diff options
| author | Yong He <yonghe@outlook.com> | 2021-05-25 10:24:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-25 10:24:38 -0700 |
| commit | ba24264275c640e0ac3732f0f5720e1f5816cded (patch) | |
| tree | 9413b919498c700afe89d498ff3434eea9cf3c89 /tools/render-test/render-test-main.cpp | |
| parent | fbf00dd54d787c6e22b0f1785a64dfb2fb1e300a (diff) | |
Allow overriding specialization args via `IShaderObject`. (#1854)
* Allow overriding specialization args via `IShaderObject`.
* Fixes.
Co-authored-by: T. Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tools/render-test/render-test-main.cpp')
| -rw-r--r-- | tools/render-test/render-test-main.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp index c04d6db00..5c8011889 100644 --- a/tools/render-test/render-test-main.cpp +++ b/tools/render-test/render-test-main.cpp @@ -341,6 +341,26 @@ struct AssignValsFromLayoutContext SLANG_RETURN_ON_FAIL(assign(ShaderCursor(shaderObject), srcVal->contentVal)); + if (srcVal->specializationArgs.getCount()) + { + List<slang::SpecializationArg> args; + for (auto srcArg : srcVal->specializationArgs) + { + auto argType = slangReflection->findTypeByName(srcArg.getBuffer()); + if (argType) + { + slang::SpecializationArg arg = slang::SpecializationArg::fromType(argType); + args.add(arg); + } + else + { + StdWriters::getError().print( + "error: could not find shader type '%s'\n", srcArg.getBuffer()); + return SLANG_E_INVALID_ARG; + } + } + shaderObject->setSpecializationArgs(args.getBuffer(), args.getCount()); + } dstCursor.setObject(shaderObject); return SLANG_OK; } |
