vkd3d/tests/hlsl/rasteriser-ordered-views.shader_test
Giovanni Mascellani bc351f4b70 tests/shader-runner: Make geometry shaders optional.
This allows the Vulkan runner to execute in environments which do
not support geometry shaders, most notably MoltenVK. In particular,
that enables SM<4 shaders to run in such environments
2024-10-15 16:55:15 +02:00

73 lines
1.5 KiB
Plaintext

[require]
shader model >= 5.0
% Used for SV_PrimitiveID/SpvBuiltInPrimitiveId.
geometry-shader
[rtv 0]
format r32-uint
size (2d, 640, 480)
[uav 1]
format r32-uint
size (2d, 640, 480)
[srv 0]
format r32g32b32a32-uint
size (2d, 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]
todo(glsl) draw triangle list 3
probe (0, 0) rui(0xaaaaaaaa)
probe uav 1 (0, 0, 640, 480) rui(0x55555555)
[pixel shader]
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
geometry-shader
rov
[test]
draw triangle list 93
probe (0, 0) rui(0x6aaaaaaa)
probe uav 1 (0, 0, 640, 480) rui(0x2aaaaaaa)