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,
static void
draw_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
LLVMValueRef total_emitted_vertices_vec,
- LLVMValueRef emitted_prims_vec)
+ LLVMValueRef emitted_prims_vec, unsigned stream)
{
const struct draw_gs_llvm_iface *gs_iface = draw_gs_llvm_iface(gs_base);
struct draw_gs_llvm_variant *variant = gs_iface->variant;
LLVMValueRef emitted_prims_ptr =
draw_gs_jit_emitted_prims(gallivm, variant->context_ptr);
LLVMValueRef zero = lp_build_const_int32(gallivm, 0);
-
+
+ if (stream > 0)
+ return;
+
emitted_verts_ptr = LLVMBuildGEP(builder, emitted_verts_ptr, &zero, 0, "");
emitted_prims_ptr = LLVMBuildGEP(builder, emitted_prims_ptr, &zero, 0, "");
struct gallivm_state *gallivm = variant->gallivm;
LLVMContextRef context = gallivm->context;
LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
- LLVMTypeRef arg_types[11];
+ LLVMTypeRef arg_types[12];
unsigned num_arg_types = ARRAY_SIZE(arg_types);
LLVMTypeRef func_type;
LLVMValueRef context_ptr;
char func_name[64];
struct lp_type vs_type;
LLVMValueRef count, fetch_elts, start_or_maxelt;
- LLVMValueRef vertex_id_offset, start_instance;
+ LLVMValueRef vertex_id_offset;
LLVMValueRef stride, step, io_itr;
LLVMValueRef ind_vec, start_vec, have_elts, fetch_max, tmp;
LLVMValueRef io_ptr, vbuffers_ptr, vb_ptr;
arg_types[i++] = int32_type; /* vertex_id_offset */
arg_types[i++] = int32_type; /* start_instance */
arg_types[i++] = LLVMPointerType(int32_type, 0); /* fetch_elts */
+ arg_types[i++] = int32_type; /* draw_id */
func_type = LLVMFunctionType(LLVMInt8TypeInContext(context),
arg_types, num_arg_types, 0);
vb_ptr = LLVMGetParam(variant_func, 6);
system_values.instance_id = LLVMGetParam(variant_func, 7);
vertex_id_offset = LLVMGetParam(variant_func, 8);
- start_instance = LLVMGetParam(variant_func, 9);
+ system_values.base_instance = LLVMGetParam(variant_func, 9);
fetch_elts = LLVMGetParam(variant_func, 10);
+ system_values.draw_id = LLVMGetParam(variant_func, 11);
lp_build_name(context_ptr, "context");
lp_build_name(io_ptr, "io");
lp_build_name(vb_ptr, "vb");
lp_build_name(system_values.instance_id, "instance_id");
lp_build_name(vertex_id_offset, "vertex_id_offset");
- lp_build_name(start_instance, "start_instance");
+ lp_build_name(system_values.base_instance, "start_instance");
lp_build_name(fetch_elts, "fetch_elts");
+ lp_build_name(system_values.draw_id, "draw_id");
/*
* Function body
lp_build_const_int32(gallivm,
velem->instance_divisor),
"instance_divisor");
- instance_index[j] = lp_build_uadd_overflow(gallivm, start_instance,
+ instance_index[j] = lp_build_uadd_overflow(gallivm, system_values.base_instance,
current_instance, &ofbit);
}
* the primitive was split (we split rendering into chunks of at
* most 4095-vertices) we need to back out the original start
* index out of our vertex id here.
+ * for ARB_shader_draw_parameters, base_vertex should be 0 for non-indexed draws.
*/
- system_values.basevertex = lp_build_broadcast_scalar(&blduivec,
- vertex_id_offset);
+ LLVMValueRef base_vertex = lp_build_select(&bld, have_elts, vertex_id_offset, lp_build_const_int32(gallivm, 0));;
+ system_values.basevertex = lp_build_broadcast_scalar(&blduivec, base_vertex);
system_values.vertex_id = true_index_array;
system_values.vertex_id_nobase = LLVMBuildSub(builder, true_index_array,
- system_values.basevertex, "");
+ lp_build_broadcast_scalar(&blduivec, vertex_id_offset), "");
ptr_aos = (const LLVMValueRef (*)[TGSI_NUM_CHANNELS]) inputs;
generate_vs(variant,
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(