const float (*input_ptr)[4];
float (*input_data)[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS] = &shader->gs_input->data;
- shader->llvm_prim_ids[shader->fetched_prim_count] =
- shader->in_prim_idx;
+ shader->llvm_prim_ids[shader->fetched_prim_count] = shader->in_prim_idx;
input_ptr = shader->input;
for (slot = 0, vs_slot = 0; slot < shader->info.num_inputs; ++slot) {
if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_PRIMID) {
/* skip. we handle system values through gallivm */
+ /* NOTE: If we hit this case here it's an ordinary input not a sv,
+ * even though it probably should be a sv.
+ * Not sure how to set it up as regular input however if that even,
+ * would make sense so hack around this later in gallivm.
+ */
} else {
vs_slot = draw_gs_get_input_index(
shader->info.input_semantic_name[slot],
{
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
+ const struct tgsi_shader_info *info = bld->bld_base.info;
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef attrib_index = NULL;
LLVMValueRef vertex_index = NULL;
LLVMValueRef swizzle_index = lp_build_const_int32(gallivm, swizzle);
LLVMValueRef res;
+ if (info->input_semantic_name[reg->Register.Index] == TGSI_SEMANTIC_PRIMID) {
+ /* This is really a system value not a regular input */
+ assert(!reg->Register.Indirect);
+ assert(!reg->Dimension.Indirect);
+ res = bld->system_values.prim_id;
+ if (stype != TGSI_TYPE_UNSIGNED && stype != TGSI_TYPE_SIGNED) {
+ res = LLVMBuildBitCast(builder, res, bld_base->base.vec_type, "");
+ }
+ return res;
+ }
+
if (reg->Register.Indirect) {
attrib_index = get_indirect_index(bld,
reg->Register.File,
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
info->num_inputs++;
- if (procType == TGSI_PROCESSOR_FRAGMENT) {
+ if (semName == TGSI_SEMANTIC_PRIMID)
+ info->uses_primid = TRUE;
+ else if (procType == TGSI_PROCESSOR_FRAGMENT) {
if (semName == TGSI_SEMANTIC_POSITION)
info->reads_position = TRUE;
- else if (semName == TGSI_SEMANTIC_PRIMID)
- info->uses_primid = TRUE;
else if (semName == TGSI_SEMANTIC_FACE)
info->uses_frontface = TRUE;
}