<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/glsl/layout-scalar-qualifier.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-07-16T00:44:33+00:00</updated>
<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>
</feed>
