return TRUE;
}
+/*
+ * Called whenever we're starting to draw a new instance.
+ * Some internal structures don't want to have to reset internal
+ * members on each invocation (because their state might have to persist
+ * between multiple primitive restart rendering call) but might have to
+ * for each new instance.
+ * This is particularly the case for primitive id's in geometry shader.
+ */
+void draw_new_instance(struct draw_context *draw)
+{
+ draw_geometry_shader_new_instance(draw->gs.geometry_shader);
+}
+
void draw_destroy( struct draw_context *draw )
{
shader->emitted_primitives = 0;
shader->vertex_size = vertex_size;
shader->tmp_output = (float (*)[4])output_verts->verts->data;
- shader->in_prim_idx = 0;
shader->fetched_prim_count = 0;
shader->input_vertex_stride = input_stride;
shader->input = input;
shader->current_variant = variant;
}
#endif
+
+/*
+ * Called at the very begin of the draw call with a new instance
+ * Used to reset state that should persist between primitive restart.
+ */
+void
+draw_geometry_shader_new_instance(struct draw_geometry_shader *gs)
+{
+ if (!gs)
+ return;
+
+ gs->in_prim_idx = 0;
+}
unsigned input_primitives);
};
+void draw_geometry_shader_new_instance(struct draw_geometry_shader *gs);
+
/*
* Returns the number of vertices emitted.
* The vertex shader can emit any number of vertices as long as it's
* Draw common initialization code
*/
boolean draw_init(struct draw_context *draw);
+void draw_new_instance(struct draw_context *draw);
/*******************************************************************************
* Vertex shader code:
for (instance = 0; instance < info->instance_count; instance++) {
draw->instance_id = instance + info->start_instance;
+ draw_new_instance(draw);
+
if (info->primitive_restart) {
draw_pt_arrays_restart(draw, info);
}