From 7363fd281696bb1519d280510fa20fdcef80fa2c Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Tue, 25 Jun 2024 14:28:33 -0400 Subject: [PATCH] tests: Add additional tests for function calls in state block rhs. --- tests/hlsl/state-block-syntax.shader_test | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/hlsl/state-block-syntax.shader_test b/tests/hlsl/state-block-syntax.shader_test index f044c6ce..a285f2d5 100644 --- a/tests/hlsl/state-block-syntax.shader_test +++ b/tests/hlsl/state-block-syntax.shader_test @@ -441,6 +441,36 @@ sampler sam float4 main() : sv_target { return 0; } +% The number of parameters must also match. +[pixel shader fail(sm<6)] +float4 fun(float a, float b) +{ + return 0; +} + +sampler sam +{ + cat = fun(foo); // no matching 1 parameter function. +}; + +float4 main() : sv_target { return 0; } + + +% Compiler assumes that unknown stateblock constants are 'const int'. +[pixel shader fail(sm<6)] +float4 fun(float p[2]) +{ + return 0; +} + +sampler sam +{ + cat = fun(foo); // cannot convert from 'const int' to 'float[2]'. +}; + +float4 main() : sv_target { return 0; } + + % PixelShader and VertexShader are valid identifiers for the lhs [pixel shader] sampler sam