summaryrefslogtreecommitdiffstats
path: root/tools/slang-test
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-09 13:54:31 -0400
committerGitHub <noreply@github.com>2019-09-09 13:54:31 -0400
commit047daae9300c8a94d28383cf992ce00e3ad2da1e (patch)
tree520025463f6493b31d859a812af8a1384a23f715 /tools/slang-test
parent4fc07614d6407e49a0c34e7483d410153c0b269a (diff)
CPU compute testing on non windows targets (#1045)
* WIP: Refactor of CPUCompute and stand alone cpu-render-test * Fix compilation on CygWin. * Make CPU compute tests run on non windows targets. * Check that C/C++ compiler is available for CPU compute. * Fix some tabbing issues. * Add -fPIC on gfx * Use dxcompiler_47.dll from slang-binaries on windows. * make https for git module slang-binaries * Fix comment in premake5.lua around d3dcompiler_47.dll * Add resources to the CPUComputeUtil::Context to keep in scope. * Fixes problem compiling on cygwin where dx12 is included in build of gfx lib.
Diffstat (limited to 'tools/slang-test')
-rw-r--r--tools/slang-test/slang-test-main.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index af78dbb14..3b14b353b 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -607,7 +607,7 @@ static SlangResult _extractRenderTestRequirements(const CommandLine& cmdLine, Te
// to render-test what renderer will be used.
// That a similar logic has to be kept inside the implementation of render-test and both this
// and render-test will have to be kept in sync.
-
+
bool useDxil = cmdLine.findArgIndex(UnownedStringSlice::fromLiteral("-use-dxil")) >= 0;
bool usePassthru = false;
@@ -751,11 +751,26 @@ static SlangResult _extractReflectionTestRequirements(const CommandLine& cmdLine
return SLANG_OK;
}
+static SlangResult _tryUseCPURenderTest(TestContext* context, CommandLine& ioCmdLine)
+{
+ String exeName = Path::getFileNameWithoutExt(ioCmdLine.m_executable);
+
+ if (exeName == "render-test")
+ {
+ bool useCPU = ioCmdLine.findArgIndex(UnownedStringSlice::fromLiteral("-cpu")) >= 0;
+ if (useCPU)
+ {
+ ioCmdLine.setExecutablePath(Path::combine(context->options.binDir, String("cpu-render-test") + ProcessUtil::getExecutableSuffix()));
+ }
+ }
+ return SLANG_OK;
+}
+
static SlangResult _extractTestRequirements(const CommandLine& cmdLine, TestRequirements* ioInfo)
{
String exeName = Path::getFileNameWithoutExt(cmdLine.m_executable);
- if (exeName == "render-test")
+ if (exeName == "render-test" || exeName == "cpu-render-test")
{
return _extractRenderTestRequirements(cmdLine, ioInfo);
}
@@ -787,10 +802,11 @@ static RenderApiFlags _getAvailableRenderApiFlags(TestContext* context)
if (apiType == RenderApiType::CPU)
{
- // TODO(JS): Only enable CPU on Windows for now
-#if SLANG_WINDOWS_FAMILY
- availableRenderApiFlags |= RenderApiFlags(1) << int(apiType);
-#endif
+ // Check that the session has the generic C/CPP compiler availability - which is all we should need for CPU target
+ if (SLANG_SUCCEEDED(spSessionCheckPassThroughSupport(context->getSession(), SLANG_PASS_THROUGH_GENERIC_C_CPP)))
+ {
+ availableRenderApiFlags |= RenderApiFlags(1) << int(apiType);
+ }
continue;
}
@@ -809,6 +825,8 @@ static RenderApiFlags _getAvailableRenderApiFlags(TestContext* context)
builder << "-" << RenderApiUtil::getApiName(apiType);
cmdLine.addArg(builder);
+ _tryUseCPURenderTest(context, cmdLine);
+
// Run the render-test tool and see if the device could startup
ExecuteResult exeRes;
if (SLANG_SUCCEEDED(spawnAndWaitSharedLibrary(context, "device-startup", cmdLine, exeRes))
@@ -2046,6 +2064,8 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
auto actualOutputFile = outputStem + ".actual.txt";
cmdLine.addArg(actualOutputFile);
+ _tryUseCPURenderTest(context, cmdLine);
+
if (context->isExecuting())
{
// clear the stale actual output file first. This will allow us to detect error if render-test fails and outputs nothing.
@@ -2161,6 +2181,8 @@ TestResult doRenderComparisonTestRun(TestContext* context, TestInput& input, cha
cmdLine.addArg("-o");
cmdLine.addArg(outputStem + outputKind + ".png");
+ _tryUseCPURenderTest(context, cmdLine);
+
ExecuteResult exeRes;
TEST_RETURN_ON_DONE(spawnAndWait(context, outputStem, input.spawnType, cmdLine, exeRes));