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;
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);
vertex_id_offset = LLVMGetParam(variant_func, 8);
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(vertex_id_offset, "vertex_id_offset");
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
draw->pt.user.min_index = info->min_index;
draw->pt.user.max_index = info->max_index;
draw->pt.user.eltSize = info->index_size ? draw->pt.user.eltSizeIB : 0;
+ draw->pt.user.drawid = info->drawid;
if (0)
debug_printf("draw_vbo(mode=%u start=%u count=%u):\n",
case nir_intrinsic_load_num_work_groups:
case nir_intrinsic_load_invocation_id:
case nir_intrinsic_load_front_face:
+ case nir_intrinsic_load_draw_id:
bld_base->sysval_intrin(bld_base, instr, result);
break;
case nir_intrinsic_discard_if:
res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.front_facing);
break;
+ case TGSI_SEMANTIC_DRAWID:
+ res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.draw_id);
+ atype = TGSI_TYPE_UNSIGNED;
+ break;
+
default:
assert(!"unexpected semantic in emit_fetch_system_value");
res = bld_base->base.zero;