s/Tungsten Graphics/VMware/
[mesa.git] / src / mesa / drivers / dri / i915 / intel_tris.c
1 /**************************************************************************
2 *
3 * Copyright 2003 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * 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, sub license, 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 portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 /** @file intel_tris.c
29 *
30 * This file contains functions for managing the vertex buffer and emitting
31 * primitives into it.
32 */
33
34 #include "main/glheader.h"
35 #include "main/context.h"
36 #include "main/macros.h"
37 #include "main/enums.h"
38 #include "main/texobj.h"
39 #include "main/state.h"
40 #include "main/dd.h"
41 #include "main/fbobject.h"
42
43 #include "swrast/swrast.h"
44 #include "swrast_setup/swrast_setup.h"
45 #include "tnl/t_context.h"
46 #include "tnl/t_pipeline.h"
47 #include "tnl/t_vertex.h"
48
49 #include "intel_screen.h"
50 #include "intel_context.h"
51 #include "intel_tris.h"
52 #include "intel_batchbuffer.h"
53 #include "intel_buffers.h"
54 #include "intel_reg.h"
55 #include "i830_context.h"
56 #include "i830_reg.h"
57 #include "i915_context.h"
58
59 static void intelRenderPrimitive(struct gl_context * ctx, GLenum prim);
60 static void intelRasterPrimitive(struct gl_context * ctx, GLenum rprim,
61 GLuint hwprim);
62
63 static void
64 intel_flush_inline_primitive(struct intel_context *intel)
65 {
66 GLuint used = intel->batch.used - intel->prim.start_ptr;
67
68 assert(intel->prim.primitive != ~0);
69
70 /* printf("/\n"); */
71
72 if (used < 2)
73 goto do_discard;
74
75 intel->batch.map[intel->prim.start_ptr] =
76 _3DPRIMITIVE | intel->prim.primitive | (used - 2);
77
78 goto finished;
79
80 do_discard:
81 intel->batch.used = intel->prim.start_ptr;
82
83 finished:
84 intel->prim.primitive = ~0;
85 intel->prim.start_ptr = 0;
86 intel->prim.flush = 0;
87 }
88
89 static void intel_start_inline(struct intel_context *intel, uint32_t prim)
90 {
91 BATCH_LOCALS;
92
93 intel->vtbl.emit_state(intel);
94
95 intel->no_batch_wrap = true;
96
97 /* Emit a slot which will be filled with the inline primitive
98 * command later.
99 */
100 BEGIN_BATCH(1);
101
102 intel->prim.start_ptr = intel->batch.used;
103 intel->prim.primitive = prim;
104 intel->prim.flush = intel_flush_inline_primitive;
105
106 OUT_BATCH(0);
107 ADVANCE_BATCH();
108
109 intel->no_batch_wrap = false;
110 /* printf(">"); */
111 }
112
113 static void intel_wrap_inline(struct intel_context *intel)
114 {
115 GLuint prim = intel->prim.primitive;
116
117 intel_flush_inline_primitive(intel);
118 intel_batchbuffer_flush(intel);
119 intel_start_inline(intel, prim); /* ??? */
120 }
121
122 static GLuint *intel_extend_inline(struct intel_context *intel, GLuint dwords)
123 {
124 GLuint *ptr;
125
126 assert(intel->prim.flush == intel_flush_inline_primitive);
127
128 if (intel_batchbuffer_space(intel) < dwords * sizeof(GLuint))
129 intel_wrap_inline(intel);
130
131 /* printf("."); */
132
133 intel->vtbl.assert_not_dirty(intel);
134
135 ptr = intel->batch.map + intel->batch.used;
136 intel->batch.used += dwords;
137
138 return ptr;
139 }
140
141 /** Sets the primitive type for a primitive sequence, flushing as needed. */
142 void intel_set_prim(struct intel_context *intel, uint32_t prim)
143 {
144 /* if we have no VBOs */
145
146 if (intel->intelScreen->no_vbo) {
147 intel_start_inline(intel, prim);
148 return;
149 }
150 if (prim != intel->prim.primitive) {
151 INTEL_FIREVERTICES(intel);
152 intel->prim.primitive = prim;
153 }
154 }
155
156 /** Returns mapped VB space for the given number of vertices */
157 uint32_t *intel_get_prim_space(struct intel_context *intel, unsigned int count)
158 {
159 uint32_t *addr;
160
161 if (intel->intelScreen->no_vbo) {
162 return intel_extend_inline(intel, count * intel->vertex_size);
163 }
164
165 /* Check for space in the existing VB */
166 if (intel->prim.vb_bo == NULL ||
167 (intel->prim.current_offset +
168 count * intel->vertex_size * 4) > INTEL_VB_SIZE ||
169 (intel->prim.count + count) >= (1 << 16)) {
170 /* Flush existing prim if any */
171 INTEL_FIREVERTICES(intel);
172
173 intel_finish_vb(intel);
174
175 /* Start a new VB */
176 if (intel->prim.vb == NULL)
177 intel->prim.vb = malloc(INTEL_VB_SIZE);
178 intel->prim.vb_bo = drm_intel_bo_alloc(intel->bufmgr, "vb",
179 INTEL_VB_SIZE, 4);
180 intel->prim.start_offset = 0;
181 intel->prim.current_offset = 0;
182 }
183
184 intel->prim.flush = intel_flush_prim;
185
186 addr = (uint32_t *)(intel->prim.vb + intel->prim.current_offset);
187 intel->prim.current_offset += intel->vertex_size * 4 * count;
188 intel->prim.count += count;
189
190 return addr;
191 }
192
193 /** Dispatches the accumulated primitive to the batchbuffer. */
194 void intel_flush_prim(struct intel_context *intel)
195 {
196 drm_intel_bo *aper_array[2];
197 drm_intel_bo *vb_bo;
198 unsigned int offset, count;
199 BATCH_LOCALS;
200
201 /* Must be called after an intel_start_prim. */
202 assert(intel->prim.primitive != ~0);
203
204 if (intel->prim.count == 0)
205 return;
206
207 /* Clear the current prims out of the context state so that a batch flush
208 * flush triggered by emit_state doesn't loop back to flush_prim again.
209 */
210 vb_bo = intel->prim.vb_bo;
211 drm_intel_bo_reference(vb_bo);
212 count = intel->prim.count;
213 intel->prim.count = 0;
214 offset = intel->prim.start_offset;
215 intel->prim.start_offset = intel->prim.current_offset;
216 if (intel->gen < 3)
217 intel->prim.current_offset = intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128);
218 intel->prim.flush = NULL;
219
220 intel->vtbl.emit_state(intel);
221
222 aper_array[0] = intel->batch.bo;
223 aper_array[1] = vb_bo;
224 if (dri_bufmgr_check_aperture_space(aper_array, 2)) {
225 intel_batchbuffer_flush(intel);
226 intel->vtbl.emit_state(intel);
227 }
228
229 /* Ensure that we don't start a new batch for the following emit, which
230 * depends on the state just emitted. emit_state should be making sure we
231 * have the space for this.
232 */
233 intel->no_batch_wrap = true;
234
235 if (intel->always_flush_cache) {
236 intel_batchbuffer_emit_mi_flush(intel);
237 }
238
239 #if 0
240 printf("emitting %d..%d=%d vertices size %d\n", offset,
241 intel->prim.current_offset, count,
242 intel->vertex_size * 4);
243 #endif
244
245 if (intel->gen >= 3) {
246 struct i915_context *i915 = i915_context(&intel->ctx);
247 unsigned int cmd = 0, len = 0;
248
249 if (vb_bo != i915->current_vb_bo) {
250 cmd |= I1_LOAD_S(0);
251 len++;
252 }
253
254 if (intel->vertex_size != i915->current_vertex_size) {
255 cmd |= I1_LOAD_S(1);
256 len++;
257 }
258 if (len)
259 len++;
260
261 BEGIN_BATCH(2+len);
262 if (cmd)
263 OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | cmd | (len - 2));
264 if (vb_bo != i915->current_vb_bo) {
265 OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, 0);
266 i915->current_vb_bo = vb_bo;
267 }
268 if (intel->vertex_size != i915->current_vertex_size) {
269 OUT_BATCH((intel->vertex_size << S1_VERTEX_WIDTH_SHIFT) |
270 (intel->vertex_size << S1_VERTEX_PITCH_SHIFT));
271 i915->current_vertex_size = intel->vertex_size;
272 }
273 OUT_BATCH(_3DPRIMITIVE |
274 PRIM_INDIRECT |
275 PRIM_INDIRECT_SEQUENTIAL |
276 intel->prim.primitive |
277 count);
278 OUT_BATCH(offset / (intel->vertex_size * 4));
279 ADVANCE_BATCH();
280 } else {
281 struct i830_context *i830 = i830_context(&intel->ctx);
282
283 BEGIN_BATCH(5);
284 OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
285 I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
286 /* S0 */
287 assert((offset & ~S0_VB_OFFSET_MASK_830) == 0);
288 OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
289 offset | (intel->vertex_size << S0_VB_PITCH_SHIFT_830) |
290 S0_VB_ENABLE_830);
291 /* S2
292 * This is somewhat unfortunate -- VB width is tied up with
293 * vertex format data that we've already uploaded through
294 * _3DSTATE_VFT[01]_CMD. We may want to replace emits of VFT state with
295 * STATE_IMMEDIATE_1 like this to avoid duplication.
296 */
297 OUT_BATCH((i830->state.Ctx[I830_CTXREG_VF] & VFT0_TEX_COUNT_MASK) >>
298 VFT0_TEX_COUNT_SHIFT << S2_TEX_COUNT_SHIFT_830 |
299 (i830->state.Ctx[I830_CTXREG_VF2] << 16) |
300 intel->vertex_size << S2_VERTEX_0_WIDTH_SHIFT_830);
301
302 OUT_BATCH(_3DPRIMITIVE |
303 PRIM_INDIRECT |
304 PRIM_INDIRECT_SEQUENTIAL |
305 intel->prim.primitive |
306 count);
307 OUT_BATCH(0); /* Beginning vertex index */
308 ADVANCE_BATCH();
309 }
310
311 if (intel->always_flush_cache) {
312 intel_batchbuffer_emit_mi_flush(intel);
313 }
314
315 intel->no_batch_wrap = false;
316
317 drm_intel_bo_unreference(vb_bo);
318 }
319
320 /**
321 * Uploads the locally-accumulated VB into the buffer object.
322 *
323 * This avoids us thrashing the cachelines in and out as the buffer gets
324 * filled, dispatched, then reused as the hardware completes rendering from it,
325 * and also lets us clflush less if we dispatch with a partially-filled VB.
326 *
327 * This is called normally from get_space when we're finishing a BO, but also
328 * at batch flush time so that we don't try accessing the contents of a
329 * just-dispatched buffer.
330 */
331 void intel_finish_vb(struct intel_context *intel)
332 {
333 if (intel->prim.vb_bo == NULL)
334 return;
335
336 drm_intel_bo_subdata(intel->prim.vb_bo, 0, intel->prim.start_offset,
337 intel->prim.vb);
338 drm_intel_bo_unreference(intel->prim.vb_bo);
339 intel->prim.vb_bo = NULL;
340 }
341
342 /***********************************************************************
343 * Emit primitives as inline vertices *
344 ***********************************************************************/
345
346 #ifdef __i386__
347 #define COPY_DWORDS( j, vb, vertsize, v ) \
348 do { \
349 int __tmp; \
350 __asm__ __volatile__( "rep ; movsl" \
351 : "=%c" (j), "=D" (vb), "=S" (__tmp) \
352 : "0" (vertsize), \
353 "D" ((long)vb), \
354 "S" ((long)v) ); \
355 } while (0)
356 #else
357 #define COPY_DWORDS( j, vb, vertsize, v ) \
358 do { \
359 for ( j = 0 ; j < vertsize ; j++ ) { \
360 vb[j] = ((GLuint *)v)[j]; \
361 } \
362 vb += vertsize; \
363 } while (0)
364 #endif
365
366 static void
367 intel_draw_quad(struct intel_context *intel,
368 intelVertexPtr v0,
369 intelVertexPtr v1, intelVertexPtr v2, intelVertexPtr v3)
370 {
371 GLuint vertsize = intel->vertex_size;
372 GLuint *vb = intel_get_prim_space(intel, 6);
373 int j;
374
375 COPY_DWORDS(j, vb, vertsize, v0);
376 COPY_DWORDS(j, vb, vertsize, v1);
377
378 /* If smooth shading, draw like a trifan which gives better
379 * rasterization. Otherwise draw as two triangles with provoking
380 * vertex in third position as required for flat shading.
381 */
382 if (intel->ctx.Light.ShadeModel == GL_FLAT) {
383 COPY_DWORDS(j, vb, vertsize, v3);
384 COPY_DWORDS(j, vb, vertsize, v1);
385 }
386 else {
387 COPY_DWORDS(j, vb, vertsize, v2);
388 COPY_DWORDS(j, vb, vertsize, v0);
389 }
390
391 COPY_DWORDS(j, vb, vertsize, v2);
392 COPY_DWORDS(j, vb, vertsize, v3);
393 }
394
395 static void
396 intel_draw_triangle(struct intel_context *intel,
397 intelVertexPtr v0, intelVertexPtr v1, intelVertexPtr v2)
398 {
399 GLuint vertsize = intel->vertex_size;
400 GLuint *vb = intel_get_prim_space(intel, 3);
401 int j;
402
403 COPY_DWORDS(j, vb, vertsize, v0);
404 COPY_DWORDS(j, vb, vertsize, v1);
405 COPY_DWORDS(j, vb, vertsize, v2);
406 }
407
408
409 static void
410 intel_draw_line(struct intel_context *intel,
411 intelVertexPtr v0, intelVertexPtr v1)
412 {
413 GLuint vertsize = intel->vertex_size;
414 GLuint *vb = intel_get_prim_space(intel, 2);
415 int j;
416
417 COPY_DWORDS(j, vb, vertsize, v0);
418 COPY_DWORDS(j, vb, vertsize, v1);
419 }
420
421
422 static void
423 intel_draw_point(struct intel_context *intel, intelVertexPtr v0)
424 {
425 GLuint vertsize = intel->vertex_size;
426 GLuint *vb = intel_get_prim_space(intel, 1);
427 int j;
428
429 /* Adjust for sub pixel position -- still required for conform. */
430 *(float *) &vb[0] = v0->v.x;
431 *(float *) &vb[1] = v0->v.y;
432 for (j = 2; j < vertsize; j++)
433 vb[j] = v0->ui[j];
434 }
435
436
437
438 /***********************************************************************
439 * Fixup for ARB_point_parameters *
440 ***********************************************************************/
441
442 /* Currently not working - VERT_ATTRIB_POINTSIZE isn't correctly
443 * represented in the fragment program InputsRead field.
444 */
445 static void
446 intel_atten_point(struct intel_context *intel, intelVertexPtr v0)
447 {
448 struct gl_context *ctx = &intel->ctx;
449 GLfloat psz[4], col[4], restore_psz, restore_alpha;
450
451 _tnl_get_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
452 _tnl_get_attr(ctx, v0, _TNL_ATTRIB_COLOR0, col);
453
454 restore_psz = psz[0];
455 restore_alpha = col[3];
456
457 if (psz[0] >= ctx->Point.Threshold) {
458 psz[0] = MIN2(psz[0], ctx->Point.MaxSize);
459 }
460 else {
461 GLfloat dsize = psz[0] / ctx->Point.Threshold;
462 psz[0] = MAX2(ctx->Point.Threshold, ctx->Point.MinSize);
463 col[3] *= dsize * dsize;
464 }
465
466 if (psz[0] < 1.0)
467 psz[0] = 1.0;
468
469 if (restore_psz != psz[0] || restore_alpha != col[3]) {
470 _tnl_set_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
471 _tnl_set_attr(ctx, v0, _TNL_ATTRIB_COLOR0, col);
472
473 intel_draw_point(intel, v0);
474
475 psz[0] = restore_psz;
476 col[3] = restore_alpha;
477
478 _tnl_set_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
479 _tnl_set_attr(ctx, v0, _TNL_ATTRIB_COLOR0, col);
480 }
481 else
482 intel_draw_point(intel, v0);
483 }
484
485
486
487
488
489 /***********************************************************************
490 * Fixup for I915 WPOS texture coordinate *
491 ***********************************************************************/
492
493 static void
494 intel_emit_fragcoord(struct intel_context *intel, intelVertexPtr v)
495 {
496 struct gl_context *ctx = &intel->ctx;
497 struct gl_framebuffer *fb = ctx->DrawBuffer;
498 GLuint offset = intel->wpos_offset;
499 float *vertex_position = (float *)v;
500 float *fragcoord = (float *)((char *)v + offset);
501
502 fragcoord[0] = vertex_position[0];
503
504 if (_mesa_is_user_fbo(fb))
505 fragcoord[1] = vertex_position[1];
506 else
507 fragcoord[1] = fb->Height - vertex_position[1];
508
509 fragcoord[2] = vertex_position[2];
510 fragcoord[3] = vertex_position[3];
511 }
512
513 static void
514 intel_wpos_triangle(struct intel_context *intel,
515 intelVertexPtr v0, intelVertexPtr v1, intelVertexPtr v2)
516 {
517 intel_emit_fragcoord(intel, v0);
518 intel_emit_fragcoord(intel, v1);
519 intel_emit_fragcoord(intel, v2);
520
521 intel_draw_triangle(intel, v0, v1, v2);
522 }
523
524
525 static void
526 intel_wpos_line(struct intel_context *intel,
527 intelVertexPtr v0, intelVertexPtr v1)
528 {
529 intel_emit_fragcoord(intel, v0);
530 intel_emit_fragcoord(intel, v1);
531 intel_draw_line(intel, v0, v1);
532 }
533
534
535 static void
536 intel_wpos_point(struct intel_context *intel, intelVertexPtr v0)
537 {
538 intel_emit_fragcoord(intel, v0);
539 intel_draw_point(intel, v0);
540 }
541
542
543
544
545
546
547 /***********************************************************************
548 * Macros for t_dd_tritmp.h to draw basic primitives *
549 ***********************************************************************/
550
551 #define TRI( a, b, c ) \
552 do { \
553 if (DO_FALLBACK) \
554 intel->draw_tri( intel, a, b, c ); \
555 else \
556 intel_draw_triangle( intel, a, b, c ); \
557 } while (0)
558
559 #define QUAD( a, b, c, d ) \
560 do { \
561 if (DO_FALLBACK) { \
562 intel->draw_tri( intel, a, b, d ); \
563 intel->draw_tri( intel, b, c, d ); \
564 } else \
565 intel_draw_quad( intel, a, b, c, d ); \
566 } while (0)
567
568 #define LINE( v0, v1 ) \
569 do { \
570 if (DO_FALLBACK) \
571 intel->draw_line( intel, v0, v1 ); \
572 else \
573 intel_draw_line( intel, v0, v1 ); \
574 } while (0)
575
576 #define POINT( v0 ) \
577 do { \
578 if (DO_FALLBACK) \
579 intel->draw_point( intel, v0 ); \
580 else \
581 intel_draw_point( intel, v0 ); \
582 } while (0)
583
584
585 /***********************************************************************
586 * Build render functions from dd templates *
587 ***********************************************************************/
588
589 #define INTEL_OFFSET_BIT 0x01
590 #define INTEL_TWOSIDE_BIT 0x02
591 #define INTEL_UNFILLED_BIT 0x04
592 #define INTEL_FALLBACK_BIT 0x08
593 #define INTEL_MAX_TRIFUNC 0x10
594
595
596 static struct
597 {
598 tnl_points_func points;
599 tnl_line_func line;
600 tnl_triangle_func triangle;
601 tnl_quad_func quad;
602 } rast_tab[INTEL_MAX_TRIFUNC];
603
604
605 #define DO_FALLBACK (IND & INTEL_FALLBACK_BIT)
606 #define DO_OFFSET (IND & INTEL_OFFSET_BIT)
607 #define DO_UNFILLED (IND & INTEL_UNFILLED_BIT)
608 #define DO_TWOSIDE (IND & INTEL_TWOSIDE_BIT)
609 #define DO_FLAT 0
610 #define DO_TRI 1
611 #define DO_QUAD 1
612 #define DO_LINE 1
613 #define DO_POINTS 1
614 #define DO_FULL_QUAD 1
615
616 #define HAVE_SPEC 1
617 #define HAVE_BACK_COLORS 0
618 #define HAVE_HW_FLATSHADE 1
619 #define VERTEX intelVertex
620 #define TAB rast_tab
621
622 /* Only used to pull back colors into vertices (ie, we know color is
623 * floating point).
624 */
625 #define INTEL_COLOR( dst, src ) \
626 do { \
627 UNCLAMPED_FLOAT_TO_UBYTE((dst)[0], (src)[2]); \
628 UNCLAMPED_FLOAT_TO_UBYTE((dst)[1], (src)[1]); \
629 UNCLAMPED_FLOAT_TO_UBYTE((dst)[2], (src)[0]); \
630 UNCLAMPED_FLOAT_TO_UBYTE((dst)[3], (src)[3]); \
631 } while (0)
632
633 #define INTEL_SPEC( dst, src ) \
634 do { \
635 UNCLAMPED_FLOAT_TO_UBYTE((dst)[0], (src)[2]); \
636 UNCLAMPED_FLOAT_TO_UBYTE((dst)[1], (src)[1]); \
637 UNCLAMPED_FLOAT_TO_UBYTE((dst)[2], (src)[0]); \
638 } while (0)
639
640
641 #define DEPTH_SCALE (ctx->DrawBuffer->Visual.depthBits == 16 ? 1.0 : 2.0)
642 #define UNFILLED_TRI unfilled_tri
643 #define UNFILLED_QUAD unfilled_quad
644 #define VERT_X(_v) _v->v.x
645 #define VERT_Y(_v) _v->v.y
646 #define VERT_Z(_v) _v->v.z
647 #define AREA_IS_CCW( a ) (a > 0)
648 #define GET_VERTEX(e) (intel->verts + (e * intel->vertex_size * sizeof(GLuint)))
649
650 #define VERT_SET_RGBA( v, c ) if (coloroffset) INTEL_COLOR( v->ub4[coloroffset], c )
651 #define VERT_COPY_RGBA( v0, v1 ) if (coloroffset) v0->ui[coloroffset] = v1->ui[coloroffset]
652 #define VERT_SAVE_RGBA( idx ) if (coloroffset) color[idx] = v[idx]->ui[coloroffset]
653 #define VERT_RESTORE_RGBA( idx ) if (coloroffset) v[idx]->ui[coloroffset] = color[idx]
654
655 #define VERT_SET_SPEC( v, c ) if (specoffset) INTEL_SPEC( v->ub4[specoffset], c )
656 #define VERT_COPY_SPEC( v0, v1 ) if (specoffset) COPY_3V(v0->ub4[specoffset], v1->ub4[specoffset])
657 #define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
658 #define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
659
660 #define LOCAL_VARS(n) \
661 struct intel_context *intel = intel_context(ctx); \
662 GLuint color[n] = { 0, }, spec[n] = { 0, }; \
663 GLuint coloroffset = intel->coloroffset; \
664 GLuint specoffset = intel->specoffset; \
665 (void) color; (void) spec; (void) coloroffset; (void) specoffset;
666
667
668 /***********************************************************************
669 * Helpers for rendering unfilled primitives *
670 ***********************************************************************/
671
672 static const GLuint hw_prim[GL_POLYGON + 1] = {
673 PRIM3D_POINTLIST,
674 PRIM3D_LINELIST,
675 PRIM3D_LINELIST,
676 PRIM3D_LINELIST,
677 PRIM3D_TRILIST,
678 PRIM3D_TRILIST,
679 PRIM3D_TRILIST,
680 PRIM3D_TRILIST,
681 PRIM3D_TRILIST,
682 PRIM3D_TRILIST
683 };
684
685 #define RASTERIZE(x) intelRasterPrimitive( ctx, x, hw_prim[x] )
686 #define RENDER_PRIMITIVE intel->render_primitive
687 #define TAG(x) x
688 #define IND INTEL_FALLBACK_BIT
689 #include "tnl_dd/t_dd_unfilled.h"
690 #undef IND
691
692 /***********************************************************************
693 * Generate GL render functions *
694 ***********************************************************************/
695
696 #define IND (0)
697 #define TAG(x) x
698 #include "tnl_dd/t_dd_tritmp.h"
699
700 #define IND (INTEL_OFFSET_BIT)
701 #define TAG(x) x##_offset
702 #include "tnl_dd/t_dd_tritmp.h"
703
704 #define IND (INTEL_TWOSIDE_BIT)
705 #define TAG(x) x##_twoside
706 #include "tnl_dd/t_dd_tritmp.h"
707
708 #define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT)
709 #define TAG(x) x##_twoside_offset
710 #include "tnl_dd/t_dd_tritmp.h"
711
712 #define IND (INTEL_UNFILLED_BIT)
713 #define TAG(x) x##_unfilled
714 #include "tnl_dd/t_dd_tritmp.h"
715
716 #define IND (INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT)
717 #define TAG(x) x##_offset_unfilled
718 #include "tnl_dd/t_dd_tritmp.h"
719
720 #define IND (INTEL_TWOSIDE_BIT|INTEL_UNFILLED_BIT)
721 #define TAG(x) x##_twoside_unfilled
722 #include "tnl_dd/t_dd_tritmp.h"
723
724 #define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT)
725 #define TAG(x) x##_twoside_offset_unfilled
726 #include "tnl_dd/t_dd_tritmp.h"
727
728 #define IND (INTEL_FALLBACK_BIT)
729 #define TAG(x) x##_fallback
730 #include "tnl_dd/t_dd_tritmp.h"
731
732 #define IND (INTEL_OFFSET_BIT|INTEL_FALLBACK_BIT)
733 #define TAG(x) x##_offset_fallback
734 #include "tnl_dd/t_dd_tritmp.h"
735
736 #define IND (INTEL_TWOSIDE_BIT|INTEL_FALLBACK_BIT)
737 #define TAG(x) x##_twoside_fallback
738 #include "tnl_dd/t_dd_tritmp.h"
739
740 #define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_FALLBACK_BIT)
741 #define TAG(x) x##_twoside_offset_fallback
742 #include "tnl_dd/t_dd_tritmp.h"
743
744 #define IND (INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
745 #define TAG(x) x##_unfilled_fallback
746 #include "tnl_dd/t_dd_tritmp.h"
747
748 #define IND (INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
749 #define TAG(x) x##_offset_unfilled_fallback
750 #include "tnl_dd/t_dd_tritmp.h"
751
752 #define IND (INTEL_TWOSIDE_BIT|INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
753 #define TAG(x) x##_twoside_unfilled_fallback
754 #include "tnl_dd/t_dd_tritmp.h"
755
756 #define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT| \
757 INTEL_FALLBACK_BIT)
758 #define TAG(x) x##_twoside_offset_unfilled_fallback
759 #include "tnl_dd/t_dd_tritmp.h"
760
761
762 static void
763 init_rast_tab(void)
764 {
765 init();
766 init_offset();
767 init_twoside();
768 init_twoside_offset();
769 init_unfilled();
770 init_offset_unfilled();
771 init_twoside_unfilled();
772 init_twoside_offset_unfilled();
773 init_fallback();
774 init_offset_fallback();
775 init_twoside_fallback();
776 init_twoside_offset_fallback();
777 init_unfilled_fallback();
778 init_offset_unfilled_fallback();
779 init_twoside_unfilled_fallback();
780 init_twoside_offset_unfilled_fallback();
781 }
782
783
784 /***********************************************************************
785 * Rasterization fallback helpers *
786 ***********************************************************************/
787
788
789 /* This code is hit only when a mix of accelerated and unaccelerated
790 * primitives are being drawn, and only for the unaccelerated
791 * primitives.
792 */
793 static void
794 intel_fallback_tri(struct intel_context *intel,
795 intelVertex * v0, intelVertex * v1, intelVertex * v2)
796 {
797 struct gl_context *ctx = &intel->ctx;
798 SWvertex v[3];
799
800 if (0)
801 fprintf(stderr, "\n%s\n", __FUNCTION__);
802
803 INTEL_FIREVERTICES(intel);
804
805 _swsetup_Translate(ctx, v0, &v[0]);
806 _swsetup_Translate(ctx, v1, &v[1]);
807 _swsetup_Translate(ctx, v2, &v[2]);
808 _swrast_render_start(ctx);
809 _swrast_Triangle(ctx, &v[0], &v[1], &v[2]);
810 _swrast_render_finish(ctx);
811 }
812
813
814 static void
815 intel_fallback_line(struct intel_context *intel,
816 intelVertex * v0, intelVertex * v1)
817 {
818 struct gl_context *ctx = &intel->ctx;
819 SWvertex v[2];
820
821 if (0)
822 fprintf(stderr, "\n%s\n", __FUNCTION__);
823
824 INTEL_FIREVERTICES(intel);
825
826 _swsetup_Translate(ctx, v0, &v[0]);
827 _swsetup_Translate(ctx, v1, &v[1]);
828 _swrast_render_start(ctx);
829 _swrast_Line(ctx, &v[0], &v[1]);
830 _swrast_render_finish(ctx);
831 }
832
833 static void
834 intel_fallback_point(struct intel_context *intel,
835 intelVertex * v0)
836 {
837 struct gl_context *ctx = &intel->ctx;
838 SWvertex v[1];
839
840 if (0)
841 fprintf(stderr, "\n%s\n", __FUNCTION__);
842
843 INTEL_FIREVERTICES(intel);
844
845 _swsetup_Translate(ctx, v0, &v[0]);
846 _swrast_render_start(ctx);
847 _swrast_Point(ctx, &v[0]);
848 _swrast_render_finish(ctx);
849 }
850
851
852 /**********************************************************************/
853 /* Render unclipped begin/end objects */
854 /**********************************************************************/
855
856 #define IND 0
857 #define V(x) (intelVertex *)(vertptr + ((x)*vertsize*sizeof(GLuint)))
858 #define RENDER_POINTS( start, count ) \
859 for ( ; start < count ; start++) POINT( V(ELT(start)) );
860 #define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
861 #define RENDER_TRI( v0, v1, v2 ) TRI( V(v0), V(v1), V(v2) )
862 #define RENDER_QUAD( v0, v1, v2, v3 ) QUAD( V(v0), V(v1), V(v2), V(v3) )
863 #define INIT(x) intelRenderPrimitive( ctx, x )
864 #undef LOCAL_VARS
865 #define LOCAL_VARS \
866 struct intel_context *intel = intel_context(ctx); \
867 GLubyte *vertptr = (GLubyte *)intel->verts; \
868 const GLuint vertsize = intel->vertex_size; \
869 const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
870 (void) elt;
871 #define RESET_STIPPLE
872 #define RESET_OCCLUSION
873 #define PRESERVE_VB_DEFS
874 #define ELT(x) x
875 #define TAG(x) intel_##x##_verts
876 #include "tnl/t_vb_rendertmp.h"
877 #undef ELT
878 #undef TAG
879 #define TAG(x) intel_##x##_elts
880 #define ELT(x) elt[x]
881 #include "tnl/t_vb_rendertmp.h"
882
883 /**********************************************************************/
884 /* Render clipped primitives */
885 /**********************************************************************/
886
887
888
889 static void
890 intelRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
891 {
892 struct intel_context *intel = intel_context(ctx);
893 TNLcontext *tnl = TNL_CONTEXT(ctx);
894 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
895 GLuint prim = intel->render_primitive;
896
897 /* Render the new vertices as an unclipped polygon.
898 */
899 {
900 GLuint *tmp = VB->Elts;
901 VB->Elts = (GLuint *) elts;
902 tnl->Driver.Render.PrimTabElts[GL_POLYGON] (ctx, 0, n,
903 PRIM_BEGIN | PRIM_END);
904 VB->Elts = tmp;
905 }
906
907 /* Restore the render primitive
908 */
909 if (prim != GL_POLYGON)
910 tnl->Driver.Render.PrimitiveNotify(ctx, prim);
911 }
912
913 static void
914 intelRenderClippedLine(struct gl_context * ctx, GLuint ii, GLuint jj)
915 {
916 TNLcontext *tnl = TNL_CONTEXT(ctx);
917
918 tnl->Driver.Render.Line(ctx, ii, jj);
919 }
920
921 static void
922 intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
923 {
924 struct intel_context *intel = intel_context(ctx);
925 const GLuint vertsize = intel->vertex_size;
926 GLuint *vb = intel_get_prim_space(intel, (n - 2) * 3);
927 GLubyte *vertptr = (GLubyte *) intel->verts;
928 const GLuint *start = (const GLuint *) V(elts[0]);
929 int i, j;
930
931 for (i = 2; i < n; i++) {
932 COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
933 COPY_DWORDS(j, vb, vertsize, V(elts[i]));
934 COPY_DWORDS(j, vb, vertsize, start);
935 }
936 }
937
938 /**********************************************************************/
939 /* Choose render functions */
940 /**********************************************************************/
941
942
943 #define DD_TRI_LIGHT_TWOSIDE (1 << 1)
944 #define DD_TRI_UNFILLED (1 << 2)
945 #define DD_TRI_STIPPLE (1 << 4)
946 #define DD_TRI_OFFSET (1 << 5)
947 #define DD_LINE_STIPPLE (1 << 7)
948 #define DD_POINT_ATTEN (1 << 9)
949
950 #define ANY_FALLBACK_FLAGS (DD_LINE_STIPPLE | DD_TRI_STIPPLE | DD_POINT_ATTEN)
951 #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED)
952
953 void
954 intelChooseRenderState(struct gl_context * ctx)
955 {
956 TNLcontext *tnl = TNL_CONTEXT(ctx);
957 struct intel_context *intel = intel_context(ctx);
958 GLuint flags =
959 ((ctx->Light.Enabled &&
960 ctx->Light.Model.TwoSide) ? DD_TRI_LIGHT_TWOSIDE : 0) |
961 ((ctx->Polygon.FrontMode != GL_FILL ||
962 ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) |
963 (ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
964 ((ctx->Polygon.OffsetPoint ||
965 ctx->Polygon.OffsetLine ||
966 ctx->Polygon.OffsetFill) ? DD_TRI_OFFSET : 0) |
967 (ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0) |
968 (ctx->Point._Attenuated ? DD_POINT_ATTEN : 0);
969 const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
970 bool have_wpos = (fprog && (fprog->Base.InputsRead & VARYING_BIT_POS));
971 GLuint index = 0;
972
973 if (INTEL_DEBUG & DEBUG_STATE)
974 fprintf(stderr, "\n%s\n", __FUNCTION__);
975
976 if ((flags & (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS)) || have_wpos) {
977
978 if (flags & ANY_RASTER_FLAGS) {
979 if (flags & DD_TRI_LIGHT_TWOSIDE)
980 index |= INTEL_TWOSIDE_BIT;
981 if (flags & DD_TRI_OFFSET)
982 index |= INTEL_OFFSET_BIT;
983 if (flags & DD_TRI_UNFILLED)
984 index |= INTEL_UNFILLED_BIT;
985 }
986
987 if (have_wpos) {
988 intel->draw_point = intel_wpos_point;
989 intel->draw_line = intel_wpos_line;
990 intel->draw_tri = intel_wpos_triangle;
991
992 /* Make sure these get called:
993 */
994 index |= INTEL_FALLBACK_BIT;
995 }
996 else {
997 intel->draw_point = intel_draw_point;
998 intel->draw_line = intel_draw_line;
999 intel->draw_tri = intel_draw_triangle;
1000 }
1001
1002 /* Hook in fallbacks for specific primitives.
1003 */
1004 if (flags & ANY_FALLBACK_FLAGS) {
1005 if (flags & DD_LINE_STIPPLE)
1006 intel->draw_line = intel_fallback_line;
1007
1008 if ((flags & DD_TRI_STIPPLE) && !intel->hw_stipple)
1009 intel->draw_tri = intel_fallback_tri;
1010
1011 if (flags & DD_POINT_ATTEN) {
1012 if (0)
1013 intel->draw_point = intel_atten_point;
1014 else
1015 intel->draw_point = intel_fallback_point;
1016 }
1017
1018 index |= INTEL_FALLBACK_BIT;
1019 }
1020 }
1021
1022 if (intel->RenderIndex != index) {
1023 intel->RenderIndex = index;
1024
1025 tnl->Driver.Render.Points = rast_tab[index].points;
1026 tnl->Driver.Render.Line = rast_tab[index].line;
1027 tnl->Driver.Render.Triangle = rast_tab[index].triangle;
1028 tnl->Driver.Render.Quad = rast_tab[index].quad;
1029
1030 if (index == 0) {
1031 tnl->Driver.Render.PrimTabVerts = intel_render_tab_verts;
1032 tnl->Driver.Render.PrimTabElts = intel_render_tab_elts;
1033 tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
1034 tnl->Driver.Render.ClippedPolygon = intelFastRenderClippedPoly;
1035 }
1036 else {
1037 tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
1038 tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
1039 tnl->Driver.Render.ClippedLine = intelRenderClippedLine;
1040 tnl->Driver.Render.ClippedPolygon = intelRenderClippedPoly;
1041 }
1042 }
1043 }
1044
1045 static const GLenum reduced_prim[GL_POLYGON + 1] = {
1046 GL_POINTS,
1047 GL_LINES,
1048 GL_LINES,
1049 GL_LINES,
1050 GL_TRIANGLES,
1051 GL_TRIANGLES,
1052 GL_TRIANGLES,
1053 GL_TRIANGLES,
1054 GL_TRIANGLES,
1055 GL_TRIANGLES
1056 };
1057
1058
1059 /**********************************************************************/
1060 /* High level hooks for t_vb_render.c */
1061 /**********************************************************************/
1062
1063
1064
1065
1066 static void
1067 intelRunPipeline(struct gl_context * ctx)
1068 {
1069 struct intel_context *intel = intel_context(ctx);
1070
1071 _mesa_lock_context_textures(ctx);
1072
1073 if (ctx->NewState)
1074 _mesa_update_state_locked(ctx);
1075
1076 /* We need to get this done before we start the pipeline, or a
1077 * change in the INTEL_FALLBACK() of its intel_draw_buffers() call
1078 * while the pipeline is running will result in mismatched swrast
1079 * map/unmaps, and later assertion failures.
1080 */
1081 intel_prepare_render(intel);
1082
1083 if (intel->NewGLState) {
1084 if (intel->NewGLState & _NEW_TEXTURE) {
1085 intel->vtbl.update_texture_state(intel);
1086 }
1087
1088 if (!intel->Fallback) {
1089 if (intel->NewGLState & _INTEL_NEW_RENDERSTATE)
1090 intelChooseRenderState(ctx);
1091 }
1092
1093 intel->NewGLState = 0;
1094 }
1095
1096 intel->tnl_pipeline_running = true;
1097 _tnl_run_pipeline(ctx);
1098 intel->tnl_pipeline_running = false;
1099
1100 _mesa_unlock_context_textures(ctx);
1101 }
1102
1103 static void
1104 intelRenderStart(struct gl_context * ctx)
1105 {
1106 struct intel_context *intel = intel_context(ctx);
1107
1108 intel_check_front_buffer_rendering(intel);
1109 intel->vtbl.render_start(intel_context(ctx));
1110 intel->vtbl.emit_state(intel);
1111 }
1112
1113 static void
1114 intelRenderFinish(struct gl_context * ctx)
1115 {
1116 struct intel_context *intel = intel_context(ctx);
1117
1118 if (intel->RenderIndex & INTEL_FALLBACK_BIT)
1119 _swrast_flush(ctx);
1120
1121 INTEL_FIREVERTICES(intel);
1122 }
1123
1124
1125
1126
1127 /* System to flush dma and emit state changes based on the rasterized
1128 * primitive.
1129 */
1130 static void
1131 intelRasterPrimitive(struct gl_context * ctx, GLenum rprim, GLuint hwprim)
1132 {
1133 struct intel_context *intel = intel_context(ctx);
1134
1135 if (0)
1136 fprintf(stderr, "%s %s %x\n", __FUNCTION__,
1137 _mesa_lookup_enum_by_nr(rprim), hwprim);
1138
1139 intel->vtbl.reduced_primitive_state(intel, rprim);
1140
1141 /* Start a new primitive. Arrange to have it flushed later on.
1142 */
1143 if (hwprim != intel->prim.primitive) {
1144 INTEL_FIREVERTICES(intel);
1145
1146 intel_set_prim(intel, hwprim);
1147 }
1148 }
1149
1150
1151 /*
1152 */
1153 static void
1154 intelRenderPrimitive(struct gl_context * ctx, GLenum prim)
1155 {
1156 struct intel_context *intel = intel_context(ctx);
1157 GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
1158 ctx->Polygon.BackMode != GL_FILL);
1159
1160 if (0)
1161 fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(prim));
1162
1163 /* Let some clipping routines know which primitive they're dealing
1164 * with.
1165 */
1166 intel->render_primitive = prim;
1167
1168 /* Shortcircuit this when called for unfilled triangles. The rasterized
1169 * primitive will always be reset by lower level functions in that case,
1170 * potentially pingponging the state:
1171 */
1172 if (reduced_prim[prim] == GL_TRIANGLES && unfilled)
1173 return;
1174
1175 /* Set some primitive-dependent state and Start? a new primitive.
1176 */
1177 intelRasterPrimitive(ctx, reduced_prim[prim], hw_prim[prim]);
1178 }
1179
1180
1181 /**********************************************************************/
1182 /* Transition to/from hardware rasterization. */
1183 /**********************************************************************/
1184
1185 static char *fallbackStrings[] = {
1186 [0] = "Draw buffer",
1187 [1] = "Read buffer",
1188 [2] = "Depth buffer",
1189 [3] = "Stencil buffer",
1190 [4] = "User disable",
1191 [5] = "Render mode",
1192
1193 [12] = "Texture",
1194 [13] = "Color mask",
1195 [14] = "Stencil",
1196 [15] = "Stipple",
1197 [16] = "Program",
1198 [17] = "Logic op",
1199 [18] = "Smooth polygon",
1200 [19] = "Smooth point",
1201 [20] = "point sprite coord origin",
1202 [21] = "depth/color drawing offset",
1203 [22] = "coord replace(SPRITE POINT ENABLE)",
1204 };
1205
1206
1207 static char *
1208 getFallbackString(GLuint bit)
1209 {
1210 int i = 0;
1211 while (bit > 1) {
1212 i++;
1213 bit >>= 1;
1214 }
1215 return fallbackStrings[i];
1216 }
1217
1218
1219
1220 /**
1221 * Enable/disable a fallback flag.
1222 * \param bit one of INTEL_FALLBACK_x flags.
1223 */
1224 void
1225 intelFallback(struct intel_context *intel, GLbitfield bit, bool mode)
1226 {
1227 struct gl_context *ctx = &intel->ctx;
1228 TNLcontext *tnl = TNL_CONTEXT(ctx);
1229 const GLbitfield oldfallback = intel->Fallback;
1230
1231 if (mode) {
1232 intel->Fallback |= bit;
1233 if (oldfallback == 0) {
1234 assert(!intel->tnl_pipeline_running);
1235
1236 intel_flush(ctx);
1237 if (INTEL_DEBUG & DEBUG_PERF)
1238 fprintf(stderr, "ENTER FALLBACK %x: %s\n",
1239 bit, getFallbackString(bit));
1240 _swsetup_Wakeup(ctx);
1241 intel->RenderIndex = ~0;
1242 }
1243 }
1244 else {
1245 intel->Fallback &= ~bit;
1246 if (oldfallback == bit) {
1247 assert(!intel->tnl_pipeline_running);
1248
1249 _swrast_flush(ctx);
1250 if (INTEL_DEBUG & DEBUG_PERF)
1251 fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString(bit));
1252 tnl->Driver.Render.Start = intelRenderStart;
1253 tnl->Driver.Render.PrimitiveNotify = intelRenderPrimitive;
1254 tnl->Driver.Render.Finish = intelRenderFinish;
1255 tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
1256 tnl->Driver.Render.CopyPV = _tnl_copy_pv;
1257 tnl->Driver.Render.Interp = _tnl_interp;
1258
1259 _tnl_invalidate_vertex_state(ctx, ~0);
1260 _tnl_invalidate_vertices(ctx, ~0);
1261 _tnl_install_attrs(ctx,
1262 intel->vertex_attrs,
1263 intel->vertex_attr_count,
1264 intel->ViewportMatrix.m, 0);
1265
1266 intel->NewGLState |= _INTEL_NEW_RENDERSTATE;
1267 }
1268 }
1269 }
1270
1271 union fi
1272 {
1273 GLfloat f;
1274 GLint i;
1275 };
1276
1277 /**********************************************************************/
1278 /* Initialization. */
1279 /**********************************************************************/
1280
1281
1282 void
1283 intelInitTriFuncs(struct gl_context * ctx)
1284 {
1285 TNLcontext *tnl = TNL_CONTEXT(ctx);
1286 static int firsttime = 1;
1287
1288 if (firsttime) {
1289 init_rast_tab();
1290 firsttime = 0;
1291 }
1292
1293 tnl->Driver.RunPipeline = intelRunPipeline;
1294 tnl->Driver.Render.Start = intelRenderStart;
1295 tnl->Driver.Render.Finish = intelRenderFinish;
1296 tnl->Driver.Render.PrimitiveNotify = intelRenderPrimitive;
1297 tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
1298 tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
1299 tnl->Driver.Render.CopyPV = _tnl_copy_pv;
1300 tnl->Driver.Render.Interp = _tnl_interp;
1301 }