Skip to content

Commit 88da6ca

Browse files
Merge branch 'drawcall2' into 'main'
[REMIX-5428] Implement preserving instances across frames for static draw calls. See merge request lightspeedrtx/dxvk-remix-nv!2089
2 parents 15ec75b + ef3313e commit 88da6ca

31 files changed

Lines changed: 1083 additions & 393 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Full guide: `documentation/CONTRIBUTING-style-guide.md`
3636
- Member variables: `m_` prefix (e.g. `m_value`)
3737
- Pointers: `p` prefix (e.g. `pInput`, `m_pPointer`)
3838
- Variables and functions: `camelCase`
39+
- Functions: Prefer short verb + object names aligned with the subsystem; avoid encoding implementation steps in the identifier (see `documentation/CONTRIBUTING-style-guide.md`, Naming Conventions).
3940
- Constants: `k` prefix and camelCase, i.e. `kConstantName`
4041
- Macros and defines: `UPPER_CASE`
4142
- Classes and structs: `PascalCase`

RtxOptions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ This file is auto-generated by RTX Remix. To regenerate it, run Remix with `DXVK
239239
|rtx.enablePSTRSecondaryIncidentSplitApproximation|bool|True|||Enable transmission PSR on secondary incident transmission events such as entering a translucent material on an already\-transmitted path \(rather than respecting no\-split path PSR rule\)\.<br>Typically this results in better looking glass when enabled \(at the cost accuracy due to ignoring reflections off of glass seen through glass for example\)\.|
240240
|rtx.enablePortalFadeInEffect|bool|False||||
241241
|rtx.enablePresentThrottle|bool|False|||A flag to enable or disable present throttling, when set to true a sleep for a time specified by the throttle delay will be inserted into the DXVK presentation thread\.<br>Useful to manually reduce the framerate if the application is running too fast or to reduce GPU power usage during development to keep temperatures down\.<br>Should not be enabled in anything other than development situations\.|
242+
|rtx.enablePreservePath|bool|True|||When true, Remix attempts to identify draw calls whose state has not changed since last frame and re\-use the previous<br>frame's translation, rather than retranslating the draw call into raytrace\-ready scene data\.<br>When false, every submit uses full dynamic geometry and instance processing \(drawReplacements / processDrawCallState\)\.<br>Disable for debugging or compatibility when suspecting preserve\-path regressions\.|
242243
|rtx.enableProbabilisticUnorderedResolveInIndirectRays|bool|True|||A flag to enable or disable probabilistic unordered resolve approximations in indirect rays\.<br>This flag speeds up the unordered resolve for indirect rays by probabilistically deciding when to perform unordered resolve or not\. Must have both unordered resolve and unordered resolve in indirect rays enabled for this to take effect\.<br>This option should be enabled by default as it can significantly improve performance on some hardware\. In rare cases it may come at the cost of some quality for particles and decals in reflections\.<br>Note that even with this option enabled, unordered resolve approximations are only done on the first indirect bounce for the sake of performance overall\.|
243244
|rtx.enableRayReconstruction|bool|True|||Enables DLSS ray reconstruction, an AI\-based denoiser designed for real time ray tracing\.|
244245
|rtx.enableRaytracing|bool|True|||Globally enables or disables ray tracing\. When set to false the original game should render mostly as it would in DXVK typically\.<br>Some artifacts may still appear however compared to the original game either due to issues with the underlying DXVK translation or issues in Remix itself\.|
@@ -833,8 +834,6 @@ This file is auto-generated by RTX Remix. To regenerate it, run Remix with `DXVK
833834
|rtx.useDenoiser|bool|True|||Enables usage of denoiser\(s\) when set to true, otherwise disables denoising when set to false\.<br>Denoising is important for filtering the raw noisy ray traced signal into a smoother and more stable result at the cost of some potential spatial/temporal artifacts \(ghosting, boiling, blurring, etc\)\.<br>Generally should remain enabled except when debugging behavior which requires investigating the output directly, or diagnosing denoising\-related issues\.|
834835
|rtx.useDenoiserReferenceMode|bool|False|||Enables reference "denoiser" \(~ accumulation mode\) when set to true, otherwise uses a standard denoiser\.<br>The reference denoiser accumulates frames over time to generate a reference multi\-sample per pixel contribution<br>which should converge slowly to the ideal result the renderer is working towards\.<br>It is useful for analyzing quality differences in various denoising methods, post\-processing filters,<br>or for more accurately comparing subtle effects of potentially biased rendering techniques<br>which may be hard to see through noise and filtering\.<br>It is also useful for higher quality artistic renders of a scene beyond what is possible in real\-time\.|
835836
|rtx.useHighlightLegacyMode|bool|False||||
836-
|rtx.useHighlightUnsafeAnchorMode|bool|False||||
837-
|rtx.useHighlightUnsafeReplacementMode|bool|False||||
838837
|rtx.useIntersectionBillboardsOnPrimaryRays|bool|False||||
839838
|rtx.useLegacyACES|bool|True|||Use a luminance\-only approximation of ACES that over\-saturates the highlights\. If false, use a refined ACES transform that converts between color spaces with more precision\.|
840839
|rtx.useNewGuiInputMethod|bool|True|||Disables the previous method for getting mouse/keyboard input and enables a new method which should be more reliable\. If successful the old method will be deprecated\. This setting can't be changed at runtime, so it must be set in a \.conf file\.|

documentation/CONTRIBUTING-style-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This document outlines our project's C++ code formatting standards, commenting s
2626
- **Constants**: `k` prefix and camelCase, i.e. `kConstantName`
2727
- **Macros and defines**: UPPER_CASE
2828
- **Class and struct names**: PascalCase
29+
- **Functions**: Prefer a short **verb + object** name that matches vocabulary in the same subsystem (e.g. `registerCamera`, `mergeInstanceHeuristics`). Do not spell out mechanics (which container, per-frame reset); put that in a comment on the definition or call site.
2930
3031
```cpp
3132
class Example {

src/dxvk/dxvk_sampler.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "dxvk_resource.h"
44
// NV-DXVK start
55
#include "../util/xxHash/xxhash.h"
6+
#include "../util/util_struct_hash.h"
67
// NV-DXVK end
78

89
namespace dxvk {
@@ -44,9 +45,22 @@ namespace dxvk {
4445

4546
// NV-DXVK start
4647
XXH64_hash_t calculateHash() const {
47-
static_assert(sizeof(DxvkSamplerCreateInfo) == 72 && "DxvkSamplerCreateInfo changed. Double check the struct is still fully padded and initialized. This is needed for used hashing and comparison functions.");
48-
49-
return XXH3_64bits(this, sizeof(DxvkSamplerCreateInfo));
48+
return hashStructByMemory(*this,
49+
&DxvkSamplerCreateInfo::magFilter,
50+
&DxvkSamplerCreateInfo::minFilter,
51+
&DxvkSamplerCreateInfo::mipmapMode,
52+
&DxvkSamplerCreateInfo::mipmapLodBias,
53+
&DxvkSamplerCreateInfo::mipmapLodMin,
54+
&DxvkSamplerCreateInfo::mipmapLodMax,
55+
&DxvkSamplerCreateInfo::useAnisotropy,
56+
&DxvkSamplerCreateInfo::maxAnisotropy,
57+
&DxvkSamplerCreateInfo::addressModeU,
58+
&DxvkSamplerCreateInfo::addressModeV,
59+
&DxvkSamplerCreateInfo::addressModeW,
60+
&DxvkSamplerCreateInfo::compareToDepth,
61+
&DxvkSamplerCreateInfo::compareOp,
62+
&DxvkSamplerCreateInfo::borderColor,
63+
&DxvkSamplerCreateInfo::usePixelCoord);
5064
}
5165

5266
bool operator== (const DxvkSamplerCreateInfo& other) const {

src/dxvk/imgui/dxvk_imgui.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,7 @@ namespace dxvk {
16371637

16381638
if (RemixGui::CollapsingHeader("Developer Options", collapsingHeaderFlags)) {
16391639
ImGui::Indent();
1640+
RemixGui::Checkbox("Enable Preserve Path", &RtxOptions::enablePreservePathObject());
16401641
RemixGui::Checkbox("Enable Instance Debugging", &RtxOptions::enableInstanceDebuggingToolsObject());
16411642
RemixGui::Checkbox("Disable Draw Calls Post RTX Injection", &RtxOptions::skipDrawCallsPostRTXInjectionObject());
16421643
RemixGui::Checkbox("Break into Debugger On Press of Key 'B'", &RtxOptions::enableBreakIntoDebuggerOnPressingBObject());
@@ -2543,8 +2544,6 @@ namespace dxvk {
25432544
ImGui::EndDisabled();
25442545
RemixGui::Separator();
25452546
RemixGui::Checkbox("Highlight Legacy Materials (flash red)", &RtxOptions::useHighlightLegacyModeObject());
2546-
RemixGui::Checkbox("Highlight Legacy Meshes with Shared Vertex Buffers (dull purple)", &RtxOptions::useHighlightUnsafeAnchorModeObject());
2547-
RemixGui::Checkbox("Highlight Replacements with Unstable Anchors (flash red)", &RtxOptions::useHighlightUnsafeReplacementModeObject());
25482547

25492548
}
25502549

src/dxvk/rtx_render/rtx_accel_manager.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,6 @@ namespace dxvk {
11721172
uint32_t primitiveCount;
11731173
uint32_t pad;
11741174
};
1175-
static_assert(sizeof(BucketGeometryContentHashData) == 80, "BucketGeometryContentHashData must remain fully padded for stable hashing.");
11761175
std::vector<BucketGeometryContentHashData> contentHashData;
11771176

11781177
// Create or find a matching BLAS for each bucket, then build it
@@ -1252,7 +1251,13 @@ namespace dxvk {
12521251
// Geometry order is part of the merged BLAS layout and affects primitive
12531252
// to surface mapping, so include the bucket order in the content hash.
12541253
if (!contentHashData.empty()) {
1255-
newContentHash = XXH3_64bits(contentHashData.data(), contentHashData.size() * sizeof(contentHashData[0]));
1254+
newContentHash = hashStructArrayByMemory(contentHashData.data(), contentHashData.size(),
1255+
&BucketGeometryContentHashData::vertexHash,
1256+
&BucketGeometryContentHashData::indexHash,
1257+
&BucketGeometryContentHashData::boneHash,
1258+
&BucketGeometryContentHashData::transform,
1259+
&BucketGeometryContentHashData::primitiveCount,
1260+
&BucketGeometryContentHashData::pad);
12561261
}
12571262
}
12581263

src/dxvk/rtx_render/rtx_accel_manager.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "rtx_point_instancer_system.h"
3333
#include "../util/util_vector.h"
3434
#include "../util/util_matrix.h"
35+
#include "../util/util_struct_hash.h"
3536

3637
namespace dxvk
3738
{
@@ -90,11 +91,17 @@ class AccelManager : public CommonDeviceObject {
9091
isSubsurface == other.isSubsurface;
9192
}
9293
};
93-
static_assert(sizeof(BlasBucketKey) == 16, "BlasBucketKey must remain fully padded for stable hashing.");
9494

9595
struct BlasBucketKeyHash {
9696
size_t operator()(const BlasBucketKey& k) const {
97-
return static_cast<size_t>(XXH3_64bits(&k, sizeof(k)));
97+
return static_cast<size_t>(hashStructByMemory(k,
98+
&BlasBucketKey::instanceShaderBindingTableRecordOffset,
99+
&BlasBucketKey::customIndexFlags,
100+
&BlasBucketKey::instanceFlags,
101+
&BlasBucketKey::instanceMask,
102+
&BlasBucketKey::usesUnorderedApproximations,
103+
&BlasBucketKey::isSubsurface,
104+
&BlasBucketKey::pad));
98105
}
99106
};
100107

src/dxvk/rtx_render/rtx_debug_view.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ namespace dxvk {
7070
{DEBUG_VIEW_BARYCENTRICS, "Barycentric Coordinates"},
7171
{DEBUG_VIEW_IS_FRONT_HIT, "Is Front Hit"},
7272
{DEBUG_VIEW_IS_STATIC, "Is Static"},
73+
{DEBUG_VIEW_PRESERVE_PATH, "Preserve path (preserved instances)"},
7374
{DEBUG_VIEW_IS_OPAQUE, "Is Opaque"},
7475
{DEBUG_VIEW_IS_THIN_OPAQUE, "Is Thin Opaque"},
7576
{DEBUG_VIEW_IS_SUBSURFACE_SCATTERING, "Is Subsurface Scattering (SSS)"},

0 commit comments

Comments
 (0)