case nir_intrinsic_load_num_work_groups:
return PAN_SYSVAL_NUM_WORK_GROUPS;
case nir_intrinsic_load_ssbo_address:
+ case nir_intrinsic_get_buffer_size:
return midgard_sysval_for_ssbo(instr);
case nir_intrinsic_load_sampler_lod_parameters_pan:
return midgard_sysval_for_sampler(instr);
emit_mir_instruction(ctx, ins);
}
-void
+static void
emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override,
- unsigned nr_components)
+ unsigned nr_components, unsigned offset)
{
unsigned dest = 0;
/* Emit the read itself -- this is never indirect */
midgard_instruction *ins =
- emit_ubo_read(ctx, instr, dest, uniform * 16, NULL, 0, 0);
+ emit_ubo_read(ctx, instr, dest, (uniform * 16) + offset, NULL, 0, 0);
ins->mask = mask_of(nr_components);
}
break;
case nir_intrinsic_load_ssbo_address:
- emit_sysval_read(ctx, &instr->instr, ~0, 1);
+ emit_sysval_read(ctx, &instr->instr, ~0, 1, 0);
+ break;
+
+ case nir_intrinsic_get_buffer_size:
+ emit_sysval_read(ctx, &instr->instr, ~0, 1, 8);
break;
case nir_intrinsic_load_viewport_scale:
case nir_intrinsic_load_viewport_offset:
case nir_intrinsic_load_num_work_groups:
case nir_intrinsic_load_sampler_lod_parameters_pan:
- emit_sysval_read(ctx, &instr->instr, ~0, 3);
+ emit_sysval_read(ctx, &instr->instr, ~0, 3, 0);
break;
case nir_intrinsic_load_work_group_id:
emit_texop_native(ctx, instr, TEXTURE_OP_TEXEL_FETCH);
break;
case nir_texop_txs:
- emit_sysval_read(ctx, &instr->instr, ~0, 4);
+ emit_sysval_read(ctx, &instr->instr, ~0, 4, 0);
break;
default: {
printf ("Unhandled texture op: %d\n", instr->op);