From d13bd05164c6a3d0b7ba95bb415f6bfac4cfcb70 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 17 Aug 2017 08:59:30 -0700 Subject: Add a flag to control type splitting The `-split-mixed-types` flag can be provided to command-line `slangc`, and the `SLANG_COMPILE_FLAG_SPLIT_MIXED_TYPE` flag can be passed to `spSetCompileFlags`. Either of these turns on a mode where Slang will split types that included both resource and non-resource fields. The declaration of such a type will just drop the resource fields, while a variable declare using such a type turns into multiple declararations: one for the non-resource fields, and then one for each resource field (recursively). This behavior was already implemented for GLSL support, and this change just adds a flag so that the user can turn it on unconditionally. Caveats: - This does not apply in "full rewriter" mode, which is what happens if the user doesn't use any `import`s. I could try to fix that, but it seems like in that mode people are asking to bypass as much of the compiler as possible. - When it *does* apply, it applies to user code as well as library/Slang code. So this will potentially rewrite the user's own HLSL in ways they wouldn't expect. I don't see a great way around it, though. --- slang.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'slang.h') diff --git a/slang.h b/slang.h index 2f6c112c0..3ed715f23 100644 --- a/slang.h +++ b/slang.h @@ -93,7 +93,11 @@ extern "C" typedef unsigned int SlangCompileFlags; enum { - SLANG_COMPILE_FLAG_NO_CHECKING = 1 << 0, /**< Disable semantic checking as much as possible. */ + /** Disable semantic checking as much as possible. */ + SLANG_COMPILE_FLAG_NO_CHECKING = 1 << 0, + + /* Split apart types that contain a mix of resource and non-resource data */ + SLANG_COMPILE_FLAG_SPLIT_MIXED_TYPES = 1 << 1, }; /*! -- cgit v1.2.3