summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-25 14:47:26 -0700
committerGravatar GitHub2018-07-25 14:47:26 -0700
commitc88382517cd9d7e0b9046c0ea8690c38e778e6f6 (patch)
tree10440f12ab2ce6115a45b640723d7f040841066a
parentMerge pull request #801 from lioncash/time (diff)
parentGPU: Use the right texture format for sRGBA framebuffers. (diff)
downloadyuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.gz
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.xz
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.zip
Merge pull request #819 from Subv/srgb
GPU: Use the right texture format for sRGBA framebuffers.
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp9
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h17
2 files changed, 17 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 91ce0357b..f52ac23f1 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -113,6 +113,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F 114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM 115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
116 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
116 117
117 // DepthStencil formats 118 // DepthStencil formats
118 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 119 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -209,9 +210,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
209 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 210 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
210 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 211 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
211 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, 212 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
212 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>, 213 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::SRGBA8>,
213 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 214 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
214 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, 215 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
216 MortonCopy<true, PixelFormat::Z32FS8>,
215}; 217};
216 218
217static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 219static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -239,6 +241,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
239 MortonCopy<false, PixelFormat::R32F>, 241 MortonCopy<false, PixelFormat::R32F>,
240 MortonCopy<false, PixelFormat::R16F>, 242 MortonCopy<false, PixelFormat::R16F>,
241 MortonCopy<false, PixelFormat::R16UNORM>, 243 MortonCopy<false, PixelFormat::R16UNORM>,
244 MortonCopy<false, PixelFormat::SRGBA8>,
242 MortonCopy<false, PixelFormat::Z24S8>, 245 MortonCopy<false, PixelFormat::Z24S8>,
243 MortonCopy<false, PixelFormat::S8Z24>, 246 MortonCopy<false, PixelFormat::S8Z24>,
244 MortonCopy<false, PixelFormat::Z32F>, 247 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 fc864c56f..ffa2019f7 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -43,15 +43,16 @@ struct SurfaceParams {
43 R32F = 18, 43 R32F = 18,
44 R16F = 19, 44 R16F = 19,
45 R16UNORM = 20, 45 R16UNORM = 20,
46 SRGBA8 = 21,
46 47
47 MaxColorFormat, 48 MaxColorFormat,
48 49
49 // DepthStencil formats 50 // DepthStencil formats
50 Z24S8 = 21, 51 Z24S8 = 22,
51 S8Z24 = 22, 52 S8Z24 = 23,
52 Z32F = 23, 53 Z32F = 24,
53 Z16 = 24, 54 Z16 = 25,
54 Z32FS8 = 25, 55 Z32FS8 = 26,
55 56
56 MaxDepthStencilFormat, 57 MaxDepthStencilFormat,
57 58
@@ -110,6 +111,7 @@ struct SurfaceParams {
110 1, // R32F 111 1, // R32F
111 1, // R16F 112 1, // R16F
112 1, // R16UNORM 113 1, // R16UNORM
114 1, // SRGBA8
113 1, // Z24S8 115 1, // Z24S8
114 1, // S8Z24 116 1, // S8Z24
115 1, // Z32F 117 1, // Z32F
@@ -147,6 +149,7 @@ struct SurfaceParams {
147 32, // R32F 149 32, // R32F
148 16, // R16F 150 16, // R16F
149 16, // R16UNORM 151 16, // R16UNORM
152 32, // SRGBA8
150 32, // Z24S8 153 32, // Z24S8
151 32, // S8Z24 154 32, // S8Z24
152 32, // Z32F 155 32, // Z32F
@@ -182,8 +185,9 @@ struct SurfaceParams {
182 185
183 static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { 186 static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
184 switch (format) { 187 switch (format) {
185 case Tegra::RenderTargetFormat::RGBA8_UNORM:
186 case Tegra::RenderTargetFormat::RGBA8_SRGB: 188 case Tegra::RenderTargetFormat::RGBA8_SRGB:
189 return PixelFormat::SRGBA8;
190 case Tegra::RenderTargetFormat::RGBA8_UNORM:
187 return PixelFormat::ABGR8; 191 return PixelFormat::ABGR8;
188 case Tegra::RenderTargetFormat::BGRA8_UNORM: 192 case Tegra::RenderTargetFormat::BGRA8_UNORM:
189 return PixelFormat::BGRA8; 193 return PixelFormat::BGRA8;
@@ -278,6 +282,7 @@ struct SurfaceParams {
278 // TODO(Subv): Properly implement this 282 // TODO(Subv): Properly implement this
279 switch (format) { 283 switch (format) {
280 case PixelFormat::ABGR8: 284 case PixelFormat::ABGR8:
285 case PixelFormat::SRGBA8:
281 return Tegra::Texture::TextureFormat::A8R8G8B8; 286 return Tegra::Texture::TextureFormat::A8R8G8B8;
282 case PixelFormat::B5G6R5: 287 case PixelFormat::B5G6R5:
283 return Tegra::Texture::TextureFormat::B5G6R5; 288 return Tegra::Texture::TextureFormat::B5G6R5;