Skip to content

Commit 89baba8

Browse files
Merge branch 'private/markh/fix-1077' into 'main'
[REMIX-5834] Fix UE1 viewmodels stuck in worldspace with multi-camera draws See merge request lightspeedrtx/dxvk-remix-nv!2269
2 parents 563418e + 6b7d6ca commit 89baba8

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/dxvk/rtx_render/rtx_instance_manager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,14 +1360,14 @@ namespace dxvk {
13601360
bool hasPreviousPositions,
13611361
bool isFirstUpdateThisFrame,
13621362
bool fireEvents) {
1363-
// Camera registration. Idempotent (RtInstance::m_seenCameraTypes is cumulative and never
1364-
// cleared), so calling it from updateInstance and again here is harmless. We need it on
1365-
// the preserve path because that path bypasses updateInstance entirely.
1366-
instance.registerCamera(drawCall.cameraType, m_device->getCurrentFrameId());
1363+
// Camera registration. This is per-instance, so this detects the first time an instance
1364+
// is drawn with a given camera each frame.
1365+
const bool isNewCameraTypeThisFrame =
1366+
instance.registerCamera(drawCall.cameraType, m_device->getCurrentFrameId());
13671367

13681368
// Re-register view-model candidates every frame; m_viewModelCandidates is cleared in
13691369
// onFrameEnd, and createViewModelInstances() iterates the list later in the frame.
1370-
if (drawCall.cameraType == CameraType::ViewModel && !instance.isHidden() && isFirstUpdateThisFrame) {
1370+
if (drawCall.cameraType == CameraType::ViewModel && !instance.isHidden() && isNewCameraTypeThisFrame) {
13711371
registerViewModelCandidate(instance);
13721372
}
13731373

@@ -1549,11 +1549,11 @@ namespace dxvk {
15491549
std::unordered_set<RtInstance*> activeViewModelReferences;
15501550
for (auto* candidateInstance : m_viewModelCandidates) {
15511551

1552-
// Valid view model instances must be associated only with the view model camera
1553-
// Check: exactly one bit set (power-of-two check via raw bitmask)
1554-
const auto seenMask = candidateInstance->m_seenCameraTypes.raw();
1555-
if (seenMask == 0 || (seenMask & (seenMask - 1)) != 0)
1552+
// A valid view-model reference must have been drawn with the view-model camera this
1553+
// frame.
1554+
if (!candidateInstance->isCameraRegistered(CameraType::ViewModel)) {
15561555
continue;
1556+
}
15571557

15581558
// Hide the reference instance since we'll create a separate instance for the view model
15591559
candidateInstance->m_vkInstance.mask = 0;

0 commit comments

Comments
 (0)