Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/vsg/app/RecordTraversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ namespace vsg
int32_t _minimumBinNumber = 0;
std::vector<ref_ptr<Bin>> _bins;
ref_ptr<ViewDependentState> _viewDependentState;

// Increment and decrement the view counter so we know if we are traversing a top-level view.
int32_t _viewCounter = 0;
};

} // namespace vsg
7 changes: 5 additions & 2 deletions src/vsg/app/RecordTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,9 @@ void RecordTraversal::apply(const View& view)
{
GPU_INSTRUMENTATION_L1_NCO(instrumentation, *getCommandBuffer(), "View", COLOR_RECORD_L1, &view);

// Reset the state at the start of a new view traversal.
_state->reset();
// Reset the state at the start of a new top-level view traversal.
if(_viewCounter == 0) _state->reset();
++_viewCounter;

// note, View::accept() updates the RecordTraversal's traversalMask
auto cached_traversalMask = _state->_commandBuffer->traversalMask;
Expand Down Expand Up @@ -659,6 +660,8 @@ void RecordTraversal::apply(const View& view)
cached_regionsOfInterest.swap(regionsOfInterest);
_state->_commandBuffer->traversalMask = cached_traversalMask;
_viewDependentState = cached_viewDependentState;

--_viewCounter;
}

void RecordTraversal::apply(const CommandGraph& commandGraph)
Expand Down
Loading