summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 7a3280620..e2ec72b4e 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -111,11 +111,26 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
111 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), 111 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(),
112 params.srgb_conversion); 112 params.srgb_conversion);
113 113
114 if (params.pixel_format == PixelFormat::R16U && config.tsc.depth_compare_enabled) { 114 if (config.tsc.depth_compare_enabled) {
115 // Some titles create a 'R16U' (normalized 16-bit) texture with depth_compare enabled, 115 // Some titles create a 'R16U' (normalized 16-bit) texture with depth_compare enabled,
116 // then attempt to sample from it via a shadow sampler. Convert format to Z16 (which also 116 // then attempt to sample from it via a shadow sampler. Convert format to Z16 (which also
117 // causes GetFormatType to properly return 'Depth' below). 117 // causes GetFormatType to properly return 'Depth' below).
118 params.pixel_format = PixelFormat::Z16; 118 if (GetFormatType(params.pixel_format) == SurfaceType::ColorTexture) {
119 switch (params.pixel_format) {
120 case PixelFormat::R16S:
121 case PixelFormat::R16U:
122 case PixelFormat::R16F:
123 params.pixel_format = PixelFormat::Z16;
124 break;
125 case PixelFormat::R32F:
126 params.pixel_format = PixelFormat::Z32F;
127 break;
128 default:
129 LOG_WARNING(HW_GPU, "Color texture format being used with depth compare: {}",
130 static_cast<u32>(params.pixel_format));
131 break;
132 }
133 }
119 } 134 }
120 135
121 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); 136 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value());