i965: fixes for JMPI
[mesa.git] / src / mesa / drivers / dri / i965 / brw_sf_emit.c
1 /*
2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial
16 portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **********************************************************************/
27 /*
28 * Authors:
29 * Keith Whitwell <keith@tungstengraphics.com>
30 */
31
32
33 #include "main/glheader.h"
34 #include "main/macros.h"
35 #include "main/enums.h"
36
37 #include "intel_batchbuffer.h"
38
39 #include "brw_defines.h"
40 #include "brw_context.h"
41 #include "brw_eu.h"
42 #include "brw_util.h"
43 #include "brw_sf.h"
44
45
46 static struct brw_reg get_vert_attr(struct brw_sf_compile *c,
47 struct brw_reg vert,
48 GLuint attr)
49 {
50 GLuint off = c->attr_to_idx[attr] / 2;
51 GLuint sub = c->attr_to_idx[attr] % 2;
52
53 return brw_vec4_grf(vert.nr + off, sub * 4);
54 }
55
56 static GLboolean have_attr(struct brw_sf_compile *c,
57 GLuint attr)
58 {
59 return (c->key.attrs & (1<<attr)) ? 1 : 0;
60 }
61
62 /***********************************************************************
63 * Twoside lighting
64 */
65 static void copy_bfc( struct brw_sf_compile *c,
66 struct brw_reg vert )
67 {
68 struct brw_compile *p = &c->func;
69 GLuint i;
70
71 for (i = 0; i < 2; i++) {
72 if (have_attr(c, VERT_RESULT_COL0+i) &&
73 have_attr(c, VERT_RESULT_BFC0+i))
74 brw_MOV(p,
75 get_vert_attr(c, vert, VERT_RESULT_COL0+i),
76 get_vert_attr(c, vert, VERT_RESULT_BFC0+i));
77 }
78 }
79
80
81 static void do_twoside_color( struct brw_sf_compile *c )
82 {
83 struct brw_compile *p = &c->func;
84 struct brw_instruction *if_insn;
85 GLuint backface_conditional = c->key.frontface_ccw ? BRW_CONDITIONAL_G : BRW_CONDITIONAL_L;
86
87 /* Already done in clip program:
88 */
89 if (c->key.primitive == SF_UNFILLED_TRIS)
90 return;
91
92 /* XXX: What happens if BFC isn't present? This could only happen
93 * for user-supplied vertex programs, as t_vp_build.c always does
94 * the right thing.
95 */
96 if (!(have_attr(c, VERT_RESULT_COL0) && have_attr(c, VERT_RESULT_BFC0)) &&
97 !(have_attr(c, VERT_RESULT_COL1) && have_attr(c, VERT_RESULT_BFC1)))
98 return;
99
100 /* Need to use BRW_EXECUTE_4 and also do an 4-wide compare in order
101 * to get all channels active inside the IF. In the clipping code
102 * we run with NoMask, so it's not an option and we can use
103 * BRW_EXECUTE_1 for all comparisions.
104 */
105 brw_push_insn_state(p);
106 brw_CMP(p, vec4(brw_null_reg()), backface_conditional, c->det, brw_imm_f(0));
107 if_insn = brw_IF(p, BRW_EXECUTE_4);
108 {
109 switch (c->nr_verts) {
110 case 3: copy_bfc(c, c->vert[2]);
111 case 2: copy_bfc(c, c->vert[1]);
112 case 1: copy_bfc(c, c->vert[0]);
113 }
114 }
115 brw_ENDIF(p, if_insn);
116 brw_pop_insn_state(p);
117 }
118
119
120
121 /***********************************************************************
122 * Flat shading
123 */
124
125 #define VERT_RESULT_COLOR_BITS ((1<<VERT_RESULT_COL0) | \
126 (1<<VERT_RESULT_COL1))
127
128 static void copy_colors( struct brw_sf_compile *c,
129 struct brw_reg dst,
130 struct brw_reg src)
131 {
132 struct brw_compile *p = &c->func;
133 GLuint i;
134
135 for (i = VERT_RESULT_COL0; i <= VERT_RESULT_COL1; i++) {
136 if (have_attr(c,i))
137 brw_MOV(p,
138 get_vert_attr(c, dst, i),
139 get_vert_attr(c, src, i));
140 }
141 }
142
143
144
145 /* Need to use a computed jump to copy flatshaded attributes as the
146 * vertices are ordered according to y-coordinate before reaching this
147 * point, so the PV could be anywhere.
148 */
149 static void do_flatshade_triangle( struct brw_sf_compile *c )
150 {
151 struct brw_compile *p = &c->func;
152 struct brw_reg ip = brw_ip_reg();
153 GLuint nr = brw_count_bits(c->key.attrs & VERT_RESULT_COLOR_BITS);
154 if (!nr)
155 return;
156
157 /* Already done in clip program:
158 */
159 if (c->key.primitive == SF_UNFILLED_TRIS)
160 return;
161
162 brw_push_insn_state(p);
163
164 brw_MUL(p, c->pv, c->pv, brw_imm_d(nr*2+1));
165 brw_JMPI(p, ip, ip, c->pv);
166
167 copy_colors(c, c->vert[1], c->vert[0]);
168 copy_colors(c, c->vert[2], c->vert[0]);
169 brw_JMPI(p, ip, ip, brw_imm_d(nr*4+1));
170
171 copy_colors(c, c->vert[0], c->vert[1]);
172 copy_colors(c, c->vert[2], c->vert[1]);
173 brw_JMPI(p, ip, ip, brw_imm_d(nr*2));
174
175 copy_colors(c, c->vert[0], c->vert[2]);
176 copy_colors(c, c->vert[1], c->vert[2]);
177
178 brw_pop_insn_state(p);
179 }
180
181
182 static void do_flatshade_line( struct brw_sf_compile *c )
183 {
184 struct brw_compile *p = &c->func;
185 struct brw_reg ip = brw_ip_reg();
186 GLuint nr = brw_count_bits(c->key.attrs & VERT_RESULT_COLOR_BITS);
187
188 if (!nr)
189 return;
190
191 /* Already done in clip program:
192 */
193 if (c->key.primitive == SF_UNFILLED_TRIS)
194 return;
195
196 brw_push_insn_state(p);
197
198 brw_MUL(p, c->pv, c->pv, brw_imm_d(nr+1));
199 brw_JMPI(p, ip, ip, c->pv);
200 copy_colors(c, c->vert[1], c->vert[0]);
201
202 brw_JMPI(p, ip, ip, brw_imm_d(nr));
203 copy_colors(c, c->vert[0], c->vert[1]);
204
205 brw_pop_insn_state(p);
206 }
207
208
209
210 /***********************************************************************
211 * Triangle setup.
212 */
213
214
215 static void alloc_regs( struct brw_sf_compile *c )
216 {
217 GLuint reg, i;
218
219 /* Values computed by fixed function unit:
220 */
221 c->pv = retype(brw_vec1_grf(1, 1), BRW_REGISTER_TYPE_D);
222 c->det = brw_vec1_grf(1, 2);
223 c->dx0 = brw_vec1_grf(1, 3);
224 c->dx2 = brw_vec1_grf(1, 4);
225 c->dy0 = brw_vec1_grf(1, 5);
226 c->dy2 = brw_vec1_grf(1, 6);
227
228 /* z and 1/w passed in seperately:
229 */
230 c->z[0] = brw_vec1_grf(2, 0);
231 c->inv_w[0] = brw_vec1_grf(2, 1);
232 c->z[1] = brw_vec1_grf(2, 2);
233 c->inv_w[1] = brw_vec1_grf(2, 3);
234 c->z[2] = brw_vec1_grf(2, 4);
235 c->inv_w[2] = brw_vec1_grf(2, 5);
236
237 /* The vertices:
238 */
239 reg = 3;
240 for (i = 0; i < c->nr_verts; i++) {
241 c->vert[i] = brw_vec8_grf(reg, 0);
242 reg += c->nr_attr_regs;
243 }
244
245 /* Temporaries, allocated after last vertex reg.
246 */
247 c->inv_det = brw_vec1_grf(reg, 0); reg++;
248 c->a1_sub_a0 = brw_vec8_grf(reg, 0); reg++;
249 c->a2_sub_a0 = brw_vec8_grf(reg, 0); reg++;
250 c->tmp = brw_vec8_grf(reg, 0); reg++;
251
252 /* Note grf allocation:
253 */
254 c->prog_data.total_grf = reg;
255
256
257 /* Outputs of this program - interpolation coefficients for
258 * rasterization:
259 */
260 c->m1Cx = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 1, 0);
261 c->m2Cy = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 2, 0);
262 c->m3C0 = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 3, 0);
263 }
264
265
266 static void copy_z_inv_w( struct brw_sf_compile *c )
267 {
268 struct brw_compile *p = &c->func;
269 GLuint i;
270
271 brw_push_insn_state(p);
272
273 /* Copy both scalars with a single MOV:
274 */
275 for (i = 0; i < c->nr_verts; i++)
276 brw_MOV(p, vec2(suboffset(c->vert[i], 2)), vec2(c->z[i]));
277
278 brw_pop_insn_state(p);
279 }
280
281
282 static void invert_det( struct brw_sf_compile *c)
283 {
284 /* Looks like we invert all 8 elements just to get 1/det in
285 * position 2 !?!
286 */
287 brw_math(&c->func,
288 c->inv_det,
289 BRW_MATH_FUNCTION_INV,
290 BRW_MATH_SATURATE_NONE,
291 0,
292 c->det,
293 BRW_MATH_DATA_SCALAR,
294 BRW_MATH_PRECISION_FULL);
295
296 }
297
298
299 static GLboolean calculate_masks( struct brw_sf_compile *c,
300 GLuint reg,
301 GLushort *pc,
302 GLushort *pc_persp,
303 GLushort *pc_linear)
304 {
305 GLboolean is_last_attr = (reg == c->nr_setup_regs - 1);
306 GLuint persp_mask;
307 GLuint linear_mask;
308
309 if (c->key.do_flat_shading || c->key.linear_color)
310 persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS |
311 FRAG_BIT_COL0 |
312 FRAG_BIT_COL1);
313 else
314 persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS);
315
316 if (c->key.do_flat_shading)
317 linear_mask = c->key.attrs & ~(FRAG_BIT_COL0|FRAG_BIT_COL1);
318 else
319 linear_mask = c->key.attrs;
320
321 *pc_persp = 0;
322 *pc_linear = 0;
323 *pc = 0xf;
324
325 if (persp_mask & (1 << c->idx_to_attr[reg*2]))
326 *pc_persp = 0xf;
327
328 if (linear_mask & (1 << c->idx_to_attr[reg*2]))
329 *pc_linear = 0xf;
330
331 /* Maybe only processs one attribute on the final round:
332 */
333 if (reg*2+1 < c->nr_setup_attrs) {
334 *pc |= 0xf0;
335
336 if (persp_mask & (1 << c->idx_to_attr[reg*2+1]))
337 *pc_persp |= 0xf0;
338
339 if (linear_mask & (1 << c->idx_to_attr[reg*2+1]))
340 *pc_linear |= 0xf0;
341 }
342
343 return is_last_attr;
344 }
345
346
347
348 void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate)
349 {
350 struct brw_compile *p = &c->func;
351 GLuint i;
352
353 c->nr_verts = 3;
354
355 if (allocate)
356 alloc_regs(c);
357
358 invert_det(c);
359 copy_z_inv_w(c);
360
361 if (c->key.do_twoside_color)
362 do_twoside_color(c);
363
364 if (c->key.do_flat_shading)
365 do_flatshade_triangle(c);
366
367
368 for (i = 0; i < c->nr_setup_regs; i++)
369 {
370 /* Pair of incoming attributes:
371 */
372 struct brw_reg a0 = offset(c->vert[0], i);
373 struct brw_reg a1 = offset(c->vert[1], i);
374 struct brw_reg a2 = offset(c->vert[2], i);
375 GLushort pc, pc_persp, pc_linear;
376 GLboolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
377
378 if (pc_persp)
379 {
380 brw_set_predicate_control_flag_value(p, pc_persp);
381 brw_MUL(p, a0, a0, c->inv_w[0]);
382 brw_MUL(p, a1, a1, c->inv_w[1]);
383 brw_MUL(p, a2, a2, c->inv_w[2]);
384 }
385
386
387 /* Calculate coefficients for interpolated values:
388 */
389 if (pc_linear)
390 {
391 brw_set_predicate_control_flag_value(p, pc_linear);
392
393 brw_ADD(p, c->a1_sub_a0, a1, negate(a0));
394 brw_ADD(p, c->a2_sub_a0, a2, negate(a0));
395
396 /* calculate dA/dx
397 */
398 brw_MUL(p, brw_null_reg(), c->a1_sub_a0, c->dy2);
399 brw_MAC(p, c->tmp, c->a2_sub_a0, negate(c->dy0));
400 brw_MUL(p, c->m1Cx, c->tmp, c->inv_det);
401
402 /* calculate dA/dy
403 */
404 brw_MUL(p, brw_null_reg(), c->a2_sub_a0, c->dx0);
405 brw_MAC(p, c->tmp, c->a1_sub_a0, negate(c->dx2));
406 brw_MUL(p, c->m2Cy, c->tmp, c->inv_det);
407 }
408
409 {
410 brw_set_predicate_control_flag_value(p, pc);
411 /* start point for interpolation
412 */
413 brw_MOV(p, c->m3C0, a0);
414
415 /* Copy m0..m3 to URB. m0 is implicitly copied from r0 in
416 * the send instruction:
417 */
418 brw_urb_WRITE(p,
419 brw_null_reg(),
420 0,
421 brw_vec8_grf(0, 0), /* r0, will be copied to m0 */
422 0, /* allocate */
423 1, /* used */
424 4, /* msg len */
425 0, /* response len */
426 last, /* eot */
427 last, /* writes complete */
428 i*4, /* offset */
429 BRW_URB_SWIZZLE_TRANSPOSE); /* XXX: Swizzle control "SF to windower" */
430 }
431 }
432 }
433
434
435
436 void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate)
437 {
438 struct brw_compile *p = &c->func;
439 GLuint i;
440
441
442 c->nr_verts = 2;
443
444 if (allocate)
445 alloc_regs(c);
446
447 invert_det(c);
448 copy_z_inv_w(c);
449
450 if (c->key.do_flat_shading)
451 do_flatshade_line(c);
452
453 for (i = 0; i < c->nr_setup_regs; i++)
454 {
455 /* Pair of incoming attributes:
456 */
457 struct brw_reg a0 = offset(c->vert[0], i);
458 struct brw_reg a1 = offset(c->vert[1], i);
459 GLushort pc, pc_persp, pc_linear;
460 GLboolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
461
462 if (pc_persp)
463 {
464 brw_set_predicate_control_flag_value(p, pc_persp);
465 brw_MUL(p, a0, a0, c->inv_w[0]);
466 brw_MUL(p, a1, a1, c->inv_w[1]);
467 }
468
469 /* Calculate coefficients for position, color:
470 */
471 if (pc_linear) {
472 brw_set_predicate_control_flag_value(p, pc_linear);
473
474 brw_ADD(p, c->a1_sub_a0, a1, negate(a0));
475
476 brw_MUL(p, c->tmp, c->a1_sub_a0, c->dx0);
477 brw_MUL(p, c->m1Cx, c->tmp, c->inv_det);
478
479 brw_MUL(p, c->tmp, c->a1_sub_a0, c->dy0);
480 brw_MUL(p, c->m2Cy, c->tmp, c->inv_det);
481 }
482
483 {
484 brw_set_predicate_control_flag_value(p, pc);
485
486 /* start point for interpolation
487 */
488 brw_MOV(p, c->m3C0, a0);
489
490 /* Copy m0..m3 to URB.
491 */
492 brw_urb_WRITE(p,
493 brw_null_reg(),
494 0,
495 brw_vec8_grf(0, 0),
496 0, /* allocate */
497 1, /* used */
498 4, /* msg len */
499 0, /* response len */
500 last, /* eot */
501 last, /* writes complete */
502 i*4, /* urb destination offset */
503 BRW_URB_SWIZZLE_TRANSPOSE);
504 }
505 }
506 }
507
508 void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate)
509 {
510 struct brw_compile *p = &c->func;
511 GLuint i;
512
513 c->nr_verts = 1;
514
515 if (allocate)
516 alloc_regs(c);
517
518 copy_z_inv_w(c);
519 for (i = 0; i < c->nr_setup_regs; i++)
520 {
521 struct brw_sf_point_tex *tex = &c->point_attrs[c->idx_to_attr[2*i]];
522 struct brw_reg a0 = offset(c->vert[0], i);
523 GLushort pc, pc_persp, pc_linear;
524 GLboolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
525
526 if (pc_persp)
527 {
528 if (!tex->CoordReplace) {
529 brw_set_predicate_control_flag_value(p, pc_persp);
530 brw_MUL(p, a0, a0, c->inv_w[0]);
531 }
532 }
533
534 if (tex->CoordReplace) {
535 /* Caculate 1.0/PointWidth */
536 brw_math(&c->func,
537 c->tmp,
538 BRW_MATH_FUNCTION_INV,
539 BRW_MATH_SATURATE_NONE,
540 0,
541 c->dx0,
542 BRW_MATH_DATA_SCALAR,
543 BRW_MATH_PRECISION_FULL);
544
545 if (c->key.SpriteOrigin == GL_LOWER_LEFT) {
546 brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]);
547 brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0));
548 brw_MUL(p, c->m2Cy, c->tmp, negate(c->inv_w[0]));
549 brw_MOV(p, vec1(suboffset(c->m2Cy, 0)), brw_imm_f(0.0));
550 } else {
551 brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]);
552 brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0));
553 brw_MUL(p, c->m2Cy, c->tmp, c->inv_w[0]);
554 brw_MOV(p, vec1(suboffset(c->m2Cy, 0)), brw_imm_f(0.0));
555 }
556 } else {
557 brw_MOV(p, c->m1Cx, brw_imm_ud(0));
558 brw_MOV(p, c->m2Cy, brw_imm_ud(0));
559 }
560
561 {
562 brw_set_predicate_control_flag_value(p, pc);
563 if (tex->CoordReplace) {
564 if (c->key.SpriteOrigin == GL_LOWER_LEFT) {
565 brw_MUL(p, c->m3C0, c->inv_w[0], brw_imm_f(1.0));
566 brw_MOV(p, vec1(suboffset(c->m3C0, 0)), brw_imm_f(0.0));
567 }
568 else
569 brw_MOV(p, c->m3C0, brw_imm_f(0.0));
570 } else {
571 brw_MOV(p, c->m3C0, a0); /* constant value */
572 }
573
574 /* Copy m0..m3 to URB.
575 */
576 brw_urb_WRITE(p,
577 brw_null_reg(),
578 0,
579 brw_vec8_grf(0, 0),
580 0, /* allocate */
581 1, /* used */
582 4, /* msg len */
583 0, /* response len */
584 last, /* eot */
585 last, /* writes complete */
586 i*4, /* urb destination offset */
587 BRW_URB_SWIZZLE_TRANSPOSE);
588 }
589 }
590 }
591
592 /* Points setup - several simplifications as all attributes are
593 * constant across the face of the point (point sprites excluded!)
594 */
595 void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate)
596 {
597 struct brw_compile *p = &c->func;
598 GLuint i;
599
600 c->nr_verts = 1;
601
602 if (allocate)
603 alloc_regs(c);
604
605 copy_z_inv_w(c);
606
607 brw_MOV(p, c->m1Cx, brw_imm_ud(0)); /* zero - move out of loop */
608 brw_MOV(p, c->m2Cy, brw_imm_ud(0)); /* zero - move out of loop */
609
610 for (i = 0; i < c->nr_setup_regs; i++)
611 {
612 struct brw_reg a0 = offset(c->vert[0], i);
613 GLushort pc, pc_persp, pc_linear;
614 GLboolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
615
616 if (pc_persp)
617 {
618 /* This seems odd as the values are all constant, but the
619 * fragment shader will be expecting it:
620 */
621 brw_set_predicate_control_flag_value(p, pc_persp);
622 brw_MUL(p, a0, a0, c->inv_w[0]);
623 }
624
625
626 /* The delta values are always zero, just send the starting
627 * coordinate. Again, this is to fit in with the interpolation
628 * code in the fragment shader.
629 */
630 {
631 brw_set_predicate_control_flag_value(p, pc);
632
633 brw_MOV(p, c->m3C0, a0); /* constant value */
634
635 /* Copy m0..m3 to URB.
636 */
637 brw_urb_WRITE(p,
638 brw_null_reg(),
639 0,
640 brw_vec8_grf(0, 0),
641 0, /* allocate */
642 1, /* used */
643 4, /* msg len */
644 0, /* response len */
645 last, /* eot */
646 last, /* writes complete */
647 i*4, /* urb destination offset */
648 BRW_URB_SWIZZLE_TRANSPOSE);
649 }
650 }
651 }
652
653 void brw_emit_anyprim_setup( struct brw_sf_compile *c )
654 {
655 struct brw_compile *p = &c->func;
656 struct brw_reg ip = brw_ip_reg();
657 struct brw_reg payload_prim = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0);
658 struct brw_reg payload_attr = get_element_ud(brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0), 0);
659 struct brw_reg primmask;
660 struct brw_instruction *jmp;
661 struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
662
663 GLuint saveflag;
664
665 c->nr_verts = 3;
666 alloc_regs(c);
667
668 primmask = retype(get_element(c->tmp, 0), BRW_REGISTER_TYPE_UD);
669
670 brw_MOV(p, primmask, brw_imm_ud(1));
671 brw_SHL(p, primmask, primmask, payload_prim);
672
673 brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
674 brw_AND(p, v1_null_ud, primmask, brw_imm_ud((1<<_3DPRIM_TRILIST) |
675 (1<<_3DPRIM_TRISTRIP) |
676 (1<<_3DPRIM_TRIFAN) |
677 (1<<_3DPRIM_TRISTRIP_REVERSE) |
678 (1<<_3DPRIM_POLYGON) |
679 (1<<_3DPRIM_RECTLIST) |
680 (1<<_3DPRIM_TRIFAN_NOSTIPPLE)));
681 jmp = brw_JMPI(p, ip, ip, brw_imm_d(0));
682 {
683 saveflag = p->flag_value;
684 brw_push_insn_state(p);
685 brw_emit_tri_setup( c, GL_FALSE );
686 brw_pop_insn_state(p);
687 p->flag_value = saveflag;
688 /* note - thread killed in subroutine, so must
689 * restore the flag which is changed when building
690 * the subroutine. fix #13240
691 */
692 }
693 brw_land_fwd_jump(p, jmp);
694
695 brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
696 brw_AND(p, v1_null_ud, primmask, brw_imm_ud((1<<_3DPRIM_LINELIST) |
697 (1<<_3DPRIM_LINESTRIP) |
698 (1<<_3DPRIM_LINELOOP) |
699 (1<<_3DPRIM_LINESTRIP_CONT) |
700 (1<<_3DPRIM_LINESTRIP_BF) |
701 (1<<_3DPRIM_LINESTRIP_CONT_BF)));
702 jmp = brw_JMPI(p, ip, ip, brw_imm_d(0));
703 {
704 saveflag = p->flag_value;
705 brw_push_insn_state(p);
706 brw_emit_line_setup( c, GL_FALSE );
707 brw_pop_insn_state(p);
708 p->flag_value = saveflag;
709 /* note - thread killed in subroutine */
710 }
711 brw_land_fwd_jump(p, jmp);
712
713 brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
714 brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<<BRW_SPRITE_POINT_ENABLE));
715 jmp = brw_JMPI(p, ip, ip, brw_imm_d(0));
716 {
717 saveflag = p->flag_value;
718 brw_push_insn_state(p);
719 brw_emit_point_sprite_setup( c, GL_FALSE );
720 brw_pop_insn_state(p);
721 p->flag_value = saveflag;
722 }
723 brw_land_fwd_jump(p, jmp);
724
725 brw_emit_point_setup( c, GL_FALSE );
726 }
727
728
729
730