From 9fa8921b509598b33813bb4b5bb3abd2c1a9a47b Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Tue, 25 Jun 2024 15:29:18 -0400 Subject: [PATCH] tests: Test shader compilation within braces. --- tests/hlsl/effect-compile.shader_test | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/hlsl/effect-compile.shader_test b/tests/hlsl/effect-compile.shader_test index e4ff954a..f1a19f25 100644 --- a/tests/hlsl/effect-compile.shader_test +++ b/tests/hlsl/effect-compile.shader_test @@ -152,6 +152,27 @@ PixelShader ps1 = CompileShader(ps_2_0, main()); PixelShader ps2 = ps1; +[pixel shader fail(sm<6)] +float4 main() : sv_target { return 0; } +PixelShader ps1 = 42; + +[pixel shader todo] +float4 main() : sv_target { return 0; } +PixelShader ps1 = {42}; // braces make the type checking more permissive. + +% This compiles, but the default value of "f" is not written. +[pixel shader todo fail(sm>=6)] +float4 fun() : sv_target { return 0; } +float f = {CompileShader(ps_2_0, fun())}; +float4 main() : sv_target { return f; } + +% This also compiles, but the default value of "f" is not written. +[pixel shader todo fail(sm>=6)] +float4 fun() : sv_target { return 0; } +float4 f = {1, 2, compile ps_2_0 fun(), 4}; +float4 main() : sv_target { return f; } + + [pixel shader fail(sm<6)] float4 fun() : sv_target { return 0; } @@ -162,6 +183,37 @@ float4 main() : sv_target return 0; } +[require] +shader model >= 5.0 +shader model < 6.0 + + +% The following test segfaults on DXC. +[pixel shader todo] +float f; + +float4 foo(uniform float r) : sv_target { return r; } + +struct apple +{ + float4 f; + PixelShader ps; +} a = {1, 2, 3, 4, compile ps_4_0 foo(f * f)}; + +technique +{ + pass + { + PixelShader = a.ps; + } +} + +float4 main() : sv_target { return 0; } + +[test] +todo draw quad +probe (0, 0) rgba (0, 0, 0, 0) + [require] shader model >= 4.0