From ebf92abd17ec423ca5ef4d7387025c31a9b1b5eb Mon Sep 17 00:00:00 2001 From: dzhdan Date: Fri, 20 Sep 2024 16:42:03 +0800 Subject: [PATCH] v4.9.4: HIGHLIGHTS: - Cmake: minor improvements - updated deps --- CMakeLists.txt | 12 ++++++++++-- External/MathLib | 2 +- External/ShaderMake | 2 +- Include/NRD.h | 4 ++-- Integration/NRDIntegration.hpp | 17 +++++++++++++---- README.md | 2 +- Resources/Version.h | 2 +- 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a408980..3a4f4f9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,12 @@ message ("NRD v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}") project (NRD LANGUAGES C CXX) message ("NRD encoding: NRD_NORMAL_ENCODING = ${NRD_NORMAL_ENCODING}; NRD_ROUGHNESS_ENCODING = ${NRD_ROUGHNESS_ENCODING}") +if (IS_SUBMODULE) + file (RELATIVE_PATH PROJECT_FOLDER ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +else () + set (PROJECT_FOLDER ${PROJECT_NAME}) +endif () + # Generate "NRDEncoding.hlsli" file (WRITE Shaders/Include/NRDEncoding.hlsli "// This file is auto-generated during project deployment. Do not modify!\n" @@ -150,7 +156,7 @@ target_include_directories (${PROJECT_NAME} PRIVATE "External") target_compile_definitions (${PROJECT_NAME} PRIVATE ${COMPILE_DEFINITIONS}) target_compile_options (${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS}) -set_property (TARGET ${PROJECT_NAME} PROPERTY FOLDER "${PROJECT_NAME}") +set_property (TARGET ${PROJECT_NAME} PROPERTY FOLDER ${PROJECT_FOLDER}) set_target_properties (${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") message ("NRD output path: '${CMAKE_RUNTIME_OUTPUT_DIRECTORY}'") @@ -166,6 +172,8 @@ if (NOT NRD_DISABLE_SHADER_COMPILATION) if (NOT TARGET ShaderMake) set (SHADERMAKE_BIN_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} CACHE STRING "") add_subdirectory (External/ShaderMake) + set_property (TARGET ShaderMake PROPERTY FOLDER "${PROJECT_FOLDER}/External") + set_property (TARGET ShaderMakeBlob PROPERTY FOLDER "${PROJECT_FOLDER}/External") endif () # ShaderMake general arguments @@ -212,6 +220,6 @@ if (NOT NRD_DISABLE_SHADER_COMPILATION) SOURCES ${SHADERS} ) - set_property (TARGET ${PROJECT_NAME}_Shaders PROPERTY FOLDER ${PROJECT_NAME}) + set_property (TARGET ${PROJECT_NAME}_Shaders PROPERTY FOLDER ${PROJECT_FOLDER}) add_dependencies (${PROJECT_NAME} ${PROJECT_NAME}_Shaders) endif () diff --git a/External/MathLib b/External/MathLib index dbc52d79..1e43e5f1 160000 --- a/External/MathLib +++ b/External/MathLib @@ -1 +1 @@ -Subproject commit dbc52d79d4d6961d0dfd8811b194c879cb9b2022 +Subproject commit 1e43e5f1e98f9dd36bd2b8ceb0d331ffde752ba1 diff --git a/External/ShaderMake b/External/ShaderMake index 470bbc7d..d1cad9d0 160000 --- a/External/ShaderMake +++ b/External/ShaderMake @@ -1 +1 @@ -Subproject commit 470bbc7d0c343bc82c988072ee8a1fb2210647ce +Subproject commit d1cad9d0dc852b46eec01f2215e60145ccae00dd diff --git a/Include/NRD.h b/Include/NRD.h index fb9ec18e..3907d6d2 100644 --- a/Include/NRD.h +++ b/Include/NRD.h @@ -29,8 +29,8 @@ license agreement from NVIDIA CORPORATION is strictly prohibited. #define NRD_VERSION_MAJOR 4 #define NRD_VERSION_MINOR 9 -#define NRD_VERSION_BUILD 3 -#define NRD_VERSION_DATE "6 September 2024" +#define NRD_VERSION_BUILD 4 +#define NRD_VERSION_DATE "20 September 2024" #if defined(_MSC_VER) #define NRD_CALL __fastcall diff --git a/Integration/NRDIntegration.hpp b/Integration/NRDIntegration.hpp index 9b15c6ec..f1e87c0a 100644 --- a/Integration/NRDIntegration.hpp +++ b/Integration/NRDIntegration.hpp @@ -11,7 +11,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited. #include "NRDIntegration.h" static_assert(NRD_VERSION_MAJOR >= 4 && NRD_VERSION_MINOR >= 9, "Unsupported NRD version!"); -static_assert(NRI_VERSION_MAJOR >= 1 && NRI_VERSION_MINOR >= 147, "Unsupported NRI version!"); +static_assert(NRI_VERSION_MAJOR >= 1 && NRI_VERSION_MINOR >= 151, "Unsupported NRI version!"); #ifdef _WIN32 #define alloca _alloca @@ -188,7 +188,7 @@ void NrdIntegration::CreatePipelines() for (uint32_t i = 0; i < instanceDesc.pipelinesNum; i++) { const nrd::PipelineDesc& nrdPipelineDesc = instanceDesc.pipelines[i]; - const nrd::ComputeShaderDesc& nrdComputeShader = (&nrdPipelineDesc.computeShaderDXBC)[(uint32_t)deviceDesc.graphicsAPI]; + const nrd::ComputeShaderDesc& nrdComputeShader = (&nrdPipelineDesc.computeShaderDXBC)[std::max((int32_t)deviceDesc.graphicsAPI - 1, 0)]; // Resources for (uint32_t j = 0; j < nrdPipelineDesc.resourceRangesNum; j++) @@ -283,7 +283,15 @@ void NrdIntegration::CreateResources(uint16_t resourceWidth, uint16_t resourceHe uint16_t w = NRD_DivideUp(resourceWidth, nrdTextureDesc.downsampleFactor); uint16_t h = NRD_DivideUp(resourceHeight, nrdTextureDesc.downsampleFactor); - nri::TextureDesc textureDesc = nri::Texture2D(format, w, h, 1, 1, nri::TextureUsageBits::SHADER_RESOURCE | nri::TextureUsageBits::SHADER_RESOURCE_STORAGE); + + nri::TextureDesc textureDesc = {}; + textureDesc.type = nri::TextureType::TEXTURE_2D; + textureDesc.usageMask = nri::TextureUsageBits::SHADER_RESOURCE | nri::TextureUsageBits::SHADER_RESOURCE_STORAGE; + textureDesc.format = format; + textureDesc.width = w; + textureDesc.height = h; + textureDesc.mipNum = 1; + nri::Texture* texture = nullptr; NRD_INTEGRATION_ABORT_ON_FAILURE(m_NRI->CreateTexture(*m_Device, textureDesc, texture)); @@ -565,7 +573,8 @@ void NrdIntegration::Dispatch(nri::CommandBuffer& commandBuffer, nri::Descriptor // TODO: persistent mapping? But no D3D11 support... void* data = m_NRI->MapBuffer(*m_ConstantBuffer, m_ConstantBufferOffset, dispatchDesc.constantBufferDataSize); - memcpy(data, dispatchDesc.constantBufferData, dispatchDesc.constantBufferDataSize); + if (data) + memcpy(data, dispatchDesc.constantBufferData, dispatchDesc.constantBufferDataSize); m_NRI->UnmapBuffer(*m_ConstantBuffer); } diff --git a/README.md b/README.md index 08c15947..f9389ff9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# NVIDIA REAL-TIME DENOISERS v4.9.3 (NRD) +# NVIDIA REAL-TIME DENOISERS v4.9.4 (NRD) [![Build NRD SDK](https://github.com/NVIDIAGameWorks/RayTracingDenoiser/actions/workflows/build.yml/badge.svg)](https://github.com/NVIDIAGameWorks/RayTracingDenoiser/actions/workflows/build.yml) diff --git a/Resources/Version.h b/Resources/Version.h index 761c3e04..fafa2e72 100644 --- a/Resources/Version.h +++ b/Resources/Version.h @@ -23,6 +23,6 @@ Versioning rules: #define VERSION_MAJOR 4 #define VERSION_MINOR 9 -#define VERSION_BUILD 3 +#define VERSION_BUILD 4 #define VERSION_STRING STR(VERSION_MAJOR.VERSION_MINOR.VERSION_BUILD encoding=NRD_NORMAL_ENCODING.NRD_ROUGHNESS_ENCODING)