<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-profile.h, 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-24T19:59:58+00:00</updated>
<entry>
<title>Organize code better by splitting some big files (#7890)</title>
<updated>2025-07-24T19:59:58+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-07-24T19:59:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=8ccd495d5eaa82cb831378c28dd190e657b6c999'/>
<id>urn:sha1:8ccd495d5eaa82cb831378c28dd190e657b6c999</id>
<content type='text'>
* Organize code better by splitting some big files

The basic change here is that the majority of the declarations in `slang-compiler.h` have been split out into a set of smaller and more focused files.
As a result, the implement of those declarations have been moved from `slang-compiler.cpp` and `slang.cpp` over to those new files when the proper home for code is obvious.

I have tried as much as possible to *not* make any edits to the code along the way, and just copy-paste declarations from one place to another as-is.
The exceptions I am aware of are:

* In some cases a function that used to be file-scope `static` was used by code that landed in two or more different `.cpp` files. In these cases, I changed the function to be non-`static` (removing the `_` prefix from its name, if it had one, per our naming conventions), and put a declaration for the function into the most appropriate header I could identify.

* I added a few comments in places where I saw ugly or unfortunate things in the code I was moving, and wanted to tag them with `TODO`s so we can hopefully get to them in the fullness of time.

* I added top-level comments to each of the new `.h` files that was introduced to try to explain the logic for what goes into that file.

* In cases where one of the new header files mostly existed to declare a single type, I sometimes added more detail to the doc comment on that type, to better explain the type and its role in the compiler (this is text that otherwise might have gone into the comment at the top leve lof the file, but I figured that the doc comment would have higher discoverability).

I expect that the most contentious choice here is that the `Session` class lands in `slang-global-session.h` while `slang-session.h` holds the `Linkage` class.
The names used in this change are consistent with how the relevant concepts in the public Slang API are named, and are consistent with how we *intend* to rename the classes themselves in time.

* format code

* fixup

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Allow checking capabilities in specific stages (#7375)</title>
<updated>2025-06-10T16:44:08+00:00</updated>
<author>
<name>jarcherNV</name>
<email>jarcher@nvidia.com</email>
</author>
<published>2025-06-10T16:44:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=3fa382505271834514d47612efee8e51a06204c5'/>
<id>urn:sha1:3fa382505271834514d47612efee8e51a06204c5</id>
<content type='text'>
This allows checking capabilities in any stage, needed specifically for
the hlsl_2018 capability which is defined for sm_5_1 and above. Stage
specific capabilities such as cs_5_1 would not find this in any stage
other than compute, so we need to restrict the check to only desired
stages.</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>Initial WGSL support (#5006)</title>
<updated>2024-09-09T17:08:29+00:00</updated>
<author>
<name>Anders Leino</name>
<email>aleino@nvidia.com</email>
</author>
<published>2024-09-09T17:08:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=170558c9618252933286955c6d010c8e3735652a'/>
<id>urn:sha1:170558c9618252933286955c6d010c8e3735652a</id>
<content type='text'>
* Add WGSL as a target

This is required for #4807.

* C-like emitter: Allow the function header emission to be overloaded

WGSL-style function headers are pretty different from normal C-style headers:

Normal C-style headers:
 ReturnType Func(...)
 void VoidFunc(...)

WGSL-style headers:
  fn Func(...) -&gt; ReturnType
  fn VoidFunc(...)

This change allows the header style to be overloaded, in order to accomodate WGSL-style
headers as required to resolve issue #4807, but retains normal C-style headers as the
default implementation.

[1] https://www.w3.org/TR/WGSL/#function-declaration-sec

* C-like emitter: Allow emission of switch case selectors to be overloaded

The C-like emitter will emit code like this:

    switch(a.x)
    {

    case 0:
    case 1:
    {
       ...
    } break;

    ...

    }

This is not allowed in WGSL. Instead, selectors for cases that share a body must [1] be
separated by commas, like this:

    switch(a.x)
    {

    case 0, 1:
    {
       ...
    } break;

    ...

    }

To prepare for addressing issue #4807, this patch makes the emission of switch case
selectors overloadable.

[1] https://www.w3.org/TR/WGSL/#syntax-case_selectors

* C-like emitter: Support WGSL-style declarations

This patch helps to address issue 4807.

C-like languages declare variables like this:
i32 a;

WGSL declares variables like this:
var a : i32

The patch introduces overloads so that the forthcoming WGSL emitter can output WGSL-style
declarations, which helps to resolve #4807.

* C-like emitter: Support overloading of declarators

Unlike C-like languages, WGSL does not support the following types at the syntax level,
via declarators:
- arrays
- pointers
- references

For this reason, this patch introduces support for overloading the declarator emitter,
in order to help address issue #4807.

C-like languages:
int a[3]; // Array-ness of type is mixed into the "declarator"

WGSL:
var a : array&lt;int, 3&gt;; // Array-ness of type is part of the... type_specifier!

* C-like emitter: Allow struct declaration separator to be overridden

C-like languages use ';' as a separator, and languages like e.g. WGSL use ','.
This change prepares for addressing issue #4807.

* C-like emitter: Allow overriding of whether pointer-like syntax is necessary

Things like e.g. structured buffers map to "ptr-to-array" in WGSL, but ptr-typed
expressions don't always need C-style pointer-like syntax.
Therefore, make it overrideable whether or not such syntax is emitted in various cases in
order to address #4807.

* C-like emitter: Emit parenthesis to avoid warning about &amp; and + precedence

This helps with #4807 because WGSL compilers (e.g. Tint) treat absence of parenthesis as
an error.

* C-like emitter: Add hook for emitting struct field attributes

WGSL requires @align attributes to specify explicit field alignment in certain cases.
Thus, this patch prepares for addressing #4807.

* C-like emitter: Add hook for emitting global param types

Declarations of structured buffers map to global array declarations in WGSL.
However, in all other cases such as when structured buffers are used in operands, their
types map to *ptr*-to-array.
This patch makes it possible for the WGSL back-end to say that structured buffers
generally map to "ptr-to-array" types, but still have a special case of just "array" when
declaring the global shader parameter.

Thus, this patch helps with addressing #4807.

* IR lowering: Use std140 for WGSL uniform buffers

This patch just cuts out some logic that prevented std140 to be chosen for WGSL uniform
buffers.

Note that WGSL buffers in the uniform address space is not quite std140, but for now it's
close enough to avoid compile issues.

Later on, a custom layout should be created for WGSL uniform buffers.
When that's done, this change will be revisited, but for now it helps to resolve #4807.

* Don't emit line directives in WGSL by default

WGSL does not support line directives [1].
The plan currently seems to be to instead support source-map [2].
This is part of addressing issue #4807.

[1] https://github.com/gpuweb/gpuweb/issues/606
[2] https://github.com/mozilla/source-map

* WGSL IR legalization: Map SV's

The implementation closely follows the cooresponding one for Metal.

Supported:
- DispatchThreadID
- GroupID
- GroupThreadID
- GroupThreadID

Unsupported:
- GSInstanceID

This is not complete, but it helps to address #4807.

* WGSL emitter: Add support for basic language constructs

A lot of the basics are added in order to generate correct WGSL code for basic Slang language constructs.
This addresses issue #4807.

This adds support for at least the following:
- statments
 - if statements
 - ternary operator
 - while statement
 - for statements
 - variable declarations
 - switch statements
  - Note: Slang may emit non-constant case expressions, see issue 4834
- literals
 - integer literals
  - u?int[16|32|64]_t
  - float and half literals
  - bool literals
  - vector literals and splatting (e.g 1.xxx)
- function definitions
- assignments
 - +=, *=, /=
 - array assignments
 - vector assignments/updates
  - swizzles of other vectors
  - from matrix rows ('m[i]' notation)
  - from matrix cols (using swizzle notation, e.g 'm._11_12_13')
 - matrix assignments/updates
  - to rows ('m[i]' notation)
  - to cols (using swizzle notation, e.g 'm._11_12_13')
- declarations
 - arrays

[1] https://www.w3.org/TR/WGSL/#syntax-switch_body

* Add some WGSL capabilities

This patch registers some WGSL capabilities required to pass many of the initial compute
shader compile tests.
Many capabilities still remain to be added -- this is just an initial set to help resolve
issue #4807.

- asint
- min and max
- cos and sin
- all and any

* WGSL and C-like emitters: Add hack to bitcast case expression

In WGSL, the switch condition and case types must match.
https://www.w3.org/TR/WGSL/#switch-statement

Slang currently allows these types to mismatch, as pointed out in #4921.

Issue #4921 should eventually be addressed in the front-end by a patch like [1].
However, at the moment that would break Falcor tests.
Thus, this patch temporarily works around the issue in the WGSL emitter only in order to
help resolve #4807.

In the future, the Falcor tests should be fixed, this patch should be dropped and [1]
should be merged instead.

[1] a32156ef52f43b8503b2c77f2f1d51220ab9bdea</content>
</entry>
<entry>
<title>Allow capabilities to be used with `[shader("...")]` (#4928)</title>
<updated>2024-08-28T19:06:23+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2024-08-28T19:06:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=65240d074b4ddec55e56962ebf8de46207bcf5fa'/>
<id>urn:sha1:65240d074b4ddec55e56962ebf8de46207bcf5fa</id>
<content type='text'>
* Allow capabilities to be used with `[shader("...")]`

Fixes: #4917

Changes:
1. Allow using capabilities instead of `Stage`s with `EntryPointAttribute`.
2. When resolving capabilities for an entrypoint+profile (per entrypoint) in `resolveStageOfProfileWithEntryPoint` add our `EntryPointAttribute` and resolved capability
3. Added tests and some capabilities related clean-up

* fix a warning made by a mistake in syntax

* change fineStageByName to assume it is passed a stage without a '_'

* test with and without prefix '_'

* cleanup some profiles and reprisentation to work better with 'Stage' and 'Profile'

This use case is why we need to clean all profile-usage into `CapabilityName`s directly.

* change how we compare

* only change profiles

* let all capabilities be resolved by 'shader' profile for now

* fix warning checks I accidently broke

* meshshading_internal to _meshshading

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Move the file public header files to `include` dir (#4636)</title>
<updated>2024-07-17T17:53:19+00:00</updated>
<author>
<name>kaizhangNV</name>
<email>149626564+kaizhangNV@users.noreply.github.com</email>
</author>
<published>2024-07-17T17:53:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2db15080085856ed9b5f20642dbb354aac59a888'/>
<id>urn:sha1:2db15080085856ed9b5f20642dbb354aac59a888</id>
<content type='text'>
* Move the file public header files to `include` dir

Close the issue (#4635).

Move the following headers files to a `include` dir
located at root dir of slang repo:

 slang-com-helper.h -&gt; include/slang-com-helper.h
 slang-com-ptr.h -&gt; include/slang-com-ptr.h
 slang-gfx.h -&gt; include/slang-gfx.h
 slang.h -&gt; include/slang.h

Change cmake/SlangTarget.cmake to add include path to
every target, and change the source file to use
"#include &lt;slang.h&gt;" to include the public headers.

The source code update is by the script like follow:

```
fileNames_slang=$(grep -r "\".*slang\.h\"" source/ -l)

for fileName in "${fileNames_slang[@]}"
do
    echo "$fileName"
    sed -i "s/\".*slang\.h\"/\"slang\.h\"/" $fileName
done
```

* Fix the test issues

* Fix cpu test issues by adding include seach path

* Update cmake to not add include path for every target

Also change "#include &lt;slang.h&gt;" to "include "slang.h" " to
make the coding style consistent with other slang code.

* Change public include to private include for unit-test and slang-glslang</content>
</entry>
<entry>
<title>Improve Direct SPIRV Backend Test Coverage (#4396)</title>
<updated>2024-06-14T16:56:59+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2024-06-14T16:56:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=fdef653ab5b38ac78d355d2f0148c6d77e784a8c'/>
<id>urn:sha1:fdef653ab5b38ac78d355d2f0148c6d77e784a8c</id>
<content type='text'>
'raytracing' and 'texture-footprint' tests

fixed texture-footprint bug
changed when we emit raytracing/rayquery extensions with glsl backend (to reduce incorrect extension emitting)</content>
</entry>
<entry>
<title>SPIRV `Block` decoration fixes. (#4303)</title>
<updated>2024-06-08T12:12:49+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-06-08T12:12:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=9a23a9aab3721828526c921db1e779008e133e8f'/>
<id>urn:sha1:9a23a9aab3721828526c921db1e779008e133e8f</id>
<content type='text'>
* SPIRV `Block` decoration fixes.

- SPIRV does not allow duplicate `Block` decorations. So we shouldn't be generating them.

- Also fixes duplication of OpName.

- SPIRV and HLSL do not allow ConstantBuffer with trailing unsized arrays. Added a check in the front-end against such code.

* Convert failing cross-compile tests to filecheck.

---------

Co-authored-by: Jay Kwak &lt;82421531+jkwak-work@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Add skeleton for metal backend. (#3971)</title>
<updated>2024-04-18T04:32:28+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-04-18T04:32:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2c66cc7ef03b4d38fc463f2c8609a81232fcb91a'/>
<id>urn:sha1:2c66cc7ef03b4d38fc463f2c8609a81232fcb91a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Capability type checking. (#3530)</title>
<updated>2024-02-03T06:28:02+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-02-03T06:28:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=14764896c34b230a5563f48d8b8e565de2f3aa10'/>
<id>urn:sha1:14764896c34b230a5563f48d8b8e565de2f3aa10</id>
<content type='text'>
* Capability type checking.

* Fix.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
</feed>
