<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/compute/global-init.slang.expected.txt, 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>2017-11-20T21:45:10+00:00</updated>
<entry>
<title>IR: support global variable with initializers (#294)</title>
<updated>2017-11-20T21:45:10+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2017-11-20T21:45:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=37315c96ea48045fae60f0e1cb1a3293f3ddd962'/>
<id>urn:sha1:37315c96ea48045fae60f0e1cb1a3293f3ddd962</id>
<content type='text'>
The big change here is that the ability to contain basic blocks with instructions in them has been hoisted from `IRFunc` into a new base type `IRGlobalValueWithCode` shared with `IRGlobalVar`.
The basic blocks of a global variable define initialization logic for it; they can be looked at like a function that returns the initial value.

Places in the IR that used to assume functions contain all the code need to be updated, but so far I only handled the cloning step.

The emit logic currently handles an initializer for a global variable by outputting its logic as a separate function, and then having the variable call that function to initialize itself. This should be cleaned up over time so that we generate an ordinary expression whenever possible.

I also made the emit logic correctly label any global variable without a layout (that is, any that don't represent a shader parameter) as `static` so that the downstream HLSL compiler sees them as variables rather than parameters.</content>
</entry>
</feed>
