Skip to content

Commit

Permalink
tint ast fuzzer: look for dxc in default path if not passed in via op…
Browse files Browse the repository at this point in the history
…tions

If dxc path is not passed in, look for it first by name. This was the
original behaviour, but was accidentally modified in:
https://dawn-review.googlesource.com/c/dawn/+/190920

Bug: 380270956
Change-Id: I959d73868cb6d0a8997f7cc0624b96bf515c1c37
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/218317
Reviewed-by: James Price <[email protected]>
Commit-Queue: Antonio Maiorano <[email protected]>
  • Loading branch information
amaiorano authored and Dawn LUCI CQ committed Dec 6, 2024
1 parent 699c1df commit 5fbc653
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/tint/lang/hlsl/writer/writer_ast_fuzz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ void ASTFuzzer(const tint::Program& program,
constexpr bool must_validate = false;

const char* dxc_path = validate::kDxcDLLName;
Result<tint::hlsl::writer::Output> res;
if (!context.options.dxc.empty()) {
dxc_path = context.options.dxc.c_str();
}
auto dxc = tint::Command::LookPath(dxc_path);

Result<tint::hlsl::writer::Output> res;
if (dxc.Found()) {
// If validating with DXC, run renamer transform first to avoid DXC validation failures.
ast::transform::DataMap inputs, outputs;
inputs.Add<ast::transform::Renamer::Config>(ast::transform::Renamer::Target::kHlslKeywords);
if (auto renamer_res = tint::ast::transform::Renamer{}.Apply(program, inputs, outputs)) {
Expand All @@ -91,7 +96,6 @@ void ASTFuzzer(const tint::Program& program,
}
res = tint::hlsl::writer::Generate(*renamer_res, options);
}

} else {
res = tint::hlsl::writer::Generate(program, options);
}
Expand All @@ -104,7 +108,6 @@ void ASTFuzzer(const tint::Program& program,
std::cout << "Dumping generated HLSL:\n" << res->hlsl << std::endl;
}

auto dxc = tint::Command::LookPath(dxc_path);
if (dxc.Found()) {
uint32_t hlsl_shader_model = 60;
bool require_16bit_types = false;
Expand Down

0 comments on commit 5fbc653

Please sign in to comment.