Skip to content

Commit

Permalink
v1.117:
Browse files Browse the repository at this point in the history
- VK: added ability to skip VK ray tracing initialization during device creation to save memory
- NRI: removed experimental StreamLine integration
- D3D11: minor renaming in "DeviceCreationDesc"
- D3D12: minor code cleanup
- updated docs and CMake
  • Loading branch information
dzhdanNV committed Feb 2, 2024
1 parent 07b745d commit c9a87d2
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 346 deletions.
65 changes: 13 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@ cmake_minimum_required (VERSION 3.15)
option (NRI_STATIC_LIBRARY "Build static library" OFF)

# Options: backends
option (NRI_BACKEND_VK "Enable VULKAN backend" ON)
option (NRI_BACKEND_D3D11 "Enable D3D11 backend" ON)
option (NRI_BACKEND_D3D12 "Enable D3D12 backend" ON)
option (NRI_ENABLE_VK_SUPPORT "Enable VULKAN backend" ON)
option (NRI_ENABLE_D3D11_SUPPORT "Enable D3D11 backend" ON)
option (NRI_ENABLE_D3D12_SUPPORT "Enable D3D12 backend" ON)

# Options: VK specific
option (NRI_ENABLE_XLIB_SUPPORT "Disable 'xlib' support" ON)
option (NRI_ENABLE_WAYLAND_SUPPORT "Disable 'wayland' support" ON)
option (NRI_ENABLE_XLIB_SUPPORT "Enable 'xlib' support" ON)
option (NRI_ENABLE_WAYLAND_SUPPORT "Enable 'wayland' support" ON)

# Options: D3D12 specific
option (NRI_ENABLE_AGILITY_SDK_SUPPORT "Enable Agility SDK suupport to unlock access to recent D3D12 features" OFF)
set (NRI_AGILITY_SDK_PATH "C:/AgilitySDK" CACHE STRING "Path to a directory containing Agility SDK (contents of '.nupkg/build/native/')")
set (NRI_AGILITY_SDK_VERSION "711" CACHE STRING "Agility SDK version")
set (NRI_AGILITY_SDK_DIR "AgilitySDK" CACHE STRING "Directory where Agility SDK binaries will be copied to relative to 'CMAKE_RUNTIME_OUTPUT_DIRECTORY'")

# Options: StreamLine SDK
option (NRI_ENABLE_STREAMLINE_SUPPORT "Enable streamline wrapper for streamline integration (requires NRI_STREAMLINE_SDK_PATH to point to a valid streamline package)" OFF)
option (NRI_USE_DEVELOPMENT_STREAMLINE_LIBRARY "Make the project use development streamline libraries instead of regular ones" OFF)
set (NRI_STREAMLINE_SDK_PATH "" CACHE STRING "Path to a directory containing StreamLine SDK package (must not include the name of the library 'sl.interposer.lib', must not be empty when NRI_ENABLE_STREAMLINE_SUPPORT is on)")

# Is submodule?
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set (IS_SUBMODULE OFF)
Expand Down Expand Up @@ -124,12 +119,10 @@ endif ()
set (COMPILE_DEFINITIONS WIN32_LEAN_AND_MEAN NOMINMAX _CRT_SECURE_NO_WARNINGS)

# D3D11
if (WIN32 AND NRI_BACKEND_D3D11)
if (WIN32 AND NRI_ENABLE_D3D11_SUPPORT)
message ("NRI adding backend: D3D11")
set (COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} NRI_USE_D3D11=1)
if (NOT NRI_ENABLE_STREAMLINE_SUPPORT)
set (INPUT_LIBS_D3D11 ${INPUT_LIB_D3D11} ${INPUT_LIB_DXGI})
endif ()
set (INPUT_LIBS_D3D11 ${INPUT_LIB_D3D11} ${INPUT_LIB_DXGI})

find_library (INPUT_LIB_NVAPI NAMES nvapi64 nvapi PATHS "External/nvapi/${NVAPI_BIN_ARCHITECTURE}" REQUIRED)
find_library (INPUT_LIB_AGS NAMES amd_ags_${BIN_ARCHITECTURE} PATHS "External/amdags/ags_lib/lib" REQUIRED)
Expand All @@ -149,12 +142,10 @@ if (WIN32 AND NRI_BACKEND_D3D11)
endif ()

# D3D12
if (WIN32 AND NRI_BACKEND_D3D12)
if (WIN32 AND NRI_ENABLE_D3D12_SUPPORT)
message ("NRI adding backend: D3D12")
set (COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} NRI_USE_D3D12=1)
if (NOT NRI_ENABLE_STREAMLINE_SUPPORT)
set (INPUT_LIBS_D3D12 ${INPUT_LIB_D3D12} ${INPUT_LIB_DXGI})
endif ()
set (INPUT_LIBS_D3D12 ${INPUT_LIB_D3D12} ${INPUT_LIB_DXGI})

file (GLOB D3D12_SOURCE "Source/D3D12/*.cpp" "Source/D3D12/*.h" "Source/D3D12/*.hpp")
source_group ("" FILES ${D3D12_SOURCE})
Expand Down Expand Up @@ -189,7 +180,7 @@ if (WIN32 AND NRI_BACKEND_D3D12)
endif ()

# VK
if (NRI_BACKEND_VK)
if (NRI_ENABLE_VK_SUPPORT)
message ("NRI adding backend: VK")
set (COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} NRI_USE_VULKAN=1)

Expand Down Expand Up @@ -253,15 +244,9 @@ file (GLOB NRI_HEADERS "Include/*.h" "Include/*.hpp")
source_group ("Include" FILES ${NRI_HEADERS})

file (GLOB NRI_EXTENSIONS "Include/Extensions/*.h" "Include/Extensions/*.hpp")
if (NRI_ENABLE_STREAMLINE_SUPPORT)
file(GLOB NRI_EXTENSIONS ${NRI_EXTENSIONS} "Include/Extensions/Optional/NRIStreamlineWrapper.h" "Include/Extensions/Optional/NRIGfxApiWrapper.h")
endif()
source_group ("Include/Extensions" FILES ${NRI_EXTENSIONS})

file (GLOB NRI_SOURCE "Source/Creation/*.cpp" "Source/Creation/*.h")
if (NRI_ENABLE_STREAMLINE_SUPPORT)
file (GLOB NRI_SOURCE ${NRI_SOURCE} "Source/Streamline/*.cpp")
endif ()
source_group ("Sources" FILES ${NRI_SOURCE})

file (GLOB NRI_RESOURCES "Resources/*")
Expand All @@ -279,30 +264,6 @@ else ()
endif ()
endif ()

if (NRI_ENABLE_STREAMLINE_SUPPORT)
set (SL_INCLUDE_DIRECTORY "${NRI_STREAMLINE_SDK_PATH}/include/")
set(SL_INTERPOSER_LINK_PATH "${NRI_STREAMLINE_SDK_PATH}/lib/x64/sl.interposer.lib")
file (TO_CMAKE_PATH "${NRI_STREAMLINE_SDK_PATH}" NRI_STREAMLINE_SDK_CMAKE_PATH)
if (NRI_USE_DEVELOPMENT_STREAMLINE_LIBRARY)
set(SL_PLUGINS_DIRECTORY "${NRI_STREAMLINE_SDK_CMAKE_PATH}/bin/x64/development")
else()
set(SL_PLUGINS_DIRECTORY "${NRI_STREAMLINE_SDK_CMAKE_PATH}/bin/x64")
endif()

target_include_directories(${PROJECT_NAME} PUBLIC ${SL_INCLUDE_DIRECTORY})
target_link_libraries (${PROJECT_NAME} PRIVATE ${SL_INTERPOSER_LINK_PATH})
target_compile_definitions (${PROJECT_NAME} PRIVATE SL_PLUGINS_DIRECTORY=${SL_PLUGINS_DIRECTORY} NRI_GFX_API_WRAPPER_LIBRARY)

file (TO_NATIVE_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>" BIN_OUTPUT_PATH_NATIVE)
file (TO_NATIVE_PATH "${SL_PLUGINS_DIRECTORY}/sl.interposer.dll" SL_INTERPOSER_CMAKE_PATH)

add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${SL_INTERPOSER_CMAKE_PATH} ${BIN_OUTPUT_PATH_NATIVE}
COMMENT "Copying '${SL_INTERPOSER_CMAKE_PATH}' to '${BIN_OUTPUT_PATH_NATIVE}'"
VERBATIM
)
endif ()

target_include_directories (${PROJECT_NAME} PRIVATE "Include" "Source/Shared" "External/vulkan/include")
target_compile_definitions (${PROJECT_NAME} PRIVATE ${COMPILE_DEFINITIONS})
target_compile_options (${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
Expand All @@ -314,13 +275,13 @@ else ()
target_link_libraries (${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
endif ()

if (WIN32 AND NRI_BACKEND_D3D11)
if (WIN32 AND NRI_ENABLE_D3D11_SUPPORT)
target_link_libraries (${PROJECT_NAME} PRIVATE NRI_D3D11)
endif ()
if (WIN32 AND NRI_BACKEND_D3D12)
if (WIN32 AND NRI_ENABLE_D3D12_SUPPORT)
target_link_libraries (${PROJECT_NAME} PRIVATE NRI_D3D12)
endif ()
if (NRI_BACKEND_VK)
if (NRI_ENABLE_VK_SUPPORT)
target_link_libraries (${PROJECT_NAME} PRIVATE NRI_VK)
endif ()

Expand Down
3 changes: 2 additions & 1 deletion Include/Extensions/NRIDeviceCreation.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ NRI_STRUCT(DeviceCreationDesc)
bool enableNRIValidation;
bool enableAPIValidation;
bool enableMGPU;
bool D3D11CommandBufferEmulation;
bool enableD3D11CommandBufferEmulation; // force enable, but why?
bool disableVulkanRayTracing; // to save some CPU memory
};

NRI_API NRI_NAME(Result) NRI_CALL nriEnumerateAdapters(NRI_NAME(AdapterDesc)* adapterDescs, uint32_t NRI_REF adapterDescNum);
Expand Down
32 changes: 0 additions & 32 deletions Include/Extensions/Optional/NRIGfxApiWrapper.h

This file was deleted.

31 changes: 0 additions & 31 deletions Include/Extensions/Optional/NRIStreamlineWrapper.h

This file was deleted.

4 changes: 2 additions & 2 deletions Include/NRI.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <stddef.h>

#define NRI_VERSION_MAJOR 1
#define NRI_VERSION_MINOR 116
#define NRI_VERSION_DATE "29 January 2024"
#define NRI_VERSION_MINOR 117
#define NRI_VERSION_DATE "2 February 2024"

#ifdef _WIN32
#define NRI_CALL __fastcall
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- common denominator for D3D11, D3D12 and Vulkan APIs
- low overhead
- ray tracing support
- API-provided and/or integrated validation layer
- validation layers (GAPI and NRI itself)
- default D3D11 behavior is changed to match D3D12/VK where applicable using *NVAPI* or *AMD AGS* libraries

*NRI* is used in:
Expand Down Expand Up @@ -37,18 +37,18 @@ Notes:
## CMAKE OPTIONS

- `NRI_STATIC_LIBRARY` - build NRI as a static library (`off` by default)
- `NRI_BACKEND_VK` - enable VULKAN backend (`on` by default)
- `NRI_BACKEND_D3D11` - enable D3D11 backend (`on` by default on Windows)
- `NRI_BACKEND_D3D12` - enable D3D12 backend (`on` by default on Windows)
- `NRI_ENABLE_VK_SUPPORT` - enable VULKAN backend (`on` by default)
- `NRI_ENABLE_D3D11_SUPPORT` - enable D3D11 backend (`on` by default on Windows)
- `NRI_ENABLE_D3D12_SUPPORT` - enable D3D12 backend (`on` by default on Windows)

Vulkan only:
- `NRI_ENABLE_XLIB_SUPPORT` - disable *Xlib* support (`on` by default)
- `NRI_ENABLE_WAYLAND_SUPPORT` - disable *Wayland* support (`on` by default)
- `NRI_ENABLE_XLIB_SUPPORT` - enable *Xlib* support (`on` by default)
- `NRI_ENABLE_WAYLAND_SUPPORT` - enable *Wayland* support (`on` by default)

D3D12 only:
- `NRI_ENABLE_AGILITY_SDK_SUPPORT` - enable Agility SDK (`off` by default)
- `NRI_AGILITY_SDK_PATH` - path to a directory containing Agility SDK: contents of `.nupkg/build/native/` (`C:/AgilitySDK` by default)
- `NRI_AGILITY_SDK_VERSION` - Agility SDK version (`711` by default, can be newer)
- `NRI_AGILITY_SDK_VERSION` - Agility SDK version (`711` or newer)
- `NRI_AGILITY_SDK_DIR` - directory where Agility SDK binaries will be copied to relative to `CMAKE_RUNTIME_OUTPUT_DIRECTORY` (`AgilitySDK` by default)

## AGILITY SDK
Expand Down
2 changes: 1 addition & 1 deletion Resources/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Versioning rules:
*/

#define VERSION_MAJOR 1
#define VERSION_MINOR 116
#define VERSION_MINOR 117
#define VERSION_BUILD 0
#define VERSION_REVISION 0

Expand Down
2 changes: 1 addition & 1 deletion Source/D3D11/DeviceD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Result DeviceD3D11::Create(const DeviceCreationDesc& deviceCreationDesc, ID3D11D
else
device->AddRef();

InitVersionedDevice(deviceCreationDesc.D3D11CommandBufferEmulation);
InitVersionedDevice(deviceCreationDesc.enableD3D11CommandBufferEmulation);
InitVersionedContext();
FillDesc(deviceCreationDesc.enableAPIValidation);

Expand Down
1 change: 0 additions & 1 deletion Source/D3D12/DeviceD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Result DeviceD3D12::CreateImplementation(Interface*& entity, const Args&... args

Result DeviceD3D12::Create(const DeviceCreationD3D12Desc& deviceCreationDesc)
{
m_SkipLiveObjectsReporting = true;
m_Device = deviceCreationDesc.d3d12Device;

// Get adapter
Expand Down
1 change: 0 additions & 1 deletion Source/D3D12/DeviceD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ struct DeviceD3D12 final : public DeviceBase
std::array<Lock, DESCRIPTOR_HEAP_TYPE_NUM> m_FreeDescriptorLocks;
bool m_IsRaytracingSupported = false;
bool m_IsMeshShaderSupported = false;
bool m_SkipLiveObjectsReporting = false;
Lock m_DescriptorHeapLock;
Lock m_QueueLock;
};
Expand Down
87 changes: 0 additions & 87 deletions Source/Streamline/GfxApiWrapper.cpp

This file was deleted.

Loading

0 comments on commit c9a87d2

Please sign in to comment.