1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

rsx: Fix depth/color mismatch resolve in texture cache

- Sometimes we need a depth texture but only a color texture is available.
This commit is contained in:
kd-11 2021-06-07 00:29:52 +03:00 committed by kd-11
parent 3f80d0b7d8
commit ddbe496097
2 changed files with 9 additions and 2 deletions

View File

@ -529,12 +529,19 @@ namespace rsx
if (const bool gcm_format_is_depth = is_gcm_depth_format(attr2.gcm_format);
gcm_format_is_depth != is_depth)
{
if (force_convert)
if (force_convert || gcm_format_is_depth)
{
// If force_convert is set, we already know there is no simple workaround. Bitcast will be forced to resolve the issue.
// If the existing texture is a color texture but depth readout is requested, force bitcast
// Note that if only reading the depth value was needed from a depth surface, it would have been sampled as color due to Z comparison.
is_depth = gcm_format_is_depth;
force_convert = true;
}
else
{
// Existing texture is a depth texture, but RSX wants a color texture.
// Change the RSX request to a compatible depth texture to give same results in shader.
ensure(is_depth);
attr2.gcm_format = get_compatible_depth_format(attr2.gcm_format);
}

View File

@ -1047,7 +1047,7 @@ namespace vk
case CELL_GCM_TEXTURE_X16:
case CELL_GCM_TEXTURE_DEPTH16:
case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
return (vk_format == VK_FORMAT_D16_UNORM);
return (vk_format == VK_FORMAT_D16_UNORM || vk_format == VK_FORMAT_D32_SFLOAT);
}
}