diff options
| -rw-r--r-- | source/slang/slang-options.cpp | 29 | ||||
| -rw-r--r-- | tests/vkray/callable-caller.slang | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index c3db39773..a89818c4f 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -717,6 +717,35 @@ struct OptionsParser addCapabilityAtom(getCurrentTarget(), atom); } } + else if( argStr == "-capability" ) + { + // The `-capability` option is similar to `-profile` but does not set the actual profile + // for a target (it just adds capabilities). + // + // TODO: Once profiles are treated as capabilities themselves, it might be possible + // to treat `-profile` and `-capability` as aliases, although there might still be + // value in only allowing a single `-profile` option per target while still allowing + // zero or more `-capability` options. + + String operand; + SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, operand)); + + List<UnownedStringSlice> slices; + StringUtil::split(operand.getUnownedSlice(), '+', slices); + Index sliceCount = slices.getCount(); + for(Index i = 0; i < sliceCount; ++i) + { + UnownedStringSlice atomName = slices[i]; + CapabilityAtom atom = findCapabilityAtom(atomName); + if( atom == CapabilityAtom::Invalid ) + { + sink->diagnose(SourceLoc(), Diagnostics::unknownProfile, atomName); + return SLANG_FAIL; + } + + addCapabilityAtom(getCurrentTarget(), atom); + } + } else if (argStr == "-stage") { String name; diff --git a/tests/vkray/callable-caller.slang b/tests/vkray/callable-caller.slang index 93d9dd3cb..64311988a 100644 --- a/tests/vkray/callable-caller.slang +++ b/tests/vkray/callable-caller.slang @@ -1,6 +1,6 @@ // callable-caller.slang -//TEST:CROSS_COMPILE: -profile glsl_460+GL_NV_ray_tracing -stage raygeneration -entry main -target spirv-assembly +//TEST:CROSS_COMPILE: -profile glsl_460 -capability GL_NV_ray_tracing -stage raygeneration -entry main -target spirv-assembly import callable_shared; |
