https://github.com/shader-slang/slang
Revision 8b3e3beea66d9773adf11ea2e163577d649f3d7c authored by Tim Foley on 28 January 2020, 20:35:13 UTC, committed by Tim Foley on 28 January 2020, 20:35:13 UTC
When using row-major layout (via command-line or API option), the following sort of declaration: ```hlsl StructuredBuffer<float4x4> 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<Wrapper> 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.
1 parent b3e0b0d
Tip revision: 8b3e3beea66d9773adf11ea2e163577d649f3d7c authored by Tim Foley on 28 January 2020, 20:35:13 UTC
Fix layout for structured buffers of matrices (#1184)
Fix layout for structured buffers of matrices (#1184)
Tip revision: 8b3e3be
File | Mode | Size |
---|---|---|
docs | ||
examples | ||
external | ||
prelude | ||
source | ||
tests | ||
tools | ||
.editorconfig | -rw-r--r-- | 937 bytes |
.gitattributes | -rw-r--r-- | 95 bytes |
.gitignore | -rw-r--r-- | 480 bytes |
.gitmodules | -rw-r--r-- | 774 bytes |
.travis.yml | -rw-r--r-- | 1.7 KB |
CODE_OF_CONDUCT.md | -rw-r--r-- | 3.1 KB |
LICENSE | -rw-r--r-- | 1.1 KB |
README.md | -rw-r--r-- | 7.1 KB |
appveyor.yml | -rw-r--r-- | 4.0 KB |
premake5.lua | -rw-r--r-- | 29.4 KB |
slang-com-helper.h | -rw-r--r-- | 4.8 KB |
slang-com-ptr.h | -rw-r--r-- | 4.8 KB |
slang-tag-version.h | -rw-r--r-- | 36 bytes |
slang.h | -rw-r--r-- | 123.9 KB |
slang.sln | -rw-r--r-- | 9.9 KB |
test.bat | -rw-r--r-- | 1.4 KB |
travis_build.sh | -rw-r--r-- | 460 bytes |
travis_test.sh | -rw-r--r-- | 435 bytes |
Computing file changes ...