Skip to content

Commit b1d8b1f

Browse files
committed
Cleaned up connection of State to CommandBuffer
1 parent bc4ce60 commit b1d8b1f

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

include/vsg/vk/State.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ namespace vsg
263263

264264
void reserve(const Slots& in_maxSlots);
265265

266+
void connect(ref_ptr<CommandBuffer> commandBuffer);
267+
266268
void reset();
267269

268270
inline void dirtyStateStacks()

src/vsg/app/CommandGraph.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ void CommandGraph::record(ref_ptr<RecordedCommandBuffers> recordedCommandBuffers
114114

115115
commandBuffer->numDependentSubmissions().fetch_add(1);
116116

117-
commandBuffer->state = recordTraversal->getState();
118-
recordTraversal->getState()->_commandBuffer = commandBuffer;
119-
recordTraversal->getState()->reset();
117+
recordTraversal->getState()->connect(commandBuffer);
120118

121119
// or select index when maps to a dormant CommandBuffer
122120
VkCommandBuffer vk_commandBuffer = *commandBuffer;

src/vsg/vk/State.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ void State::reset()
4444
activeMaxStateSlot = maxSlots.max();
4545
}
4646

47+
void State::connect(ref_ptr<CommandBuffer> commandBuffer)
48+
{
49+
_commandBuffer = commandBuffer;
50+
commandBuffer->state = this;
51+
reset();
52+
}
53+
4754
void State::pushView(ref_ptr<StateCommand> command)
4855
{
4956
stateStacks[command->slot].push(command);

0 commit comments

Comments
 (0)