From 62fad1c185dbd232eabe375f5d4fbc793848db62 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Tue, 27 Aug 2024 10:55:41 -0400 Subject: [PATCH] tests: Test hull shader function overloads. --- Makefile.am | 1 + tests/hlsl/hull-shader-syntax.shader_test | 112 ++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 tests/hlsl/hull-shader-syntax.shader_test diff --git a/Makefile.am b/Makefile.am index 38651e62..38272547 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,6 +133,7 @@ vkd3d_shader_tests = \ tests/hlsl/half.shader_test \ tests/hlsl/hard-copy-prop.shader_test \ tests/hlsl/hull-shader-attributes.shader_test \ + tests/hlsl/hull-shader-syntax.shader_test \ tests/hlsl/initializer-flatten.shader_test \ tests/hlsl/initializer-implicit-array.shader_test \ tests/hlsl/initializer-invalid-arg-count.shader_test \ diff --git a/tests/hlsl/hull-shader-syntax.shader_test b/tests/hlsl/hull-shader-syntax.shader_test new file mode 100644 index 00000000..5e5062e6 --- /dev/null +++ b/tests/hlsl/hull-shader-syntax.shader_test @@ -0,0 +1,112 @@ +[require] +shader model >= 5.0 + +%% Test patch constant function overloads. +%% For SM < 6, the last declaration that is defined is picked. +%% For SM >= 6, the last valid declaration is picked, even if it is not defined. + +[hull shader] +struct patch_constant_data +{ + float edges[2] : SV_TessFactor; +}; + +patch_constant_data patch_constant(float x); +patch_constant_data patch_constant(float x, uint y); + +patch_constant_data patch_constant() +{ + return (patch_constant_data)0; +} + +// Missing valid return semantics (SV_TessFactor). +float patch_constant(uint x); + + [domain("isoline")] + [outputcontrolpoints(3)] + [partitioning("integer")] + [outputtopology("point")] + [patchconstantfunc("patch_constant")] +float4 main() : POSITION +{ + return 0; +} + +[hull shader fail(sm>=6)] +struct patch_constant_data +{ + float edges[2] : SV_TessFactor; +}; + +patch_constant_data patch_constant(float x); +patch_constant_data patch_constant(float x, uint y); + +patch_constant_data patch_constant() +{ + return (patch_constant_data)0; +} + +patch_constant_data patch_constant(uint x : SV_PrimitiveID); + + [domain("isoline")] + [outputcontrolpoints(3)] + [partitioning("integer")] + [outputtopology("point")] + [patchconstantfunc("patch_constant")] +float4 main() : POSITION +{ + return 0; +} + +[hull shader] +struct patch_constant_data +{ + float edges[2] : SV_TessFactor; +}; + +patch_constant_data patch_constant() +{ + return (patch_constant_data)0; +} + +patch_constant_data patch_constant(uint x : SV_PrimitiveID) +{ + return (patch_constant_data)x; +} + + [domain("isoline")] + [outputcontrolpoints(3)] + [partitioning("integer")] + [outputtopology("point")] + [patchconstantfunc("patch_constant")] +float4 main() : POSITION +{ + return 0; +} + +[hull shader fail todo] +struct patch_constant_data +{ + float edges[2] : SV_TessFactor; +}; + +patch_constant_data patch_constant() +{ + return (patch_constant_data)0; +} + +// x is missing a semantic. +patch_constant_data patch_constant(uint x) +{ + return (patch_constant_data)x; +} + + [domain("isoline")] + [outputcontrolpoints(3)] + [partitioning("integer")] + [outputtopology("point")] + [patchconstantfunc("patch_constant")] +float4 main() : POSITION +{ + return 0; +}