<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-ir-wrap-structured-buffers.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>2024-10-29T06:49:26+00:00</updated>
<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>Fix layout for structured buffers of matrices (#1184)</title>
<updated>2020-01-28T20:35:13+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-01-28T20:35:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=8b3e3beea66d9773adf11ea2e163577d649f3d7c'/>
<id>urn:sha1:8b3e3beea66d9773adf11ea2e163577d649f3d7c</id>
<content type='text'>
When using row-major layout (via command-line or API option), the following sort of declaration:

```hlsl
StructuredBuffer&lt;float4x4&gt; gBuffer;

... gBuffer[i] ...
```

Generates unexpected results when compiled to DXBC via fxc or DXIL via dxc, because the fxc/dxc compilers do not respect the matrix layout mode in this specific case (a structured buffer of matrices). Instead, they always use column-major layout, even if row-major was requested by the user.

A user can work around this behavior by wrapping the matrix in a `struct`:

```hlsl
struct Wrapper { float4x4 wrapped; }
SturcturedBuffer&lt;Wrapper&gt; gBuffer;

... gBuffer[i].wrapped ...
```

This change simply automates that workaround when compiling for an HLSL-based downstream compiler, so that we get the same behavior across all our backends.

The change adds a test case to confirm the behavior across multiple targets, but it turns out we also had a test checked in that confirmed the buggy (or at least surprising) fxc/dxc behavior, so that one had its baselines changed and can work as a regression test for this fix as well.</content>
</entry>
</feed>
