tests/hlsl: Add a test for constexpr pointer cast.

This commit is contained in:
Conor McCarthy 2024-04-27 20:35:07 +10:00 committed by Alexandre Julliard
parent 05510c118a
commit 2fc32c3d1d
Notes: Alexandre Julliard 2024-04-30 23:14:34 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/836
2 changed files with 24 additions and 0 deletions

View File

@ -163,6 +163,7 @@ vkd3d_shader_tests = \
tests/hlsl/object-field-offsets.shader_test \
tests/hlsl/object-parameters.shader_test \
tests/hlsl/object-references.shader_test \
tests/hlsl/pointer-cast.shader_test \
tests/hlsl/pow.shader_test \
tests/hlsl/precise-modifier.shader_test \
tests/hlsl/rasteriser-ordered-views.shader_test \

View File

@ -0,0 +1,23 @@
[require]
shader model >= 6.0
[pixel shader]
uint u, v, w;
static float foo[3] = {0.25, 0.5, 0.75};
float4 main(float4 pos : SV_Position) : SV_Target
{
// Compiles to a constexpr uint pointer cast of foo for a store instruction.
if (v)
foo[1] = asfloat(w);
return float4(foo[u], foo[u + 1], 0.0, 1.0);
}
[test]
uniform 0 uint4 0 1 0x3e000000 0
todo draw quad
probe all rgba (0.25, 0.125, 0.0, 1.0)
uniform 0 uint4 1 0 0x3e000000 0
todo draw quad
probe all rgba (0.5, 0.75, 0.0, 1.0)