diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index b64027f31..36590a6d0 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -129,8 +129,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format | |||
| 129 | 129 | ||
| 130 | const FormatTuple& GetFormatTuple(PixelFormat pixel_format) { | 130 | const FormatTuple& GetFormatTuple(PixelFormat pixel_format) { |
| 131 | ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size()); | 131 | ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size()); |
| 132 | const auto& format{tex_format_tuples[static_cast<std::size_t>(pixel_format)]}; | 132 | return tex_format_tuples[static_cast<std::size_t>(pixel_format)]; |
| 133 | return format; | ||
| 134 | } | 133 | } |
| 135 | 134 | ||
| 136 | GLenum GetTextureTarget(const SurfaceTarget& target) { | 135 | GLenum GetTextureTarget(const SurfaceTarget& target) { |
| @@ -243,11 +242,17 @@ OGLTexture CreateTexture(const SurfaceParams& params, GLenum target, GLenum inte | |||
| 243 | CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& params, | 242 | CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& params, |
| 244 | bool is_astc_supported) | 243 | bool is_astc_supported) |
| 245 | : VideoCommon::SurfaceBase<View>(gpu_addr, params, is_astc_supported) { | 244 | : VideoCommon::SurfaceBase<View>(gpu_addr, params, is_astc_supported) { |
| 246 | const auto& tuple{GetFormatTuple(params.pixel_format)}; | 245 | if (is_converted) { |
| 247 | internal_format = tuple.internal_format; | 246 | internal_format = params.srgb_conversion ? GL_SRGB8_ALPHA8 : GL_RGBA8; |
| 248 | format = tuple.format; | 247 | format = GL_RGBA; |
| 249 | type = tuple.type; | 248 | type = GL_UNSIGNED_BYTE; |
| 250 | is_compressed = !is_converted && params.IsCompressed(); | 249 | } else { |
| 250 | const auto& tuple{GetFormatTuple(params.pixel_format)}; | ||
| 251 | internal_format = tuple.internal_format; | ||
| 252 | format = tuple.format; | ||
| 253 | type = tuple.type; | ||
| 254 | is_compressed = params.IsCompressed(); | ||
| 255 | } | ||
| 251 | target = GetTextureTarget(params.target); | 256 | target = GetTextureTarget(params.target); |
| 252 | texture = CreateTexture(params, target, internal_format, texture_buffer); | 257 | texture = CreateTexture(params, target, internal_format, texture_buffer); |
| 253 | DecorateSurfaceName(); | 258 | DecorateSurfaceName(); |