GPU: Implemented the R16 and R16F texture formats.
This commit is contained in:
parent
316c994f55
commit
4cc1e180ec
3 changed files with 32 additions and 5 deletions
|
@ -111,6 +111,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
|
||||||
{GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
|
{GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
|
||||||
{GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
|
{GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
|
||||||
{GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
|
{GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
|
||||||
|
{GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
|
||||||
|
{GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
|
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
|
||||||
|
@ -204,7 +206,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
|
||||||
MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
|
MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
|
||||||
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
|
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
|
||||||
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
|
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
|
||||||
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>,
|
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
|
||||||
|
MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>,
|
||||||
MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
|
MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
|
||||||
MortonCopy<true, PixelFormat::Z16>,
|
MortonCopy<true, PixelFormat::Z16>,
|
||||||
};
|
};
|
||||||
|
@ -232,6 +235,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
|
||||||
MortonCopy<false, PixelFormat::RGBA32F>,
|
MortonCopy<false, PixelFormat::RGBA32F>,
|
||||||
MortonCopy<false, PixelFormat::RG32F>,
|
MortonCopy<false, PixelFormat::RG32F>,
|
||||||
MortonCopy<false, PixelFormat::R32F>,
|
MortonCopy<false, PixelFormat::R32F>,
|
||||||
|
MortonCopy<false, PixelFormat::R16F>,
|
||||||
|
MortonCopy<false, PixelFormat::R16UNORM>,
|
||||||
MortonCopy<false, PixelFormat::Z24S8>,
|
MortonCopy<false, PixelFormat::Z24S8>,
|
||||||
MortonCopy<false, PixelFormat::S8Z24>,
|
MortonCopy<false, PixelFormat::S8Z24>,
|
||||||
MortonCopy<false, PixelFormat::Z32F>,
|
MortonCopy<false, PixelFormat::Z32F>,
|
||||||
|
|
|
@ -41,14 +41,16 @@ struct SurfaceParams {
|
||||||
RGBA32F = 16,
|
RGBA32F = 16,
|
||||||
RG32F = 17,
|
RG32F = 17,
|
||||||
R32F = 18,
|
R32F = 18,
|
||||||
|
R16F = 19,
|
||||||
|
R16UNORM = 20,
|
||||||
|
|
||||||
MaxColorFormat,
|
MaxColorFormat,
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
Z24S8 = 19,
|
Z24S8 = 21,
|
||||||
S8Z24 = 20,
|
S8Z24 = 22,
|
||||||
Z32F = 21,
|
Z32F = 23,
|
||||||
Z16 = 22,
|
Z16 = 24,
|
||||||
|
|
||||||
MaxDepthStencilFormat,
|
MaxDepthStencilFormat,
|
||||||
|
|
||||||
|
@ -105,6 +107,8 @@ struct SurfaceParams {
|
||||||
1, // RGBA32F
|
1, // RGBA32F
|
||||||
1, // RG32F
|
1, // RG32F
|
||||||
1, // R32F
|
1, // R32F
|
||||||
|
1, // R16F
|
||||||
|
1, // R16UNORM
|
||||||
1, // Z24S8
|
1, // Z24S8
|
||||||
1, // S8Z24
|
1, // S8Z24
|
||||||
1, // Z32F
|
1, // Z32F
|
||||||
|
@ -139,6 +143,8 @@ struct SurfaceParams {
|
||||||
128, // RGBA32F
|
128, // RGBA32F
|
||||||
64, // RG32F
|
64, // RG32F
|
||||||
32, // R32F
|
32, // R32F
|
||||||
|
16, // R16F
|
||||||
|
16, // R16UNORM
|
||||||
32, // Z24S8
|
32, // Z24S8
|
||||||
32, // S8Z24
|
32, // S8Z24
|
||||||
32, // Z32F
|
32, // Z32F
|
||||||
|
@ -226,6 +232,16 @@ struct SurfaceParams {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Tegra::Texture::TextureFormat::R32_G32:
|
case Tegra::Texture::TextureFormat::R32_G32:
|
||||||
return PixelFormat::RG32F;
|
return PixelFormat::RG32F;
|
||||||
|
case Tegra::Texture::TextureFormat::R16:
|
||||||
|
switch (component_type) {
|
||||||
|
case Tegra::Texture::ComponentType::FLOAT:
|
||||||
|
return PixelFormat::R16F;
|
||||||
|
case Tegra::Texture::ComponentType::UNORM:
|
||||||
|
return PixelFormat::R16UNORM;
|
||||||
|
}
|
||||||
|
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
|
||||||
|
static_cast<u32>(component_type));
|
||||||
|
UNREACHABLE();
|
||||||
case Tegra::Texture::TextureFormat::R32:
|
case Tegra::Texture::TextureFormat::R32:
|
||||||
return PixelFormat::R32F;
|
return PixelFormat::R32F;
|
||||||
case Tegra::Texture::TextureFormat::DXT1:
|
case Tegra::Texture::TextureFormat::DXT1:
|
||||||
|
@ -290,6 +306,9 @@ struct SurfaceParams {
|
||||||
return Tegra::Texture::TextureFormat::R32_G32;
|
return Tegra::Texture::TextureFormat::R32_G32;
|
||||||
case PixelFormat::R32F:
|
case PixelFormat::R32F:
|
||||||
return Tegra::Texture::TextureFormat::R32;
|
return Tegra::Texture::TextureFormat::R32;
|
||||||
|
case PixelFormat::R16F:
|
||||||
|
case PixelFormat::R16UNORM:
|
||||||
|
return Tegra::Texture::TextureFormat::R16;
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
|
@ -66,6 +66,7 @@ u32 BytesPerPixel(TextureFormat format) {
|
||||||
case TextureFormat::A1B5G5R5:
|
case TextureFormat::A1B5G5R5:
|
||||||
case TextureFormat::B5G6R5:
|
case TextureFormat::B5G6R5:
|
||||||
case TextureFormat::G8R8:
|
case TextureFormat::G8R8:
|
||||||
|
case TextureFormat::R16:
|
||||||
return 2;
|
return 2;
|
||||||
case TextureFormat::R8:
|
case TextureFormat::R8:
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -123,6 +124,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
|
||||||
case TextureFormat::R32_G32_B32_A32:
|
case TextureFormat::R32_G32_B32_A32:
|
||||||
case TextureFormat::R32_G32:
|
case TextureFormat::R32_G32:
|
||||||
case TextureFormat::R32:
|
case TextureFormat::R32:
|
||||||
|
case TextureFormat::R16:
|
||||||
case TextureFormat::BF10GF11RF11:
|
case TextureFormat::BF10GF11RF11:
|
||||||
case TextureFormat::ASTC_2D_4X4:
|
case TextureFormat::ASTC_2D_4X4:
|
||||||
CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
|
CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
|
||||||
|
@ -181,6 +183,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
|
||||||
case TextureFormat::R32_G32_B32_A32:
|
case TextureFormat::R32_G32_B32_A32:
|
||||||
case TextureFormat::R32_G32:
|
case TextureFormat::R32_G32:
|
||||||
case TextureFormat::R32:
|
case TextureFormat::R32:
|
||||||
|
case TextureFormat::R16:
|
||||||
// TODO(Subv): For the time being just forward the same data without any decoding.
|
// TODO(Subv): For the time being just forward the same data without any decoding.
|
||||||
rgba_data = texture_data;
|
rgba_data = texture_data;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue