int num_prims = shader->llvm_emitted_primitives[i + (stream * shader->vector_length)];
for (j = 0; j < num_prims; ++j) {
int prim_length =
- shader->llvm_prim_lengths[j][i];
+ shader->llvm_prim_lengths[j * shader->num_vertex_streams + stream][i];
shader->stream[stream].primitive_lengths[shader->stream[stream].emitted_primitives + prim_idx] =
prim_length;
++prim_idx;
if (max_out_prims > shader->max_out_prims) {
unsigned i;
if (shader->llvm_prim_lengths) {
- for (i = 0; i < shader->max_out_prims; ++i) {
+ for (i = 0; i < shader->num_vertex_streams * shader->max_out_prims; ++i) {
align_free(shader->llvm_prim_lengths[i]);
}
FREE(shader->llvm_prim_lengths);
}
- shader->llvm_prim_lengths = MALLOC(max_out_prims * sizeof(unsigned*));
- for (i = 0; i < max_out_prims; ++i) {
+ shader->llvm_prim_lengths = MALLOC(shader->num_vertex_streams * max_out_prims * sizeof(unsigned*));
+ for (i = 0; i < shader->num_vertex_streams * max_out_prims; ++i) {
int vector_size = shader->vector_length * sizeof(unsigned);
shader->llvm_prim_lengths[i] =
align_malloc(vector_size, vector_size);
if (dgs->llvm_prim_lengths) {
unsigned i;
- for (i = 0; i < dgs->max_out_prims; ++i) {
+ for (i = 0; i < dgs->num_vertex_streams * dgs->max_out_prims; ++i) {
align_free(dgs->llvm_prim_lengths[i]);
}
FREE(dgs->llvm_prim_lengths);
LLVMValueRef this_cond = LLVMBuildExtractElement(gallivm->builder, cond, ind, "");
struct lp_build_if_state ifthen;
lp_build_if(&ifthen, gallivm, this_cond);
+ prims_emitted = LLVMBuildMul(gallivm->builder, prims_emitted, lp_build_const_int32(gallivm, variant->shader->base.num_vertex_streams), "");
+ prims_emitted = LLVMBuildAdd(gallivm->builder, prims_emitted, lp_build_const_int32(gallivm, stream), "");
store_ptr = LLVMBuildGEP(builder, prim_lengts_ptr, &prims_emitted, 1, "");
store_ptr = LLVMBuildLoad(builder, store_ptr, "");
store_ptr = LLVMBuildGEP(builder, store_ptr, &ind, 1, "");