<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/reflection/resource-in-cbuffer.hlsl.expected, 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-01T09:18:53+00:00</updated>
<entry>
<title>Fix 7441: CUDA boolean vector layout to use 1-byte elements (#7862)</title>
<updated>2025-08-01T09:18:53+00:00</updated>
<author>
<name>Harsh Aggarwal (NVIDIA)</name>
<email>haaggarwal@nvidia.com</email>
</author>
<published>2025-08-01T09:18:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=bdda8a90cdd44ca822b21233ac988f92d1f20826'/>
<id>urn:sha1:bdda8a90cdd44ca822b21233ac988f92d1f20826</id>
<content type='text'>
* Fix 7441: CUDA boolean vector layout to use 1-byte elements

Boolean vectors (bool1, bool2, bool3, bool4) were incorrectly implemented
as integer-based types using 4 bytes per element instead of actual 1-byte
boolean elements on CUDA targets.

Changes:
- Update CUDA prelude to define boolean vectors as structs with bool fields
  instead of typedef aliases to integer vectors
- Implement CUDALayoutRulesImpl::GetVectorLayout to use 1-byte alignment
  for boolean vectors, matching actual CUDA memory layout behavior
- Update make_bool functions to populate struct fields correctly

This ensures boolean vectors have the same memory layout as bool[4] arrays:
- bool1: 1 byte (was 4 bytes)
- bool2: 2 bytes (was 8 bytes)
- bool3: 3 bytes (was 12 bytes)
- bool4: 4 bytes (was 16 bytes)

Fixes memory layout mismatch between Slang reflection API and actual
CUDA compilation, achieving 75% memory savings for boolean vector usage.

* Fix CI issues -

Add and update associated functions and operators

* Make boolX same as uchar

* Use align construct on struct for boolX

* Improve Test case for robust alignment checks

* Formatting

* Disable selected slangpy tests

* add metal check which is slightly different than cuda

* Test-1

* Test-2

* Test-3

* Test-4

* ReflectionChange

* cleanup and update

* _slang_select with plain bool is needed for reverse-loop-checkpoint-test</content>
</entry>
<entry>
<title>Add inner texture type to reflection json (#6416)</title>
<updated>2025-02-28T01:52:14+00:00</updated>
<author>
<name>Devon</name>
<email>devonrutledge03@gmail.com</email>
</author>
<published>2025-02-28T01:52:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=cd20e94af9f384c03e8be69f6c8ce9e97212cc9b'/>
<id>urn:sha1:cd20e94af9f384c03e8be69f6c8ce9e97212cc9b</id>
<content type='text'>
* Add inner texture type to reflection json

* Add expected result of test

* Adjust test expected results

* Fix ci test result

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Fixed stage and result field names in json reflection (#5927)</title>
<updated>2024-12-21T16:14:56+00:00</updated>
<author>
<name>Stan</name>
<email>109335133+stanoddly@users.noreply.github.com</email>
</author>
<published>2024-12-21T16:14:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=76fdeaa477a5d21176facf0296f77e28e2d59477'/>
<id>urn:sha1:76fdeaa477a5d21176facf0296f77e28e2d59477</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove some "do what I mean" logic from reflection API (#1539)</title>
<updated>2020-09-11T20:21:10+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-09-11T20:21:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=459e788e2d2b6d21b0bed95cf3046bb8d0e6b8f3'/>
<id>urn:sha1:459e788e2d2b6d21b0bed95cf3046bb8d0e6b8f3</id>
<content type='text'>
The reflection API had a bit of DWIM (Do What I Mean) logic in that a client could query the resource usage/bindings of a `ParameterBlock&lt;X&gt;` and see not only the register `space` or descriptor `set` for the block itself, but also the constant buffer `register` or `binding` for its default constant buffer (if any).

The reason for this behavior was that there was existing client code in Falcor that relied on that behavior for parameter blocks, and even after changing the way that parameter block layouts were computed and stored we sought to maintain backwards compatibility with that client code. The trouble is that the weird behavior then goes on to cause confusion for other clients of the Slang reflection API.

This change removes the special-case logic, and fixes up our reflection tests to mirror the new (correct) information that we return.

When this change is released, it will be a breaking change for any client code that still relies on the old behavior. We will need to coordinate with client application developers to fix their reflection logic. Note that all the same information can still be accessed, simply by using new reflection API that we have added.</content>
</entry>
<entry>
<title>Cover a few corner cases in reflection API (#1163)</title>
<updated>2020-01-08T22:45:06+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-01-08T22:45:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0a856f458ff9f17d76bc646d008602713c6c66d1'/>
<id>urn:sha1:0a856f458ff9f17d76bc646d008602713c6c66d1</id>
<content type='text'>
This change adds some new entry points to the reflection API to cover corner cases that a majority of applications won't care about.
These are most likely to come up for users who want to make a complete copy of the Slang reflection information into a data format of their own design.

All of the information is stuff that we already computed as part of layout, and just hadn't exposed:

* Alignment information for type layouts. This is only useful for ordinary/uniform data; in all other cases alignment is always one. Even for uniform/ordinary data, it is unlikely that any application would actually make use of it.

* Layout information for the result of an entry point function. This would be useful for applications that need to enumerate the varying outputs (user- or system-defined) of a shader. Having information available for `out` parameters but not the function result was inconsistent.

* The "element type" of a parameter block type (e.g., going from `ParameterBlock&lt;X&gt;` to `X`). This seems to have been an oversight since `ConstantBuffer&lt;X&gt;` appears to have been implemented, and the case for a type *layout* was handled.

* The "container" variable layout for a parameter block or constant buffer. It took a while for us to arrive at the current representation of layout for parameter groups, and most client code continues to use the original API that requires us to generated kludged "do what I mean" data. However, if we don't expose the more useful new representation fully, there is no way for users to take advantage of it!

The reflection test tool has been updated to print the new information where it makes sense, which provides us some level of coverage for the new code.
Unfortunately, this led to some cascading changes:

* First, a bunch of the tests had their output changed since they include new information. That's the easy bit.

* Next, the "container" and "element" var layouts don't actually have names (because there is no actual variable underlying them), which means that the code to emit variable names in the JSON dump needed to be condition.

* Making the `"name"` output conditional messed up a lot of the delicate logic that had been dealing with when to emit commas for the output JSON (JSON uses commas as separators, and doesn't allow trailing commas). I added a bit of new infrastructure to make it simple(-ish) to track when a comma actually needs to be output.</content>
</entry>
<entry>
<title>Fix parameter block binding for Vulkan (#308)</title>
<updated>2017-12-13T23:48:29+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2017-12-13T23:48:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=6d6142122b15461d6c8cabdb31292b0de688ba35'/>
<id>urn:sha1:6d6142122b15461d6c8cabdb31292b0de688ba35</id>
<content type='text'>
Fixes #307

This ends up being a major overhaul over how type layout computation is structured and exposed.
The big problems all arise around cases where both the "container" for a parameter block or CB, and the "element" type both use the same kind of resource.
E.g., if you define a CB with a texture in it, then in Vulkan both the CB and the texture use the same kind of resource, and so if you query the CB's resource usage it will just tell you it uses two descriptor-table slots, but nothing more than that.

Similar confusion still arises in the HLSL case, when a CB with a texture in it reports its parameter category as "mixed" so that a user might query for a category they didn't mean to. There were also cases in the existing code where a parameter block might expose *both* a register-space usage and another concrete resource type, which isn't right.

The most important changes here are:

- A `ParameterGroupTypeLayout` now has a more refined internal structure, consisting of:
  - A `containerTypeLayout`, which represents the resource usage of the buffer/block itself (e.g., if a constant buffer had to be allocated)
  - An `elementVarLayout` which stores the offsets that need to be applied to get from the `VarLayout` for an instance of this parameter-group type to the offsets of its elements. The `TypeLayout` for this variable layout should be the "raw" type of the block/CB element.
  - The `offsetElementTypeLayout` (formerly just `elementTypeLayout`) which represents the element type, but in the case of a `struct` element type, will have fields offset similar to the `elementVarLayout`. This is what all the old code used to use, so we need to keep it for compatibility.

- When doing reflection on a `ParameterGroupTypeLayout`, we now only report the resource usage of the `containerTypeLayout`. This is technically a potentially breaking change in the public API, but I don't think Falcor will mind, since they actually want something closer to this behavior.

- Add a new public API for querying the element variable layout of a parameter block of constant buffer. This could be used by savvy applications to fold the handling of CB element offsetting into some notion of a "reflection path." This would be required for applications that want to handle CBs or parameter blocks where the element type is *not* a `struct` type.

- Remove old logic for applying an offset when creating a type layout for constant buffer element, and instead perform offsetting more uniformly later, by constructing the `offsetElementTypeLayout` from the `rawElementTypeLayout`. This is useful both because we want to keep both (the "raw" type layout becomes the type layout of the `elementVarLayout`), and also because we can decide later whether we even want to allocate a CB register for a buffer, based on whether it actually contains any uniform data.

- Fix cases where we might end up with a parameter block type reporting both that it uses a whole register space (and thus should not expose the resource usage of the container/element type) *and* a constant-buffer register/slot. The latter should be hidden inside the regsiter space.

- Clean up the `spReflectionParameter_GetBinding{Index,Space}` functions to just route to `spReflectionVariableLayout_Get{Offset,Space}`, using the "default" category of the parameter

- Try to make the `GetSpace` query take into account cases where a variable also has an explicit `RegisterSpace` allocation.
  - This probably still needs some cleanup, since ideally we'd just move things into the `space` field on the `ReosurceInfo` and have an invariant that a variable *either* has a `RegisterSpace` allocation, or it has other resource infos, but never both...

- Add some ad-hoc logic so that if the user queries for a binding index/space using a parameter category that doesn't actually apply (e.g., they query for a D3D `t` register when using Vulkan), we can optionally remap it to the resource type they "probably" meant. This is a mess of Do What I Mean code, but it is also what our users want right now.

- Fix various bits of emit logic so that if a parameter block has a register space/set allocated to it, we properly output that as part of the binding information for it.
  - This is another thing that might be cleaned up if we rationale the way that things get split during legalization.

- Add a GLSL case for emitting a parameter block variable as a `cbuffer`.</content>
</entry>
<entry>
<title>Add per-entry-point information to reflection JSON dumps</title>
<updated>2017-07-12T17:18:11+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoley@nvidia.com</email>
</author>
<published>2017-07-12T17:18:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2c6c501b36db9e7991c3f7999451b70f12329ecc'/>
<id>urn:sha1:2c6c501b36db9e7991c3f7999451b70f12329ecc</id>
<content type='text'>
- This also adds reflection API for querying:
  - Entry point name
  - Entry point parameter list
</content>
</entry>
<entry>
<title>Initial import of code.</title>
<updated>2017-06-09T20:44:59+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoley@nvidia.com</email>
</author>
<published>2017-06-09T18:34:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=fcf83dbf9effab3bd98bad2b83b2468b7eb05cfd'/>
<id>urn:sha1:fcf83dbf9effab3bd98bad2b83b2468b7eb05cfd</id>
<content type='text'>
</content>
</entry>
</feed>
