mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
Ignore inactive metadata address bits in sampled depth descriptors
Co-authored-by: Ali Almohaya <17254073+Almo7aya@users.noreply.github.com>
This commit is contained in:
@@ -184,17 +184,18 @@ bool IsSupportedDepthTextureEncoding(const ShaderTextureResource& descriptor, bo
|
|||||||
}
|
}
|
||||||
const bool full = common && descriptor.fields[4] == field4_expected &&
|
const bool full = common && descriptor.fields[4] == field4_expected &&
|
||||||
descriptor.fields[5] == field5_expected;
|
descriptor.fields[5] == field5_expected;
|
||||||
if (!full || (descriptor.fields[6] == 0 && descriptor.fields[7] != 0) ||
|
if (!full ||
|
||||||
(descriptor.MsaaDepth() && !IsMultisampledTexture(descriptor.Type()))) {
|
(descriptor.MsaaDepth() && !IsMultisampledTexture(descriptor.Type()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (descriptor.fields[6] == 0) {
|
const auto metadata_control = descriptor.fields[6] & 0x00ffffffu;
|
||||||
|
if (metadata_control == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
constexpr uint32_t htile_control = 0x00280000u;
|
constexpr uint32_t htile_control = 0x00280000u;
|
||||||
const uint32_t expected_control = htile_control | (descriptor.MsaaDepth() ? (1u << 10u) : 0u);
|
const uint32_t expected_control = htile_control | (descriptor.MsaaDepth() ? (1u << 10u) : 0u);
|
||||||
const auto metadata_addr = descriptor.MetaAddr() << 8u;
|
const auto metadata_addr = descriptor.MetaAddr() << 8u;
|
||||||
return (descriptor.fields[6] & 0x00ffffffu) == expected_control && metadata_addr != 0 &&
|
return metadata_control == expected_control && metadata_addr != 0 &&
|
||||||
metadata_addr < TRACKER_ADDRESS_SIZE && (metadata_addr & 0x7fffu) == 0 &&
|
metadata_addr < TRACKER_ADDRESS_SIZE && (metadata_addr & 0x7fffu) == 0 &&
|
||||||
descriptor.TileMode() == Prospero::TileMode::kDepth;
|
descriptor.TileMode() == Prospero::TileMode::kDepth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29200,6 +29200,17 @@ void CheckDepthTextureEncoding() {
|
|||||||
IsSupportedDepthTextureEncoding(compressed_descriptor),
|
IsSupportedDepthTextureEncoding(compressed_descriptor),
|
||||||
"valid compressed depth descriptor required a prior depth target");
|
"valid compressed depth descriptor required a prior depth target");
|
||||||
|
|
||||||
|
const ShaderTextureResource disabled_metadata{{
|
||||||
|
0x20018100u, 0xc1600000u, 0x021bc1dfu, 0x91800204u,
|
||||||
|
0x00000000u, 0x00700000u, 0x00000000u, 0x0020037fu,
|
||||||
|
}};
|
||||||
|
auto retained_metadata_address = compressed_descriptor;
|
||||||
|
retained_metadata_address.fields[6] &= 0xff000000u;
|
||||||
|
Require("DepthTextureEncoding", "disabled metadata with retained address",
|
||||||
|
IsSupportedDepthTextureEncoding(disabled_metadata) &&
|
||||||
|
IsSupportedDepthTextureEncoding(retained_metadata_address),
|
||||||
|
"uncompressed depth rejected inactive metadata address bits");
|
||||||
|
|
||||||
const ShaderTextureResource first_use_depth{{
|
const ShaderTextureResource first_use_depth{{
|
||||||
0x0225fc00u, 0x01600000u, 0x00000000u, 0x91800924u,
|
0x0225fc00u, 0x01600000u, 0x00000000u, 0x91800924u,
|
||||||
0x00000000u, 0x00700000u, 0x80280000u, 0x000225fdu,
|
0x00000000u, 0x00700000u, 0x80280000u, 0x000225fdu,
|
||||||
|
|||||||
Reference in New Issue
Block a user