2 * Intel i810 DRI driver for Mesa 3.5
4 * Copyright (C) 1999-2000 Keith Whitwell 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, sublicense,
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 shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL KEITH WHITWELL BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Keith Whitwell <keith@tungstengraphics.com>
30 * Render unclipped vertex buffers by emitting vertices directly to
31 * dma buffers. Use strip/fan hardware acceleration where possible.
34 #include "main/glheader.h"
35 #include "main/context.h"
36 #include "main/macros.h"
37 #include "main/imports.h"
38 #include "main/mtypes.h"
40 #include "tnl/t_context.h"
42 #include "i810screen.h"
45 #include "i810context.h"
48 #include "i810ioctl.h"
51 * Render unclipped vertex buffers by emitting vertices directly to
52 * dma buffers. Use strip/fan hardware primitives where possible.
53 * Try to simulate missing primitives with indexed vertices.
57 #define HAVE_LINE_STRIPS 1
58 #define HAVE_TRIANGLES 1
59 #define HAVE_TRI_STRIPS 1
60 #define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
61 #define HAVE_TRI_FANS 1
62 #define HAVE_POLYGONS 1
64 #define HAVE_QUAD_STRIPS 0
69 static GLuint hw_prim
[GL_POLYGON
+1] = {
82 static const GLenum reduced_prim
[GL_POLYGON
+1] = {
98 #define LOCAL_VARS i810ContextPtr imesa = I810_CONTEXT(ctx)
99 #define INIT( prim ) do { \
100 I810_STATECHANGE(imesa, 0); \
101 i810RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
103 #define GET_CURRENT_VB_MAX_VERTS() \
104 (((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
105 #define GET_SUBSEQUENT_VB_MAX_VERTS() \
106 (I810_DMA_BUF_SZ-4) / (imesa->vertex_size * 4)
108 #define ALLOC_VERTS( nr ) \
109 i810AllocDmaLow( imesa, (nr) * imesa->vertex_size * 4)
110 #define EMIT_VERTS( ctx, j, nr, buf ) \
111 i810_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
113 #define FLUSH() I810_FIREVERTICES( imesa )
116 #define TAG(x) i810_##x
117 #include "tnl_dd/t_dd_dmatmp.h"
120 /**********************************************************************/
121 /* Render pipeline stage */
122 /**********************************************************************/
125 static GLboolean
i810_run_render( GLcontext
*ctx
,
126 struct tnl_pipeline_stage
*stage
)
128 i810ContextPtr imesa
= I810_CONTEXT(ctx
);
129 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
130 struct vertex_buffer
*VB
= &tnl
->vb
;
133 /* Don't handle clipping or indexed vertices.
135 if (imesa
->RenderIndex
!= 0 ||
136 !i810_validate_render( ctx
, VB
)) {
140 imesa
->SetupNewInputs
= VERT_BIT_POS
;
142 tnl
->Driver
.Render
.Start( ctx
);
144 for (i
= 0 ; i
< VB
->PrimitiveCount
; i
++)
146 GLuint prim
= _tnl_translate_prim(&VB
->Primitive
[i
]);
147 GLuint start
= VB
->Primitive
[i
].start
;
148 GLuint length
= VB
->Primitive
[i
].count
;
153 i810_render_tab_verts
[prim
& PRIM_MODE_MASK
]( ctx
, start
, start
+ length
,
157 tnl
->Driver
.Render
.Finish( ctx
);
159 return GL_FALSE
; /* finished the pipe */
164 const struct tnl_pipeline_stage _i810_render_stage
=
171 i810_run_render
/* run */