diff --git a/src/tint/utils/io/command_posix.cc b/src/tint/utils/io/command_posix.cc index ff0a138920..b3371e7613 100644 --- a/src/tint/utils/io/command_posix.cc +++ b/src/tint/utils/io/command_posix.cc @@ -251,7 +251,9 @@ Command::Output Command::Exec(std::initializer_list arguments) cons std::vector args; args.emplace_back(path_.c_str()); for (auto& arg : arguments) { - args.emplace_back(arg.c_str()); + if (!arg.empty()) { + args.emplace_back(arg.c_str()); + } } args.emplace_back(nullptr); auto res = execv(path_.c_str(), const_cast(args.data())); diff --git a/src/tint/utils/io/command_windows.cc b/src/tint/utils/io/command_windows.cc index 36c39c6f03..8c94e254f4 100644 --- a/src/tint/utils/io/command_windows.cc +++ b/src/tint/utils/io/command_windows.cc @@ -200,7 +200,9 @@ Command::Output Command::Exec(std::initializer_list arguments) cons std::stringstream args; args << path_; for (auto& arg : arguments) { - args << " " << arg; + if (!arg.empty()) { + args << " " << arg; + } } PROCESS_INFORMATION pi{}; diff --git a/src/tint/val/hlsl.cc b/src/tint/val/hlsl.cc index 6119570266..eabbe68488 100644 --- a/src/tint/val/hlsl.cc +++ b/src/tint/val/hlsl.cc @@ -69,21 +69,16 @@ Result HlslUsingDXC(const std::string& dxc_path, break; } - std::string profile = - "-T " + std::string(stage_prefix) + "_" + std::string(shader_model_version); - if (require_16bit_types) { - // Add "-enable-16bit-types" flag if required - profile = profile + " -enable-16bit-types"; - } - // Match Dawn's compile flags // See dawn\src\dawn_native\d3d12\RenderPipelineD3D12.cpp // and dawn_native\d3d12\ShaderModuleD3D12.cpp (GetDXCArguments) - auto res = dxc(profile.c_str(), - "-E " + ep.first, // Entry point - "/Zpr", // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR - "/Gis", // D3DCOMPILE_IEEE_STRICTNESS - file.Path()); + auto res = dxc( + "-T " + std::string(stage_prefix) + "_" + std::string(shader_model_version), // Profile + "-E " + ep.first, // Entry point + "/Zpr", // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR + "/Gis", // D3DCOMPILE_IEEE_STRICTNESS + require_16bit_types ? "-enable-16bit-types" : "", // Enable 16-bit if required + file.Path()); if (!res.out.empty()) { if (!result.output.empty()) { result.output += "\n";