Merge pull request #2373 from FernandoS27/z32

Set Pixel Format to Z32 if its R32F and depth compare enabled, and Implement format ZF32_X24S8
This commit is contained in:
bunnei 2019-04-13 22:14:51 -04:00 committed by GitHub
commit c9454c8422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -112,11 +112,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.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(),
params.srgb_conversion); 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, // 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 // then attempt to sample from it via a shadow sampler. Convert format to Z16 (which also
// causes GetFormatType to properly return 'Depth' below). // causes GetFormatType to properly return 'Depth' below).
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; 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()); params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value());

View File

@ -294,6 +294,8 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
return PixelFormat::Z16; return PixelFormat::Z16;
case Tegra::Texture::TextureFormat::Z24S8: case Tegra::Texture::TextureFormat::Z24S8:
return PixelFormat::Z24S8; return PixelFormat::Z24S8;
case Tegra::Texture::TextureFormat::ZF32_X24S8:
return PixelFormat::Z32FS8;
case Tegra::Texture::TextureFormat::DXT1: case Tegra::Texture::TextureFormat::DXT1:
return is_srgb ? PixelFormat::DXT1_SRGB : PixelFormat::DXT1; return is_srgb ? PixelFormat::DXT1_SRGB : PixelFormat::DXT1;
case Tegra::Texture::TextureFormat::DXT23: case Tegra::Texture::TextureFormat::DXT23: