Add PixelFormatExtensions::ComputeBlockSize
This commit is contained in:
@@ -660,6 +660,37 @@ int PixelFormatExtensions::ComputeComponentsCount(const PixelFormat format)
|
||||
}
|
||||
}
|
||||
|
||||
int32 PixelFormatExtensions::ComputeBlockSize(PixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormat::BC1_Typeless:
|
||||
case PixelFormat::BC1_UNorm:
|
||||
case PixelFormat::BC1_UNorm_sRGB:
|
||||
case PixelFormat::BC2_Typeless:
|
||||
case PixelFormat::BC2_UNorm:
|
||||
case PixelFormat::BC2_UNorm_sRGB:
|
||||
case PixelFormat::BC3_Typeless:
|
||||
case PixelFormat::BC3_UNorm:
|
||||
case PixelFormat::BC3_UNorm_sRGB:
|
||||
case PixelFormat::BC4_Typeless:
|
||||
case PixelFormat::BC4_UNorm:
|
||||
case PixelFormat::BC4_SNorm:
|
||||
case PixelFormat::BC5_Typeless:
|
||||
case PixelFormat::BC5_UNorm:
|
||||
case PixelFormat::BC5_SNorm:
|
||||
case PixelFormat::BC6H_Typeless:
|
||||
case PixelFormat::BC6H_Uf16:
|
||||
case PixelFormat::BC6H_Sf16:
|
||||
case PixelFormat::BC7_Typeless:
|
||||
case PixelFormat::BC7_UNorm:
|
||||
case PixelFormat::BC7_UNorm_sRGB:
|
||||
return 4;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
PixelFormat PixelFormatExtensions::TosRGB(const PixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
|
||||
@@ -173,6 +173,13 @@ public:
|
||||
/// <returns>The components count.</returns>
|
||||
API_FUNCTION() static int ComputeComponentsCount(PixelFormat format);
|
||||
|
||||
/// <summary>
|
||||
/// Computes the amount of pixels per-axis stored in the a single block of the format (eg. 4 for BC-family). Returns 1 for uncompressed formats.
|
||||
/// </summary>
|
||||
/// <param name="format">The <see cref="PixelFormat"/>.</param>
|
||||
/// <returns>The block pixels count.</returns>
|
||||
API_FUNCTION() static int32 ComputeBlockSize(PixelFormat format);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the equivalent sRGB format to the provided format.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user