From: Evan Tang etang@codeweavers.com
--- Makefile.am | 1 + .../hlsl/rasteriser-ordered-views.shader_test | 69 +++++++ tests/hlsl/uav-rwbuffer.shader_test | 76 +++++++ tests/hlsl/uav-rwstructuredbuffer.shader_test | 53 +++++ tests/hlsl/uav-rwtexture.shader_test | 195 ++++++++++++++++++ tests/shader_runner.c | 5 + tests/shader_runner.h | 1 + tests/shader_runner_d3d11.c | 10 + tests/shader_runner_d3d12.c | 4 + tests/shader_runner_d3d9.c | 3 + tests/shader_runner_gl.c | 2 + tests/shader_runner_vulkan.c | 2 + 12 files changed, 421 insertions(+) create mode 100644 tests/hlsl/rasteriser-ordered-views.shader_test
diff --git a/Makefile.am b/Makefile.am index d9db8eec3..c02ec026a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -152,6 +152,7 @@ vkd3d_shader_tests = \ tests/hlsl/object-parameters.shader_test \ tests/hlsl/object-references.shader_test \ tests/hlsl/pow.shader_test \ + tests/hlsl/rasteriser-ordered-views.shader_test \ tests/hlsl/reflect.shader_test \ tests/hlsl/register-reservations-numeric.shader_test \ tests/hlsl/register-reservations-resources.shader_test \ diff --git a/tests/hlsl/rasteriser-ordered-views.shader_test b/tests/hlsl/rasteriser-ordered-views.shader_test new file mode 100644 index 000000000..ad75cd0c2 --- /dev/null +++ b/tests/hlsl/rasteriser-ordered-views.shader_test @@ -0,0 +1,69 @@ +[require] +shader model >= 5.0 + +[render target 0] +format r32 uint +size (640, 480) + +[uav 1] +format r32 uint +size (640, 480) + +[texture 0] +format r32g32b32a32 uint +size (1, 1) +0 0 0 0 + +[vertex shader] +float4 main(uint vid : SV_VertexID) : SV_Position +{ + uint pos = vid % 3; + return float4(pos == 1 ? 3 : -1, pos == 2 ? 3 : -1, 0, 1); +} + +[pixel shader] +RWTexture2D<uint4> uav : register(u1); + +uint4 main(float4 pos : sv_position) : sv_target +{ + uav[pos.xy] = 0x55555555; + return 0xaaaaaaaa; +} + +% Initialise the UAV and RTV. +[test] +draw triangle list 3 +probe all rui(0xaaaaaaaa) +probe uav 1 all rui(0x55555555) + +[pixel shader todo] +RasterizerOrderedTexture2D<uint4> tex : register(u1); +Texture2D<uint4> spin : register(t0); + +uint4 main(float4 pos : SV_Position, uint id : SV_PrimitiveID) : SV_Target +{ + int2 idx = int2(pos.xy); + uint val = tex[idx].x; + uint flag = 1 << (id & 31); + uint expected = 0x55555555 ^ (flag - 1); + /* Slow down the shader to increase the likelihood of overlap. */ + int2 bufidx = int2(0, 0); + for (uint i = 0; i < 64; ++i) + { + uint4 extra = spin[bufidx]; + val |= extra; + bufidx = extra.xy; + } + bool ok = val == expected; + tex[idx] = ok ? val ^ flag : 0; + return val; +} + +[require] +shader model >= 5.0 +rov + +[test] +todo draw triangle list 93 +probe all rui(0x6aaaaaaa) +probe uav 1 all rui(0x2aaaaaaa) diff --git a/tests/hlsl/uav-rwbuffer.shader_test b/tests/hlsl/uav-rwbuffer.shader_test index b476c7854..fd948543b 100644 --- a/tests/hlsl/uav-rwbuffer.shader_test +++ b/tests/hlsl/uav-rwbuffer.shader_test @@ -27,6 +27,23 @@ float4 main() : sv_target1 return 0; }
+[pixel shader todo] +struct s +{ + float3 a; +}; + +RasterizerOrderedBuffer<float4> u : register(u2); +RasterizerOrderedBuffer<float> u1; +RasterizerOrderedBuffer<float2x2> u2; +RasterizerOrderedBuffer<struct s> u3; + +float4 main() : sv_target1 +{ + u[0] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} + % Type size is too wide [pixel shader fail] struct s @@ -57,6 +74,35 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail] +struct s +{ + float3 a; + float2 b; +}; +RasterizerOrderedBuffer<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail(sm<6)] +RasterizerOrderedBuffer<double3> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader todo] +RasterizerOrderedBuffer<double2> u; + +float4 main() : sv_target1 +{ + return 0; +} + % Array type [pixel shader fail(sm<6)] typedef float arr[2]; @@ -88,6 +134,36 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail(sm<6)] +typedef float arr[2]; +RasterizerOrderedBuffer<arr> u; + +float4 main() : sv_target1 +{ + return 0; +} + +% Object types +[pixel shader fail(sm<6)] +RasterizerOrderedBuffer<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; +RasterizerOrderedBuffer<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} + [buffer uav 2] size (1, 1)
diff --git a/tests/hlsl/uav-rwstructuredbuffer.shader_test b/tests/hlsl/uav-rwstructuredbuffer.shader_test index 904d15514..03fa789ef 100644 --- a/tests/hlsl/uav-rwstructuredbuffer.shader_test +++ b/tests/hlsl/uav-rwstructuredbuffer.shader_test @@ -25,6 +25,30 @@ float4 main() : sv_target1 return 0; }
+[pixel shader todo] +struct s +{ + float3 a; +}; + +struct s2 +{ + float4x4 f1, f2, f3; +}; + +RasterizerOrderedStructuredBuffer<float4> u : register(u2); +RasterizerOrderedStructuredBuffer<float> u1; +RasterizerOrderedStructuredBuffer<float2x2> u2; +RasterizerOrderedStructuredBuffer<struct s> u3; +RasterizerOrderedStructuredBuffer<float4x4> u4; +RasterizerOrderedStructuredBuffer<struct s2> u5; + +float4 main() : sv_target1 +{ + u[0] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} + % Array type [pixel shader] typedef float arr[2]; @@ -35,6 +59,15 @@ float4 main() : sv_target1 return 0; }
+[pixel shader todo] +typedef float arr[2]; +RasterizerOrderedStructuredBuffer<arr> u; + +float4 main() : sv_target1 +{ + return 0; +} + % Object types [pixel shader fail(sm<6)] RWStructuredBuffer<Texture2D> u; @@ -55,3 +88,23 @@ float4 main() : sv_target1 { return 0; } + +[pixel shader fail(sm<6)] +RasterizerOrderedStructuredBuffer<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; +RasterizerOrderedStructuredBuffer<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} diff --git a/tests/hlsl/uav-rwtexture.shader_test b/tests/hlsl/uav-rwtexture.shader_test index 5cfd969f0..ecf0d2905 100644 --- a/tests/hlsl/uav-rwtexture.shader_test +++ b/tests/hlsl/uav-rwtexture.shader_test @@ -181,6 +181,24 @@ float4 main() : sv_target1 return 0; }
+% RasterizerOrderedTexture1D types +[pixel shader todo] +struct s +{ + float3 a; +}; + +RasterizerOrderedTexture1D<float4> u : register(u2); +RasterizerOrderedTexture1D<float> u1; +RasterizerOrderedTexture1D<float2x2> u2; +RasterizerOrderedTexture1D<struct s> u3; + +float4 main() : sv_target1 +{ + u[0] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} + % RWTexture1DArray types [pixel shader] struct s @@ -199,6 +217,24 @@ float4 main() : sv_target1 return 0; }
+% RasterizerOrderedTexture1DArray types +[pixel shader todo] +struct s +{ + float3 a; +}; + +RasterizerOrderedTexture1DArray<float4> u : register(u2); +RasterizerOrderedTexture1DArray<float> u1; +RasterizerOrderedTexture1DArray<float2x2> u2; +RasterizerOrderedTexture1DArray<struct s> u3; + +float4 main() : sv_target1 +{ + u[int2(0, 0)] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} + % RWTexture2D types [pixel shader] struct s @@ -217,6 +253,24 @@ float4 main() : sv_target1 return 0; }
+% RasterizerOrderedTexture2D types +[pixel shader todo] +struct s +{ + float3 a; +}; + +RasterizerOrderedTexture2D<float4> u : register(u2); +RasterizerOrderedTexture2D<float> u1; +RasterizerOrderedTexture2D<float2x2> u2; +RasterizerOrderedTexture2D<struct s> u3; + +float4 main() : sv_target1 +{ + u[int2(0, 0)] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} + % RWTexture2DArray types [pixel shader] struct s @@ -235,6 +289,24 @@ float4 main() : sv_target1 return 0; }
+% RasterizerOrderedTexture2DArray types +[pixel shader todo] +struct s +{ + float3 a; +}; + +RasterizerOrderedTexture2DArray<float4> u : register(u2); +RasterizerOrderedTexture2DArray<float> u1; +RasterizerOrderedTexture2DArray<float2x2> u2; +RasterizerOrderedTexture2DArray<struct s> u3; + +float4 main() : sv_target1 +{ + u[int3(0, 0, 0)] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} + % RWTexture3D types [pixel shader] struct s @@ -253,6 +325,24 @@ float4 main() : sv_target1 return 0; }
+% RasterizerOrderedTexture3D types +[pixel shader todo] +struct s +{ + float3 a; +}; + +RasterizerOrderedTexture3D<float4> u : register(u2); +RasterizerOrderedTexture3D<float> u1; +RasterizerOrderedTexture3D<float2x2> u2; +RasterizerOrderedTexture3D<struct s> u3; + +float4 main() : sv_target1 +{ + u[int3(0, 0, 0)] = float4(11.1, 12.2, 13.3, 14.4); + return 0; +} +
[require] shader model >= 5.0 @@ -316,6 +406,14 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail] +RasterizerOrderedTexture1D<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture1DArray<Texture2D> u;
@@ -324,6 +422,14 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail] +RasterizerOrderedTexture1DArray<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture2D<Texture2D> u;
@@ -332,6 +438,14 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail] +RasterizerOrderedTexture2D<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture2DArray<Texture2D> u;
@@ -340,6 +454,14 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail] +RasterizerOrderedTexture2DArray<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture3D<Texture2D> u;
@@ -348,6 +470,14 @@ float4 main() : sv_target1 return 0; }
+[pixel shader fail] +RasterizerOrderedTexture3D<Texture2D> u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] struct s { @@ -367,6 +497,19 @@ struct s Texture2D t; };
+RasterizerOrderedTexture1D<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture1DArray<struct s> u;
float4 main() : sv_target1 @@ -380,6 +523,19 @@ struct s Texture2D t; };
+RasterizerOrderedTexture1DArray<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture2D<struct s> u;
float4 main() : sv_target1 @@ -393,6 +549,19 @@ struct s Texture2D t; };
+RasterizerOrderedTexture2D<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture2DArray<struct s> u;
float4 main() : sv_target1 @@ -406,9 +575,35 @@ struct s Texture2D t; };
+RasterizerOrderedTexture2DArray<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture3D<struct s> u;
float4 main() : sv_target1 { return 0; } + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + +RasterizerOrderedTexture3D<struct s> u; + +float4 main() : sv_target1 +{ + return 0; +} diff --git a/tests/shader_runner.c b/tests/shader_runner.c index c645e6c0a..1fa92210b 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -309,6 +309,10 @@ static void parse_require_directive(struct shader_runner *runner, const char *li { runner->require_int64 = true; } + else if (match_string(line, "rov", &line)) + { + runner->require_rov = true; + } else { fatal_error("Unknown require directive '%s'.\n", line); @@ -1505,6 +1509,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_o runner->maximum_shader_model = maximum_shader_model; runner->require_float64 = false; runner->require_int64 = false; + runner->require_rov = false; runner->compile_options = 0; skip_tests = false; } diff --git a/tests/shader_runner.h b/tests/shader_runner.h index a17fa485b..7e184fc5e 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -124,6 +124,7 @@ struct shader_runner enum shader_model maximum_shader_model; bool require_float64; bool require_int64; + bool require_rov;
bool last_render_failed;
diff --git a/tests/shader_runner_d3d11.c b/tests/shader_runner_d3d11.c index 1e22d44ef..d0d9e9273 100644 --- a/tests/shader_runner_d3d11.c +++ b/tests/shader_runner_d3d11.c @@ -73,6 +73,7 @@ struct d3d11_shader_runner ID3D11RasterizerState *rasterizer_state;
bool supports_float64; + bool supports_rov; };
static struct d3d11_shader_runner *d3d11_shader_runner(struct shader_runner *r) @@ -260,6 +261,7 @@ static IDXGISwapChain *create_swapchain(ID3D11Device *device, HWND window)
static BOOL init_test_context(struct d3d11_shader_runner *runner) { + D3D11_FEATURE_DATA_D3D11_OPTIONS2 options2 = {0}; D3D11_FEATURE_DATA_DOUBLES doubles = {0}; unsigned int rt_width, rt_height; D3D11_RASTERIZER_DESC rs_desc; @@ -281,6 +283,12 @@ static BOOL init_test_context(struct d3d11_shader_runner *runner) trace("DoublePrecisionFloatShaderOps: %u.\n", doubles.DoublePrecisionFloatShaderOps); runner->supports_float64 = doubles.DoublePrecisionFloatShaderOps;
+ hr = ID3D11Device_CheckFeatureSupport(runner->device, + D3D11_FEATURE_D3D11_OPTIONS2, &options2, sizeof(options2)); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + trace("ROVsSupported: %u.\n", options2.ROVsSupported); + runner->supports_rov = options2.ROVsSupported; + rt_width = RENDER_TARGET_WIDTH; rt_height = RENDER_TARGET_HEIGHT; SetRect(&rect, 0, 0, rt_width, rt_height); @@ -334,6 +342,8 @@ static bool d3d11_runner_check_requirements(struct shader_runner *r)
if (runner->r.require_float64 && !runner->supports_float64) return false; + if (runner->r.require_rov && !runner->supports_rov) + return false;
return true; } diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index e08a953e0..7ba61d117 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -117,6 +117,9 @@ static bool d3d12_runner_check_requirements(struct shader_runner *r) if (runner->r.require_int64 && !runner->options1.Int64ShaderOps) return false;
+ if (runner->r.require_rov && !runner->options.ROVsSupported) + return false; + return true; }
@@ -652,6 +655,7 @@ void run_shader_tests_d3d12(void *dxc_compiler) &runner.options, sizeof(runner.options)); ok(hr == S_OK, "Failed to check feature options support, hr %#x.\n", hr); trace("DoublePrecisionFloatShaderOps: %u.\n", runner.options.DoublePrecisionFloatShaderOps); + trace("ROVsSupported: %u.\n", runner.options.ROVsSupported);
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_D3D12_OPTIONS1, &runner.options1, sizeof(runner.options1)); diff --git a/tests/shader_runner_d3d9.c b/tests/shader_runner_d3d9.c index 3440e89c3..824aca01f 100644 --- a/tests/shader_runner_d3d9.c +++ b/tests/shader_runner_d3d9.c @@ -196,6 +196,9 @@ static bool d3d9_runner_check_requirements(struct shader_runner *r) if (runner->r.minimum_shader_model >= SHADER_MODEL_4_0) return false;
+ if (runner->r.require_rov) + return false; + return true; }
diff --git a/tests/shader_runner_gl.c b/tests/shader_runner_gl.c index 881ca77ad..13bbf2e39 100644 --- a/tests/shader_runner_gl.c +++ b/tests/shader_runner_gl.c @@ -297,6 +297,8 @@ static bool gl_runner_check_requirements(struct shader_runner *r) return false; if (r->require_int64 && !runner->caps.int64) return false; + if (r->require_rov) + return false;
return true; } diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index 96e462af9..4edf7f046 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -94,6 +94,8 @@ static bool vulkan_runner_check_requirements(struct shader_runner *r) return false; if (runner->r.require_int64 && !runner->supports_int64) return false; + if (runner->r.require_rov) + return false;
return true; }