3
0
Fork 0
forked from suyu/suyu

texture: Implement R8G8UI

- Used by The Walking Dead: The Final Season
This commit is contained in:
Morph 2020-04-30 12:17:02 -04:00
parent 3e9cafbee5
commit 7909860d16
8 changed files with 52 additions and 38 deletions

View file

@ -68,6 +68,7 @@ enum class RenderTargetFormat : u32 {
BGR5A1_UNORM = 0xE9, BGR5A1_UNORM = 0xE9,
RG8_UNORM = 0xEA, RG8_UNORM = 0xEA,
RG8_SNORM = 0xEB, RG8_SNORM = 0xEB,
RG8_UINT = 0xED,
R16_UNORM = 0xEE, R16_UNORM = 0xEE,
R16_SNORM = 0xEF, R16_SNORM = 0xEF,
R16_SINT = 0xF0, R16_SINT = 0xF0,

View file

@ -83,6 +83,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::RGBA8_SRGB>, MortonCopy<true, PixelFormat::RGBA8_SRGB>,
MortonCopy<true, PixelFormat::RG8U>, MortonCopy<true, PixelFormat::RG8U>,
MortonCopy<true, PixelFormat::RG8S>, MortonCopy<true, PixelFormat::RG8S>,
MortonCopy<true, PixelFormat::RG8UI>,
MortonCopy<true, PixelFormat::RG32UI>, MortonCopy<true, PixelFormat::RG32UI>,
MortonCopy<true, PixelFormat::RGBX16F>, MortonCopy<true, PixelFormat::RGBX16F>,
MortonCopy<true, PixelFormat::R32UI>, MortonCopy<true, PixelFormat::R32UI>,
@ -166,6 +167,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::RGBA8_SRGB>, MortonCopy<false, PixelFormat::RGBA8_SRGB>,
MortonCopy<false, PixelFormat::RG8U>, MortonCopy<false, PixelFormat::RG8U>,
MortonCopy<false, PixelFormat::RG8S>, MortonCopy<false, PixelFormat::RG8S>,
MortonCopy<false, PixelFormat::RG8UI>,
MortonCopy<false, PixelFormat::RG32UI>, MortonCopy<false, PixelFormat::RG32UI>,
MortonCopy<false, PixelFormat::RGBX16F>, MortonCopy<false, PixelFormat::RGBX16F>,
MortonCopy<false, PixelFormat::R32UI>, MortonCopy<false, PixelFormat::R32UI>,

View file

@ -83,6 +83,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U
{GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S {GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S
{GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG8UI
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI
{GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI

View file

@ -160,6 +160,7 @@ struct FormatTuple {
{VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB {VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB
{VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U {VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U
{VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S {VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S
{VK_FORMAT_R8G8_UINT, Attachable | Storage}, // RG8UI
{VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI {VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI
{VK_FORMAT_UNDEFINED}, // RGBX16F {VK_FORMAT_UNDEFINED}, // RGBX16F
{VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI {VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI

View file

@ -95,6 +95,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
VK_FORMAT_R8G8B8A8_SRGB, VK_FORMAT_R8G8B8A8_SRGB,
VK_FORMAT_R8G8_UNORM, VK_FORMAT_R8G8_UNORM,
VK_FORMAT_R8G8_SNORM, VK_FORMAT_R8G8_SNORM,
VK_FORMAT_R8G8_UINT,
VK_FORMAT_R8_UNORM, VK_FORMAT_R8_UNORM,
VK_FORMAT_R8_UINT, VK_FORMAT_R8_UINT,
VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_B10G11R11_UFLOAT_PACK32,

View file

@ -145,6 +145,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
return PixelFormat::RG8U; return PixelFormat::RG8U;
case Tegra::RenderTargetFormat::RG8_SNORM: case Tegra::RenderTargetFormat::RG8_SNORM:
return PixelFormat::RG8S; return PixelFormat::RG8S;
case Tegra::RenderTargetFormat::RG8_UINT:
return PixelFormat::RG8UI;
case Tegra::RenderTargetFormat::R16_FLOAT: case Tegra::RenderTargetFormat::R16_FLOAT:
return PixelFormat::R16F; return PixelFormat::R16F;
case Tegra::RenderTargetFormat::R16_UNORM: case Tegra::RenderTargetFormat::R16_UNORM:

View file

@ -57,51 +57,52 @@ enum class PixelFormat {
RGBA8_SRGB = 39, RGBA8_SRGB = 39,
RG8U = 40, RG8U = 40,
RG8S = 41, RG8S = 41,
RG32UI = 42, RG8UI = 42,
RGBX16F = 43, RG32UI = 43,
R32UI = 44, RGBX16F = 44,
R32I = 45, R32UI = 45,
ASTC_2D_8X8 = 46, R32I = 46,
ASTC_2D_8X5 = 47, ASTC_2D_8X8 = 47,
ASTC_2D_5X4 = 48, ASTC_2D_8X5 = 48,
BGRA8_SRGB = 49, ASTC_2D_5X4 = 49,
DXT1_SRGB = 50, BGRA8_SRGB = 50,
DXT23_SRGB = 51, DXT1_SRGB = 51,
DXT45_SRGB = 52, DXT23_SRGB = 52,
BC7U_SRGB = 53, DXT45_SRGB = 53,
R4G4B4A4U = 54, BC7U_SRGB = 54,
ASTC_2D_4X4_SRGB = 55, R4G4B4A4U = 55,
ASTC_2D_8X8_SRGB = 56, ASTC_2D_4X4_SRGB = 56,
ASTC_2D_8X5_SRGB = 57, ASTC_2D_8X8_SRGB = 57,
ASTC_2D_5X4_SRGB = 58, ASTC_2D_8X5_SRGB = 58,
ASTC_2D_5X5 = 59, ASTC_2D_5X4_SRGB = 59,
ASTC_2D_5X5_SRGB = 60, ASTC_2D_5X5 = 60,
ASTC_2D_10X8 = 61, ASTC_2D_5X5_SRGB = 61,
ASTC_2D_10X8_SRGB = 62, ASTC_2D_10X8 = 62,
ASTC_2D_6X6 = 63, ASTC_2D_10X8_SRGB = 63,
ASTC_2D_6X6_SRGB = 64, ASTC_2D_6X6 = 64,
ASTC_2D_10X10 = 65, ASTC_2D_6X6_SRGB = 65,
ASTC_2D_10X10_SRGB = 66, ASTC_2D_10X10 = 66,
ASTC_2D_12X12 = 67, ASTC_2D_10X10_SRGB = 67,
ASTC_2D_12X12_SRGB = 68, ASTC_2D_12X12 = 68,
ASTC_2D_8X6 = 69, ASTC_2D_12X12_SRGB = 69,
ASTC_2D_8X6_SRGB = 70, ASTC_2D_8X6 = 70,
ASTC_2D_6X5 = 71, ASTC_2D_8X6_SRGB = 71,
ASTC_2D_6X5_SRGB = 72, ASTC_2D_6X5 = 72,
E5B9G9R9F = 73, ASTC_2D_6X5_SRGB = 73,
E5B9G9R9F = 74,
MaxColorFormat, MaxColorFormat,
// Depth formats // Depth formats
Z32F = 74, Z32F = 75,
Z16 = 75, Z16 = 76,
MaxDepthFormat, MaxDepthFormat,
// DepthStencil formats // DepthStencil formats
Z24S8 = 76, Z24S8 = 77,
S8Z24 = 77, S8Z24 = 78,
Z32FS8 = 78, Z32FS8 = 79,
MaxDepthStencilFormat, MaxDepthStencilFormat,
@ -171,6 +172,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
0, // RGBA8_SRGB 0, // RGBA8_SRGB
0, // RG8U 0, // RG8U
0, // RG8S 0, // RG8S
0, // RG8UI
0, // RG32UI 0, // RG32UI
0, // RGBX16F 0, // RGBX16F
0, // R32UI 0, // R32UI
@ -269,6 +271,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
1, // RGBA8_SRGB 1, // RGBA8_SRGB
1, // RG8U 1, // RG8U
1, // RG8S 1, // RG8S
1, // RG8UI
1, // RG32UI 1, // RG32UI
1, // RGBX16F 1, // RGBX16F
1, // R32UI 1, // R32UI
@ -359,6 +362,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
1, // RGBA8_SRGB 1, // RGBA8_SRGB
1, // RG8U 1, // RG8U
1, // RG8S 1, // RG8S
1, // RG8UI
1, // RG32UI 1, // RG32UI
1, // RGBX16F 1, // RGBX16F
1, // R32UI 1, // R32UI
@ -449,6 +453,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
32, // RGBA8_SRGB 32, // RGBA8_SRGB
16, // RG8U 16, // RG8U
16, // RG8S 16, // RG8S
16, // RG8UI
64, // RG32UI 64, // RG32UI
64, // RGBX16F 64, // RGBX16F
32, // R32UI 32, // R32UI

View file

@ -41,7 +41,7 @@ struct Table {
ComponentType alpha_component; ComponentType alpha_component;
bool is_srgb; bool is_srgb;
}; };
constexpr std::array<Table, 76> DefinitionTable = {{ constexpr std::array<Table, 77> DefinitionTable = {{
{TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U}, {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U},
{TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S}, {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S},
{TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI}, {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI},
@ -60,6 +60,7 @@ constexpr std::array<Table, 76> DefinitionTable = {{
{TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U}, {TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U},
{TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S}, {TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S},
{TextureFormat::G8R8, C, UINT, UINT, UINT, UINT, PixelFormat::RG8UI},
{TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S}, {TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S},
{TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U}, {TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U},