Implement R8_UINT RenderTargetFormat & PixelFormat
used by Go Vacation
This commit is contained in:
@@ -44,6 +44,9 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
|
||||
case RenderTargetFormat::R32_FLOAT:
|
||||
case RenderTargetFormat::R11G11B10_FLOAT:
|
||||
return 4;
|
||||
case RenderTargetFormat::R8_UNORM:
|
||||
case RenderTargetFormat::R8_UINT:
|
||||
return 1;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ enum class RenderTargetFormat : u32 {
|
||||
B5G6R5_UNORM = 0xE8,
|
||||
R16_FLOAT = 0xF2,
|
||||
R8_UNORM = 0xF3,
|
||||
R8_UINT = 0xF6,
|
||||
};
|
||||
|
||||
enum class DepthFormat : u32 {
|
||||
|
||||
@@ -98,6 +98,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
|
||||
false}, // A2B10G10R10
|
||||
{GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5
|
||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8
|
||||
{GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // R8UI
|
||||
{GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F
|
||||
{GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float,
|
||||
false}, // R11FG11FB10F
|
||||
@@ -228,24 +229,24 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, std::vector<u8>& gl_bu
|
||||
static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),
|
||||
SurfaceParams::MaxPixelFormat>
|
||||
morton_to_gl_fns = {
|
||||
MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>,
|
||||
MortonCopy<true, PixelFormat::R8>, MortonCopy<true, PixelFormat::RGBA16F>,
|
||||
MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>,
|
||||
MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
|
||||
MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
|
||||
MortonCopy<true, PixelFormat::DXN2UNORM>, MortonCopy<true, PixelFormat::DXN2SNORM>,
|
||||
MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
|
||||
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
|
||||
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
|
||||
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
|
||||
MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>,
|
||||
MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>,
|
||||
MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>,
|
||||
MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>,
|
||||
MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
|
||||
MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
|
||||
MortonCopy<true, PixelFormat::Z32FS8>,
|
||||
MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>,
|
||||
MortonCopy<true, PixelFormat::R8>, MortonCopy<true, PixelFormat::R8UI>,
|
||||
MortonCopy<true, PixelFormat::RGBA16F>, MortonCopy<true, PixelFormat::R11FG11FB10F>,
|
||||
MortonCopy<true, PixelFormat::RGBA32UI>, MortonCopy<true, PixelFormat::DXT1>,
|
||||
MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>,
|
||||
MortonCopy<true, PixelFormat::DXN1>, MortonCopy<true, PixelFormat::DXN2UNORM>,
|
||||
MortonCopy<true, PixelFormat::DXN2SNORM>, MortonCopy<true, PixelFormat::BC7U>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::G8R8>,
|
||||
MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::RGBA32F>,
|
||||
MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::R32F>,
|
||||
MortonCopy<true, PixelFormat::R16F>, MortonCopy<true, PixelFormat::R16UNORM>,
|
||||
MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>,
|
||||
MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>,
|
||||
MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>,
|
||||
MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>,
|
||||
MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
|
||||
MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
|
||||
};
|
||||
|
||||
static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),
|
||||
@@ -256,6 +257,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
|
||||
MortonCopy<false, PixelFormat::A2B10G10R10>,
|
||||
MortonCopy<false, PixelFormat::A1B5G5R5>,
|
||||
MortonCopy<false, PixelFormat::R8>,
|
||||
MortonCopy<false, PixelFormat::R8UI>,
|
||||
MortonCopy<false, PixelFormat::RGBA16F>,
|
||||
MortonCopy<false, PixelFormat::R11FG11FB10F>,
|
||||
MortonCopy<false, PixelFormat::RGBA32UI>,
|
||||
|
||||
@@ -28,40 +28,41 @@ struct SurfaceParams {
|
||||
A2B10G10R10 = 2,
|
||||
A1B5G5R5 = 3,
|
||||
R8 = 4,
|
||||
RGBA16F = 5,
|
||||
R11FG11FB10F = 6,
|
||||
RGBA32UI = 7,
|
||||
DXT1 = 8,
|
||||
DXT23 = 9,
|
||||
DXT45 = 10,
|
||||
DXN1 = 11, // This is also known as BC4
|
||||
DXN2UNORM = 12,
|
||||
DXN2SNORM = 13,
|
||||
BC7U = 14,
|
||||
ASTC_2D_4X4 = 15,
|
||||
G8R8 = 16,
|
||||
BGRA8 = 17,
|
||||
RGBA32F = 18,
|
||||
RG32F = 19,
|
||||
R32F = 20,
|
||||
R16F = 21,
|
||||
R16UNORM = 22,
|
||||
RG16 = 23,
|
||||
RG16F = 24,
|
||||
RG16UI = 25,
|
||||
RG16I = 26,
|
||||
RG16S = 27,
|
||||
RGB32F = 28,
|
||||
SRGBA8 = 29,
|
||||
R8UI = 5,
|
||||
RGBA16F = 6,
|
||||
R11FG11FB10F = 7,
|
||||
RGBA32UI = 8,
|
||||
DXT1 = 9,
|
||||
DXT23 = 10,
|
||||
DXT45 = 11,
|
||||
DXN1 = 12, // This is also known as BC4
|
||||
DXN2UNORM = 13,
|
||||
DXN2SNORM = 14,
|
||||
BC7U = 15,
|
||||
ASTC_2D_4X4 = 16,
|
||||
G8R8 = 17,
|
||||
BGRA8 = 18,
|
||||
RGBA32F = 19,
|
||||
RG32F = 20,
|
||||
R32F = 21,
|
||||
R16F = 22,
|
||||
R16UNORM = 23,
|
||||
RG16 = 24,
|
||||
RG16F = 25,
|
||||
RG16UI = 26,
|
||||
RG16I = 27,
|
||||
RG16S = 28,
|
||||
RGB32F = 29,
|
||||
SRGBA8 = 30,
|
||||
|
||||
MaxColorFormat,
|
||||
|
||||
// DepthStencil formats
|
||||
Z24S8 = 30,
|
||||
S8Z24 = 31,
|
||||
Z32F = 32,
|
||||
Z16 = 33,
|
||||
Z32FS8 = 34,
|
||||
Z24S8 = 31,
|
||||
S8Z24 = 32,
|
||||
Z32F = 33,
|
||||
Z16 = 34,
|
||||
Z32FS8 = 35,
|
||||
|
||||
MaxDepthStencilFormat,
|
||||
|
||||
@@ -104,6 +105,7 @@ struct SurfaceParams {
|
||||
1, // A2B10G10R10
|
||||
1, // A1B5G5R5
|
||||
1, // R8
|
||||
1, // R8UI
|
||||
1, // RGBA16F
|
||||
1, // R11FG11FB10F
|
||||
1, // RGBA32UI
|
||||
@@ -150,6 +152,7 @@ struct SurfaceParams {
|
||||
32, // A2B10G10R10
|
||||
16, // A1B5G5R5
|
||||
8, // R8
|
||||
8, // R8UI
|
||||
64, // RGBA16F
|
||||
32, // R11FG11FB10F
|
||||
128, // RGBA32UI
|
||||
@@ -233,6 +236,8 @@ struct SurfaceParams {
|
||||
return PixelFormat::RGBA32UI;
|
||||
case Tegra::RenderTargetFormat::R8_UNORM:
|
||||
return PixelFormat::R8;
|
||||
case Tegra::RenderTargetFormat::R8_UINT:
|
||||
return PixelFormat::R8UI;
|
||||
case Tegra::RenderTargetFormat::RG16_FLOAT:
|
||||
return PixelFormat::RG16F;
|
||||
case Tegra::RenderTargetFormat::RG16_UINT:
|
||||
@@ -266,7 +271,15 @@ struct SurfaceParams {
|
||||
case Tegra::Texture::TextureFormat::A1B5G5R5:
|
||||
return PixelFormat::A1B5G5R5;
|
||||
case Tegra::Texture::TextureFormat::R8:
|
||||
return PixelFormat::R8;
|
||||
switch (component_type) {
|
||||
case Tegra::Texture::ComponentType::UNORM:
|
||||
return PixelFormat::R8;
|
||||
case Tegra::Texture::ComponentType::UINT:
|
||||
return PixelFormat::R8UI;
|
||||
}
|
||||
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
|
||||
static_cast<u32>(component_type));
|
||||
UNREACHABLE();
|
||||
case Tegra::Texture::TextureFormat::G8R8:
|
||||
return PixelFormat::G8R8;
|
||||
case Tegra::Texture::TextureFormat::R16_G16_B16_A16:
|
||||
@@ -390,6 +403,7 @@ struct SurfaceParams {
|
||||
return ComponentType::Float;
|
||||
case Tegra::RenderTargetFormat::RGBA32_UINT:
|
||||
case Tegra::RenderTargetFormat::RG16_UINT:
|
||||
case Tegra::RenderTargetFormat::R8_UINT:
|
||||
return ComponentType::UInt;
|
||||
case Tegra::RenderTargetFormat::RG16_SINT:
|
||||
return ComponentType::SInt;
|
||||
|
||||
Reference in New Issue
Block a user