}
dst[0] = ctx->base_instance;
break;
+ case nir_intrinsic_load_view_index:
+ if (!ctx->view_index) {
+ ctx->view_index = create_sysval_input(ctx, SYSTEM_VALUE_VIEW_INDEX, 0x1);
+ }
+ dst[0] = ctx->view_index;
+ break;
case nir_intrinsic_load_vertex_id_zero_base:
case nir_intrinsic_load_vertex_id:
if (!ctx->vertex_id) {
struct ir3_instruction *frag_face, *frag_coord;
/* For vertex shaders, keep track of the system values sources */
- struct ir3_instruction *vertex_id, *basevertex, *instance_id, *base_instance, *draw_id;
+ struct ir3_instruction *vertex_id, *basevertex, *instance_id, *base_instance, *draw_id, *view_index;
/* For fragment shaders: */
struct ir3_instruction *samp_id, *samp_mask_in;
/* location for fixed-function gl_PrimitiveID passthrough */
uint8_t primid_loc;
+
+ /* location for fixed-function gl_ViewIndex passthrough */
+ uint8_t viewid_loc;
};
static inline void
int j = -1, k;
l->primid_loc = 0xff;
+ l->viewid_loc = 0xff;
while (l->cnt < ARRAY_SIZE(l->var)) {
j = ir3_next_varying(fs, j);
l->primid_loc = fs->inputs[j].inloc;
}
+ if (fs->inputs[j].slot == VARYING_SLOT_VIEW_INDEX) {
+ assert(k < 0);
+ l->viewid_loc = fs->inputs[j].inloc;
+ }
+
ir3_link_add(l, k >= 0 ? vs->outputs[k].regid : default_regid,
fs->inputs[j].compmask, fs->inputs[j].inloc);
}