<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/reflection/structured-buffer.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>2022-05-18T17:57:37+00:00</updated>
<entry>
<title>Support for querying which parameters are used in emitted code (#2239)</title>
<updated>2022-05-18T17:57:37+00:00</updated>
<author>
<name>Alexey Panteleev</name>
<email>alpanteleev@nvidia.com</email>
</author>
<published>2022-05-18T17:57:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=69cb6e8f300d77e74bd2c7dfe15d12e10b38f512'/>
<id>urn:sha1:69cb6e8f300d77e74bd2c7dfe15d12e10b38f512</id>
<content type='text'>
See https://github.com/shader-slang/slang/issues/2213 </content>
</entry>
<entry>
<title>Fix uses of dynamic_cast on types in reflection API (#731)</title>
<updated>2018-11-29T15:48:38+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2018-11-29T15:48:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=e5cc4660c634a0dd35a9813e03192d380f253332'/>
<id>urn:sha1:e5cc4660c634a0dd35a9813e03192d380f253332</id>
<content type='text'>
The `Type` infrastructure uses a class hierarchy, but blindly `dynamic_cast`ing to a desired case doesn't always give the expected result, because a `Type` could represent a `typedef` (a `NamedExpressionType`) that itself resolves to, e.g, a vector type (a `VectorExpressionType`). In that case a `dynamic_cast&lt;VectorExpressionType*&gt;(someType)` would fail, even though the type logically represents a vector. The `Type::As&lt;T&gt;()` method is designed to handle this case, by "looking through" simple `typedef`s to get at the real definition of a type.

The fix in this case is to use `Type::As&lt;T&gt;()` at various points in the reflection code (`reflection.cpp`) instead of `dynamic_cast`.

This problem surfaced with a `StructuredBuffer&lt;float2&gt;` not reflecting correctly, because the element type (`float2`) is actually a `typedef` (for `vector&lt;float,2&gt;`), so I've included a test case that stresses that case. Getting the right output in the test required tweaking the `slang-reflection-test` tool to produce additional output for resource types (currently narrowed down to only affect structured buffers to avoid large diffs in expected test outputs).</content>
</entry>
</feed>
