Skip to content

Commit

Permalink
[REMIX-2823] Avoid capturing virtual instances
Browse files Browse the repository at this point in the history
- Fix bug wherein strange duplicates of instances were appearing. Avoid capturing virtual instances seems to do the trick.
  • Loading branch information
nv-nfreybler committed May 6, 2024
2 parents 8b18ad0 + 4c4e0f3 commit a911c31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/dxvk/rtx_render/rtx_game_capturer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,23 @@ namespace dxvk {
for (const RtInstance* pRtInstance : m_sceneManager.getInstanceTable()) {
assert(pRtInstance->getBlas() != nullptr);

const XXH64_hash_t instanceId = pRtInstance->getId();
if (instanceId == UINT64_MAX) {
// Ignore "virtual" instances, as they are used primarily for special render
// passes, rather than representing real entities that we want captured
continue;
}
assert(instanceId != UINT64_MAX);

if (pRtInstance->getBlas()->input.cameraType == CameraType::Sky) {
if (!m_pCap->bSkyProbeBaked) {
const std::string skyProbeFilname = getBakedSkyProbeName(m_pCap->instance.stageName);
m_exporter.bakeSkyProbe(ctx, BASE_DIR + lss::commonDirName::texDir, skyProbeFilname);
const std::string skyProbeFilename = getBakedSkyProbeName(m_pCap->instance.stageName);
m_exporter.bakeSkyProbe(ctx, BASE_DIR + lss::commonDirName::texDir, skyProbeFilename);
m_pCap->bSkyProbeBaked = true;
Logger::debug("[GameCapturer][" + m_pCap->idStr + "][SkyProbe] Bake scheduled to " + skyProbeFilname);
Logger::debug("[GameCapturer][" + m_pCap->idStr + "][SkyProbe] Bake scheduled to " + skyProbeFilename);
}
}

const XXH64_hash_t instanceId = pRtInstance->getId();
const uint8_t instanceFlags = m_pCap->instanceFlags[instanceId];
const bool bIsNew = m_pCap->instances.count(instanceId) == 0;
const bool bPointsUpdate = checkInstanceUpdateFlag(instanceFlags, InstFlag::PositionsUpdate);
Expand Down
3 changes: 3 additions & 0 deletions src/dxvk/rtx_render/rtx_instance_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ class RtInstance {
void onTransformChanged();
friend class InstanceManager;

// Unique ID of the RtInstance.
// Sentinel value UINT64_MAX indicates that such RtInstance is a "virtual" instance, and is ignored by some features,
// most notably the GameCapturer
const uint64_t m_id;
mutable uint32_t m_instanceVectorId; // Index within instance vector in instance manager

Expand Down

0 comments on commit a911c31

Please sign in to comment.