summaryrefslogtreecommitdiff
path: root/tools/slang-test
diff options
context:
space:
mode:
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));