Skip to content

Commit

Permalink
v1.2.07 release
Browse files Browse the repository at this point in the history
  • Loading branch information
acmarrs-nvidia committed Mar 22, 2022
1 parent d2076bd commit a1071d9
Show file tree
Hide file tree
Showing 52 changed files with 1,133 additions and 201 deletions.
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@
path = thirdparty/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
branch = sdk-1.2.170
[submodule "thirdparty/libpng"]
path = thirdparty/libpng
url = https://github.com/glennrp/libpng.git
branch = libpng16
[submodule "thirdparty/zlib"]
path = thirdparty/zlib
url = https://github.com/madler/zlib.git
branch = master
22 changes: 21 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin")

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Add Vulkan headers on ARM since there is no official Vulkan SDK
# Add Vulkan headers on ARM since there is no official ARM Vulkan SDK
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
add_subdirectory(thirdparty/Vulkan-Headers)
set(RTXGI_API_VULKAN_SDK "1")
Expand Down Expand Up @@ -47,6 +47,26 @@ if(RTXGI_BUILD_SAMPLES)
target_compile_definitions(tinygltf PUBLIC _CRT_SECURE_NO_WARNINGS) # suppress the sprintf CRT warnings
set_target_properties(tinygltf PROPERTIES FOLDER "Thirdparty/")

# zlib
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
set(CMAKE_DEBUG_POSTFIX "" CACHE STRING "override debug postfix")
option(ASM686 "" OFF)
option(AMD64 "" OFF)
add_subdirectory(thirdparty/zlib)
target_compile_options(zlib BEFORE PUBLIC /wd4267) # suppress the implicit conversion warning
set_target_properties(zlib zlibstatic example minigzip PROPERTIES FOLDER "Thirdparty/zlib" DEBUG_POSTFIX "")

# libpng
option(PNG_BUILD_ZLIB "" ON)
option(PNG_STATIC "" ON)
option(PNG_SHARED "" OFF)
option(PNG_EXECUTABLES "" OFF)
option(PNG_FRAMEWORK "" OFF)
option(PNG_TESTS "" OFF)
set(ZLIB_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/thirdparty/zlib" "${CMAKE_BINARY_DIR}/thirdparty/zlib")
add_subdirectory(thirdparty/libpng)
set_target_properties(png_static genfiles PROPERTIES FOLDER "Thirdparty/libpng" DEBUG_POSTFIX "")

# Samples
add_subdirectory(samples)
endif()
29 changes: 29 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# RTXGI SDK Change Log

## 1.2.07

### SDK

Features and Improvements:
- Shader improvements for probe data reads/writes
- The probe data texture now uses the same layout as the irradiance and distance textures
- This change makes probe data visualizations easier to understand
- Adds a RWTexture2D variant of ```DDGILoadProbeState()```
- Uses the ```DDGILoadProbeState()``` convenience function where appropriate
- Moved the ```data``` member of the ```DDGIVolumeDescGPU``` struct inside the ```GetPackedData()``` function so the struct size is the same on the CPU and GPU
- Updated stale code comments (non-functional)
- Bumped SDK revision number and version string

Bug Fixes:
- ```DDGIGetVolumeBlendWeight```: fixed regression related to volume edge fade not respecting rotations

### Test Harness

Features and Improvements:
- ```ProbeTraceRGS.hlsl```: no longer performs lighting for fixed rays when probe relocation is enabled (performance optimization)
- Adds a performance benchmark mode that collects CPU and GPU performance data and outputs the results to ```*.csv``` files
- Press the ```F2``` key to run a benchmark
- Adds the ability to store intermediate textures (back buffer, GBuffer, RTAO, and DDGIVolume textures) to disk
- Uses the zlib and libpng libraries for cross-platform compatibility
- Press the ```F1``` key to save the current image data to disk
- ```VolumeTexturesCS.hlsl```: minor updates to the layout order of visualized textures
- Config file and documentation updates

## 1.2.04

### SDK
Expand Down
4 changes: 2 additions & 2 deletions docs/DDGIVolume.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,11 @@ This texture stores world-space offsets and classification states for all probes
- ```ProbeDataCommon.hlsl``` contains helper functions for reading and writing world-space offset data.
- Probe classification state is stored in the W channel.

The texture's layout is the same as the irradiance and distance texture altases, except each probe uses just *one texel*. Below is a visualization of the probe data texture's world-space offsets (top) and probe states (bottom).
The texture's layout is the same as the irradiance and distance texture altases, except here each probe is represented by just *one texel*. Below is a visualization of the probe data texture's world-space offsets (top) and probe states (bottom).

<figure>
<img src="images/ddgivolume-textures-probedata.jpg" width=800px></img>
<figcaption><b>Figure 6: The Probe Data texture (zoomed) from the Crytek Sponza scene</b></figcaption>
<figcaption><b>Figure 6: A visualization of the Probe Data texture (zoomed) for the Crytek Sponza scene</b></figcaption>
</figure>


Expand Down
9 changes: 7 additions & 2 deletions docs/ShaderAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ The Test Harness sample application provides [an example ray generation shader](

Computes the 3D grid-space coordinates for the probe at a given probe index in the range [0, numProbes]. Provide these coordinates to ```DDGIGetProbeWorldPosition()``` and ```DDGIGetScrollingProbeIndex()```.

#### ```DDGIGetProbeState(...)```
#### ```DDGILoadProbeState(...)```

float DDGIGetProbeState(
float DDGILoadProbeState(
int probeIndex,
RWTexture2D<float4> probeData,
DDGIVolumeDescGPU volume)

float DDGILoadProbeState(
int probeIndex,
Texture2D<float4> probeData,
DDGIVolumeDescGPU volume)
Expand Down
Binary file modified docs/images/ddgivolume-textures-probedata.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion rtxgi-sdk/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions rtxgi-sdk/include/rtxgi/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ namespace rtxgi
{
static const int major = 1;
static const int minor = 2;
static const int revision = 4;
static const int revision = 7;

inline static const char* getVersionString()
{
return "1.2.04";
return "1.2.07";
}
};

Expand Down
2 changes: 1 addition & 1 deletion rtxgi-sdk/include/rtxgi/ddgi/DDGIVolumeDescGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ struct DDGIVolumeDescGPU
bool probeScrollClear[3]; // whether probes of a plane need to be cleared due to scrolling movement

#ifndef HLSL
rtxgi::DDGIVolumeDescGPUPacked data;
rtxgi::DDGIVolumeDescGPUPacked GetPackedData()
{
rtxgi::DDGIVolumeDescGPUPacked data;
data.origin = origin;
data.probeHysteresis = probeHysteresis;
data.rotation = rotation;
Expand Down
4 changes: 2 additions & 2 deletions rtxgi-sdk/include/rtxgi/ddgi/gfx/DDGIVolume_D3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace rtxgi

ID3D12Resource* constantsBuffer = nullptr; // Constants structured buffer resource pointer (device)

// Provide these resources if you use DDGIVolume::Upload() to transfer constants to the GPU
// Provide these resources if you use UploadDDGIVolumeConstants() to transfer constants to the GPU
ID3D12Resource* constantsBufferUpload = nullptr; // [Optional] Constants structured buffer resource pointer (upload)
UINT64 constantsBufferSizeInBytes = 0; // [Optional] Size (in bytes) of the constants structured buffer
};
Expand Down Expand Up @@ -261,7 +261,7 @@ namespace rtxgi
ID3D12Device* m_device = nullptr; // D3D12 device pointer
#endif

// Constants (if you use the DDGIVolume::Upload() to transfer constants to the GPU)
// Constants (if you use UploadDDGIVolumeConstants() to transfer constants to the GPU)
ID3D12Resource* m_constantsBuffer = nullptr; // Structured buffer that stores the volume's constants (device)
ID3D12Resource* m_constantsBufferUpload = nullptr; // Structured buffer that stores the volume's constants (upload)
UINT64 m_constantsBufferSizeInBytes = 0; // Size (in bytes) of the structured buffer that stores *all* volumes constants
Expand Down
4 changes: 2 additions & 2 deletions rtxgi-sdk/include/rtxgi/ddgi/gfx/DDGIVolume_VK.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace rtxgi

VkBuffer constantsBuffer = nullptr; // Constants structured buffer (device)

// Provide these resources if you use DDGIVolume::Upload() to transfer constants to the GPU
// Provide these resources if you use UploadDDGIVolumeConstants() to transfer constants to the GPU
VkBuffer constantsBufferUpload = nullptr; // [Optional] Constants structured buffer (upload)
VkDeviceMemory constantsBufferUploadMemory = nullptr; // [Optional] Constants structured buffer memory (upload)
uint64_t constantsBufferSizeInBytes = 0; // [Optional] Size (in bytes) of the constants structured buffer
Expand Down Expand Up @@ -307,7 +307,7 @@ namespace rtxgi
VkDescriptorPool m_descriptorPool = nullptr; // Vulkan descriptor pool handle
#endif

// Constants (if you use the DDGIVolume::Upload() to transfer constants to the GPU)
// Constants (if you use UploadDDGIVolumeConstants() to transfer constants to the GPU)
VkBuffer m_constantsBuffer = nullptr; // Structured buffer that stores the volume's constants (device)
VkBuffer m_constantsBufferUpload = nullptr; // Structured buffer that stores the volume's constants (upload)
VkDeviceMemory m_constantsBufferUploadMemory = nullptr; // Memory for the volume's constants upload structured buffer
Expand Down
19 changes: 8 additions & 11 deletions rtxgi-sdk/shaders/ddgi/Irradiance.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ float3 DDGIGetSurfaceBias(float3 surfaceNormal, float3 cameraDirection, DDGIVolu
*/
float DDGIGetVolumeBlendWeight(float3 worldPosition, DDGIVolumeDescGPU volume)
{
// Get the volume's origin
// Get the volume's origin and extent
float3 origin = volume.origin + (volume.probeScrollOffsets * volume.probeSpacing);

// Get spatial delta between the world position and the volume
float3 extent = (volume.probeSpacing * (volume.probeCounts - 1)) * 0.5f;
float3 position = abs(worldPosition - origin);

// Get the delta between the (rotated volume) and the world-space position
float3 position = (worldPosition - origin);
position = abs(RTXGIQuaternionRotate(position, RTXGIQuaternionConjugate(volume.rotation)));

float3 delta = position - extent;
if(all(delta < 0)) return 1.f;

Expand Down Expand Up @@ -99,13 +101,8 @@ float3 DDGIGetVolumeIrradiance(
int adjacentProbeIndex = DDGIGetScrollingProbeIndex(adjacentProbeCoords, volume);

// Early Out: don't allow inactive probes to contribute to irradiance
if (volume.probeClassificationEnabled)
{
// Get the probe state
int2 probeDataCoords = DDGIGetProbeDataTexelCoords(adjacentProbeIndex, volume);
int probeState = resources.probeData[probeDataCoords].w;
if (probeState == RTXGI_DDGI_PROBE_STATE_INACTIVE) continue;
}
int probeState = DDGILoadProbeState(adjacentProbeIndex, resources.probeData, volume);
if (probeState == RTXGI_DDGI_PROBE_STATE_INACTIVE) continue;

// Get the adjacent probe's world position
float3 adjacentProbeWorldPosition = DDGIGetProbeWorldPosition(adjacentProbeCoords, volume, resources.probeData);
Expand Down
9 changes: 2 additions & 7 deletions rtxgi-sdk/shaders/ddgi/ProbeBlendingCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,8 @@ void DDGIProbeBlendingCS(uint3 DispatchThreadID : SV_DispatchThreadID, uint Grou
}

// Early Out: don't blend rays for probes that are inactive
if(volume.probeClassificationEnabled)
{
// Get the probe state
int2 probeDataCoords = DDGIGetProbeDataTexelCoords(probeIndex, volume);
int probeState = ProbeData[probeDataCoords].w;
if (probeState == RTXGI_DDGI_PROBE_STATE_INACTIVE) return;
}
int probeState = DDGILoadProbeState(probeIndex, ProbeData, volume);
if (probeState == RTXGI_DDGI_PROBE_STATE_INACTIVE) return;

// Visualize the probe index
#if RTXGI_DDGI_BLEND_RADIANCE && RTXGI_DDGI_DEBUG_PROBE_INDEXING
Expand Down
4 changes: 2 additions & 2 deletions rtxgi-sdk/shaders/ddgi/ProbeClassificationCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void DDGIProbeClassificationCS(uint3 DispatchThreadID : SV_DispatchThreadID)
}

// Get the probe's texel coordinates in the Probe Data texture
uint2 probeDataCoords = DDGIGetProbeDataTexelCoords(probeIndex, volume);
uint2 probeDataCoords = DDGIGetProbeTexelCoords(probeIndex, volume);

// Early out: number of backface hits has been exceeded. The probe is probably inside geometry.
if(((float)backfaceCount / (float)RTXGI_DDGI_NUM_FIXED_RAYS) > volume.probeBackfaceThreshold)
Expand Down Expand Up @@ -369,7 +369,7 @@ void DDGIProbeClassificationResetCS(uint3 DispatchThreadID : SV_DispatchThreadID
#endif

// Get the probe's texel coordinates in the Probe Data texture
uint2 probeDataCoords = DDGIGetProbeDataTexelCoords(DispatchThreadID.x, volume);
uint2 probeDataCoords = DDGIGetProbeTexelCoords(DispatchThreadID.x, volume);

ProbeData[probeDataCoords].w = RTXGI_DDGI_PROBE_STATE_ACTIVE;
}
4 changes: 2 additions & 2 deletions rtxgi-sdk/shaders/ddgi/ProbeRelocationCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void DDGIProbeRelocationCS(uint3 DispatchThreadID : SV_DispatchThreadID)
#endif

// Get the probe's texel coordinates in the Probe Data texture
uint2 coords = DDGIGetProbeDataTexelCoords(probeIndex, volume);
uint2 coords = DDGIGetProbeTexelCoords(probeIndex, volume);

// Read the current world position offset
float3 offset = DDGILoadProbeDataOffset(ProbeData, coords, volume);
Expand Down Expand Up @@ -387,7 +387,7 @@ void DDGIProbeRelocationResetCS(uint3 DispatchThreadID : SV_DispatchThreadID)
#endif

// Get the probe's texel coordinates in the Probe Data texture
uint2 probeDataCoords = DDGIGetProbeDataTexelCoords(DispatchThreadID.x, volume);
uint2 probeDataCoords = DDGIGetProbeTexelCoords(DispatchThreadID.x, volume);

// Write the probe offset
ProbeData[probeDataCoords].xyz = float3(0.f, 0.f, 0.f);
Expand Down
4 changes: 2 additions & 2 deletions rtxgi-sdk/shaders/ddgi/include/ProbeCommon.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ float3 DDGIGetProbeWorldPosition(int3 probeCoords, DDGIVolumeDescGPU volume, Tex
int probeIndex = DDGIGetScrollingProbeIndex(probeCoords, volume);

// Find the texture coordinates of the probe in the Probe Data texture
uint2 coords = DDGIGetProbeDataTexelCoords(probeIndex, volume);
uint2 coords = DDGIGetProbeTexelCoords(probeIndex, volume);

// Load the probe's world-space position offset and add it to the current world position
probeWorldPosition += DDGILoadProbeDataOffset(probeData, coords, volume);
Expand All @@ -88,7 +88,7 @@ float3 DDGIGetProbeWorldPosition(int3 probeCoords, DDGIVolumeDescGPU volume, RWT
int probeIndex = DDGIGetScrollingProbeIndex(probeCoords, volume);

// Find the texture coordinates of the probe in the Probe Data texture
uint2 coords = DDGIGetProbeDataTexelCoords(probeIndex, volume);
uint2 coords = DDGIGetProbeTexelCoords(probeIndex, volume);

// Load the probe's world-space position offset and add it to the current world position
probeWorldPosition += DDGILoadProbeDataOffset(probeData, coords, volume);
Expand Down
Loading

0 comments on commit a1071d9

Please sign in to comment.