static struct zink_gfx_program *
get_gfx_program(struct zink_context *ctx)
{
- if (ctx->dirty_program) {
+ if (ctx->dirty_shader_stages) {
struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache,
ctx->gfx_stages);
if (!entry) {
struct zink_gfx_program *prog;
prog = zink_create_gfx_program(ctx, ctx->gfx_stages);
- entry = _mesa_hash_table_insert(ctx->program_cache, prog->stages, prog);
+ entry = _mesa_hash_table_insert(ctx->program_cache, prog->shaders, prog);
if (!entry)
return NULL;
}
ctx->curr_program = entry->data;
- ctx->dirty_program = false;
+ ctx->dirty_shader_stages = 0;
}
assert(ctx->curr_program);
}
}
+static inline bool
+restart_supported(enum pipe_prim_type mode)
+{
+ return mode == PIPE_PRIM_LINE_STRIP || mode == PIPE_PRIM_TRIANGLE_STRIP || mode == PIPE_PRIM_TRIANGLE_FAN;
+}
+
void
zink_draw_vbo(struct pipe_context *pctx,
const struct pipe_draw_info *dinfo)
VkDeviceSize counter_buffer_offsets[PIPE_MAX_SO_OUTPUTS] = {};
bool need_index_buffer_unref = false;
+
+ if (dinfo->primitive_restart && !restart_supported(dinfo->mode)) {
+ util_draw_vbo_without_prim_restart(pctx, dinfo);
+ return;
+ }
if (dinfo->mode >= PIPE_PRIM_QUADS ||
dinfo->mode == PIPE_PRIM_LINE_LOOP) {
if (!u_trim_pipe_prim(dinfo->mode, (unsigned *)&dinfo->count))
if (!gfx_program)
return;
- /* this is broken for anything requiring primconvert atm */
+ if (ctx->gfx_pipeline_state.primitive_restart != !!dinfo->primitive_restart)
+ ctx->gfx_pipeline_state.hash = 0;
ctx->gfx_pipeline_state.primitive_restart = !!dinfo->primitive_restart;
VkPipeline pipeline = zink_get_gfx_pipeline(screen, gfx_program,
if (i == MESA_SHADER_VERTEX && ctx->num_so_targets) {
for (unsigned i = 0; i < ctx->num_so_targets; i++) {
struct zink_so_target *t = zink_so_target(ctx->so_targets[i]);
- t->stride = shader->stream_output.stride[i] * sizeof(uint32_t);
+ t->stride = shader->streamout.so_info.stride[i] * sizeof(uint32_t);
}
}
batch = zink_batch_rp(ctx);
assert(batch->descs_left >= gfx_program->num_descriptors);
}
+ zink_batch_reference_program(batch, ctx->curr_program);
VkDescriptorSet desc_set = allocate_descriptor_set(screen, batch,
gfx_program);