<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/cross-compile/function-static-const.slang, 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>2019-01-16T16:16:53+00:00</updated>
<entry>
<title>Add proper IR codegen support for local static const variables (#779)</title>
<updated>2019-01-16T16:16:53+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2019-01-16T16:16:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f0633a7d0b1615f6b115d53763bedeeb857b7f3c'/>
<id>urn:sha1:f0633a7d0b1615f6b115d53763bedeeb857b7f3c</id>
<content type='text'>
Previously the IR codegen logic was treating function-scope `static const` variables just like `static` variables, which results in them generating less efficient output HLSL/GLSL.

This change special-cases function-local `static const` variables with logic that mirrors how we handle global-scope `static const` variables.

The approach in this change attempts to find a simpler solution to deal with `static const` variables inside of generic functions than what is currently done for `static` variables in generic functions, but I haven't tested whether that works in practice, so I didn't apply the same approach to the plain `static` case. That would make a good follow-on change.

I've included a single test case to demonstrate that with this fix the Slang compiler generates output DXBC that uses an indexable "immediate" constant buffer, whereas without the fix it generates an array in local memory (slow).</content>
</entry>
</feed>
