Fix D3D12_AMD_Shader_Extensions test for DXIL support

* We can't build with -O0, it has to be at least -O1 for DXIL. We also need -Ges
  / strictness on both builds.
This commit is contained in:
baldurk
2021-05-10 17:02:49 +01:00
parent 9c50927777
commit 732ccb2d89
3 changed files with 30 additions and 23 deletions
@@ -321,25 +321,18 @@ void main(uint3 threadID : SV_DispatchThreadID)
{
vsblob[i] = Compile(D3DDefaultVertex, "main", "vs" + profilesuffix[i]);
// disable DXIL for now as it seems to crash
// if(i == 2 && !m_DXILSupport)
if(i == 2)
{
psblob[i] = Compile(BasicPixel, "main", "ps" + profilesuffix[i], false);
csblob[i] = Compile(BasicCompute, "main", "cs" + profilesuffix[i], false);
}
else
{
valid[i] = true;
// if we don't have DXIL support we can't compile anything, even a dummy shader
if(i == 2 && !m_DXILSupport)
continue;
std::string defines = "#define AMD_EXT_SHADER_INTRINSIC_UAV_OVERRIDE u7\n\n";
valid[i] = true;
// can't skip optimising and still have the extensions work, sadly
psblob[i] =
Compile(defines + ags_header + BaryCentricPixel, "main", "ps" + profilesuffix[i], false);
csblob[i] =
Compile(defines + ags_header + MaxCompute, "main", "cs" + profilesuffix[i], false);
}
std::string defines = "#define AMD_EXT_SHADER_INTRINSIC_UAV_OVERRIDE u7\n\n";
// can't skip optimising and still have the extensions work, sadly
psblob[i] =
Compile(defines + ags_header + BaryCentricPixel, "main", "ps" + profilesuffix[i], false);
csblob[i] = Compile(defines + ags_header + MaxCompute, "main", "cs" + profilesuffix[i], false);
pso[i] = MakePSO().RootSig(sig).InputLayout().VS(vsblob[i]).PS(psblob[i]);
cso[i] = MakePSO().RootSig(sig).CS(csblob[i]);
@@ -400,9 +393,6 @@ void main(uint3 threadID : SV_DispatchThreadID)
ClearRenderTargetView(cmd, rtv, {0.2f, 0.2f, 0.2f, 1.0f});
UINT zero[4] = {};
cmd->ClearUnorderedAccessViewUint(uav1gpu, uav1cpu, outBuf, zero, 0, NULL);
// force inclusion of all pipelines
for(int i = 0; i < ARRAY_COUNT(pso); i++)
{
@@ -431,6 +421,9 @@ void main(uint3 threadID : SV_DispatchThreadID)
pushMarker(cmd, passname[i]);
UINT zero[4] = {};
cmd->ClearUnorderedAccessViewUint(uav1gpu, uav1cpu, outBuf, zero, 0, NULL);
OMSetRenderTargets(cmd, {rtv}, {});
IASetVertexBuffer(cmd, vb, sizeof(DefaultA2V), 0);
@@ -439,7 +432,7 @@ void main(uint3 threadID : SV_DispatchThreadID)
RSSetScissorRect(cmd, {0, 0, screenWidth, screenHeight});
RSSetViewport(cmd, {x * float(i % 2), i * float(i / 2), x, y, 0.0f, 1.0f});
RSSetViewport(cmd, {x * float(i % 2), y * float(i / 2), x, y, 0.0f, 1.0f});
setMarker(cmd, passname[i] + " Draw");
cmd->SetPipelineState(pso[i]);
+9 -2
View File
@@ -1063,9 +1063,16 @@ ID3DBlobPtr D3D12GraphicsTest::Compile(std::string src, std::string entry, std::
std::vector<std::wstring> argStorage;
argStorage.push_back(L"-WX");
argStorage.push_back(L"-O0");
if(skipoptimise)
{
argStorage.push_back(L"-O0");
argStorage.push_back(L"-Od");
}
else
{
argStorage.push_back(L"-Ges");
argStorage.push_back(L"-O1");
}
argStorage.push_back(L"-Zi");
argStorage.push_back(L"-Qembed_debug");
@@ -1135,7 +1142,7 @@ ID3DBlobPtr D3D12GraphicsTest::Compile(std::string src, std::string entry, std::
if(skipoptimise)
flags |= D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_OPTIMIZATION_LEVEL0;
else
flags |= D3DCOMPILE_OPTIMIZATION_LEVEL0;
flags |= D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_OPTIMIZATION_LEVEL0;
HRESULT hr = dyn_D3DCompile(src.c_str(), src.length(), "", NULL, NULL, entry.c_str(),
profile.c_str(), flags, 0, &blob, &error);
@@ -72,6 +72,13 @@ class D3D12_AMD_Shader_Extensions(rdtest.TestCase):
# We always check the CS pipe to ensure the reflection is OK
cs_pipe = self.get_resource_by_name("cspipe" + pass_type)
if cs_pipe is None:
# everything but DXIL we must get, DXIL we may not be able to compile
if pass_type != "SM60":
raise rdtest.TestFailureException("Didn't find compute pipeline for {}".format(pass_type))
continue
pipe = cs_pipe.resourceId
cs = rd.ResourceId()