Skip to content

Commit

Permalink
[hlsl-out] Fix reading from mat3
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored and kvark committed Aug 17, 2021
1 parent ba92640 commit 91ea6e3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/back/hlsl/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ impl<W: fmt::Write> super::Writer<'_, W> {
rows as u8,
columns as u8,
)?;
let row_stride = width as u32 * columns as u32;

// Note: Matrices containing vec3s, due to padding, act like they contain vec4s.
let padded_columns = match columns {
crate::VectorSize::Tri => 4,
columns => columns as u32,
};

let row_stride = width as u32 * padded_columns;
let iter = (0..rows as u32).map(|i| {
let ty_inner = crate::TypeInner::Vector {
size: columns,
Expand Down

0 comments on commit 91ea6e3

Please sign in to comment.