const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS])
{
struct tgsi_exec_machine *machine = shader->machine;
-
+ int j;
tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
constants, constants_size);
+
+ if (shader->info.uses_invocationid) {
+ unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INVOCATIONID];
+ for (j = 0; j < TGSI_QUAD_SIZE; j++)
+ machine->SystemValue[i].i[j] = shader->invocation_id;
+ }
}
static unsigned tgsi_gs_run(struct draw_geometry_shader *shader,
* overflown vertices into some area where they won't harm anyone */
unsigned total_verts_per_buffer = shader->primitive_boundary *
num_in_primitives;
-
+ unsigned invocation;
//Assume at least one primitive
max_out_prims = MAX2(max_out_prims, 1);
output_verts->stride = output_verts->vertex_size;
output_verts->verts =
(struct vertex_header *)MALLOC(output_verts->vertex_size *
- total_verts_per_buffer);
+ total_verts_per_buffer * shader->num_invocations);
debug_assert(output_verts->verts);
#if 0
shader->input = input;
shader->input_info = input_info;
FREE(shader->primitive_lengths);
- shader->primitive_lengths = MALLOC(max_out_prims * sizeof(unsigned));
+ shader->primitive_lengths = MALLOC(max_out_prims * sizeof(unsigned) * shader->num_invocations);
#ifdef HAVE_LLVM
}
#endif
- shader->prepare(shader, constants, constants_size);
+ for (invocation = 0; invocation < shader->num_invocations; invocation++) {
+ shader->invocation_id = invocation;
- if (input_prim->linear)
- gs_run(shader, input_prim, input_verts,
- output_prims, output_verts);
- else
- gs_run_elts(shader, input_prim, input_verts,
- output_prims, output_verts);
+ shader->prepare(shader, constants, constants_size);
- /* Flush the remaining primitives. Will happen if
- * num_input_primitives % 4 != 0
- */
- if (shader->fetched_prim_count > 0) {
- gs_flush(shader);
- }
+ if (input_prim->linear)
+ gs_run(shader, input_prim, input_verts,
+ output_prims, output_verts);
+ else
+ gs_run_elts(shader, input_prim, input_verts,
+ output_prims, output_verts);
- debug_assert(shader->fetched_prim_count == 0);
+ /* Flush the remaining primitives. Will happen if
+ * num_input_primitives % 4 != 0
+ */
+ if (shader->fetched_prim_count > 0) {
+ gs_flush(shader);
+ }
+ debug_assert(shader->fetched_prim_count == 0);
+ }
/* Update prim_info:
*/
gs->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM];
gs->max_output_vertices =
gs->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
+ gs->num_invocations =
+ gs->info.properties[TGSI_PROPERTY_GS_INVOCATIONS];
if (!gs->max_output_vertices)
gs->max_output_vertices = 32;