- for (; attr < FRAG_ATTRIB_MAX; attr++) {
- enum glsl_interp_qualifier interp_qualifier =
- brw->fragment_program->InterpQualifier[attr];
- bool is_gl_Color = attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1;
-
- if (!(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)))
- continue;
-
- /* _NEW_POINT */
- if (ctx->Point.PointSprite &&
- (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) &&
- ctx->Point.CoordReplace[attr - FRAG_ATTRIB_TEX0]) {
- dw16 |= (1 << input_index);
- }
-
- if (attr == FRAG_ATTRIB_PNTC)
- dw16 |= (1 << input_index);
-
- /* flat shading */
- if (interp_qualifier == INTERP_QUALIFIER_FLAT ||
- (shade_model_flat && is_gl_Color &&
- interp_qualifier == INTERP_QUALIFIER_NONE))
- dw17 |= (1 << input_index);
-
- /* The hardware can only do the overrides on 16 overrides at a
- * time, and the other up to 16 have to be lined up so that the
- * input index = the output index. We'll need to do some
- * tweaking to make sure that's the case.
- */
- assert(input_index < 16 || attr == input_index);
-
- /* _NEW_LIGHT | _NEW_PROGRAM */
- attr_overrides[input_index++] =
- get_attr_override(&vue_map, urb_entry_read_offset, attr,
- ctx->VertexProgram._TwoSideEnabled);
- }
-
- for (; input_index < FRAG_ATTRIB_MAX; input_index++)
- attr_overrides[input_index] = 0;
+ uint32_t urb_entry_read_length;
+ calculate_attr_overrides(brw, attr_overrides, &dw16, &dw17,
+ &urb_entry_read_length);
+ dw1 |= (urb_entry_read_length << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
+ urb_entry_read_offset << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT);