Skip to content

Commit

Permalink
v1.3.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
acmarrs-nvidia committed May 8, 2023
1 parent d9fd1d8 commit c233266
Show file tree
Hide file tree
Showing 41 changed files with 1,177 additions and 940 deletions.
16 changes: 16 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# RTXGI SDK Change Log

## 1.3.7
### SDK
- **Bug Fixes**
- Fixes issue in ```ReductionCS.hlsl``` that caused a divide by zero when all probes in a volume are disabled. A reduction thread should not contribute to the variability calculation if ```threadFootprintWeightSum``` is zero.
- Fixes issue in ```ProbeBlendingCS.hlsl``` that prevented ```probeBrightnessThreshold``` from working as intended. Fixes GitHub Issue [#70](https://github.com/NVIDIAGameWorks/RTXGI/issues/70).

### Test Harness
- **Improvements**
- Enhances shader compilation options and allows for the options to be specified in ```*.ini``` files.
- Enhancements to frame queueing/buffering. The CPU can now run ahead one frame, allowing CPU and GPU work to overlap.
- Adds a toggle to enable/disable progressive rendering in the path tracer.
- Increased the granularity of CPU timestamps and reworks the detailed performance UI.
- **Bug Fixes**
- Fixes minor issues with Vulkan timestamps.


## 1.3.6
### SDK
- **Improvements**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The RTXGI SDK and sample application(s) require the following hardware and softw

### Hardware
* Any DXR capable GPU. NVIDIA DXR enabled GPUs are:
* RTX 4090, 4080
* RTX 4090, 4080, 4070 Ti, 4070
* RTX 3090 Ti, 3090, 3080 Ti, 3080, 3070 Ti, 3070, 3060 Ti, 3060, 3050
* Titan RTX
* RTX 2080 Ti, 2080 SUPER, 2080, 2070 SUPER, 2070, 2060 SUPER, 2060
Expand Down
4 changes: 2 additions & 2 deletions rtxgi-sdk/include/rtxgi/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace rtxgi
{
static const int major = 1;
static const int minor = 3;
static const int revision = 6;
static const int revision = 7;

inline static const char* getVersionString()
{
return "1.3.6";
return "1.3.7";
}
};

Expand Down
39 changes: 21 additions & 18 deletions rtxgi-sdk/shaders/ddgi/ProbeBlendingCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -502,33 +502,34 @@ void DDGIProbeBlendingCS(
result.rgb *= 1.f / (2.f * max(result.a, epsilon));
result.a = 1.f;

// Get the previous irradiance in the probe
float3 previous = Output[DispatchThreadID].rgb;
// Get the irradiance mean stored in the probe
float3 probeIrradianceMean = Output[DispatchThreadID].rgb;

// Get the history weight (hysteresis) to use for the probe texel's previous value
// If the probe was previously cleared to completely black, set the hysteresis to zero
float hysteresis = volume.probeHysteresis;
if (dot(previous, previous) == 0) hysteresis = 0.f;
if (dot(probeIrradianceMean, probeIrradianceMean) == 0) hysteresis = 0.f;

#if RTXGI_DDGI_BLEND_RADIANCE
// Tone-mapping gamma adjustment
result.rgb = pow(result.rgb, (1.f / volume.probeIrradianceEncodingGamma));

float3 delta = (result.rgb - previous.rgb);
// Get the difference between the current irradiance and the irradiance mean stored in the probe
float3 delta = (result.rgb - probeIrradianceMean.rgb);

float3 previousIrradianceMean = previous.rgb;
float3 currentIrradianceSample = result.rgb;
// Store the current irradiance (before interpolation) for use in probe variability
float3 irradianceSample = result.rgb;

if (RTXGIMaxComponent(previous.rgb - result.rgb) > volume.probeIrradianceThreshold)
if (RTXGIMaxComponent(probeIrradianceMean.rgb - result.rgb) > volume.probeIrradianceThreshold)
{
// Lower the hysteresis when a large lighting change is detected
hysteresis = max(0.f, hysteresis - 0.75f);
}

if (length(delta) > volume.probeBrightnessThreshold)
if (RTXGILinearRGBToLuminance(delta) > volume.probeBrightnessThreshold)
{
// Clamp the maximum change in irradiance when a large brightness change is detected
result.rgb = previous.rgb + (delta * 0.25f);
// Clamp the maximum per-update change in irradiance when a large brightness change is detected
delta *= 0.25f;
}

// Interpolate the new blended irradiance with the existing irradiance in the probe.
Expand All @@ -542,26 +543,28 @@ void DDGIProbeBlendingCS(
// dark convergence.
static const float c_threshold = 1.f / 1024.f;
float3 lerpDelta = (1.f - hysteresis) * delta;
if (RTXGIMaxComponent(result.rgb) < RTXGIMaxComponent(previous.rgb))
if (RTXGIMaxComponent(result.rgb) < RTXGIMaxComponent(probeIrradianceMean.rgb))
{
lerpDelta = min(max(c_threshold, abs(lerpDelta)), abs(delta)) * sign(lerpDelta);
}
result = float4(previous.rgb + lerpDelta, 1.f);
result = float4(probeIrradianceMean.rgb + lerpDelta, 1.f);

if (volume.probeVariabilityEnabled)
{
float3 newIrradianceMean = result.rgb;
float3 newIrradianceSigma2 = (currentIrradianceSample - previousIrradianceMean) * (currentIrradianceSample - newIrradianceMean);
float newLuminanceSigma2 = RTXGILinearRGBToLuminance(newIrradianceSigma2);
float newLuminanceMean = RTXGILinearRGBToLuminance(newIrradianceMean);
float coefficientOfVariation = (newLuminanceMean <= c_threshold) ? 0.f : sqrt(newLuminanceSigma2) / newLuminanceMean;
// Compute the coefficient of variation
float3 irradianceMean = result.rgb;
float3 irradianceSigma2 = (irradianceSample - probeIrradianceMean) * (irradianceSample - irradianceMean);
float luminanceSigma2 = RTXGILinearRGBToLuminance(irradianceSigma2);
float luminanceMean = RTXGILinearRGBToLuminance(irradianceMean);
float coefficientOfVariation = (luminanceMean <= c_threshold) ? 0.f : sqrt(luminanceSigma2) / luminanceMean;

ProbeVariability[threadCoords].r = coefficientOfVariation;
}
#else

// Interpolate the new filtered distance with the existing filtered distance in the probe.
// A high hysteresis value emphasizes the existing probe filtered distance.
result = float4(lerp(result.rg, previous.rg, hysteresis), 0.f, 1.f);
result = float4(lerp(result.rg, probeIrradianceMean.rg, hysteresis), 0.f, 1.f);
#endif

Output[DispatchThreadID] = result;
Expand Down
2 changes: 1 addition & 1 deletion rtxgi-sdk/shaders/ddgi/ReductionCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ void DDGIExtraReductionCS(uint3 GroupID : SV_GroupID, uint3 GroupThreadID : SV_G
}
}
}
float threadAverageValue = footprintInBounds ? threadFootprintValueSum / threadFootprintWeightSum : 0;
float threadAverageValue = (footprintInBounds && threadFootprintWeightSum > 0) ? threadFootprintValueSum / threadFootprintWeightSum : 0;
// Per-thread weight will be 1.0 if thread sampled all 4x2 pixels, 0.125 if it only sampled one
float ThreadTotalPossibleWeight = ThreadSampleFootprint.x * ThreadSampleFootprint.y;
float threadWeight = threadFootprintWeightSum / ThreadTotalPossibleWeight;
Expand Down
7 changes: 7 additions & 0 deletions samples/test-harness/config/cornell.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ app.root=../../../samples/test-harness/
app.rtxgiSDK=../../../rtxgi-sdk/
app.title=RTXGI Test Harness

# shader compilation
shaders.warningsAsErrors=1
shaders.disableOptimizations=0
shaders.disableValidation=0
shaders.shaderSymbols=1
shaders.lifetimeMarkers=1

# scene
scene.name=Cornell-Box
scene.path=data/gltf/cornell/
Expand Down
7 changes: 7 additions & 0 deletions samples/test-harness/config/furnace.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ app.root=../../../samples/test-harness/
app.rtxgiSDK=../../../rtxgi-sdk/
app.title=RTXGI Test Harness

# shader compilation
shaders.warningsAsErrors=1
shaders.disableOptimizations=0
shaders.disableValidation=0
shaders.shaderSymbols=0
shaders.lifetimeMarkers=0

# scene
scene.name=Furnace
scene.path=data/gltf/furnace/
Expand Down
7 changes: 7 additions & 0 deletions samples/test-harness/config/multi-cornell.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ app.root=../../../samples/test-harness/
app.rtxgiSDK=../../../rtxgi-sdk/
app.title=RTXGI Test Harness

# shader compilation
shaders.warningsAsErrors=1
shaders.disableOptimizations=0
shaders.disableValidation=0
shaders.shaderSymbols=0
shaders.lifetimeMarkers=0

# scene
scene.name=Cornell-Boxes
scene.path=data/gltf/multi-cornell/
Expand Down
9 changes: 8 additions & 1 deletion samples/test-harness/config/sponza.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ app.root=../../../samples/test-harness/
app.rtxgiSDK=../../../rtxgi-sdk/
app.title=RTXGI Test Harness

# shader compilation
shaders.warningsAsErrors=1
shaders.disableOptimizations=0
shaders.disableValidation=0
shaders.shaderSymbols=1
shaders.lifetimeMarkers=1

# scene
scene.name=Sponza
scene.path=data/gltf/sponza/
Expand Down Expand Up @@ -78,7 +85,7 @@ ddgi.volume.0.probeNormalBias=0.1
ddgi.volume.0.probeViewBias=0.3
ddgi.volume.0.probeMaxRayDistance=10000
ddgi.volume.0.probeIrradianceThreshold=0.2
ddgi.volume.0.probeBrightnessThreshold=2.0
ddgi.volume.0.probeBrightnessThreshold=1.0
ddgi.volume.0.vis.probeVisType=1
ddgi.volume.0.vis.probeRadius=0.1
ddgi.volume.0.vis.probeDistanceDivisor=200
Expand Down
7 changes: 7 additions & 0 deletions samples/test-harness/config/tunnel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ app.root=../../../samples/test-harness/
app.rtxgiSDK=../../../rtxgi-sdk/
app.title=RTXGI Test Harness

# shader compilation
shaders.warningsAsErrors=1
shaders.disableOptimizations=0
shaders.disableValidation=0
shaders.shaderSymbols=0
shaders.lifetimeMarkers=0

# scene
scene.name=Tunnel
scene.path=data/gltf/tunnel/
Expand Down
11 changes: 9 additions & 2 deletions samples/test-harness/config/two-rooms.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ app.root=../../../samples/test-harness/
app.rtxgiSDK=../../../rtxgi-sdk/
app.title=RTXGI Test Harness

# shader compilation
shaders.warningsAsErrors=1
shaders.disableOptimizations=0
shaders.disableValidation=0
shaders.shaderSymbols=0
shaders.lifetimeMarkers=0

# scene
scene.name=Two-Rooms
scene.path=data/gltf/two-rooms/
Expand Down Expand Up @@ -67,7 +74,7 @@ ddgi.volume.0.probeRelocation.enabled=1
ddgi.volume.0.probeRelocation.minFrontfaceDistance=0.1
ddgi.volume.0.probeClassification.enabled=1
ddgi.volume.0.probeVariability.enabled=1
ddgi.volume.0.probeVariability.threshold=0.035
ddgi.volume.0.probeVariability.threshold=0.03
ddgi.volume.0.infiniteScrolling.enabled=1
ddgi.volume.0.textures.rayData.format=5 # EDDGIVolumeTextureFormat::F32x2
ddgi.volume.0.textures.irradiance.format=0 # EDDGIVolumeTextureFormat::U32
Expand All @@ -85,7 +92,7 @@ ddgi.volume.0.probeNormalBias=1.0
ddgi.volume.0.probeViewBias=6.0
ddgi.volume.0.probeMaxRayDistance=10000
ddgi.volume.0.probeIrradianceThreshold=0.2
ddgi.volume.0.probeBrightnessThreshold=2.0
ddgi.volume.0.probeBrightnessThreshold=0.22
ddgi.volume.0.vis.probeVisType=1
ddgi.volume.0.vis.probeRadius=2.0
ddgi.volume.0.vis.probeDistanceDivisor=30
Expand Down
11 changes: 11 additions & 0 deletions samples/test-harness/include/Configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ namespace Configs
{
bool enabled = false;
bool antialiasing = false;
bool progressive = true;
bool shaderExecutionReordering = false;
bool reload = false;
float rayNormalBias = 0.001f;
Expand Down Expand Up @@ -197,6 +198,15 @@ namespace Configs
float rotationSpeed = 1.f;
};

struct Shaders
{
bool warningsAsErrors = true; // treat warnings as errors
bool disableOptimizations = false; // disable optimizations
bool disableValidation = false; // disable validation
bool shaderSymbols = false; // include symbols in shader blobs
bool lifetimeMarkers = false; // enable variable lifetime markers
};

struct Application
{
int width = 1280;
Expand All @@ -222,6 +232,7 @@ namespace Configs
struct Config
{
Application app;
Shaders shaders;
Input input;
Scene scene;
PathTrace pathTrace;
Expand Down
17 changes: 9 additions & 8 deletions samples/test-harness/include/Direct3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace Graphics
#define D3DCHECK(hr) if(!Check(hr, __FILE__, __LINE__)) { return false; }

#ifdef GFX_PERF_INSTRUMENTATION
#define GPU_TIMESTAMP_BEGIN(x) d3d.cmdList->EndQuery(d3dResources.timestampHeap, D3D12_QUERY_TYPE_TIMESTAMP, x);
#define GPU_TIMESTAMP_END(x) d3d.cmdList->EndQuery(d3dResources.timestampHeap, D3D12_QUERY_TYPE_TIMESTAMP, x);
#define GPU_TIMESTAMP_BEGIN(x) d3d.cmdList[d3d.frameIndex]->EndQuery(d3dResources.timestampHeap, D3D12_QUERY_TYPE_TIMESTAMP, x);
#define GPU_TIMESTAMP_END(x) d3d.cmdList[d3d.frameIndex]->EndQuery(d3dResources.timestampHeap, D3D12_QUERY_TYPE_TIMESTAMP, x);
#else
#define GPU_TIMESTAMP_BEGIN(x)
#define GPU_TIMESTAMP_END(x)
Expand Down Expand Up @@ -99,15 +99,16 @@ namespace Graphics
IDXGIFactory7* factory = nullptr;
ID3D12Device6* device = nullptr;
ID3D12CommandQueue* cmdQueue = nullptr;
ID3D12CommandAllocator* cmdAlloc[2] = { nullptr, nullptr };
ID3D12GraphicsCommandList4* cmdList = nullptr;
ID3D12CommandAllocator* cmdAlloc[MAX_FRAMES_IN_FLIGHT] = { nullptr, nullptr };
ID3D12GraphicsCommandList4* cmdList[MAX_FRAMES_IN_FLIGHT] = { nullptr, nullptr };

IDXGISwapChain4* swapChain = nullptr;
ID3D12Resource* backBuffer[2] = { nullptr, nullptr };
ID3D12Resource* backBuffer[MAX_FRAMES_IN_FLIGHT] = { nullptr, nullptr };

ID3D12Fence* fence = nullptr;
UINT64 fenceValue = 0;
HANDLE fenceEvent;
ID3D12Fence* fence[MAX_FRAMES_IN_FLIGHT] = { nullptr, nullptr };
ID3D12Fence* immediateFence = nullptr;
HANDLE fenceEvent[MAX_FRAMES_IN_FLIGHT];
HANDLE immediateFenceEvent;
UINT frameIndex = 0;
UINT frameNumber = 0;

Expand Down
6 changes: 5 additions & 1 deletion samples/test-harness/include/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Scenes.h"
#include "Instrumentation.h"

const int MAX_FRAMES_IN_FLIGHT = 2;
const int MAX_TLAS = 2;
const int MAX_TEXTURES = 300;
const int MAX_DDGIVOLUMES = 6;
Expand Down Expand Up @@ -48,13 +49,16 @@ namespace Graphics
{
bool CreateDevice(Globals& gfx, Configs::Config& config);
bool Initialize(const Configs::Config& config, Scenes::Scene& scene, Globals& gfx, GlobalResources& resources, std::ofstream& log);
bool PostInitialize(Globals& gfx, std::ofstream& log);
void Update(Globals& gfx, GlobalResources& gfxResources, const Configs::Config& config, Scenes::Scene& scene);
bool Resize(Globals& gfx, GlobalResources& resources, int width, int height, std::ofstream& log);
bool ResizeBegin(Globals& gfx, GlobalResources& resources, int width, int height, std::ofstream& log);
bool ResizeEnd(Globals& gfx);
bool ToggleFullscreen(Globals& gfx);
bool ResetCmdList(Globals& gfx);
bool SubmitCmdList(Globals& gfx);
bool Present(Globals& gfx);
bool WaitForGPU(Globals& gfx);
bool WaitForPrevGPUFrame(Globals& gfx);
bool MoveToNextFrame(Globals& gfx);
void Cleanup(Globals& gfx, GlobalResources& gfxResources);

Expand Down
19 changes: 19 additions & 0 deletions samples/test-harness/include/Instrumentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@

namespace Instrumentation
{
enum EStatIndex
{
FRAME = 0,
WAITFORGPU,
RESET,
TIMESTAMP_BEGIN,
INPUT,
UPDATE,
PT,
GBUFFER,
DDGI,
DDGI_VIS,
RTAO,
COMPOSITE,
UI,
TIMESTAMP_END,
SUBMIT,
PRESENT,
};

enum class EStatType
{
Expand Down
3 changes: 2 additions & 1 deletion samples/test-harness/include/Shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Shaders
IDxcIncludeHandler* includes = nullptr;

DxcCreateInstanceProc DxcCreateInstance = nullptr;
Configs::Shaders config = {};

std::string root = "";
std::string rtxgi = "";
Expand Down Expand Up @@ -118,6 +119,6 @@ namespace Shaders

bool Initialize(const Configs::Config& config, ShaderCompiler& compiler);
void AddDefine(ShaderProgram& shader, std::wstring name, std::wstring value);
bool Compile(ShaderCompiler& compiler, ShaderProgram& shader, bool warningsAsErrors = false, bool debugInfo = false);
bool Compile(ShaderCompiler& compiler, ShaderProgram& shader, bool warningsAsErrors = true);
void Cleanup(ShaderCompiler& compiler);
}
Loading

0 comments on commit c233266

Please sign in to comment.