From fcac02e405661de311b5ceebbd6d3e2c78bf8aea Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 21 Aug 2020 16:04:42 -0400 Subject: Vulkan update/NVAPI support (#1511) * 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. --- tools/gfx/nvapi/nvapi-util.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tools/gfx/nvapi/nvapi-util.cpp (limited to 'tools/gfx/nvapi/nvapi-util.cpp') diff --git a/tools/gfx/nvapi/nvapi-util.cpp b/tools/gfx/nvapi/nvapi-util.cpp new file mode 100644 index 000000000..63bcc65fc --- /dev/null +++ b/tools/gfx/nvapi/nvapi-util.cpp @@ -0,0 +1,30 @@ +#include "nvapi-util.h" + +#include "nvapi-include.h" + +namespace gfx { + +static SlangResult g_initStatus = SLANG_E_UNINITIALIZED; + +/* static */SlangResult NVAPIUtil::initialize() +{ +#ifdef GFX_NVAPI + if (g_initStatus == SLANG_E_UNINITIALIZED) + { + NvAPI_Status ret = NVAPI_OK; + ret = NvAPI_Initialize(); + g_initStatus = (ret == NVAPI_OK) ? SLANG_OK : SLANG_E_NOT_AVAILABLE; + } +#else + g_initStatus = SLANG_E_NOT_AVAILABLE; +#endif + + return g_initStatus; +} + +/* static */bool NVAPIUtil::isAvailable() +{ + return SLANG_SUCCEEDED(g_initStatus); +} + +} // gfx -- cgit v1.2.3