https://github.com/shader-slang/slang
Revision 8d77db3c4e357329c8693457d37b99fc1f48a9f7 authored by Tim Foley on 31 May 2018, 17:50:28 UTC, committed by GitHub on 31 May 2018, 17:50:28 UTC
* Add options to control matrix layout rules

Up to this point, the Slang compiler has assumed that the default matrix layout conventions for the target API will be used.
This means column-major layout for D3D, and *row major* layout for GL/Vulkan (note that while GL/Vulkan describe the default as "column major" there is an implicit swap of "row" and "column" when mapping HLSL conventions to GLSL).

This commit introduces two main changes:

1. The default layout convention is switched to column-major on all targets, to ensure that D3D and GL/Vulkan can easily be driven by the same application logic. I would prefer to make the default be row-major (because this is the "obvious" convention for matrices), but I don't want to deviate from the defaults in existing HLSL compilers.

2. Command-line and API options are introduced for setting the matrix layout convention to use (by default) for each code generation target. It is still possible for explicit qualifiers like `row_major` to change the layout from within shader code.

I also added an API to query the matrix layout convention that was used for a type layout (which should be of the `SLANG_TYPE_KIND_MATRIX` kind), but this isn't yet exercised.

I added a reflection test case to make sure that the offsets/sizes we compute for matrix-type fields are appropriately modified by the flag that gets passed in.

In a future change we could possibly switch the default convention to row-major, if we also changed our testing to match, since there are currently not many clients to be adversely impacted by the change.

* Fixup: silence 64-bit build warning
1 parent 8c593ae
History
Tip revision: 8d77db3c4e357329c8693457d37b99fc1f48a9f7 authored by Tim Foley on 31 May 2018, 17:50:28 UTC
Add options to control matrix layout rules (#583)
Tip revision: 8d77db3
File Mode Size
docs
examples
external
source
tests
tools
.editorconfig -rw-r--r-- 937 bytes
.gitattributes -rw-r--r-- 95 bytes
.gitignore -rw-r--r-- 398 bytes
.gitmodules -rw-r--r-- 107 bytes
.travis.yml -rw-r--r-- 1.6 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.1 KB
LICENSE -rw-r--r-- 1.1 KB
Makefile -rw-r--r-- 6.3 KB
README.md -rw-r--r-- 4.9 KB
appveyor.yml -rw-r--r-- 3.5 KB
premake5.lua -rw-r--r-- 20.1 KB
slang.h -rw-r--r-- 42.1 KB
slang.sln -rw-r--r-- 8.9 KB
test.bat -rw-r--r-- 1.4 KB

README.md

back to top