<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/glsl.meta.slang, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2025-10-03T19:52:50+00:00</updated>
<entry>
<title>Add direct usage support for gl_DrawID (#8594)</title>
<updated>2025-10-03T19:52:50+00:00</updated>
<author>
<name>Copilot</name>
<email>198982749+Copilot@users.noreply.github.com</email>
</author>
<published>2025-10-03T19:52:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2491ac5f42d78d082d4afa6416906fad9b32ea80'/>
<id>urn:sha1:2491ac5f42d78d082d4afa6416906fad9b32ea80</id>
<content type='text'>
- [x] Add `gl_DrawID` property declaration in
`source/slang/glsl.meta.slang` similar to `gl_BaseVertex` and
`gl_BaseInstance`
- [x] Ensure it maps to `SV_DrawIndex` semantic
- [x] Add extension requirements in `slang-ir-glsl-legalize.cpp` (GLSL
460 and GL_ARB_shader_draw_parameters)
- [x] Create test case to verify SPIRV output contains `DrawIndex`
decoration
- [x] Run formatting script before committing
- [x] Verify existing tests still pass
- [x] Remove accidentally committed temp files (1.glsl, 3.spv-asm)
- [x] Update .gitignore to prevent similar files from being committed

&lt;!-- START COPILOT CODING AGENT SUFFIX --&gt;



&lt;details&gt;

&lt;summary&gt;Original prompt&lt;/summary&gt;

&gt; 
&gt; ----
&gt; 
&gt; *This section details on the original issue you should resolve*
&gt; 
&gt; &lt;issue_title&gt;Missing direct usage support for gl_DrawID&lt;/issue_title&gt;
&gt; &lt;issue_description&gt;# Problem Description
&gt; Because DirectX does not have support for DrawIndex like vulkan does,
i add the support in d3d12 by emulating it and storing it in a root
constant. In vulkan though, i should be able to use it directly, but
because now i store it as a global variable, i cannot use the
SV_DrawIndex semantic either.
&gt; 
&gt; # Preferred Solution
&gt; I'd like to be able to use gl_DrawID like you how can use
gl_BaseVertex and gl_BaseInstance.
&gt; &lt;/issue_description&gt;
&gt; 
&gt; &lt;agent_instructions&gt;You can just edit glsl.meta.slang and add a
declaration for gl_DrawID in a similar way to gl_BaseVertex, and map it
to SV_DrawIndex.
&gt; 
&gt; Create a `//TEST:SIMPLE(filecheck=SPIRV): -target spirv` test case,
and use filecheck to verify the output contains the correct SPIRV
`DrawIndex` decoration.&lt;/agent_instructions&gt;
&gt; 
&gt; ## Comments on the Issue (you are @copilot in this section)
&gt; 
&gt; &lt;comments&gt;
&gt; &lt;/comments&gt;
&gt; 


&lt;/details&gt;
Fixes shader-slang/slang#8548

&lt;!-- START COPILOT CODING AGENT TIPS --&gt;
---

✨ Let Copilot coding agent [set things up for
you](https://github.com/shader-slang/slang/issues/new?title=✨+Set+up+Copilot+instructions&amp;body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&amp;assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] &lt;198982749+Copilot@users.noreply.github.com&gt;
Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Diagnose error when the function args can't satisfy constexpr parameter requirements (#7269)</title>
<updated>2025-09-16T19:51:43+00:00</updated>
<author>
<name>Gangzheng Tong</name>
<email>tonggangzheng@gmail.com</email>
</author>
<published>2025-09-16T19:51:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=afb8146e10626887e3eb9f479480d4f8a1ad6128'/>
<id>urn:sha1:afb8146e10626887e3eb9f479480d4f8a1ad6128</id>
<content type='text'>
## Summary
This PR enhances constexpr validation by adding proper error checking
when function arguments cannot satisfy constexpr parameter requirements,
addressing issue #6370.

## Problem
Previously, when a function declared constexpr parameters, the compiler
would attempt to propagate constexpr-ness to the call site arguments,
but there was insufficient validation and error reporting when this
propagation failed. This could lead silent failures where constexpr
requirements weren't properly enforced

## Solution
This PR adds checks that:

1. **Validates constexpr arguments**: When a function parameter is
marked as `constexpr`, the compiler now explicitly checks that the
corresponding argument can be marked as `constexpr`

2. **Issues clear compilation errors**: added
`Diagnostics::argIsNotConstexpr`)

3. **Handles both call scenarios**: The validation works for both:
   - Direct function calls with IR-level function definitions
   - Calls to function from external modules

Fixes #6370

---------

Co-authored-by: slangbot &lt;ellieh+slangbot@nvidia.com&gt;
Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Implement SV_VulkanSamplePosition (#8236)</title>
<updated>2025-08-21T00:30:44+00:00</updated>
<author>
<name>davli-nv</name>
<email>davli@nvidia.com</email>
</author>
<published>2025-08-21T00:30:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=05f0f5603561daed2c134e13bc64649362759968'/>
<id>urn:sha1:05f0f5603561daed2c134e13bc64649362759968</id>
<content type='text'>
-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 &lt;159081215+ArielG-NV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>[Capability System] Fix bug where capabilities do not correctly propegate if AST-parent has target+set the AST-child does not (#8175)</title>
<updated>2025-08-14T19:27:55+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2025-08-14T19:27:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=dd06524f523cdac9c753801ce9c3992f66ae5576'/>
<id>urn:sha1:dd06524f523cdac9c753801ce9c3992f66ae5576</id>
<content type='text'>
Fixes: #8174

Changes:
* To determine if we propagate capabilities, we need to ensure that a
`join` will do nothing (optimization since `join` is expensive + caching
data for the `join` adds up to be expensive). This logic was changed in
`slang-check-decl.cpp` since the current logic was incorrect.
* A parent could have the set `metal+glsl` and the use-site could have
`glsl`. In this case, we will not remove `metal` from the parent since
`{metal+glsl}.implies({glsl})` is true.

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Error if super-type capabilities are a super-set of sub-type (#7452)</title>
<updated>2025-08-08T20:19:25+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2025-08-08T20:19:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=07f21ee31b5f427edb72d5578f713b3da3f3b96f'/>
<id>urn:sha1:07f21ee31b5f427edb72d5578f713b3da3f3b96f</id>
<content type='text'>
Fixes: #7410

Changes:
1. super-type capabilities must be a super-set of sub-type capabilities
(and support the same shader stages/targets)
* InheritanceDecl visits super-type to inherit it's capabilities;
validate InheritanceDecl capabilities against sub-type
    * visit all container decl's with a default case 
    * clean up functionDeclBase visitor
* Simplify `diagnoseUndeclaredCapability` by moving logic into
capability checking (more correct*)
3. added changed behavior to documentation
4. fixed some incorrect capabilities
5. **we do not** diagnose capability errors on interface
requirement-to-implementation if both lack explicit capability
requirements. This change is to work around a slangpy regression (test
case for the failing situation is in
`tests\language-feature\capability\capability-interface-extension-1.slang`),
Note: maybe for slang-2026 we don't do this?
6. requirement &amp; implementation must support the same shader
stage/target. This was changed because otherwise we can have cases where
`X` inherits from `Y`, but `Y` is only expected to be used in `glsl`
whilst `X` is expected to be used in `hlsl | glsl`
7. removed
`tests/language-feature/capability/capabilitySimplification3.slang`
because it tests nothing special (redundant)

Note: not using rebase due to separate branches depending on this PR

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Implement SPV_EXT_fragment_invocation_density (SPV_NV_shading_rate) (#8037)</title>
<updated>2025-08-05T17:55:52+00:00</updated>
<author>
<name>davli-nv</name>
<email>davli@nvidia.com</email>
</author>
<published>2025-08-05T17:55:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=83675103a1a4fefde11b314aed26f4d37860efe7'/>
<id>urn:sha1:83675103a1a4fefde11b314aed26f4d37860efe7</id>
<content type='text'>
* Implement SPV_EXT_fragment_invocation_density

-Adds semantics SV_FragSize and SV_FragInvocationCount and implements them for SPIRV and GLSL using the appropriate target builtins from extensions.
-Adds test case checking for expected target builtins from these semantics.
-For future work, could implement SV_FragSize using pixel shader input SV_ShadingRate for HLSL, and SV_FragInvocationCount needs research.

Fixes #7974

Generated with Claude Code

* address review feedback

https://github.com/shader-slang/slang/pull/8037#pullrequestreview-3084645845

* fixup format

* review feedback

https://github.com/shader-slang/slang/pull/8037#pullrequestreview-3086442819</content>
</entry>
<entry>
<title>Add WorkgroupCount function (#7734)</title>
<updated>2025-07-12T00:46:22+00:00</updated>
<author>
<name>davli-nv</name>
<email>davli@nvidia.com</email>
</author>
<published>2025-07-12T00:46:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d39590228241cb42d72f493f6f484c5ea93df934'/>
<id>urn:sha1:d39590228241cb42d72f493f6f484c5ea93df934</id>
<content type='text'>
Fixes #7733

Copy gl_NumWorkGroups into hlsl.meta.slang as WorkgroupCount function so
that it can be used for GLSL and SPIR-V targets without GLSL syntax.

Also change WorkgroupSize function to allow use with mesh shading capability.
Update pipeline/rasterization/mesh/task-simple.slang to test it in task and mesh stages.</content>
</entry>
<entry>
<title>Support the GLSL/SPIR-V Built-in variable `DeviceIndex` (#7552)</title>
<updated>2025-06-29T04:15:48+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2025-06-29T04:15:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=67af8c718ce5e3f95a25e5188840f63b41a33ecc'/>
<id>urn:sha1:67af8c718ce5e3f95a25e5188840f63b41a33ecc</id>
<content type='text'>
* Support DeviceIndex

* format code

* regenerate command line reference

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Address issues with GLSL style global in/out vars (#6669) (#6998)</title>
<updated>2025-06-06T20:13:43+00:00</updated>
<author>
<name>sricker-nvidia</name>
<email>115114531+sricker-nvidia@users.noreply.github.com</email>
</author>
<published>2025-06-06T20:13:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=649d533727b31b28397ffb3a530e655ac3861547'/>
<id>urn:sha1:649d533727b31b28397ffb3a530e655ac3861547</id>
<content type='text'>
* Address issues with GLSL style global in/out vars (#6669)

Asserts and segfaults were observed trying to compile a simple
vertex shader like:

````
in int2 inPos;

[shader("vertex")]
main(uniform int2 test1, int2 test2, out float4 pos: SV_Position)
void main()
{
    // Bogus use of all input vars to prevent optimizing out.
    pos = float4(inPos.x, test1.x, test2.y, 0);
}
````

Further investigation found that while replacing "uniform int2 test1"
with "int2 test1" allowed for successful compilation, the resulting
output shader would have overlapping location qualifiers. For example,
compiling the above with "int2 test1" to glsl might give:

````
...
layout(location = 0) in ivec2 test1_0;
layout(location = 1) in ivec2 test2_0;
layout(location = 0) in ivec2 translatedGlobalParams_inPos_0;
...
````

This was because Slang does not actually support mixing GLSL style global
in/out vars and entry point params. However, this is never checked for
or noted in documentation. Slang source also assumes input shaders do not
mix these and these assumptions ultimately led to the observed asserts
and seg faults when using uniform entry point params.

This change makes updates to throw an error when the compiler detects that
it is trying to translate global in/out variables into entry point params
when an entry point already contains parameters, allowing for compilation
to fail gracefully.

Certain tests have been updated to avoid mixing GLSL style global in/out
vars and entry point params. This was mostly for tests that were using
functions like WaveGetLaneIndex which use global in vars for certain
platforms (see __builtinWaveLaneIndex).

* Address issues with GLSL style global in/out vars - updates 1 (#6669)

Update addresses review feedback to support mixing GLSL-flavored global
in/out vars and entrypoint parameters when either all global in/out vars
or all entry point params have a system value binding semantic.

* Address issues with GLSL style global in/out vars - updates 2 (#6669)

This update attempts to actually allow mixing GLSL style global in
vars and entry point vars.

Change attempts to recalculate offsets when adding the global input
vars into the recreated entry point params layout.

Additional updates were made to:

-resolve further issues uncovered with entry point uniform params.

-Address improper use of SV_DispatchThreadID in wave-get-lane-index.slang
 for metal. "thread_position_in_grid" is not supported for signed integer
 scalars or vectors.

-Fix a spirv casting conflict due to the implementation of
 gl_PrimitiveID.get conflicting with PrimitiveIndex().

-Add a call to remove a global var in replaceUsesOfGlobalVar(). The global
 var is already replaced in this function and keeping it around can prevent
 it from being cleaned up by DCE if it still has decorations.

* format code

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Add full support for SPV_NV_shader_subgroup_partitioned (#7103)</title>
<updated>2025-05-25T16:58:08+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-05-25T16:58:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0476b57faad96bee61f59f27ddd48c6cb067cfa2'/>
<id>urn:sha1:0476b57faad96bee61f59f27ddd48c6cb067cfa2</id>
<content type='text'>
* Properly implement WaveMask* variants of WaveMultiPrefix* intrinsics

* More partitioned intrinsics

* More partitioned intrinsics and cleaned up non-prefixed WaveMask* implementations

* Refactor HLSL WaveMultiPrefix* implementations

* fix cap atoms

* Clean up implementation

* Add GLSL intrinsics and cleanup

* Add tests

* Fix affected capability test

* Update and fix tests

* Move expected.txt file

* Refactor WaveMask* to call WaveMulti*

* Refactor SPIRV/GLSL preamble code

* Enable emit-via-glsl tests

* remove wave_multi_prefix capability in favor of subgroup_partitioned

* Update docs

* Update cap atoms doc</content>
</entry>
</feed>
