https://github.com/shader-slang/slang
Revision a22b7520745334ecef3cbd920a0331f01c905935 authored by Tim Foley on 08 March 2018, 20:35:00 UTC, committed by GitHub on 08 March 2018, 20:35:00 UTC
* Cleanups on slang-generate

There is nothing too significant in these changes, but I'm trying to get
things in place so that we can:

- Clean up the stdlib code to do less explicit `StringBuilder`
operations and instead to use more of the "template engine" approach

- Start using slang-generate for code other than the slang stdlib, so
that we can generate more of our boilerplate.

The main new functionality here is that in a template/meta file, you can
now enclose an expression in `$(...)` to indicate that is should be
spliced into the result. E.g. instead of:

    class ${{ sb << someClassName; }}
    {
        ...
    }

We can now write:

    class $(someClassName)
    {
        ...
    }

The other bit of new functionality is support for a whole-line statement
escape, so that instead of:

    ${{ for( auto a : someCollection ) { }}
    void $(a)() { ... }
    ${{ } }}

We can instead write:

    $: for(auto a : someCollection) {
    void $(a)() { ... }
    $: }

I haven't yet tried to use that functionality in the stdlib meta-code,
but doing so would be an obvious next step.

* Fixup: change some $P to $p

The capitalization on some of the GLSL intrinsic mappings got messed up during a find-and-replace operation when removing the double `$` that used to be required to escape things.
1 parent ed718ba
History
Tip revision: a22b7520745334ecef3cbd920a0331f01c905935 authored by Tim Foley on 08 March 2018, 20:35:00 UTC
Cleanups on slang-generate (#437)
Tip revision: a22b752
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-- 42.0 KB
slang.sln -rw-r--r-- 9.1 KB
test.bat -rw-r--r-- 1.4 KB

README.md

back to top