-
- /* Color output is lowered by vc4_nir_lower_blend(). */
- if (c->stage == QSTAGE_FRAG &&
- (output_var->data.location == FRAG_RESULT_COLOR ||
- output_var->data.location == FRAG_RESULT_DATA0 ||
- output_var->data.location == FRAG_RESULT_SAMPLE_MASK)) {
- intr->const_index[0] *= 4;
- return;
- }
-
- /* All TGSI-to-NIR outputs are VEC4. */
- assert(intr->num_components == 4);
-
- /* We only accept direct outputs and TGSI only ever gives them to us
- * with an offset value of 0.
- */
- assert(nir_src_as_const_value(intr->src[1]) &&
- nir_src_as_const_value(intr->src[1])->u[0] == 0);
-
- b->cursor = nir_before_instr(&intr->instr);
-
- for (unsigned i = 0; i < intr->num_components; i++) {
- nir_intrinsic_instr *intr_comp =
- nir_intrinsic_instr_create(c->s, nir_intrinsic_store_output);
- intr_comp->num_components = 1;
- intr_comp->const_index[0] = intr->const_index[0] * 4 + i;
-
- assert(intr->src[0].is_ssa);
- intr_comp->src[0] =
- nir_src_for_ssa(nir_channel(b, intr->src[0].ssa, i));
- intr_comp->src[1] = nir_src_for_ssa(nir_imm_int(b, 0));
- nir_builder_instr_insert(b, &intr_comp->instr);
- }
-
- nir_instr_remove(&intr->instr);