summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2019-04-13 22:14:51 -0400
committerGravatar GitHub2019-04-13 22:14:51 -0400
commitc9454c8422e746285df7d947eeb0b339f02d719b (patch)
tree57338e73fd2ef8723a9e2c3b5c22b985389660e9
parentMerge pull request #2357 from zarroboogs/force-30fps-mode (diff)
parentImplement Texture Format ZF32_X24S8. (diff)
downloadyuzu-c9454c8422e746285df7d947eeb0b339f02d719b.tar.gz
yuzu-c9454c8422e746285df7d947eeb0b339f02d719b.tar.xz
yuzu-c9454c8422e746285df7d947eeb0b339f02d719b.zip
Merge pull request #2373 from FernandoS27/z32
Set Pixel Format to Z32 if its R32F and depth compare enabled, and Implement format ZF32_X24S8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp19
-rw-r--r--src/video_core/surface.cpp2
2 files changed, 19 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 55b6d8591..f2ffc4710 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -112,11 +112,26 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
112 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), 112 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(),
113 params.srgb_conversion); 113 params.srgb_conversion);
114 114
115 if (params.pixel_format == PixelFormat::R16U && config.tsc.depth_compare_enabled) { 115 if (config.tsc.depth_compare_enabled) {
116 // Some titles create a 'R16U' (normalized 16-bit) texture with depth_compare enabled, 116 // Some titles create a 'R16U' (normalized 16-bit) texture with depth_compare enabled,
117 // then attempt to sample from it via a shadow sampler. Convert format to Z16 (which also 117 // then attempt to sample from it via a shadow sampler. Convert format to Z16 (which also
118 // causes GetFormatType to properly return 'Depth' below). 118 // causes GetFormatType to properly return 'Depth' below).
119 params.pixel_format = PixelFormat::Z16; 119 if (GetFormatType(params.pixel_format) == SurfaceType::ColorTexture) {
120 switch (params.pixel_format) {
121 case PixelFormat::R16S:
122 case PixelFormat::R16U:
123 case PixelFormat::R16F:
124 params.pixel_format = PixelFormat::Z16;
125 break;
126 case PixelFormat::R32F:
127 params.pixel_format = PixelFormat::Z32F;
128 break;
129 default:
130 LOG_WARNING(HW_GPU, "Color texture format being used with depth compare: {}",
131 static_cast<u32>(params.pixel_format));
132 break;
133 }
134 }
120 } 135 }
121 136
122 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); 137 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value());
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index a7ac26d71..3b022a456 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -294,6 +294,8 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
294 return PixelFormat::Z16; 294 return PixelFormat::Z16;
295 case Tegra::Texture::TextureFormat::Z24S8: 295 case Tegra::Texture::TextureFormat::Z24S8:
296 return PixelFormat::Z24S8; 296 return PixelFormat::Z24S8;
297 case Tegra::Texture::TextureFormat::ZF32_X24S8:
298 return PixelFormat::Z32FS8;
297 case Tegra::Texture::TextureFormat::DXT1: 299 case Tegra::Texture::TextureFormat::DXT1:
298 return is_srgb ? PixelFormat::DXT1_SRGB : PixelFormat::DXT1; 300 return is_srgb ? PixelFormat::DXT1_SRGB : PixelFormat::DXT1;
299 case Tegra::Texture::TextureFormat::DXT23: 301 case Tegra::Texture::TextureFormat::DXT23: