Przeglądaj źródła

Add a 'RenderPrimitive' callback to t_vb_render.c. Helps out drivers

that used to require a 'ReducedPrimitiveChange' callback.

Various compilation fixes for XFree86.

Reverted to the older version of glcore.h used internally in XFree86, and
moved it to 'Mesa/include/GL/internal/glcore.h', for compatibility with
XFree86.
tags/mesa_3_5
Keith Whitwell 25 lat temu
rodzic
commit
b980b2eeb6

+ 3
- 2
src/mesa/main/context.c Wyświetl plik

/* $Id: context.c,v 1.115 2001/01/05 05:31:42 keithw Exp $ */
/* $Id: context.c,v 1.116 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
modes->accumAlphaBits, modes->accumAlphaBits,
0); 0);


_mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->wscx, GL_FALSE);
/* KW: was imports->wscx */
_mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->other, GL_FALSE);


ctx->exports.destroyContext = _mesa_DestroyContext; ctx->exports.destroyContext = _mesa_DestroyContext;



+ 3
- 1
src/mesa/main/dd.h Wyświetl plik

/* $Id: dd.h,v 1.45 2001/01/05 02:26:48 keithw Exp $ */
/* $Id: dd.h,v 1.46 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library




void (*RenderStart)( GLcontext *ctx ); void (*RenderStart)( GLcontext *ctx );
void (*RenderPrimitive)( GLcontext *ctx, GLenum mode );
void (*RenderFinish)( GLcontext *ctx ); void (*RenderFinish)( GLcontext *ctx );
/* Wrap around all rendering functions. Suitable for /* Wrap around all rendering functions. Suitable for
* grabbing/releasing hardware locks. * grabbing/releasing hardware locks.
void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
void (*RenderMode)(GLcontext *ctx, GLenum mode );
void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
void (*ShadeModel)(GLcontext *ctx, GLenum mode); void (*ShadeModel)(GLcontext *ctx, GLenum mode);
void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);

+ 1
- 16
src/mesa/main/dispatch.c Wyświetl plik

/* $Id: dispatch.c,v 1.18 2001/01/02 10:07:34 joukj Exp $ */
/* $Id: dispatch.c,v 1.19 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library


#else #else


#ifdef THREADS

#define DISPATCH(FUNC, ARGS, MESSAGE) \ #define DISPATCH(FUNC, ARGS, MESSAGE) \
const struct _glapi_table *dispatch; \ const struct _glapi_table *dispatch; \
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
return (dispatch->FUNC) ARGS return (dispatch->FUNC) ARGS


#else


#define DISPATCH(FUNC, ARGS, MESSAGE) \
__asm__ ("jmp *(%%eax) ;" : : "a" (&(_glapi_Dispatch->FUNC)) )

#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
const struct _glapi_table *dispatch; \
dispatch = _glapi_Dispatch;\
return (dispatch->FUNC) ARGS

#endif

#endif #endif





+ 4
- 1
src/mesa/main/feedback.c Wyświetl plik

/* $Id: feedback.c,v 1.18 2000/12/26 05:09:28 keithw Exp $ */
/* $Id: feedback.c,v 1.19 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
} }


ctx->RenderMode = mode; ctx->RenderMode = mode;
if (ctx->Driver.RenderMode)
ctx->Driver.RenderMode( ctx, mode );

return result; return result;
} }



+ 2
- 2
src/mesa/main/glheader.h Wyświetl plik

/* $Id: glheader.h,v 1.15 2000/09/26 20:53:53 brianp Exp $ */
/* $Id: glheader.h,v 1.16 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#ifndef CAPI #ifndef CAPI
#define CAPI #define CAPI
#endif #endif
#include "glcore.h"
#include <GL/internal/glcore.h>







+ 10
- 5
src/mesa/main/imports.c Wyświetl plik

/* $Id: imports.c,v 1.3 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: imports.c,v 1.4 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#ifdef DEBUG #ifdef DEBUG
debug = GL_TRUE; debug = GL_TRUE;
#else #else
/* Whacko XFree86 macro:
*/
#ifdef getenv
#undef getenv
#endif
if (gc->imports.getenv(gc, "MESA_DEBUG")) { if (gc->imports.getenv(gc, "MESA_DEBUG")) {
debug = GL_TRUE; debug = GL_TRUE;
} }
_mesa_getenv(__GLcontext *gc, const char *var) _mesa_getenv(__GLcontext *gc, const char *var)
{ {
(void) gc; (void) gc;
return getenv(var);
return gc->imports.getenv(gc, var);
} }


static int static int
imports->warning = _mesa_warning; imports->warning = _mesa_warning;
imports->fatal = _mesa_fatal; imports->fatal = _mesa_fatal;
imports->getenv = _mesa_getenv; imports->getenv = _mesa_getenv;
imports->atoi = _mesa_atoi;
/* imports->atoi = _mesa_atoi; */
imports->sprintf = _mesa_sprintf; imports->sprintf = _mesa_sprintf;
imports->fopen = _mesa_fopen; imports->fopen = _mesa_fopen;
imports->fclose = _mesa_fclose; imports->fclose = _mesa_fclose;
imports->fprintf = _mesa_fprintf; imports->fprintf = _mesa_fprintf;
imports->getDrawablePrivate = _mesa_GetDrawablePrivate; imports->getDrawablePrivate = _mesa_GetDrawablePrivate;
imports->wscx = driverCtx;
imports->other = other;
/* imports->wscx = driverCtx; */
imports->other = driverCtx;
} }

+ 5
- 1
src/mesa/main/lines.c Wyświetl plik

/* $Id: lines.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */
/* $Id: lines.c,v 1.25 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library


FLUSH_VERTICES(ctx, _NEW_LINE); FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.Width = width; ctx->Line.Width = width;
ctx->Line._Width = CLAMP(width,
ctx->Const.MinLineWidth,
ctx->Const.MaxLineWidth);



if (width != 1.0) if (width != 1.0)
ctx->_TriangleCaps |= DD_LINE_WIDTH; ctx->_TriangleCaps |= DD_LINE_WIDTH;

+ 2
- 2
src/mesa/main/macros.h Wyświetl plik

/* $Id: macros.h,v 1.16 2000/12/26 05:09:29 keithw Exp $ */
/* $Id: macros.h,v 1.17 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i))
#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) #define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i))
#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i)) #define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i))
#define STRIDE_T(p, t, i) (p = (t *)((GLubyte *)p + i))
#define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i))




#define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 #define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0

+ 2
- 1
src/mesa/main/mtypes.h Wyświetl plik

/* $Id: mtypes.h,v 1.11 2001/01/06 22:46:13 gareth Exp $ */
/* $Id: mtypes.h,v 1.12 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLushort StipplePattern; /* Stipple pattern */ GLushort StipplePattern; /* Stipple pattern */
GLint StippleFactor; /* Stipple repeat factor */ GLint StippleFactor; /* Stipple repeat factor */
GLfloat Width; /* Line width */ GLfloat Width; /* Line width */
GLfloat _Width; /* Clamped Line width */
}; };





+ 2
- 1
src/mesa/math/m_xform.c Wyświetl plik

/* $Id: m_xform.c,v 1.5 2000/12/26 05:09:31 keithw Exp $ */
/* $Id: m_xform.c,v 1.6 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#include "m_matrix.h" #include "m_matrix.h"
#include "m_translate.h" #include "m_translate.h"
#include "m_xform.h" #include "m_xform.h"
#include "mathmod.h"




#ifdef DEBUG #ifdef DEBUG

+ 0
- 2
src/mesa/math/mathmod.h Wyświetl plik

#ifndef _MESA_MATH_H_ #ifndef _MESA_MATH_H_
#define _MESA_MATH_H_ #define _MESA_MATH_H_


#include <math.h>

extern void _math_init( void ); extern void _math_init( void );


#endif #endif

+ 7
- 1
src/mesa/swrast_setup/ss_context.c Wyświetl plik

/* $Id: ss_context.c,v 1.6 2001/01/05 02:26:49 keithw Exp $ */
/* $Id: ss_context.c,v 1.7 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
} }




void
_swsetup_RenderPrimNoop( GLcontext *ctx, GLenum mode )
{
(void) ctx;
(void) mode;
}

+ 2
- 0
src/mesa/swrast_setup/swrast_setup.h Wyświetl plik

extern void extern void
_swsetup_Points( GLcontext *ctx, GLuint first, GLuint last ); _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last );


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


#endif #endif

+ 8
- 2
src/mesa/tnl/t_array_import.c Wyświetl plik

/* $Id: t_array_import.c,v 1.4 2001/01/05 02:26:49 keithw Exp $ */
/* $Id: t_array_import.c,v 1.5 2001/01/08 04:09:41 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) { if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) {
ASSERT(VB->ObjPtr == &inputs->Obj); ASSERT(VB->ObjPtr == &inputs->Obj);
_tnl_import_vertex( ctx, writeable, stride ); _tnl_import_vertex( ctx, writeable, stride );
VB->importable_data &= ~(VERT_OBJ|VERT_CLIP);
} }


if ((required & VERT_NORM) && (VB->NormalPtr->flags & flags)) { if ((required & VERT_NORM) && (VB->NormalPtr->flags & flags)) {
ASSERT(VB->NormalPtr == &inputs->Normal); ASSERT(VB->NormalPtr == &inputs->Normal);
_tnl_import_normal( ctx, writeable, stride ); _tnl_import_normal( ctx, writeable, stride );
VB->importable_data &= ~VERT_NORM;
} }


if ((required & VERT_RGBA) && (VB->ColorPtr[0]->flags & flags)) { if ((required & VERT_RGBA) && (VB->ColorPtr[0]->flags & flags)) {
ASSERT(VB->ColorPtr[0] == &inputs->Color); ASSERT(VB->ColorPtr[0] == &inputs->Color);
_tnl_import_color( ctx, writeable, stride ); _tnl_import_color( ctx, writeable, stride );
VB->importable_data &= ~VERT_RGBA;
} }


if ((required & VERT_SPEC_RGB) && (VB->SecondaryColorPtr[0]->flags&flags)) { if ((required & VERT_SPEC_RGB) && (VB->SecondaryColorPtr[0]->flags&flags)) {
ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor); ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor);
_tnl_import_secondarycolor( ctx, writeable, stride ); _tnl_import_secondarycolor( ctx, writeable, stride );
VB->importable_data &= ~VERT_SPEC_RGB;
} }


if ((required & VERT_FOG_COORD) && (VB->FogCoordPtr->flags & flags)) { if ((required & VERT_FOG_COORD) && (VB->FogCoordPtr->flags & flags)) {
ASSERT(VB->FogCoordPtr == &inputs->FogCoord); ASSERT(VB->FogCoordPtr == &inputs->FogCoord);
_tnl_import_fogcoord( ctx, writeable, stride ); _tnl_import_fogcoord( ctx, writeable, stride );
VB->importable_data &= ~VERT_FOG_COORD;
} }


if ((required & VERT_INDEX) && (VB->IndexPtr[0]->flags & flags)) { if ((required & VERT_INDEX) && (VB->IndexPtr[0]->flags & flags)) {
ASSERT(VB->IndexPtr[0] == &inputs->Index); ASSERT(VB->IndexPtr[0] == &inputs->Index);
_tnl_import_index( ctx, writeable, stride ); _tnl_import_index( ctx, writeable, stride );
VB->importable_data &= ~VERT_INDEX;
} }


if (required & VERT_TEX_ANY) if (required & VERT_TEX_ANY)
if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) {
ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]); ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]);
_tnl_import_texcoord( ctx, i, writeable, stride ); _tnl_import_texcoord( ctx, i, writeable, stride );
VB->importable_data &= ~VERT_TEX(i);
} }
VB->importable_data &= ~required;
} }





+ 6
- 2
src/mesa/tnl/t_vb_light.c Wyświetl plik

/* $Id: t_vb_light.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* $Id: t_vb_light.c,v 1.3 2001/01/08 04:09:42 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */ stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */
if (ctx->Light.ColorMaterialEnabled) if (ctx->Light.ColorMaterialEnabled)
stage->inputs |= VERT_RGBA; stage->inputs |= VERT_RGBA;

stage->outputs = VERT_RGBA;
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
stage->outputs |= VERT_SPEC_RGB;
} }
} }


_NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency _NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency
* otherwise not captured by inputs * otherwise not captured by inputs
* (which may be VERT_OBJ) */ * (which may be VERT_OBJ) */
0,0,VERT_RGBA, /* active, inputs, outputs */
0,0,0, /* active, inputs, outputs */
0,0, /* changed_inputs, private_data */ 0,0, /* changed_inputs, private_data */
dtr, /* destroy */ dtr, /* destroy */
check_lighting, /* check */ check_lighting, /* check */

+ 2
- 1
src/mesa/tnl/t_vb_render.c Wyświetl plik

/* $Id: t_vb_render.c,v 1.6 2001/01/05 02:26:49 keithw Exp $ */
/* $Id: t_vb_render.c,v 1.7 2001/01/08 04:09:42 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
(void) elt; (void) mask; (void) sz; (void) elt; (void) mask; (void) sz;


#define TAG(x) clip_##x##_verts #define TAG(x) clip_##x##_verts
#define INIT(x) ctx->Driver.RenderPrimitive( ctx, x )
#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx ) #define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE; #define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE;
#define PRESERVE_VB_DEFS #define PRESERVE_VB_DEFS

+ 8
- 8
src/mesa/tnl/t_vb_rendertmp.h Wyświetl plik

/* $Id: t_vb_rendertmp.h,v 1.4 2001/01/05 02:26:49 keithw Exp $ */
/* $Id: t_vb_rendertmp.h,v 1.5 2001/01/08 04:09:42 keithw Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
(void) flags; (void) flags;


RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINES);
INIT(GL_LINE_STRIP);


for (j=start+1; j<count; j++ ) for (j=start+1; j<count; j++ )
RENDER_LINE( ELT(j-1), ELT(j) ); RENDER_LINE( ELT(j-1), ELT(j) );
(void) flags; (void) flags;


RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINES);
INIT(GL_LINE_LOOP);


if (start+1 < count) { if (start+1 < count) {
if (TEST_PRIM_BEGIN(flags)) { if (TEST_PRIM_BEGIN(flags)) {
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;


INIT(GL_POLYGON);
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+2; j<count; j+=3) { for (j=start+2; j<count; j+=3) {
/* Leave the edgeflags as supplied by the user. /* Leave the edgeflags as supplied by the user.
if (TEST_PRIM_PARITY(flags)) if (TEST_PRIM_PARITY(flags))
parity = 1; parity = 1;
INIT(GL_POLYGON);
INIT(GL_TRIANGLE_STRIP);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+2;j<count;j++,parity^=1) { for (j=start+2;j<count;j++,parity^=1) {
GLuint ej2 = ELT(j-2+parity); GLuint ej2 = ELT(j-2+parity);
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;


INIT(GL_POLYGON);
INIT(GL_TRIANGLE_FAN);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+2;j<count;j++) { for (j=start+2;j<count;j++) {
/* For trifans, all edges are boundary. /* For trifans, all edges are boundary.
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;


INIT(GL_POLYGON);
INIT(GL_QUADS);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+3; j<count; j+=4) { for (j=start+3; j<count; j+=4) {
/* Use user-specified edgeflags for quads. /* Use user-specified edgeflags for quads.
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;


INIT(GL_POLYGON);
INIT(GL_QUAD_STRIP);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+3;j<count;j+=2) { for (j=start+3;j<count;j+=2) {
/* All edges are boundary. Set edgeflags to 1, draw the /* All edges are boundary. Set edgeflags to 1, draw the

Ładowanie…
Anuluj
Zapisz