tests: Create structured buffers with the appropriate stride.

The stride didn't match the structure size used in the shader.

This didn't seem to be a problem on AMD and WARP, but it was
on NVIDIA on Windows. Specifically, it seems that the buffer
is read using the shader structure size (so most tests pass),
but bounds are checked using the buffer stride, so a test
returned zero simply because an out-of-bounds read was detected.
This commit is contained in:
Giovanni Mascellani
2025-04-10 20:31:25 +02:00
committed by Henri Verbeet
parent 85e848289b
commit 4412a83655
Notes: Henri Verbeet 2025-04-14 17:17:15 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1459

View File

@@ -21,6 +21,38 @@ float4 main() : sv_target
todo(sm<6) draw quad todo(sm<6) draw quad
probe (0, 0) rgba(0.0, 1.0, 2.0, 3.0) probe (0, 0) rgba(0.0, 1.0, 2.0, 3.0)
[pixel shader todo]
struct banana
{
float2 x;
float2 y;
};
uniform uint idx;
StructuredBuffer<banana> buffer;
float4 main() : sv_target
{
return float4(buffer[idx].x, buffer[idx].y);
}
[test]
uniform 0 uint 0
todo(sm<6) draw quad
probe (0, 0) rgba(0.0, 1.0, 2.0, 3.0)
uniform 0 uint 1
todo(sm<6) draw quad
probe (0, 0) rgba(4.0, 5.0, 6.0, 7.0)
[srv 0]
stride 12
size (buffer, 5)
0.0 1.0 2.0
3.0 4.0 5.0
6.0 7.0 8.0
9.0 10.0 11.0
12.0 13.0 14.0
% Structured buffers are tightly packed. % Structured buffers are tightly packed.
[pixel shader todo] [pixel shader todo]
uniform uint idx; uniform uint idx;
@@ -67,29 +99,6 @@ uniform 0 uint 4
todo(sm<6) draw quad todo(sm<6) draw quad
probe (0, 0) rgba(12.0, 13.0, 14.0, 4.0) probe (0, 0) rgba(12.0, 13.0, 14.0, 4.0)
[pixel shader todo]
struct banana
{
float2 x;
float2 y;
};
uniform uint idx;
StructuredBuffer<banana> buffer;
float4 main() : sv_target
{
return float4(buffer[idx].x, buffer[idx].y);
}
[test]
uniform 0 uint 0
todo(sm<6) draw quad
probe (0, 0) rgba(0.0, 1.0, 2.0, 3.0)
uniform 0 uint 1
todo(sm<6) draw quad
probe (0, 0) rgba(4.0, 5.0, 6.0, 7.0)
% Matrices % Matrices
[srv 0] [srv 0]