tests: cover low-alpha packed tiler conversion in both directions

This commit is contained in:
nmzik committed 2026-10-29 18:37:29 +01:00
1 parent 4592e4c178
commit 25f3ba4eae
1 file changed
+10
+10
View File
@@ -20889,6 +20889,14 @@ public:
std::swap(channels[0], channels[2]);
std::memcpy(dst->data() + dst_offset, channels.data(),
sizeof(channels));
} else if (info.GetColorTransform() == ColorTransform::Rotate2_10_10_10) {
uint32_t packed = 0;
std::memcpy(&packed, src.data() + src_offset, sizeof(packed));
// The guest format stores the two-bit channel low; the host format stores it high.
const uint32_t alpha = to_tiled ? packed >> 30u : packed & 3u;
const uint32_t color = to_tiled ? packed & 0x3fffffffu : packed >> 2u;
packed = to_tiled ? (color << 2u) | alpha : color | (alpha << 30u);
std::memcpy(dst->data() + dst_offset, &packed, sizeof(packed));
} else {
std::memcpy(dst->data() + dst_offset, src.data() + src_offset,
block.bytes_per_element);
@@ -21282,6 +21290,8 @@ public:
convert_reference(false, &cpu, tiled, layout);
gpu_detile(tiled, &gpu, total.size, total.size, layout);
compare("format bytes", cpu, gpu);
if (layout.GetColorTransform() == ColorTransform::Rotate2_10_10_10)
check_round_trip("low-alpha packed format", total.size, layout);
++format_cases;
}
}