video_core: Implement RGBA16_SNORM

Implement RGBA16_SNORM with the current API. Nothing special here.
This commit is contained in:
ReinUsesLisp 2020-03-12 21:42:33 -03:00
parent ca2d228c9d
commit 4dcca90ef4
8 changed files with 84 additions and 69 deletions

View file

@ -39,6 +39,7 @@ enum class RenderTargetFormat : u32 {
RGBA32_FLOAT = 0xC0,
RGBA32_UINT = 0xC2,
RGBA16_UNORM = 0xC6,
RGBA16_SNORM = 0xC7,
RGBA16_UINT = 0xC9,
RGBA16_FLOAT = 0xCA,
RG32_FLOAT = 0xCB,

View file

@ -51,6 +51,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::R8UI>,
MortonCopy<true, PixelFormat::RGBA16F>,
MortonCopy<true, PixelFormat::RGBA16U>,
MortonCopy<true, PixelFormat::RGBA16S>,
MortonCopy<true, PixelFormat::RGBA16UI>,
MortonCopy<true, PixelFormat::R11FG11FB10F>,
MortonCopy<true, PixelFormat::RGBA32UI>,
@ -131,6 +132,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::R8U>,
MortonCopy<false, PixelFormat::R8UI>,
MortonCopy<false, PixelFormat::RGBA16F>,
MortonCopy<false, PixelFormat::RGBA16S>,
MortonCopy<false, PixelFormat::RGBA16U>,
MortonCopy<false, PixelFormat::RGBA16UI>,
MortonCopy<false, PixelFormat::R11FG11FB10F>,

View file

@ -53,6 +53,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, false}, // R8UI
{GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, false}, // RGBA16F
{GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, false}, // RGBA16U
{GL_RGBA16_SNORM, GL_RGBA, GL_SHORT, false}, // RGBA16S
{GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, false}, // RGBA16UI
{GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, false}, // R11FG11FB10F
{GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, false}, // RGBA32UI

View file

@ -125,6 +125,7 @@ struct FormatTuple {
{vk::Format::eR8Uint, Attachable | Storage}, // R8UI
{vk::Format::eR16G16B16A16Sfloat, Attachable | Storage}, // RGBA16F
{vk::Format::eR16G16B16A16Unorm, Attachable | Storage}, // RGBA16U
{vk::Format::eR16G16B16A16Snorm, Attachable | Storage}, // RGBA16S
{vk::Format::eR16G16B16A16Uint, Attachable | Storage}, // RGBA16UI
{vk::Format::eB10G11R11UfloatPack32, Attachable | Storage}, // R11FG11FB10F
{vk::Format::eR32G32B32A32Uint, Attachable | Storage}, // RGBA32UI

View file

@ -510,6 +510,7 @@ std::unordered_map<vk::Format, vk::FormatProperties> VKDevice::GetFormatProperti
vk::Format::eR32G32Sfloat,
vk::Format::eR32G32Uint,
vk::Format::eR16G16B16A16Uint,
vk::Format::eR16G16B16A16Snorm,
vk::Format::eR16G16B16A16Unorm,
vk::Format::eR16G16Unorm,
vk::Format::eR16G16Snorm,

View file

@ -111,6 +111,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
return PixelFormat::RGBA16F;
case Tegra::RenderTargetFormat::RGBA16_UNORM:
return PixelFormat::RGBA16U;
case Tegra::RenderTargetFormat::RGBA16_SNORM:
return PixelFormat::RGBA16S;
case Tegra::RenderTargetFormat::RGBA16_UINT:
return PixelFormat::RGBA16UI;
case Tegra::RenderTargetFormat::RGBA32_FLOAT:

View file

@ -25,82 +25,83 @@ enum class PixelFormat {
R8UI = 7,
RGBA16F = 8,
RGBA16U = 9,
RGBA16UI = 10,
R11FG11FB10F = 11,
RGBA32UI = 12,
DXT1 = 13,
DXT23 = 14,
DXT45 = 15,
DXN1 = 16, // This is also known as BC4
DXN2UNORM = 17,
DXN2SNORM = 18,
BC7U = 19,
BC6H_UF16 = 20,
BC6H_SF16 = 21,
ASTC_2D_4X4 = 22,
BGRA8 = 23,
RGBA32F = 24,
RG32F = 25,
R32F = 26,
R16F = 27,
R16U = 28,
R16S = 29,
R16UI = 30,
R16I = 31,
RG16 = 32,
RG16F = 33,
RG16UI = 34,
RG16I = 35,
RG16S = 36,
RGB32F = 37,
RGBA8_SRGB = 38,
RG8U = 39,
RG8S = 40,
RG32UI = 41,
RGBX16F = 42,
R32UI = 43,
R32I = 44,
ASTC_2D_8X8 = 45,
ASTC_2D_8X5 = 46,
ASTC_2D_5X4 = 47,
BGRA8_SRGB = 48,
DXT1_SRGB = 49,
DXT23_SRGB = 50,
DXT45_SRGB = 51,
BC7U_SRGB = 52,
R4G4B4A4U = 53,
ASTC_2D_4X4_SRGB = 54,
ASTC_2D_8X8_SRGB = 55,
ASTC_2D_8X5_SRGB = 56,
ASTC_2D_5X4_SRGB = 57,
ASTC_2D_5X5 = 58,
ASTC_2D_5X5_SRGB = 59,
ASTC_2D_10X8 = 60,
ASTC_2D_10X8_SRGB = 61,
ASTC_2D_6X6 = 62,
ASTC_2D_6X6_SRGB = 63,
ASTC_2D_10X10 = 64,
ASTC_2D_10X10_SRGB = 65,
ASTC_2D_12X12 = 66,
ASTC_2D_12X12_SRGB = 67,
ASTC_2D_8X6 = 68,
ASTC_2D_8X6_SRGB = 69,
ASTC_2D_6X5 = 70,
ASTC_2D_6X5_SRGB = 71,
E5B9G9R9F = 72,
RGBA16S = 10,
RGBA16UI = 11,
R11FG11FB10F = 12,
RGBA32UI = 13,
DXT1 = 14,
DXT23 = 15,
DXT45 = 16,
DXN1 = 17, // This is also known as BC4
DXN2UNORM = 18,
DXN2SNORM = 19,
BC7U = 20,
BC6H_UF16 = 21,
BC6H_SF16 = 22,
ASTC_2D_4X4 = 23,
BGRA8 = 24,
RGBA32F = 25,
RG32F = 26,
R32F = 27,
R16F = 28,
R16U = 29,
R16S = 30,
R16UI = 31,
R16I = 32,
RG16 = 33,
RG16F = 34,
RG16UI = 35,
RG16I = 36,
RG16S = 37,
RGB32F = 38,
RGBA8_SRGB = 39,
RG8U = 40,
RG8S = 41,
RG32UI = 42,
RGBX16F = 43,
R32UI = 44,
R32I = 45,
ASTC_2D_8X8 = 46,
ASTC_2D_8X5 = 47,
ASTC_2D_5X4 = 48,
BGRA8_SRGB = 49,
DXT1_SRGB = 50,
DXT23_SRGB = 51,
DXT45_SRGB = 52,
BC7U_SRGB = 53,
R4G4B4A4U = 54,
ASTC_2D_4X4_SRGB = 55,
ASTC_2D_8X8_SRGB = 56,
ASTC_2D_8X5_SRGB = 57,
ASTC_2D_5X4_SRGB = 58,
ASTC_2D_5X5 = 59,
ASTC_2D_5X5_SRGB = 60,
ASTC_2D_10X8 = 61,
ASTC_2D_10X8_SRGB = 62,
ASTC_2D_6X6 = 63,
ASTC_2D_6X6_SRGB = 64,
ASTC_2D_10X10 = 65,
ASTC_2D_10X10_SRGB = 66,
ASTC_2D_12X12 = 67,
ASTC_2D_12X12_SRGB = 68,
ASTC_2D_8X6 = 69,
ASTC_2D_8X6_SRGB = 70,
ASTC_2D_6X5 = 71,
ASTC_2D_6X5_SRGB = 72,
E5B9G9R9F = 73,
MaxColorFormat,
// Depth formats
Z32F = 73,
Z16 = 74,
Z32F = 74,
Z16 = 75,
MaxDepthFormat,
// DepthStencil formats
Z24S8 = 75,
S8Z24 = 76,
Z32FS8 = 77,
Z24S8 = 76,
S8Z24 = 77,
Z32FS8 = 78,
MaxDepthStencilFormat,
@ -138,6 +139,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
0, // R8UI
0, // RGBA16F
0, // RGBA16U
0, // RGBA16S
0, // RGBA16UI
0, // R11FG11FB10F
0, // RGBA32UI
@ -235,6 +237,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
1, // R8UI
1, // RGBA16F
1, // RGBA16U
1, // RGBA16S
1, // RGBA16UI
1, // R11FG11FB10F
1, // RGBA32UI
@ -324,6 +327,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
1, // R8UI
1, // RGBA16F
1, // RGBA16U
1, // RGBA16S
1, // RGBA16UI
1, // R11FG11FB10F
1, // RGBA32UI
@ -413,6 +417,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
8, // R8UI
64, // RGBA16F
64, // RGBA16U
64, // RGBA16S
64, // RGBA16UI
32, // R11FG11FB10F
128, // RGBA32UI
@ -517,6 +522,7 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
SurfaceCompression::None, // R8UI
SurfaceCompression::None, // RGBA16F
SurfaceCompression::None, // RGBA16U
SurfaceCompression::None, // RGBA16S
SurfaceCompression::None, // RGBA16UI
SurfaceCompression::None, // R11FG11FB10F
SurfaceCompression::None, // RGBA32UI

View file

@ -41,7 +41,7 @@ struct Table {
ComponentType alpha_component;
bool is_srgb;
};
constexpr std::array<Table, 75> DefinitionTable = {{
constexpr std::array<Table, 76> DefinitionTable = {{
{TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U},
{TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S},
{TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI},
@ -61,6 +61,7 @@ constexpr std::array<Table, 75> DefinitionTable = {{
{TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U},
{TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S},
{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, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGBA16F},
{TextureFormat::R16_G16_B16_A16, C, UINT, UINT, UINT, UINT, PixelFormat::RGBA16UI},