diff --git a/Makefile.am b/Makefile.am index d9db8eec..c02ec026 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 00000000..ad75cd0c --- /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 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 tex : register(u1); +Texture2D 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 b476c785..fd948543 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 u : register(u2); +RasterizerOrderedBuffer u1; +RasterizerOrderedBuffer u2; +RasterizerOrderedBuffer 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 u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail(sm<6)] +RasterizerOrderedBuffer u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader todo] +RasterizerOrderedBuffer 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 u; + +float4 main() : sv_target1 +{ + return 0; +} + +% Object types +[pixel shader fail(sm<6)] +RasterizerOrderedBuffer u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; +RasterizerOrderedBuffer 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 904d1551..03fa789e 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 u : register(u2); +RasterizerOrderedStructuredBuffer u1; +RasterizerOrderedStructuredBuffer u2; +RasterizerOrderedStructuredBuffer u3; +RasterizerOrderedStructuredBuffer u4; +RasterizerOrderedStructuredBuffer 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 u; + +float4 main() : sv_target1 +{ + return 0; +} + % Object types [pixel shader fail(sm<6)] RWStructuredBuffer u; @@ -55,3 +88,23 @@ float4 main() : sv_target1 { return 0; } + +[pixel shader fail(sm<6)] +RasterizerOrderedStructuredBuffer u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; +RasterizerOrderedStructuredBuffer u; + +float4 main() : sv_target1 +{ + return 0; +} diff --git a/tests/hlsl/uav-rwtexture.shader_test b/tests/hlsl/uav-rwtexture.shader_test index 5cfd969f..ecf0d290 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 u : register(u2); +RasterizerOrderedTexture1D u1; +RasterizerOrderedTexture1D u2; +RasterizerOrderedTexture1D 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 u : register(u2); +RasterizerOrderedTexture1DArray u1; +RasterizerOrderedTexture1DArray u2; +RasterizerOrderedTexture1DArray 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 u : register(u2); +RasterizerOrderedTexture2D u1; +RasterizerOrderedTexture2D u2; +RasterizerOrderedTexture2D 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 u : register(u2); +RasterizerOrderedTexture2DArray u1; +RasterizerOrderedTexture2DArray u2; +RasterizerOrderedTexture2DArray 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 u : register(u2); +RasterizerOrderedTexture3D u1; +RasterizerOrderedTexture3D u2; +RasterizerOrderedTexture3D 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 u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture1DArray u; @@ -324,6 +422,14 @@ float4 main() : sv_target1 return 0; } +[pixel shader fail] +RasterizerOrderedTexture1DArray u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture2D u; @@ -332,6 +438,14 @@ float4 main() : sv_target1 return 0; } +[pixel shader fail] +RasterizerOrderedTexture2D u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture2DArray u; @@ -340,6 +454,14 @@ float4 main() : sv_target1 return 0; } +[pixel shader fail] +RasterizerOrderedTexture2DArray u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] RWTexture3D u; @@ -348,6 +470,14 @@ float4 main() : sv_target1 return 0; } +[pixel shader fail] +RasterizerOrderedTexture3D u; + +float4 main() : sv_target1 +{ + return 0; +} + [pixel shader fail] struct s { @@ -367,6 +497,19 @@ struct s Texture2D t; }; +RasterizerOrderedTexture1D u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture1DArray u; float4 main() : sv_target1 @@ -380,6 +523,19 @@ struct s Texture2D t; }; +RasterizerOrderedTexture1DArray u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture2D u; float4 main() : sv_target1 @@ -393,6 +549,19 @@ struct s Texture2D t; }; +RasterizerOrderedTexture2D u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture2DArray u; float4 main() : sv_target1 @@ -406,9 +575,35 @@ struct s Texture2D t; }; +RasterizerOrderedTexture2DArray u; + +float4 main() : sv_target1 +{ + return 0; +} + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + RWTexture3D u; float4 main() : sv_target1 { return 0; } + +[pixel shader fail] +struct s +{ + Texture2D t; +}; + +RasterizerOrderedTexture3D u; + +float4 main() : sv_target1 +{ + return 0; +} diff --git a/tests/shader_runner.c b/tests/shader_runner.c index c645e6c0..1fa92210 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 a17fa485..7e184fc5 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 1e22d44e..d0d9e927 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 e08a953e..7ba61d11 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 3440e89c..824aca01 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 881ca77a..13bbf2e3 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 96e462af..4edf7f04 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; }