Added a utility function to determine required texture size alignments.

TRAC #22422 Signed-off-by: Jamie Madill Signed-off-by: Nicolas Capens Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1913 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent fd86c2ce
...@@ -571,6 +571,40 @@ size_t ComputeBlockSizeBits(DXGI_FORMAT format) ...@@ -571,6 +571,40 @@ size_t ComputeBlockSizeBits(DXGI_FORMAT format)
} }
} }
unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format)
{
switch (format)
{
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_SNORM:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC2_UNORM:
case DXGI_FORMAT_BC2_UNORM_SRGB:
case DXGI_FORMAT_BC3_TYPELESS:
case DXGI_FORMAT_BC3_UNORM:
case DXGI_FORMAT_BC3_UNORM_SRGB:
case DXGI_FORMAT_BC5_SNORM:
case DXGI_FORMAT_BC5_TYPELESS:
case DXGI_FORMAT_BC5_UNORM:
case DXGI_FORMAT_BC6H_SF16:
case DXGI_FORMAT_BC6H_TYPELESS:
case DXGI_FORMAT_BC6H_UF16:
case DXGI_FORMAT_BC7_TYPELESS:
case DXGI_FORMAT_BC7_UNORM:
case DXGI_FORMAT_BC7_UNORM_SRGB:
return 4;
case DXGI_FORMAT_UNKNOWN:
UNREACHABLE();
return 1;
default:
return 1;
}
}
bool IsDepthStencilFormat(DXGI_FORMAT format) bool IsDepthStencilFormat(DXGI_FORMAT format)
{ {
switch (format) switch (format)
......
...@@ -71,6 +71,8 @@ void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, floa ...@@ -71,6 +71,8 @@ void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, floa
size_t ComputePixelSizeBits(DXGI_FORMAT format); size_t ComputePixelSizeBits(DXGI_FORMAT format);
size_t ComputeBlockSizeBits(DXGI_FORMAT format); size_t ComputeBlockSizeBits(DXGI_FORMAT format);
unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format);
bool IsDepthStencilFormat(DXGI_FORMAT format); bool IsDepthStencilFormat(DXGI_FORMAT format);
DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format); DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format);
DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format); DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment