summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-04-01 06:44:15 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-04-01 06:44:15 +0200
commitdd1232755b11ef3034909d3f57f740bc8b94867f (patch)
tree068a1e0f5158e75cc253c13c18f930b174c7cfbe /src
parentvk_device: Add missing ASTC queries (diff)
downloadyuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.tar
yuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.tar.gz
yuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.tar.bz2
yuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.tar.lz
yuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.tar.xz
yuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.tar.zst
yuzu-dd1232755b11ef3034909d3f57f740bc8b94867f.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp19
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
const FormatTuple& GetFormatTuple(PixelFormat pixel_format) {
ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size());
- const auto& format{tex_format_tuples[static_cast<std::size_t>(pixel_format)]};
- return format;
+ return tex_format_tuples[static_cast<std::size_t>(pixel_format)];
}
GLenum GetTextureTarget(const SurfaceTarget& target) {
@@ -243,11 +242,17 @@ OGLTexture CreateTexture(const SurfaceParams& params, GLenum target, GLenum inte
CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& params,
bool is_astc_supported)
: VideoCommon::SurfaceBase<View>(gpu_addr, params, is_astc_supported) {
- const auto& tuple{GetFormatTuple(params.pixel_format)};
- internal_format = tuple.internal_format;
- format = tuple.format;
- type = tuple.type;
- is_compressed = !is_converted && params.IsCompressed();
+ if (is_converted) {
+ internal_format = params.srgb_conversion ? GL_SRGB8_ALPHA8 : GL_RGBA8;
+ format = GL_RGBA;
+ type = GL_UNSIGNED_BYTE;
+ } else {
+ const auto& tuple{GetFormatTuple(params.pixel_format)};
+ internal_format = tuple.internal_format;
+ format = tuple.format;
+ type = tuple.type;
+ is_compressed = params.IsCompressed();
+ }
target = GetTextureTarget(params.target);
texture = CreateTexture(params, target, internal_format, texture_buffer);
DecorateSurfaceName();