shader: support packed D16 XYZW formatted buffer stores

Co-authored-by: fxpw <fxpw@outlook.com>
This commit is contained in:
nmzik
2026-10-14 19:35:08 +02:00
parent c914435f20
commit 4843d8d942
8 changed files with 107 additions and 29 deletions
@@ -474,11 +474,12 @@ void ValidateProgram(const Program& program, bool require_ssa) {
return Fail("indirect buffer requires a scalar, raw 8/16-bit, raw DWORD x1/x2/x3/x4, "
"or formatted X load");
}
const bool packed_formatted_load =
BufferAccessOf(inst.GetOpcode()) == BufferAccess::Read && memory.formatted &&
const auto access = BufferAccessOf(inst.GetOpcode());
const bool packed_formatted =
(access == BufferAccess::Read || access == BufferAccess::Write) && memory.formatted &&
memory.data_bits == 16u && memory.component_count == 4u && buffer_components == 2u;
if (buffer_components > 1u &&
(!vector_buffer || (memory.data_bits != 32u && !packed_formatted_load) ||
(!vector_buffer || (memory.data_bits != 32u && !packed_formatted) ||
memory.data_dwords != buffer_components || memory.component_index != 0u)) {
return Fail(fmt::format("{} has inconsistent native-wide metadata",
ValueOpcodeName(inst.GetOpcode())));