Merge pull request #16857 from adriadam10/fix/main-depth24-tolerance

fix(main): accept one 24-bit step of driver rounding in the depth24 test
This commit is contained in:
Adrià authored and GitHub committed 2026-11-07 19:32:23 +01:00
commit 6b733c4ef2
1 file changed
+7 -2
@@ -732,6 +732,11 @@ void CheckPacked16(AgcDriver::VulkanDevice& device, std::uint8_t* texels, std::u
}
}
bool SameDepth24(std::uint32_t bits, std::uint32_t depth) {
const auto actual = StoreField(bits, 0xffffffu);
return actual + 1u >= depth && actual <= depth + 1u;
}
void CheckDepth24(AgcDriver::VulkanDevice& device, std::uint8_t* texels) {
for (std::uint32_t index = 0; index < LoadWidth; ++index) {
const auto texel = LoadTexel(index);
@@ -740,13 +745,13 @@ void CheckDepth24(AgcDriver::VulkanDevice& device, std::uint8_t* texels) {
Run(device, LoadXyzw, TextureDescriptor(texels, 141u, SwizzleXYZW, LoadWidth), {}, LoadGroups);
for (std::uint32_t index = 0; index < LoadWidth; ++index) {
const auto depth = LoadTexel(index) & 0xffffffu;
Require(StoreField(Output[index * 4u], 0xffffffu) == depth, "image_load of 8_24_UNORM reads the wrong depth for format 141: " + Hex(Output[index * 4u]) + " for texel " + Hex(LoadTexel(index)));
Require(SameDepth24(Output[index * 4u], depth), "image_load of 8_24_UNORM reads the wrong depth for format 141: " + Hex(Output[index * 4u]) + " for texel " + Hex(LoadTexel(index)));
Require(Output[index * 4u + 1u] == 0u && Output[index * 4u + 2u] == 0u && Output[index * 4u + 3u] == 0x3f800000u, "image_load of 8_24_UNORM must give G=0 B=0 A=1 for format 141");
}
Run(device, SampleLz, TextureDescriptor(texels, 141u, SwizzleXYZW, LoadWidth), PointSampler, 1);
const auto depth = LoadTexel(0) & 0xffffffu;
for (std::uint32_t tid = 0; tid < Threads; ++tid) {
Require(StoreField(Output[tid * 4u], 0xffffffu) == depth, "image_sample_lz of 8_24_UNORM reads the wrong depth for format 141");
Require(SameDepth24(Output[tid * 4u], depth), "image_sample_lz of 8_24_UNORM reads the wrong depth for format 141");
Require(Output[tid * 4u + 1u] == 0u && Output[tid * 4u + 2u] == 0u && Output[tid * 4u + 3u] == 0x3f800000u, "image_sample_lz of 8_24_UNORM must give G=0 B=0 A=1 for format 141");
}
}