[glsl-in] error on a matCx2 used with the std140 layout (#1806)

This commit is contained in:
Teodor Tanasoaia
2022-04-11 06:42:02 +02:00
committed by GitHub
parent a3d968e795
commit fa44d9d536
2 changed files with 14 additions and 0 deletions

View File

@@ -94,6 +94,12 @@ pub enum ErrorKind {
/// prioritize work.
#[error("Unknown layout qualifier: {0}")]
UnknownLayoutQualifier(String),
/// Unsupported matrix of the form matCx2
///
/// Our IR expects matrices of the form matCx2 to have a stride of 8 however
/// matrices in the std140 layout have a stride of at least 16
#[error("unsupported matrix of the form matCx2 in std140 block layout")]
UnsupportedMatrixTypeInStd140,
/// A variable with the same name already exists in the current scope.
#[cfg(feature = "glsl-validate")]
#[error("Variable already declared: {0}")]

View File

@@ -121,6 +121,14 @@ pub fn calculate_offset(
align = align_up(align, 16);
}
// See comment on the error kind
if StructLayout::Std140 == layout && rows == crate::VectorSize::Bi {
errors.push(Error {
kind: ErrorKind::UnsupportedMatrixTypeInStd140,
meta,
});
}
(align, align * columns as u32)
}
TypeInner::Struct { ref members, .. } => {