summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-10 12:07:37 -0400
committerGravatar bunnei2018-08-11 19:06:42 -0400
commit88ffa422d42e9fec2e56272a584f22b1db454ad0 (patch)
tree21a679c79e25643b3c862e7195217acc57235788
parentgl_rasterizer: Implement render target format RGBA8_SNORM. (diff)
downloadyuzu-88ffa422d42e9fec2e56272a584f22b1db454ad0.tar.gz
yuzu-88ffa422d42e9fec2e56272a584f22b1db454ad0.tar.xz
yuzu-88ffa422d42e9fec2e56272a584f22b1db454ad0.zip
gl_rasterizer: Implement render target format RG8_SNORM.
- Used by Super Mario Odyssey.
-rw-r--r--src/video_core/gpu.cpp1
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h16
4 files changed, 18 insertions, 8 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index e0fc10a51..834940b83 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -67,6 +67,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
67 case RenderTargetFormat::R16_UINT: 67 case RenderTargetFormat::R16_UINT:
68 case RenderTargetFormat::R16_SINT: 68 case RenderTargetFormat::R16_SINT:
69 case RenderTargetFormat::R16_FLOAT: 69 case RenderTargetFormat::R16_FLOAT:
70 case RenderTargetFormat::RG8_SNORM:
70 return 2; 71 return 2;
71 case RenderTargetFormat::R8_UNORM: 72 case RenderTargetFormat::R8_UNORM:
72 return 1; 73 return 1;
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 36918ca16..de5b037be 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -35,6 +35,7 @@ enum class RenderTargetFormat : u32 {
35 R11G11B10_FLOAT = 0xE0, 35 R11G11B10_FLOAT = 0xE0,
36 R32_FLOAT = 0xE5, 36 R32_FLOAT = 0xE5,
37 B5G6R5_UNORM = 0xE8, 37 B5G6R5_UNORM = 0xE8,
38 RG8_SNORM = 0xEB,
38 R16_UNORM = 0xEE, 39 R16_UNORM = 0xEE,
39 R16_SNORM = 0xEF, 40 R16_SNORM = 0xEF,
40 R16_SINT = 0xF0, 41 R16_SINT = 0xF0,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 5b09236ca..d055b1dfa 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -133,6 +133,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
133 {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S 133 {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S
134 {GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F 134 {GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F
135 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 135 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
136 {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S
136 137
137 // DepthStencil formats 138 // DepthStencil formats
138 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 139 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -249,9 +250,9 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
249 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, 250 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>,
250 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, 251 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>,
251 MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, 252 MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>,
252 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, 253 MortonCopy<true, PixelFormat::RG8S>, MortonCopy<true, PixelFormat::Z24S8>,
253 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, 254 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
254 MortonCopy<true, PixelFormat::Z32FS8>, 255 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
255}; 256};
256 257
257static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), 258static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),
@@ -293,6 +294,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
293 MortonCopy<false, PixelFormat::RG16S>, 294 MortonCopy<false, PixelFormat::RG16S>,
294 MortonCopy<false, PixelFormat::RGB32F>, 295 MortonCopy<false, PixelFormat::RGB32F>,
295 MortonCopy<false, PixelFormat::SRGBA8>, 296 MortonCopy<false, PixelFormat::SRGBA8>,
297 MortonCopy<false, PixelFormat::RG8S>,
296 MortonCopy<false, PixelFormat::Z24S8>, 298 MortonCopy<false, PixelFormat::Z24S8>,
297 MortonCopy<false, PixelFormat::S8Z24>, 299 MortonCopy<false, PixelFormat::S8Z24>,
298 MortonCopy<false, PixelFormat::Z32F>, 300 MortonCopy<false, PixelFormat::Z32F>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 826ad2930..d7a43652e 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -57,15 +57,16 @@ struct SurfaceParams {
57 RG16S = 31, 57 RG16S = 31,
58 RGB32F = 32, 58 RGB32F = 32,
59 SRGBA8 = 33, 59 SRGBA8 = 33,
60 RG8S = 34,
60 61
61 MaxColorFormat, 62 MaxColorFormat,
62 63
63 // DepthStencil formats 64 // DepthStencil formats
64 Z24S8 = 34, 65 Z24S8 = 35,
65 S8Z24 = 35, 66 S8Z24 = 36,
66 Z32F = 36, 67 Z32F = 37,
67 Z16 = 37, 68 Z16 = 38,
68 Z32FS8 = 38, 69 Z32FS8 = 39,
69 70
70 MaxDepthStencilFormat, 71 MaxDepthStencilFormat,
71 72
@@ -137,6 +138,7 @@ struct SurfaceParams {
137 1, // RG16S 138 1, // RG16S
138 1, // RGB32F 139 1, // RGB32F
139 1, // SRGBA8 140 1, // SRGBA8
141 1, // RG8S
140 1, // Z24S8 142 1, // Z24S8
141 1, // S8Z24 143 1, // S8Z24
142 1, // Z32F 144 1, // Z32F
@@ -187,6 +189,7 @@ struct SurfaceParams {
187 32, // RG16S 189 32, // RG16S
188 96, // RGB32F 190 96, // RGB32F
189 32, // SRGBA8 191 32, // SRGBA8
192 16, // RG8S
190 32, // Z24S8 193 32, // Z24S8
191 32, // S8Z24 194 32, // S8Z24
192 32, // Z32F 195 32, // Z32F
@@ -257,6 +260,8 @@ struct SurfaceParams {
257 return PixelFormat::RG16; 260 return PixelFormat::RG16;
258 case Tegra::RenderTargetFormat::RG16_SNORM: 261 case Tegra::RenderTargetFormat::RG16_SNORM:
259 return PixelFormat::RG16S; 262 return PixelFormat::RG16S;
263 case Tegra::RenderTargetFormat::RG8_SNORM:
264 return PixelFormat::RG8S;
260 case Tegra::RenderTargetFormat::R16_FLOAT: 265 case Tegra::RenderTargetFormat::R16_FLOAT:
261 return PixelFormat::R16F; 266 return PixelFormat::R16F;
262 case Tegra::RenderTargetFormat::R16_UNORM: 267 case Tegra::RenderTargetFormat::R16_UNORM:
@@ -418,6 +423,7 @@ struct SurfaceParams {
418 case Tegra::RenderTargetFormat::RGBA8_SNORM: 423 case Tegra::RenderTargetFormat::RGBA8_SNORM:
419 case Tegra::RenderTargetFormat::RG16_SNORM: 424 case Tegra::RenderTargetFormat::RG16_SNORM:
420 case Tegra::RenderTargetFormat::R16_SNORM: 425 case Tegra::RenderTargetFormat::R16_SNORM:
426 case Tegra::RenderTargetFormat::RG8_SNORM:
421 return ComponentType::SNorm; 427 return ComponentType::SNorm;
422 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 428 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
423 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 429 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: