Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/thirdparty/tint/src/tint/lang/core/ir/validator.cc b/thirdparty/tint/src/tint/lang/core/ir/validator.cc
index a0dfe1e..451c918 100644
--- a/thirdparty/tint/src/tint/lang/core/ir/validator.cc
+++ b/thirdparty/tint/src/tint/lang/core/ir/validator.cc
@@ -2257,7 +2257,15 @@ void Validator::CheckType(const core::type::Type* root,

cur_offset += (member->Offset() - cur_offset) + member->MinimumRequiredSize();
}
- if (str->Size() < cur_offset) {
+ // GODOT PATCH (patches/0007, extends patches/0002): the total-size
+ // check must honor kAllowStructMemberSizeMismatch like the
+ // member-size check above — spec-constant-sized arrays leave the
+ // struct's Size() decoration at its unfolded value. Empirically
+ // required for the WebGPU driver (a build without it renders
+ // nothing); rationale and caveats in thirdparty/tint/patches/README.md
+ // and the introducing commit.
+ if (!capabilities_.Contains(Capability::kAllowStructMemberSizeMismatch) &&
+ str->Size() < cur_offset) {
diag() << "struct size (" << str->Size()
<< ") is smaller than the end of the last member (" << cur_offset << ")";
return false;
1 change: 1 addition & 0 deletions thirdparty/tint/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ done
| 0004 | shader_io.cc | Point size | Accept non-constant `point_size` stores |
| 0005 | ir_to_program.cc | Spec constants | `@size` emission guard + capability |
| 0006 | parse_num.cc | Vendoring | Replace `absl::from_chars` with `std::from_chars` |
| 0007 | validator.cc | UBO layout | Extend `kAllowStructMemberSizeMismatch` to the struct TOTAL-size check (spec-constant-sized arrays leave `Size()` at its unfolded value) |

## Logical Groups

Expand Down
10 changes: 9 additions & 1 deletion thirdparty/tint/src/tint/lang/core/ir/validator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,15 @@ void Validator::CheckType(const core::type::Type* root,

cur_offset += (member->Offset() - cur_offset) + member->MinimumRequiredSize();
}
if (str->Size() < cur_offset) {
// GODOT PATCH (patches/0007, extends patches/0002): the total-size
// check must honor kAllowStructMemberSizeMismatch like the
// member-size check above — spec-constant-sized arrays leave the
// struct's Size() decoration at its unfolded value. Empirically
// required for the WebGPU driver (a build without it renders
// nothing); rationale and caveats in thirdparty/tint/patches/README.md
// and the introducing commit.
if (!capabilities_.Contains(Capability::kAllowStructMemberSizeMismatch) &&
str->Size() < cur_offset) {
diag() << "struct size (" << str->Size()
<< ") is smaller than the end of the last member (" << cur_offset << ")";
return false;
Expand Down