tests: Add minimal tests for temp lifetimes within a loop.

This commit is contained in:
Francisco Casas 2023-05-15 15:57:38 -04:00 committed by Alexandre Julliard
parent 855bb71f6d
commit fbd2df2ad5
Notes: Alexandre Julliard 2023-05-24 22:33:32 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/208
2 changed files with 44 additions and 0 deletions

View File

@ -136,6 +136,7 @@ vkd3d_shader_tests = \
tests/load-level.shader_test \
tests/log.shader_test \
tests/logic-operations.shader_test \
tests/loop.shader_test \
tests/majority-syntax.shader_test \
tests/math.shader_test \
tests/matrix-semantics.shader_test \

43
tests/loop.shader_test Normal file
View File

@ -0,0 +1,43 @@
[pixel shader]
float a;
float4 main() : sv_target
{
float res = 0;
for (int i = 0; i < 10; ++i)
{
res += a;
// The temp copy of 'a' must reserve its registers for the rest of the loop.
// It shall not be overwritten.
}
return res;
}
[test]
uniform 0 float 5.0
draw quad
todo probe all rgba (50.0, 50.0, 50.0, 50.0)
[pixel shader]
float a;
float4 main() : sv_target
{
float res = 0;
for (int i = 0; i < 10; ++i)
{
res += a;
// The temp copy of 'a' must reserve its registers for the rest of the loop.
// It shall not be overwritten.
i++;
}
return res;
}
[test]
uniform 0 float 4.0
draw quad
todo probe all rgba (20.0, 20.0, 20.0, 20.0)