summaryrefslogtreecommitdiffstats
path: root/source/slang/options.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-08-17 08:59:30 -0700
committerTim Foley <tfoley@nvidia.com>2017-08-17 08:59:30 -0700
commitd13bd05164c6a3d0b7ba95bb415f6bfac4cfcb70 (patch)
treed1b85e1553b0a81d2322f043d3e4022bd9d780c1 /source/slang/options.cpp
parent3dd88c2eb5cd2e405cd5aa184a2cd45db6fb027a (diff)
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.
Diffstat (limited to 'source/slang/options.cpp')
-rw-r--r--source/slang/options.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/slang/options.cpp b/source/slang/options.cpp
index a360695f2..0e329ccd2 100644
--- a/source/slang/options.cpp
+++ b/source/slang/options.cpp
@@ -254,6 +254,10 @@ struct OptionsParser
//else
if (argStr == "-no-checking")
flags |= SLANG_COMPILE_FLAG_NO_CHECKING;
+ else if(argStr == "-split-mixed-types" )
+ {
+ flags |= SLANG_COMPILE_FLAG_SPLIT_MIXED_TYPES;
+ }
else if (argStr == "-backend" || argStr == "-target")
{
String name = tryReadCommandLineArgument(arg, &argCursor, argEnd);