shader: admit bounded multi-component formatted buffer loads

Co-authored-by: fxpw <fxpw@outlook.com>
This commit is contained in:
nmzik
2026-10-14 22:04:55 +02:00
parent dcc642551f
commit 6455546f26
3 changed files with 89 additions and 30 deletions
@@ -2637,7 +2637,8 @@ private:
bool IndirectBufferAccess(const Inst& inst) const {
const auto opcode = inst.GetOpcode();
if (opcode != ValueOpcode::StoreBufferU32 && opcode != ValueOpcode::StoreBufferU8 &&
opcode != ValueOpcode::StoreBufferU32x4 && opcode != ValueOpcode::LoadBufferU32x2) return false;
opcode != ValueOpcode::StoreBufferU32x4 && opcode != ValueOpcode::LoadBufferU32x2 &&
opcode != ValueOpcode::LoadBufferU32x3 && opcode != ValueOpcode::LoadBufferU32x4) return false;
const auto index = inst.Flags<MemoryFlags>().index;
if (index >= m_program.memory_info.size()) return false;
const auto& memory = m_program.memory_info[index];
@@ -2652,8 +2653,11 @@ private:
if (opcode == ValueOpcode::StoreBufferU32x4)
return memory.formatted && memory.data_bits == 32u && memory.data_dwords == 4u &&
memory.component_count == 4u;
return memory.formatted && memory.data_bits == 16u && memory.data_dwords == 2u &&
memory.component_count == 4u;
const auto components = BufferComponentCount(opcode);
return memory.formatted && memory.data_dwords == components &&
((memory.data_bits == 32u && memory.component_count == components) ||
(opcode == ValueOpcode::LoadBufferU32x2 && memory.data_bits == 16u &&
memory.component_count == 4u));
}
bool MatchDescriptorTable(Inst& handle, const DescriptorSource& descriptor,