summaryrefslogtreecommitdiffstats
path: root/tools/render-test/slang-support.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-16 09:38:21 -0400
committerGitHub <noreply@github.com>2019-09-16 09:38:21 -0400
commit40d8f3aeedf018c7c6766e98ec64733abd90671e (patch)
tree0c9cae7bc88d4344dd53596a88c3ce9918f2df13 /tools/render-test/slang-support.cpp
parentc2e5d2468ad6a38cdb8a067da0678302f6cc6066 (diff)
CPU Performance/Testing improvements (#1055)
* First pass of render-test refactor. * Make window construction a function that can choose an implementation. * Remove OpenGL as currently has windows dependency. * Disable Vulkan as Renderer impl has dependency on windows. * Pass Window in as parameter of 'update'. * Add win-window.cpp as was missing. * Fix warning on windows about signs during comparison. * * Added mechanism to add random arrays as buffer inputs and select type * Improved RenderGenerator to generate more types, and to be more careful around int32 ranges. * Added support for security checks (for Visual Studio C++) * Disable Execption handling being on by default when compiling kernels * Added a 'Group' version of the entry point that will evaluate all threads in a group in a single call. In test code use this method if available. * Added -compile-arg to be able to pass arguments to the compile within render-test * Add documention for the _Group execution feature. * Fix some typos in cpu-target.md
Diffstat (limited to 'tools/render-test/slang-support.cpp')
-rw-r--r--tools/render-test/slang-support.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp
index df7e91df8..515481d4f 100644
--- a/tools/render-test/slang-support.cpp
+++ b/tools/render-test/slang-support.cpp
@@ -25,6 +25,17 @@ static const char computeEntryPointName[] = "computeMain";
out.request = slangRequest;
out.session = session;
+ // Parse all the extra args
+ if (request.compileArgs.getCount() > 0)
+ {
+ List<const char*> args;
+ for (const auto& arg : request.compileArgs)
+ {
+ args.add(arg.value.getBuffer());
+ }
+ SLANG_RETURN_ON_FAIL(spProcessCommandLineArguments(slangRequest, args.getBuffer(), int(args.getCount())));
+ }
+
spSetCodeGenTarget(slangRequest, input.target);
spSetTargetProfile(slangRequest, 0, spFindProfile(session, input.profile));
@@ -224,7 +235,7 @@ static const char computeEntryPointName[] = "computeMain";
return SLANG_OK;
}
-/* static */SlangResult ShaderCompilerUtil::compileWithLayout(SlangSession* session, const String& sourcePath, Options::ShaderProgramType shaderType, const ShaderCompilerUtil::Input& input, OutputAndLayout& output)
+/* static */SlangResult ShaderCompilerUtil::compileWithLayout(SlangSession* session, const String& sourcePath, const Slang::List<Slang::CommandLine::Arg>& compileArgs, Options::ShaderProgramType shaderType, const ShaderCompilerUtil::Input& input, OutputAndLayout& output)
{
List<char> sourceText;
SLANG_RETURN_ON_FAIL(readSource(sourcePath, sourceText));
@@ -245,8 +256,11 @@ static const char computeEntryPointName[] = "computeMain";
break;
}
+ // Deterministic random generator
+ RefPtr<RandomGenerator> rand = RandomGenerator::create(0x34234);
+
// Parse the layout
- layout.parse(sourceText.getBuffer());
+ layout.parse(rand, sourceText.getBuffer());
layout.updateForTarget(input.target);
// Setup SourceInfo
@@ -257,6 +271,9 @@ static const char computeEntryPointName[] = "computeMain";
sourceInfo.dataEnd = sourceText.getBuffer() + sourceText.getCount() - 1;
ShaderCompileRequest compileRequest;
+
+ compileRequest.compileArgs = compileArgs;
+
compileRequest.source = sourceInfo;
if (shaderType == Options::ShaderProgramType::Graphics || shaderType == Options::ShaderProgramType::GraphicsCompute)
{