LLVMContextRef context = gallivm->context;
LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
LLVMTypeRef flt_type = LLVMFloatTypeInContext(context);
- LLVMTypeRef arg_types[9];
+ LLVMTypeRef arg_types[10];
LLVMTypeRef func_type;
LLVMValueRef variant_func;
LLVMValueRef context_ptr;
LLVMValueRef tess_coord[2], io_ptr, input_array, num_tess_coord;
- LLVMValueRef tess_inner, tess_outer, prim_id;
+ LLVMValueRef tess_inner, tess_outer, prim_id, patch_vertices_in;
LLVMBasicBlockRef block;
LLVMBuilderRef builder;
LLVMValueRef mask_val;
arg_types[6] = LLVMPointerType(flt_type, 0);
arg_types[7] = LLVMPointerType(LLVMArrayType(flt_type, 4), 0);
arg_types[8] = LLVMPointerType(LLVMArrayType(flt_type, 2), 0);
+ arg_types[9] = int32_type;
func_type = LLVMFunctionType(int32_type, arg_types, ARRAY_SIZE(arg_types), 0);
variant_func = LLVMAddFunction(gallivm->module, func_name, func_type);
tess_coord[1] = LLVMGetParam(variant_func, 6);
tess_outer = LLVMGetParam(variant_func, 7);
tess_inner = LLVMGetParam(variant_func, 8);
+ patch_vertices_in = LLVMGetParam(variant_func, 9);
lp_build_name(context_ptr, "context");
lp_build_name(input_array, "input");
lp_build_name(tess_coord[1], "tess_coord[1]");
lp_build_name(tess_outer, "tess_outer");
lp_build_name(tess_inner, "tess_inner");
+ lp_build_name(patch_vertices_in, "patch_vertices_in");
tes_iface.base.fetch_vertex_input = draw_tes_llvm_fetch_vertex_input;
tes_iface.base.fetch_patch_input = draw_tes_llvm_fetch_patch_input;
system_values.tess_inner = LLVMBuildLoad(builder, tess_inner, "");
system_values.prim_id = lp_build_broadcast_scalar(&bldvec, prim_id);
+
+ system_values.vertices_in = lp_build_broadcast_scalar(&bldvec, patch_vertices_in);
struct lp_build_loop_state lp_loop;
lp_build_loop_begin(&lp_loop, gallivm, bld.zero);
{
static void
llvm_tes_run(struct draw_tess_eval_shader *shader,
uint32_t prim_id,
+ uint32_t patch_vertices_in,
struct pipe_tessellator_data *tess_data,
struct pipe_tessellation_factors *tess_factors,
struct vertex_header *output)
{
shader->current_variant->jit_func(shader->jit_context, shader->tes_input->data, output, prim_id,
tess_data->num_domain_points, tess_data->domain_points_u, tess_data->domain_points_v,
- tess_factors->outer_tf, tess_factors->inner_tf);
+ tess_factors->outer_tf, tess_factors->inner_tf, patch_vertices_in);
}
#endif
/* run once per primitive? */
char *output = (char *)output_verts->verts;
output += vert_start * vertex_size;
- llvm_tes_run(shader, i, &data, &factors, (struct vertex_header *)output);
+ llvm_tes_run(shader, i, num_input_vertices_per_patch, &data, &factors, (struct vertex_header *)output);
uint32_t prim_len = u_prim_vertex_count(output_prims->prim)->min;
output_prims->primitive_count += data.num_indices / prim_len;