https://github.com/shader-slang/slang
Revision 935b629448fedc187243bfe88d4149bf30d89c05 authored by Tim Foley on 23 January 2019, 17:13:03 UTC, committed by GitHub on 23 January 2019, 17:13:03 UTC
There was a bug in the logic for emitting initial IR, such that it was neglecting to emit "methods" (member functions) unless they were also referenced by a non-member (global) function, or were needed to satisfy an interface requirement. This would only matter for `import`ed modules, since for non-`import`ed code, anything relevant would be referenced by the entry point so that the problem would never surface. This change fixes the underlying problem by adding a step to the IR lowering pass called `ensureAllDeclsRec` that makes sure that not only global-scope declarations, but also anything nested under a `struct` type gets emitted to the initial IR module. There are also a few unrelated fixes in this PR, which are things I ran into while making the fix: * Deleted support for the (long gone) `IRDeclRef` type in our `slang.natvis` file * Added support for visualizing the value of IR string and integer literals when they appear in the debugger * Fixed IR dumping logic to not skip emitting `struct` and `interface` instructions. Switching those to inherit from `IRType` accidentally affected how they get printed in IR dumps by default. * Fixed up the IR linking logic so that it correctly takes `[export]` decorations into account, so that an exported definition will always be taken over any other (unless the latter is more specialized for the target). I initially implemented this in an attempt to fix the original issue, but found it wasn't a fix for the root cause. It is still a better approach than what was implemented previously, so I'm leaving it in place.
1 parent a08a314
Tip revision: 935b629448fedc187243bfe88d4149bf30d89c05 authored by Tim Foley on 23 January 2019, 17:13:03 UTC
Fix IR emit logic for methods in `struct` types (#791)
Fix IR emit logic for methods in `struct` types (#791)
Tip revision: 935b629
File | Mode | Size |
---|---|---|
docs | ||
examples | ||
external | ||
source | ||
tests | ||
tools | ||
.editorconfig | -rw-r--r-- | 937 bytes |
.gitattributes | -rw-r--r-- | 95 bytes |
.gitignore | -rw-r--r-- | 407 bytes |
.gitmodules | -rw-r--r-- | 406 bytes |
.travis.yml | -rw-r--r-- | 1.7 KB |
CODE_OF_CONDUCT.md | -rw-r--r-- | 3.1 KB |
LICENSE | -rw-r--r-- | 1.1 KB |
Makefile | -rw-r--r-- | 6.0 KB |
README.md | -rw-r--r-- | 6.7 KB |
appveyor.yml | -rw-r--r-- | 3.7 KB |
premake5.lua | -rw-r--r-- | 25.4 KB |
slang-com-helper.h | -rw-r--r-- | 4.8 KB |
slang-com-ptr.h | -rw-r--r-- | 4.8 KB |
slang.h | -rw-r--r-- | 77.4 KB |
slang.sln | -rw-r--r-- | 9.8 KB |
test.bat | -rw-r--r-- | 1.4 KB |
travis_build.sh | -rw-r--r-- | 304 bytes |
travis_test.sh | -rw-r--r-- | 435 bytes |
Computing file changes ...