aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobin@lunarg.com>2015-10-01 09:24:40 -0600
committerTobin Ehlis <tobin@lunarg.com>2015-10-01 10:11:10 -0600
commitcf76ad166e14c1bdc24aa2d9051d0a0e0c90ae86 (patch)
treea3c6b94e41382b4d747d477c0ce7ae6e43b0e09f
parent8b772df4c35a66c543b52011821b4337ab4d599a (diff)
downloadusermoji-cf76ad166e14c1bdc24aa2d9051d0a0e0c90ae86.tar.xz
layers: Fix DrawState to correctly handle dynamic state from PSO and CmdSet* calls
Track which dynamic states are set via PSO and merge that with dynamic state set by CmdSet* cmds. Updated viewport not set test to pass when scissor is flagged as missing. Currently scissor and viewport set together so scissor error masks viewport error.
-rw-r--r--layers/draw_state.cpp25
-rw-r--r--layers/draw_state.h1
2 files changed, 16 insertions, 10 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 30e4ade9..646fff77 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1151,41 +1151,46 @@ static void set_cb_pso_status(GLOBAL_CB_NODE* pCB, const PIPELINE_NODE* pPipe)
pCB->status |= CBSTATUS_STENCIL_TEST_ENABLE;
}
if (pPipe->dynStateCI.dynamicStateCount) {
- // Account for any dynamic state set via this PSO
+ // Account for any dynamic state not set via this PSO
+ // First consider all state on
+ // Then unset any state that's noted as dynamic in PSO
+ // Finally OR that into CB statemask
+ CBStatusFlags psoDynStateMask = CBSTATUS_ALL;
for (uint32_t i=0; i < pPipe->dynStateCI.dynamicStateCount; i++) {
switch (pPipe->dynStateCI.pDynamicStates[i]) {
case VK_DYNAMIC_STATE_VIEWPORT:
- pCB->status |= CBSTATUS_VIEWPORT_SET;
+ psoDynStateMask &= ~CBSTATUS_VIEWPORT_SET;
break;
case VK_DYNAMIC_STATE_SCISSOR:
- pCB->status |= CBSTATUS_SCISSOR_SET;
+ psoDynStateMask &= ~CBSTATUS_SCISSOR_SET;
break;
case VK_DYNAMIC_STATE_LINE_WIDTH:
- pCB->status |= CBSTATUS_LINE_WIDTH_SET;
+ psoDynStateMask &= ~CBSTATUS_LINE_WIDTH_SET;
break;
case VK_DYNAMIC_STATE_DEPTH_BIAS:
- pCB->status |= CBSTATUS_DEPTH_BIAS_SET;
+ psoDynStateMask &= ~CBSTATUS_DEPTH_BIAS_SET;
break;
case VK_DYNAMIC_STATE_BLEND_CONSTANTS:
- pCB->status |= CBSTATUS_BLEND_SET;
+ psoDynStateMask &= ~CBSTATUS_BLEND_SET;
break;
case VK_DYNAMIC_STATE_DEPTH_BOUNDS:
- pCB->status |= CBSTATUS_DEPTH_BOUNDS_SET;
+ psoDynStateMask &= ~CBSTATUS_DEPTH_BOUNDS_SET;
break;
case VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK:
- pCB->status |= CBSTATUS_STENCIL_READ_MASK_SET;
+ psoDynStateMask &= ~CBSTATUS_STENCIL_READ_MASK_SET;
break;
case VK_DYNAMIC_STATE_STENCIL_WRITE_MASK:
- pCB->status |= CBSTATUS_STENCIL_WRITE_MASK_SET;
+ psoDynStateMask &= ~CBSTATUS_STENCIL_WRITE_MASK_SET;
break;
case VK_DYNAMIC_STATE_STENCIL_REFERENCE:
- pCB->status |= CBSTATUS_STENCIL_REFERENCE_SET;
+ psoDynStateMask &= ~CBSTATUS_STENCIL_REFERENCE_SET;
break;
default:
// TODO : Flag error here
break;
}
}
+ pCB->status |= psoDynStateMask;
}
}
// Print the last bound Gfx Pipeline
diff --git a/layers/draw_state.h b/layers/draw_state.h
index c84eb2e7..8f583cec 100644
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -246,6 +246,7 @@ typedef enum _CBStatusFlagBits
CBSTATUS_STENCIL_REFERENCE_SET = 0x00000400, // Stencil reference has been set
CBSTATUS_INDEX_BUFFER_BOUND = 0x00000800, // Index buffer has been set
CBSTATUS_SCISSOR_SET = 0x00001000, // Scissor has been set
+ CBSTATUS_ALL = 0x00001FFF, // All dynamic state set
} CBStatusFlagBits;
typedef struct stencil_data {