summaryrefslogtreecommitdiff
path: root/tools/slang-test/slang-test-main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-03-25 11:48:10 -0400
committerGitHub <noreply@github.com>2019-03-25 11:48:10 -0400
commit2f4029a753f72833c30c4e6bad28c06b20540384 (patch)
treeca771b5e00c6126351079b2df920d014e4ed6a1e /tools/slang-test/slang-test-main.cpp
parent5bdc3ef07373be62363deb64dedd4163589430b6 (diff)
Adapter selection for Renderer (#923)
* * Make adapter used selectable on the command line * Added 'adapter' to Renderer::Desc with dx11, dx12, vk honoring it * GL will check that the renderer matches, but cannot select a specific device * Share functionality on dx adapter selection in D3DUtil Note - that on tests that use OpenGL and the adapter doesn't match it will ignore the test (and display a message that the appropriate device couldn't be started) * Small function name improvement. * Variable rename to match type. * Fix typo in Dx12 device selection. * * Add checking if an adapter is warp * Improve some comments
Diffstat (limited to 'tools/slang-test/slang-test-main.cpp')
-rw-r--r--tools/slang-test/slang-test-main.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 0b4b83198..9119c3224 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -452,6 +452,8 @@ ToolReturnCode getReturnCode(OSProcessSpawner& spawner)
ToolReturnCode spawnAndWait(TestContext* context, const String& testPath, SpawnType spawnType, OSProcessSpawner& spawner)
{
+ const auto& options = context->options;
+
OSError spawnResult = kOSError_OperationFailed;
switch (spawnType)
{
@@ -1079,6 +1081,14 @@ TestResult runGLSLComparisonTest(TestContext* context, TestInput& input)
return TestResult::Pass;
}
+static void _addRenderTestOptions(const Options& options, OSProcessSpawner& spawner)
+{
+ if (options.adapter.Length())
+ {
+ spawner.pushArgument("-adapter");
+ spawner.pushArgument(options.adapter);
+ }
+}
TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, const char *const* langOpts, size_t numLangOpts)
{
@@ -1097,6 +1107,8 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
spawner.pushExecutablePath(String(context->options.binDir) + "render-test" + osGetExecutableSuffix());
spawner.pushArgument(filePath999);
+ _addRenderTestOptions(context->options, spawner);
+
for (auto arg : input.testOptions->args)
{
spawner.pushArgument(arg);
@@ -1199,6 +1211,8 @@ TestResult doRenderComparisonTestRun(TestContext* context, TestInput& input, cha
spawner.pushExecutablePath(String(context->options.binDir) + "render-test" + osGetExecutableSuffix());
spawner.pushArgument(filePath);
+ _addRenderTestOptions(context->options, spawner);
+
for( auto arg : input.testOptions->args )
{
spawner.pushArgument(arg);
@@ -1405,7 +1419,15 @@ TestResult runHLSLRenderComparisonTestImpl(
String actualOutput;
TestResult hlslResult = doRenderComparisonTestRun(context, input, expectedArg, ".expected", &expectedOutput);
+ if (hlslResult != TestResult::Pass)
+ {
+ return hlslResult;
+ }
TestResult slangResult = doRenderComparisonTestRun(context, input, actualArg, ".actual", &actualOutput);
+ if (slangResult != TestResult::Pass)
+ {
+ return slangResult;
+ }
Slang::File::WriteAllText(outputStem + ".expected", expectedOutput);
Slang::File::WriteAllText(outputStem + ".actual", actualOutput);