Skip to content

Commit

Permalink
Merge branch 'blackwell'
Browse files Browse the repository at this point in the history
  • Loading branch information
apanteleev committed Feb 4, 2025
2 parents 656bb06 + 5ce965c commit e1ece83
Show file tree
Hide file tree
Showing 24 changed files with 1,420 additions and 132 deletions.
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,12 @@ if (NVRHI_WITH_NVAPI AND NOT TARGET nvapi)
endif()

if (NVRHI_WITH_AFTERMATH AND NOT TARGET aftermath)
find_package(Aftermath REQUIRED)

if (AFTERMATH_FOUND)
add_library(aftermath SHARED IMPORTED GLOBAL)
target_include_directories(aftermath INTERFACE "${AFTERMATH_INCLUDE_DIR}")
if (WIN32)
set_property(TARGET aftermath PROPERTY IMPORTED_IMPLIB "${AFTERMATH_LIBRARY}")
endif()
set_property(TARGET aftermath PROPERTY IMPORTED_LOCATION "${AFTERMATH_RUNTIME_LIBRARY}")
file(COPY ${AFTERMATH_RUNTIME_LIBRARY} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else()
message(FATAL_ERROR "NVRHI_WITH_AFTERMATH is enabled but cmake cannot find the Aftermath SDK in AFTERMATH_SEARCH_PATHS")
endif()
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FetchAftermath.cmake")
endif()

set(include_common
include/nvrhi/nvrhi.h
include/nvrhi/nvrhiHLSL.h
include/nvrhi/utils.h
include/nvrhi/common/containers.h
include/nvrhi/common/misc.h
Expand Down
65 changes: 65 additions & 0 deletions cmake/FetchAftermath.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

if( TARGET aftermath )
return()
endif()

if (NOT AFTERMATH_SEARCH_PATHS)
include(FetchContent)
if(WIN32)
set(AFTERMATH_SDK_URL https://developer.nvidia.com/downloads/assets/tools/secure/nsight-aftermath-sdk/2024_3_0/windows/NVIDIA_Nsight_Aftermath_SDK_2024.3.0.24312.zip)
set(AFTERMATH_SDK_MD5 232145E8A749F873B8EE32B9DA6F09D6)
else()
set(AFTERMATH_SDK_URL https://developer.nvidia.com/downloads/assets/tools/secure/nsight-aftermath-sdk/2024_3_0/linux/NVIDIA_Nsight_Aftermath_SDK_2024.3.0.24312.tgz)
set(AFTERMATH_SDK_MD5 C118C60F7A8D8302AF53513EA4FF1ABD)
endif()

FetchContent_Declare(
aftermath_sdk
URL ${AFTERMATH_SDK_URL}
URL_HASH MD5=${AFTERMATH_SDK_MD5}
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
set(AFTERMATH_SEARCH_PATHS "${CMAKE_BINARY_DIR}/_deps/aftermath_sdk-src/")
FetchContent_MakeAvailable(aftermath_sdk)
endif()

find_path(AFTERMATH_INCLUDE_DIR GFSDK_Aftermath.h
PATHS ${AFTERMATH_SEARCH_PATHS}
PATH_SUFFIXES "include")

find_library(AFTERMATH_LIBRARY GFSDK_Aftermath_Lib.x64
PATHS ${AFTERMATH_SEARCH_PATHS}
REQUIRED
PATH_SUFFIXES "lib/x64")

add_library(aftermath SHARED IMPORTED)
target_include_directories(aftermath INTERFACE ${AFTERMATH_INCLUDE_DIR})

if(WIN32)
find_file(AFTERMATH_RUNTIME_LIBRARY GFSDK_Aftermath_Lib.x64.dll
PATHS ${AFTERMATH_SEARCH_PATHS}
PATH_SUFFIXES "lib/x64")
set_property(TARGET aftermath PROPERTY IMPORTED_LOCATION ${AFTERMATH_RUNTIME_LIBRARY})
set_property(TARGET aftermath PROPERTY IMPORTED_IMPLIB ${AFTERMATH_LIBRARY})
else()
set_property(TARGET aftermath PROPERTY IMPORTED_LOCATION ${AFTERMATH_LIBRARY})
endif()
80 changes: 0 additions & 80 deletions cmake/FindAftermath.cmake

This file was deleted.

1 change: 1 addition & 0 deletions include/nvrhi/common/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ namespace nvrhi
constexpr ObjectType VK_PipelineLayout = 0x00030012;
constexpr ObjectType VK_Pipeline = 0x00030013;
constexpr ObjectType VK_Micromap = 0x00030014;
constexpr ObjectType VK_ImageCreateInfo = 0x00030015;
};

struct Object
Expand Down
10 changes: 10 additions & 0 deletions include/nvrhi/d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,17 @@ namespace nvrhi::d3d12
uint32_t shaderResourceViewHeapSize = 16384;
uint32_t samplerHeapSize = 1024;
uint32_t maxTimerQueries = 256;

// If enabled and the device has the capability,
// create RootSignatures with D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED
// and D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED
bool enableHeapDirectlyIndexed = false;

bool aftermathEnabled = false;

// Enable logging the buffer lifetime to IMessageCallback
// Useful for debugging resource lifetimes
bool logBufferLifetime = false;
};

NVRHI_API DeviceHandle createDevice(const DeviceDesc& desc);
Expand Down
Loading

0 comments on commit e1ece83

Please sign in to comment.