From 10b62eecd94be53eca4ac2555af860f864966d76 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 14 Sep 2017 15:37:05 -0700 Subject: IR: handle control flow constructs (#186) * IR: handle control flow constructs This change includes a bunch of fixes and additions to the IR path: - `slang-ir-assembly` is now a valid output target (so we can use it for testing) - This uses what used to be the IR "dumping" logic, revamped to support much prettier output. - A future change will need to add back support for less prettified output to use when actually debugging - IR generation for `for` loops and `if` statements is supported - HLSL output from the above control flow constructs is implemented - Revamped the handling of l-values, and in particular work on compound ops like `+=` - Add basic IR support for `groupshared` variables - Add basic IR support for storing compute thread-group size - Output semantics on entry point parameters - This uses the AST structures to find semantics, so its still needs work - Pass through loop unroll flags - This is required to match `fxc` output, at least until we implement unrolling ourselves. * Fixup: 64-bit build issues. * fixup for merge --- source/slang/hlsl.meta.slang.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/slang/hlsl.meta.slang.cpp') diff --git a/source/slang/hlsl.meta.slang.cpp b/source/slang/hlsl.meta.slang.cpp index a3744f620..49254ac60 100644 --- a/source/slang/hlsl.meta.slang.cpp +++ b/source/slang/hlsl.meta.slang.cpp @@ -29,7 +29,14 @@ sb << " __intrinsic_op uint4 Load4(int location);\n"; sb << " __intrinsic_op uint4 Load4(int location, out uint status);\n"; sb << "};\n"; sb << "\n"; -sb << "__generic __magic_type(HLSLStructuredBufferType) struct StructuredBuffer\n"; +sb << "__generic\n"; +sb << "__magic_type(HLSLStructuredBufferType)\n"; +sb << "__intrinsic_type("; + + // TODO: we really need a simple way to write an "expression splice" + sb << kIROp_structuredBufferType; +sb << ")\n"; +sb << "struct StructuredBuffer\n"; sb << "{\n"; sb << " __intrinsic_op void GetDimensions(\n"; sb << " out uint numStructs,\n"; -- cgit v1.2.3