int vertex_count = 0;
int total_prims = 0;
int max_prims_per_invocation = 0;
- char *output_ptr = (char*)shader->gs_output;
+ char *output_ptr = (char*)shader->gs_output[stream];
int i, j, prim_idx;
unsigned next_prim_boundary = shader->primitive_boundary;
llvm_gs_run(struct draw_geometry_shader *shader,
unsigned input_primitives, unsigned *out_prims)
{
- unsigned ret;
- char *input = (char*)shader->gs_output;
-
- input += (shader->stream[0].emitted_vertices * shader->vertex_size);
+ struct vertex_header *input[PIPE_MAX_VERTEX_STREAMS];
+ for (unsigned i = 0; i < shader->num_vertex_streams; i++) {
+ char *tmp = (char *)shader->gs_output[i];
+ tmp += shader->stream[i].emitted_vertices * shader->vertex_size;
+ input[i] = (struct vertex_header *)tmp;
+ }
- ret = shader->current_variant->jit_func(
+ shader->current_variant->jit_func(
shader->jit_context, shader->gs_input->data,
- (struct vertex_header*)input,
+ input,
input_primitives,
shader->draw->instance_id,
shader->llvm_prim_ids,
shader->invocation_id);
- *out_prims = ret;
+ for (unsigned i = 0; i < shader->num_vertex_streams; i++) {
+ out_prims[i] = shader->jit_context->emitted_prims[i];
+ }
}
#endif
#ifdef LLVM_AVAILABLE
if (shader->draw->llvm) {
- shader->gs_output = output_verts[0].verts;
+ for (i = 0; i < shader->num_vertex_streams; i++) {
+ shader->gs_output[i] = output_verts[i].verts;
+ }
if (max_out_prims > shader->max_out_prims) {
unsigned i;
if (shader->llvm_prim_lengths) {
struct draw_gs_inputs *gs_input;
struct draw_gs_jit_context *jit_context;
struct draw_gs_llvm_variant *current_variant;
- struct vertex_header *gs_output;
+ struct vertex_header *gs_output[PIPE_MAX_VERTEX_STREAMS];
int **llvm_prim_lengths;
int *llvm_emitted_primitives;
indices[i] = LLVMBuildAdd(builder, indices[i], currently_emitted, "");
}
+ io = lp_build_pointer_get(builder, io, LLVMBuildExtractElement(builder, stream_id, lp_build_const_int32(gallivm, 0), ""));
+
convert_to_aos(gallivm, io, indices,
outputs, clipmask,
gs_info->num_outputs, gs_type,
arg_types[0] = get_gs_context_ptr_type(variant); /* context */
arg_types[1] = variant->input_array_type; /* input */
- arg_types[2] = variant->vertex_header_ptr_type; /* vertex_header */
+ arg_types[2] = LLVMPointerType(variant->vertex_header_ptr_type, 0); /* vertex_header */
arg_types[3] = int32_type; /* num_prims */
arg_types[4] = int32_type; /* instance_id */
arg_types[5] = LLVMPointerType(
typedef int
(*draw_gs_jit_func)(struct draw_gs_jit_context *context,
float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS],
- struct vertex_header *output,
+ struct vertex_header **output,
unsigned num_prims,
unsigned instance_id,
int *prim_ids,