Restore "[tint][fuzz] Enable AllowedFeatures::Everything()"
Bug: tint:2223
This reverts commit 48de84dfe6458204fe463d1249e336680302ff71.
Change-Id: I4f3946d937f9b467dab0c30058c4a75caf2db19d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/185583
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/cmd/fuzz/wgsl/fuzz.cc b/src/tint/cmd/fuzz/wgsl/fuzz.cc
index 6e4d9b8..23bbe0f 100644
--- a/src/tint/cmd/fuzz/wgsl/fuzz.cc
+++ b/src/tint/cmd/fuzz/wgsl/fuzz.cc
@@ -30,6 +30,8 @@
#include <iostream>
#include <thread>
+#include "src/tint/lang/wgsl/common/allowed_features.h"
+#include "src/tint/lang/wgsl/reader/options.h"
#include "src/tint/lang/wgsl/reader/reader.h"
#include "src/tint/utils/containers/vector.h"
#include "src/tint/utils/macros/defer.h"
@@ -87,8 +89,14 @@
tint::Source::File file("test.wgsl", wgsl);
// Parse the WGSL program.
- auto program = tint::wgsl::reader::Parse(&file);
+ tint::wgsl::reader::Options parse_options;
+ parse_options.allowed_features = tint::wgsl::AllowedFeatures::Everything();
+ auto program = tint::wgsl::reader::Parse(&file, parse_options);
if (!program.IsValid()) {
+ if (options.verbose) {
+ std::cerr << "invalid WGSL program: " << std::endl
+ << program.Diagnostics() << std::endl;
+ }
return;
}
diff --git a/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc b/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc
index b745f56..3b41233 100644
--- a/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc
+++ b/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc
@@ -46,7 +46,9 @@
return;
}
- auto dst = tint::wgsl::writer::IRToProgram(ir);
+ writer::ProgramOptions program_options;
+ program_options.allowed_features = AllowedFeatures::Everything();
+ auto dst = tint::wgsl::writer::IRToProgram(ir, program_options);
if (!dst.IsValid()) {
std::cerr << "IR:\n" << core::ir::Disassemble(ir) << std::endl;
if (auto result = tint::wgsl::writer::Generate(dst, {}); result == Success) {
diff --git a/src/tint/lang/wgsl/ir_roundtrip_test.cc b/src/tint/lang/wgsl/ir_roundtrip_test.cc
index 5cb3f99..07fcbb3 100644
--- a/src/tint/lang/wgsl/ir_roundtrip_test.cc
+++ b/src/tint/lang/wgsl/ir_roundtrip_test.cc
@@ -196,6 +196,14 @@
)");
}
+TEST_F(IRToProgramRoundtripTest, SingleFunction_UnrestrictedPointerParameters) {
+ RUN_TEST(R"(
+fn f(p : ptr<uniform, i32>) -> i32 {
+ return *(p);
+}
+)");
+}
+
////////////////////////////////////////////////////////////////////////////////
// Struct declaration
////////////////////////////////////////////////////////////////////////////////