Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v5: New patch.
Makefile.am | 1 + tests/multiple-rt.shader_test | 19 +++++++++++++++++++ tests/shader_runner.c | 26 ++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/multiple-rt.shader_test
diff --git a/Makefile.am b/Makefile.am index 400dc8aae..6e827175a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -108,6 +108,7 @@ vkd3d_shader_tests = \ tests/hlsl-vector-indexing-uniform.shader_test \ tests/logic-operations.shader_test \ tests/math.shader_test \ + tests/multiple-rt.shader_test \ tests/nointerpolation.shader_test \ tests/pow.shader_test \ tests/preproc-if.shader_test \ diff --git a/tests/multiple-rt.shader_test b/tests/multiple-rt.shader_test new file mode 100644 index 000000000..59e4acbbe --- /dev/null +++ b/tests/multiple-rt.shader_test @@ -0,0 +1,19 @@ +[render target 0] +format r32g32b32a32 float +size (640, 480) + +[render target 1] +format r32g32b32a32 float +size (640, 480) + +[pixel shader] +void main(out float4 o0 : sv_target0, out float4 o1 : sv_target1) +{ + o0 = float4(0.1, 0.2, 0.3, 0.4); + o1 = float4(0.5, 0.6, 0.7, 0.8); +} + +[test] +draw quad +probe render target 0 all rgba (0.1, 0.2, 0.3, 0.4) +probe render target 1 all rgba (0.5, 0.6, 0.7, 0.8) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index e2dc2dda6..25986b316 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -468,7 +468,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) } else if (match_string(line, "probe", &line)) { - unsigned int left, top, right, bottom, ulps; + unsigned int left, top, right, bottom, ulps, slot; struct resource_readback *rb; struct resource *resource; int ret, len; @@ -479,7 +479,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
if (match_string(line, "uav", &line)) { - unsigned int slot = strtoul(line, &rest, 10); + slot = strtoul(line, &rest, 10);
if (rest == line) fatal_error("Malformed UAV index '%s'.\n", line); @@ -487,6 +487,16 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
resource = get_resource(runner, RESOURCE_TYPE_UAV, slot); } + else if (match_string(line, "render target", &line)) + { + slot = strtoul(line, &rest, 10); + + if (rest == line) + fatal_error("Malformed render target index '%s'.\n", line); + line = rest; + + resource = get_resource(runner, RESOURCE_TYPE_RENDER_TARGET, slot); + } else { resource = get_resource(runner, RESOURCE_TYPE_RENDER_TARGET, 0); @@ -836,6 +846,18 @@ void run_shader_tests(struct shader_runner *runner, int argc, char **argv, const current_sampler->v_address = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; current_sampler->w_address = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; } + else if (sscanf(line, "[render target %u]\n", &index)) + { + state = STATE_RESOURCE; + + memset(¤t_resource, 0, sizeof(current_resource)); + + current_resource.slot = index; + current_resource.type = RESOURCE_TYPE_RENDER_TARGET; + current_resource.format = DXGI_FORMAT_R32G32B32A32_FLOAT; + current_resource.data_type = TEXTURE_DATA_FLOAT; + current_resource.texel_size = 16; + } else if (sscanf(line, "[texture %u]\n", &index)) { state = STATE_RESOURCE;