From 05f0f5603561daed2c134e13bc64649362759968 Mon Sep 17 00:00:00 2001 From: davli-nv Date: Wed, 20 Aug 2025 17:30:44 -0700 Subject: 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> --- docs/user-guide/a2-01-spirv-target-specific.md | 3 ++- docs/user-guide/a2-02-metal-target-specific.md | 1 + docs/user-guide/a2-03-wgsl-target-specific.md | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/user-guide/a2-01-spirv-target-specific.md b/docs/user-guide/a2-01-spirv-target-specific.md index 0f64a5e1b..899fb39fd 100644 --- a/docs/user-guide/a2-01-spirv-target-specific.md +++ b/docs/user-guide/a2-01-spirv-target-specific.md @@ -95,9 +95,10 @@ The system-value semantics are translated to the following SPIR-V code. | `SV_ViewID` | `BuiltIn ViewIndex` | | `SV_ViewportArrayIndex` | `BuiltIn ViewportIndex` | | `SV_VulkanInstanceID` | `BuiltIn InstanceIndex` | +| `SV_VulkanSamplePosition` | `BuiltIn SamplePosition` | | `SV_VulkanVertexID` | `BuiltIn VertexIndex` | -*Note* that `SV_DrawIndex`, `SV_FragInvocationCount`, `SV_FragSize`, `SV_PointSize` and `SV_PointCoord` are Slang-specific semantics that are not defined in HLSL. +*Note* that `SV_DrawIndex`, `SV_FragInvocationCount`, `SV_FragSize`, `SV_PointSize`, `SV_PointCoord` and `SV_VulkanSamplePosition` are Slang-specific semantics that are not defined in HLSL. Also *Note* that `SV_InstanceID`/`SV_VertexID` counts all instances/vertices in a draw call, unlike how `InstanceIndex`/`VertexIndex` is relative to `BaseInstance`/`BaseVertex`. See [Using SV_InstanceID/SV_VertexID with SPIR-V target](#using-sv_instanceid-and-sv_vertexid-with-spir-v-target) diff --git a/docs/user-guide/a2-02-metal-target-specific.md b/docs/user-guide/a2-02-metal-target-specific.md index 5d3e336db..62af51a0e 100644 --- a/docs/user-guide/a2-02-metal-target-specific.md +++ b/docs/user-guide/a2-02-metal-target-specific.md @@ -47,6 +47,7 @@ The system-value semantics are translated to the following Metal attributes: | `SV_StartVertexLocation` | `[[base_vertex]]` | | `SV_StartInstanceLocation` | `[[base_instance]]` | | `SV_VulkanInstanceID` | `[[instance_id]]` | +| `SV_VulkanSamplePosition` | `(Not supported)` | | `SV_VulkanVertexID` | `[[vertex_id]]` | Custom semantics are mapped to user attributes: diff --git a/docs/user-guide/a2-03-wgsl-target-specific.md b/docs/user-guide/a2-03-wgsl-target-specific.md index 35aecd291..a16ca946e 100644 --- a/docs/user-guide/a2-03-wgsl-target-specific.md +++ b/docs/user-guide/a2-03-wgsl-target-specific.md @@ -53,6 +53,7 @@ The system-value semantics are translated to the following WGSL code. | SV_ViewID | *Not supported* | | SV_ViewportArrayIndex | *Not supported* | | SV_VulkanInstanceID | `@builtin(instance_index)` | +| SV_VulkanSamplePosition | *Not supported* | | SV_VulkanVertexID | `@builtin(vertex_index)` | -- cgit v1.2.3