<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/vkray/raygen-trace-ray-param-struct.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>2024-04-04T00:43:24+00:00</updated>
<entry>
<title>Legalization of non-struct when function expects struct, resolves #3840 (#3880)</title>
<updated>2024-04-04T00:43:24+00:00</updated>
<author>
<name>ArielG-NV</name>
<email>159081215+ArielG-NV@users.noreply.github.com</email>
</author>
<published>2024-04-04T00:43:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=94ced35a519294bbfb8e1d6c90aa235dd3878d88'/>
<id>urn:sha1:94ced35a519294bbfb8e1d6c90aa235dd3878d88</id>
<content type='text'>
* Legalization of non-struct when expects struct.

`__forceVarIntoStructTemporarily()` solves the issue of passing "non-struct type's" into a parameter that only accepts "struct type's".
The intrinsic solves the issue through checking the parameter of the intrinsic:
If the parameter is a "struct type"
* Return a reference to the parameter
else
* a "struct type" Temporary variable is made and the "non struct type" parameter is copied to a member of this struct. This struct is then returned by `__forceVarIntoStructTemporarily()`. Optionally if the use location of this call is a argument which can have side effects (out, inout, ref, etc.) the temporary struct variable is copied into the original "non struct type" parameter.

Testing code has "addComplexity" functions to avoid optimizations through forcing side effects so we can predict the code output.

* Address review comments

- ForceInline ray functions
- fix testing
- adjust how we replace operands in senarios to avoid unexpected side effects of replacing operands without any explicit checks

* Adjust nv test slightly and remove .glsl file

* Remove implicit LOD sampling &amp; test additions

- Implicit LOD sampling is not allowed in a raygen. Implicit LOD sampling requires depth (from a fragment shader) to sample. Raygen does not have the depth, so this function was replaced.
- Changed other tests for correctness/clarity

* Test if Falcor breaks through use of ForceInline

* Add back force inline

may need to look at how Falcor wrote its slang shaders. This will be done if ForceInline causes issues since ForceInline should not affect code gen in an impactable way.</content>
</entry>
</feed>
