<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/glsl, 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-01T02:08:23+00:00</updated>
<entry>
<title>Enhance buffer load specialization pass to specialize past field extracts. (#8547)</title>
<updated>2025-10-01T02:08:23+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-10-01T02:08:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=e4611e2e30a3e5969d402f5ed7e72706a0e3b024'/>
<id>urn:sha1:e4611e2e30a3e5969d402f5ed7e72706a0e3b024</id>
<content type='text'>
This allows us to specialize functions whose argument is a sub element
of a constant buffer, instead of being only applicable to entire buffer
element. Closes #8421.

This change also implements a proper heuristic to determine when to
specialize the calls and defer the buffer loads.

This PR addresses a pathological case exposed in
`slangpy\slangpy\benchmarks\test_benchmark_tensor.py`, which used to
take 27ms to finish, and now takes 1.25ms.


For example, given:
```
struct Bottom
{
    float bigArray[1024];

    [mutating]
    void setVal(int index, float value) { bigArray[index] = value; }
}

struct Root
{
    Bottom top[2];
    [mutating]
    void setTopVal(int x, int y, float value)
    {
        top[x].setVal(y, value);
    }
}

RWStructuredBuffer&lt;Root&gt; sb;

[shader("compute")]
[numthreads(1, 1, 1)]
void compute_main(uint3 tid: SV_DispatchThreadID)
{
    sb[0].setTopVal(1, 2, 100.0f);
}
```

We are now able to specialize the call to `setTopVal` into:
```
void compute_main(uint3 tid: SV_DispatchThreadID)
{
    setTopVal_specialized(0, 1, 2, 100.0f);
}

void setTopVal_specialized(int sbIdx, int x, int y, float value)
{
      Bottom_setVal_specialized(sbIdx, x, y, value);
}

void Bottom_setVal_specialized(int sbIdx, int x, int y, float value)
{
     sb[sbIdx].top[x].bigArray[y] = value;
}
```

And get rid of all unnecessary loads. Achieving this requires a
combination of function call specialization and buffer-load-defer pass.
The buffer-load-defer pass has been completely rewritten to be more
correct and avoid introducing redundant loads.

This PR also adds tests to make sure pointers, bindless handles, and
loads from structured buffer or constant buffers works as expected.</content>
</entry>
<entry>
<title>Fix varying output structs in GLSL source (#8501)</title>
<updated>2025-09-23T03:17:01+00:00</updated>
<author>
<name>Julius Ikkala</name>
<email>julius.ikkala@gmail.com</email>
</author>
<published>2025-09-23T03:17:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=9e34c6d949e97fc87a0a7be4ab37092b586aee9d'/>
<id>urn:sha1:9e34c6d949e97fc87a0a7be4ab37092b586aee9d</id>
<content type='text'>
Closes #8500.

`slang-ir-translate-global-varying-var.cpp` turns the global varying
outputs into a struct that's returned from the entry point. Currently,
there's a problem when one of the outputs is a struct. It always creates
a generic `IRTypeLayout`, even when a correct type layout already
exists. Somehow, this appears to work when the global varying outputs
aren't structs.

The crash occurs in
`slang-ir-glsl-legalize.cpp:createGLSLGlobalVaryingsImpl()`. It
correctly handles the generated outer struct, but when that contains an
inner struct, it's been given a non-struct type layout and crashes.

This PR uses the correct layout if found, instead of generating a broken
placeholder. This matches the behaviour that has already been
implemented for inputs.

Additionally, I removed a call to `addResourceUsage` from both the input
and output side. I can't see any way in which it would've affected
anything, the layout builder is never used after that call and it
doesn't retroactively modify the layout that was already created.</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>Lowering unsupported matrix types for GLSL/WGSL/Metal targets (#7936)</title>
<updated>2025-07-30T16:27:38+00:00</updated>
<author>
<name>venkataram-nv</name>
<email>vedavamadath@nvidia.com</email>
</author>
<published>2025-07-30T16:27:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=92ee2927d0012dd454dff7bb53b900f5240073d5'/>
<id>urn:sha1:92ee2927d0012dd454dff7bb53b900f5240073d5</id>
<content type='text'>
* Add emit cases for WGSL and GLSL

* Fix compilation warnings

Modify short cutting test to reflect change in emit logic

Lower matrix for metal as well

Add emit matrix logic for metal

Fix compiler warning

Brace initializer for lowered matrices

Fix compiler warnings

* Tests for metal

* Fix mult, any, and determinant

* Fix matrix-matrix multiplication

* Fix mat mul to be element-wise

* Fix compiler warning

* Move makeMatrix to legalization

* Move unary and binary arithmetic operator lowering to legalization

* Remove emit logic and move final comparison operators to legalization

* Handle vector/matrix negation for WGSL

* Restore older SPIR-V emit logic

* Address PR comments

* Revert to zero minus for negation

* format code

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fix GLSL memory layout qualifiers not applied to uniform buffers or cbuffers (#7740)</title>
<updated>2025-07-16T00:44:33+00:00</updated>
<author>
<name>pdeayton-nv</name>
<email>205388607+pdeayton-nv@users.noreply.github.com</email>
</author>
<published>2025-07-16T00:44:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=299eb0c889322a960d1907b6722ee1caf88475a4'/>
<id>urn:sha1:299eb0c889322a960d1907b6722ee1caf88475a4</id>
<content type='text'>
* Fix GLSL memory layout qualifiers not applied to uniform buffers or cbuffers

The `layout(scalar)` qualifier was being ignored for GLSL `uniform` blocks and
HLSL `cbuffer` declarations, causing them to use std140 layout instead of the
requested scalar layout.

**Root Cause**:
The parsing logic in `slang-parser.cpp` handled layout qualifiers inconsistently:
- GLSL `buffer` blocks correctly used `getLayoutArg()` to map layout modifiers
- GLSL `uniform` blocks and HLSL `cbuffer` skipped layout arguments entirely

**Solution**:
- Enhanced `parseHLSLCBufferDecl()` to check for GLSL layout qualifiers
- Added same `getLayoutArg()` logic used by buffer blocks
- Modified uniform block parsing to pass layout arguments through

**Testing**:
- Added comprehensive test case: `tests/glsl/layout-scalar-qualifier.slang`
- Verified fix works for both `uniform` blocks and `cbuffer` declarations
- Confirmed no regressions in existing test suite

**Before**: `layout(scalar) uniform {...}` → std140 layout (32 bytes, offset 0,16)
**After**: `layout(scalar) uniform {...}` → scalar layout (16 bytes, offset 0,4)

Fixes #7735

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

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

* Apply code formatting to slang-parser.cpp

Fixed line wrapping, trailing whitespace, and parameter formatting
according to repository style guidelines.

Co-authored-by: Harsh Aggarwal (NVIDIA) &lt;szihs@users.noreply.github.com&gt;

* format code (#7742)

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

---------

Co-authored-by: github-actions[bot] &lt;41898282+github-actions[bot]@users.noreply.github.com&gt;
Co-authored-by: pdeayton-nv &lt;pdeayton-nv@users.noreply.github.com&gt;
Co-authored-by: Harsh Aggarwal (NVIDIA) &lt;szihs@users.noreply.github.com&gt;
Co-authored-by: slangbot &lt;ellieh+slangbot@nvidia.com&gt;
Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;
Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Fix broken -emit-spirv-via-glsl test option (#7091)</title>
<updated>2025-05-16T00:01:08+00:00</updated>
<author>
<name>sricker-nvidia</name>
<email>115114531+sricker-nvidia@users.noreply.github.com</email>
</author>
<published>2025-05-16T00:01:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b39ec87cccaadebbb9325dd2adb8c0b13b364805'/>
<id>urn:sha1:b39ec87cccaadebbb9325dd2adb8c0b13b364805</id>
<content type='text'>
Fixes issue #6898

The -emit-spirv-via-glsl slang-test option has been broken for
some amount of time. Tests that were using it were operating as
if using -emit-spirv-directly, leading to many duplicated tests.

After fixing the test option, there were an number of errors that
appeared as a result.

This change fixes the broken test option and the resulting test
errors. Some of the test errors revealed some legitimate issues,
such as:

-The GLSL bitCount instrinsic only supports 32-bit integers and
 requires emulation for other bit widths.
-Emitting GLSL 8-bit and 16-bit glsl integer types did not emit
 the proper extension requirements
-Emitting GLSL and casting for 16-bit integers was missing a
 closing parenthesis.
-Missing profile for GL_EXT_shader_explicit_arithmetic_types
-Missing toType cases for UInt8/Int8 for the kIROp_BitCast case
 in tryEmitInstExprImpl.</content>
</entry>
<entry>
<title>Add half-precision matrix type aliases in GLSL (#7066)</title>
<updated>2025-05-13T01:03:59+00:00</updated>
<author>
<name>James Helferty (NVIDIA)</name>
<email>jhelferty@nvidia.com</email>
</author>
<published>2025-05-13T01:03:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2fb95f99c3efbe54f92f6338ab8c6970f1ec35ee'/>
<id>urn:sha1:2fb95f99c3efbe54f92f6338ab8c6970f1ec35ee</id>
<content type='text'>
Fixes #6708

This commit adds type aliases for half-precision matrices, including
f16mat3x2, f16mat3x3, f16mat3x4, f16mat4x2, f16mat4x3, and f16mat4x4.
Convenience aliases for square matrices (f16mat2, f16mat3, f16mat4) are
also added.

This commit introduces a new test file that validates the usage of
half-precision types in a compute shader context.</content>
</entry>
<entry>
<title>bitcast require the input has same width with result type (#7018)</title>
<updated>2025-05-07T05:46:42+00:00</updated>
<author>
<name>kaizhangNV</name>
<email>149626564+kaizhangNV@users.noreply.github.com</email>
</author>
<published>2025-05-07T05:46:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=ccdb2e39da37753961f3694d0f90e676bf859006'/>
<id>urn:sha1:ccdb2e39da37753961f3694d0f90e676bf859006</id>
<content type='text'>
bitcast requires the input has same width with result type, this PR ensures that we always lower the bitcast IR instruction satisfies this requirement.

Close #7017.

</content>
</entry>
<entry>
<title>Add interger pack/unpack intrinsic to glsl (#6997)</title>
<updated>2025-05-06T15:51:07+00:00</updated>
<author>
<name>kaizhangNV</name>
<email>149626564+kaizhangNV@users.noreply.github.com</email>
</author>
<published>2025-05-06T15:51:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=10376faffee1ab51b2d23c311212b5724c3c6ac6'/>
<id>urn:sha1:10376faffee1ab51b2d23c311212b5724c3c6ac6</id>
<content type='text'>
* Add interger pack/unpack intrinsic to glsl

Add unpack8, unpack16 and pack32 intrinsics to glsl.

* add unit test

* fix lowering logic for 'bitcast'

* format</content>
</entry>
<entry>
<title>Fix crash when using GLSL global uniforms and varying inputs/ouputs together (#6651)</title>
<updated>2025-04-05T01:02:16+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-04-05T01:02:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=680fb0b4e9cbb65d46677183a3f68630be1f6179'/>
<id>urn:sha1:680fb0b4e9cbb65d46677183a3f68630be1f6179</id>
<content type='text'>
* Fix incorrect assert on mixed global uniform and varyings

* add test

* remove unnecessary include

* fix incorrect logic

* fix comment grammar

* address review comments and improve test

* minimize diff

* fix more issues for cuda build

* remove unnecessary line for diff</content>
</entry>
</feed>
