Make HLSL validation run with same flags as Dawn
FXC is buggy, and I recently landed changes in Dawn to run with "/O0" rather than /"O2" because of these bugs. Let's make sure Tint end-to-end tests do the same. Also do the same when running against DXC. Bug: dawn:1203 Change-Id: I1a30f16dee8306bd645d87b3ccb0cc87691c5972 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71800 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
c55c7715db
commit
cf3880201b
|
@ -63,7 +63,14 @@ Result HlslUsingDXC(const std::string& dxc_path,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto res = dxc(profile, "-E " + ep.first, file.Path());
|
// Match Dawn's compile flags
|
||||||
|
// See dawn\src\dawn_native\d3d12\RenderPipelineD3D12.cpp
|
||||||
|
// and dawn_native\d3d12\ShaderModuleD3D12.cpp (GetDXCArguments)
|
||||||
|
const char* compileFlags =
|
||||||
|
"/Zpr " // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
|
||||||
|
"/Gis"; // D3DCOMPILE_IEEE_STRICTNESS
|
||||||
|
|
||||||
|
auto res = dxc(profile, "-E " + ep.first, compileFlags, file.Path());
|
||||||
if (!res.out.empty()) {
|
if (!res.out.empty()) {
|
||||||
if (!result.output.empty()) {
|
if (!result.output.empty()) {
|
||||||
result.output += "\n";
|
result.output += "\n";
|
||||||
|
@ -129,11 +136,26 @@ Result HlslUsingFXC(const std::string& source,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Match Dawn's compile flags
|
||||||
|
// See dawn\src\dawn_native\d3d12\RenderPipelineD3D12.cpp
|
||||||
|
UINT compileFlags = D3DCOMPILE_OPTIMIZATION_LEVEL0 |
|
||||||
|
D3DCOMPILE_PACK_MATRIX_ROW_MAJOR |
|
||||||
|
D3DCOMPILE_IEEE_STRICTNESS;
|
||||||
|
|
||||||
ComPtr<ID3DBlob> compiledShader;
|
ComPtr<ID3DBlob> compiledShader;
|
||||||
ComPtr<ID3DBlob> errors;
|
ComPtr<ID3DBlob> errors;
|
||||||
if (FAILED(d3dCompile(source.c_str(), source.length(), nullptr, nullptr,
|
HRESULT cr = d3dCompile(source.c_str(), // pSrcData
|
||||||
nullptr, ep.first.c_str(), profile, 0, 0,
|
source.length(), // SrcDataSize
|
||||||
&compiledShader, &errors))) {
|
nullptr, // pSourceName
|
||||||
|
nullptr, // pDefines
|
||||||
|
nullptr, // pInclude
|
||||||
|
ep.first.c_str(), // pEntrypoint
|
||||||
|
profile, // pTarget
|
||||||
|
compileFlags, // Flags1
|
||||||
|
0, // Flags2
|
||||||
|
&compiledShader, // ppCode
|
||||||
|
&errors); // ppErrorMsgs
|
||||||
|
if (FAILED(cr)) {
|
||||||
result.output = static_cast<char*>(errors->GetBufferPointer());
|
result.output = static_cast<char*>(errors->GetBufferPointer());
|
||||||
result.failed = true;
|
result.failed = true;
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue