<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-ir-legalize-varying-params.cpp, 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-10T23:01:51+00:00</updated>
<entry>
<title>Allow entry points with missing numthreads on CPU targets (#8678)</title>
<updated>2025-10-10T23:01:51+00:00</updated>
<author>
<name>Julius Ikkala</name>
<email>julius.ikkala@gmail.com</email>
</author>
<published>2025-10-10T23:01:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c99addbf2e8a0210b97dad2827045dad95765d08'/>
<id>urn:sha1:c99addbf2e8a0210b97dad2827045dad95765d08</id>
<content type='text'>
Several tests have compute entry points without a `[numthreads(x,y,z)]`
decoration. Currently, none of these tests run on the CPU target, as
they crash the compiler. I took a look at the SPIR-V emitter, which
falls back to a workgroup size of (1,1,1):


https://github.com/shader-slang/slang/blob/1e0908bd7107dfbdac912b693c3ab9bd6e1dc8b3/source/slang/slang-ir-spirv-legalize.cpp#L1635-L1643

To match this behaviour, this PR implements a fallback solution that
makes `emitCalcGroupExtents()` emit (1,1,1).

This PR is both a question and a suggestion; I'm not sure the approach
here is at all reasonable. Personally, I'd just like to explicitly add
`[numthreads(1,1,1)]` to all such tests, but I don't know if it's
actually legal and supported to not have a `numthreads`. So the
implementation here is a bit conservative.

I ran across these when I went through tests for the upcoming LLVM
target. These were the final blockers to get all autodiff and
language-features tests passing (not counting the ones using things like
wave intrinsics and barriers etc.)</content>
</entry>
<entry>
<title>Allow 1D SV_DispatchThreadID in CPU targets (#8612)</title>
<updated>2025-10-08T23:13:27+00:00</updated>
<author>
<name>Julius Ikkala</name>
<email>julius.ikkala@gmail.com</email>
</author>
<published>2025-10-08T23:13:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=1e4265edd4ec4c44e3d8f209fca802727076aa46'/>
<id>urn:sha1:1e4265edd4ec4c44e3d8f209fca802727076aa46</id>
<content type='text'>
The varying param legalization pass didn't deal with this 1D form of
SV_DispatchThreadID for CPU targets:

```slang
void computeMain(int i : SV_DispatchThreadID)
```

Instead, it just overrode the type of `i` with a `uint3`, breaking lots
of code that attempted to use `i` for something, like a `switch`
statement for example.

I ran across this when going through `language-feature` tests for the
LLVM target, which will also use this legalization pass. I'm separately
submitting this now because this also fixes the existing CPU target. The
test I enable in this PR is one that was previously generating broken
code on CPU.

(somewhat related issue: #7468)</content>
</entry>
<entry>
<title>Rename some symbols related to pointers types (#8592)</title>
<updated>2025-10-03T04:48:11+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-10-03T04:48:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=cc8f6a241edb47c43c5698ee33abed4fe57d4566'/>
<id>urn:sha1:cc8f6a241edb47c43c5698ee33abed4fe57d4566</id>
<content type='text'>
Note that while this change touched a large numer of files, there are no
changes to functionality being made here. The only things being done are
renaming various symbols and, in a few cases, updating or adding
comments for consistency with the new names.

The core of the naming changes are:

* Most things named to refer to `OutType` (e.g., `IROutType`,
`IRBuilder::getOutType()`, etc.) have been consistently renamed to refer
to `OutParamType`, to emphasize that the relevant AST/IR node types are
only intended for use to represent `out` parameters.

* The same change as described above for `OutType` is also made for
`RefType`, which becomes `RefParamType` in most cases. One mess that
this exposes is the way that the `ExplicitRef&lt;T&gt;` type in the core
module currently lowers to `IRRefParamType`. This change sticks to the
rule of not making functional changes, so that mess is left as-is for
now.

* Names referring to `InOutType` have been changed to instead refer to
`BorrowInOutType`. The intention with this naming change is to emphasize
that the Slang rules for `inout` are semantically those of a borrow (or
at least our interpretation of what a borrow means).

* Names referring to `ConstRefType` have been changed to instead refer
to `BorrowInType`. This change starts work on clarifying that the
existing `__constref` modifier was never intended to be a read-only
analogue of `__ref`, and instead is the input-only analogue of `inout`.

* The `ParameterDirection` enum type has been changed to
`ParamPassingMode`, to reflect the fact that the concept of "direction"
fails to capture what is actually being encoded, particularly once we
have modes beyond simple `in`/`out`/`inout`.

While this change does not alter behavior in any case (the user-exposed
Slang language is unchanged), it is intended to set up subsequence
changes that will work to make the handling of these types in the
compiler more nuanced and correct. Breaking this part of the change out
separately is primarily motivated by a desire to minimize the effort for
reviewers.

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>[CBP] Pointer frontend changes + groupshared pointer support (#7848)</title>
<updated>2025-08-29T22:52:34+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2025-08-29T22:52:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=7758625d3fea67e55e98e7e4103d56c9918365be'/>
<id>urn:sha1:7758625d3fea67e55e98e7e4103d56c9918365be</id>
<content type='text'>
Resolves #7628
Resolves: #8197

Primary Goals:
1. Add `Access` to pointer
2. AddressSpace::GroupShared support for pointers (SPIR-V)
3. Add `__getAddress()` to replace `&amp;`
* `&amp;` is not updated to `require(cpu)` since slangpy uses `&amp;`. This
means we must: (1) merge PR; (2) replace `&amp;` with `__getAddress()`; (3)
add `require(cpu)` to `&amp;`

Changes:
* Added to `Ptr` the `Access` generic argument &amp; logic (for
`Access::Read`).
* Moved the generic argument `AddressSpace` from `Ptr` to the end of the
type.
* Added pointer casting support between any `Ptr` as long as the
`AddressSpace` is the same
* Disallow globallycoherent T* and coherent T*
* Disallow const T*, T const*, and const T*
* Fixed .natvis display of `ConstantValue` `ValOperandNode`
* Support generic resolution of type-casted integers
* Added `VariablePointer` emitting for spirv + other minor logic needed
for groupshared pointers

Breaking Changes:
* Anyone using the `AddressSpace` of `Ptr` will now have to account for
the `Access` argument
* we disallow various syntax paired with `Ptr` and `T*`

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Handle SV_Barycentrics on metal (#8163)</title>
<updated>2025-08-13T20:45:44+00:00</updated>
<author>
<name>James Helferty (NVIDIA)</name>
<email>jhelferty@nvidia.com</email>
</author>
<published>2025-08-13T20:45:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=90a9515fcbc7e362c05341c2ca65fbe78bc1106a'/>
<id>urn:sha1:90a9515fcbc7e362c05341c2ca65fbe78bc1106a</id>
<content type='text'>
Fixes #6785</content>
</entry>
<entry>
<title>Remove the semantic decoration from the original entry struct (#8146)</title>
<updated>2025-08-13T15:37:22+00:00</updated>
<author>
<name>Jay Kwak</name>
<email>82421531+jkwak-work@users.noreply.github.com</email>
</author>
<published>2025-08-13T15:37:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d7e2bac2df176af4cd3955e6df02e2ddcbc059d8'/>
<id>urn:sha1:d7e2bac2df176af4cd3955e6df02e2ddcbc059d8</id>
<content type='text'>
When we legalize the entry point param, there are cases where we need to
reconstruct a struct for the parameter and the original struct wouldn't
be used. But if the user tries to use the origianl struct as a type for
a function parameter, we will end up using both the original struct and
the synthesized struct at the same time.

On Metal and WGSL, it causes an error when an identical semtaic is used
on more than one variable.

This commit removes the semantics from the original struct after cloning
the type.

Fixes https://github.com/shader-slang/slang/issues/8141
Related to https://github.com/shader-slang/slang/issues/7693

---------

Co-authored-by: ArielG-NV &lt;159081215+ArielG-NV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Replace [KnownBuiltin] string-based comparisons with enum-based system (#7714)</title>
<updated>2025-07-15T10:11:39+00:00</updated>
<author>
<name>Copilot</name>
<email>198982749+Copilot@users.noreply.github.com</email>
</author>
<published>2025-07-15T10:11:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d964555d2ee83fac2ba357e4ec81e2a393a7b12f'/>
<id>urn:sha1:d964555d2ee83fac2ba357e4ec81e2a393a7b12f</id>
<content type='text'>
* Initial plan

* Implement enum-based KnownBuiltin system to replace string comparisons

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Add test for enum-based KnownBuiltin system and verify functionality

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Implement enum-based KnownBuiltin system with direct integer values

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Fix IntVal access and update tests for new enum-based KnownBuiltin system

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Replace hardcoded KnownBuiltin integers with preprocessor enum syntax

- Updated all KnownBuiltin attributes to use $( (int)KnownBuiltinDeclName::EnumValue) syntax
- Added space between parentheses to avoid preprocessor bug: $( (int) instead of $((int)
- Updated both core.meta.slang and hlsl.meta.slang files
- Eliminates preprocessor-time integer conversion, baking enum values directly into meta files
- Maintains same functionality while using type-safe enum references

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Fix IDifferentiablePtr KnownBuiltin mapping regression

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Remove unused IDifferentiablePtrType enum case from KnownBuiltinDeclName

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Clean up temporary AST dump files from testing

Co-authored-by: csyonghe &lt;2652293+csyonghe@users.noreply.github.com&gt;

* Replace hardcoded integer with descriptive constant in KnownBuiltin test

Replace the hardcoded [KnownBuiltin(0)] with a descriptive named constant
GEOMETRY_STREAM_APPEND_BUILTIN to improve code readability and maintainability.
The test now clearly indicates which builtin enum value is being tested.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Gangzheng Tong &lt;gtong-nv@users.noreply.github.com&gt;

---------

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;
Co-authored-by: github-actions[bot] &lt;41898282+github-actions[bot]@users.noreply.github.com&gt;
Co-authored-by: Gangzheng Tong &lt;gtong-nv@users.noreply.github.com&gt;
Co-authored-by: Gangzheng Tong &lt;tonggangzheng@gmail.com&gt;</content>
</entry>
<entry>
<title>Legalise out parameters for vertex shaders on metal (#6943)</title>
<updated>2025-06-10T09:33:38+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2025-06-10T09:33:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=405d438bf176411247bfd2937fcbb8c0684b0ed7'/>
<id>urn:sha1:405d438bf176411247bfd2937fcbb8c0684b0ed7</id>
<content type='text'>
* Handle pointer types when getting type cast style

Closes https://github.com/shader-slang/slang/issues/6025

* Move vertex shader out parameters to return type for Metal

Closes https://github.com/shader-slang/slang/issues/6025

* More asserts

* Make struct instead of tuple

* More layout preservation

* Handle same function result

* more layout

* remove layout

* a

* more debug code

* more debug code

* a

* layout working

* refactored

* more tests

* more tests

* fuse loops

* remove unused comments

* Correct filecheck usage

* debug code

* correct name and order of filecheck vars

* simplify

* Address review comments

fix warning

* simplify handling of simple vertex shaders</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>Map `SV_VertexID` to `gl_VertexIndex-gl_BaseVertex`, add `SV_Vulkan*ID` semantics (#7150)</title>
<updated>2025-05-19T18:21:25+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-05-19T18:21:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=634e3960c2bc322bbd51fccc7ff395d9f24e35dc'/>
<id>urn:sha1:634e3960c2bc322bbd51fccc7ff395d9f24e35dc</id>
<content type='text'>
* Map SV_VertexID to `gl_VertexIndex - gl_BaseVertex`, provide SV_Vulkan* SV semantics

* Fix docs

* Regenerate toc

* Fix affected pointer-2 test

* Add tests

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
</feed>
