summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-06-30 03:51:42 -0300
committerGravatar ReinUsesLisp2020-07-13 01:01:08 -0300
commitfd33e996e0d6d441917446f7a9ec854b0a79a909 (patch)
treefcc3d6086372cb7b04f2ed494ea60ce30298dfc2
parentvideo_core/surface: Remove explicit values on PixelFormat's definition (diff)
downloadyuzu-fd33e996e0d6d441917446f7a9ec854b0a79a909.tar.gz
yuzu-fd33e996e0d6d441917446f7a9ec854b0a79a909.tar.xz
yuzu-fd33e996e0d6d441917446f7a9ec854b0a79a909.zip
video_core: Implement R8_SNORM render target
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/morton.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp1
-rw-r--r--src/video_core/renderer_vulkan/maxwell_to_vk.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_device.cpp1
-rw-r--r--src/video_core/surface.cpp2
-rw-r--r--src/video_core/surface.h5
7 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 2c42483bd..2b92ab0ea 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -75,6 +75,7 @@ enum class RenderTargetFormat : u32 {
75 R16_UINT = 0xF1, 75 R16_UINT = 0xF1,
76 R16_FLOAT = 0xF2, 76 R16_FLOAT = 0xF2,
77 R8_UNORM = 0xF3, 77 R8_UNORM = 0xF3,
78 R8_SNORM = 0xF4,
78 R8_UINT = 0xF6, 79 R8_UINT = 0xF6,
79}; 80};
80 81
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp
index 836b25c1d..9b569afc8 100644
--- a/src/video_core/morton.cpp
+++ b/src/video_core/morton.cpp
@@ -48,6 +48,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
48 MortonCopy<true, PixelFormat::A2B10G10R10U>, 48 MortonCopy<true, PixelFormat::A2B10G10R10U>,
49 MortonCopy<true, PixelFormat::A1B5G5R5U>, 49 MortonCopy<true, PixelFormat::A1B5G5R5U>,
50 MortonCopy<true, PixelFormat::R8U>, 50 MortonCopy<true, PixelFormat::R8U>,
51 MortonCopy<true, PixelFormat::R8S>,
51 MortonCopy<true, PixelFormat::R8UI>, 52 MortonCopy<true, PixelFormat::R8UI>,
52 MortonCopy<true, PixelFormat::RGBA16F>, 53 MortonCopy<true, PixelFormat::RGBA16F>,
53 MortonCopy<true, PixelFormat::RGBA16U>, 54 MortonCopy<true, PixelFormat::RGBA16U>,
@@ -131,6 +132,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
131 MortonCopy<false, PixelFormat::A2B10G10R10U>, 132 MortonCopy<false, PixelFormat::A2B10G10R10U>,
132 MortonCopy<false, PixelFormat::A1B5G5R5U>, 133 MortonCopy<false, PixelFormat::A1B5G5R5U>,
133 MortonCopy<false, PixelFormat::R8U>, 134 MortonCopy<false, PixelFormat::R8U>,
135 MortonCopy<false, PixelFormat::R8S>,
134 MortonCopy<false, PixelFormat::R8UI>, 136 MortonCopy<false, PixelFormat::R8UI>,
135 MortonCopy<false, PixelFormat::RGBA16F>, 137 MortonCopy<false, PixelFormat::RGBA16F>,
136 MortonCopy<false, PixelFormat::RGBA16S>, 138 MortonCopy<false, PixelFormat::RGBA16S>,
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 61505879b..6319b0006 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -48,6 +48,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
48 {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U 48 {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U
49 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U 49 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U
50 {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U 50 {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U
51 {GL_R8_SNORM, GL_RED, GL_BYTE}, // R8S
51 {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8UI 52 {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8UI
52 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // RGBA16F 53 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // RGBA16F
53 {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // RGBA16U 54 {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // RGBA16U
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
index d7f1ae89f..1f3f79380 100644
--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
@@ -124,6 +124,7 @@ struct FormatTuple {
124 {VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U 124 {VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U
125 {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle) 125 {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle)
126 {VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U 126 {VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U
127 {VK_FORMAT_R8_SNORM, Attachable | Storage}, // R8S
127 {VK_FORMAT_R8_UINT, Attachable | Storage}, // R8UI 128 {VK_FORMAT_R8_UINT, Attachable | Storage}, // R8UI
128 {VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // RGBA16F 129 {VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // RGBA16F
129 {VK_FORMAT_R16G16B16A16_UNORM, Attachable | Storage}, // RGBA16U 130 {VK_FORMAT_R16G16B16A16_UNORM, Attachable | Storage}, // RGBA16U
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp
index fdaea4210..c4889ac88 100644
--- a/src/video_core/renderer_vulkan/vk_device.cpp
+++ b/src/video_core/renderer_vulkan/vk_device.cpp
@@ -98,6 +98,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
98 VK_FORMAT_R8G8_SNORM, 98 VK_FORMAT_R8G8_SNORM,
99 VK_FORMAT_R8G8_UINT, 99 VK_FORMAT_R8G8_UINT,
100 VK_FORMAT_R8_UNORM, 100 VK_FORMAT_R8_UNORM,
101 VK_FORMAT_R8_SNORM,
101 VK_FORMAT_R8_UINT, 102 VK_FORMAT_R8_UINT,
102 VK_FORMAT_B10G11R11_UFLOAT_PACK32, 103 VK_FORMAT_B10G11R11_UFLOAT_PACK32,
103 VK_FORMAT_R32_SFLOAT, 104 VK_FORMAT_R32_SFLOAT,
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index 2392a46f4..6e9b496d3 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -164,6 +164,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
164 return PixelFormat::R16F; 164 return PixelFormat::R16F;
165 case Tegra::RenderTargetFormat::R8_UNORM: 165 case Tegra::RenderTargetFormat::R8_UNORM:
166 return PixelFormat::R8U; 166 return PixelFormat::R8U;
167 case Tegra::RenderTargetFormat::R8_SNORM:
168 return PixelFormat::R8S;
167 case Tegra::RenderTargetFormat::R8_UINT: 169 case Tegra::RenderTargetFormat::R8_UINT:
168 return PixelFormat::R8UI; 170 return PixelFormat::R8UI;
169 default: 171 default:
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index 422c9fcb2..def206740 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -22,6 +22,7 @@ enum class PixelFormat {
22 A2B10G10R10U, 22 A2B10G10R10U,
23 A1B5G5R5U, 23 A1B5G5R5U,
24 R8U, 24 R8U,
25 R8S,
25 R8UI, 26 R8UI,
26 RGBA16F, 27 RGBA16F,
27 RGBA16U, 28 RGBA16U,
@@ -137,6 +138,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
137 0, // A2B10G10R10U 138 0, // A2B10G10R10U
138 0, // A1B5G5R5U 139 0, // A1B5G5R5U
139 0, // R8U 140 0, // R8U
141 0, // R8S
140 0, // R8UI 142 0, // R8UI
141 0, // RGBA16F 143 0, // RGBA16F
142 0, // RGBA16U 144 0, // RGBA16U
@@ -236,6 +238,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
236 1, // A2B10G10R10U 238 1, // A2B10G10R10U
237 1, // A1B5G5R5U 239 1, // A1B5G5R5U
238 1, // R8U 240 1, // R8U
241 1, // R8S
239 1, // R8UI 242 1, // R8UI
240 1, // RGBA16F 243 1, // RGBA16F
241 1, // RGBA16U 244 1, // RGBA16U
@@ -327,6 +330,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
327 1, // A2B10G10R10U 330 1, // A2B10G10R10U
328 1, // A1B5G5R5U 331 1, // A1B5G5R5U
329 1, // R8U 332 1, // R8U
333 1, // R8S
330 1, // R8UI 334 1, // R8UI
331 1, // RGBA16F 335 1, // RGBA16F
332 1, // RGBA16U 336 1, // RGBA16U
@@ -418,6 +422,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
418 32, // A2B10G10R10U 422 32, // A2B10G10R10U
419 16, // A1B5G5R5U 423 16, // A1B5G5R5U
420 8, // R8U 424 8, // R8U
425 8, // R8S
421 8, // R8UI 426 8, // R8UI
422 64, // RGBA16F 427 64, // RGBA16F
423 64, // RGBA16U 428 64, // RGBA16U