diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-08-24 14:26:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-24 11:26:27 -0700 |
| commit | 67ca54997d445e15891965b8d77561b9d10bb18c (patch) | |
| tree | 8719fb2ff6a42f24daef5ca77d046a55b56d5b98 /tools/render-test/render-test-main.cpp | |
| parent | fcac02e405661de311b5ceebbd6d3e2c78bf8aea (diff) | |
NVAPI improvements (#1512)
* First pass at incorporating nvapi into test harness.
* D3d12 Atomic Float Add via NVAPI working
* Dx12 atomic float appears to work.
* Atomic float add on Dx12.
* Added atomic64 feature addition to vk.
Fix correct output for atomic-float-byte-address.slang
* Disable atomic float failing tests.
* Upgraded VK headers.
* Detect atomic float availability on VK.
* Try to get test working for in64 atomic.
* Made HLSL prelude controlled via the render-test requirements.
* Added -enable-nvapi to premake.
* Fix D3D12Renderer when NVAPI is not available.
* Small improvements to VKRenderer.
* Improve atomic documentation in target-compatibility.md.
* Fixed NVAPI working on D3D12.
* Test for specific NVAPI features.
* Remove requiredFeatures from Renderer::Desc as was ignored. Tried to document more around nvapiExtnSlot.
* Readded requiredFeatures to Renderer::Desc
* Improve comments in the tests.
Diffstat (limited to 'tools/render-test/render-test-main.cpp')
| -rw-r--r-- | tools/render-test/render-test-main.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp index e7356901d..25486c722 100644 --- a/tools/render-test/render-test-main.cpp +++ b/tools/render-test/render-test-main.cpp @@ -12,6 +12,7 @@ #include "shader-renderer-util.h" #include "../source/core/slang-io.h" +#include "../source/core/slang-string-util.h" #include "core/slang-token-reader.h" @@ -406,7 +407,7 @@ Result RenderTestApp::update(Window* window) static SlangResult _setSessionPrelude(const Options& options, const char* exePath, SlangSession* session) { // Let's see if we need to set up special prelude for HLSL - if (options.nvapiRegister.getLength()) + if (options.nvapiExtnSlot.getLength()) { String rootPath; SLANG_RETURN_ON_FAIL(TestToolUtil::getRootPath(exePath, rootPath)); @@ -416,7 +417,7 @@ static SlangResult _setSessionPrelude(const Options& options, const char* exePat StringBuilder buf; // We have to choose a slot that NVAPI will use. - buf << "#define NV_SHADER_EXTN_SLOT " << options.nvapiRegister << "\n"; + buf << "#define NV_SHADER_EXTN_SLOT " << options.nvapiExtnSlot << "\n"; // Include the NVAPI header buf << "#include \"" << includePath << "\"\n\n"; @@ -589,13 +590,18 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi } } + Index nvapiExtnSlot = -1; + // Let's see if we need to set up special prelude for HLSL - if (options.nvapiRegister.getLength()) + if (options.nvapiExtnSlot.getLength() && options.nvapiExtnSlot[0] == 'u') { - // We require nvapi to be available on the device - if (options.renderFeatures.indexOf("nvapi") < 0) + // + Slang::Int value; + UnownedStringSlice slice = options.nvapiExtnSlot.getUnownedSlice(); + UnownedStringSlice indexText(slice.begin() + 1 , slice.end()); + if (SLANG_SUCCEEDED(StringUtil::parseInt(indexText, value))) { - options.renderFeatures.add("nvapi"); + nvapiExtnSlot = Index(value); } } @@ -716,16 +722,6 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi #endif } - if (options.nvapiRegister.getLength()) - { - // We require nvapi to be available on the device - if (options.renderFeatures.indexOf("nvapi") < 0) - { - options.renderFeatures.add("nvapi"); - } - } - - Slang::RefPtr<Renderer> renderer; { RendererUtil::CreateFunc createFunc = RendererUtil::getCreateFunc(options.rendererType); @@ -748,6 +744,7 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi desc.height = gWindowHeight; desc.adapter = options.adapter; desc.requiredFeatures = options.renderFeatures; + desc.nvapiExtnSlot = int(nvapiExtnSlot); window = renderer_test::Window::create(); SLANG_RETURN_ON_FAIL(window->initialize(gWindowWidth, gWindowHeight)); @@ -755,7 +752,9 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi SlangResult res = renderer->initialize(desc, window->getHandle()); if (SLANG_FAILED(res)) { - if (!options.onlyStartup) + // Returns E_NOT_AVAILABLE only when specified features are not available. + // Will cause to be ignored. + if (!options.onlyStartup && res != SLANG_E_NOT_AVAILABLE) { fprintf(stderr, "Unable to initialize renderer %s\n", rendererName.getBuffer()); } |
