Support for swappable t&l modules, including an example one in the FX

driver (enable with FX_ALLOW_VTXFMT=t).
This commit is contained in:
Keith Whitwell 2000-11-24 10:25:05 +00:00
parent 00608a79dc
commit ad2ac216fa
36 changed files with 737 additions and 1009 deletions

View File

@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.33 2000/11/16 21:05:34 keithw Exp $
# $Id: Makefile.X11,v 1.34 2000/11/24 10:25:05 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@ -21,6 +21,7 @@ LIBDIR = ../lib
CORE_SOURCES = \
tnl/t_vtxfmt.c \
tnl/t_bbox.c \
tnl/t_clip.c \
tnl/t_context.c \
@ -31,7 +32,6 @@ CORE_SOURCES = \
tnl/t_fog.c \
tnl/t_light.c \
tnl/t_pipeline.c \
tnl/t_rect.c \
tnl/t_shade.c \
tnl/t_stages.c \
tnl/t_texture.c \
@ -39,10 +39,11 @@ CORE_SOURCES = \
tnl/t_varray.c \
tnl/t_vb.c \
tnl/t_vbcull.c \
tnl/t_vbfill.c \
tnl/t_vbindirect.c \
tnl/t_vbrender.c \
tnl/t_vbxform.c \
api_loopback.c \
api_noop.c \
accum.c \
alpha.c \
attrib.c \
@ -90,7 +91,6 @@ CORE_SOURCES = \
polygon.c \
rastpos.c \
readpix.c \
rect.c \
scissor.c \
state.c \
stencil.c \
@ -100,6 +100,7 @@ CORE_SOURCES = \
texture.c \
texutil.c \
varray.c \
vtxfmt.c \
winpos.c \
X86/x86.c \
X86/common_x86.c \
@ -147,6 +148,8 @@ CORE_SOURCES = \
DRIVER_SOURCES = \
FX/fxvtxfmt.c \
FX/fxvtxprims.c \
FX/fxapi.c \
FX/fxdd.c \
FX/fxddspan.c \

View File

@ -710,13 +710,11 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
fxMesa->state = NULL;
fxMesa->fogTable = NULL;
fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));
fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES) *
sizeof(GrFog_t));
if (!fxMesa->state || !fxMesa->fogTable) {
if (fxMesa->state) free(fxMesa->state);
if (fxMesa->fogTable) free(fxMesa->fogTable);
@ -756,7 +754,8 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
_swrast_allow_vertex_fog( fxMesa->glCtx, GL_FALSE );
_swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE );
fxDDInitExtensions(fxMesa->glCtx);
fxDDInitExtensions(fxMesa->glCtx);
fxDDInitVtxfmt(fxMesa->glCtx);
FX_grGlideGetState((GrState*)fxMesa->state);
@ -902,41 +901,75 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
return GL_TRUE;
}
static void update_texture_scales( GLcontext *ctx )
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
if (t0 && t0->_Current && FX_TEXTURE_DATA(t0)) {
fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
fxMesa->inv_s0scale = 1.0 / fxMesa->s0scale;
fxMesa->inv_t0scale = 1.0 / fxMesa->t0scale;
}
if (t1 && t1->_Current && FX_TEXTURE_DATA(t1)) {
fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
fxMesa->inv_s1scale = 1.0 / fxMesa->s1scale;
fxMesa->inv_t1scale = 1.0 / fxMesa->t1scale;
}
}
static void fxDDUpdateDDPointers(GLcontext *ctx)
{
GLuint new_state = ctx->NewState;
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint new_state = ctx->NewState;
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
/* Recalculate fog table on projection matrix changes. This used to
* be triggered by the NearFar callback.
*/
if (new_state & _NEW_PROJECTION) {
FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
/* Recalculate fog table on projection matrix changes. This used to
* be triggered by the NearFar callback.
*/
if (new_state & _NEW_PROJECTION)
fxMesa->new_state |= FX_NEW_FOG;
if (new_state & (_FX_NEW_IS_IN_HARDWARE |
_FX_NEW_RENDERSTATE |
_FX_NEW_SETUP_FUNCTION))
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
if (new_state & (_FX_NEW_IS_IN_HARDWARE |
_FX_NEW_RENDERSTATE |
_FX_NEW_SETUP_FUNCTION |
_NEW_TEXTURE))
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
if (new_state & _FX_NEW_IS_IN_HARDWARE)
fxMesa->is_in_hardware = fxIsInHardware(ctx);
if (new_state & _FX_NEW_IS_IN_HARDWARE)
fxMesa->is_in_hardware = fxIsInHardware(ctx);
if (fxMesa->new_state)
fxSetupFXUnits(ctx);
if (fxMesa->new_state)
fxSetupFXUnits(ctx);
if (new_state & _FX_NEW_RENDERSTATE)
fxDDChooseRenderState( ctx );
if (new_state & _FX_NEW_SETUP_FUNCTION)
ctx->Driver.RasterSetup = fxDDChooseSetupFunction(ctx);
if (new_state & _FX_NEW_RENDERSTATE)
fxDDChooseRenderState( ctx );
if (new_state & _NEW_TEXTURE)
update_texture_scales( ctx );
if (new_state & _FX_NEW_SETUP_FUNCTION)
ctx->Driver.RasterSetup = fxDDChooseSetupFunction(ctx);
}
}
if (fxMesa->allow_vfmt) {
if (new_state & _NEW_LIGHT)
fx_update_lighting( ctx );
if (new_state & _FX_NEW_VTXFMT)
fxDDCheckVtxfmt( ctx );
else if (fxMesa->vtxfmt_fallback_count > 1)
fxMesa->vtxfmt_fallback_count--;
}
}
@ -971,7 +1004,7 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.Finish=fxDDFinish;
ctx->Driver.Flush=NULL;
ctx->Driver.RenderStart=NULL;
ctx->Driver.RenderStart=fxSetupFXUnits;
ctx->Driver.RenderFinish=_swrast_flush;
ctx->Driver.TexImage2D = fxDDTexImage2D;
@ -1013,6 +1046,7 @@ void fxSetupDDPointers(GLcontext *ctx)
* Need this to provide at least one external definition.
*/
extern int gl_fx_dummy_function_dd(void);
int gl_fx_dummy_function_dd(void)
{
return 0;

View File

@ -565,6 +565,7 @@ void fxSetupDDSpanPointers(GLcontext *ctx)
* Need this to provide at least one external definition.
*/
extern int gl_fx_dummy_function_span(void);
int gl_fx_dummy_function_span(void)
{
return 0;

View File

@ -99,7 +99,6 @@ static void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj)
ti->validated=GL_FALSE;
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
@ -159,7 +158,6 @@ void fxDDTexBind(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj)
ti->lastTimeUsed=fxMesa->texBindNumber;
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
void fxDDTexEnv(GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param)
@ -184,7 +182,6 @@ void fxDDTexEnv(GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *para
}
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
@ -282,7 +279,6 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
break;
}
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
case GL_TEXTURE_WRAP_T:
@ -297,7 +293,6 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
break;
}
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
case GL_TEXTURE_BORDER_COLOR:
@ -439,7 +434,6 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
}
convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
fxMesa->new_state |= FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
}
@ -1191,6 +1185,7 @@ GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
* Need this to provide at least one external definition.
*/
extern int gl_fx_dummy_function_ddtex(void);
int gl_fx_dummy_function_ddtex(void)
{
return 0;

View File

@ -68,18 +68,6 @@
#include "math/m_vector.h"
/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of
* WINGDIAPI/APIENTRY/CALLBACK, these are defined in mesa gl/gl.h -
* tjump@spgs.com
*/
extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
#if defined(MESA_DEBUG) && 0
#define grDrawTriangle fx_sanity_triangle
#endif
/* Define some shorter names for these things.
*/
@ -99,18 +87,6 @@ extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
#define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
#define CLIP_XCOORD 0 /* normal place */
#define CLIP_YCOROD 1 /* normal place */
#define CLIP_ZCOORD 2 /* GR_VERTEX_Z_OFFSET */
#define CLIP_WCOORD 3 /* GR_VERTEX_R_OFFSET */
#define CLIP_GCOORD 4 /* normal place */
#define CLIP_BCOORD 5 /* normal place */
#define CLIP_RCOORD 6 /* GR_VERTEX_OOZ_OFFSET */
#define CLIP_ACOORD 7 /* normal place */
/* Should have size == 16 * sizeof(float).
*/
typedef union {
@ -119,6 +95,26 @@ typedef union {
GLuint ui[16];
} fxVertex;
/* Used in the fxvtxfmt t&l engine.
*/
typedef struct {
GrVertex v;
GLfloat clip[4];
GLfloat win[4];
GLfloat texcoord[2][2];
GLubyte mask;
GLfloat normal[3]; /* for replay & fallback */
} fxClipVertex;
typedef void (*vfmt_project_func)( GLcontext *ctx, fxClipVertex *v );
typedef void (*vfmt_interpolate_func)( GLfloat t,
fxClipVertex *O,
const fxClipVertex *I,
const fxClipVertex *J );
#if defined(FXMESA_USE_ARGB)
#define FXCOLOR4( c ) ( \
@ -141,16 +137,14 @@ typedef union {
/* Mergable items first
/* fastpath/vtxfmt flags first
*/
#define SETUP_RGBA 0x1
#define SETUP_TMU0 0x2
#define SETUP_TMU1 0x4
#define SETUP_TMU0 0x1
#define SETUP_TMU1 0x2
#define SETUP_RGBA 0x4
#define SETUP_XYZW 0x8
#define MAX_SETUP 0x10
#define MAX_MERGABLE 0x8
#define FX_NUM_TMU 2
@ -199,7 +193,6 @@ typedef union {
#define FX_UM_ALPHA_ITERATED 0x04000000
#define FX_UM_ALPHA_CONSTANT 0x08000000
typedef void (*tfxRenderVBFunc)(GLcontext *);
/*
Memory range from startAddr to endAddr-1
@ -355,6 +348,15 @@ struct tfxMesaVertexBuffer {
_NEW_COLOR) \
/* Covers the state referenced in fxDDCheckVtxfmt.
*/
#define _FX_NEW_VTXFMT (_NEW_TEXTURE | \
_NEW_TEXTURE_MATRIX | \
_NEW_TRANSFORM | \
_NEW_LIGHT | \
_FX_NEW_RENDERSTATE)
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
*/
@ -369,101 +371,127 @@ typedef void (*fx_point_func)( GLcontext *, const fxVertex * );
typedef void (*fxRenderEltsFunc)( struct vertex_buffer * );
struct tfxMesaContext {
GuTexPalette glbPalette;
GuTexPalette glbPalette;
GLcontext *glCtx; /* the core Mesa context */
GLvisual *glVis; /* describes the color buffer */
GLframebuffer *glBuffer; /* the ancillary buffers */
GLcontext *glCtx; /* the core Mesa context */
GLvisual *glVis; /* describes the color buffer */
GLframebuffer *glBuffer; /* the ancillary buffers */
GLint board; /* the board used for this context */
GLint width, height; /* size of color buffer */
GLint board; /* the board used for this context */
GLint width, height; /* size of color buffer */
GrBuffer_t currentFB;
GrBuffer_t currentFB;
GLboolean bgrOrder;
GrColor_t color;
GrColor_t clearC;
GrAlpha_t clearA;
GLuint constColor;
GrCullMode_t cullMode;
GLboolean bgrOrder;
GrColor_t color;
GrColor_t clearC;
GrAlpha_t clearA;
GLuint constColor;
GrCullMode_t cullMode;
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
GLuint tmu_source[FX_NUM_TMU];
GLuint tex_dest[MAX_TEXTURE_UNITS];
GLuint render_index;
GLuint setupindex;
GLuint setupdone;
GLuint stw_hint_state; /* for grHints */
GLuint is_in_hardware;
GLuint new_state;
GLuint using_fast_path, passes, multipass;
GLuint tmu_source[FX_NUM_TMU];
GLuint tex_dest[MAX_TEXTURE_UNITS];
GLuint render_index;
GLuint setupindex;
GLuint setupdone;
GLuint stw_hint_state; /* for grHints */
GLuint is_in_hardware;
GLuint new_state;
GLuint using_fast_path, passes, multipass;
/* Texture Memory Manager Data */
/* Texture Memory Manager Data */
GLuint texBindNumber;
GLint tmuSrc;
GLuint lastUnitsMode;
GLuint freeTexMem[FX_NUM_TMU];
MemRange *tmPool;
MemRange *tmFree[FX_NUM_TMU];
GLuint texBindNumber;
GLint tmuSrc;
GLuint lastUnitsMode;
GLuint freeTexMem[FX_NUM_TMU];
MemRange *tmPool;
MemRange *tmFree[FX_NUM_TMU];
GLenum fogTableMode;
GLfloat fogDensity;
GLfloat fogStart, fogEnd;
GrFog_t *fogTable;
GLint textureAlign;
GLenum fogTableMode;
GLfloat fogDensity;
GLfloat fogStart, fogEnd;
GrFog_t *fogTable;
GLint textureAlign;
/* Acc. functions */
/* Acc. functions */
fx_point_func draw_point;
fx_line_func draw_line;
fx_tri_func draw_tri;
fx_point_func draw_point;
fx_line_func draw_line;
fx_tri_func draw_tri;
fxRenderEltsFunc RenderElementsRaw;
fxRenderEltsFunc RenderElementsRaw;
/* System to turn culling on/off for tris/lines/points.
*/
fx_point_func initial_point;
fx_line_func initial_line;
fx_tri_func initial_tri;
fx_point_func initial_point;
fx_line_func initial_line;
fx_tri_func initial_tri;
fx_point_func subsequent_point;
fx_line_func subsequent_line;
fx_tri_func subsequent_tri;
fx_point_func subsequent_point;
fx_line_func subsequent_line;
fx_tri_func subsequent_tri;
GLfloat s0scale;
GLfloat s1scale;
GLfloat t0scale;
GLfloat t1scale;
GLfloat inv_s0scale;
GLfloat inv_s1scale;
GLfloat inv_t0scale;
GLfloat inv_t1scale;
tfxStats stats;
tfxStats stats;
void *state;
void *state;
/* Options */
/* Options */
GLboolean verbose;
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
GLboolean haveAlphaBuffer;
GLboolean haveZBuffer;
GLboolean haveDoubleBuffer;
GLboolean haveGlobalPaletteTexture;
GLint swapInterval;
GLint maxPendingSwapBuffers;
GLboolean verbose;
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
GLboolean haveAlphaBuffer;
GLboolean haveZBuffer;
GLboolean haveDoubleBuffer;
GLboolean haveGlobalPaletteTexture;
GLint swapInterval;
GLint maxPendingSwapBuffers;
FX_GrContext_t glideContext;
FX_GrContext_t glideContext;
int screen_width;
int screen_height;
int initDone;
int clipMinX;
int clipMaxX;
int clipMinY;
int clipMaxY;
int screen_width;
int screen_height;
int initDone;
int clipMinX;
int clipMaxX;
int clipMinY;
int clipMaxY;
/* fxvtxfmt
*/
GLboolean allow_vfmt;
GLvertexformat vtxfmt;
fxClipVertex current;
fxClipVertex verts[4];
fxClipVertex *vert; /* points into verts[] */
void (*fire_on_vertex)( GLcontext * );
void (*fire_on_end)( GLcontext * );
void (*fire_on_fallback)( GLcontext * );
vfmt_project_func project_vertex;
vfmt_interpolate_func interpolate_vertices;
int vtxfmt_fallback_count;
int vtxfmt_installed;
void (*old_begin)( GLenum );
GLenum prim;
GLuint accel_light;
GLfloat basecolor[4];
};
typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
@ -594,4 +622,7 @@ extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
GLint where);
extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
extern void fxDDCheckVtxfmt( GLcontext *ctx );
extern void fx_update_lighting( GLcontext *ctx );
#endif

View File

@ -436,6 +436,7 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
* Need this to provide at least one external definition.
*/
extern int gl_fx_dummy_function_glidew(void);
int gl_fx_dummy_function_glidew(void)
{
return 0;

View File

@ -69,7 +69,7 @@ static void fxSetupBlend(GLcontext *ctx);
static void fxSetupDepthTest(GLcontext *ctx);
static void fxSetupScissor(GLcontext *ctx);
static void fxSetupCull(GLcontext *ctx);
static void gl_print_fx_state_flags( const char *msg, GLuint flags);
static void fx_print_state_flags( const char *msg, GLuint flags);
/*static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint);*/
static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint );
@ -1181,7 +1181,6 @@ void fxDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
us->blendSrcFuncRGB=sfact;
us->blendSrcFuncAlpha=asfact;
fxMesa->new_state |= FX_NEW_BLEND;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
switch(dfactor) {
@ -1235,7 +1234,6 @@ void fxDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
us->blendDstFuncRGB=dfact;
us->blendDstFuncAlpha=adfact;
fxMesa->new_state |= FX_NEW_BLEND;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
}
@ -1296,13 +1294,11 @@ void fxDDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref)
if(newfunc!=us->alphaTestFunc) {
us->alphaTestFunc=newfunc;
fxMesa->new_state |= FX_NEW_ALPHA;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
if(ctx->Color.AlphaRef!=us->alphaTestRefValue) {
us->alphaTestRefValue=ctx->Color.AlphaRef;
fxMesa->new_state |= FX_NEW_ALPHA;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
}
@ -1363,7 +1359,6 @@ void fxDDDepthFunc(GLcontext *ctx, GLenum func)
if(dfunc!=us->depthTestFunc) {
us->depthTestFunc=dfunc;
fxMesa->new_state |= FX_NEW_DEPTH;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
}
@ -1376,7 +1371,6 @@ void fxDDDepthMask(GLcontext *ctx, GLboolean flag)
if(flag!=us->depthMask) {
us->depthMask=flag;
fxMesa->new_state |= FX_NEW_DEPTH;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
}
@ -1405,7 +1399,6 @@ void fxDDColorMask(GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
fxMesa->new_state |= FX_NEW_COLOR_MASK;
ctx->Driver.RenderStart = fxSetupFXUnits;
(void) r; (void) g; (void) b; (void) a;
}
@ -1482,7 +1475,6 @@ static void fxSetupFog(GLcontext *ctx)
void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
{
FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
ctx->Driver.RenderStart = fxSetupFXUnits; /* XXX why is this here? */
}
/************************************************************************/
@ -1528,7 +1520,6 @@ static void fxSetupScissor(GLcontext *ctx)
void fxDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
{
FX_CONTEXT(ctx)->new_state |= FX_NEW_SCISSOR;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
/************************************************************************/
@ -1540,14 +1531,12 @@ void fxDDCullFace(GLcontext *ctx, GLenum mode)
{
(void) mode;
FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
void fxDDFrontFace(GLcontext *ctx, GLenum mode)
{
(void) mode;
FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
@ -1597,21 +1586,18 @@ void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
if(state!=us->alphaTestEnabled) {
us->alphaTestEnabled=state;
fxMesa->new_state |= FX_NEW_ALPHA;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
break;
case GL_BLEND:
if(state!=us->blendEnabled) {
us->blendEnabled=state;
fxMesa->new_state |= FX_NEW_BLEND;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
break;
case GL_DEPTH_TEST:
if(state!=us->depthTestEnabled) {
us->depthTestEnabled=state;
fxMesa->new_state |= FX_NEW_DEPTH;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
break;
case GL_DITHER:
@ -1623,18 +1609,15 @@ void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
case GL_SCISSOR_TEST:
fxMesa->new_state |= FX_NEW_SCISSOR;
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
fxDDTexUseGlbPalette(ctx, state);
break;
case GL_FOG:
fxMesa->new_state |= FX_NEW_FOG;
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
case GL_CULL_FACE:
fxMesa->new_state |= FX_NEW_CULL;
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
case GL_LINE_SMOOTH:
case GL_LINE_STIPPLE:
@ -1642,7 +1625,6 @@ void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_POLYGON_SMOOTH:
case GL_TEXTURE_2D:
fxMesa->new_state |= FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
default:
; /* XXX no-op? */
@ -1781,7 +1763,6 @@ static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass )
void fxDDShadeModel(GLcontext *ctx, GLenum mode)
{
FX_CONTEXT(ctx)->new_state |= FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
}
@ -1789,7 +1770,7 @@ void fxDDShadeModel(GLcontext *ctx, GLenum mode)
/************************************************************************/
/****************************** Units SetUp *****************************/
/************************************************************************/
static void gl_print_fx_state_flags( const char *msg, GLuint flags )
static void fx_print_state_flags( const char *msg, GLuint flags )
{
fprintf(stderr,
"%s: (0x%x) %s%s%s%s%s%s%s\n",
@ -1810,7 +1791,7 @@ void fxSetupFXUnits( GLcontext *ctx )
GLuint newstate = fxMesa->new_state;
if (MESA_VERBOSE&VERBOSE_DRIVER)
gl_print_fx_state_flags("fxmesa: fxSetupFXUnits", newstate);
fx_print_state_flags("fxmesa: fxSetupFXUnits", newstate);
if (newstate) {
if (newstate & FX_NEW_TEXTURING)
@ -1834,10 +1815,8 @@ void fxSetupFXUnits( GLcontext *ctx )
if (newstate & FX_NEW_COLOR_MASK)
fxSetupColorMask(ctx);
if (newstate & FX_NEW_CULL) {
if (newstate & FX_NEW_CULL)
fxSetupCull(ctx);
}
fxMesa->draw_point = fxMesa->initial_point;
fxMesa->draw_line = fxMesa->initial_line;
@ -1855,6 +1834,7 @@ void fxSetupFXUnits( GLcontext *ctx )
* Need this to provide at least one external definition.
*/
extern int gl_fx_dummy_function_setup(void);
int gl_fx_dummy_function_setup(void)
{
return 0;

View File

@ -738,6 +738,7 @@ fxTMRestoreTextures_NoLock(fxMesaContext ctx) {
* Need this to provide at least one external definition.
*/
extern int gl_fx_dummy_function_texman(void);
int gl_fx_dummy_function_texman(void)
{
return 0;

View File

@ -1,4 +1,4 @@
/* $Id: xm_tri.c,v 1.12 2000/11/22 07:32:18 joukj Exp $ */
/* $Id: xm_tri.c,v 1.13 2000/11/24 10:25:09 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -1410,8 +1410,8 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx,
#ifdef DEBUG
static void
_xmesa_print_triangle_func( swrast_tri_func triFunc )
extern void _xmesa_print_triangle_func( swrast_tri_func triFunc );
void _xmesa_print_triangle_func( swrast_tri_func triFunc )
{
printf("XMesa tri func = ");
if (triFunc ==smooth_TRUECOLOR_z_triangle)

View File

@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.33 2000/11/16 21:05:34 keithw Exp $
# $Id: Makefile.X11,v 1.34 2000/11/24 10:25:05 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@ -21,6 +21,7 @@ LIBDIR = ../lib
CORE_SOURCES = \
tnl/t_vtxfmt.c \
tnl/t_bbox.c \
tnl/t_clip.c \
tnl/t_context.c \
@ -31,7 +32,6 @@ CORE_SOURCES = \
tnl/t_fog.c \
tnl/t_light.c \
tnl/t_pipeline.c \
tnl/t_rect.c \
tnl/t_shade.c \
tnl/t_stages.c \
tnl/t_texture.c \
@ -39,10 +39,11 @@ CORE_SOURCES = \
tnl/t_varray.c \
tnl/t_vb.c \
tnl/t_vbcull.c \
tnl/t_vbfill.c \
tnl/t_vbindirect.c \
tnl/t_vbrender.c \
tnl/t_vbxform.c \
api_loopback.c \
api_noop.c \
accum.c \
alpha.c \
attrib.c \
@ -90,7 +91,6 @@ CORE_SOURCES = \
polygon.c \
rastpos.c \
readpix.c \
rect.c \
scissor.c \
state.c \
stencil.c \
@ -100,6 +100,7 @@ CORE_SOURCES = \
texture.c \
texutil.c \
varray.c \
vtxfmt.c \
winpos.c \
X86/x86.c \
X86/common_x86.c \
@ -147,6 +148,8 @@ CORE_SOURCES = \
DRIVER_SOURCES = \
FX/fxvtxfmt.c \
FX/fxvtxprims.c \
FX/fxapi.c \
FX/fxdd.c \
FX/fxddspan.c \

View File

@ -1,4 +1,4 @@
/* $Id: clip.c,v 1.16 2000/11/22 07:32:16 joukj Exp $ */
/* $Id: clip.c,v 1.17 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -78,7 +78,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
* whenever the projection matrix changes.
*/
if (ctx->ModelView.flags & MAT_DIRTY)
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
gl_transform_vector( ctx->Transform.EyeUserPlane[p], equation,
ctx->ModelView.inv );
@ -90,7 +90,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
*/
if (ctx->Transform.ClipEnabled[p]) {
if (ctx->ProjectionMatrix.flags & MAT_DIRTY)
_math_matrix_analyze( &ctx->ProjectionMatrix );
_math_matrix_analyse( &ctx->ProjectionMatrix );
gl_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p],
@ -98,6 +98,9 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
}
ctx->NewState |= _NEW_TRANSFORM;
if (ctx->Driver.ClipPlane)
ctx->Driver.ClipPlane( ctx, plane, equation );
}

View File

@ -1,4 +1,4 @@
/* $Id: colormac.h,v 1.3 2000/11/16 21:05:34 keithw Exp $ */
/* $Id: colormac.h,v 1.4 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -38,7 +38,7 @@
#include "config.h"
#include "macros.h"
#include "mmath.h"
/* Do not reference types.h from this file.
/* Do not reference mtypes.h from this file.
*/

View File

@ -1,4 +1,4 @@
/* $Id: context.c,v 1.108 2000/11/22 07:32:16 joukj Exp $ */
/* $Id: context.c,v 1.109 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -690,70 +690,6 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
}
static void
init_fallback_arrays( GLcontext *ctx )
{
struct gl_client_array *cl;
GLuint i;
cl = &ctx->Fallback.Normal;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Normal;
cl->Enabled = 1;
cl = &ctx->Fallback.Color;
cl->Size = 4;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Color;
cl->Enabled = 1;
cl = &ctx->Fallback.SecondaryColor;
cl->Size = 3;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.SecondaryColor;
cl->Enabled = 1;
cl = &ctx->Fallback.FogCoord;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.FogCoord;
cl->Enabled = 1;
cl = &ctx->Fallback.Index;
cl->Size = 1;
cl->Type = GL_UNSIGNED_INT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.Index;
cl->Enabled = 1;
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) {
cl = &ctx->Fallback.TexCoord[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Texcoord[i];
cl->Enabled = 1;
}
cl = &ctx->Fallback.EdgeFlag;
cl->Size = 1;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.EdgeFlag;
cl->Enabled = 1;
}
/* Initialize a 1-D evaluator map */
@ -908,7 +844,6 @@ init_attrib_groups( GLcontext *ctx )
ctx->Current.EdgeFlag = GL_TRUE;
ASSIGN_3V( ctx->Current.Normal, 0.0, 0.0, 1.0 );
init_fallback_arrays( ctx );
/* Depth buffer group */
ctx->Depth.Test = GL_FALSE;
@ -1525,6 +1460,9 @@ _mesa_initialize_context( GLcontext *ctx,
_mesa_init_dlist_table(ctx->Save, dispatchSize);
ctx->CurrentDispatch = ctx->Exec;
ctx->ExecPrefersFloat = GL_FALSE;
ctx->SavePrefersFloat = GL_FALSE;
#if defined(MESA_TRACE)
ctx->TraceCtx = CALLOC( sizeof(trace_context_t) );
#if 0

View File

@ -1,4 +1,4 @@
/* $Id: dd.h,v 1.42 2000/11/16 21:05:34 keithw Exp $ */
/* $Id: dd.h,v 1.43 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -29,7 +29,7 @@
#ifndef DD_INCLUDED
#define DD_INCLUDED
/* THIS FILE ONLY INCLUDED BY types.h !!!!! */
/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
struct gl_pixelstore_attrib;
@ -872,6 +872,12 @@ struct dd_function_table {
*/
void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
void (*UnlockArraysEXT)( GLcontext *ctx );
/*
*/
/*
* State-changing functions (drawing functions are above)
*
@ -888,9 +894,11 @@ struct dd_function_table {
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA );
void (*ClearDepth)(GLcontext *ctx, GLclampd d);
void (*ClearStencil)(GLcontext *ctx, GLint s);
void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask );
void (*CullFace)(GLcontext *ctx, GLenum mode);
void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
void (*FrontFace)(GLcontext *ctx, GLenum mode);
void (*DepthFunc)(GLcontext *ctx, GLenum func);
void (*DepthMask)(GLcontext *ctx, GLboolean flag);
@ -909,10 +917,12 @@ struct dd_function_table {
void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
void (*ShadeModel)(GLcontext *ctx, GLenum mode);
void (*ClearStencil)(GLcontext *ctx, GLint s);
void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
void (*StencilMask)(GLcontext *ctx, GLuint mask);
void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
const GLfloat *params );
void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
/* State-query functions
@ -945,5 +955,114 @@ struct dd_function_table {
typedef struct {
void (*ArrayElement)( GLint ); /* NOTE */
void (*Color3f)( GLfloat, GLfloat, GLfloat );
void (*Color3fv)( const GLfloat * );
void (*Color3ub)( GLubyte, GLubyte, GLubyte );
void (*Color3ubv)( const GLubyte * );
void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (*Color4fv)( const GLfloat * );
void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
void (*Color4ubv)( const GLubyte * );
void (*EdgeFlag)( GLboolean );
void (*EdgeFlagv)( const GLboolean * );
void (*EvalCoord1f)( GLfloat ); /* NOTE */
void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
void (*EvalPoint1)( GLint ); /* NOTE */
void (*EvalPoint2)( GLint, GLint ); /* NOTE */
void (*FogCoordfEXT)( GLfloat );
void (*FogCoordfvEXT)( const GLfloat * );
void (*Indexi)( GLint );
void (*Indexiv)( const GLint * );
void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
void (*MultiTexCoord1fARB)( GLenum, GLfloat );
void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * );
void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * );
void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * );
void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * );
void (*Normal3f)( GLfloat, GLfloat, GLfloat );
void (*Normal3fv)( const GLfloat * );
void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
void (*SecondaryColor3fvEXT)( const GLfloat * );
void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
void (*SecondaryColor3ubvEXT)( const GLubyte * );
void (*TexCoord1f)( GLfloat );
void (*TexCoord1fv)( const GLfloat * );
void (*TexCoord2f)( GLfloat, GLfloat );
void (*TexCoord2fv)( const GLfloat * );
void (*TexCoord3f)( GLfloat, GLfloat, GLfloat );
void (*TexCoord3fv)( const GLfloat * );
void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (*TexCoord4fv)( const GLfloat * );
void (*Vertex2f)( GLfloat, GLfloat );
void (*Vertex2fv)( const GLfloat * );
void (*Vertex3f)( GLfloat, GLfloat, GLfloat );
void (*Vertex3fv)( const GLfloat * );
void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (*Vertex4fv)( const GLfloat * );
void (*CallList)( GLuint ); /* NOTE */
void (*Begin)( GLenum );
void (*End)( void );
/* Drivers present a reduced set of the functions possible in
* begin/end objects. Core mesa provides translation stubs for the
* remaining functions to map down to these entrypoints.
*
* These are the initial values to be installed into dispatch by
* mesa. If the t&l driver wants to modify the dispatch table
* while installed, it must do so itself. It would be possible for
* the vertexformat to install it's own initial values for these
* functions, but this way there is an obvious list of what is
* expected of the driver.
*
* If the driver wants to hook in entrypoints other than those
* listed above, it must restore them to their original values in
* the disable() callback, below.
*/
void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
/*
*/
void (*DrawArrays)( GLenum mode, GLint start, GLsizei count );
void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices );
void (*DrawRangeElements)(GLenum mode, GLuint start,
GLuint end, GLsizei count,
GLenum type, const GLvoid *indices);
/* These may or may not belong here. Heuristic: If an array is
* enabled, the installed vertex format should support that array and
* it's current size natively.
*/
void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
/* If you don't support eval, fallback to the default vertex format
* on receiving an eval call and use the pipeline mechanism to
* provide partial t&l acceleration.
*
* Mesa will provide a set of helper functions to do eval within
* accelerated vertex formats, eventually...
*/
GLboolean prefer_float_colors;
/* Should core send non-standard colors to glColor4f or glColor4ub
*/
} GLvertexformat;
#endif

View File

@ -1,4 +1,4 @@
/* $Id: dlist.c,v 1.52 2000/11/22 07:32:16 joukj Exp $ */
/* $Id: dlist.c,v 1.53 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -30,6 +30,7 @@
#else
#include "glheader.h"
#include "accum.h"
#include "api_loopback.h"
#include "attrib.h"
#include "bitmap.h"
#include "blend.h"
@ -62,7 +63,6 @@
#include "points.h"
#include "polygon.h"
#include "readpix.h"
#include "rect.h"
#include "state.h"
#include "texobj.h"
#include "teximage.h"
@ -73,9 +73,6 @@
#include "math/m_matrix.h"
#include "math/m_xform.h"
#include "tnl/t_vbfill.h"
#include "tnl/t_eval.h"
#include "tnl/t_varray.h"
#endif
@ -216,7 +213,6 @@ typedef enum {
OPCODE_PUSH_MATRIX,
OPCODE_PUSH_NAME,
OPCODE_RASTER_POS,
OPCODE_RECTF,
OPCODE_READ_BUFFER,
OPCODE_RESET_HISTOGRAM,
OPCODE_RESET_MIN_MAX,
@ -605,7 +601,6 @@ void gl_init_lists( void )
InstSize[OPCODE_PUSH_MATRIX] = 1;
InstSize[OPCODE_PUSH_NAME] = 2;
InstSize[OPCODE_RASTER_POS] = 5;
InstSize[OPCODE_RECTF] = 5;
InstSize[OPCODE_READ_BUFFER] = 2;
InstSize[OPCODE_RESET_HISTOGRAM] = 2;
InstSize[OPCODE_RESET_MIN_MAX] = 2;
@ -2852,59 +2847,6 @@ static void save_ReadBuffer( GLenum mode )
}
static void save_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
n = ALLOC_INSTRUCTION( ctx, OPCODE_RECTF, 4 );
if (n) {
n[1].f = x1;
n[2].f = y1;
n[3].f = x2;
n[4].f = y2;
}
if (ctx->ExecuteFlag) {
(*ctx->Exec->Rectf)( x1, y1, x2, y2 );
}
}
static void save_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
{
save_Rectf(x1, y1, x2, y2);
}
static void save_Rectdv(const GLdouble *v1, const GLdouble *v2)
{
save_Rectf(v1[0], v1[1], v2[0], v2[1]);
}
static void save_Rectfv( const GLfloat *v1, const GLfloat *v2 )
{
save_Rectf(v1[0], v1[1], v2[0], v2[1]);
}
static void save_Recti(GLint x1, GLint y1, GLint x2, GLint y2)
{
save_Rectf(x1, y1, x2, y2);
}
static void save_Rectiv(const GLint *v1, const GLint *v2)
{
save_Rectf(v1[0], v1[1], v2[0], v2[1]);
}
static void save_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
{
save_Rectf(x1, y1, x2, y2);
}
static void save_Rectsv(const GLshort *v1, const GLshort *v2)
{
save_Rectf(v1[0], v1[1], v2[0], v2[1]);
}
static void
save_ResetHistogram(GLenum target)
{
@ -4481,10 +4423,6 @@ static void execute_list( GLcontext *ctx, GLuint list )
case OPCODE_READ_BUFFER:
(*ctx->Exec->ReadBuffer)( n[1].e );
break;
case OPCODE_RECTF:
(*ctx->Exec->Rectf)( n[1].f, n[2].f, n[3].f, n[4].f );
FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
break;
case OPCODE_RESET_HISTOGRAM:
(*ctx->Exec->ResetHistogram)( n[1].e );
break;
@ -4824,7 +4762,9 @@ _mesa_NewList( GLuint list, GLenum mode )
/*
* End definition of current display list.
* End definition of current display list. Is the current
* ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
* we are outside begin/end calls?
*/
void
_mesa_EndList( void )
@ -4952,16 +4892,21 @@ _mesa_ListBase( GLuint base )
/*
* Assign all the pointers in <table> to point to Mesa's display list
* building functions.
*
* This does not include any of the tnl functions - they are
* initialized from _mesa_init_api_defaults and from the active vtxfmt
* struct.
*/
void
_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
{
_mesa_init_no_op_table(table, tableSize);
_mesa_loopback_init_api_table( table, GL_FALSE );
/* GL 1.0 */
table->Accum = save_Accum;
table->AlphaFunc = save_AlphaFunc;
table->Begin = _mesa_Begin;
table->Bitmap = save_Bitmap;
table->BlendFunc = save_BlendFunc;
table->CallList = save_CallList;
@ -4973,38 +4918,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->ClearIndex = save_ClearIndex;
table->ClearStencil = save_ClearStencil;
table->ClipPlane = save_ClipPlane;
table->Color3b = _mesa_Color3b;
table->Color3bv = _mesa_Color3bv;
table->Color3d = _mesa_Color3d;
table->Color3dv = _mesa_Color3dv;
table->Color3f = _mesa_Color3f;
table->Color3fv = _mesa_Color3fv;
table->Color3i = _mesa_Color3i;
table->Color3iv = _mesa_Color3iv;
table->Color3s = _mesa_Color3s;
table->Color3sv = _mesa_Color3sv;
table->Color3ub = _mesa_Color3ub;
table->Color3ubv = _mesa_Color3ubv;
table->Color3ui = _mesa_Color3ui;
table->Color3uiv = _mesa_Color3uiv;
table->Color3us = _mesa_Color3us;
table->Color3usv = _mesa_Color3usv;
table->Color4b = _mesa_Color4b;
table->Color4bv = _mesa_Color4bv;
table->Color4d = _mesa_Color4d;
table->Color4dv = _mesa_Color4dv;
table->Color4f = _mesa_Color4f;
table->Color4fv = _mesa_Color4fv;
table->Color4i = _mesa_Color4i;
table->Color4iv = _mesa_Color4iv;
table->Color4s = _mesa_Color4s;
table->Color4sv = _mesa_Color4sv;
table->Color4ub = _mesa_Color4ub;
table->Color4ubv = _mesa_Color4ubv;
table->Color4ui = _mesa_Color4ui;
table->Color4uiv = _mesa_Color4uiv;
table->Color4us = _mesa_Color4us;
table->Color4usv = _mesa_Color4usv;
table->ColorMask = save_ColorMask;
table->ColorMaterial = save_ColorMaterial;
table->CopyPixels = save_CopyPixels;
@ -5016,30 +4929,12 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->Disable = save_Disable;
table->DrawBuffer = save_DrawBuffer;
table->DrawPixels = save_DrawPixels;
table->EdgeFlag = _mesa_EdgeFlag;
table->EdgeFlagv = _mesa_EdgeFlagv;
table->Enable = save_Enable;
table->End = _mesa_End;
table->EndList = _mesa_EndList;
table->EvalCoord1d = _mesa_EvalCoord1d;
table->EvalCoord1dv = _mesa_EvalCoord1dv;
table->EvalCoord1f = _mesa_EvalCoord1f;
table->EvalCoord1fv = _mesa_EvalCoord1fv;
table->EvalCoord2d = _mesa_EvalCoord2d;
table->EvalCoord2dv = _mesa_EvalCoord2dv;
table->EvalCoord2f = _mesa_EvalCoord2f;
table->EvalCoord2fv = _mesa_EvalCoord2fv;
table->EvalMesh1 = save_EvalMesh1;
table->EvalMesh2 = save_EvalMesh2;
table->EvalPoint1 = _mesa_EvalPoint1;
table->EvalPoint2 = _mesa_EvalPoint2;
table->FeedbackBuffer = _mesa_FeedbackBuffer;
table->Finish = _mesa_Finish;
table->Flush = _mesa_Flush;
table->FogCoordfEXT = _mesa_FogCoordfEXT;
table->FogCoordfvEXT = _mesa_FogCoordfvEXT;
table->FogCoorddEXT = _mesa_FogCoorddEXT;
table->FogCoorddvEXT = _mesa_FogCoorddvEXT;
table->Fogf = save_Fogf;
table->Fogfv = save_Fogfv;
table->Fogi = save_Fogi;
@ -5077,14 +4972,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->GetTexParameteriv = _mesa_GetTexParameteriv;
table->Hint = save_Hint;
table->IndexMask = save_IndexMask;
table->Indexd = _mesa_Indexd;
table->Indexdv = _mesa_Indexdv;
table->Indexf = _mesa_Indexf;
table->Indexfv = _mesa_Indexfv;
table->Indexi = _mesa_Indexi;
table->Indexiv = _mesa_Indexiv;
table->Indexs = _mesa_Indexs;
table->Indexsv = _mesa_Indexsv;
table->InitNames = save_InitNames;
table->IsEnabled = _mesa_IsEnabled;
table->IsList = _mesa_IsList;
@ -5112,24 +4999,10 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->MapGrid1f = save_MapGrid1f;
table->MapGrid2d = save_MapGrid2d;
table->MapGrid2f = save_MapGrid2f;
table->Materialf = _mesa_Materialf;
table->Materialfv = _mesa_Materialfv;
table->Materiali = _mesa_Materiali;
table->Materialiv = _mesa_Materialiv;
table->MatrixMode = save_MatrixMode;
table->MultMatrixd = save_MultMatrixd;
table->MultMatrixf = save_MultMatrixf;
table->NewList = save_NewList;
table->Normal3b = _mesa_Normal3b;
table->Normal3bv = _mesa_Normal3bv;
table->Normal3d = _mesa_Normal3d;
table->Normal3dv = _mesa_Normal3dv;
table->Normal3f = _mesa_Normal3f;
table->Normal3fv = _mesa_Normal3fv;
table->Normal3i = _mesa_Normal3i;
table->Normal3iv = _mesa_Normal3iv;
table->Normal3s = _mesa_Normal3s;
table->Normal3sv = _mesa_Normal3sv;
table->Ortho = save_Ortho;
table->PassThrough = save_PassThrough;
table->PixelMapfv = save_PixelMapfv;
@ -5176,74 +5049,18 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->RasterPos4sv = save_RasterPos4sv;
table->ReadBuffer = save_ReadBuffer;
table->ReadPixels = _mesa_ReadPixels;
table->Rectd = save_Rectd;
table->Rectdv = save_Rectdv;
table->Rectf = save_Rectf;
table->Rectfv = save_Rectfv;
table->Recti = save_Recti;
table->Rectiv = save_Rectiv;
table->Rects = save_Rects;
table->Rectsv = save_Rectsv;
table->RenderMode = _mesa_RenderMode;
table->Rotated = save_Rotated;
table->Rotatef = save_Rotatef;
table->Scaled = save_Scaled;
table->Scalef = save_Scalef;
table->Scissor = save_Scissor;
table->SecondaryColor3bEXT = _mesa_SecondaryColor3bEXT;
table->SecondaryColor3bvEXT = _mesa_SecondaryColor3bvEXT;
table->SecondaryColor3sEXT = _mesa_SecondaryColor3sEXT;
table->SecondaryColor3svEXT = _mesa_SecondaryColor3svEXT;
table->SecondaryColor3iEXT = _mesa_SecondaryColor3iEXT;
table->SecondaryColor3ivEXT = _mesa_SecondaryColor3ivEXT;
table->SecondaryColor3fEXT = _mesa_SecondaryColor3fEXT;
table->SecondaryColor3fvEXT = _mesa_SecondaryColor3fvEXT;
table->SecondaryColor3dEXT = _mesa_SecondaryColor3dEXT;
table->SecondaryColor3dvEXT = _mesa_SecondaryColor3dvEXT;
table->SecondaryColor3ubEXT = _mesa_SecondaryColor3ubEXT;
table->SecondaryColor3ubvEXT = _mesa_SecondaryColor3ubvEXT;
table->SecondaryColor3usEXT = _mesa_SecondaryColor3usEXT;
table->SecondaryColor3usvEXT = _mesa_SecondaryColor3usvEXT;
table->SecondaryColor3uiEXT = _mesa_SecondaryColor3uiEXT;
table->SecondaryColor3uivEXT = _mesa_SecondaryColor3uivEXT;
table->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
table->FeedbackBuffer = _mesa_FeedbackBuffer;
table->SelectBuffer = _mesa_SelectBuffer;
table->ShadeModel = save_ShadeModel;
table->StencilFunc = save_StencilFunc;
table->StencilMask = save_StencilMask;
table->StencilOp = save_StencilOp;
table->TexCoord1d = _mesa_TexCoord1d;
table->TexCoord1dv = _mesa_TexCoord1dv;
table->TexCoord1f = _mesa_TexCoord1f;
table->TexCoord1fv = _mesa_TexCoord1fv;
table->TexCoord1i = _mesa_TexCoord1i;
table->TexCoord1iv = _mesa_TexCoord1iv;
table->TexCoord1s = _mesa_TexCoord1s;
table->TexCoord1sv = _mesa_TexCoord1sv;
table->TexCoord2d = _mesa_TexCoord2d;
table->TexCoord2dv = _mesa_TexCoord2dv;
table->TexCoord2f = _mesa_TexCoord2f;
table->TexCoord2fv = _mesa_TexCoord2fv;
table->TexCoord2i = _mesa_TexCoord2i;
table->TexCoord2iv = _mesa_TexCoord2iv;
table->TexCoord2s = _mesa_TexCoord2s;
table->TexCoord2sv = _mesa_TexCoord2sv;
table->TexCoord3d = _mesa_TexCoord3d;
table->TexCoord3dv = _mesa_TexCoord3dv;
table->TexCoord3f = _mesa_TexCoord3f;
table->TexCoord3fv = _mesa_TexCoord3fv;
table->TexCoord3i = _mesa_TexCoord3i;
table->TexCoord3iv = _mesa_TexCoord3iv;
table->TexCoord3s = _mesa_TexCoord3s;
table->TexCoord3sv = _mesa_TexCoord3sv;
table->TexCoord4d = _mesa_TexCoord4d;
table->TexCoord4dv = _mesa_TexCoord4dv;
table->TexCoord4f = _mesa_TexCoord4f;
table->TexCoord4fv = _mesa_TexCoord4fv;
table->TexCoord4i = _mesa_TexCoord4i;
table->TexCoord4iv = _mesa_TexCoord4iv;
table->TexCoord4s = _mesa_TexCoord4s;
table->TexCoord4sv = _mesa_TexCoord4sv;
table->TexEnvf = save_TexEnvf;
table->TexEnvfv = save_TexEnvfv;
table->TexEnvi = save_TexEnvi;
@ -5262,35 +5079,10 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->TexParameteriv = save_TexParameteriv;
table->Translated = save_Translated;
table->Translatef = save_Translatef;
table->Vertex2d = _mesa_Vertex2d;
table->Vertex2dv = _mesa_Vertex2dv;
table->Vertex2f = _mesa_Vertex2f;
table->Vertex2fv = _mesa_Vertex2fv;
table->Vertex2i = _mesa_Vertex2i;
table->Vertex2iv = _mesa_Vertex2iv;
table->Vertex2s = _mesa_Vertex2s;
table->Vertex2sv = _mesa_Vertex2sv;
table->Vertex3d = _mesa_Vertex3d;
table->Vertex3dv = _mesa_Vertex3dv;
table->Vertex3f = _mesa_Vertex3f;
table->Vertex3fv = _mesa_Vertex3fv;
table->Vertex3i = _mesa_Vertex3i;
table->Vertex3iv = _mesa_Vertex3iv;
table->Vertex3s = _mesa_Vertex3s;
table->Vertex3sv = _mesa_Vertex3sv;
table->Vertex4d = _mesa_Vertex4d;
table->Vertex4dv = _mesa_Vertex4dv;
table->Vertex4f = _mesa_Vertex4f;
table->Vertex4fv = _mesa_Vertex4fv;
table->Vertex4i = _mesa_Vertex4i;
table->Vertex4iv = _mesa_Vertex4iv;
table->Vertex4s = _mesa_Vertex4s;
table->Vertex4sv = _mesa_Vertex4sv;
table->Viewport = save_Viewport;
/* GL 1.1 */
table->AreTexturesResident = _mesa_AreTexturesResident;
table->ArrayElement = _mesa_ArrayElement;
table->BindTexture = save_BindTexture;
table->ColorPointer = _mesa_ColorPointer;
table->CopyTexImage1D = save_CopyTexImage1D;
@ -5299,15 +5091,11 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->CopyTexSubImage2D = save_CopyTexSubImage2D;
table->DeleteTextures = _mesa_DeleteTextures;
table->DisableClientState = _mesa_DisableClientState;
table->DrawArrays = _mesa_DrawArrays;
table->DrawElements = _mesa_DrawElements;
table->EdgeFlagPointer = _mesa_EdgeFlagPointer;
table->EnableClientState = _mesa_EnableClientState;
table->GenTextures = _mesa_GenTextures;
table->GetPointerv = _mesa_GetPointerv;
table->IndexPointer = _mesa_IndexPointer;
table->Indexub = _mesa_Indexub;
table->Indexubv = _mesa_Indexubv;
table->InterleavedArrays = _mesa_InterleavedArrays;
table->IsTexture = _mesa_IsTexture;
table->NormalPointer = _mesa_NormalPointer;
@ -5321,7 +5109,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
/* GL 1.2 */
table->CopyTexSubImage3D = save_CopyTexSubImage3D;
table->DrawRangeElements = _mesa_DrawRangeElements;
table->TexImage3D = save_TexImage3D;
table->TexSubImage3D = save_TexSubImage3D;
@ -5424,38 +5211,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
/* GL_ARB_multitexture */
table->ActiveTextureARB = save_ActiveTextureARB;
table->ClientActiveTextureARB = save_ClientActiveTextureARB;
table->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB;
table->MultiTexCoord1dvARB = _mesa_MultiTexCoord1dvARB;
table->MultiTexCoord1fARB = _mesa_MultiTexCoord1fARB;
table->MultiTexCoord1fvARB = _mesa_MultiTexCoord1fvARB;
table->MultiTexCoord1iARB = _mesa_MultiTexCoord1iARB;
table->MultiTexCoord1ivARB = _mesa_MultiTexCoord1ivARB;
table->MultiTexCoord1sARB = _mesa_MultiTexCoord1sARB;
table->MultiTexCoord1svARB = _mesa_MultiTexCoord1svARB;
table->MultiTexCoord2dARB = _mesa_MultiTexCoord2dARB;
table->MultiTexCoord2dvARB = _mesa_MultiTexCoord2dvARB;
table->MultiTexCoord2fARB = _mesa_MultiTexCoord2fARB;
table->MultiTexCoord2fvARB = _mesa_MultiTexCoord2fvARB;
table->MultiTexCoord2iARB = _mesa_MultiTexCoord2iARB;
table->MultiTexCoord2ivARB = _mesa_MultiTexCoord2ivARB;
table->MultiTexCoord2sARB = _mesa_MultiTexCoord2sARB;
table->MultiTexCoord2svARB = _mesa_MultiTexCoord2svARB;
table->MultiTexCoord3dARB = _mesa_MultiTexCoord3dARB;
table->MultiTexCoord3dvARB = _mesa_MultiTexCoord3dvARB;
table->MultiTexCoord3fARB = _mesa_MultiTexCoord3fARB;
table->MultiTexCoord3fvARB = _mesa_MultiTexCoord3fvARB;
table->MultiTexCoord3iARB = _mesa_MultiTexCoord3iARB;
table->MultiTexCoord3ivARB = _mesa_MultiTexCoord3ivARB;
table->MultiTexCoord3sARB = _mesa_MultiTexCoord3sARB;
table->MultiTexCoord3svARB = _mesa_MultiTexCoord3svARB;
table->MultiTexCoord4dARB = _mesa_MultiTexCoord4dARB;
table->MultiTexCoord4dvARB = _mesa_MultiTexCoord4dvARB;
table->MultiTexCoord4fARB = _mesa_MultiTexCoord4fARB;
table->MultiTexCoord4fvARB = _mesa_MultiTexCoord4fvARB;
table->MultiTexCoord4iARB = _mesa_MultiTexCoord4iARB;
table->MultiTexCoord4ivARB = _mesa_MultiTexCoord4ivARB;
table->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB;
table->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB;
/* GL_EXT_blend_func_separate */
table->BlendFuncSeparateEXT = save_BlendFuncSeparateEXT;
@ -5503,6 +5258,12 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB;
table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB;
table->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB;
/* GL_EXT_secondary_color */
table->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
/* GL_EXT_fog_coord */
table->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
}
@ -5623,9 +5384,6 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list )
case OPCODE_RASTER_POS:
fprintf(f,"RasterPos %g %g %g %g\n", n[1].f, n[2].f,n[3].f,n[4].f);
break;
case OPCODE_RECTF:
fprintf( f, "Rectf %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f);
break;
case OPCODE_ROTATE:
fprintf(f,"Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f );
break;

View File

@ -1,4 +1,4 @@
/* $Id: enable.c,v 1.33 2000/11/22 07:32:16 joukj Exp $ */
/* $Id: enable.c,v 1.34 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -100,7 +100,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform._AnyClip++;
if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
_math_matrix_analyze( &ctx->ProjectionMatrix );
_math_matrix_analyse( &ctx->ProjectionMatrix );
}
/* This derived state also calculated in clip.c and

View File

@ -1,4 +1,4 @@
/* $Id: light.c,v 1.27 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: light.c,v 1.28 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -122,7 +122,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
case GL_SPOT_DIRECTION:
/* transform direction by inverse modelview */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
}
TRANSFORM_NORMAL( l->EyeDirection, params, ctx->ModelView.inv );
break;
@ -568,58 +568,48 @@ void gl_update_material( GLcontext *ctx,
if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) {
struct gl_material *mat = &ctx->Light.Material[0];
COPY_3V( ctx->Light._BaseColor[0], mat->Emission );
ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient );
ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient,
ctx->Light.Model.Ambient );
}
if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) {
struct gl_material *mat = &ctx->Light.Material[1];
COPY_3V( ctx->Light._BaseColor[1], mat->Emission );
ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient );
ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient,
ctx->Light.Model.Ambient );
}
/* update material diffuse values */
if (bitmask & FRONT_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
GLfloat tmp[4];
SUB_3V( tmp, src[0].Diffuse, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->_MatDiffuse[0], light->Diffuse, tmp );
}
COPY_4FV( mat->Diffuse, src[0].Diffuse );
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
}
FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[0], mat->Diffuse[3]);
}
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
GLfloat tmp[4];
SUB_3V( tmp, src[1].Diffuse, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->_MatDiffuse[1], light->Diffuse, tmp );
}
COPY_4FV( mat->Diffuse, src[1].Diffuse );
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
}
FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[1], mat->Diffuse[3]);
}
/* update material specular values */
if (bitmask & FRONT_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
GLfloat tmp[4];
SUB_3V( tmp, src[0].Specular, mat->Specular );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, tmp );
light->_IsMatSpecular[0] =
(LEN_SQUARED_3FV(light->_MatSpecular[0]) > 1e-16);
}
COPY_4FV( mat->Specular, src[0].Specular );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, mat->Specular);
}
}
if (bitmask & BACK_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
GLfloat tmp[4];
SUB_3V( tmp, src[1].Specular, mat->Specular );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, tmp );
light->_IsMatSpecular[1] =
(LEN_SQUARED_3FV(light->_MatSpecular[1]) > 1e-16);
}
COPY_4FV( mat->Specular, src[1].Specular );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, mat->Specular);
}
}
if (bitmask & FRONT_SHININESS_BIT) {
@ -733,49 +723,37 @@ void gl_update_color_material( GLcontext *ctx,
/* update light->_MatDiffuse = light's diffuse * material's diffuse */
if (bitmask & FRONT_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
GLfloat tmp[4];
SUB_3V( tmp, color, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->_MatDiffuse[0], light->Diffuse, tmp );
}
COPY_4FV( mat->Diffuse, color );
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
}
FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[0], mat->Diffuse[3]);
}
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
GLfloat tmp[4];
SUB_3V( tmp, color, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->_MatDiffuse[1], light->Diffuse, tmp );
}
COPY_4FV( mat->Diffuse, color );
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
}
FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[1], mat->Diffuse[3]);
}
/* update light->_MatSpecular = light's specular * material's specular */
if (bitmask & FRONT_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
GLfloat tmp[4];
SUB_3V( tmp, color, mat->Specular );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, tmp );
light->_IsMatSpecular[0] =
(LEN_SQUARED_3FV(light->_MatSpecular[0]) > 1e-16);
}
COPY_4FV( mat->Specular, color );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, mat->Specular);
}
}
if (bitmask & BACK_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
GLfloat tmp[4];
SUB_3V( tmp, color, mat->Specular );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, tmp );
light->_IsMatSpecular[1] =
(LEN_SQUARED_3FV(light->_MatSpecular[1]) > 1e-16);
}
COPY_4FV( mat->Specular, color );
foreach (light, list) {
ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, mat->Specular);
}
}
if (0)
@ -839,51 +817,6 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
void
_mesa_Materialf( GLenum face, GLenum pname, GLfloat param )
{
_mesa_Materialfv( face, pname, &param );
}
void
_mesa_Materiali(GLenum face, GLenum pname, GLint param )
{
_mesa_Materialiv(face, pname, &param);
}
void
_mesa_Materialiv(GLenum face, GLenum pname, const GLint *params )
{
GLfloat fparam[4];
switch (pname) {
case GL_AMBIENT:
case GL_DIFFUSE:
case GL_SPECULAR:
case GL_EMISSION:
case GL_AMBIENT_AND_DIFFUSE:
fparam[0] = INT_TO_FLOAT( params[0] );
fparam[1] = INT_TO_FLOAT( params[1] );
fparam[2] = INT_TO_FLOAT( params[2] );
fparam[3] = INT_TO_FLOAT( params[3] );
break;
case GL_SHININESS:
fparam[0] = (GLfloat) params[0];
break;
case GL_COLOR_INDEXES:
fparam[0] = (GLfloat) params[0];
fparam[1] = (GLfloat) params[1];
fparam[2] = (GLfloat) params[2];
break;
default:
/* Error will be caught later in gl_Materialfv */
;
}
_mesa_Materialfv(face, pname, fparam);
}
void
_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
@ -1190,8 +1123,6 @@ gl_update_lighting( GLcontext *ctx )
SCALE_3V( light->_MatAmbient[side], light->Ambient, mat->Ambient );
SCALE_3V( light->_MatSpecular[side], light->Specular,
mat->Specular);
light->_IsMatSpecular[side] =
(LEN_SQUARED_3FV(light->_MatSpecular[side]) > 1e-16);
}
}
}

View File

@ -1,4 +1,4 @@
/* $Id: light.h,v 1.6 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: light.h,v 1.7 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -62,18 +62,6 @@ _mesa_LightModeli( GLenum pname, GLint param );
extern void
_mesa_LightModeliv( GLenum pname, const GLint *params );
extern void
_mesa_Materialf( GLenum face, GLenum pname, GLfloat param );
extern void
_mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params );
extern void
_mesa_Materiali( GLenum face, GLenum pname, GLint param );
extern void
_mesa_Materialiv( GLenum face, GLenum pname, const GLint *params );
extern void
_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params );

View File

@ -1,4 +1,4 @@
/* $Id: macros.h,v 1.14 2000/11/16 21:05:35 keithw Exp $ */
/* $Id: macros.h,v 1.15 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -35,7 +35,7 @@
#include "glheader.h"
/* Do not reference types.h from this file.
/* Do not reference mtypes.h from this file.
*/

View File

@ -1,4 +1,4 @@
/* $Id: matrix.c,v 1.27 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: matrix.c,v 1.28 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -57,10 +57,10 @@
/**********************************************************************/
#define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \
#define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \
do { \
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, where); \
if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, where); \
if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \
switch (ctx->Transform.MatrixMode) { \
case GL_MODELVIEW: \
mat = &ctx->ModelView; \

View File

@ -1,4 +1,4 @@
/* $Id: mtypes.h,v 1.1 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: mtypes.h,v 1.2 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -208,7 +208,6 @@ struct gl_light {
GLfloat _MatSpecular[2][3]; /* material spec * light specular */
GLfloat _dli; /* CI diffuse light intensity */
GLfloat _sli; /* CI specular light intensity */
GLboolean _IsMatSpecular[2];
};
@ -502,7 +501,6 @@ struct gl_light_attrib {
#define LIGHT_POSITIONAL 0x4
#define LIGHT_SPOT 0x10
#define LIGHT_LOCAL_VIEWER 0x20
#define LIGHT_TWO_SIDE 0x40
#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
@ -724,7 +722,6 @@ struct gl_stencil_attrib {
#define ENABLE_LIGHT 0x1000000
#define ENABLE_FOG 0x2000000
#define ENABLE_USERCLIP 0x4000000
#define ENABLE_VIEWCLIP 0x8000000
#define ENABLE_NORMALIZE 0x10000000
#define ENABLE_RESCALE 0x20000000
#define ENABLE_POINT_ATTEN 0x40000000
@ -976,23 +973,9 @@ struct gl_array_attrib {
GLuint LockFirst;
GLuint LockCount;
};
/* These are used to make the ctx->Current values look like
* arrays (with zero StrideB).
*/
struct gl_fallback_arrays {
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS];
struct gl_client_array EdgeFlag;
};
struct gl_feedback {
@ -1428,6 +1411,9 @@ struct __GLcontextRec {
struct _glapi_table *Save; /* Display list save funcs */
struct _glapi_table *Exec; /* Execute funcs */
struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */
GLboolean ExecPrefersFloat; /* What preference for color conversion? */
GLboolean SavePrefersFloat;
GLvisual Visual;
GLframebuffer *DrawBuffer; /* buffer for writing */
@ -1529,8 +1515,6 @@ struct __GLcontextRec {
struct gl_color_table PostColorMatrixColorTable;
struct gl_color_table ProxyPostColorMatrixColorTable;
struct gl_fallback_arrays Fallback;
GLenum ErrorValue; /* Last error code */
GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLuint NewState; /* bitwise-or of _NEW_* flags */

View File

@ -1,4 +1,4 @@
/* $Id: rastpos.c,v 1.15 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: rastpos.c,v 1.16 2000/11/24 10:25:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -168,7 +168,7 @@ static void gl_shade_rastpos( GLcontext *ctx,
ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[0]);
diffuse += n_dot_VP * light->_dli * attenuation;
if (light->_IsMatSpecular[0]) {
{
if (ctx->Light.Model.LocalViewer) {
GLfloat v[3];
COPY_3V(v, vertex);

View File

@ -1,4 +1,4 @@
/* $Id: state.c,v 1.47 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: state.c,v 1.48 2000/11/24 10:25:06 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -37,6 +37,7 @@
#include "glheader.h"
#include "accum.h"
#include "alpha.h"
#include "api_loopback.h"
#include "attrib.h"
#include "bitmap.h"
#include "blend.h"
@ -68,7 +69,6 @@
#include "polygon.h"
#include "rastpos.h"
#include "readpix.h"
#include "rect.h"
#include "scissor.h"
#include "state.h"
#include "stencil.h"
@ -83,10 +83,6 @@
#include "swrast/swrast.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"
#include "tnl/t_eval.h"
#include "tnl/t_vbfill.h"
#include "tnl/t_varray.h"
#include "tnl/t_rect.h"
#endif
@ -119,6 +115,9 @@ _mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
/*
* Initialize the given dispatch table with pointers to Mesa's
* immediate-mode commands.
*
* Pointers to begin/end object commands and a few others
* are provided via the vtxfmt interface elsewhere.
*/
void
_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
@ -126,10 +125,11 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
/* first initialize all dispatch slots to no-op */
_mesa_init_no_op_table(exec, tableSize);
_mesa_loopback_init_api_table( exec, GL_FALSE );
/* load the dispatch slots we understand */
exec->Accum = _mesa_Accum;
exec->AlphaFunc = _mesa_AlphaFunc;
exec->Begin = _mesa_Begin;
exec->Bitmap = _mesa_Bitmap;
exec->BlendFunc = _mesa_BlendFunc;
exec->CallList = _mesa_CallList;
@ -141,38 +141,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->ClearIndex = _mesa_ClearIndex;
exec->ClearStencil = _mesa_ClearStencil;
exec->ClipPlane = _mesa_ClipPlane;
exec->Color3b = _mesa_Color3b;
exec->Color3bv = _mesa_Color3bv;
exec->Color3d = _mesa_Color3d;
exec->Color3dv = _mesa_Color3dv;
exec->Color3f = _mesa_Color3f;
exec->Color3fv = _mesa_Color3fv;
exec->Color3i = _mesa_Color3i;
exec->Color3iv = _mesa_Color3iv;
exec->Color3s = _mesa_Color3s;
exec->Color3sv = _mesa_Color3sv;
exec->Color3ub = _mesa_Color3ub;
exec->Color3ubv = _mesa_Color3ubv;
exec->Color3ui = _mesa_Color3ui;
exec->Color3uiv = _mesa_Color3uiv;
exec->Color3us = _mesa_Color3us;
exec->Color3usv = _mesa_Color3usv;
exec->Color4b = _mesa_Color4b;
exec->Color4bv = _mesa_Color4bv;
exec->Color4d = _mesa_Color4d;
exec->Color4dv = _mesa_Color4dv;
exec->Color4f = _mesa_Color4f;
exec->Color4fv = _mesa_Color4fv;
exec->Color4i = _mesa_Color4i;
exec->Color4iv = _mesa_Color4iv;
exec->Color4s = _mesa_Color4s;
exec->Color4sv = _mesa_Color4sv;
exec->Color4ub = _mesa_Color4ub;
exec->Color4ubv = _mesa_Color4ubv;
exec->Color4ui = _mesa_Color4ui;
exec->Color4uiv = _mesa_Color4uiv;
exec->Color4us = _mesa_Color4us;
exec->Color4usv = _mesa_Color4usv;
exec->ColorMask = _mesa_ColorMask;
exec->ColorMaterial = _mesa_ColorMaterial;
exec->CopyPixels = _mesa_CopyPixels;
@ -184,33 +152,12 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->Disable = _mesa_Disable;
exec->DrawBuffer = _mesa_DrawBuffer;
exec->DrawPixels = _mesa_DrawPixels;
exec->EdgeFlag = _mesa_EdgeFlag;
exec->EdgeFlagv = _mesa_EdgeFlagv;
exec->Enable = _mesa_Enable;
exec->End = _mesa_End;
exec->EndList = _mesa_EndList;
exec->EvalCoord1d = _mesa_EvalCoord1d;
exec->EvalCoord1dv = _mesa_EvalCoord1dv;
exec->EvalCoord1f = _mesa_EvalCoord1f;
exec->EvalCoord1fv = _mesa_EvalCoord1fv;
exec->EvalCoord2d = _mesa_EvalCoord2d;
exec->EvalCoord2dv = _mesa_EvalCoord2dv;
exec->EvalCoord2f = _mesa_EvalCoord2f;
exec->EvalCoord2fv = _mesa_EvalCoord2fv;
exec->EvalMesh1 = _mesa_EvalMesh1;
exec->EvalMesh2 = _mesa_EvalMesh2;
exec->EvalPoint1 = _mesa_EvalPoint1;
exec->EvalPoint2 = _mesa_EvalPoint2;
exec->FeedbackBuffer = _mesa_FeedbackBuffer;
exec->Finish = _mesa_Finish;
exec->Flush = _mesa_Flush;
exec->FogCoordfEXT = _mesa_FogCoordfEXT;
exec->FogCoordfvEXT = _mesa_FogCoordfvEXT;
exec->FogCoorddEXT = _mesa_FogCoorddEXT;
exec->FogCoorddvEXT = _mesa_FogCoorddvEXT;
exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
exec->Fogf = _mesa_Fogf;
exec->Fogfv = _mesa_Fogfv;
exec->Fogi = _mesa_Fogi;
@ -248,14 +195,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->GetTexParameteriv = _mesa_GetTexParameteriv;
exec->Hint = _mesa_Hint;
exec->IndexMask = _mesa_IndexMask;
exec->Indexd = _mesa_Indexd;
exec->Indexdv = _mesa_Indexdv;
exec->Indexf = _mesa_Indexf;
exec->Indexfv = _mesa_Indexfv;
exec->Indexi = _mesa_Indexi;
exec->Indexiv = _mesa_Indexiv;
exec->Indexs = _mesa_Indexs;
exec->Indexsv = _mesa_Indexsv;
exec->InitNames = _mesa_InitNames;
exec->IsEnabled = _mesa_IsEnabled;
exec->IsList = _mesa_IsList;
@ -283,24 +222,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->MapGrid1f = _mesa_MapGrid1f;
exec->MapGrid2d = _mesa_MapGrid2d;
exec->MapGrid2f = _mesa_MapGrid2f;
exec->Materialf = _mesa_Materialf;
exec->Materialfv = _mesa_Materialfv;
exec->Materiali = _mesa_Materiali;
exec->Materialiv = _mesa_Materialiv;
exec->MatrixMode = _mesa_MatrixMode;
exec->MultMatrixd = _mesa_MultMatrixd;
exec->MultMatrixf = _mesa_MultMatrixf;
exec->NewList = _mesa_NewList;
exec->Normal3b = _mesa_Normal3b;
exec->Normal3bv = _mesa_Normal3bv;
exec->Normal3d = _mesa_Normal3d;
exec->Normal3dv = _mesa_Normal3dv;
exec->Normal3f = _mesa_Normal3f;
exec->Normal3fv = _mesa_Normal3fv;
exec->Normal3i = _mesa_Normal3i;
exec->Normal3iv = _mesa_Normal3iv;
exec->Normal3s = _mesa_Normal3s;
exec->Normal3sv = _mesa_Normal3sv;
exec->Ortho = _mesa_Ortho;
exec->PassThrough = _mesa_PassThrough;
exec->PixelMapfv = _mesa_PixelMapfv;
@ -347,74 +272,18 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->RasterPos4sv = _mesa_RasterPos4sv;
exec->ReadBuffer = _mesa_ReadBuffer;
exec->ReadPixels = _mesa_ReadPixels;
exec->Rectd = _mesa_Rectd;
exec->Rectdv = _mesa_Rectdv;
exec->Rectf = _mesa_Rectf;
exec->Rectfv = _mesa_Rectfv;
exec->Recti = _mesa_Recti;
exec->Rectiv = _mesa_Rectiv;
exec->Rects = _mesa_Rects;
exec->Rectsv = _mesa_Rectsv;
exec->RenderMode = _mesa_RenderMode;
exec->Rotated = _mesa_Rotated;
exec->Rotatef = _mesa_Rotatef;
exec->Scaled = _mesa_Scaled;
exec->Scalef = _mesa_Scalef;
exec->Scissor = _mesa_Scissor;
exec->SecondaryColor3bEXT = _mesa_SecondaryColor3bEXT;
exec->SecondaryColor3bvEXT = _mesa_SecondaryColor3bvEXT;
exec->SecondaryColor3sEXT = _mesa_SecondaryColor3sEXT;
exec->SecondaryColor3svEXT = _mesa_SecondaryColor3svEXT;
exec->SecondaryColor3iEXT = _mesa_SecondaryColor3iEXT;
exec->SecondaryColor3ivEXT = _mesa_SecondaryColor3ivEXT;
exec->SecondaryColor3fEXT = _mesa_SecondaryColor3fEXT;
exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3fvEXT;
exec->SecondaryColor3dEXT = _mesa_SecondaryColor3dEXT;
exec->SecondaryColor3dvEXT = _mesa_SecondaryColor3dvEXT;
exec->SecondaryColor3ubEXT = _mesa_SecondaryColor3ubEXT;
exec->SecondaryColor3ubvEXT = _mesa_SecondaryColor3ubvEXT;
exec->SecondaryColor3usEXT = _mesa_SecondaryColor3usEXT;
exec->SecondaryColor3usvEXT = _mesa_SecondaryColor3usvEXT;
exec->SecondaryColor3uiEXT = _mesa_SecondaryColor3uiEXT;
exec->SecondaryColor3uivEXT = _mesa_SecondaryColor3uivEXT;
exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
exec->SelectBuffer = _mesa_SelectBuffer;
exec->ShadeModel = _mesa_ShadeModel;
exec->StencilFunc = _mesa_StencilFunc;
exec->StencilMask = _mesa_StencilMask;
exec->StencilOp = _mesa_StencilOp;
exec->TexCoord1d = _mesa_TexCoord1d;
exec->TexCoord1dv = _mesa_TexCoord1dv;
exec->TexCoord1f = _mesa_TexCoord1f;
exec->TexCoord1fv = _mesa_TexCoord1fv;
exec->TexCoord1i = _mesa_TexCoord1i;
exec->TexCoord1iv = _mesa_TexCoord1iv;
exec->TexCoord1s = _mesa_TexCoord1s;
exec->TexCoord1sv = _mesa_TexCoord1sv;
exec->TexCoord2d = _mesa_TexCoord2d;
exec->TexCoord2dv = _mesa_TexCoord2dv;
exec->TexCoord2f = _mesa_TexCoord2f;
exec->TexCoord2fv = _mesa_TexCoord2fv;
exec->TexCoord2i = _mesa_TexCoord2i;
exec->TexCoord2iv = _mesa_TexCoord2iv;
exec->TexCoord2s = _mesa_TexCoord2s;
exec->TexCoord2sv = _mesa_TexCoord2sv;
exec->TexCoord3d = _mesa_TexCoord3d;
exec->TexCoord3dv = _mesa_TexCoord3dv;
exec->TexCoord3f = _mesa_TexCoord3f;
exec->TexCoord3fv = _mesa_TexCoord3fv;
exec->TexCoord3i = _mesa_TexCoord3i;
exec->TexCoord3iv = _mesa_TexCoord3iv;
exec->TexCoord3s = _mesa_TexCoord3s;
exec->TexCoord3sv = _mesa_TexCoord3sv;
exec->TexCoord4d = _mesa_TexCoord4d;
exec->TexCoord4dv = _mesa_TexCoord4dv;
exec->TexCoord4f = _mesa_TexCoord4f;
exec->TexCoord4fv = _mesa_TexCoord4fv;
exec->TexCoord4i = _mesa_TexCoord4i;
exec->TexCoord4iv = _mesa_TexCoord4iv;
exec->TexCoord4s = _mesa_TexCoord4s;
exec->TexCoord4sv = _mesa_TexCoord4sv;
exec->TexEnvf = _mesa_TexEnvf;
exec->TexEnvfv = _mesa_TexEnvfv;
exec->TexEnvi = _mesa_TexEnvi;
@ -433,35 +302,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->TexParameteriv = _mesa_TexParameteriv;
exec->Translated = _mesa_Translated;
exec->Translatef = _mesa_Translatef;
exec->Vertex2d = _mesa_Vertex2d;
exec->Vertex2dv = _mesa_Vertex2dv;
exec->Vertex2f = _mesa_Vertex2f;
exec->Vertex2fv = _mesa_Vertex2fv;
exec->Vertex2i = _mesa_Vertex2i;
exec->Vertex2iv = _mesa_Vertex2iv;
exec->Vertex2s = _mesa_Vertex2s;
exec->Vertex2sv = _mesa_Vertex2sv;
exec->Vertex3d = _mesa_Vertex3d;
exec->Vertex3dv = _mesa_Vertex3dv;
exec->Vertex3f = _mesa_Vertex3f;
exec->Vertex3fv = _mesa_Vertex3fv;
exec->Vertex3i = _mesa_Vertex3i;
exec->Vertex3iv = _mesa_Vertex3iv;
exec->Vertex3s = _mesa_Vertex3s;
exec->Vertex3sv = _mesa_Vertex3sv;
exec->Vertex4d = _mesa_Vertex4d;
exec->Vertex4dv = _mesa_Vertex4dv;
exec->Vertex4f = _mesa_Vertex4f;
exec->Vertex4fv = _mesa_Vertex4fv;
exec->Vertex4i = _mesa_Vertex4i;
exec->Vertex4iv = _mesa_Vertex4iv;
exec->Vertex4s = _mesa_Vertex4s;
exec->Vertex4sv = _mesa_Vertex4sv;
exec->Viewport = _mesa_Viewport;
/* 1.1 */
exec->AreTexturesResident = _mesa_AreTexturesResident;
exec->ArrayElement = _mesa_ArrayElement;
exec->BindTexture = _mesa_BindTexture;
exec->ColorPointer = _mesa_ColorPointer;
exec->CopyTexImage1D = _mesa_CopyTexImage1D;
@ -470,15 +314,11 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D;
exec->DeleteTextures = _mesa_DeleteTextures;
exec->DisableClientState = _mesa_DisableClientState;
exec->DrawArrays = _mesa_DrawArrays;
exec->DrawElements = _mesa_DrawElements;
exec->EdgeFlagPointer = _mesa_EdgeFlagPointer;
exec->EnableClientState = _mesa_EnableClientState;
exec->GenTextures = _mesa_GenTextures;
exec->GetPointerv = _mesa_GetPointerv;
exec->IndexPointer = _mesa_IndexPointer;
exec->Indexub = _mesa_Indexub;
exec->Indexubv = _mesa_Indexubv;
exec->InterleavedArrays = _mesa_InterleavedArrays;
exec->IsTexture = _mesa_IsTexture;
exec->NormalPointer = _mesa_NormalPointer;
@ -492,7 +332,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
/* 1.2 */
exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D;
exec->DrawRangeElements = _mesa_DrawRangeElements;
exec->TexImage3D = _mesa_TexImage3D;
exec->TexSubImage3D = _mesa_TexSubImage3D;
@ -634,38 +473,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
/* ARB 1. GL_ARB_multitexture */
exec->ActiveTextureARB = _mesa_ActiveTextureARB;
exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
exec->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB;
exec->MultiTexCoord1dvARB = _mesa_MultiTexCoord1dvARB;
exec->MultiTexCoord1fARB = _mesa_MultiTexCoord1fARB;
exec->MultiTexCoord1fvARB = _mesa_MultiTexCoord1fvARB;
exec->MultiTexCoord1iARB = _mesa_MultiTexCoord1iARB;
exec->MultiTexCoord1ivARB = _mesa_MultiTexCoord1ivARB;
exec->MultiTexCoord1sARB = _mesa_MultiTexCoord1sARB;
exec->MultiTexCoord1svARB = _mesa_MultiTexCoord1svARB;
exec->MultiTexCoord2dARB = _mesa_MultiTexCoord2dARB;
exec->MultiTexCoord2dvARB = _mesa_MultiTexCoord2dvARB;
exec->MultiTexCoord2fARB = _mesa_MultiTexCoord2fARB;
exec->MultiTexCoord2fvARB = _mesa_MultiTexCoord2fvARB;
exec->MultiTexCoord2iARB = _mesa_MultiTexCoord2iARB;
exec->MultiTexCoord2ivARB = _mesa_MultiTexCoord2ivARB;
exec->MultiTexCoord2sARB = _mesa_MultiTexCoord2sARB;
exec->MultiTexCoord2svARB = _mesa_MultiTexCoord2svARB;
exec->MultiTexCoord3dARB = _mesa_MultiTexCoord3dARB;
exec->MultiTexCoord3dvARB = _mesa_MultiTexCoord3dvARB;
exec->MultiTexCoord3fARB = _mesa_MultiTexCoord3fARB;
exec->MultiTexCoord3fvARB = _mesa_MultiTexCoord3fvARB;
exec->MultiTexCoord3iARB = _mesa_MultiTexCoord3iARB;
exec->MultiTexCoord3ivARB = _mesa_MultiTexCoord3ivARB;
exec->MultiTexCoord3sARB = _mesa_MultiTexCoord3sARB;
exec->MultiTexCoord3svARB = _mesa_MultiTexCoord3svARB;
exec->MultiTexCoord4dARB = _mesa_MultiTexCoord4dARB;
exec->MultiTexCoord4dvARB = _mesa_MultiTexCoord4dvARB;
exec->MultiTexCoord4fARB = _mesa_MultiTexCoord4fARB;
exec->MultiTexCoord4fvARB = _mesa_MultiTexCoord4fvARB;
exec->MultiTexCoord4iARB = _mesa_MultiTexCoord4iARB;
exec->MultiTexCoord4ivARB = _mesa_MultiTexCoord4ivARB;
exec->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB;
exec->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB;
/* ARB 3. GL_ARB_transpose_matrix */
exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB;
@ -733,7 +540,7 @@ calculate_model_project_matrix( GLcontext *ctx )
&ctx->ProjectionMatrix,
&ctx->ModelView );
_math_matrix_analyze( &ctx->_ModelProjectMatrix );
_math_matrix_analyse( &ctx->_ModelProjectMatrix );
}
}
@ -824,8 +631,8 @@ update_drawbuffer( GLcontext *ctx )
static void
update_projection( GLcontext *ctx )
{
_math_matrix_analyze( &ctx->ProjectionMatrix );
_math_matrix_analyse( &ctx->ProjectionMatrix );
/* Recompute clip plane positions in clipspace. This is also done
* in _mesa_ClipPlane().
*/
@ -921,7 +728,7 @@ void gl_update_state( GLcontext *ctx )
gl_print_state("", new_state);
if (new_state & _NEW_MODELVIEW)
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
if (new_state & _NEW_PROJECTION)
update_projection( ctx );
@ -930,7 +737,7 @@ void gl_update_state( GLcontext *ctx )
_mesa_update_texture_matrices( ctx );
if (new_state & _NEW_COLOR_MATRIX)
_math_matrix_analyze( &ctx->ColorMatrix );
_math_matrix_analyse( &ctx->ColorMatrix );
/* References ColorMatrix.type (derived above).
*/

View File

@ -1,4 +1,4 @@
/* $Id: texstate.c,v 1.24 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: texstate.c,v 1.25 2000/11/24 10:25:06 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -1116,7 +1116,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
else if (pname==GL_EYE_PLANE) {
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
}
gl_transform_vector( texUnit->EyePlaneS, params,
ctx->ModelView.inv );
@ -1164,7 +1164,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
else if (pname==GL_EYE_PLANE) {
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
}
gl_transform_vector( texUnit->EyePlaneT, params,
ctx->ModelView.inv );
@ -1208,7 +1208,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
else if (pname==GL_EYE_PLANE) {
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
}
gl_transform_vector( texUnit->EyePlaneR, params,
ctx->ModelView.inv );
@ -1244,7 +1244,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
else if (pname==GL_EYE_PLANE) {
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyze( &ctx->ModelView );
_math_matrix_analyse( &ctx->ModelView );
}
gl_transform_vector( texUnit->EyePlaneQ, params,
ctx->ModelView.inv );
@ -1258,6 +1258,9 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
return;
}
if (ctx->Driver.TexGen)
ctx->Driver.TexGen( ctx, coord, pname, params );
ctx->NewState |= _NEW_TEXTURE;
}

View File

@ -1,4 +1,4 @@
/* $Id: varray.c,v 1.32 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: varray.c,v 1.33 2000/11/24 10:25:06 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -692,3 +692,48 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
/* Transform the array components now, upto the setup call. When
* actual draw commands arrive, the data will be merged prior to
* calling render_vb.
*/
void
_mesa_LockArraysEXT(GLint first, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glLockArraysEXT" );
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glLockArrays %d %d\n", first, count);
if (first == 0 && count > 0 && count <= ctx->Const.MaxArrayLockSize) {
ctx->Array.LockFirst = first;
ctx->Array.LockCount = count;
}
else {
ctx->Array.LockFirst = 0;
ctx->Array.LockCount = 0;
}
ctx->NewState |= _NEW_ARRAY;
if (ctx->Driver.LockArraysEXT)
ctx->Driver.LockArraysEXT( ctx, first, count );
}
void
_mesa_UnlockArraysEXT( void )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glUnlockArraysEXT" );
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glUnlockArrays\n");
ctx->Array.LockFirst = 0;
ctx->Array.LockCount = 0;
ctx->NewState |= _NEW_ARRAY;
if (ctx->Driver.UnlockArraysEXT)
ctx->Driver.UnlockArraysEXT( ctx );
}

View File

@ -1,4 +1,4 @@
/* $Id: varray.h,v 1.10 2000/11/22 07:32:17 joukj Exp $ */
/* $Id: varray.h,v 1.11 2000/11/24 10:25:06 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -36,6 +36,12 @@ extern void
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr);
extern void
_mesa_UnlockArraysEXT( void );
extern void
_mesa_LockArraysEXT(GLint first, GLsizei count);
extern void
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);

View File

@ -1,4 +1,4 @@
/* $Id: m_matrix.c,v 1.3 2000/11/20 15:16:33 brianp Exp $ */
/* $Id: m_matrix.c,v 1.4 2000/11/24 10:25:11 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -739,7 +739,7 @@ _math_matrix_ortho( GLmatrix *mat,
/* Determine type and flags from scratch. This is expensive enough to
* only want to do it once.
*/
static void analyze_from_scratch( GLmatrix *mat )
static void analyse_from_scratch( GLmatrix *mat )
{
const GLfloat *m = mat->m;
GLuint mask = 0;
@ -851,7 +851,7 @@ static void analyze_from_scratch( GLmatrix *mat )
/* Analyse a matrix given that its flags are accurate - this is the
* more common operation, hopefully.
*/
static void analyze_from_flags( GLmatrix *mat )
static void analyse_from_flags( GLmatrix *mat )
{
const GLfloat *m = mat->m;
@ -891,13 +891,13 @@ static void analyze_from_flags( GLmatrix *mat )
void
_math_matrix_analyze( GLmatrix *mat )
_math_matrix_analyse( GLmatrix *mat )
{
if (mat->flags & MAT_DIRTY_TYPE) {
if (mat->flags & MAT_DIRTY_FLAGS)
analyze_from_scratch( mat );
analyse_from_scratch( mat );
else
analyze_from_flags( mat );
analyse_from_flags( mat );
}
if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) {

View File

@ -1,4 +1,4 @@
/* $Id: m_matrix.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
/* $Id: m_matrix.h,v 1.2 2000/11/24 10:25:11 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -151,7 +151,7 @@ extern void
_math_matrix_copy( GLmatrix *to, const GLmatrix *from );
extern void
_math_matrix_analyze( GLmatrix *mat );
_math_matrix_analyse( GLmatrix *mat );
extern void
_math_matrix_print( const GLmatrix *m );

View File

@ -1,4 +1,4 @@
/* $Id: m_xform.c,v 1.3 2000/11/18 08:10:24 jtaylor Exp $ */
/* $Id: m_xform.c,v 1.4 2000/11/24 10:25:11 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -173,7 +173,7 @@ void gl_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16]
/* Useful for one-off point transformations, as in clipping.
* Note that because the matrix isn't analyzed we do too many
* Note that because the matrix isn't analysed we do too many
* multiplies, and that the result is always 4-clean.
*/
void gl_transform_point_sz( GLfloat Q[4], const GLfloat M[16],

View File

@ -55,7 +55,7 @@ static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end)
/* TODO: Get import_client_data to pad vectors out to 4 cleanly.
*/
gl_import_client_data( VB, tnl->_RenderFlags,
_tnl_import_client_data( VB, tnl->_RenderFlags,
(VB->ClipOrMask
? /* VEC_CLEAN| */VEC_WRITABLE|VEC_GOOD_STRIDE
: /* VEC_CLEAN| */VEC_GOOD_STRIDE));

View File

@ -1,5 +1,6 @@
#include "mtypes.h"
#include "mem.h"
#include "vtxfmt.h"
#include "t_context.h"
#include "t_clip.h"
@ -15,10 +16,11 @@
#include "t_vb.h"
#include "t_vbrender.h"
#include "t_vbxform.h"
#include "t_vtxfmt.h"
#include "tnl.h"
#if !defined(THREADS)
struct immediate *_mesa_CurrentInput = NULL;
struct immediate *_tnl_CurrentInput = NULL;
#endif
@ -31,9 +33,9 @@ _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags )
if ((IM->Flag[IM->Count] & (VERT_BEGIN|VERT_END)) != VERT_END ||
(flush_flags & (FLUSH_STORED_VERTICES|FLUSH_UPDATE_CURRENT)))
{
if (IM->Flag[IM->Start])
_mesa_flush_vb( ctx );
if (IM->Flag[IM->Start])
_tnl_maybe_transform_vb( IM );
/* Although this code updates the ctx->Current values, that bit
* is left set as there is no easy mechanism to set it
* elsewhere. This means that each time core wants to examine
@ -50,71 +52,30 @@ _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags )
}
GLboolean
_tnl_CreateContext( GLcontext *ctx )
void
_tnl_MakeCurrent( GLcontext *ctx,
GLframebuffer *drawBuffer,
GLframebuffer *readBuffer )
{
TNLcontext *tnl;
static int firsttime = 1;
/* Onetime initializations. Doesn't really matter if this gets
* done twice: no need for mutexes.
*/
if (firsttime) {
firsttime = 0;
_tnl_clip_init( );
_tnl_eval_init( );
_tnl_shade_init( );
_tnl_texture_init( );
_tnl_trans_elt_init( );
_tnl_vbrender_init( );
_tnl_stages_init( );
}
/* Create the TNLcontext structure
*/
ctx->swtnl_context = tnl = CALLOC( sizeof(TNLcontext) );
if (!tnl) {
return GL_FALSE;
}
/* Create and hook in the data structures available from ctx.
*/
ctx->swtnl_vb = (void *)gl_vb_create_for_immediate( ctx );
if (!ctx->swtnl_vb) {
FREE(tnl);
ctx->swtnl_context = 0;
return GL_FALSE;
}
ctx->swtnl_im = (void *)TNL_VB(ctx)->IM;
#ifndef THREADS
SET_IMMEDIATE( ctx, TNL_VB(ctx)->IM );
#endif
}
/* Initialize tnl state.
*/
_tnl_dlist_init( ctx );
_tnl_pipeline_init( ctx );
tnl->_CurrentFlag = (VERT_NORM |
VERT_INDEX |
VERT_RGBA |
VERT_SPEC_RGB |
VERT_FOG_COORD |
VERT_EDGE |
VERT_TEX0_12 |
VERT_TEX1_12 |
VERT_TEX2_12 |
VERT_TEX3_12 |
VERT_MATERIAL);
tnl->_CurrentPrimitive = GL_POLYGON+1;
gl_reset_vb( TNL_VB(ctx) );
gl_reset_input( ctx );
/* Update all state that references _NeedEyeCoords
*/
void
_tnl_LightingSpaceChange( GLcontext *ctx )
{
_tnl_update_normal_transform( ctx );
}
/* Set a few default values in the driver struct. This is a
* temporary mechanism.
*/
static void
install_driver_callbacks( GLcontext *ctx )
{
ctx->Driver.RenderVBCulledTab = _tnl_render_tab_cull;
ctx->Driver.RenderVBClippedTab = _tnl_render_tab_clipped;
ctx->Driver.RenderVBRawTab = _tnl_render_tab_raw;
@ -132,6 +93,84 @@ _tnl_CreateContext( GLcontext *ctx )
ctx->Driver.SecondaryColorPointer = _tnl_SecondaryColorPointer;
ctx->Driver.TexCoordPointer = _tnl_TexCoordPointer;
ctx->Driver.EdgeFlagPointer = _tnl_EdgeFlagPointer;
ctx->Driver.LockArraysEXT = _tnl_LockArraysEXT;
ctx->Driver.UnlockArraysEXT = _tnl_UnlockArraysEXT;
}
GLboolean
_tnl_CreateContext( GLcontext *ctx )
{
TNLcontext *tnl;
static int firsttime = 1;
/* Onetime initializations. Doesn't really matter if this gets
* done twice: no need for mutexes.
*/
if (firsttime) {
firsttime = 0;
_tnl_clip_init();
_tnl_eval_init();
_tnl_shade_init();
_tnl_texture_init();
_tnl_trans_elt_init();
_tnl_vbrender_init();
_tnl_stages_init();
}
/* Create the TNLcontext structure
*/
ctx->swtnl_context = tnl = CALLOC( sizeof(TNLcontext) );
if (!tnl) {
return GL_FALSE;
}
/* Create and hook in the data structures available from ctx.
*/
ctx->swtnl_vb = (void *)_tnl_vb_create_for_immediate( ctx );
if (!ctx->swtnl_vb) {
FREE(tnl);
ctx->swtnl_context = 0;
return GL_FALSE;
}
ctx->swtnl_im = (void *)TNL_VB(ctx)->IM;
/* Initialize tnl state.
*/
_tnl_dlist_init( ctx );
_tnl_pipeline_init( ctx );
_tnl_vtxfmt_init( ctx );
_tnl_cva_init( ctx );
_tnl_reset_vb( TNL_VB(ctx) );
_tnl_reset_input( ctx, 0, 0 ); /* initially outside begin/end */
tnl->_CurrentFlag = (VERT_NORM |
VERT_INDEX |
VERT_RGBA |
VERT_SPEC_RGB |
VERT_FOG_COORD |
VERT_EDGE |
VERT_TEX0_12 |
VERT_TEX1_12 |
VERT_TEX2_12 |
VERT_TEX3_12 |
VERT_MATERIAL);
tnl->_CurrentPrimitive = GL_POLYGON+1;
/* Hook our functions into exec and compile dispatch tables.
*/
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
/* Set a few default values in the driver struct.
*/
install_driver_callbacks(ctx);
return GL_TRUE;
}
@ -143,9 +182,9 @@ _tnl_DestroyContext( GLcontext *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (TNL_CURRENT_IM(ctx) != TNL_VB(ctx)->IM)
gl_immediate_free( TNL_CURRENT_IM(ctx) );
_tnl_immediate_free( TNL_CURRENT_IM(ctx) );
gl_vb_free( TNL_VB(ctx) );
_tnl_vb_free( TNL_VB(ctx) );
/* Free cache of immediate buffers. */
while (tnl->nr_im_queued-- > 0) {
@ -156,23 +195,15 @@ _tnl_DestroyContext( GLcontext *ctx )
}
/* Update all state that references _NeedEyeCoords
*/
void
_tnl_LightingSpaceChange( GLcontext *ctx )
{
_tnl_update_normal_transform( ctx );
}
void
_tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
{
if (new_state & _NEW_LIGHT)
gl_update_lighting_function(ctx);
_tnl_update_lighting_function(ctx);
if (new_state & _NEW_ARRAY)
gl_update_client_state( ctx );
_tnl_update_client_state( ctx );
if (new_state & _NEW_TEXTURE)
if (ctx->_Enabled & ENABLE_TEXGEN_ANY)
@ -182,20 +213,54 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
_DD_NEW_TRI_LIGHT_TWOSIDE |
_DD_NEW_SEPERATE_SPECULAR |
_DD_NEW_TRI_UNFILLED ))
gl_update_clipmask(ctx);
_tnl_update_clipmask(ctx);
if (new_state & _TNL_NEW_NORMAL_TRANSFORM)
_tnl_update_normal_transform( ctx );
gl_update_pipelines(ctx);
_tnl_update_pipelines(ctx);
}
void
_tnl_MakeCurrent( GLcontext *ctx,
GLframebuffer *drawBuffer,
GLframebuffer *readBuffer )
_tnl_wakeup_exec( GLcontext *ctx )
{
#ifndef THREADS
SET_IMMEDIATE( ctx, TNL_VB(ctx)->IM );
#endif
TNLcontext *tnl = TNL_CONTEXT(ctx);
fprintf(stderr, "%s\n", __FUNCTION__);
install_driver_callbacks(ctx);
/* Hook our functions into exec and compile dispatch tables.
*/
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
/* Call all appropriate driver callbacks to revive state.
*/
_tnl_MakeCurrent( ctx, ctx->DrawBuffer, ctx->ReadBuffer );
_tnl_UnlockArraysEXT( ctx );
_tnl_LockArraysEXT( ctx, ctx->Array.LockFirst, ctx->Array.LockCount );
/* Equivalent to calling all _tnl_*Pointer functions:
*/
tnl->_ArrayNewState = ~0;
/* Assume we haven't been getting state updates either:
*/
_tnl_InvalidateState( ctx, ~0 );
/* Special state not restored by other methods:
*/
_tnl_recalc_current_flag( ctx );
}
void
_tnl_wakeup_save_exec( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
fprintf(stderr, "%s\n", __FUNCTION__);
_tnl_wakeup_exec( ctx );
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
}

View File

@ -1,5 +1,5 @@
/* $Id: t_context.h,v 1.3 2000/11/22 07:32:18 joukj Exp $ */
/* $Id: t_context.h,v 1.4 2000/11/24 10:25:12 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -142,6 +142,9 @@
#define VERT_TEX3_1234 (VERT_TEX3_4|VERT_TEX3_123)
#define VERT_TEX3_ANY VERT_TEX3_12
#define VERT_TEX_ANY_ANY (VERT_TEX0_ANY|VERT_TEX1_ANY| \
VERT_TEX2_ANY|VERT_TEX3_ANY)
#define NR_TEXSIZE_BITS 3
#define VERT_TEX_ANY(i) (VERT_TEX0_ANY << ((i) * NR_TEXSIZE_BITS))
@ -173,12 +176,6 @@
VERT_FOG_COORD)
/* For beginstate
*/
#define VERT_BEGIN_0 0x1 /* glBegin (if initially inside beg/end) */
#define VERT_BEGIN_1 0x2 /* glBegin (if initially outside beg/end) */
#define VERT_ERROR_0 0x4 /* invalid_operation in initial state 0 */
#define VERT_ERROR_1 0x8 /* invalid_operation in initial state 1 */
struct gl_pipeline;
@ -240,7 +237,6 @@ enum {
#define VERT_ERROR_0 0x4 /* invalid_operation in initial state 0 */
#define VERT_ERROR_1 0x8 /* invalid_operation in initial state 1 */
/* KW: Represents everything that can take place between a begin and
* end, and can represent multiple begin/end pairs. This plus *any*
* state variable (GLcontext) should be all you need to replay the
@ -259,7 +255,8 @@ struct immediate
*/
GLuint Start, Count;
GLuint LastData; /* count or count+1 */
GLuint AndFlag, OrFlag, BeginState;
GLuint AndFlag, OrFlag;
GLuint BeginState, SavedBeginState;
GLuint LastPrimitive;
GLuint ArrayAndFlags; /* precalc'ed for glArrayElt */
@ -437,7 +434,7 @@ typedef struct vertex_buffer
} TNLvertexbuffer;
typedef void (*gl_shade_func)( struct vertex_buffer *VB );
typedef void (*shade_func)( struct vertex_buffer *VB );
typedef void (*clip_interp_func)( struct vertex_buffer *VB, GLuint dst,
GLfloat t, GLuint in, GLuint out );
@ -531,12 +528,26 @@ struct gl_cva {
GLuint orflag;
GLuint merge;
GLuint locked;
GLuint lock_changed;
GLuint last_orflag;
GLuint last_array_flags;
GLuint last_array_new_state;
};
/* These are used to make the ctx->Current values look like
* arrays (with zero StrideB).
*/
struct gl_fallback_arrays {
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS];
struct gl_client_array EdgeFlag;
};
typedef void (*texgen_func)( struct vertex_buffer *VB,
@ -577,18 +588,24 @@ typedef struct tnl_context {
clip_poly_func *_poly_clip_tab;
clip_line_func *_line_clip_tab;
clip_interp_func _ClipInterpFunc; /* Clip interpolation function */
normal_func *_NormalTransform;
gl_shade_func *_shade_func_tab; /* Current shading function table */
normal_func *_NormalTransform;
shade_func *_shade_func_tab; /* Current shading function table */
GLenum _CurrentPrimitive; /* Prim or GL_POLYGON+1 */
GLuint _CurrentFlag;
GLboolean _ReplayHardBeginEnd; /* Display list execution of rect, etc */
GLuint _RenderFlags; /* Active inputs to render stage */
/* Cache of unused immediate structs */
struct immediate *freed_im_queue;
GLuint nr_im_queued;
struct gl_fallback_arrays Fallback;
GLvertexformat vtxfmt;
} TNLcontext;
@ -597,7 +614,6 @@ typedef struct tnl_context {
#define TNL_CURRENT_IM(ctx) ((struct immediate *)(ctx->swtnl_im))
#define TNL_VB(ctx) ((struct vertex_buffer *)(ctx->swtnl_vb))
extern void _tnl_reset_immediate( GLcontext *ctx );
extern GLboolean _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags );
@ -617,12 +633,12 @@ _tnl_LightingSpaceChange( GLcontext *ctx );
#define GET_IMMEDIATE struct immediate *IM = TNL_CURRENT_IM(((GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())))
#define SET_IMMEDIATE(ctx, im) ctx->swtnl_im = (void *)im
#else
extern struct immediate *_mesa_CurrentInput;
#define GET_IMMEDIATE struct immediate *IM = _mesa_CurrentInput
extern struct immediate *_tnl_CurrentInput;
#define GET_IMMEDIATE struct immediate *IM = _tnl_CurrentInput
#define SET_IMMEDIATE(ctx, im) \
do { \
ctx->swtnl_im = (void *)im; \
_mesa_CurrentInput = im; \
_tnl_CurrentInput = im; \
} while (0)
#endif

View File

@ -1,4 +1,4 @@
/* $Id: t_pipeline.c,v 1.3 2000/11/22 07:32:18 joukj Exp $ */
/* $Id: t_pipeline.c,v 1.4 2000/11/24 10:25:12 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -41,6 +41,7 @@
#include "t_bbox.h"
#include "t_clip.h"
#include "t_cva.h"
#include "t_debug.h"
#include "t_fog.h"
#include "t_light.h"
#include "t_pipeline.h"
@ -55,7 +56,7 @@
void gl_print_pipe_ops( const char *msg, GLuint flags )
void _tnl_print_pipe_ops( const char *msg, GLuint flags )
{
fprintf(stderr,
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n",
@ -80,13 +81,13 @@ void gl_print_pipe_ops( const char *msg, GLuint flags )
/* Have to reset only those parts of the vb which are being recalculated.
*/
void gl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages )
void _tnl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages )
{
GLcontext *ctx = VB->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (MESA_VERBOSE&VERBOSE_PIPELINE)
gl_print_pipe_ops( "reset cva vb", stages );
_tnl_print_pipe_ops( "reset cva vb", stages );
if (stages & PIPE_OP_VERT_XFORM)
{
@ -142,8 +143,8 @@ static void pipeline_ctr( struct gl_pipeline *p, GLcontext *ctx, GLuint type )
p->type = type;
p->ops = 0;
for (i = 0 ; i < gl_default_nr_stages ; i++)
p->state_change |= gl_default_pipeline[i].state_change;
for (i = 0 ; i < _tnl_default_nr_stages ; i++)
p->state_change |= _tnl_default_pipeline[i].state_change;
}
@ -151,12 +152,12 @@ void _tnl_pipeline_init( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
MEMCPY( tnl->PipelineStage,
gl_default_pipeline,
sizeof(*gl_default_pipeline) * gl_default_nr_stages );
tnl->NrPipelineStages = gl_default_nr_stages;
MEMCPY( tnl->PipelineStage,
_tnl_default_pipeline,
sizeof(*_tnl_default_pipeline) * _tnl_default_nr_stages );
tnl->NrPipelineStages = _tnl_default_nr_stages;
pipeline_ctr( &tnl->CVA.elt, ctx, PIPE_IMMEDIATE);
pipeline_ctr( &tnl->CVA.pre, ctx, PIPE_PRECALC );
}
@ -224,7 +225,7 @@ static void build_full_precalc_pipeline( GLcontext *ctx )
if (MESA_VERBOSE & VERBOSE_PIPELINE) {
fprintf(stderr, ": Rebuild pipeline\n");
gl_print_vert_flags("orflag", cva->orflag);
_tnl_print_vert_flags("orflag", cva->orflag);
}
@ -290,7 +291,7 @@ static void build_full_precalc_pipeline( GLcontext *ctx )
pre->changed_ops = changed_ops;
}
void gl_build_precalc_pipeline( GLcontext *ctx )
void _tnl_build_precalc_pipeline( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct gl_pipeline *pre = &tnl->CVA.pre;
@ -307,7 +308,7 @@ void gl_build_precalc_pipeline( GLcontext *ctx )
tnl->CVA.orflag = 0;
if (MESA_VERBOSE&VERBOSE_PIPELINE)
gl_print_pipeline( ctx, pre );
_tnl_print_pipeline( ctx, pre );
}
@ -378,7 +379,7 @@ static void build_full_immediate_pipeline( GLcontext *ctx )
void gl_build_immediate_pipeline( GLcontext *ctx )
void _tnl_build_immediate_pipeline( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct gl_pipeline *elt = &tnl->CVA.elt;
@ -392,12 +393,12 @@ void gl_build_immediate_pipeline( GLcontext *ctx )
tnl->CVA.orflag = 0;
if (MESA_VERBOSE&VERBOSE_PIPELINE)
gl_print_pipeline( ctx, elt );
_tnl_print_pipeline( ctx, elt );
}
#define INTERESTED ~0
void gl_update_pipelines( GLcontext *ctx )
void _tnl_update_pipelines( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint newstate = ctx->NewState;
@ -476,7 +477,7 @@ void gl_update_pipelines( GLcontext *ctx )
cva->last_array_flags = tnl->_ArrayFlags;
}
void gl_run_pipeline( struct vertex_buffer *VB )
void _tnl_run_pipeline( struct vertex_buffer *VB )
{
struct gl_pipeline *pipe = VB->pipeline;
struct gl_pipeline_stage **stages = pipe->stages;
@ -484,8 +485,8 @@ void gl_run_pipeline( struct vertex_buffer *VB )
pipe->data_valid = 1; /* optimized stages might want to reset this. */
if (0) gl_print_pipeline( VB->ctx, pipe );
if (0) _tnl_print_pipeline( VB->ctx, pipe );
START_FAST_MATH(x);
for ( VB->Culled = 0; *stages && !VB->Culled ; stages++ )

View File

@ -1,4 +1,4 @@
/* $Id: t_pipeline.h,v 1.2 2000/11/22 07:32:18 joukj Exp $ */
/* $Id: t_pipeline.h,v 1.3 2000/11/24 10:25:12 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -36,24 +36,25 @@
#include "mtypes.h"
#include "t_context.h"
extern void gl_update_materials( struct vertex_buffer *VB);
extern void _tnl_pipeline_init( GLcontext *ctx );
extern void gl_update_pipelines( GLcontext *ctx );
extern void gl_build_precalc_pipeline( GLcontext *ctx );
extern void gl_build_immediate_pipeline( GLcontext *ctx );
extern void _tnl_update_materials( struct vertex_buffer *VB);
extern void gl_print_vert_flags( const char *name, GLuint flags );
extern void gl_print_pipeline( GLcontext *ctx, struct gl_pipeline *p );
extern void gl_print_active_pipeline( GLcontext *ctx, struct gl_pipeline *p );
extern void _tnl_update_pipelines( GLcontext *ctx );
extern void gl_run_pipeline( struct vertex_buffer *VB );
extern void _tnl_build_precalc_pipeline( GLcontext *ctx );
extern void _tnl_build_immediate_pipeline( GLcontext *ctx );
extern void gl_clean_color( struct vertex_buffer *VB );
extern void _tnl_print_vert_flags( const char *name, GLuint flags );
extern void _tnl_print_pipeline( GLcontext *ctx, struct gl_pipeline *p );
extern void _tnl_print_active_pipeline( GLcontext *ctx, struct gl_pipeline *p );
extern void gl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages );
extern void _tnl_run_pipeline( struct vertex_buffer *VB );
extern void gl_print_pipe_ops( const char *msg, GLuint flags );
extern void _tnl_clean_color( struct vertex_buffer *VB );
extern void _tnl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages );
extern void _tnl_print_pipe_ops( const char *msg, GLuint flags );
#endif

View File

@ -44,5 +44,19 @@ _tnl_DestroyContext( GLcontext *ctx );
extern void
_tnl_InvalidateState( GLcontext *ctx, GLuint new_state );
/* Functions to revive the tnl module after being unhooked from
* dispatch and/or driver callbacks.
*/
/* Restore just the ctx->Exec table:
*/
extern void
_tnl_wakeup_exec( GLcontext *ctx );
/* Restore both ctx->Exec and ctx->Save:
*/
extern void
_tnl_wakeup_save_exec( GLcontext *ctx );
#endif

View File

@ -1,4 +1,4 @@
/* $Id: common_x86_asm.h,v 1.3 2000/11/16 21:05:41 keithw Exp $ */
/* $Id: common_x86_asm.h,v 1.4 2000/11/24 10:25:10 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -39,7 +39,7 @@
#ifndef __COMMON_X86_ASM_H__
#define __COMMON_X86_ASM_H__
/* Do not reference types.h from this file.
/* Do not reference mtypes.h from this file.
*/
#include "common_x86_features.h"