u_decomposed_prims_for_vertices(shader->output_primitive,
shader->max_output_vertices)
* num_in_primitives;
+ /* we allocate exactly one extra vertex per primitive to allow the GS to emit
+ * overflown vertices into some area where they won't harm anyone */
+ unsigned total_verts_per_buffer = shader->primitive_boundary *
+ num_in_primitives;
//Assume at least one primitive
max_out_prims = MAX2(max_out_prims, 1);
output_verts->vertex_size = vertex_size;
output_verts->stride = output_verts->vertex_size;
- /* we allocate exactly one extra vertex per primitive to allow the GS to emit
- * overflown vertices into some area where they won't harm anyone */
output_verts->verts =
(struct vertex_header *)MALLOC(output_verts->vertex_size *
- max_out_prims *
- shader->primitive_boundary);
+ total_verts_per_buffer);
+ debug_assert(output_verts->verts);
#if 0
debug_printf("%s count = %d (in prims # = %d)\n",
__FUNCTION__, num_input_verts, num_in_primitives);
debug_printf("\tlinear = %d, prim_info->count = %d\n",
input_prim->linear, input_prim->count);
- debug_printf("\tprim pipe = %s, shader in = %s, shader out = %s, max out = %d\n",
+ debug_printf("\tprim pipe = %s, shader in = %s, shader out = %s\n"
u_prim_name(input_prim->prim),
u_prim_name(shader->input_primitive),
- u_prim_name(shader->output_primitive),
- shader->max_output_vertices);
+ u_prim_name(shader->output_primitive));
+ debug_printf("\tmaxv = %d, maxp = %d, primitive_boundary = %d, "
+ "vertex_size = %d, tverts = %d\n",
+ shader->max_output_vertices, max_out_prims,
+ shader->primitive_boundary, output_verts->vertex_size,
+ total_verts_per_buffer);
#endif
shader->emitted_vertices = 0;