ctx->stencil_ref.ref_value[0]);
}
+ if (screen->info.have_EXT_extended_dynamic_state) {
+ screen->vk_CmdSetDepthBoundsTestEnableEXT(batch->state->cmdbuf, dsa_state->hw_state.depth_bounds_test);
+ if (dsa_state->hw_state.depth_bounds_test)
+ vkCmdSetDepthBounds(batch->state->cmdbuf,
+ dsa_state->hw_state.min_depth_bounds,
+ dsa_state->hw_state.max_depth_bounds);
+ screen->vk_CmdSetDepthTestEnableEXT(batch->state->cmdbuf, dsa_state->hw_state.depth_test);
+ if (dsa_state->hw_state.depth_test)
+ screen->vk_CmdSetDepthCompareOpEXT(batch->state->cmdbuf, dsa_state->hw_state.depth_compare_op);
+ screen->vk_CmdSetDepthWriteEnableEXT(batch->state->cmdbuf, dsa_state->hw_state.depth_write);
+ screen->vk_CmdSetStencilTestEnableEXT(batch->state->cmdbuf, dsa_state->hw_state.stencil_test);
+ if (dsa_state->hw_state.stencil_test) {
+ screen->vk_CmdSetStencilOpEXT(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_BIT,
+ dsa_state->hw_state.stencil_front.failOp,
+ dsa_state->hw_state.stencil_front.passOp,
+ dsa_state->hw_state.stencil_front.depthFailOp,
+ dsa_state->hw_state.stencil_front.compareOp);
+ screen->vk_CmdSetStencilOpEXT(batch->state->cmdbuf, VK_STENCIL_FACE_BACK_BIT,
+ dsa_state->hw_state.stencil_back.failOp,
+ dsa_state->hw_state.stencil_back.passOp,
+ dsa_state->hw_state.stencil_back.depthFailOp,
+ dsa_state->hw_state.stencil_back.compareOp);
+ }
+ if (dsa_state->base.stencil[0].enabled) {
+ if (dsa_state->base.stencil[1].enabled) {
+ vkCmdSetStencilWriteMask(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_BIT, dsa_state->hw_state.stencil_front.writeMask);
+ vkCmdSetStencilWriteMask(batch->state->cmdbuf, VK_STENCIL_FACE_BACK_BIT, dsa_state->hw_state.stencil_back.writeMask);
+ vkCmdSetStencilCompareMask(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_BIT, dsa_state->hw_state.stencil_front.compareMask);
+ vkCmdSetStencilCompareMask(batch->state->cmdbuf, VK_STENCIL_FACE_BACK_BIT, dsa_state->hw_state.stencil_back.compareMask);
+ } else {
+ vkCmdSetStencilWriteMask(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_AND_BACK, dsa_state->hw_state.stencil_front.writeMask);
+ vkCmdSetStencilCompareMask(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_AND_BACK, dsa_state->hw_state.stencil_front.compareMask);
+ }
+ }
+ }
+
if (depth_bias)
vkCmdSetDepthBias(batch->state->cmdbuf, rast_state->offset_units, rast_state->offset_clamp, rast_state->offset_scale);
else
if (screen->info.have_EXT_extended_dynamic_state) {
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_WRITE_MASK;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_OP_EXT;
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT;
} else {
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VIEWPORT;
struct zink_rasterizer_hw_state *rast_state;
- struct zink_depth_stencil_alpha_hw_state *depth_stencil_alpha_state;
-
VkSampleMask sample_mask;
uint8_t rast_samples;
uint8_t vertices_per_patch;
uint32_t hash;
bool dirty;
+ struct zink_depth_stencil_alpha_hw_state *depth_stencil_alpha_state; //non-dynamic state
+
VkShaderModule modules[PIPE_SHADER_TYPES - 1];
uint32_t module_hash;
static uint32_t
hash_gfx_pipeline_state(const void *key)
{
- return _mesa_hash_data(key, offsetof(struct zink_gfx_pipeline_state, hash));
+ const struct zink_gfx_pipeline_state *state = key;
+ uint32_t hash = _mesa_hash_data(key, offsetof(struct zink_gfx_pipeline_state, hash));
+ if (state->have_EXT_extended_dynamic_state)
+ return hash;
+ return XXH32(&state->depth_stencil_alpha_state, sizeof(void*), hash);
}
static bool
if (sa->vertex_strides[idx_a] != sb->vertex_strides[idx_b])
return false;
}
+ if (!!sa->depth_stencil_alpha_state != !!sb->depth_stencil_alpha_state ||
+ (sa && sb && memcmp(sa->depth_stencil_alpha_state, sb->depth_stencil_alpha_state, sizeof(struct zink_depth_stencil_alpha_hw_state))))
+ return false;
}
return !memcmp(sa->modules, sb->modules, sizeof(sa->modules)) &&
!memcmp(a, b, offsetof(struct zink_gfx_pipeline_state, hash));
if (screen->info.have_EXT_extended_dynamic_state) {
GET_PROC_ADDR(CmdSetViewportWithCountEXT);
GET_PROC_ADDR(CmdSetScissorWithCountEXT);
+ GET_PROC_ADDR(CmdSetDepthBoundsTestEnableEXT);
+ GET_PROC_ADDR(CmdSetDepthCompareOpEXT);
+ GET_PROC_ADDR(CmdSetDepthTestEnableEXT);
+ GET_PROC_ADDR(CmdSetDepthWriteEnableEXT);
+ GET_PROC_ADDR(CmdSetStencilOpEXT);
+ GET_PROC_ADDR(CmdSetStencilTestEnableEXT);
GET_PROC_ADDR(CmdBindVertexBuffers2EXT);
}
PFN_vkCmdSetViewportWithCountEXT vk_CmdSetViewportWithCountEXT;
PFN_vkCmdSetScissorWithCountEXT vk_CmdSetScissorWithCountEXT;
+ PFN_vkCmdSetDepthBoundsTestEnableEXT vk_CmdSetDepthBoundsTestEnableEXT;
+ PFN_vkCmdSetDepthCompareOpEXT vk_CmdSetDepthCompareOpEXT;
+ PFN_vkCmdSetDepthTestEnableEXT vk_CmdSetDepthTestEnableEXT;
+ PFN_vkCmdSetDepthWriteEnableEXT vk_CmdSetDepthWriteEnableEXT;
+ PFN_vkCmdSetStencilTestEnableEXT vk_CmdSetStencilTestEnableEXT;
+ PFN_vkCmdSetStencilOpEXT vk_CmdSetStencilOpEXT;
PFN_vkCmdBindVertexBuffers2EXT vk_CmdBindVertexBuffers2EXT;
PFN_vkCreateDebugUtilsMessengerEXT vk_CreateDebugUtilsMessengerEXT;
struct zink_gfx_pipeline_state *state = &ctx->gfx_pipeline_state;
if (state->depth_stencil_alpha_state != &ctx->dsa_state->hw_state) {
state->depth_stencil_alpha_state = &ctx->dsa_state->hw_state;
- state->dirty = true;
+ state->dirty |= !zink_screen(pctx->screen)->info.have_EXT_extended_dynamic_state;
}
}
}