~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i965/brw_clip_util.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
{
110
110
   struct brw_compile *p = &c->func;
111
111
   struct brw_reg tmp = get_tmp(c);
 
112
   GLuint hpos_offset = brw_vert_result_to_offset(&c->vue_map,
 
113
                                                  VERT_RESULT_HPOS);
 
114
   GLuint ndc_offset = brw_vert_result_to_offset(&c->vue_map,
 
115
                                                 BRW_VERT_RESULT_NDC);
112
116
 
113
117
   /* Fixup position.  Extract from the original vertex and re-project
114
118
    * to screen space:
115
119
    */
116
 
   brw_MOV(p, tmp, deref_4f(vert_addr, c->offset[VERT_RESULT_HPOS]));
 
120
   brw_MOV(p, tmp, deref_4f(vert_addr, hpos_offset));
117
121
   brw_clip_project_position(c, tmp);
118
 
   brw_MOV(p, deref_4f(vert_addr, c->header_position_offset), tmp);
 
122
   brw_MOV(p, deref_4f(vert_addr, ndc_offset), tmp);
119
123
         
120
124
   release_tmp(c, tmp);
121
125
}
131
135
                             struct brw_indirect v0_ptr, /* from */
132
136
                             struct brw_indirect v1_ptr, /* to */
133
137
                             struct brw_reg t0,
134
 
                             GLboolean force_edgeflag)
 
138
                             bool force_edgeflag)
135
139
{
136
140
   struct brw_compile *p = &c->func;
137
141
   struct brw_reg tmp = get_tmp(c);
138
 
   GLuint i;
 
142
   GLuint slot;
139
143
 
140
144
   /* Just copy the vertex header:
141
145
    */
147
151
      
148
152
   /* Iterate over each attribute (could be done in pairs?)
149
153
    */
150
 
   for (i = 0; i < c->nr_attrs; i++) {
151
 
      GLuint delta = c->offset[c->idx_to_attr[i]];
 
154
   for (slot = 0; slot < c->vue_map.num_slots; slot++) {
 
155
      int vert_result = c->vue_map.slot_to_vert_result[slot];
 
156
      GLuint delta = brw_vue_slot_to_offset(slot);
152
157
 
153
 
      if (c->idx_to_attr[i] == VERT_RESULT_EDGE) {
 
158
      if (vert_result == VERT_RESULT_EDGE) {
154
159
         if (force_edgeflag) 
155
160
            brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(1));
156
161
         else
157
162
            brw_MOV(p, deref_4f(dest_ptr, delta), deref_4f(v0_ptr, delta));
158
 
      }
159
 
      else {
160
 
         /* Interpolate: 
 
163
      } else if (vert_result == VERT_RESULT_PSIZ ||
 
164
                 vert_result == VERT_RESULT_CLIP_DIST0 ||
 
165
                 vert_result == VERT_RESULT_CLIP_DIST1) {
 
166
         /* PSIZ doesn't need interpolation because it isn't used by the
 
167
          * fragment shader.  CLIP_DIST0 and CLIP_DIST1 don't need
 
168
          * intepolation because on pre-GEN6, these are just placeholder VUE
 
169
          * slots that don't perform any action.
 
170
          */
 
171
      } else if (vert_result < VERT_RESULT_MAX) {
 
172
         /* This is a true vertex result (and not a special value for the VUE
 
173
          * header), so interpolate:
161
174
          *
162
175
          *        New = attr0 + t*attr1 - t*attr0
163
176
          */
178
191
      }
179
192
   }
180
193
 
181
 
   if (i & 1) {
182
 
      GLuint delta = c->offset[c->idx_to_attr[c->nr_attrs - 1]] + ATTR_SIZE;
 
194
   if (c->vue_map.num_slots % 2) {
 
195
      GLuint delta = brw_vue_slot_to_offset(c->vue_map.num_slots);
183
196
 
184
197
      brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(0));
185
198
   }
194
207
 
195
208
void brw_clip_emit_vue(struct brw_clip_compile *c, 
196
209
                       struct brw_indirect vert,
197
 
                       GLboolean allocate,
198
 
                       GLboolean eot,
 
210
                       bool allocate,
 
211
                       bool eot,
199
212
                       GLuint header)
200
213
{
201
214
   struct brw_compile *p = &c->func;
286
299
{
287
300
   struct brw_compile *p = &c->func;
288
301
 
289
 
   if (c->offset[VERT_RESULT_COL0])
290
 
      brw_MOV(p, 
291
 
              byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_COL0]),
292
 
              byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_COL0]));
293
 
 
294
 
   if (c->offset[VERT_RESULT_COL1])
295
 
      brw_MOV(p, 
296
 
              byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_COL1]),
297
 
              byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_COL1]));
298
 
 
299
 
   if (c->offset[VERT_RESULT_BFC0])
300
 
      brw_MOV(p, 
301
 
              byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_BFC0]),
302
 
              byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_BFC0]));
303
 
 
304
 
   if (c->offset[VERT_RESULT_BFC1])
305
 
      brw_MOV(p, 
306
 
              byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_BFC1]),
307
 
              byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_BFC1]));
 
302
   if (brw_clip_have_vert_result(c, VERT_RESULT_COL0))
 
303
      brw_MOV(p, 
 
304
              byte_offset(c->reg.vertex[to],
 
305
                          brw_vert_result_to_offset(&c->vue_map,
 
306
                                                    VERT_RESULT_COL0)),
 
307
              byte_offset(c->reg.vertex[from],
 
308
                          brw_vert_result_to_offset(&c->vue_map,
 
309
                                                    VERT_RESULT_COL0)));
 
310
 
 
311
   if (brw_clip_have_vert_result(c, VERT_RESULT_COL1))
 
312
      brw_MOV(p, 
 
313
              byte_offset(c->reg.vertex[to],
 
314
                          brw_vert_result_to_offset(&c->vue_map,
 
315
                                                    VERT_RESULT_COL1)),
 
316
              byte_offset(c->reg.vertex[from],
 
317
                          brw_vert_result_to_offset(&c->vue_map,
 
318
                                                    VERT_RESULT_COL1)));
 
319
 
 
320
   if (brw_clip_have_vert_result(c, VERT_RESULT_BFC0))
 
321
      brw_MOV(p, 
 
322
              byte_offset(c->reg.vertex[to],
 
323
                          brw_vert_result_to_offset(&c->vue_map,
 
324
                                                    VERT_RESULT_BFC0)),
 
325
              byte_offset(c->reg.vertex[from],
 
326
                          brw_vert_result_to_offset(&c->vue_map,
 
327
                                                    VERT_RESULT_BFC0)));
 
328
 
 
329
   if (brw_clip_have_vert_result(c, VERT_RESULT_BFC1))
 
330
      brw_MOV(p, 
 
331
              byte_offset(c->reg.vertex[to],
 
332
                          brw_vert_result_to_offset(&c->vue_map,
 
333
                                                    VERT_RESULT_BFC1)),
 
334
              byte_offset(c->reg.vertex[from],
 
335
                          brw_vert_result_to_offset(&c->vue_map,
 
336
                                                    VERT_RESULT_BFC1)));
308
337
}
309
338
 
310
339