Quellcode durchsuchen

Fix several conformance problems. Hack solution to line stipple problem.

tags/mesa_3_5
Keith Whitwell vor 26 Jahren
Ursprung
Commit
d43a5943d8

+ 33
- 3
src/mesa/drivers/glide/fxdd.c Datei anzeigen

@@ -1028,10 +1028,40 @@ static void fxDDUpdateDDPointers(GLcontext *ctx, GLuint new_state)

static void fxDDRenderPrimitive( GLcontext *ctx, GLenum mode )
{
(void) ctx; (void) mode;
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;

if (!fxMesa->is_in_hardware) {
_swsetup_RenderPrimitive( ctx, mode );
}
else {
fxMesa->render_prim = mode;
}
}


static void fxDDRenderStart( GLcontext *ctx )
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;

if (!fxMesa->is_in_hardware) {
_swsetup_RenderStart( ctx );
}
else if (fxMesa->new_state) {
fxSetupFXUnits( ctx );
}
}

static void fxDDRenderFinish( GLcontext *ctx )
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;

if (!fxMesa->is_in_hardware) {
_swsetup_RenderFinish( ctx );
}
}



void fxSetupDDPointers(GLcontext *ctx)
{
if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -1062,8 +1092,8 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.Finish=fxDDFinish;
ctx->Driver.Flush=NULL;

ctx->Driver.RenderStart=fxSetupFXUnits;
ctx->Driver.RenderFinish=_swrast_flush;
ctx->Driver.RenderStart=fxDDRenderStart;
ctx->Driver.RenderFinish=fxDDRenderFinish;
ctx->Driver.ResetLineStipple=_swrast_ResetLineStipple;
ctx->Driver.RenderPrimitive=fxDDRenderPrimitive;


+ 1
- 0
src/mesa/drivers/glide/fxdrv.h Datei anzeigen

@@ -424,6 +424,7 @@ struct tfxMesaContext {
GLuint render_index;
GLuint passes, multipass;
GLuint is_in_hardware;
GLenum render_prim;

/* Current rasterization functions
*/

+ 11
- 10
src/mesa/drivers/x11/xm_dd.c Datei anzeigen

@@ -1,4 +1,4 @@
/* $Id: xm_dd.c,v 1.9 2001/01/08 04:06:20 keithw Exp $ */
/* $Id: xm_dd.c,v 1.10 2001/01/16 05:29:43 keithw Exp $ */

/*
* Mesa 3-D graphics library
@@ -922,9 +922,16 @@ void xmesa_init_pointers( GLcontext *ctx )
ctx->Driver.Flush = flush;
ctx->Driver.Finish = finish;

ctx->Driver.RenderStart = 0;
ctx->Driver.RenderPrimitive = _swsetup_RenderPrimNoop;
ctx->Driver.RenderFinish = _swrast_flush;
ctx->Driver.RenderStart = _swsetup_RenderStart;
ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
ctx->Driver.RenderPrimitive = _swsetup_RenderPrimitive;
ctx->Driver.PointsFunc = _swsetup_Points;
ctx->Driver.LineFunc = _swsetup_Line;
ctx->Driver.TriangleFunc = _swsetup_Triangle;
ctx->Driver.QuadFunc = _swsetup_Quad;
ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple;
ctx->Driver.RenderFinish = _swsetup_RenderFinish;


ctx->Driver.SetDrawBuffer = set_draw_buffer;
ctx->Driver.SetReadBuffer = set_read_buffer;
@@ -936,11 +943,5 @@ void xmesa_init_pointers( GLcontext *ctx )
ctx->Driver.ColorMask = color_mask;
ctx->Driver.Enable = enable;

ctx->Driver.PointsFunc = _swsetup_Points;
ctx->Driver.LineFunc = _swsetup_Line;
ctx->Driver.TriangleFunc = _swsetup_Triangle;
ctx->Driver.QuadFunc = _swsetup_Quad;
ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple;
(void) DitherValues; /* silenced unused var warning */
}

+ 40
- 98
src/mesa/swrast_setup/ss_context.c Datei anzeigen

@@ -1,4 +1,4 @@
/* $Id: ss_context.c,v 1.7 2001/01/08 04:09:41 keithw Exp $ */
/* $Id: ss_context.c,v 1.8 2001/01/16 05:29:43 keithw Exp $ */

/*
* Mesa 3-D graphics library
@@ -27,64 +27,17 @@
* Keith Whitwell <keithw@valinux.com>
*/


#include "glheader.h"
#include "mem.h"


#include "ss_context.h"
#include "ss_triangle.h"
#include "ss_vb.h"

#include "swrast_setup.h"

#include "tnl/t_context.h"

/* Stub for swsetup->Triangle to select a true triangle function
* after a state change.
*/
static void
_swsetup_validate_quad( GLcontext *ctx, GLuint v0, GLuint v1,
GLuint v2, GLuint v3 )
{
_swsetup_choose_trifuncs( ctx );
SWSETUP_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3 );
}

static void
_swsetup_validate_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2 )
{
_swsetup_choose_trifuncs( ctx );
SWSETUP_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
}

static void
_swsetup_validate_line( GLcontext *ctx, GLuint v0, GLuint v1 )
{
_swsetup_choose_trifuncs( ctx );
SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1 );
}


static void
_swsetup_validate_points( GLcontext *ctx, GLuint first, GLuint last )
{
_swsetup_choose_trifuncs( ctx );
SWSETUP_CONTEXT(ctx)->Points( ctx, first, last );
}



static void
_swsetup_validate_buildprojverts( GLcontext *ctx,
GLuint start, GLuint end, GLuint new_inputs )
{
_swsetup_choose_rastersetup_func( ctx );
SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs );
}


#define _SWSETUP_NEW_VERTS (_NEW_RENDERMODE| \
_NEW_LIGHT| \
_NEW_TEXTURE| \
_NEW_COLOR| \
_NEW_FOG| \
@@ -93,38 +46,13 @@ _swsetup_validate_buildprojverts( GLcontext *ctx,
#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT)


#if 0
/* TODO: sleep/wakeup mechanism
*/
static void
_swsetup_sleep( GLcontext *ctx, GLuint new_state )
{
}
#endif

static void
_swsetup_invalidate_state( GLcontext *ctx, GLuint new_state )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
swsetup->NewState |= new_state;

if (new_state & _SWSETUP_NEW_RENDERINDEX) {
swsetup->Triangle = _swsetup_validate_triangle;
swsetup->Line = _swsetup_validate_line;
swsetup->Points = _swsetup_validate_points;
swsetup->Quad = _swsetup_validate_quad;
}

if (new_state & _SWSETUP_NEW_VERTS) {
swsetup->BuildProjVerts = _swsetup_validate_buildprojverts;
}
}



/* Dispatch from these fixed entrypoints to the state-dependent
* functions:
* functions.
*
* The design of swsetup suggests that we could really program
* ctx->Driver.TriangleFunc directly from _swsetup_RenderStart, and
* avoid this second level of indirection. However, this is more
* convient for fallback cases in hardware rasterization drivers.
*/
void
_swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1,
@@ -146,7 +74,6 @@ _swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1 )
SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1 );
}


void
_swsetup_Points( GLcontext *ctx, GLuint first, GLuint last )
{
@@ -160,12 +87,6 @@ _swsetup_BuildProjectedVertices( GLcontext *ctx, GLuint start, GLuint end,
SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs );
}

void
_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state )
{
SWSETUP_CONTEXT(ctx)->InvalidateState( ctx, new_state );
}


GLboolean
_swsetup_CreateContext( GLcontext *ctx )
@@ -185,13 +106,6 @@ _swsetup_CreateContext( GLcontext *ctx )
ctx->swsetup_context = swsetup;

swsetup->NewState = ~0;
swsetup->InvalidateState = _swsetup_invalidate_state;
swsetup->Quad = _swsetup_validate_quad;
swsetup->Triangle = _swsetup_validate_triangle;
swsetup->Line = _swsetup_validate_line;
swsetup->Points = _swsetup_validate_points;
swsetup->BuildProjVerts = _swsetup_validate_buildprojverts;
_swsetup_vb_init( ctx );
_swsetup_trifuncs_init( ctx );

@@ -210,10 +124,38 @@ _swsetup_DestroyContext( GLcontext *ctx )
}
}

void
_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode )
{
SWSETUP_CONTEXT(ctx)->render_prim = mode;
}

void
_swsetup_RenderStart( GLcontext *ctx )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
GLuint new_state = swsetup->NewState;

if (new_state & _SWSETUP_NEW_RENDERINDEX) {
_swsetup_choose_trifuncs( ctx );
}

if (new_state & _SWSETUP_NEW_VERTS) {
_swsetup_choose_rastersetup_func( ctx );
}

swsetup->NewState = 0;
}

void
_swsetup_RenderFinish( GLcontext *ctx )
{
_swrast_flush( ctx );
}

void
_swsetup_RenderPrimNoop( GLcontext *ctx, GLenum mode )
_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state )
{
(void) ctx;
(void) mode;
SWSETUP_CONTEXT(ctx)->NewState |= new_state;
}


+ 1
- 0
src/mesa/swrast_setup/ss_context.h Datei anzeigen

@@ -54,6 +54,7 @@ typedef struct {
void (*Points)( GLcontext *ctx, GLuint first, GLuint last );

SWvertex *verts;
GLenum render_prim;

} SScontext;


+ 95
- 0
src/mesa/swrast_setup/ss_triangle.c Datei anzeigen

@@ -26,6 +26,7 @@
*/

#include "glheader.h"
#include "colormac.h"
#include "macros.h"
#include "mtypes.h"

@@ -44,6 +45,100 @@ static triangle_func tri_tab[SS_MAX_TRIFUNC];
static quad_func quad_tab[SS_MAX_TRIFUNC];


static void _swsetup_render_line_tri( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2 )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLubyte *ef = VB->EdgeFlag;
SWvertex *verts = swsetup->verts;
SWvertex *v0 = &verts[e0];
SWvertex *v1 = &verts[e1];
SWvertex *v2 = &verts[e2];
GLchan c[2][4];
GLchan s[2][4];
GLuint i[2];

if (ctx->_TriangleCaps & DD_FLATSHADE) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
COPY_CHAN4(s[0], v0->specular);
COPY_CHAN4(s[1], v1->specular);
i[0] = v0->index;
i[1] = v1->index;

COPY_CHAN4(v0->color, v2->color);
COPY_CHAN4(v1->color, v2->color);
COPY_CHAN4(v0->specular, v2->specular);
COPY_CHAN4(v1->specular, v2->specular);
v0->index = v2->index;
v1->index = v2->index;
}

if (swsetup->render_prim == GL_POLYGON) {
if (ef[e2]) _swrast_Line( ctx, v2, v0 );
if (ef[e0]) _swrast_Line( ctx, v0, v1 );
if (ef[e1]) _swrast_Line( ctx, v1, v2 );
} else {
if (ef[e0]) _swrast_Line( ctx, v0, v1 );
if (ef[e1]) _swrast_Line( ctx, v1, v2 );
if (ef[e2]) _swrast_Line( ctx, v2, v0 );
}

if (ctx->_TriangleCaps & DD_FLATSHADE) {
COPY_CHAN4(v0->color, c[0]);
COPY_CHAN4(v1->color, c[1]);
COPY_CHAN4(v0->specular, s[0]);
COPY_CHAN4(v1->specular, s[1]);
v0->index = i[0];
v1->index = i[1];
}
}

static void _swsetup_render_point_tri( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2 )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLubyte *ef = VB->EdgeFlag;
SWvertex *verts = swsetup->verts;
SWvertex *v0 = &verts[e0];
SWvertex *v1 = &verts[e1];
SWvertex *v2 = &verts[e2];
GLchan c[2][4];
GLchan s[2][4];
GLuint i[2];

if (ctx->_TriangleCaps & DD_FLATSHADE) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
COPY_CHAN4(s[0], v0->specular);
COPY_CHAN4(s[1], v1->specular);
i[0] = v0->index;
i[1] = v1->index;

COPY_CHAN4(v0->color, v2->color);
COPY_CHAN4(v1->color, v2->color);
COPY_CHAN4(v0->specular, v2->specular);
COPY_CHAN4(v1->specular, v2->specular);
v0->index = v2->index;
v1->index = v2->index;
}

if (ef[e0]) _swrast_Point( ctx, v0 );
if (ef[e1]) _swrast_Point( ctx, v1 );
if (ef[e2]) _swrast_Point( ctx, v2 );

if (ctx->_TriangleCaps & DD_FLATSHADE) {
COPY_CHAN4(v0->color, c[0]);
COPY_CHAN4(v1->color, c[1]);
COPY_CHAN4(v0->specular, s[0]);
COPY_CHAN4(v1->specular, s[1]);
v0->index = i[0];
v1->index = i[1];
}
}

#define SS_COLOR(a,b) COPY_4UBV(a,b)
#define SS_SPEC(a,b) COPY_4UBV(a,b)
#define SS_IND(a,b) (a = b)

+ 2
- 8
src/mesa/swrast_setup/ss_tritmp.h Datei anzeigen

@@ -99,25 +99,19 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}

if (mode == GL_POINT) {
GLubyte *ef = VB->EdgeFlag;
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
v[2]->win[2] += offset;
}
if (ef[e0]) _swrast_Point( ctx, v[0] );
if (ef[e1]) _swrast_Point( ctx, v[1] );
if (ef[e2]) _swrast_Point( ctx, v[2] );
_swsetup_render_point_tri( ctx, e0, e1, e2 );
} else if (mode == GL_LINE) {
GLubyte *ef = VB->EdgeFlag;
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
v[2]->win[2] += offset;
}
if (ef[e0]) _swrast_Line( ctx, v[0], v[1] );
if (ef[e1]) _swrast_Line( ctx, v[1], v[2] );
if (ef[e2]) _swrast_Line( ctx, v[2], v[0] );
_swsetup_render_line_tri( ctx, e0, e1, e2 );
} else {
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) {
v[0]->win[2] += offset;

+ 10
- 2
src/mesa/swrast_setup/swrast_setup.h Datei anzeigen

@@ -25,7 +25,9 @@
* Keith Whitwell <keithw@valinux.com>
*/

/* Public interface to the swrast_setup module.
/* Public interface to the swrast_setup module. This module provides
* an implementation of the driver interface to t_vb_render.c, and uses
* the software rasterizer (swrast) to perform actual rasterization.
*/

#ifndef SWRAST_SETUP_H
@@ -59,6 +61,12 @@ extern void
_swsetup_Points( GLcontext *ctx, GLuint first, GLuint last );

extern void
_swsetup_RenderPrimNoop( GLcontext *ctx, GLenum mode );
_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode );

extern void
_swsetup_RenderStart( GLcontext *ctx );

extern void
_swsetup_RenderFinish( GLcontext *ctx );

#endif

+ 3
- 5
src/mesa/tnl/t_vb_render.c Datei anzeigen

@@ -1,4 +1,4 @@
/* $Id: t_vb_render.c,v 1.9 2001/01/08 21:56:00 keithw Exp $ */
/* $Id: t_vb_render.c,v 1.10 2001/01/16 05:29:43 keithw Exp $ */

/*
* Mesa 3-D graphics library
@@ -577,8 +577,7 @@ static GLboolean run_render( GLcontext *ctx,
* that window coordinates are guarenteed not to change before
* rendering.
*/
if (ctx->Driver.RenderStart)
ctx->Driver.RenderStart( ctx );
ctx->Driver.RenderStart( ctx );
if (VB->ClipOrMask) {
tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
@@ -611,9 +610,8 @@ static GLboolean run_render( GLcontext *ctx,
} while (ctx->Driver.MultipassFunc &&
ctx->Driver.MultipassFunc( ctx, ++pass ));

if (ctx->Driver.RenderFinish)
ctx->Driver.RenderFinish( ctx );

ctx->Driver.RenderFinish( ctx );
return GL_FALSE; /* finished the pipe */
}


+ 2
- 2
src/mesa/tnl/t_vb_rendertmp.h Datei anzeigen

@@ -1,4 +1,4 @@
/* $Id: t_vb_rendertmp.h,v 1.6 2001/01/14 06:14:21 keithw Exp $ */
/* $Id: t_vb_rendertmp.h,v 1.7 2001/01/16 05:29:43 keithw Exp $ */

/*
* Mesa 3-D graphics library
@@ -348,7 +348,7 @@ static void TAG(render_quads)( GLcontext *ctx,
}
}
POSTFIX;
}
}

static void TAG(render_quad_strip)( GLcontext *ctx,
GLuint start,

Laden…
Abbrechen
Speichern