summaryrefslogtreecommitdiffstats
path: root/tools/render-test
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/render-test
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/render-test')
-rw-r--r--tools/render-test/options.cpp10
-rw-r--r--tools/render-test/options.h2
-rw-r--r--tools/render-test/render-test-main.cpp13
3 files changed, 23 insertions, 2 deletions
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index 1171a2a03..9d5ff35c8 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -151,6 +151,16 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
{
gOptions.useDXIL = true;
}
+ else if (strcmp(arg, "-adapter") == 0)
+ {
+ if (argCursor == argEnd)
+ {
+ stdError.print("expected argument for '%s' option\n", arg);
+ return SLANG_FAIL;
+ }
+
+ gOptions.adapter = *argCursor++;
+ }
else
{
// Lookup
diff --git a/tools/render-test/options.h b/tools/render-test/options.h
index 7b55b9ac0..104906f42 100644
--- a/tools/render-test/options.h
+++ b/tools/render-test/options.h
@@ -57,6 +57,8 @@ struct Options
bool useDXIL = false;
Slang::List<Slang::String> renderFeatures; /// Required render features for this test to run
+
+ Slang::String adapter; ///< The adapter to use either name or index
};
extern Options gOptions;
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index ee408f283..2bc6cd8f8 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -555,21 +555,30 @@ SLANG_TEST_TOOL_API SlangResult innerMain(Slang::StdWriters* stdWriters, SlangSe
return SLANG_FAIL;
}
+ StringBuilder rendererName;
+ rendererName << "[" << RendererUtil::toText(gOptions.rendererType) << "] ";
+ if (gOptions.adapter.Length())
+ {
+ rendererName << "'" << gOptions.adapter << "'";
+ }
+
+
if (!renderer)
{
- fprintf(stderr, "Unable to create renderer\n");
+ fprintf(stderr, "Unable to create renderer %s\n", rendererName.Buffer());
return SLANG_FAIL;
}
Renderer::Desc desc;
desc.width = gWindowWidth;
desc.height = gWindowHeight;
+ desc.adapter = gOptions.adapter;
{
SlangResult res = renderer->initialize(desc, (HWND)window->getHandle());
if (SLANG_FAILED(res))
{
- fprintf(stderr, "Unable to initialize renderer\n");
+ fprintf(stderr, "Unable to initialize renderer %s\n", rendererName.Buffer());
return res;
}
}