diff options
| author | davli-nv <davli@nvidia.com> | 2025-08-20 17:30:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-21 00:30:44 +0000 |
| commit | 05f0f5603561daed2c134e13bc64649362759968 (patch) | |
| tree | ff1ea0eb835dd636a459603ea0285290d504b9b7 /tests | |
| parent | cbd73dde3dd2da790bb663385a229ce22965c43c (diff) | |
Implement SV_VulkanSamplePosition (#8236)
-Adds semantic SV_VulkanSamplePosition that emits corresponding
gl_SamplePosition and SpvBuiltinSamplePosition
-Adds gl_SamplePosition property to glsl.meta.slang
-Adds SPIRV and GLSL tests for the semantic and property
-Plan is to later implement SV_SamplePosition that follows HLSL range of
-0.5 to +0.5,
and emits GetRenderTargetSamplePosition(SV_SampleIndex) which needs more
complicated IR manipulation for HLSL and Metal
Fixes #7906
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/spirv/sv-vulkan-sample-position.slang | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/spirv/sv-vulkan-sample-position.slang b/tests/spirv/sv-vulkan-sample-position.slang new file mode 100644 index 000000000..853ae03ac --- /dev/null +++ b/tests/spirv/sv-vulkan-sample-position.slang @@ -0,0 +1,21 @@ +//TEST:SIMPLE(filecheck=CHECK-SPIRV): -target spirv -stage fragment -entry main +//TEST:SIMPLE(filecheck=CHECK-GLSL): -target glsl -stage fragment -entry main + +// Test for SV_VulkanSamplePosition support + +// CHECK-SPIRV: OpCapability SampleRateShading +// CHECK-SPIRV-DAG: OpDecorate {{.*}} BuiltIn SamplePosition +// CHECK-GLSL-DAG: gl_SamplePosition + +import glsl; + +struct FragmentInput +{ + float2 samplePosition : SV_VulkanSamplePosition; +} + +[shader("fragment")] +float4 main(FragmentInput input) : SV_Target +{ + return float4(input.samplePosition.x, gl_SamplePosition.y, 0.0, 1.0); +}
\ No newline at end of file |
