3
0
Fork 0
forked from suyu/suyu

video_core: Implement RGBA32_SINT render target

This commit is contained in:
ReinUsesLisp 2020-06-30 04:46:07 -03:00
parent 95c0f5afe5
commit 9338599d72
7 changed files with 13 additions and 0 deletions

View file

@ -40,6 +40,7 @@ namespace Tegra {
enum class RenderTargetFormat : u32 { enum class RenderTargetFormat : u32 {
NONE = 0x0, NONE = 0x0,
RGBA32_FLOAT = 0xC0, RGBA32_FLOAT = 0xC0,
RGBA32_SINT = 0xC1,
RGBA32_UINT = 0xC2, RGBA32_UINT = 0xC2,
RGBA16_UNORM = 0xC6, RGBA16_UNORM = 0xC6,
RGBA16_SNORM = 0xC7, RGBA16_SNORM = 0xC7,

View file

@ -71,6 +71,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::BGRA8>,
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RGBA32F>,
MortonCopy<true, PixelFormat::RGBA32I>,
MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::RG32F>,
MortonCopy<true, PixelFormat::RG32I>, MortonCopy<true, PixelFormat::RG32I>,
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R32F>,
@ -161,6 +162,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
nullptr, nullptr,
MortonCopy<false, PixelFormat::BGRA8>, MortonCopy<false, PixelFormat::BGRA8>,
MortonCopy<false, PixelFormat::RGBA32F>, MortonCopy<false, PixelFormat::RGBA32F>,
MortonCopy<false, PixelFormat::RGBA32I>,
MortonCopy<false, PixelFormat::RG32F>, MortonCopy<false, PixelFormat::RG32F>,
MortonCopy<false, PixelFormat::RG32I>, MortonCopy<false, PixelFormat::RG32I>,
MortonCopy<false, PixelFormat::R32F>, MortonCopy<false, PixelFormat::R32F>,

View file

@ -71,6 +71,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4 {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
{GL_RGBA32F, GL_RGBA, GL_FLOAT}, // RGBA32F {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // RGBA32F
{GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // RGBA32I
{GL_RG32F, GL_RG, GL_FLOAT}, // RG32F {GL_RG32F, GL_RG, GL_FLOAT}, // RG32F
{GL_RG32I, GL_RG_INTEGER, GL_INT}, // RG32I {GL_RG32I, GL_RG_INTEGER, GL_INT}, // RG32I
{GL_R32F, GL_RED, GL_FLOAT}, // R32F {GL_R32F, GL_RED, GL_FLOAT}, // R32F

View file

@ -147,6 +147,7 @@ struct FormatTuple {
{VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, // ASTC_2D_4X4 {VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, // ASTC_2D_4X4
{VK_FORMAT_B8G8R8A8_UNORM, Attachable}, // BGRA8 {VK_FORMAT_B8G8R8A8_UNORM, Attachable}, // BGRA8
{VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // RGBA32F {VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // RGBA32F
{VK_FORMAT_R32G32B32A32_SINT, Attachable | Storage}, // RGBA32I
{VK_FORMAT_R32G32_SFLOAT, Attachable | Storage}, // RG32F {VK_FORMAT_R32G32_SFLOAT, Attachable | Storage}, // RG32F
{VK_FORMAT_R32G32_SINT, Attachable | Storage}, // RG32I {VK_FORMAT_R32G32_SINT, Attachable | Storage}, // RG32I
{VK_FORMAT_R32_SFLOAT, Attachable | Storage}, // R32F {VK_FORMAT_R32_SFLOAT, Attachable | Storage}, // R32F

View file

@ -83,6 +83,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
VK_FORMAT_A2B10G10R10_UNORM_PACK32, VK_FORMAT_A2B10G10R10_UNORM_PACK32,
VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_A1R5G5B5_UNORM_PACK16,
VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_R32G32B32A32_SINT,
VK_FORMAT_R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT,
VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R32G32_SFLOAT,
VK_FORMAT_R32G32_SINT, VK_FORMAT_R32G32_SINT,

View file

@ -94,6 +94,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
switch (format) { switch (format) {
case Tegra::RenderTargetFormat::RGBA32_FLOAT: case Tegra::RenderTargetFormat::RGBA32_FLOAT:
return PixelFormat::RGBA32F; return PixelFormat::RGBA32F;
case Tegra::RenderTargetFormat::RGBA32_SINT:
return PixelFormat::RGBA32I;
case Tegra::RenderTargetFormat::RGBA32_UINT: case Tegra::RenderTargetFormat::RGBA32_UINT:
return PixelFormat::RGBA32UI; return PixelFormat::RGBA32UI;
case Tegra::RenderTargetFormat::RGBA16_UNORM: case Tegra::RenderTargetFormat::RGBA16_UNORM:

View file

@ -45,6 +45,7 @@ enum class PixelFormat {
ASTC_2D_4X4, ASTC_2D_4X4,
BGRA8, BGRA8,
RGBA32F, RGBA32F,
RGBA32I,
RG32F, RG32F,
RG32I, RG32I,
R32F, R32F,
@ -166,6 +167,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
2, // ASTC_2D_4X4 2, // ASTC_2D_4X4
0, // BGRA8 0, // BGRA8
0, // RGBA32F 0, // RGBA32F
0, // RGBA32I
0, // RG32F 0, // RG32F
0, // RG32I 0, // RG32I
0, // R32F 0, // R32F
@ -271,6 +273,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
4, // ASTC_2D_4X4 4, // ASTC_2D_4X4
1, // BGRA8 1, // BGRA8
1, // RGBA32F 1, // RGBA32F
1, // RGBA32I
1, // RG32F 1, // RG32F
1, // RG32I 1, // RG32I
1, // R32F 1, // R32F
@ -368,6 +371,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
4, // ASTC_2D_4X4 4, // ASTC_2D_4X4
1, // BGRA8 1, // BGRA8
1, // RGBA32F 1, // RGBA32F
1, // RGBA32I
1, // RG32F 1, // RG32F
1, // RG32I 1, // RG32I
1, // R32F 1, // R32F
@ -465,6 +469,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
128, // ASTC_2D_4X4 128, // ASTC_2D_4X4
32, // BGRA8 32, // BGRA8
128, // RGBA32F 128, // RGBA32F
128, // RGBA32I
64, // RG32F 64, // RG32F
64, // RG32I 64, // RG32I
32, // R32F 32, // R32F