summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-25 23:47:26 +0200
committerGitHub <noreply@github.com>2018-07-25 23:47:26 +0200
commitc88382517cd9d7e0b9046c0ea8690c38e778e6f6 (patch)
tree10440f12ab2ce6115a45b640723d7f040841066a
parentMerge pull request #801 from lioncash/time (diff)
parentGPU: Use the right texture format for sRGBA framebuffers. (diff)
downloadyuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.gz
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.bz2
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.lz
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.xz
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.tar.zst
yuzu-c88382517cd9d7e0b9046c0ea8690c38e778e6f6.zip
-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
{GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
{GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
{GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
+ {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
// DepthStencil formats
{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),
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
- MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>,
- MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
- MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
+ MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::SRGBA8>,
+ MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
+ MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
+ MortonCopy<true, PixelFormat::Z32FS8>,
};
static 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),
MortonCopy<false, PixelFormat::R32F>,
MortonCopy<false, PixelFormat::R16F>,
MortonCopy<false, PixelFormat::R16UNORM>,
+ MortonCopy<false, PixelFormat::SRGBA8>,
MortonCopy<false, PixelFormat::Z24S8>,
MortonCopy<false, PixelFormat::S8Z24>,
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 {
R32F = 18,
R16F = 19,
R16UNORM = 20,
+ SRGBA8 = 21,
MaxColorFormat,
// DepthStencil formats
- Z24S8 = 21,
- S8Z24 = 22,
- Z32F = 23,
- Z16 = 24,
- Z32FS8 = 25,
+ Z24S8 = 22,
+ S8Z24 = 23,
+ Z32F = 24,
+ Z16 = 25,
+ Z32FS8 = 26,
MaxDepthStencilFormat,
@@ -110,6 +111,7 @@ struct SurfaceParams {
1, // R32F
1, // R16F
1, // R16UNORM
+ 1, // SRGBA8
1, // Z24S8
1, // S8Z24
1, // Z32F
@@ -147,6 +149,7 @@ struct SurfaceParams {
32, // R32F
16, // R16F
16, // R16UNORM
+ 32, // SRGBA8
32, // Z24S8
32, // S8Z24
32, // Z32F
@@ -182,8 +185,9 @@ struct SurfaceParams {
static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
switch (format) {
- case Tegra::RenderTargetFormat::RGBA8_UNORM:
case Tegra::RenderTargetFormat::RGBA8_SRGB:
+ return PixelFormat::SRGBA8;
+ case Tegra::RenderTargetFormat::RGBA8_UNORM:
return PixelFormat::ABGR8;
case Tegra::RenderTargetFormat::BGRA8_UNORM:
return PixelFormat::BGRA8;
@@ -278,6 +282,7 @@ struct SurfaceParams {
// TODO(Subv): Properly implement this
switch (format) {
case PixelFormat::ABGR8:
+ case PixelFormat::SRGBA8:
return Tegra::Texture::TextureFormat::A8R8G8B8;
case PixelFormat::B5G6R5:
return Tegra::Texture::TextureFormat::B5G6R5;