summaryrefslogtreecommitdiffstats
path: root/premake5.lua
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-08-21 16:04:42 -0400
committerGitHub <noreply@github.com>2020-08-21 13:04:42 -0700
commitfcac02e405661de311b5ceebbd6d3e2c78bf8aea (patch)
tree6e79865b39f0739d2ac9c3f91cc4129c244b6977 /premake5.lua
parent49067fd2e97b40649df3fa2ce096f78c2e45da5a (diff)
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.
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua47
1 files changed, 45 insertions, 2 deletions
diff --git a/premake5.lua b/premake5.lua
index 49aa47a35..e78afa354 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -92,6 +92,14 @@ newoption {
}
newoption {
+ trigger = "enable-nvapi",
+ description = "(Optional) If true will enable NVAPI, if NVAPI is found via CUDA_PATH",
+ value = "bool",
+ default = "false",
+ allowed = { { "true", "True"}, { "false", "False" } }
+}
+
+newoption {
trigger = "cuda-sdk-path",
description = "(Optional) Path to the root of CUDA SDK. If set will enable CUDA in build (ie in effect sets enable-cuda=true too)",
value = "path"
@@ -111,7 +119,6 @@ newoption {
value = "path"
}
-
newoption {
trigger = "enable-profile",
description = "(Optional) If true will enable slang-profile tool - suitable for gprof usage on linux",
@@ -130,6 +137,10 @@ optixPath = _OPTIONS["optix-sdk-path"]
enableOptix = not not (_OPTIONS["enable-optix"] == "true" or optixPath)
enableProfile = (_OPTIONS["enable-profile"] == "true")
+-- This is the path where nvapi is expected to be found
+
+nvapiPath = "external/nvapi"
+
if enableOptix then
optixPath = optixPath or "C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.0.0/"
enableCuda = true;
@@ -145,6 +156,14 @@ end
-- Is true when the target is really windows (ie not something on top of windows like cygwin)
local isTargetWindows = (os.target() == "windows") and not (targetDetail == "mingw" or targetDetail == "cygwin")
+-- Even if we have the nvapi path, we only want to currently enable on windows targets
+
+enableNvapi = not not (os.isdir(nvapiPath) and isTargetWindows and _OPTIONS["enable-nvapi"] == "true")
+
+if enableNvapi then
+ printf("Enabled NVAPI")
+end
+
overrideModule = {}
local overrideModulePath = _OPTIONS["override-module"]
if overrideModulePath then
@@ -660,7 +679,7 @@ toolSharedLibrary "render-test"
defines { "RENDER_TEST_CUDA" }
includedirs { cudaPath .. "/include" }
includedirs { cudaPath .. "/include", cudaPath .. "/common/inc" }
-
+
if optixPath then
defines { "RENDER_TEST_OPTIX" }
includedirs { optixPath .. "include/" }
@@ -673,6 +692,7 @@ toolSharedLibrary "render-test"
filter { "platforms:x64" }
libdirs { cudaPath .. "/lib/x64/" }
+
end
--
@@ -689,6 +709,9 @@ tool "gfx"
includedirs { ".", "external", "source", "external/imgui" }
+ -- Will compile across targets
+ addSourceDir "tools/gfx/nvapi"
+
-- To special case that we may be building using cygwin on windows. If 'true windows' we build for dx12/vk and run the script
-- If not we assume it's a cygwin/mingw type situation and remove files that aren't appropriate
if isTargetWindows then
@@ -718,6 +741,26 @@ tool "gfx"
--addSourceDir "tools/gfx/open-gl"
end
+
+ -- If NVAPI is enabled
+ if enableNvapi then
+ -- Add the include path
+ includedirs { nvapiPath }
+
+ -- Add a define so that render-test code can check if nvapi is available
+ defines { "GFX_NVAPI" }
+
+ -- Set the nvapi libs directory
+ filter { "platforms:x86" }
+ libdirs { nvapiPath .. "/x86" }
+ links { "nvapi" }
+
+ filter { "platforms:x64" }
+ libdirs { nvapiPath .. "/amd64" }
+ links { "nvapi64" }
+
+ end
+
filter { "system:linux" }
-- might be able to do pic(true)
buildoptions{"-fPIC"}