mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
reader/spirv: Handle the MatrixStride decoration
Add `transform::DecomposeStridedMatrix`, which replaces matrix members of storage or uniform buffer structures, that have a [[stride]] decoration, into an array of N column vectors. This is required to correctly handle `mat2x2` matrices in UBOs, as std140 rules will expect a default stride of 16 bytes, when in WGSL the default structure layout expects a stride of 8 bytes. Bug: tint:1047 Change-Id: If5ca3c6ec087bbc1ac31a8d9a657b99bf34042a4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59840 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
c6cbe3fda6
commit
97668c8c37
@@ -3937,13 +3937,20 @@ bool Resolver::ValidateStructure(const sem::Struct* str) {
|
||||
auto has_position = false;
|
||||
ast::InvariantDecoration* invariant_attribute = nullptr;
|
||||
for (auto* deco : member->Declaration()->decorations()) {
|
||||
if (!(deco->Is<ast::BuiltinDecoration>() ||
|
||||
deco->Is<ast::InterpolateDecoration>() ||
|
||||
deco->Is<ast::InvariantDecoration>() ||
|
||||
deco->Is<ast::LocationDecoration>() ||
|
||||
deco->Is<ast::StructMemberOffsetDecoration>() ||
|
||||
deco->Is<ast::StructMemberSizeDecoration>() ||
|
||||
deco->Is<ast::StructMemberAlignDecoration>())) {
|
||||
if (!deco->IsAnyOf<ast::BuiltinDecoration, //
|
||||
ast::InternalDecoration, //
|
||||
ast::InterpolateDecoration, //
|
||||
ast::InvariantDecoration, //
|
||||
ast::LocationDecoration, //
|
||||
ast::StructMemberOffsetDecoration, //
|
||||
ast::StructMemberSizeDecoration, //
|
||||
ast::StructMemberAlignDecoration>()) {
|
||||
if (deco->Is<ast::StrideDecoration>() &&
|
||||
IsValidationDisabled(
|
||||
member->Declaration()->decorations(),
|
||||
ast::DisabledValidation::kIgnoreStrideDecoration)) {
|
||||
continue;
|
||||
}
|
||||
AddError("decoration is not valid for structure members",
|
||||
deco->source());
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user