1 /**************************************************************************
3 Copyright (C) 2007 Dave Airlie
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the "Software"),
9 to deal in the Software without restriction, including without limitation
10 on the rights to use, copy, modify, merge, publish, distribute, sub
11 license, and/or sell copies of the Software, and to permit persons to whom
12 the Software is furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice (including the next
15 paragraph) shall be included in all copies or substantial portions of the
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Dave Airlie <airlied@linux.ie>
33 /* derived from r200 swtcl path */
45 #include "swrast/s_context.h"
46 #include "swrast/s_fog.h"
47 #include "swrast_setup/swrast_setup.h"
48 #include "math/m_translate.h"
50 #include "tnl/t_context.h"
51 #include "tnl/t_pipeline.h"
53 #include "r300_context.h"
54 #include "r300_swtcl.h"
55 #include "r300_state.h"
56 #include "r300_ioctl.h"
57 #include "r300_emit.h"
60 #define R300_NEWPRIM( rmesa ) \
62 if ( rmesa->dma.flush ) \
63 rmesa->dma.flush( rmesa ); \
66 static void flush_last_swtcl_prim( r300ContextPtr rmesa
);
69 void r300EmitVertexAOS(r300ContextPtr rmesa
, GLuint vertex_size
, GLuint offset
);
70 void r300EmitVbufPrim(r300ContextPtr rmesa
, GLuint primitive
, GLuint vertex_nr
);
71 #define EMIT_ATTR( ATTR, STYLE, F0 ) \
73 rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = (ATTR); \
74 rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = (STYLE); \
75 rmesa->swtcl.vertex_attr_count++; \
79 #define EMIT_PAD( N ) \
81 rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = 0; \
82 rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = EMIT_PAD; \
83 rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].offset = (N); \
84 rmesa->swtcl.vertex_attr_count++; \
87 static void r300SetVertexFormat( GLcontext
*ctx
)
89 r300ContextPtr rmesa
= R300_CONTEXT( ctx
);
90 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
91 struct vertex_buffer
*VB
= &tnl
->vb
;
92 DECLARE_RENDERINPUTS(index_bitset
);
98 RENDERINPUTS_COPY( index_bitset
, tnl
->render_inputs_bitset
);
102 if ( VB
->NdcPtr
!= NULL
) {
103 VB
->AttribPtr
[VERT_ATTRIB_POS
] = VB
->NdcPtr
;
106 VB
->AttribPtr
[VERT_ATTRIB_POS
] = VB
->ClipPtr
;
109 assert( VB
->AttribPtr
[VERT_ATTRIB_POS
] != NULL
);
110 rmesa
->swtcl
.vertex_attr_count
= 0;
112 /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
113 * build up a hardware vertex.
115 if ( !rmesa
->swtcl
.needproj
||
116 RENDERINPUTS_TEST_RANGE( index_bitset
, _TNL_FIRST_TEX
, _TNL_LAST_TEX
)) { /* need w coord for projected textures */
117 EMIT_ATTR( _TNL_ATTRIB_POS
, EMIT_4F
, R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT
);
118 vap_vte_cntl
|= R300_VTX_XY_FMT
| R300_VTX_Z_FMT
| R300_VTX_W0_FMT
;
123 EMIT_ATTR( _TNL_ATTRIB_POS
, EMIT_3F
, R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT
);
124 vap_vte_cntl
|= R300_VTX_XY_FMT
| R300_VTX_Z_FMT
;
128 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_POINTSIZE
)) {
129 EMIT_ATTR( _TNL_ATTRIB_POINTSIZE
, EMIT_1F
, R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT
);
133 rmesa
->swtcl
.coloroffset
= offset
;
134 #if MESA_LITTLE_ENDIAN
135 EMIT_ATTR( _TNL_ATTRIB_COLOR0
, EMIT_4UB_4F_RGBA
, R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT
);
137 EMIT_ATTR( _TNL_ATTRIB_COLOR0
, EMIT_4UB_4F_ABGR
, R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT
);
141 rmesa
->swtcl
.specoffset
= 0;
142 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_COLOR1
) ||
143 RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_FOG
)) {
145 #if MESA_LITTLE_ENDIAN
146 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_COLOR1
)) {
147 rmesa
->swtcl
.specoffset
= offset
;
148 EMIT_ATTR( _TNL_ATTRIB_COLOR1
, EMIT_3UB_3F_RGB
, R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT
);
154 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_FOG
)) {
155 EMIT_ATTR( _TNL_ATTRIB_FOG
, EMIT_1UB_1F
, R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT
);
161 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_FOG
)) {
162 EMIT_ATTR( _TNL_ATTRIB_FOG
, EMIT_1UB_1F
, R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT
);
168 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_COLOR1
)) {
169 rmesa
->swtcl
.specoffset
= offset
;
170 EMIT_ATTR( _TNL_ATTRIB_COLOR1
, EMIT_3UB_3F_BGR
, R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT
);
178 if (RENDERINPUTS_TEST_RANGE( index_bitset
, _TNL_FIRST_TEX
, _TNL_LAST_TEX
)) {
181 for (i
= 0; i
< ctx
->Const
.MaxTextureUnits
; i
++) {
182 if (RENDERINPUTS_TEST( index_bitset
, _TNL_ATTRIB_TEX(i
) )) {
183 GLuint sz
= VB
->TexCoordPtr
[i
]->size
;
185 vap_fmt_1
|= sz
<< (3 * i
);
186 EMIT_ATTR( _TNL_ATTRIB_TEX0
+i
, EMIT_1F
+ sz
- 1, 0 );
192 if ( (rmesa
->hw
.ctx
.cmd
[CTX_PP_FOG_COLOR
] & R200_FOG_USE_MASK
)
193 != R200_FOG_USE_SPEC_ALPHA
) {
194 R200_STATECHANGE( rmesa
, ctx
);
195 rmesa
->hw
.ctx
.cmd
[CTX_PP_FOG_COLOR
] &= ~R200_FOG_USE_MASK
;
196 rmesa
->hw
.ctx
.cmd
[CTX_PP_FOG_COLOR
] |= R200_FOG_USE_SPEC_ALPHA
;
200 if (!RENDERINPUTS_EQUAL( rmesa
->tnl_index_bitset
, index_bitset
) ||
201 (rmesa
->hw
.vof
.cmd
[R300_VOF_CNTL_0
] != vap_fmt_0
) ||
202 (rmesa
->hw
.vof
.cmd
[R300_VOF_CNTL_1
] != vap_fmt_1
) ) {
204 R300_STATECHANGE(rmesa
, vof
);
205 rmesa
->hw
.vof
.cmd
[R300_VOF_CNTL_0
] =
207 rmesa
->hw
.vof
.cmd
[R300_VOF_CNTL_1
] =
210 rmesa
->swtcl
.vertex_size
=
211 _tnl_install_attrs( ctx
,
212 rmesa
->swtcl
.vertex_attrs
,
213 rmesa
->swtcl
.vertex_attr_count
,
215 rmesa
->swtcl
.vertex_size
/= 4;
216 RENDERINPUTS_COPY( rmesa
->tnl_index_bitset
, index_bitset
);
221 /* Flush vertices in the current dma region.
223 static void flush_last_swtcl_prim( r300ContextPtr rmesa
)
225 if (RADEON_DEBUG
& DEBUG_IOCTL
)
226 fprintf(stderr
, "%s\n", __FUNCTION__
);
228 rmesa
->dma
.flush
= NULL
;
230 if (rmesa
->dma
.current
.buf
) {
231 struct r300_dma_region
*current
= &rmesa
->dma
.current
;
232 // GLuint current_offset = rmesa->state.swtcl_dma.aos_offset;
234 GLuint current_offset
= r300_mem_offset(rmesa
,current
->buf
->id
);
235 // assert (!(rmesa->swtcl.hw_primitive & R200_VF_PRIM_WALK_IND));
237 assert (current
->start
+
238 rmesa
->swtcl
.numverts
* rmesa
->swtcl
.vertex_size
* 4 ==
241 if (rmesa
->dma
.current
.start
!= rmesa
->dma
.current
.ptr
) {
242 // r200EnsureCmdBufSpace( rmesa, VERT_AOS_BUFSZ +
243 // rmesa->hw.max_state_size + VBUF_BUFSZ );
244 r300EmitVertexAOS( rmesa
,
245 rmesa
->swtcl
.vertex_size
,
248 r300EmitVbufPrim( rmesa
,
249 rmesa
->swtcl
.hw_primitive
,
250 rmesa
->swtcl
.numverts
);
253 rmesa
->swtcl
.numverts
= 0;
254 current
->start
= current
->ptr
;
260 r300AllocDmaLowVerts( r300ContextPtr rmesa
, int nverts
, int vsize
)
262 GLuint bytes
= vsize
* nverts
;
264 r300AllocDmaRegion(rmesa
, &rmesa
->state
.swtcl_dma
, bytes
, 0);
266 if (!rmesa
->dma
.flush
) {
267 rmesa
->dma
.flush
= flush_last_swtcl_prim
;
268 rmesa
->radeon
.glCtx
->Driver
.NeedFlush
|= FLUSH_STORED_VERTICES
;
272 rmesa
->swtcl
.numverts
+= nverts
;
273 rmesa
->dma
.current
.ptr
+= bytes
;
274 return (rmesa
->dma
.current
.address
+ rmesa
->dma
.current
.ptr
);
278 static INLINE GLuint
reduced_hw_prim( GLcontext
*ctx
, GLuint prim
)
282 return R300_VAP_VF_CNTL__PRIM_POINTS
;
284 return R300_VAP_VF_CNTL__PRIM_LINES
;
287 return R300_VAP_VF_CNTL__PRIM_LINE_LOOP
;
290 return R300_VAP_VF_CNTL__PRIM_LINE_STRIP
;
292 /* all others reduced to triangles */
293 return R300_VAP_VF_CNTL__PRIM_TRIANGLES
;
297 static void r300RasterPrimitive( GLcontext
*ctx
, GLuint hwprim
);
298 static void r300RenderPrimitive( GLcontext
*ctx
, GLenum prim
);
299 //static void r300ResetLineStipple( GLcontext *ctx );
301 static void r300PrintVertex(r300Vertex
*v
)
303 fprintf(stderr
,"Vertex %p\n", v
);
307 /***********************************************************************
308 * Emit primitives as inline vertices *
309 ***********************************************************************/
312 #define HAVE_POINTS 1
314 #define HAVE_LINE_STRIPS 1
315 #define HAVE_TRIANGLES 1
316 #define HAVE_TRI_STRIPS 1
317 #define HAVE_TRI_STRIP_1 0
318 #define HAVE_TRI_FANS 1
320 #define HAVE_QUAD_STRIPS 0
321 #define HAVE_POLYGONS 1
326 #define CTX_ARG r300ContextPtr rmesa
327 #define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
328 #define ALLOC_VERTS( n, size ) r300AllocDmaLowVerts( rmesa, n, size * 4 )
330 r300ContextPtr rmesa = R300_CONTEXT(ctx); \
331 const char *r300verts = (char *)rmesa->swtcl.verts;
332 #define VERT(x) (r300Vertex *)(r300verts + ((x) * vertsize * sizeof(int)))
333 #define VERTEX r300Vertex
334 #define DO_DEBUG_VERTS (1 && (RADEON_DEBUG & DEBUG_VERTS))
335 #define PRINT_VERTEX(x) r300PrintVertex(x)
337 #define TAG(x) r300_##x
338 #include "tnl_dd/t_dd_triemit.h"
342 /***********************************************************************
343 * Macros for t_dd_tritmp.h to draw basic primitives *
344 ***********************************************************************/
346 #define QUAD( a, b, c, d ) r300_quad( rmesa, a, b, c, d )
347 #define TRI( a, b, c ) r300_triangle( rmesa, a, b, c )
348 #define LINE( a, b ) r300_line( rmesa, a, b )
349 #define POINT( a ) r300_point( rmesa, a )
351 /***********************************************************************
352 * Build render functions from dd templates *
353 ***********************************************************************/
355 #define R300_TWOSIDE_BIT 0x01
356 #define R300_UNFILLED_BIT 0x02
357 #define R300_MAX_TRIFUNC 0x04
360 tnl_points_func points
;
362 tnl_triangle_func triangle
;
364 } rast_tab
[R300_MAX_TRIFUNC
];
366 #define DO_FALLBACK 0
367 #define DO_UNFILLED (IND & R300_UNFILLED_BIT)
368 #define DO_TWOSIDE (IND & R300_TWOSIDE_BIT)
375 #define DO_FULL_QUAD 1
379 #define HAVE_BACK_COLORS 0
380 #define HAVE_HW_FLATSHADE 1
383 #define DEPTH_SCALE 1.0
384 #define UNFILLED_TRI unfilled_tri
385 #define UNFILLED_QUAD unfilled_quad
386 #define VERT_X(_v) _v->v.x
387 #define VERT_Y(_v) _v->v.y
388 #define VERT_Z(_v) _v->v.z
389 #define AREA_IS_CCW( a ) (a < 0)
390 #define GET_VERTEX(e) (rmesa->swtcl.verts + (e*rmesa->swtcl.vertex_size*sizeof(int)))
392 #define VERT_SET_RGBA( v, c ) \
394 r300_color_t *color = (r300_color_t *)&((v)->ui[coloroffset]); \
395 UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
396 UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
397 UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
398 UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
401 #define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
403 #define VERT_SET_SPEC( v, c ) \
406 r300_color_t *spec = (r300_color_t *)&((v)->ui[specoffset]); \
407 UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \
408 UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \
409 UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \
412 #define VERT_COPY_SPEC( v0, v1 ) \
415 r300_color_t *spec0 = (r300_color_t *)&((v0)->ui[specoffset]); \
416 r300_color_t *spec1 = (r300_color_t *)&((v1)->ui[specoffset]); \
417 spec0->red = spec1->red; \
418 spec0->green = spec1->green; \
419 spec0->blue = spec1->blue; \
423 /* These don't need LE32_TO_CPU() as they used to save and restore
424 * colors which are already in the correct format.
426 #define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
427 #define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
428 #define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
429 #define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
435 #define LOCAL_VARS(n) \
436 r300ContextPtr rmesa = R300_CONTEXT(ctx); \
437 GLuint color[n], spec[n]; \
438 GLuint coloroffset = rmesa->swtcl.coloroffset; \
439 GLuint specoffset = rmesa->swtcl.specoffset; \
440 (void) color; (void) spec; (void) coloroffset; (void) specoffset;
442 /***********************************************************************
443 * Helpers for rendering unfilled primitives *
444 ***********************************************************************/
446 #define RASTERIZE(x) r300RasterPrimitive( ctx, reduced_hw_prim(ctx, x) )
447 #define RENDER_PRIMITIVE rmesa->swtcl.render_primitive
450 #include "tnl_dd/t_dd_unfilled.h"
454 /***********************************************************************
455 * Generate GL render functions *
456 ***********************************************************************/
461 #include "tnl_dd/t_dd_tritmp.h"
463 #define IND (R300_TWOSIDE_BIT)
464 #define TAG(x) x##_twoside
465 #include "tnl_dd/t_dd_tritmp.h"
467 #define IND (R300_UNFILLED_BIT)
468 #define TAG(x) x##_unfilled
469 #include "tnl_dd/t_dd_tritmp.h"
471 #define IND (R300_TWOSIDE_BIT|R300_UNFILLED_BIT)
472 #define TAG(x) x##_twoside_unfilled
473 #include "tnl_dd/t_dd_tritmp.h"
476 static void init_rast_tab( void )
481 init_twoside_unfilled();
484 /**********************************************************************/
485 /* Render unclipped begin/end objects */
486 /**********************************************************************/
488 #define RENDER_POINTS( start, count ) \
489 for ( ; start < count ; start++) \
490 r300_point( rmesa, VERT(start) )
491 #define RENDER_LINE( v0, v1 ) \
492 r300_line( rmesa, VERT(v0), VERT(v1) )
493 #define RENDER_TRI( v0, v1, v2 ) \
494 r300_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
495 #define RENDER_QUAD( v0, v1, v2, v3 ) \
496 r300_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
497 #define INIT(x) do { \
498 r300RenderPrimitive( ctx, x ); \
502 r300ContextPtr rmesa = R300_CONTEXT(ctx); \
503 const GLuint vertsize = rmesa->swtcl.vertex_size; \
504 const char *r300verts = (char *)rmesa->swtcl.verts; \
505 const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
506 const GLboolean stipple = ctx->Line.StippleFlag; \
507 (void) elt; (void) stipple;
508 #define RESET_STIPPLE //if ( stipple ) r200ResetLineStipple( ctx );
509 #define RESET_OCCLUSION
510 #define PRESERVE_VB_DEFS
512 #define TAG(x) r300_##x##_verts
513 #include "tnl/t_vb_rendertmp.h"
516 #define TAG(x) r300_##x##_elts
517 #define ELT(x) elt[x]
518 #include "tnl/t_vb_rendertmp.h"
523 /**********************************************************************/
524 /* Choose render functions */
525 /**********************************************************************/
527 void r300ChooseRenderState( GLcontext
*ctx
)
529 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
530 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
532 GLuint flags
= ctx
->_TriangleCaps
;
534 // if (!rmesa->TclFallback || rmesa->Fallback)
537 if (flags
& DD_TRI_LIGHT_TWOSIDE
) index
|= R300_TWOSIDE_BIT
;
538 if (flags
& DD_TRI_UNFILLED
) index
|= R300_UNFILLED_BIT
;
540 if (index
!= rmesa
->swtcl
.RenderIndex
) {
541 tnl
->Driver
.Render
.Points
= rast_tab
[index
].points
;
542 tnl
->Driver
.Render
.Line
= rast_tab
[index
].line
;
543 tnl
->Driver
.Render
.ClippedLine
= rast_tab
[index
].line
;
544 tnl
->Driver
.Render
.Triangle
= rast_tab
[index
].triangle
;
545 tnl
->Driver
.Render
.Quad
= rast_tab
[index
].quad
;
548 tnl
->Driver
.Render
.PrimTabVerts
= r300_render_tab_verts
;
549 tnl
->Driver
.Render
.PrimTabElts
= r300_render_tab_elts
;
550 tnl
->Driver
.Render
.ClippedPolygon
= r300_fast_clipped_poly
;
552 tnl
->Driver
.Render
.PrimTabVerts
= _tnl_render_tab_verts
;
553 tnl
->Driver
.Render
.PrimTabElts
= _tnl_render_tab_elts
;
554 tnl
->Driver
.Render
.ClippedPolygon
= _tnl_RenderClippedPolygon
;
557 rmesa
->swtcl
.RenderIndex
= index
;
562 static void r300RenderStart(GLcontext
*ctx
)
564 r300ContextPtr rmesa
= R300_CONTEXT( ctx
);
565 fprintf(stderr
, "%s\n", __FUNCTION__
);
567 r300SetVertexFormat(ctx
);
568 if (rmesa
->dma
.flush
!= 0 &&
569 rmesa
->dma
.flush
!= flush_last_swtcl_prim
)
570 rmesa
->dma
.flush( rmesa
);
573 static void r300RenderFinish(GLcontext
*ctx
)
575 fprintf(stderr
, "%s\n", __FUNCTION__
);
578 static void r300RasterPrimitive( GLcontext
*ctx
, GLuint hwprim
)
580 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
582 if (rmesa
->swtcl
.hw_primitive
!= hwprim
) {
583 R300_NEWPRIM( rmesa
);
584 rmesa
->swtcl
.hw_primitive
= hwprim
;
588 static void r300RenderPrimitive(GLcontext
*ctx
, GLenum prim
)
591 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
592 rmesa
->swtcl
.render_primitive
= prim
;
593 if (prim
< GL_TRIANGLES
|| !(ctx
->_TriangleCaps
& DD_TRI_UNFILLED
))
594 r300RasterPrimitive( ctx
, reduced_hw_prim(ctx
, prim
) );
595 fprintf(stderr
, "%s\n", __FUNCTION__
);
599 static void r300ResetLineStipple(GLcontext
*ctx
)
605 void r300InitSwtcl(GLcontext
*ctx
)
607 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
608 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
609 static int firsttime
= 1;
616 tnl
->Driver
.Render
.Start
= r300RenderStart
;
617 tnl
->Driver
.Render
.Finish
= r300RenderFinish
;
618 tnl
->Driver
.Render
.PrimitiveNotify
= r300RenderPrimitive
;
619 tnl
->Driver
.Render
.ResetLineStipple
= r300ResetLineStipple
;
620 tnl
->Driver
.Render
.BuildVertices
= _tnl_build_vertices
;
621 tnl
->Driver
.Render
.CopyPV
= _tnl_copy_pv
;
622 tnl
->Driver
.Render
.Interp
= _tnl_interp
;
624 /* FIXME: what are these numbers? */
625 _tnl_init_vertices( ctx
, ctx
->Const
.MaxArrayLockSize
+ 12,
626 36 * sizeof(GLfloat
) );
628 rmesa
->swtcl
.verts
= (GLubyte
*)tnl
->clipspace
.vertex_buf
;
629 rmesa
->swtcl
.RenderIndex
= ~0;
630 rmesa
->swtcl
.render_primitive
= GL_TRIANGLES
;
631 rmesa
->swtcl
.hw_primitive
= 0;
633 _tnl_invalidate_vertex_state( ctx
, ~0 );
634 _tnl_invalidate_vertices( ctx
, ~0 );
635 RENDERINPUTS_ZERO( rmesa
->tnl_index_bitset
);
637 r300ChooseRenderState(ctx
);
640 void r300DestroySwtcl(GLcontext
*ctx
)
644 void r300EmitVertexAOS(r300ContextPtr rmesa
, GLuint vertex_size
, GLuint offset
)
646 int cmd_reserved
= 0;
649 drm_radeon_cmd_header_t
*cmd
= NULL
;
650 if (1)//RADEON_DEBUG & DEBUG_VERTS)
651 fprintf(stderr
, "%s: vertex_size %d, offset 0x%x \n",
652 __FUNCTION__
, vertex_size
, offset
);
654 start_packet3(CP_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR
, 2), 2);
656 e32(vertex_size
| (vertex_size
<< 8));
660 void r300EmitVbufPrim(r300ContextPtr rmesa
, GLuint primitive
, GLuint vertex_nr
)
663 int cmd_reserved
= 0;
666 drm_radeon_cmd_header_t
*cmd
= NULL
;
668 type
= r300PrimitiveType(rmesa
, primitive
);
669 num_verts
= r300NumVerts(rmesa
, vertex_nr
, primitive
);
670 r300EmitState(rmesa
);
672 start_packet3(CP_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2
, 0), 0);
673 e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST
| (num_verts
<< 16) | type
);