[tint][ast] Fix ClampFragDepth fuzzer
It was erroring when the offsets were not correctly aligned.
Bug: 339704597
Change-Id: I778add3df193c6e9cade51ed68a1d32fbccc1fbc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/187683
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc
index 6de6553..7b75d69 100644
--- a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc
+++ b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc
@@ -33,8 +33,13 @@
namespace {
bool CanRun(const ClampFragDepth::Config& config) {
- if (config.offsets && config.offsets->min >= config.offsets->max) {
- return false; // member offset collision / non-ascending
+ if (config.offsets) {
+ if (config.offsets->min >= config.offsets->max) {
+ return false; // member offset collision / non-ascending
+ }
+ if ((config.offsets->min & 3) != 0 || (config.offsets->max & 3) != 0) {
+ return false; // Offsets need 4-byte alignment.
+ }
}
return true;
}