Implement BC6H_UF16 & BC6H_SF16 (#1092)
* Implement BC6H_UF16 & BC6H_SF16 Require by ARMS * correct coding style * correct coding style part 2
This commit is contained in:
parent
f08d24e9c0
commit
06578e89b2
@ -121,6 +121,10 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
|
|||||||
{GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RG, GL_INT, ComponentType::SNorm, true}, // DXN2SNORM
|
{GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RG, GL_INT, ComponentType::SNorm, true}, // DXN2SNORM
|
||||||
{GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
|
{GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
|
||||||
true}, // BC7U
|
true}, // BC7U
|
||||||
|
{GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8,
|
||||||
|
ComponentType::UNorm, true}, // BC6H_UF16
|
||||||
|
{GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
|
||||||
|
true}, // BC6H_SF16
|
||||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
|
||||||
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8U
|
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8U
|
||||||
{GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // G8R8S
|
{GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // G8R8S
|
||||||
@ -210,6 +214,8 @@ static bool IsFormatBCn(PixelFormat format) {
|
|||||||
case PixelFormat::DXN2SNORM:
|
case PixelFormat::DXN2SNORM:
|
||||||
case PixelFormat::DXN2UNORM:
|
case PixelFormat::DXN2UNORM:
|
||||||
case PixelFormat::BC7U:
|
case PixelFormat::BC7U:
|
||||||
|
case PixelFormat::BC6H_UF16:
|
||||||
|
case PixelFormat::BC6H_SF16:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -266,6 +272,8 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
|
|||||||
MortonCopy<true, PixelFormat::DXN2UNORM>,
|
MortonCopy<true, PixelFormat::DXN2UNORM>,
|
||||||
MortonCopy<true, PixelFormat::DXN2SNORM>,
|
MortonCopy<true, PixelFormat::DXN2SNORM>,
|
||||||
MortonCopy<true, PixelFormat::BC7U>,
|
MortonCopy<true, PixelFormat::BC7U>,
|
||||||
|
MortonCopy<true, PixelFormat::BC6H_UF16>,
|
||||||
|
MortonCopy<true, PixelFormat::BC6H_SF16>,
|
||||||
MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
|
MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
|
||||||
MortonCopy<true, PixelFormat::G8R8U>,
|
MortonCopy<true, PixelFormat::G8R8U>,
|
||||||
MortonCopy<true, PixelFormat::G8R8S>,
|
MortonCopy<true, PixelFormat::G8R8S>,
|
||||||
@ -314,8 +322,10 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
|
|||||||
MortonCopy<false, PixelFormat::RGBA16UI>,
|
MortonCopy<false, PixelFormat::RGBA16UI>,
|
||||||
MortonCopy<false, PixelFormat::R11FG11FB10F>,
|
MortonCopy<false, PixelFormat::R11FG11FB10F>,
|
||||||
MortonCopy<false, PixelFormat::RGBA32UI>,
|
MortonCopy<false, PixelFormat::RGBA32UI>,
|
||||||
// TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/DXN2/BC7U/ASTC_2D_4X4 formats is not
|
// TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/DXN2/BC7U/BC6H_UF16/BC6H_SF16/ASTC_2D_4X4
|
||||||
// supported
|
// formats are not supported
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -45,42 +45,44 @@ struct SurfaceParams {
|
|||||||
DXN2UNORM = 17,
|
DXN2UNORM = 17,
|
||||||
DXN2SNORM = 18,
|
DXN2SNORM = 18,
|
||||||
BC7U = 19,
|
BC7U = 19,
|
||||||
ASTC_2D_4X4 = 20,
|
BC6H_UF16 = 20,
|
||||||
G8R8U = 21,
|
BC6H_SF16 = 21,
|
||||||
G8R8S = 22,
|
ASTC_2D_4X4 = 22,
|
||||||
BGRA8 = 23,
|
G8R8U = 23,
|
||||||
RGBA32F = 24,
|
G8R8S = 24,
|
||||||
RG32F = 25,
|
BGRA8 = 25,
|
||||||
R32F = 26,
|
RGBA32F = 26,
|
||||||
R16F = 27,
|
RG32F = 27,
|
||||||
R16U = 28,
|
R32F = 28,
|
||||||
R16S = 29,
|
R16F = 29,
|
||||||
R16UI = 30,
|
R16U = 30,
|
||||||
R16I = 31,
|
R16S = 31,
|
||||||
RG16 = 32,
|
R16UI = 32,
|
||||||
RG16F = 33,
|
R16I = 33,
|
||||||
RG16UI = 34,
|
RG16 = 34,
|
||||||
RG16I = 35,
|
RG16F = 35,
|
||||||
RG16S = 36,
|
RG16UI = 36,
|
||||||
RGB32F = 37,
|
RG16I = 37,
|
||||||
SRGBA8 = 38,
|
RG16S = 38,
|
||||||
RG8U = 39,
|
RGB32F = 39,
|
||||||
RG8S = 40,
|
SRGBA8 = 40,
|
||||||
RG32UI = 41,
|
RG8U = 41,
|
||||||
R32UI = 42,
|
RG8S = 42,
|
||||||
|
RG32UI = 43,
|
||||||
|
R32UI = 44,
|
||||||
|
|
||||||
MaxColorFormat,
|
MaxColorFormat,
|
||||||
|
|
||||||
// Depth formats
|
// Depth formats
|
||||||
Z32F = 43,
|
Z32F = 45,
|
||||||
Z16 = 44,
|
Z16 = 46,
|
||||||
|
|
||||||
MaxDepthFormat,
|
MaxDepthFormat,
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
Z24S8 = 45,
|
Z24S8 = 47,
|
||||||
S8Z24 = 46,
|
S8Z24 = 48,
|
||||||
Z32FS8 = 47,
|
Z32FS8 = 49,
|
||||||
|
|
||||||
MaxDepthStencilFormat,
|
MaxDepthStencilFormat,
|
||||||
|
|
||||||
@ -138,6 +140,8 @@ struct SurfaceParams {
|
|||||||
4, // DXN2UNORM
|
4, // DXN2UNORM
|
||||||
4, // DXN2SNORM
|
4, // DXN2SNORM
|
||||||
4, // BC7U
|
4, // BC7U
|
||||||
|
4, // BC6H_UF16
|
||||||
|
4, // BC6H_SF16
|
||||||
4, // ASTC_2D_4X4
|
4, // ASTC_2D_4X4
|
||||||
1, // G8R8U
|
1, // G8R8U
|
||||||
1, // G8R8S
|
1, // G8R8S
|
||||||
@ -197,6 +201,8 @@ struct SurfaceParams {
|
|||||||
128, // DXN2UNORM
|
128, // DXN2UNORM
|
||||||
128, // DXN2SNORM
|
128, // DXN2SNORM
|
||||||
128, // BC7U
|
128, // BC7U
|
||||||
|
128, // BC6H_UF16
|
||||||
|
128, // BC6H_SF16
|
||||||
32, // ASTC_2D_4X4
|
32, // ASTC_2D_4X4
|
||||||
16, // G8R8U
|
16, // G8R8U
|
||||||
16, // G8R8S
|
16, // G8R8S
|
||||||
@ -482,6 +488,10 @@ struct SurfaceParams {
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Tegra::Texture::TextureFormat::BC7U:
|
case Tegra::Texture::TextureFormat::BC7U:
|
||||||
return PixelFormat::BC7U;
|
return PixelFormat::BC7U;
|
||||||
|
case Tegra::Texture::TextureFormat::BC6H_UF16:
|
||||||
|
return PixelFormat::BC6H_UF16;
|
||||||
|
case Tegra::Texture::TextureFormat::BC6H_SF16:
|
||||||
|
return PixelFormat::BC6H_SF16;
|
||||||
case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
|
case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
|
||||||
return PixelFormat::ASTC_2D_4X4;
|
return PixelFormat::ASTC_2D_4X4;
|
||||||
case Tegra::Texture::TextureFormat::R16_G16:
|
case Tegra::Texture::TextureFormat::R16_G16:
|
||||||
|
@ -56,6 +56,8 @@ u32 BytesPerPixel(TextureFormat format) {
|
|||||||
case TextureFormat::DXT45:
|
case TextureFormat::DXT45:
|
||||||
case TextureFormat::DXN2:
|
case TextureFormat::DXN2:
|
||||||
case TextureFormat::BC7U:
|
case TextureFormat::BC7U:
|
||||||
|
case TextureFormat::BC6H_UF16:
|
||||||
|
case TextureFormat::BC6H_SF16:
|
||||||
// In this case a 'pixel' actually refers to a 4x4 tile.
|
// In this case a 'pixel' actually refers to a 4x4 tile.
|
||||||
return 16;
|
return 16;
|
||||||
case TextureFormat::R32_G32_B32:
|
case TextureFormat::R32_G32_B32:
|
||||||
@ -106,6 +108,8 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
|
|||||||
case TextureFormat::DXN1:
|
case TextureFormat::DXN1:
|
||||||
case TextureFormat::DXN2:
|
case TextureFormat::DXN2:
|
||||||
case TextureFormat::BC7U:
|
case TextureFormat::BC7U:
|
||||||
|
case TextureFormat::BC6H_UF16:
|
||||||
|
case TextureFormat::BC6H_SF16:
|
||||||
case TextureFormat::ASTC_2D_4X4:
|
case TextureFormat::ASTC_2D_4X4:
|
||||||
case TextureFormat::A8R8G8B8:
|
case TextureFormat::A8R8G8B8:
|
||||||
case TextureFormat::A2B10G10R10:
|
case TextureFormat::A2B10G10R10:
|
||||||
|
Loading…
Reference in New Issue
Block a user