Skip to content

Commit bffceb8

Browse files
committed
Mopved inihertance mask into vsg::State.
1 parent f6303c2 commit bffceb8

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

include/vsg/app/CommandGraph.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ namespace vsg
4141
int presentFamily = -1;
4242
int submitOrder = 0;
4343
Slots maxSlots;
44-
StateInheritanceMask stateInheritanceMask = StateInheritanceMask::INHERIT_ALL;
4544

4645
ref_ptr<RecordTraversal> getOrCreateRecordTraversal();
4746

include/vsg/vk/CommandBuffer.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ namespace vsg
2525
class InstanceNode;
2626
class State;
2727

28-
enum StateInheritanceMask : unsigned int
29-
{
30-
INHERIT_STATE = (1 << 0),
31-
INHERIT_VIEWPORT_STATE_HINT = (1 << 1),
32-
INHERIT_VIEWPOINTS = (1 << 2),
33-
INHERIT_MATRICES = (1 << 4),
34-
INHERIT_ALL = INHERIT_STATE | INHERIT_VIEWPORT_STATE_HINT | INHERIT_VIEWPOINTS | INHERIT_MATRICES
35-
};
36-
3728
/// CommandBuffer encapsulates VkCommandBuffer
3829
class VSG_DECLSPEC CommandBuffer : public Inherit<Object, CommandBuffer>
3930
{

include/vsg/vk/State.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,18 @@ namespace vsg
285285

286286
void reset();
287287

288+
enum InheritanceMask
289+
{
290+
INHERIT_STATE = (1 << 0),
291+
INHERIT_VIEWPORT_STATE_HINT = (1 << 1),
292+
INHERIT_VIEWPOINT = (1 << 2),
293+
INHERIT_MATRICES = (1 << 4),
294+
INHERIT_ALL = INHERIT_STATE | INHERIT_VIEWPORT_STATE_HINT | INHERIT_VIEWPOINT | INHERIT_MATRICES
295+
};
296+
297+
InheritanceMask inheritanceMask = InheritanceMask::INHERIT_ALL;
288298

289-
void inherit(State& state, StateInheritanceMask inheritanceMask = StateInheritanceMask::INHERIT_ALL);
299+
void inherit(State& state);
290300

291301
inline void dirtyStateStacks()
292302
{

src/vsg/app/RecordTraversal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ void RecordTraversal::apply(const CommandGraph& commandGraph)
670670
auto cg = const_cast<CommandGraph*>(&commandGraph);
671671
if (cg->device)
672672
{
673-
cg->getOrCreateRecordTraversal()->_state->inherit(*_state, cg->stateInheritanceMask);
673+
cg->getOrCreateRecordTraversal()->_state->inherit(*_state);
674674

675675
if (_viewDependentState && _viewDependentState->view && (_viewDependentState->view->features & INHERIT_VIEWPOINT) != 0)
676676
{

src/vsg/vk/State.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,33 +78,33 @@ void State::popView(const View& view)
7878
if ((viewportStateHint & DYNAMIC_VIEWPORTSTATE) && view.camera && view.camera->viewportState) popView(view.camera->viewportState);
7979
}
8080

81-
void State::inherit(State& state, StateInheritanceMask inheritanceMask)
81+
void State::inherit(State& state)
8282
{
83+
reserve(state.maxSlots);
84+
8385
reset();
8486

8587
dirty = true;
86-
maxSlots = state.maxSlots;
87-
activeMaxStateSlot = state.activeMaxStateSlot;
8888

89-
if ((inheritanceMask & StateInheritanceMask::INHERIT_VIEWPOINTS) != 0)
89+
if ((inheritanceMask & InheritanceMask::INHERIT_VIEWPOINT) != 0)
9090
{
9191
inheritViewForLODScaling = state.inheritViewForLODScaling;
9292
inheritedProjectionMatrix = state.inheritedProjectionMatrix;
9393
inheritedViewMatrix = state.inheritedViewMatrix;
9494
inheritedViewTransform = state.inheritedViewTransform;
9595
}
9696

97-
if ((inheritanceMask & StateInheritanceMask::INHERIT_STATE) != 0)
97+
if ((inheritanceMask & InheritanceMask::INHERIT_STATE) != 0)
9898
{
9999
stateStacks = state.stateStacks;
100100
}
101101

102-
if ((inheritanceMask & StateInheritanceMask::INHERIT_VIEWPORT_STATE_HINT) != 0)
102+
if ((inheritanceMask & InheritanceMask::INHERIT_VIEWPORT_STATE_HINT) != 0)
103103
{
104104
viewportStateHint = state.viewportStateHint;
105105
}
106106

107-
if ((inheritanceMask & StateInheritanceMask::INHERIT_MATRICES) != 0)
107+
if ((inheritanceMask & InheritanceMask::INHERIT_MATRICES) != 0)
108108
{
109109
projectionMatrixStack = state.projectionMatrixStack;
110110
modelviewMatrixStack = state.modelviewMatrixStack;

0 commit comments

Comments
 (0)