summaryrefslogtreecommitdiffstats
path: root/tools/render-test/options.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-19 08:47:23 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-19 09:56:42 -0700
commit634522da69b14b38c15b14d6b717b1289812e9bb (patch)
tree04f502283ed818f661e368b3d8d1ba5ce875d1d2 /tools/render-test/options.cpp
parentcafed774d99f95bce6f182599913f3417dc68a3a (diff)
Allow for automatic importing of Slang code
The basic idea of this change is that user code can just write: #include "foo.h" and then if `foo.h` gets found in a list of registered directories for "auto-import," then it actually gets interpreted as if the user had writte, more or less: __import foo; That is, the code in `foo.h` will be treated as Slang, and will be fully parsed and checked (no matter what the source language had been), and the scoping rules will be those of `__import` instead of `#include`. This is a really big hammer, and I could imagine it smashing fingers if used poorly. I'm not sure this feature will pan out, but we need to try things to know. One big piece of that that I'll likely keep in either case is an overhaul of command-line options parsing for `slangc`. In particular, this logic has been moved into the core `slang` library (so that users can just pass options in via the API), and it is all done on UTF-8 strings rather than wide strings (which was always going to be Windows-specific).
Diffstat (limited to 'tools/render-test/options.cpp')
-rw-r--r--tools/render-test/options.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index a486c8b15..53f88b7a9 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -76,6 +76,22 @@ void parseOptions(int* argc, char** argv)
{
gOptions.mode = Mode::GLSLCrossCompile;
}
+ else if( strcmp(arg, "-xslang") == 0 )
+ {
+ // This is an option that we want to pass along to Slang
+
+ if( argCursor == argEnd )
+ {
+ fprintf(stderr, "expected argument for '%s' option\n", arg);
+ exit(1);
+ }
+ if( gOptions.slangArgCount == kMaxSlangArgs )
+ {
+ fprintf(stderr, "maximum number of '%s' options exceeded (%d)\n", arg, kMaxSlangArgs);
+ exit(1);
+ }
+ gOptions.slangArgs[gOptions.slangArgCount++] = *argCursor++;
+ }
else
{
fprintf(stderr, "unknown option '%s'\n", arg);