Skip to content

Commit f6303c2

Browse files
committed
Fixed build by reorganizing where mask is defined.
1 parent 10d0f49 commit f6303c2

5 files changed

Lines changed: 23 additions & 25 deletions

File tree

include/vsg/app/CommandGraph.h

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

4646
ref_ptr<RecordTraversal> getOrCreateRecordTraversal();
4747

include/vsg/vk/CommandBuffer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ 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+
2837
/// CommandBuffer encapsulates VkCommandBuffer
2938
class VSG_DECLSPEC CommandBuffer : public Inherit<Object, CommandBuffer>
3039
{

include/vsg/vk/State.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace vsg
3939
Stack stack;
4040
size_t pos = 0;
4141

42-
StateStack& operator = (const StateStack& rhs)
42+
StateStack& operator=(const StateStack& rhs)
4343
{
4444
stack = rhs.stack;
4545
pos = rhs.pos;
@@ -102,7 +102,7 @@ namespace vsg
102102
uint32_t offset = 0;
103103
bool dirty = false;
104104

105-
MatrixStack& operator = (const MatrixStack& rhs)
105+
MatrixStack& operator=(const MatrixStack& rhs)
106106
{
107107
matrixStack = rhs.matrixStack;
108108
offset = rhs.offset;
@@ -168,7 +168,6 @@ namespace vsg
168168
return;
169169
}
170170

171-
172171
// make sure matrix is a float matrix.
173172
mat4 newmatrix(matrixStack.top());
174173
vkCmdPushConstants(commandBuffer, pipeline, stageFlags, offset, sizeof(newmatrix), newmatrix.data());
@@ -286,16 +285,8 @@ namespace vsg
286285

287286
void reset();
288287

289-
enum InheritanceMask
290-
{
291-
INHERIT_STATE = (1<<0),
292-
INHERIT_VIEWPORT_STATE_HINT = (1<<1),
293-
INHERIT_VIEWPOINT = (1<<2),
294-
INHERIT_MATRICES = (1<<4)
295-
INHERIT_ALL = INHERIT_STATE | INHERIT_VIEWPORT_STATE_HINT | INHERIT_VIEWPOINT | INHERIT_MATRICES;
296-
};
297288

298-
void inherit(State& state, InheritanceMask inheritanceMask = INHERIT_ALL);
289+
void inherit(State& state, StateInheritanceMask inheritanceMask = StateInheritanceMask::INHERIT_ALL);
299290

300291
inline void dirtyStateStacks()
301292
{

src/vsg/app/RecordTraversal.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,15 +670,13 @@ void RecordTraversal::apply(const CommandGraph& commandGraph)
670670
auto cg = const_cast<CommandGraph*>(&commandGraph);
671671
if (cg->device)
672672
{
673-
674673
cg->getOrCreateRecordTraversal()->_state->inherit(*_state, cg->stateInheritanceMask);
675674

676-
if (_viewDependentState && _viewDependentState->view && (_viewDependentState->view->features & INHERIT_VIEWPOINT)!=0))
677-
{
678-
auto camera = _viewDependentState->view->camera;
679-
if(camera) cg->getOrCreateRecordTraversal()->_state->setInhertiedViewProjectionAndViewMatrix(camera->projectionMatrix->transform(), camera->viewMatrix->transform());
680-
}
681-
675+
if (_viewDependentState && _viewDependentState->view && (_viewDependentState->view->features & INHERIT_VIEWPOINT) != 0)
676+
{
677+
auto camera = _viewDependentState->view->camera;
678+
if (camera) cg->getOrCreateRecordTraversal()->_state->setInhertiedViewProjectionAndViewMatrix(camera->projectionMatrix->transform(), camera->viewMatrix->transform());
679+
}
682680

683681
cg->record(recordedCommandBuffers, _frameStamp, _databasePager);
684682
}

src/vsg/vk/State.cpp

Lines changed: 5 additions & 5 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)
81+
void State::inherit(State& state, StateInheritanceMask inheritanceMask)
8282
{
8383
reset();
8484

8585
dirty = true;
8686
maxSlots = state.maxSlots;
8787
activeMaxStateSlot = state.activeMaxStateSlot;
8888

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

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

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

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

0 commit comments

Comments
 (0)