<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-ir-entry-point-uniforms.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-08-21T05:47:18+00:00</updated>
<entry>
<title>Introduce CDataLayout &amp; -fvk-use-c-layout (#8136)</title>
<updated>2025-08-21T05:47:18+00:00</updated>
<author>
<name>Julius Ikkala</name>
<email>julius.ikkala@gmail.com</email>
</author>
<published>2025-08-21T05:47:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=35f8e092f2aa3ed5e3cf03387e712f798ff4850e'/>
<id>urn:sha1:35f8e092f2aa3ed5e3cf03387e712f798ff4850e</id>
<content type='text'>
Closes #8112. ~~The issue asks for a "C layout", but in this PR I use
the term "CPU layout" because this naming was pre-existing in the
codebase as `kCPULayoutRulesImpl_`. The primary purpose of this layout
is to match CPU-side struct definitions with the shader side. I'm open
to better naming suggestions, though.~~

Edit: switched back to using `CDataLayout` &amp; `-fvk-use-c-layout`, as the
CPU target depends on the object layout rules of existing CPU layout
rules, but they're incompatible with actual shaders. So a new
`kCLayoutRulesImpl_` was needed anyway.

---------

Co-authored-by: Ellie Hermaszewska &lt;ellieh@nvidia.com&gt;</content>
</entry>
<entry>
<title>Fix segmentation fault in ray tracing parameter consolidation. (#7997)</title>
<updated>2025-07-31T22:49:39+00:00</updated>
<author>
<name>Copilot</name>
<email>198982749+Copilot@users.noreply.github.com</email>
</author>
<published>2025-07-31T22:49:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=e313300d2446c2efdc1d221304a6b6454fe7fa54'/>
<id>urn:sha1:e313300d2446c2efdc1d221304a6b6454fe7fa54</id>
<content type='text'>
* Initial plan

* Fix segfault in ray tracing parameter consolidation

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

* Fix.

* Fix.

* Keep entrypoint param layout consistent during `MoveEntryPointUniformParametersToGlobalScope`.

* Fix.

* fix.

* Fix.

* Fix pending layout handling.

---------

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: Yong He &lt;yonghe@outlook.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>Remove unnecessary parameters from Metal entry point signature (#6131)</title>
<updated>2025-01-22T16:57:53+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-01-22T16:57:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=14211ec3c4e56e59f479dbac23123ea61eab7d91'/>
<id>urn:sha1:14211ec3c4e56e59f479dbac23123ea61eab7d91</id>
<content type='text'>
* fix metal entry point global params

* address review comments, cleanup and test

* remove dead code

* undo accidental change

* address review comments and cleanup

* minor fix and cleanup

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Add datalayout for constant buffers. (#5608)</title>
<updated>2024-11-21T22:07:23+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-11-21T22:07:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=fdf061e278720ec066a1fac8f1f35a22e817bf2d'/>
<id>urn:sha1:fdf061e278720ec066a1fac8f1f35a22e817bf2d</id>
<content type='text'>
* Add datalayout for constant buffers.

* Fixes.

* Fix test.

* Fix glsl codegen.

* Update spirv-specific doc.

* Fix test.

* Fix binding in the presense of specialization constants.

* address comments.

* Add a test for constant buffer layout.</content>
</entry>
<entry>
<title>Move switch statement bodies to their own lines (#5493)</title>
<updated>2024-11-05T17:47:26+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2024-11-05T17:47:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b118451e301d734e3e783b3acdf871f3f6ea851c'/>
<id>urn:sha1:b118451e301d734e3e783b3acdf871f3f6ea851c</id>
<content type='text'>
* Move switch statement bodies to their own lines

* format

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>format</title>
<updated>2024-10-29T06:49:26+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2024-10-29T06:49:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21'/>
<id>urn:sha1:f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21</id>
<content type='text'>
* format

* Minor test fixes

* enable checking cpp format in ci</content>
</entry>
<entry>
<title>Fix assert when compiling an entrypoint that calls another entrypoint. (#5268)</title>
<updated>2024-10-14T17:06:16+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-10-14T17:06:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2e08f33386b65502e16eea33613bddf98ab8b440'/>
<id>urn:sha1:2e08f33386b65502e16eea33613bddf98ab8b440</id>
<content type='text'>
* Fix assert when compiling an entrypoint that calls another entrypoint.

* Fix test.</content>
</entry>
<entry>
<title>Uniformity analysis. (#3704)</title>
<updated>2024-03-07T21:19:44+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-03-07T21:19:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=240727db40552180446c1f14acc371f690db10e4'/>
<id>urn:sha1:240727db40552180446c1f14acc371f690db10e4</id>
<content type='text'>
* Uniformity analysis.

* Add [NonUniformReturn] decorations to some hlsl intrinsic functions.</content>
</entry>
<entry>
<title>Support recomputing phi params in bwd prop func. (#2841)</title>
<updated>2023-04-26T01:32:45+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-04-26T01:32:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=1717c6c507043a5cc960c2344dd556524804ce59'/>
<id>urn:sha1:1717c6c507043a5cc960c2344dd556524804ce59</id>
<content type='text'>
</content>
</entry>
</feed>
