Browse Source

video_core: Implement RG8_SINT render target and fix RG8_UINT

ReinUsesLisp 6 years ago
parent
commit
e849d68048

+ 1 - 0
src/video_core/gpu.h

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

+ 2 - 0
src/video_core/morton.cpp

@@ -85,6 +85,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
     MortonCopy<true, PixelFormat::RGBA8_SRGB>,
     MortonCopy<true, PixelFormat::RG8U>,
     MortonCopy<true, PixelFormat::RG8S>,
+    MortonCopy<true, PixelFormat::RG8I>,
     MortonCopy<true, PixelFormat::RG8UI>,
     MortonCopy<true, PixelFormat::RG32UI>,
     MortonCopy<true, PixelFormat::RGBX16F>,
@@ -171,6 +172,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
     MortonCopy<false, PixelFormat::RGBA8_SRGB>,
     MortonCopy<false, PixelFormat::RG8U>,
     MortonCopy<false, PixelFormat::RG8S>,
+    MortonCopy<false, PixelFormat::RG8I>,
     MortonCopy<false, PixelFormat::RG8UI>,
     MortonCopy<false, PixelFormat::RG32UI>,
     MortonCopy<false, PixelFormat::RGBX16F>,

+ 2 - 1
src/video_core/renderer_opengl/gl_texture_cache.cpp

@@ -85,7 +85,8 @@ 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_RG8, GL_RG, GL_UNSIGNED_BYTE},                            // RG8U
     {GL_RG8_SNORM, GL_RG, GL_BYTE},                               // RG8S
-    {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_INT},                   // RG8UI
+    {GL_RG8I, GL_RG_INTEGER, GL_BYTE},                            // RG8I
+    {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE},                  // RG8UI
     {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT},                  // RG32UI
     {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT},                          // RGBX16F
     {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT},                  // R32UI

+ 1 - 0
src/video_core/renderer_vulkan/maxwell_to_vk.cpp

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

+ 1 - 0
src/video_core/renderer_vulkan/vk_device.cpp

@@ -96,6 +96,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
         VK_FORMAT_R8G8B8A8_SRGB,
         VK_FORMAT_R8G8_UNORM,
         VK_FORMAT_R8G8_SNORM,
+        VK_FORMAT_R8G8_SINT,
         VK_FORMAT_R8G8_UINT,
         VK_FORMAT_R8_UNORM,
         VK_FORMAT_R8_SNORM,

+ 2 - 0
src/video_core/surface.cpp

@@ -150,6 +150,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
         return PixelFormat::RG8U;
     case Tegra::RenderTargetFormat::RG8_SNORM:
         return PixelFormat::RG8S;
+    case Tegra::RenderTargetFormat::RG8_SINT:
+        return PixelFormat::RG8I;
     case Tegra::RenderTargetFormat::RG8_UINT:
         return PixelFormat::RG8UI;
     case Tegra::RenderTargetFormat::R16_UNORM:

+ 5 - 0
src/video_core/surface.h

@@ -59,6 +59,7 @@ enum class PixelFormat {
     RGBA8_SRGB,
     RG8U,
     RG8S,
+    RG8I,
     RG8UI,
     RG32UI,
     RGBX16F,
@@ -176,6 +177,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
     0, // RGBA8_SRGB
     0, // RG8U
     0, // RG8S
+    0, // RG8I
     0, // RG8UI
     0, // RG32UI
     0, // RGBX16F
@@ -277,6 +279,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
     1,  // RGBA8_SRGB
     1,  // RG8U
     1,  // RG8S
+    1,  // RG8I
     1,  // RG8UI
     1,  // RG32UI
     1,  // RGBX16F
@@ -370,6 +373,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
     1,  // RGBA8_SRGB
     1,  // RG8U
     1,  // RG8S
+    1,  // RG8I
     1,  // RG8UI
     1,  // RG32UI
     1,  // RGBX16F
@@ -463,6 +467,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
     32,  // RGBA8_SRGB
     16,  // RG8U
     16,  // RG8S
+    16,  // RG8I
     16,  // RG8UI
     64,  // RG32UI
     64,  // RGBX16F