summaryrefslogtreecommitdiffstats
path: root/source/slang/ir.h
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-02-07 13:41:43 -0800
committerGitHub <noreply@github.com>2018-02-07 13:41:43 -0800
commit1fbc73d96fbc0a199d823dfb38fc8f02bf7ada0a (patch)
treeb4d894f1179a66219631539a95e422ba62988b04 /source/slang/ir.h
parent662f43fff6721c6cd013a8f1b2639c2e29fe6be3 (diff)
Support __target_intrinsic modifiers in IR codegen (#401)
The standard library already has a bunch of these decorations, since they were added to support Slang->Vulkan codegen on the AST-to-AST path. This change makes the IR code generator able to exploit the modifiers so that we pick up a bunch of Vulkan support "for free" in the short term. The basic change is in `lower-to-ir.cpp` where we copy over any `TargetIntrinsicModifier`s to become `IRTargetIntrinsicDecoration`s with the same information. We then need a bit of logic in `ir.cpp` to make sure we clone them as needed. The core work of using the modifiers is in `emit.cpp`, where I basically just copy-pasted the existing logic that applied in the AST path (all the AST-related code there is dead, and we should clean it up soon). The big change that comes with this logic is that when dealing with a member function, the numbering of the argument used in the intrinsic definition string changes, so that `$0` refers to the base object (whereas before the base object was looked up via the base expression of a `MemberExpr` used for the function). This requires a bunch of the definitions in the library to be updated; hopefully I caught them all. For kicks, I've re-enabled a cross-compilation test just to confirm that we are generating valid SPIR-V for code that performs texture-fetch operations. I don't expect us to keep that test enabled as-is in the long term, though, because it would be much better to instead use render-test to do the same thing. Alas, beefing up the Vulkan support in render-test is an outstanding work item, and I didn't want to pollute this change with more work along those lines.
Diffstat (limited to 'source/slang/ir.h')
-rw-r--r--source/slang/ir.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/source/slang/ir.h b/source/slang/ir.h
index fe6fab5f6..1b4529a3c 100644
--- a/source/slang/ir.h
+++ b/source/slang/ir.h
@@ -106,6 +106,7 @@ enum IRDecorationOp : uint16_t
kIRDecorationOp_Layout,
kIRDecorationOp_LoopControl,
kIRDecorationOp_Target,
+ kIRDecorationOp_TargetIntrinsic,
};
// A "decoration" that gets applied to an instruction.