_mesa_hash_table_init(&ctx->batch_states, ctx, NULL, _mesa_key_pointer_equal);
ctx->gfx_pipeline_state.have_EXT_extended_dynamic_state = screen->info.have_EXT_extended_dynamic_state;
+ ctx->gfx_pipeline_state.have_EXT_extended_dynamic_state2 = screen->info.have_EXT_extended_dynamic_state2;
slab_create_child(&ctx->transfer_pool, &screen->transfer_pool);
slab_create_child(&ctx->transfer_pool_unsync, &screen->transfer_pool);
bool gfx_dirty;
bool is_device_lost;
+ bool primitive_restart;
bool vertex_state_changed : 1;
bool blend_state_changed : 1;
bool rast_state_changed : 1;
}
ctx->gfx_prim_mode = mode;
- if (ctx->gfx_pipeline_state.primitive_restart != dinfo->primitive_restart)
- ctx->gfx_pipeline_state.dirty = true;
- ctx->gfx_pipeline_state.primitive_restart = dinfo->primitive_restart;
+ if (!HAS_DYNAMIC_STATE2) {
+ if (ctx->gfx_pipeline_state.primitive_restart != dinfo->primitive_restart)
+ ctx->gfx_pipeline_state.dirty = true;
+ ctx->gfx_pipeline_state.primitive_restart = dinfo->primitive_restart;
+ }
unsigned index_offset = 0;
unsigned index_size = dinfo->index_size;
screen->vk.CmdSetPrimitiveTopologyEXT(batch->state->cmdbuf, zink_primitive_topology(mode));
}
+ if (HAS_DYNAMIC_STATE2 && (BATCH_CHANGED || ctx->primitive_restart != dinfo->primitive_restart)) {
+ screen->vk.CmdSetPrimitiveRestartEnableEXT(batch->state->cmdbuf, dinfo->primitive_restart);
+ ctx->primitive_restart = dinfo->primitive_restart;
+ }
+
if (zink_program_has_descriptors(&ctx->curr_program->base))
screen->descriptors_update(ctx, false);
VkPipelineInputAssemblyStateCreateInfo primitive_state = {0};
primitive_state.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
primitive_state.topology = primitive_topology;
- switch (primitive_topology) {
- case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
- case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- if (state->primitive_restart)
- debug_printf("restart_index set with unsupported primitive topology %u\n", primitive_topology);
- primitive_state.primitiveRestartEnable = VK_FALSE;
- break;
- default:
- primitive_state.primitiveRestartEnable = state->primitive_restart ? VK_TRUE : VK_FALSE;
+ if (!screen->info.have_EXT_extended_dynamic_state2) {
+ switch (primitive_topology) {
+ case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+ case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
+ case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
+ case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
+ if (state->primitive_restart)
+ debug_printf("restart_index set with unsupported primitive topology %u\n", primitive_topology);
+ primitive_state.primitiveRestartEnable = VK_FALSE;
+ break;
+ default:
+ primitive_state.primitiveRestartEnable = state->primitive_restart ? VK_TRUE : VK_FALSE;
+ }
}
VkPipelineColorBlendAttachmentState blend_att[PIPE_MAX_COLOR_BUFS];
if (screen->info.have_EXT_vertex_input_dynamic_state) {
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_EXT;
}
+ if (screen->info.have_EXT_extended_dynamic_state2)
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT;
VkPipelineRasterizationLineStateCreateInfoEXT rast_line_state;
if (screen->info.have_EXT_line_rasterization) {
unsigned num_viewports;
- bool primitive_restart;
-
/* Pre-hashed value for table lookup, invalid when zero.
* Members after this point are not included in pipeline state hash key */
uint32_t hash;
struct zink_depth_stencil_alpha_hw_state *depth_stencil_alpha_state; //non-dynamic state
VkFrontFace front_face;
+
+ bool primitive_restart; //dynamic state2
VkShaderModule modules[PIPE_SHADER_TYPES - 1];
uint32_t module_hash;
uint32_t vertex_strides[PIPE_MAX_ATTRIBS];
bool sample_locations_enabled;
bool have_EXT_extended_dynamic_state;
-
+ bool have_EXT_extended_dynamic_state2;
VkPipeline pipeline;
uint8_t patch_vertices;
unsigned idx : 8;
{
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_state2)
+ hash = XXH32(&state->primitive_restart, 1, hash);
if (state->have_EXT_extended_dynamic_state)
return hash;
return XXH32(&state->depth_stencil_alpha_state, sizeof(void*), hash);
memcmp(sa->depth_stencil_alpha_state, sb->depth_stencil_alpha_state, sizeof(struct zink_depth_stencil_alpha_hw_state)))
return false;
}
+ if (!sa->have_EXT_extended_dynamic_state2) {
+ if (sa->primitive_restart != sb->primitive_restart)
+ return false;
+ }
return !memcmp(sa->modules, sb->modules, sizeof(sa->modules)) &&
!memcmp(a, b, offsetof(struct zink_gfx_pipeline_state, hash));
}