From e849d680480e07e430793fd9657a08b676655803 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 30 Jun 2020 04:13:46 -0300 Subject: video_core: Implement RG8_SINT render target and fix RG8_UINT --- src/video_core/gpu.h | 1 + src/video_core/morton.cpp | 2 ++ src/video_core/renderer_opengl/gl_texture_cache.cpp | 3 ++- src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 1 + src/video_core/renderer_vulkan/vk_device.cpp | 1 + src/video_core/surface.cpp | 2 ++ src/video_core/surface.h | 5 +++++ 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 1e5d2ffcc..a6f846f3c 100644 --- a/src/video_core/gpu.h +++ b/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, diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index 790360d4d..9e50aa11d 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp @@ -85,6 +85,7 @@ static constexpr ConversionArray morton_to_linear_fns = { MortonCopy, MortonCopy, MortonCopy, + MortonCopy, MortonCopy, MortonCopy, MortonCopy, @@ -171,6 +172,7 @@ static constexpr ConversionArray linear_to_morton_fns = { MortonCopy, MortonCopy, MortonCopy, + MortonCopy, MortonCopy, MortonCopy, MortonCopy, diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 553db1cb1..ef1729894 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -85,7 +85,8 @@ constexpr std::array 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 diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 645cb92ca..43264ce14 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/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 diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp index 59c5f9ea5..06c6169dc 100644 --- a/src/video_core/renderer_vulkan/vk_device.cpp +++ b/src/video_core/renderer_vulkan/vk_device.cpp @@ -96,6 +96,7 @@ std::unordered_map 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, diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index f132f1b43..1f12163fe 100644 --- a/src/video_core/surface.cpp +++ b/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: diff --git a/src/video_core/surface.h b/src/video_core/surface.h index a6cac3bf9..6999d9dc3 100644 --- a/src/video_core/surface.h +++ b/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 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 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 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 bpp_table = {{ 32, // RGBA8_SRGB 16, // RG8U 16, // RG8S + 16, // RG8I 16, // RG8UI 64, // RG32UI 64, // RGBX16F -- cgit v1.2.3