mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
tests: Add some tests for rasteriser-ordered views.
This commit is contained in:
parent
f614d98759
commit
628acb6b96
Notes:
Alexandre Julliard
2024-02-14 23:28:07 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/651
@ -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 \
|
||||
|
69
tests/hlsl/rasteriser-ordered-views.shader_test
Normal file
69
tests/hlsl/rasteriser-ordered-views.shader_test
Normal file
@ -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)
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user