naga-agal: Fix using matrix opcodes with indirect source register

In indirect mode, We need to increment the indirect_offset value
to load subsequent matrix rows.
This commit is contained in:
Aaron Hill 2023-11-24 14:54:43 -05:00 committed by TÖRÖK Attila
parent 884f46241c
commit 78c34c1be9
1 changed files with 11 additions and 4 deletions

View File

@ -1061,7 +1061,7 @@ impl<'a> NagaBuilder<'a> {
let (num_rows, ty, vec_size, out_size) = match opcode { let (num_rows, ty, vec_size, out_size) = match opcode {
Opcode::M33 => ( Opcode::M33 => (
3, 3u8,
self.matrix3x3f, self.matrix3x3f,
VectorSize::Tri, VectorSize::Tri,
VertexAttributeFormat::Float3, VertexAttributeFormat::Float3,
@ -1084,11 +1084,18 @@ impl<'a> NagaBuilder<'a> {
// Read each row of the matrix // Read each row of the matrix
let mut components = Vec::with_capacity(num_rows.into()); let mut components = Vec::with_capacity(num_rows.into());
for i in 0..num_rows { for i in 0..num_rows {
let source2_row = self.emit_source_field_load_with_swizzle_out( let modified_source_field = match source2.direct_mode {
&SourceField { DirectMode::Direct => SourceField {
reg_num: source2.reg_num + i, reg_num: source2.reg_num + (i as u16),
..source2.clone() ..source2.clone()
}, },
DirectMode::Indirect => SourceField {
indirect_offset: source2.indirect_offset + i,
..source2.clone()
},
};
let source2_row = self.emit_source_field_load_with_swizzle_out(
&modified_source_field,
false, false,
vec_size, vec_size,
)?; )?;