vkd3d/tests/hlsl/rasteriser-ordered-views.shader_test
Francisco Casas 19c23ca6f2 tests/shader_runner: Replace spaces with dashes in format names.
Probably good if we want to allow specifying several formats in the same
line, separated by spaces.

While at it, rename "r32g32 int" to "r32g32-sint".
2024-08-22 16:01:37 +02:00

70 lines
1.4 KiB
Plaintext

[require]
shader model >= 5.0
[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
rov
[test]
draw triangle list 93
probe (0, 0) rui(0x6aaaaaaa)
probe uav 1 (0, 0, 640, 480) rui(0x2aaaaaaa)