Don't hard-fail on results of undefined tests in shader debug zoo

This commit is contained in:
baldurk
2022-09-19 16:43:05 +01:00
parent 00d7827d06
commit aa412ddf89
4 changed files with 53 additions and 10 deletions
@@ -244,7 +244,7 @@ float4 main(v2f IN) : SV_Target0
// test reading/writing byte address data
// mis-aligned loads
if(IN.tri == 35)
if(IN.tri == 35) // undefined-test
{
// use this to ensure the compiler doesn't know we're using fixed locations
uint z = intval - IN.tri - 7;
@@ -290,7 +290,7 @@ float4 main(v2f IN) : SV_Target0
}
// mis-aligned store
if(IN.tri == 40)
if(IN.tri == 40) // undefined-test
{
// use this to ensure the compiler doesn't know we're using fixed locations
uint z = intval - IN.tri - 7;
@@ -302,7 +302,7 @@ float4 main(v2f IN) : SV_Target0
return asfloat(byterwtest.Load(z2+0).x);
}
// mis-aligned loads
if(IN.tri == 41)
if(IN.tri == 41) // undefined-test
{
// use this to ensure the compiler doesn't know we're using fixed locations
uint z = intval - IN.tri - 7;
@@ -901,6 +901,21 @@ float4 main(v2f IN, uint samp : SV_SampleIndex) : SV_Target0
const uint32_t numTests = atoi(pixel.c_str() + lastTest) + 1;
std::string undefined_tests = "Undefined tests:";
size_t undef = pixel.find("undefined-test");
while(undef != std::string::npos)
{
size_t testNumStart = pixel.rfind("IN.tri == ", undef);
testNumStart += sizeof("IN.tri == ") - 1;
size_t testNumEnd = pixel.find_first_not_of("0123456789", testNumStart);
undefined_tests += " ";
undefined_tests += pixel.substr(testNumStart, testNumEnd - testNumStart);
undef = pixel.find("undefined-test", undef + 1);
}
if(opts2.TypedUAVLoadAdditionalFormats)
common += "\n#define TYPED_UAV_EXT 1\n";
@@ -1054,6 +1069,8 @@ float4 main(v2f IN, uint samp : SV_SampleIndex) : SV_Target0
ctx->OMSetRenderTargetsAndUnorderedAccessViews(1, &fltRT.GetInterfacePtr(), NULL, 1, 3, uavs,
NULL);
setMarker(undefined_tests);
setMarker("Main Test");
ctx->DrawInstanced(3, numTests, 0, 0);
@@ -294,7 +294,7 @@ float4 main(v2f IN) : SV_Target0
// test reading/writing byte address data
// mis-aligned loads
if(IN.tri == 35)
if(IN.tri == 35) // undefined-test
{
// use this to ensure the compiler doesn't know we're using fixed locations
uint z = intval - IN.tri - 7;
@@ -340,7 +340,7 @@ float4 main(v2f IN) : SV_Target0
}
// mis-aligned store
if(IN.tri == 40)
if(IN.tri == 40) // undefined-test
{
// use this to ensure the compiler doesn't know we're using fixed locations
uint z = intval - IN.tri - 7;
@@ -352,7 +352,7 @@ float4 main(v2f IN) : SV_Target0
return asfloat(byterwtest.Load(z2+0).x);
}
// mis-aligned loads
if(IN.tri == 41)
if(IN.tri == 41) // undefined-test
{
// use this to ensure the compiler doesn't know we're using fixed locations
uint z = intval - IN.tri - 7;
@@ -753,6 +753,20 @@ float4 main(v2f IN, uint samp : SV_SampleIndex) : SV_Target0
const uint32_t numTests = atoi(pixel.c_str() + lastTest) + 1;
std::string undefined_tests = "Undefined tests:";
size_t undef = pixel.find("undefined-test");
while(undef != std::string::npos)
{
size_t testNumStart = pixel.rfind("IN.tri == ", undef);
testNumStart += sizeof("IN.tri == ") - 1;
size_t testNumEnd = pixel.find_first_not_of("0123456789", testNumStart);
undefined_tests += " ";
undefined_tests += pixel.substr(testNumStart, testNumEnd - testNumStart);
undef = pixel.find("undefined-test", undef + 1);
}
ID3DBlobPtr vsblob = Compile(common + vertex, "main", "vs_5_0");
ID3DBlobPtr psblob = Compile(common + pixel, "main", "ps_5_0");
@@ -1080,6 +1094,8 @@ float4 main(v2f IN, uint samp : SV_SampleIndex) : SV_Target0
MakeRTV(bb).Format(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB).CreateCPU(2);
ClearRenderTargetView(cmd, rtv, {0.2f, 0.2f, 0.2f, 1.0f});
setMarker(cmd, undefined_tests);
ID3D12PipelineStatePtr psos[2] = {pso_5_0, pso_5_1};
float blitOffsets[2] = {0.0f, 4.0f};
D3D12_RECT scissors[2] = {{0, 0, (int)texDim, 4}, {0, 4, (int)texDim, 8}};
@@ -10,6 +10,8 @@ class D3D11_Shader_Debug_Zoo(rdtest.TestCase):
# Jump to the action
action = self.find_action("Main Test").next
undefined_tests = [int(test) for test in self.find_action("Undefined tests: ").customName.split(" ")[2:]]
self.controller.SetFrameEvent(action.eventId, False)
pipe: rd.PipeState = self.controller.GetPipelineState()
@@ -32,8 +34,11 @@ class D3D11_Shader_Debug_Zoo(rdtest.TestCase):
try:
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 4 * test, 0, debugged.value.f32v[0:4])
except rdtest.TestFailureException as ex:
failed = True
rdtest.log.error("Test {} did not match. {}".format(test, str(ex)))
if test in undefined_tests:
rdtest.log.comment("Undefined test {} did not match. {}".format(test, str(ex)))
else:
rdtest.log.error("Test {} did not match. {}".format(test, str(ex)))
failed = True
continue
finally:
self.controller.FreeTrace(trace)
@@ -11,6 +11,8 @@ class D3D12_Shader_Debug_Zoo(rdtest.TestCase):
rdtest.log.success("Shader debugging not enabled, skipping test")
return
undefined_tests = [int(test) for test in self.find_action("Undefined tests: ").customName.split(" ")[2:]]
failed = False
shaderModels = ["sm_5_0", "sm_5_1"]
@@ -43,8 +45,11 @@ class D3D12_Shader_Debug_Zoo(rdtest.TestCase):
try:
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 4 * test, 0, debugged.value.f32v[0:4])
except rdtest.TestFailureException as ex:
failed = True
rdtest.log.error("Test {} did not match. {}".format(test, str(ex)))
if test in undefined_tests:
rdtest.log.comment("Undefined test {} did not match. {}".format(test, str(ex)))
else:
rdtest.log.error("Test {} did not match. {}".format(test, str(ex)))
failed = True
continue
finally:
self.controller.FreeTrace(trace)