mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-04 15:00:36 +01:00
Fix vertex copying bug, remove polygonmode support (didn't/couldn't work)
This commit is contained in:
parent
4b5f9479eb
commit
6133ba36ec
1 changed files with 21 additions and 152 deletions
|
|
@ -97,53 +97,22 @@ static struct {
|
|||
static void radeonFlushVertices( GLcontext *, GLuint );
|
||||
|
||||
|
||||
static struct { int start, incr, hwprim, lnprim, ptprim; } prims[10] = {
|
||||
{ 1, 1,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT},
|
||||
{ 2, 2,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE },
|
||||
{ 2, 1,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP },
|
||||
{ 2, 1,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP },
|
||||
{ 3, 3,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT },
|
||||
{ 3, 1,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT },
|
||||
{ 3, 1,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT },
|
||||
{ 4, 4,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT },
|
||||
{ 4, 2,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT },
|
||||
{ 3, 1,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
|
||||
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT },
|
||||
static struct { int start, incr, hwprim; } prims[10] = {
|
||||
{ 1, 1, RADEON_CP_VC_CNTL_PRIM_TYPE_POINT},
|
||||
{ 2, 2, RADEON_CP_VC_CNTL_PRIM_TYPE_LINE },
|
||||
{ 2, 1, RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP },
|
||||
{ 2, 1, RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP },
|
||||
{ 3, 3, RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST },
|
||||
{ 3, 1, RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP },
|
||||
{ 3, 1, RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN },
|
||||
{ 4, 4, RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST },
|
||||
{ 4, 2, RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP },
|
||||
{ 3, 1, RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN },
|
||||
};
|
||||
|
||||
static void finish_prim( radeonContextPtr rmesa )
|
||||
{
|
||||
GLuint prim_end = vb.stack[0].initial_vertspace - vb.stack[0].vertspace;
|
||||
GLuint hwprim = 0;
|
||||
|
||||
/* Too few vertices? (eg: 2 vertices for a triangles prim?)
|
||||
*/
|
||||
|
|
@ -157,15 +126,8 @@ static void finish_prim( radeonContextPtr rmesa )
|
|||
|
||||
radeonEmitVertexAOS( rmesa, vb.vertex_size, GET_START(&rmesa->dma.current) );
|
||||
|
||||
switch (vb.context->Polygon.FrontMode) {
|
||||
case GL_LINE: hwprim = prims[vb.prim].lnprim; break;
|
||||
case GL_POINT: hwprim = prims[vb.prim].ptprim; break;
|
||||
case GL_FILL: hwprim = prims[vb.prim].hwprim; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
radeonEmitVbufPrim( rmesa, vb.vertex_format,
|
||||
hwprim | rmesa->tcl.tcl_flag,
|
||||
prims[vb.prim].hwprim | rmesa->tcl.tcl_flag,
|
||||
prim_end );
|
||||
|
||||
rmesa->dma.current.ptr =
|
||||
|
|
@ -225,12 +187,12 @@ static GLuint copy_dma_verts( radeonContextPtr rmesa,
|
|||
return 2;
|
||||
}
|
||||
case GL_TRIANGLE_STRIP:
|
||||
case GL_QUAD_STRIP:
|
||||
case GL_QUADS:
|
||||
ovf = MIN2( nr-1, 2 );
|
||||
for (i = 0 ; i < ovf ; i++)
|
||||
copy_vertex( rmesa, nr-ovf+i, tmp[i] );
|
||||
return i;
|
||||
case GL_QUAD_STRIP:
|
||||
case GL_QUADS:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -318,29 +280,13 @@ static void emit_vertex( int v )
|
|||
vb.stack[0].notify();
|
||||
}
|
||||
|
||||
static void emit_tri( int v0, int v1, int v2 )
|
||||
{
|
||||
assert (vb.context->Polygon.FrontMode == GL_LINE);
|
||||
assert (vb.prim == GL_LINES);
|
||||
emit_vertex( v0 ); emit_vertex( v1 );
|
||||
emit_vertex( v1 ); emit_vertex( v2 );
|
||||
emit_vertex( v2 ); emit_vertex( v0 );
|
||||
}
|
||||
|
||||
/* Emit a quad (in vb.vertex_store) to dma as two triangles.
|
||||
*/
|
||||
static void emit_quad( int v0, int v1, int v2, int v3 )
|
||||
{
|
||||
if (vb.context->Polygon.FrontMode == GL_LINE) {
|
||||
emit_vertex( v0 ); emit_vertex( v1 );
|
||||
emit_vertex( v1 ); emit_vertex( v2 );
|
||||
emit_vertex( v2 ); emit_vertex( v3 );
|
||||
emit_vertex( v3 ); emit_vertex( v0 );
|
||||
}
|
||||
else {
|
||||
emit_vertex( v0 ); emit_vertex( v1 ); emit_vertex( v3 );
|
||||
emit_vertex( v1 ); emit_vertex( v2 ); emit_vertex( v3 );
|
||||
}
|
||||
emit_vertex( v0 ); emit_vertex( v1 ); emit_vertex( v3 );
|
||||
emit_vertex( v1 ); emit_vertex( v2 ); emit_vertex( v3 );
|
||||
}
|
||||
|
||||
/* Every fourth vertex in a quad primitive, this is called to emit:
|
||||
|
|
@ -348,7 +294,7 @@ static void emit_quad( int v0, int v1, int v2, int v3 )
|
|||
static void notify_quad( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_quad( 0, 1, 2, 3 );
|
||||
emit_quad( 0, 1, 2, 3 );
|
||||
push_notify( notify_quad, 4, vb.vertex_store );
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +312,7 @@ static void notify_qstrip0( void )
|
|||
static void notify_qstrip1( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_quad( 3, 2, 0, 1 );
|
||||
emit_quad( 1, 0, 2, 3 );
|
||||
push_notify( notify_qstrip0, 2, vb.vertex_store + 2*vb.vertex_size );
|
||||
}
|
||||
|
||||
|
|
@ -379,55 +325,6 @@ static void notify_lineloop0( void )
|
|||
emit_vertex(0);
|
||||
}
|
||||
|
||||
/* Need to decompose tristrip & trifan to tris for unfilled line modes
|
||||
*/
|
||||
static void notify_tristrip1( void );
|
||||
static void notify_tristrip2( void );
|
||||
static void notify_tristrip0( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_tri( 0, 1, 2 );
|
||||
push_notify( notify_tristrip1, 1, vb.vertex_store );
|
||||
}
|
||||
|
||||
static void notify_tristrip1( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_tri( 1, 0, 2 );
|
||||
push_notify( notify_tristrip2, 1, vb.vertex_store + 1*vb.vertex_size );
|
||||
}
|
||||
|
||||
static void notify_tristrip2( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_tri( 1, 0, 2 );
|
||||
push_notify( notify_tristrip0, 1, vb.vertex_store + 2*vb.vertex_size );
|
||||
}
|
||||
|
||||
|
||||
static void notify_trifan1( void );
|
||||
static void notify_trifan0( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_tri( 0, 1, 2 );
|
||||
push_notify( notify_trifan1, 1, vb.vertex_store + 1*vb.vertex_size );
|
||||
}
|
||||
|
||||
static void notify_trifan1( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_tri( 0, 2, 1 );
|
||||
push_notify( notify_trifan0, 1, vb.vertex_store + 2*vb.vertex_size );
|
||||
}
|
||||
|
||||
/* Emit lines in GL_LINE fill mode
|
||||
*/
|
||||
static void notify_tri( void )
|
||||
{
|
||||
pop_notify();
|
||||
emit_tri( 0, 1, 2 );
|
||||
push_notify( notify_tri, 3, vb.vertex_store );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -534,8 +431,7 @@ static void radeon_Begin( GLenum mode )
|
|||
se_cntl = rmesa->hw.set.cmd[SET_SE_CNTL] | RADEON_FLAT_SHADE_VTX_LAST;
|
||||
|
||||
if (ctx->Line.StippleFlag &&
|
||||
(ctx->Polygon.FrontMode == GL_LINE ||
|
||||
mode == GL_LINES ||
|
||||
(mode == GL_LINES ||
|
||||
mode == GL_LINE_LOOP ||
|
||||
mode == GL_LINE_STRIP))
|
||||
RESET_STIPPLE();
|
||||
|
|
@ -549,36 +445,12 @@ static void radeon_Begin( GLenum mode )
|
|||
vb.prim = GL_LINE_STRIP;
|
||||
push_notify( notify_lineloop0, 1, vb.vertex_store );
|
||||
break;
|
||||
case GL_TRIANGLES:
|
||||
if (ctx->Polygon.FrontMode == GL_LINE) {
|
||||
vb.prim = GL_LINES;
|
||||
push_notify( notify_tri, 3, vb.vertex_store );
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLE_STRIP:
|
||||
if (ctx->Polygon.FrontMode == GL_LINE) {
|
||||
vb.prim = GL_LINES;
|
||||
push_notify( notify_tristrip0, 3, vb.vertex_store );
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLE_FAN:
|
||||
if (ctx->Polygon.FrontMode == GL_LINE) {
|
||||
vb.prim = GL_LINES;
|
||||
push_notify( notify_trifan0, 3, vb.vertex_store );
|
||||
}
|
||||
break;
|
||||
case GL_QUADS:
|
||||
if (ctx->Polygon.FrontMode == GL_LINE)
|
||||
vb.prim = GL_LINES;
|
||||
else
|
||||
vb.prim = GL_TRIANGLES;
|
||||
vb.prim = GL_TRIANGLES;
|
||||
push_notify( notify_quad, 4, vb.vertex_store );
|
||||
break;
|
||||
case GL_QUAD_STRIP:
|
||||
if (ctx->Polygon.FrontMode == GL_LINE) {
|
||||
push_notify( notify_qstrip0, 4, vb.vertex_store );
|
||||
}
|
||||
else if (ctx->_TriangleCaps & DD_FLATSHADE) {
|
||||
if (ctx->_TriangleCaps & DD_FLATSHADE) {
|
||||
vb.prim = GL_TRIANGLES;
|
||||
push_notify( notify_qstrip0, 4, vb.vertex_store );
|
||||
}
|
||||
|
|
@ -586,8 +458,6 @@ static void radeon_Begin( GLenum mode )
|
|||
case GL_POLYGON:
|
||||
if (ctx->_TriangleCaps & DD_FLATSHADE)
|
||||
se_cntl &= ~RADEON_FLAT_SHADE_VTX_LAST;
|
||||
if (ctx->Polygon.FrontMode == GL_LINE)
|
||||
push_notify( notify_lineloop0, 1, vb.vertex_store );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -740,7 +610,6 @@ void radeonVtxfmtInit( GLcontext *ctx )
|
|||
exec->Vertex3fv = radeon_Vertex3fv;
|
||||
exec->Begin = radeon_Begin;
|
||||
exec->End = radeon_End;
|
||||
exec->Rectf = _mesa_noop_Rectf;
|
||||
|
||||
vb.context = ctx;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue