2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2006 Stephane Marchesin. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sub license,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
26 /* Software TCL for NV10, NV20, NV30, NV40, NV50 */
38 #include "swrast/swrast.h"
39 #include "swrast_setup/swrast_setup.h"
40 #include "tnl/t_context.h"
41 #include "tnl/t_pipeline.h"
43 #include "nouveau_swtcl.h"
44 #include "nv10_swtcl.h"
45 #include "nouveau_context.h"
46 #include "nouveau_span.h"
47 #include "nouveau_reg.h"
48 #include "nouveau_tex.h"
49 #include "nouveau_fifo.h"
50 #include "nouveau_msg.h"
51 #include "nouveau_object.h"
53 static void nv10RasterPrimitive( GLcontext
*ctx
, GLenum rprim
, GLuint hwprim
);
54 static void nv10RenderPrimitive( GLcontext
*ctx
, GLenum prim
);
55 static void nv10ResetLineStipple( GLcontext
*ctx
);
59 static inline void nv10StartPrimitive(struct nouveau_context
* nmesa
,uint32_t primitive
,uint32_t size
)
61 if (nmesa
->screen
->card
->type
==NV_10
)
62 BEGIN_RING_SIZE(NvSub3D
,NV10_TCL_PRIMITIVE_3D_BEGIN_END
,1);
63 else if (nmesa
->screen
->card
->type
==NV_20
)
64 BEGIN_RING_SIZE(NvSub3D
,NV20_TCL_PRIMITIVE_3D_BEGIN_END
,1);
66 BEGIN_RING_SIZE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_BEGIN_END
,1);
69 if (nmesa
->screen
->card
->type
==NV_10
)
70 BEGIN_RING_SIZE(NvSub3D
,NV10_TCL_PRIMITIVE_3D_VERTEX_ARRAY_DATA
|NONINC_METHOD
,size
);
71 else if (nmesa
->screen
->card
->type
==NV_20
)
72 BEGIN_RING_SIZE(NvSub3D
,NV20_TCL_PRIMITIVE_3D_VERTEX_DATA
|NONINC_METHOD
,size
);
74 BEGIN_RING_SIZE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_VERTEX_DATA
|NONINC_METHOD
,size
);
77 inline void nv10FinishPrimitive(struct nouveau_context
*nmesa
)
79 if (nmesa
->screen
->card
->type
==NV_10
)
80 BEGIN_RING_SIZE(NvSub3D
,NV10_TCL_PRIMITIVE_3D_BEGIN_END
,1);
81 else if (nmesa
->screen
->card
->type
==NV_20
)
82 BEGIN_RING_SIZE(NvSub3D
,NV20_TCL_PRIMITIVE_3D_BEGIN_END
,1);
84 BEGIN_RING_SIZE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_BEGIN_END
,1);
90 static inline void nv10ExtendPrimitive(struct nouveau_context
* nmesa
, int size
)
92 /* make sure there's enough room. if not, wait */
93 if (RING_AVAILABLE()<size
)
95 WAIT_RING(nmesa
,size
);
99 /**********************************************************************/
100 /* Render unclipped begin/end objects */
101 /**********************************************************************/
103 static inline void nv10_render_generic_primitive_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
,GLuint prim
)
105 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
106 GLubyte
*vertptr
= (GLubyte
*)nmesa
->verts
;
107 GLuint vertsize
= nmesa
->vertex_size
;
108 GLuint size_dword
= vertsize
*(count
-start
)/4;
110 nv10ExtendPrimitive(nmesa
, size_dword
);
111 nv10StartPrimitive(nmesa
,prim
+1,size_dword
);
112 OUT_RINGp((nouveauVertex
*)(vertptr
+(start
*vertsize
)),size_dword
);
113 nv10FinishPrimitive(nmesa
);
116 static void nv10_render_points_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
118 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_POINTS
);
121 static void nv10_render_lines_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
123 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_LINES
);
126 static void nv10_render_line_strip_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
128 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_LINE_STRIP
);
131 static void nv10_render_line_loop_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
133 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_LINE_LOOP
);
136 static void nv10_render_triangles_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
138 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_TRIANGLES
);
141 static void nv10_render_tri_strip_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
143 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_TRIANGLE_STRIP
);
146 static void nv10_render_tri_fan_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
148 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_TRIANGLE_FAN
);
151 static void nv10_render_quads_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
153 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_QUADS
);
156 static void nv10_render_quad_strip_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
158 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_QUAD_STRIP
);
161 static void nv10_render_poly_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
163 nv10_render_generic_primitive_verts(ctx
,start
,count
,flags
,GL_POLYGON
);
166 static void nv10_render_noop_verts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
170 static void (*nv10_render_tab_verts
[GL_POLYGON
+2])(GLcontext
*,
175 nv10_render_points_verts
,
176 nv10_render_lines_verts
,
177 nv10_render_line_loop_verts
,
178 nv10_render_line_strip_verts
,
179 nv10_render_triangles_verts
,
180 nv10_render_tri_strip_verts
,
181 nv10_render_tri_fan_verts
,
182 nv10_render_quads_verts
,
183 nv10_render_quad_strip_verts
,
184 nv10_render_poly_verts
,
185 nv10_render_noop_verts
,
189 static inline void nv10_render_generic_primitive_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
,GLuint prim
)
191 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
192 GLubyte
*vertptr
= (GLubyte
*)nmesa
->verts
;
193 GLuint vertsize
= nmesa
->vertex_size
;
194 GLuint size_dword
= vertsize
*(count
-start
)/4;
195 const GLuint
* const elt
= TNL_CONTEXT(ctx
)->vb
.Elts
;
198 nv10ExtendPrimitive(nmesa
, size_dword
);
199 nv10StartPrimitive(nmesa
,prim
+1,size_dword
);
200 for (j
=start
; j
<count
; j
++ ) {
201 OUT_RINGp((nouveauVertex
*)(vertptr
+(elt
[j
]*vertsize
)),vertsize
/4);
203 nv10FinishPrimitive(nmesa
);
206 static void nv10_render_points_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
208 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_POINTS
);
211 static void nv10_render_lines_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
213 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_LINES
);
216 static void nv10_render_line_strip_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
218 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_LINE_STRIP
);
221 static void nv10_render_line_loop_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
223 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_LINE_LOOP
);
226 static void nv10_render_triangles_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
228 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_TRIANGLES
);
231 static void nv10_render_tri_strip_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
233 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_TRIANGLE_STRIP
);
236 static void nv10_render_tri_fan_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
238 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_TRIANGLE_FAN
);
241 static void nv10_render_quads_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
243 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_QUADS
);
246 static void nv10_render_quad_strip_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
248 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_QUAD_STRIP
);
251 static void nv10_render_poly_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
253 nv10_render_generic_primitive_elts(ctx
,start
,count
,flags
,GL_POLYGON
);
256 static void nv10_render_noop_elts(GLcontext
*ctx
,GLuint start
,GLuint count
,GLuint flags
)
260 static void (*nv10_render_tab_elts
[GL_POLYGON
+2])(GLcontext
*,
265 nv10_render_points_elts
,
266 nv10_render_lines_elts
,
267 nv10_render_line_loop_elts
,
268 nv10_render_line_strip_elts
,
269 nv10_render_triangles_elts
,
270 nv10_render_tri_strip_elts
,
271 nv10_render_tri_fan_elts
,
272 nv10_render_quads_elts
,
273 nv10_render_quad_strip_elts
,
274 nv10_render_poly_elts
,
275 nv10_render_noop_elts
,
279 /**********************************************************************/
280 /* Choose render functions */
281 /**********************************************************************/
284 #define EMIT_ATTR( ATTR, STYLE ) \
286 nmesa->vertex_attrs[nmesa->vertex_attr_count].attrib = (ATTR); \
287 nmesa->vertex_attrs[nmesa->vertex_attr_count].format = (STYLE); \
288 nmesa->vertex_attr_count++; \
291 static void nv10_render_clipped_line(GLcontext
*ctx
,GLuint ii
,GLuint jj
)
296 static void nv10_render_clipped_poly(GLcontext
*ctx
,const GLuint
*elts
,GLuint n
)
298 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
299 struct vertex_buffer
*VB
= &tnl
->vb
;
300 GLuint
*tmp
= VB
->Elts
;
301 VB
->Elts
= (GLuint
*)elts
;
302 nv10_render_generic_primitive_elts( ctx
, 0, n
, PRIM_BEGIN
|PRIM_END
,GL_POLYGON
);
306 static inline void nv10_render_points(GLcontext
*ctx
,GLuint first
,GLuint last
)
308 WARN_ONCE("Unimplemented\n");
311 static inline void nv10_render_line(GLcontext
*ctx
,GLuint v1
,GLuint v2
)
313 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
314 GLubyte
*vertptr
= (GLubyte
*)nmesa
->verts
;
315 GLuint vertsize
= nmesa
->vertex_size
;
316 GLuint size_dword
= vertsize
*(2)/4;
318 /* OUT_RINGp wants size in DWORDS */
321 nv10ExtendPrimitive(nmesa
, size_dword
);
322 nv10StartPrimitive(nmesa
,GL_LINES
+1,size_dword
);
323 OUT_RINGp((nouveauVertex
*)(vertptr
+(v1
*vertsize
)),vertsize
);
324 OUT_RINGp((nouveauVertex
*)(vertptr
+(v2
*vertsize
)),vertsize
);
325 nv10FinishPrimitive(nmesa
);
328 static inline void nv10_render_triangle(GLcontext
*ctx
,GLuint v1
,GLuint v2
,GLuint v3
)
330 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
331 GLubyte
*vertptr
= (GLubyte
*)nmesa
->verts
;
332 GLuint vertsize
= nmesa
->vertex_size
;
333 GLuint size_dword
= vertsize
*(3)/4;
335 /* OUT_RINGp wants size in DWORDS */
338 nv10ExtendPrimitive(nmesa
, size_dword
);
339 nv10StartPrimitive(nmesa
,GL_TRIANGLES
+1,size_dword
);
340 OUT_RINGp((nouveauVertex
*)(vertptr
+(v1
*vertsize
)),vertsize
);
341 OUT_RINGp((nouveauVertex
*)(vertptr
+(v2
*vertsize
)),vertsize
);
342 OUT_RINGp((nouveauVertex
*)(vertptr
+(v3
*vertsize
)),vertsize
);
343 nv10FinishPrimitive(nmesa
);
346 static inline void nv10_render_quad(GLcontext
*ctx
,GLuint v1
,GLuint v2
,GLuint v3
,GLuint v4
)
348 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
349 GLubyte
*vertptr
= (GLubyte
*)nmesa
->verts
;
350 GLuint vertsize
= nmesa
->vertex_size
;
351 GLuint size_dword
= vertsize
*(4)/4;
353 /* OUT_RINGp wants size in DWORDS */
356 nv10ExtendPrimitive(nmesa
, size_dword
);
357 nv10StartPrimitive(nmesa
,GL_QUADS
+1,size_dword
);
358 OUT_RINGp((nouveauVertex
*)(vertptr
+(v1
*vertsize
)),vertsize
);
359 OUT_RINGp((nouveauVertex
*)(vertptr
+(v2
*vertsize
)),vertsize
);
360 OUT_RINGp((nouveauVertex
*)(vertptr
+(v3
*vertsize
)),vertsize
);
361 OUT_RINGp((nouveauVertex
*)(vertptr
+(v4
*vertsize
)),vertsize
);
362 nv10FinishPrimitive(nmesa
);
367 static void nv10ChooseRenderState(GLcontext
*ctx
)
369 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
370 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
372 tnl
->Driver
.Render
.PrimTabVerts
= nv10_render_tab_verts
;
373 tnl
->Driver
.Render
.PrimTabElts
= nv10_render_tab_elts
;
374 tnl
->Driver
.Render
.ClippedLine
= nv10_render_clipped_line
;
375 tnl
->Driver
.Render
.ClippedPolygon
= nv10_render_clipped_poly
;
376 tnl
->Driver
.Render
.Points
= nv10_render_points
;
377 tnl
->Driver
.Render
.Line
= nv10_render_line
;
378 tnl
->Driver
.Render
.Triangle
= nv10_render_triangle
;
379 tnl
->Driver
.Render
.Quad
= nv10_render_quad
;
384 static inline void nv10OutputVertexFormat(struct nouveau_context
* nmesa
)
386 GLcontext
* ctx
=nmesa
->glCtx
;
387 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
388 DECLARE_RENDERINPUTS(index
);
389 struct vertex_buffer
*VB
= &tnl
->vb
;
391 int default_attr_size
[8]={3,3,3,4,3,1,4,4};
396 nmesa
->vertex_attr_count
= 0;
397 RENDERINPUTS_COPY(index
, nmesa
->render_inputs_bitset
);
400 * Determine attribute sizes
404 if (RENDERINPUTS_TEST(index
, i
))
405 attr_size
[i
]=default_attr_size
[i
];
411 if (RENDERINPUTS_TEST(index
, i
))
412 attr_size
[i
]=VB
->TexCoordPtr
[i
-8]->size
;
418 * Tell t_vertex about the vertex format
422 if (RENDERINPUTS_TEST(index
, i
))
428 EMIT_ATTR(i
,EMIT_1F
);
431 EMIT_ATTR(i
,EMIT_2F
);
434 EMIT_ATTR(i
,EMIT_3F
);
437 EMIT_ATTR(i
,EMIT_4F
);
440 if (i
==_TNL_ATTRIB_COLOR0
)
441 nmesa
->color_offset
=total_size
;
442 if (i
==_TNL_ATTRIB_COLOR1
)
443 nmesa
->specular_offset
=total_size
;
444 total_size
+=attr_size
[i
];
448 nmesa
->vertex_size
=_tnl_install_attrs( ctx
,
450 nmesa
->vertex_attr_count
,
452 assert(nmesa
->vertex_size
==total_size
*4);
455 * Tell the hardware about the vertex format
457 if (nmesa
->screen
->card
->type
==NV_10
) {
460 #define NV_VERTEX_ATTRIBUTE_TYPE_FLOAT 2
462 #define NV10_SET_VERTEX_ATTRIB(i,j) \
464 size = attr_size[j] << 4; \
465 size |= (attr_size[j]*4) << 8; \
466 size |= NV_VERTEX_ATTRIBUTE_TYPE_FLOAT; \
467 BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); \
468 OUT_RING_CACHE(size); \
471 NV10_SET_VERTEX_ATTRIB(0, _TNL_ATTRIB_POS
);
472 NV10_SET_VERTEX_ATTRIB(1, _TNL_ATTRIB_COLOR0
);
473 NV10_SET_VERTEX_ATTRIB(2, _TNL_ATTRIB_COLOR1
);
474 NV10_SET_VERTEX_ATTRIB(3, _TNL_ATTRIB_TEX0
);
475 NV10_SET_VERTEX_ATTRIB(4, _TNL_ATTRIB_TEX1
);
476 NV10_SET_VERTEX_ATTRIB(5, _TNL_ATTRIB_NORMAL
);
477 NV10_SET_VERTEX_ATTRIB(6, _TNL_ATTRIB_WEIGHT
);
478 NV10_SET_VERTEX_ATTRIB(7, _TNL_ATTRIB_FOG
);
480 BEGIN_RING_CACHE(NvSub3D
, NV10_TCL_PRIMITIVE_3D_VERTEX_ARRAY_VALIDATE
,1);
482 } else if (nmesa
->screen
->card
->type
==NV_20
) {
485 int size
=attr_size
[i
];
486 BEGIN_RING_CACHE(NvSub3D
,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(i
),1);
487 OUT_RING_CACHE(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT
|(size
*0x10));
490 BEGIN_RING_SIZE(NvSub3D
, NV30_TCL_PRIMITIVE_3D_DO_VERTICES
, 1);
492 BEGIN_RING_CACHE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_VERTEX_ATTR0_POS
,slots
);
495 int size
=attr_size
[i
];
496 OUT_RING_CACHE(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT
|(size
*0x10));
498 // FIXME this is probably not needed
499 BEGIN_RING_SIZE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_VERTEX_UNK_0
,1);
501 BEGIN_RING_SIZE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_VERTEX_UNK_0
,1);
503 BEGIN_RING_SIZE(NvSub3D
,NV30_TCL_PRIMITIVE_3D_VERTEX_UNK_0
,1);
509 static void nv10ChooseVertexState( GLcontext
*ctx
)
511 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
512 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
513 DECLARE_RENDERINPUTS(index
);
515 RENDERINPUTS_COPY(index
, tnl
->render_inputs_bitset
);
516 if (!RENDERINPUTS_EQUAL(index
, nmesa
->render_inputs_bitset
))
518 RENDERINPUTS_COPY(nmesa
->render_inputs_bitset
, index
);
519 nv10OutputVertexFormat(nmesa
);
522 if (nmesa
->screen
->card
->type
== NV_30
) {
525 if (ctx
->FragmentProgram
.Enabled
) {
526 fp
= (nouveauShader
*) ctx
->FragmentProgram
.Current
;
527 nvsUpdateShader(ctx
, fp
);
529 nvsUpdateShader(ctx
, nmesa
->passthrough_fp
);
532 if (nmesa
->screen
->card
->type
>= NV_40
) {
533 /* Ensure passthrough shader is being used, and mvp matrix
536 nvsUpdateShader(ctx
, nmesa
->passthrough_vp
);
538 /* Update texenv shader / user fragprog */
539 nvsUpdateShader(ctx
, (nouveauShader
*)ctx
->FragmentProgram
._Current
);
544 /**********************************************************************/
545 /* High level hooks for t_vb_render.c */
546 /**********************************************************************/
549 static void nv10RenderStart(GLcontext
*ctx
)
551 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
552 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
554 if (nmesa
->new_state
) {
555 nmesa
->new_render_state
|= nmesa
->new_state
;
558 if (nmesa
->new_render_state
) {
559 nv10ChooseVertexState(ctx
);
560 nv10ChooseRenderState(ctx
);
561 nmesa
->new_render_state
= 0;
565 static void nv10RenderFinish(GLcontext
*ctx
)
570 /* System to flush dma and emit state changes based on the rasterized
573 void nv10RasterPrimitive(GLcontext
*ctx
,
577 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
579 assert (!nmesa
->new_state
);
581 if (hwprim
!= nmesa
->current_primitive
)
583 nmesa
->current_primitive
=hwprim
;
588 static const GLuint hw_prim
[GL_POLYGON
+1] = {
601 /* Callback for mesa:
603 static void nv10RenderPrimitive( GLcontext
*ctx
, GLuint prim
)
605 nv10RasterPrimitive( ctx
, prim
, hw_prim
[prim
] );
608 static void nv10ResetLineStipple( GLcontext
*ctx
)
610 /* FIXME do something here */
611 WARN_ONCE("Unimplemented nv10ResetLineStipple\n");
615 /**********************************************************************/
616 /* Initialization. */
617 /**********************************************************************/
619 void nv10TriInitFunctions(GLcontext
*ctx
)
621 struct nouveau_context
*nmesa
= NOUVEAU_CONTEXT(ctx
);
622 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
624 tnl
->Driver
.RunPipeline
= nouveauRunPipeline
;
625 tnl
->Driver
.Render
.Start
= nv10RenderStart
;
626 tnl
->Driver
.Render
.Finish
= nv10RenderFinish
;
627 tnl
->Driver
.Render
.PrimitiveNotify
= nv10RenderPrimitive
;
628 tnl
->Driver
.Render
.ResetLineStipple
= nv10ResetLineStipple
;
629 tnl
->Driver
.Render
.BuildVertices
= _tnl_build_vertices
;
630 tnl
->Driver
.Render
.CopyPV
= _tnl_copy_pv
;
631 tnl
->Driver
.Render
.Interp
= _tnl_interp
;
633 _tnl_init_vertices( ctx
, ctx
->Const
.MaxArrayLockSize
+ 12,
634 64 * sizeof(GLfloat
) );
636 nmesa
->verts
= (GLubyte
*)tnl
->clipspace
.vertex_buf
;