<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-emit-wgsl.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-10T01:30:24+00:00</updated>
<entry>
<title>Defer `IRCastStorageToLogicalDeref` in lowerBufferElementType pass. (#8668)</title>
<updated>2025-10-10T01:30:24+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-10-10T01:30:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=e420f2f980813559b186a6a6bcd5540f74310d02'/>
<id>urn:sha1:e420f2f980813559b186a6a6bcd5540f74310d02</id>
<content type='text'>
Fix a regression on metal test.

In `lowerBufferElementTypeToStorageType` pass, not only we want to defer
an argument that is `CastStorageToLogical` to the callee, but also apply
the same defer logic to `CastStorageToLogicalDeref` as well.

Because `CastStorageToLogicalDeref` will appear as argumnet if
`lowerBufferElementTypeToStorageType` is run before we apply the
`in-&gt;borrow` transformation pass, which is the case for metal parameter
block legalization.</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>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>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 int16_t/uint16_t support for WGSL target (#7692)</title>
<updated>2025-07-11T03:22:59+00:00</updated>
<author>
<name>Copilot</name>
<email>198982749+Copilot@users.noreply.github.com</email>
</author>
<published>2025-07-11T03:22:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d0f342c9263a0e47947ac3be9fa4d9f665831e63'/>
<id>urn:sha1:d0f342c9263a0e47947ac3be9fa4d9f665831e63</id>
<content type='text'>
* Initial plan

* Implement int16_t/uint16_t support for WGSL target

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

* Change int16_t/uint16_t to emit proper diagnostics instead of auto-promoting

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

* Implement diagnoseOnce to prevent duplicate diagnostics

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

* Optimize diagnoseOnce to use HashSet::add() return value

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

* Apply code formatting to slang-emit-c-like.h

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

* Fix diagnoseOnce to use all parameters instead of first parameter only

Co-authored-by: csyonghe &lt;2652293+csyonghe@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;</content>
</entry>
<entry>
<title>extend fiddle to allow custom lua splices in more places (#7559)</title>
<updated>2025-07-01T19:03:41+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2025-07-01T19:03:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5120c1cd072548654c9ce79fa85426a5e48736c4'/>
<id>urn:sha1:5120c1cd072548654c9ce79fa85426a5e48736c4</id>
<content type='text'>
* Add fkYAML submodule

* Generate slang-ir-inst-defs.h from slang-ir-inst-defs.yaml

* generate ir-inst-defs.h

* neaten things

* neaten inst def parser

* add rapidyaml submodule

* remove fkyaml

* remove fkyaml submodule

* remove use of ir-inst-defs.h

* format and warnings

* fix wasm build

* tidy

* remove rapidyaml

* Extend fiddle to allow custom splices in more places

* Use lua to describe ir insts

* fix

* neaten

* neaten

* neaten

* spelling

* neaten

* comment comment out assert

* merge</content>
</entry>
<entry>
<title>Fix generation of wgsl case arms (#7374)</title>
<updated>2025-06-25T07:35:12+00:00</updated>
<author>
<name>Swoorup Joshi</name>
<email>swoorupj@gmail.com</email>
</author>
<published>2025-06-25T07:35:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=7e8c85e85440c1fea42236a8ef8286e1ce1638ce'/>
<id>urn:sha1:7e8c85e85440c1fea42236a8ef8286e1ce1638ce</id>
<content type='text'>
* Fix generation of wgsl case arms

* Added test case to test generation of switch case

---------

Co-authored-by: Harsh Aggarwal (NVIDIA) &lt;haaggarwal@nvidia.com&gt;</content>
</entry>
<entry>
<title>Add `vk::offset` to specify member offsets for push constants (#6797)</title>
<updated>2025-04-21T18:46:23+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-04-21T18:46:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=62baf92a524a5b57eb465100a5e47c489c049f15'/>
<id>urn:sha1:62baf92a524a5b57eb465100a5e47c489c049f15</id>
<content type='text'>
* Add struct member offset qualifier for SPIRV

* Implement for GLSL target and add tests

* clean up

* fix formatting

* fix typo

* renamed GLSLStructOffset to VkStructOffset and added emit-spirv-via-glsl test case</content>
</entry>
<entry>
<title>Use correct syntax for WGSL array transpiling (#6693)</title>
<updated>2025-04-02T08:46:52+00:00</updated>
<author>
<name>jarcherNV</name>
<email>jarcher@nvidia.com</email>
</author>
<published>2025-04-02T08:46:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5c111ebef679c994047df95bbdf90181ccb2d067'/>
<id>urn:sha1:5c111ebef679c994047df95bbdf90181ccb2d067</id>
<content type='text'>
Fixes issue #6533

This patch updates handling of Array and ConstantBuffer types for WGSL
transpiling, giving correct syntax for arrays of buffers in WGSL.</content>
</entry>
<entry>
<title>Implement GetDimensions for structured buffers on WGSL (#6609)</title>
<updated>2025-03-14T22:32:37+00:00</updated>
<author>
<name>Darren Wihandi</name>
<email>65404740+fairywreath@users.noreply.github.com</email>
</author>
<published>2025-03-14T22:32:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c8c9e424e91e72e718529ed76df14f7586624cd6'/>
<id>urn:sha1:c8c9e424e91e72e718529ed76df14f7586624cd6</id>
<content type='text'>
* Implement structured buffer GetDimensions for WGSL

* byte address buffer fix

* enable wgsl test and minor fixups

* maybe fix get equivalent structured buffer

* remove unnecessary include

* clean up some code in meta file</content>
</entry>
</feed>
