summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-04-09 17:31:28 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-04-09 18:06:59 +0200
commitb0aa8ad73625941fe08b2d9df36e8319bb958dd0 (patch)
treef46111ec09d9cb6dc5079778f7886f81c3fd37bb
parentMerge pull request #2300 from FernandoS27/null-shader (diff)
downloadyuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.tar
yuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.tar.gz
yuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.tar.bz2
yuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.tar.lz
yuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.tar.xz
yuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.tar.zst
yuzu-b0aa8ad73625941fe08b2d9df36e8319bb958dd0.zip
-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,
params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(),
params.srgb_conversion);
- if (params.pixel_format == PixelFormat::R16U && config.tsc.depth_compare_enabled) {
+ if (config.tsc.depth_compare_enabled) {
// Some titles create a 'R16U' (normalized 16-bit) texture with depth_compare enabled,
// then attempt to sample from it via a shadow sampler. Convert format to Z16 (which also
// causes GetFormatType to properly return 'Depth' below).
- params.pixel_format = PixelFormat::Z16;
+ if (GetFormatType(params.pixel_format) == SurfaceType::ColorTexture) {
+ switch (params.pixel_format) {
+ case PixelFormat::R16S:
+ case PixelFormat::R16U:
+ case PixelFormat::R16F:
+ params.pixel_format = PixelFormat::Z16;
+ break;
+ case PixelFormat::R32F:
+ params.pixel_format = PixelFormat::Z32F;
+ break;
+ default:
+ LOG_WARNING(HW_GPU, "Color texture format being used with depth compare: {}",
+ static_cast<u32>(params.pixel_format));
+ break;
+ }
+ }
}
params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value());