https://github.com/shader-slang/slang
Revision c7c97ad4bb62b83efd6e26cdd4f38ebf164ec40e authored by Tim Foley on 08 February 2018, 22:46:12 UTC, committed by GitHub on 08 February 2018, 22:46:12 UTC
* Basic IR support for `static const` globals

Our strategy for lowering global *variables* can fall back to putting their initialization into a function, but that isn't really appropriate for global constants (it also isn't appropriate for arrays, but we'll need to deal with that seaprately).

This change adds a distinct case for global constants (rather than treating them as variables), and forces the emission logic to always emit them as a single expression.
Doing this makes assumptions about how the IR for these constants gets emitted (and what optimziations might do to it).
In order to make things work, I had to switch the handling of initializer-list expressions to not be lowered via temporaries and mutation (since that isn't a good fit for reverting to a single expression).

I've added a single test case to ensure that this works in the simplest scenario. My next priority will be to see if this unblocks my work in Falcor.

* Fixup: bug fixes
1 parent 112caca
History
Tip revision: c7c97ad4bb62b83efd6e26cdd4f38ebf164ec40e authored by Tim Foley on 08 February 2018, 22:46:12 UTC
Basic IR support for `static const` globals (#404)
Tip revision: c7c97ad
File Mode Size
build
docs
examples
external
source
tests
tools
.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
slang.h -rw-r--r-- 41.8 KB
slang.sln -rw-r--r-- 9.1 KB
test.bat -rw-r--r-- 1.4 KB

README.md

back to top