-/* $Id: t_dd_dmatmp.h,v 1.12 2002/02/13 00:53:20 keithw Exp $ */
+/* $Id: t_dd_dmatmp.h,v 1.13 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define ELTS_VARS
#define ALLOC_ELTS( nr )
#define EMIT_ELT( offset, elt )
+#define EMIT_TWO_ELTS( offset, elt0, elt1 )
#define INCR_ELTS( nr )
#define ELT_INIT(prim)
#define GET_CURRENT_VB_MAX_ELTS() 0
NEW_PRIMITIVE();
ALLOC_ELTS_NEW_PRIMITIVE( quads*6 );
- for ( i = 0 ; i < quads*2 ; i+=2 ) {
+ for ( i = j-start ; i < j-start+quads*2 ; i+=2 ) {
EMIT_TWO_ELTS( 0, (i+0), (i+1) );
EMIT_TWO_ELTS( 2, (i+2), (i+1) );
EMIT_TWO_ELTS( 4, (i+3), (i+2) );
NEW_PRIMITIVE();
ALLOC_ELTS_NEW_PRIMITIVE( quads*6 );
- for ( i = 0 ; i < quads*4 ; i+=4 ) {
+ for ( i = j-start ; i < j-start+quads*4 ; i+=4 ) {
EMIT_TWO_ELTS( 0, (i+0), (i+1) );
EMIT_TWO_ELTS( 2, (i+3), (i+1) );
EMIT_TWO_ELTS( 4, (i+2), (i+3) );
NEW_PRIMITIVE();
ALLOC_ELTS_NEW_PRIMITIVE( quads*6 );
- for ( i = 0 ; i < quads ; i++, elts += 2 ) {
+ for ( i = j-start ; i < j-start+quads ; i++, elts += 2 ) {
EMIT_TWO_ELTS( 0, elts[0], elts[1] );
EMIT_TWO_ELTS( 2, elts[2], elts[1] );
EMIT_TWO_ELTS( 4, elts[3], elts[2] );
NEW_PRIMITIVE();
ALLOC_ELTS_NEW_PRIMITIVE( quads * 6 );
- for ( i = 0 ; i < quads ; i++, elts += 4 ) {
+ for ( i = j-start ; i < j-start+quads ; i++, elts += 4 ) {
EMIT_TWO_ELTS( 0, elts[0], elts[1] );
EMIT_TWO_ELTS( 2, elts[3], elts[1] );
EMIT_TWO_ELTS( 4, elts[2], elts[3] );
-/* $Id: t_dd_vbtmp.h,v 1.17 2002/06/03 16:06:35 brianp Exp $ */
+/* $Id: t_dd_vbtmp.h,v 1.18 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
if (DO_SPEC) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- IMPORT_FLOAT_SPEC_COLORS( ctx );
- spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr;
- spec_stride = VB->SecondaryColorPtr[0]->StrideB;
+ if (VB->SecondaryColorPtr[0]) {
+ if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
+ IMPORT_FLOAT_SPEC_COLORS( ctx );
+ spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr;
+ spec_stride = VB->SecondaryColorPtr[0]->StrideB;
+ } else {
+ GLubyte tmp[4];
+ spec = &tmp;
+ spec_stride = 0;
+ }
}
if (DO_FOG) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ if (VB->FogCoordPtr) {
+ fog = VB->FogCoordPtr->data;
+ fog_stride = VB->FogCoordPtr->stride;
+ }
+ else {
+ GLfloat tmp = 0;
+ fog = &tmp;
+ fog_stride = 0;
+ }
}
if (VB->importable_data) {
-/* $Id: t_dd_vertex.h,v 1.11 2002/06/05 16:48:54 brianp Exp $ */
+/* $Id: t_dd_vertex.h,v 1.12 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLubyte ub4[24][4];
} TAG(Vertex), *TAG(VertexPtr);
-typedef struct {
- GLfloat clip[4];
- GLuint mask;
- GLuint pad; /* alignment */
- TAG(Vertex) v;
-} TAG(TnlVertex), *TAG(TnlVertexPtr);
/*\r
* Set the destination/draw buffer.\r
*/\r
-static GLboolean set_draw_buffer (GLcontext *ctx, GLenum mode)\r
+static void set_draw_buffer (GLcontext *ctx, GLenum mode)\r
{\r
- if (mode==GL_BACK_LEFT) {\r
- return GL_TRUE;\r
- } else {\r
- return GL_FALSE;\r
- }\r
+ /*\r
+ XXX this has to be fixed\r
+ */\r
}\r
\r
\r
}
/* Set the buffer used for drawing */
-static GLboolean gl_ggiSetDrawBuffer(GLcontext *ctx, GLenum mode)
+static void gl_ggiSetDrawBuffer(GLcontext *ctx, GLenum mode)
{
ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
{
ggiSetWriteFrame(ggi_ctx->ggi_visual,
ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- return GL_TRUE;
}
else if (mode == GL_BACK_LEFT)
{
ggiSetWriteFrame(ggi_ctx->ggi_visual,
ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1);
- return GL_TRUE;
}
else
{
- return GL_FALSE;
+ /* nothing since we don't have any point/line/triangle functions. */
}
}
-/* $Id: fxapi.c,v 1.32 2001/09/23 16:50:01 brianp Exp $ */
+/* $Id: fxapi.c,v 1.33 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
char *errorstr;
GLboolean useBGR;
char *system = NULL;
+ __GLimports imports;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxMesaCreateContext() Start\n");
goto errorhandler;
}
- ctx = fxMesa->glCtx = _mesa_create_context(fxMesa->glVis, shareCtx, /* share list context */
- (void *) fxMesa, GL_TRUE);
+ _mesa_init_default_imports( &imports, (void *) fxMesa);
+ ctx = fxMesa->glCtx = _mesa_create_context(fxMesa->glVis,
+ shareCtx,
+ &imports);
if (!ctx) {
errorstr = "_mesa_create_context";
goto errorhandler;
-/* $Id: fxdd.c,v 1.86 2002/06/13 04:28:30 brianp Exp $ */
+/* $Id: fxdd.c,v 1.87 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* Set the buffer used for drawing */
/* XXX support for separate read/draw buffers hasn't been tested */
-static GLboolean
+static void
fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
if (mode == GL_FRONT_LEFT) {
fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
FX_grRenderBuffer(fxMesa->currentFB);
- return GL_TRUE;
}
else if (mode == GL_BACK_LEFT) {
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
FX_grRenderBuffer(fxMesa->currentFB);
- return GL_TRUE;
}
else if (mode == GL_NONE) {
FX_grColorMask(FXFALSE, FXFALSE);
- return GL_TRUE;
}
else {
- return GL_FALSE;
+ /* we'll need a software fallback */
+ /* XXX not implemented */
}
}
-/* $Id: fxvb.c,v 1.12 2002/06/06 16:19:25 brianp Exp $ */
+/* $Id: fxvb.c,v 1.13 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
ind |= SETUP_TMU0;
}
}
- else if (ctx->Texture._ReallyEnabled & TETURE0_ANY) {
+ else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
ind |= SETUP_TMU0;
}
-/* $Id: osmesa.c,v 1.80 2002/06/13 04:28:30 brianp Exp $ */
+/* $Id: osmesa.c,v 1.81 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
-static GLboolean set_draw_buffer( GLcontext *ctx, GLenum mode )
+static void set_draw_buffer( GLcontext *ctx, GLenum mode )
{
(void) ctx;
- if (mode==GL_FRONT_LEFT) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
+ (void) mode;
}
-/* $Id: svgamesa.c,v 1.18 2002/06/13 04:28:30 brianp Exp $ */
+/* $Id: svgamesa.c,v 1.19 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
*height = SVGAMesa->height = vga_getydim();
}
-static GLboolean set_draw_buffer( GLcontext *ctx, GLenum buffer )
+static void set_draw_buffer( GLcontext *ctx, GLenum buffer )
{
if (buffer == GL_FRONT_LEFT) {
SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
SVGABuffer.FrontBuffer=tmpptr;
#endif
- return GL_TRUE;
}
else if (buffer == GL_BACK_LEFT) {
SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
/* vga_waitretrace(); */
copy_buffer(SVGABuffer.BackBuffer);
#endif
- return GL_TRUE;
}
- else
- return GL_FALSE;
+ else {
+ /* nothing since we don't have any point/line/triangle functions. */
+ }
}
-/* $Id: wmesa.c,v 1.29 2002/06/13 04:28:30 brianp Exp $ */
+/* $Id: wmesa.c,v 1.30 2002/06/15 02:38:17 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
}
}
-static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode )
+static void set_draw_buffer( GLcontext* ctx, GLenum mode )
{
- /* TODO: this could be better */
- if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
+ /* XXX doing nothing for now */
+ /* if front buffer, fine */
+ /* if back buffer, fine */
+ /* else, check swrast->_RasterMask & MULTI_DRAW_BIT, if true, */
+ /* use a swrast fallback function */
}
if (ctx->Polygon.SmoothFlag) return NULL;
if (ctx->Texture._ReallyEnabled) return NULL;
if (!wmesa->db_flag) return NULL;
+ if (ctx->swrast->_RasterMask & MULTI_DRAW_BIT) return NULL;
+
/*if (wmesa->xm_buffer->buffer==XIMAGE)*/ {
if ( ctx->Light.ShadeModel==GL_SMOOTH
&& ctx->_RasterMask==DEPTH_BIT
-/* $Id: xm_dd.c,v 1.31 2002/03/19 16:48:06 brianp Exp $ */
+/* $Id: xm_dd.c,v 1.32 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
}
-
-
-static GLboolean
+static void
set_draw_buffer( GLcontext *ctx, GLenum mode )
{
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
/* write to front buffer */
xmesa->xm_buffer->buffer = xmesa->xm_buffer->frontbuffer;
xmesa_update_span_funcs(ctx);
- return GL_TRUE;
}
else if (mode==GL_BACK_LEFT && xmesa->xm_buffer->db_state) {
/* write to back buffer */
xmesa->xm_buffer->buffer = xmesa->xm_buffer->frontbuffer;
}
xmesa_update_span_funcs(ctx);
- return GL_TRUE;
}
else {
- return GL_FALSE;
+ /* the swrast->_RasterMask MULTI_DRAW_BIT will be set and
+ * we'll fall back to swrast to draw points/lines/triangles.
+ */
}
}
-/* $Id: xm_line.c,v 1.18 2001/09/12 03:32:29 brianp Exp $ */
+/* $Id: xm_line.c,v 1.19 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Texture._ReallyEnabled) return (swrast_line_func) NULL;
if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL;
if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
+ if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
if (xmesa->xm_buffer->buffer==XIMAGE
&& swrast->_RasterMask==DEPTH_BIT
-/* $Id: xm_tri.c,v 1.22 2002/04/19 14:05:51 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.23 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define USE(triFunc) \
do { \
triFuncName = #triFunc; \
- /*printf("%s\n", triFuncName);*/ \
return triFunc; \
} while (0)
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
if (ctx->Texture._ReallyEnabled) return (swrast_tri_func) NULL;
+ if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL;
if (xmesa->xm_buffer->buffer==XIMAGE) {
if ( ctx->Light.ShadeModel==GL_SMOOTH
-/* $Id: api_arrayelt.c,v 1.8 2002/04/19 00:23:08 brianp Exp $ */
+/* $Id: api_arrayelt.c,v 1.9 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
_ae_update_state( ctx );
for (ta = actx->texarrays ; ta->func ; ta++) {
- ta->func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->StrideB );
+ ta->func( ta->unit + GL_TEXTURE0_ARB, (char *)ta->array->Ptr + elt * ta->array->StrideB );
}
/* Must be last
-/* $Id: attrib.c,v 1.66 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: attrib.c,v 1.67 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glPushAttrib %x\n", (int) mask);
+ _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask);
if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) {
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" );
while (attr) {
if (MESA_VERBOSE & VERBOSE_API) {
- _mesa_debug("glPopAttrib %s\n", _mesa_lookup_enum_by_nr(attr->kind));
+ _mesa_debug(ctx, "glPopAttrib %s\n",
+ _mesa_lookup_enum_by_nr(attr->kind));
}
switch (attr->kind) {
_mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE);
}
if (ctx->Driver.ClipPlane)
- ctx->Driver.ClipPlane( ctx, i, eyePlane );
+ ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane );
}
/* normalize/rescale */
-/* $Id: blend.c,v 1.35 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: blend.c,v 1.36 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glBlendFunc %s %s\n",
- _mesa_lookup_enum_by_nr(sfactor),
- _mesa_lookup_enum_by_nr(dfactor));
+ _mesa_debug(ctx, "glBlendFunc %s %s\n",
+ _mesa_lookup_enum_by_nr(sfactor),
+ _mesa_lookup_enum_by_nr(dfactor));
switch (sfactor) {
case GL_SRC_COLOR:
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glBlendFuncSeparate %s %s %s %s\n",
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
+ _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n",
+ _mesa_lookup_enum_by_nr(sfactorRGB),
+ _mesa_lookup_enum_by_nr(dfactorRGB),
+ _mesa_lookup_enum_by_nr(sfactorA),
+ _mesa_lookup_enum_by_nr(dfactorA));
switch (sfactorRGB) {
case GL_SRC_COLOR:
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glBlendEquation %s\n",
- _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glBlendEquation %s\n",
+ _mesa_lookup_enum_by_nr(mode));
switch (mode) {
case GL_FUNC_ADD_EXT:
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glColorMask %d %d %d %d\n", red, green, blue, alpha);
+ _mesa_debug(ctx, "glColorMask %d %d %d %d\n", red, green, blue, alpha);
/* Shouldn't have any information about channel depth in core mesa
* -- should probably store these as the native booleans:
-/* $Id: buffers.c,v 1.35 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: buffers.c,v 1.36 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glClear 0x%x\n", mask);
+ _mesa_debug(ctx, "glClear 0x%x\n", mask);
if (mask & ~(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT |
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
switch (mode) {
case GL_AUX0:
}
/*
- * If we get here there can't have been an error.
- * Now see if device driver can implement the drawing to the target
- * buffer(s). The driver may not be able to do GL_FRONT_AND_BACK mode
- * for example. We'll take care of that in the core code by looping
- * over the individual buffers.
+ * If we get here there can't have been an error. Now tell the
+ * device driver about it.
*/
ASSERT(ctx->Driver.SetDrawBuffer);
- if ( (*ctx->Driver.SetDrawBuffer)(ctx, ctx->Color.DriverDrawBuffer) ) {
- /* All OK, the driver will do all buffer writes */
- ctx->Color.MultiDrawBuffer = GL_FALSE;
- }
- else {
- /* We'll have to loop over the multiple draw buffer targets */
- ctx->Color.MultiDrawBuffer = GL_TRUE;
- /* Set drawing buffer to front for now */
- (void) (*ctx->Driver.SetDrawBuffer)(ctx, GL_FRONT_LEFT);
- }
+ (*ctx->Driver.SetDrawBuffer)(ctx, ctx->Color.DriverDrawBuffer);
ctx->Color.DrawBuffer = mode;
ctx->NewState |= _NEW_COLOR;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
switch (mode) {
case GL_AUX0:
GLcontext *ctx = _mesa_get_current_context();
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glResizeBuffersMESA\n");
+ _mesa_debug(ctx, "glResizeBuffersMESA\n");
if (ctx) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
}
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glScissor %d %d %d %d\n", x, y, width, height);
+ _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
if (x == ctx->Scissor.X &&
y == ctx->Scissor.Y &&
-/* $Id: config.h,v 1.38 2002/05/27 17:04:52 brianp Exp $ */
+/* $Id: config.h,v 1.39 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
* Bits per accumulation buffer color component: 8, 16 or 32
*/
-#define ACCUM_BITS 16
+#define ACCUM_BITS 32
/*
-/* $Id: context.c,v 1.166 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: context.c,v 1.167 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
GLcontext *ctx;
- ctx = (GLcontext *) (*imports->calloc)(0, 1, sizeof(GLcontext));
+ ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext));
if (ctx == NULL) {
return NULL;
}
ctx->Driver.CurrentExecPrimitive=0; /* XXX why is this here??? */
ctx->imports = *imports;
+ _mesa_init_default_exports(&(ctx->exports));
_mesa_initialize_visual(&ctx->Visual,
modes->rgbMode,
* This function just calls all the various one-time-init functions in Mesa.
*/
static void
-one_time_init( void )
+one_time_init( GLcontext *ctx )
{
static GLboolean alreadyCalled = GL_FALSE;
_glthread_LOCK_MUTEX(OneTimeLock);
#ifdef USE_SPARC_ASM
_mesa_init_sparc_glapi_relocs();
#endif
- if (getenv("MESA_DEBUG")) {
+ if (ctx->imports.getenv(ctx, "MESA_DEBUG")) {
_glapi_noop_enable_warnings(GL_TRUE);
}
else {
}
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
- fprintf(stderr, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__);
+ fprintf(stderr, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__);
#endif
alreadyCalled = GL_TRUE;
ctx->OcclusionResultSaved = GL_FALSE;
/* For debug/development only */
- ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
+ ctx->NoRaster = ctx->imports.getenv(ctx, "MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
ctx->FirstTimeCurrent = GL_TRUE;
/* Dither disable */
- ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
+ ctx->NoDither = ctx->imports.getenv(ctx, "MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
if (ctx->NoDither) {
- if (getenv("MESA_DEBUG")) {
+ if (ctx->imports.getenv(ctx, "MESA_DEBUG")) {
fprintf(stderr, "MESA_NO_DITHER set - dithering disabled\n");
}
ctx->Color.DitherFlag = GL_FALSE;
ASSERT(imports);
ASSERT(imports->other); /* other points to the device driver's context */
- /* misc one-time initializations */
- one_time_init();
+ /* assing imports */
+ ctx->imports = *imports;
/* initialize the exports (Mesa functions called by the window system) */
- _mesa_init_default_exports( &(ctx->exports) );
+ _mesa_init_default_exports( &(ctx->exports) );
+
+ /* misc one-time initializations */
+ one_time_init(ctx);
#if 0
/**
#endif
- if (getenv("MESA_DEBUG"))
- add_debug_flags(getenv("MESA_DEBUG"));
+ if (ctx->imports.getenv(ctx, "MESA_DEBUG"))
+ add_debug_flags(ctx->imports.getenv(ctx, "MESA_DEBUG"));
- if (getenv("MESA_VERBOSE"))
- add_debug_flags(getenv("MESA_VERBOSE"));
+ if (ctx->imports.getenv(ctx, "MESA_VERBOSE"))
+ add_debug_flags(ctx->imports.getenv(ctx, "MESA_VERBOSE"));
return GL_TRUE;
}
GLcontext *share_list,
const __GLimports *imports )
{
- GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) );
- if (!ctx) {
+ GLcontext *ctx;
+
+ ASSERT(visual);
+ ASSERT(imports);
+ ASSERT(imports->calloc);
+
+ ctx = (GLcontext *) imports->calloc(NULL, 1, sizeof(GLcontext));
+ if (!ctx)
return NULL;
- }
+
ctx->Driver.CurrentExecPrimitive = 0; /* XXX why is this here??? */
+
if (_mesa_initialize_context(ctx, visual, share_list, imports)) {
return ctx;
}
else {
- FREE(ctx);
+ imports->free(NULL, ctx);
return NULL;
}
}
GLframebuffer *readBuffer )
{
if (MESA_VERBOSE)
- fprintf(stderr, "_mesa_make_current2()\n");
+ _mesa_debug(newCtx, "_mesa_make_current2()\n");
/* Check that the context's and framebuffer's visuals are compatible.
* We could do a lot more checking here but this'll catch obvious
* information.
*/
if (newCtx->FirstTimeCurrent) {
- if (getenv("MESA_INFO")) {
+ if (newCtx->imports.getenv(newCtx, "MESA_INFO")) {
print_info();
}
newCtx->FirstTimeCurrent = GL_FALSE;
*/
void _mesa_problem( const GLcontext *ctx, const char *s )
{
- fprintf( stderr, "Mesa implementation error: %s\n", s );
+ if (ctx) {
+ ctx->imports.fprintf((GLcontext *) ctx, stderr, "Mesa implementation error: %s\n", s);
+#ifdef XF86DRI
+ ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the DRI bug database at dri.sourceforge.net\n");
+#else
+ ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" );
+#endif
+ }
+ else {
+ /* what can we do if we don't have a context???? */
+ fprintf( stderr, "Mesa implementation error: %s\n", s );
#ifdef XF86DRI
- fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n");
+ fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n");
#else
- fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" );
+ fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" );
#endif
- (void) ctx;
+ }
}
void
_mesa_error( GLcontext *ctx, GLenum error, const char *where )
{
- const char *debugEnv = getenv("MESA_DEBUG");
+ const char *debugEnv;
GLboolean debug;
+ if (ctx)
+ debugEnv = ctx->imports.getenv(ctx, "MESA_DEBUG");
+ else
+ /* what can we do??? */
+ debugEnv = "";
+
#ifdef DEBUG
if (debugEnv && strstr(debugEnv, "silent"))
debug = GL_FALSE;
/*
- * Call this to report debug information.
+ * Call this to report debug information. Uses stderr.
*/
void
-_mesa_debug( const char *fmtString, ... )
+_mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
{
-#ifdef DEBUG
va_list args;
va_start( args, fmtString );
- (void) vfprintf( stderr, fmtString, args );
+ (void) ctx->imports.fprintf( (__GLcontext *) ctx, stderr, fmtString, args );
+ va_end( args );
+}
+
+
+/*
+ * A wrapper for printf. Uses stdout.
+ */
+void
+_mesa_printf( const GLcontext *ctx, const char *fmtString, ... )
+{
+ va_list args;
+ va_start( args, fmtString );
+ (void) ctx->imports.fprintf( (__GLcontext *) ctx, stdout, fmtString, args );
va_end( args );
-#endif
}
+
void
_mesa_Finish( void )
{
-/* $Id: context.h,v 1.31 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: context.h,v 1.32 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
_mesa_error( GLcontext *ctx, GLenum error, const char *s );
extern void
-_mesa_debug( const char *fmtString, ... );
+_mesa_debug( const GLcontext *ctx, const char *fmtString, ... );
+
+extern void
+_mesa_printf( const GLcontext *ctx, const char *fmtString, ... );
-/* $Id: dd.h,v 1.68 2002/04/21 18:49:18 brianp Exp $ */
+/* $Id: dd.h,v 1.69 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* settings! Software Mesa can do masked clears if the device driver can't.
*/
- GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
+ void (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
/*
* Specifies the current buffer for writing.
* The following values must be accepted when applicable:
* GL_BACK_LEFT - when double buffering
* GL_FRONT_RIGHT - when using stereo
* GL_BACK_RIGHT - when using stereo and double buffering
- * The folowing values may optionally be accepted. Return GL_TRUE
- * if accepted, GL_FALSE if not accepted. In practice, only drivers
- * which can write to multiple color buffers at once should accept
- * these values.
* GL_FRONT - write to front left and front right if it exists
* GL_BACK - write to back left and back right if it exists
* GL_LEFT - write to front left and back left if it exists
* GL_RIGHT - write to right left and back right if they exist
* GL_FRONT_AND_BACK - write to all four buffers if they exist
* GL_NONE - disable buffer write in device driver.
+ *
+ * Note the driver must organize fallbacks (eg with swrast) if it
+ * cannot implement the requested mode.
*/
void (*GetBufferSize)( GLframebuffer *buffer,
-/* $Id: depth.c,v 1.29 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: depth.c,v 1.30 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
+ _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
switch (func) {
case GL_LESS: /* (default) pass if incoming z < stored z */
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glDepthMask %d\n", flag);
+ _mesa_debug(ctx, "glDepthMask %d\n", flag);
/*
* GL_TRUE indicates depth buffer writing is enabled (default)
-/* $Id: dlist.c,v 1.89 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: dlist.c,v 1.90 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Driver.BeginCallList)
ctx->Driver.BeginCallList( ctx, list );
-/* _mesa_debug("execute list %d\n", list); */
-/* mesa_print_display_list( list ); */
-
ctx->CallDepth++;
n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glNewList %u %s\n", list, _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glNewList %u %s\n", list,
+ _mesa_lookup_enum_by_nr(mode));
if (list==0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glNewList" );
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glEndList\n");
+ _mesa_debug(ctx, "glEndList\n");
/* Check that a list is under construction */
if (!ctx->CurrentListPtr) {
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("_mesa_CallList %d\n", list);
+ _mesa_debug(ctx, "_mesa_CallList %d\n", list);
/* mesa_print_display_list( list ); */
GLboolean save_compile_flag;
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("_mesa_CallLists %d\n", n);
+ _mesa_debug(ctx, "_mesa_CallLists %d\n", n);
/* Save the CompileFlag status, turn it off, execute display list,
* and restore the CompileFlag.
* Print the commands in a display list. For debugging only.
* TODO: many commands aren't handled yet.
*/
-static void print_list( GLcontext *ctx, FILE *f, GLuint list )
+static void print_list( GLcontext *ctx, GLuint list )
{
Node *n;
GLboolean done;
if (!glIsList(list)) {
- fprintf(f,"%u is not a display list ID\n",list);
+ _mesa_printf(ctx, "%u is not a display list ID\n", list);
return;
}
n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
- fprintf( f, "START-LIST %u, address %p\n", list, (void*)n );
+ _mesa_printf(ctx, "START-LIST %u, address %p\n", list, (void*)n );
done = n ? GL_FALSE : GL_TRUE;
while (!done) {
else {
switch (opcode) {
case OPCODE_ACCUM:
- fprintf(f,"accum %s %g\n", enum_string(n[1].e), n[2].f );
+ _mesa_printf(ctx, "accum %s %g\n", enum_string(n[1].e), n[2].f );
break;
case OPCODE_BITMAP:
- fprintf(f,"Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
+ _mesa_printf(ctx, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data );
break;
case OPCODE_CALL_LIST:
- fprintf(f,"CallList %d\n", (int) n[1].ui );
+ _mesa_printf(ctx, "CallList %d\n", (int) n[1].ui );
break;
case OPCODE_CALL_LIST_OFFSET:
- fprintf(f,"CallList %d + offset %u = %u\n", (int) n[1].ui,
+ _mesa_printf(ctx, "CallList %d + offset %u = %u\n", (int) n[1].ui,
ctx->List.ListBase, ctx->List.ListBase + n[1].ui );
break;
case OPCODE_COLOR_TABLE_PARAMETER_FV:
- fprintf(f,"ColorTableParameterfv %s %s %f %f %f %f\n",
+ _mesa_printf(ctx, "ColorTableParameterfv %s %s %f %f %f %f\n",
enum_string(n[1].e), enum_string(n[2].e),
n[3].f, n[4].f, n[5].f, n[6].f);
break;
case OPCODE_COLOR_TABLE_PARAMETER_IV:
- fprintf(f,"ColorTableParameteriv %s %s %d %d %d %d\n",
+ _mesa_printf(ctx, "ColorTableParameteriv %s %s %d %d %d %d\n",
enum_string(n[1].e), enum_string(n[2].e),
n[3].i, n[4].i, n[5].i, n[6].i);
break;
case OPCODE_DISABLE:
- fprintf(f,"Disable %s\n", enum_string(n[1].e));
+ _mesa_printf(ctx, "Disable %s\n", enum_string(n[1].e));
break;
case OPCODE_ENABLE:
- fprintf(f,"Enable %s\n", enum_string(n[1].e));
+ _mesa_printf(ctx, "Enable %s\n", enum_string(n[1].e));
break;
case OPCODE_FRUSTUM:
- fprintf(f,"Frustum %g %g %g %g %g %g\n",
+ _mesa_printf(ctx, "Frustum %g %g %g %g %g %g\n",
n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
break;
case OPCODE_LINE_STIPPLE:
- fprintf(f,"LineStipple %d %x\n", n[1].i, (int) n[2].us );
+ _mesa_printf(ctx, "LineStipple %d %x\n", n[1].i, (int) n[2].us );
break;
case OPCODE_LOAD_IDENTITY:
- fprintf(f,"LoadIdentity\n");
+ _mesa_printf(ctx, "LoadIdentity\n");
break;
case OPCODE_LOAD_MATRIX:
- fprintf(f,"LoadMatrix\n");
- fprintf(f," %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f);
- fprintf(f," %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f);
- fprintf(f," %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f);
- fprintf(f," %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f);
+ _mesa_printf(ctx, "LoadMatrix\n");
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[1].f, n[5].f, n[9].f, n[13].f);
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[2].f, n[6].f, n[10].f, n[14].f);
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[3].f, n[7].f, n[11].f, n[15].f);
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[4].f, n[8].f, n[12].f, n[16].f);
break;
case OPCODE_MULT_MATRIX:
- fprintf(f,"MultMatrix (or Rotate)\n");
- fprintf(f," %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f);
- fprintf(f," %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f);
- fprintf(f," %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f);
- fprintf(f," %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f);
+ _mesa_printf(ctx, "MultMatrix (or Rotate)\n");
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[1].f, n[5].f, n[9].f, n[13].f);
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[2].f, n[6].f, n[10].f, n[14].f);
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[3].f, n[7].f, n[11].f, n[15].f);
+ _mesa_printf(ctx, " %8f %8f %8f %8f\n",
+ n[4].f, n[8].f, n[12].f, n[16].f);
break;
case OPCODE_ORTHO:
- fprintf(f,"Ortho %g %g %g %g %g %g\n",
+ _mesa_printf(ctx, "Ortho %g %g %g %g %g %g\n",
n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
break;
case OPCODE_POP_ATTRIB:
- fprintf(f,"PopAttrib\n");
+ _mesa_printf(ctx, "PopAttrib\n");
break;
case OPCODE_POP_MATRIX:
- fprintf(f,"PopMatrix\n");
+ _mesa_printf(ctx, "PopMatrix\n");
break;
case OPCODE_POP_NAME:
- fprintf(f,"PopName\n");
+ _mesa_printf(ctx, "PopName\n");
break;
case OPCODE_PUSH_ATTRIB:
- fprintf(f,"PushAttrib %x\n", n[1].bf );
+ _mesa_printf(ctx, "PushAttrib %x\n", n[1].bf );
break;
case OPCODE_PUSH_MATRIX:
- fprintf(f,"PushMatrix\n");
+ _mesa_printf(ctx, "PushMatrix\n");
break;
case OPCODE_PUSH_NAME:
- fprintf(f,"PushName %d\n", (int) n[1].ui );
+ _mesa_printf(ctx, "PushName %d\n", (int) n[1].ui );
break;
case OPCODE_RASTER_POS:
- fprintf(f,"RasterPos %g %g %g %g\n", n[1].f, n[2].f,n[3].f,n[4].f);
+ _mesa_printf(ctx, "RasterPos %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 );
+ _mesa_printf(ctx, "Rotate %g %g %g %g\n",
+ n[1].f, n[2].f, n[3].f, n[4].f );
break;
case OPCODE_SCALE:
- fprintf(f,"Scale %g %g %g\n", n[1].f, n[2].f, n[3].f );
+ _mesa_printf(ctx, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f );
break;
case OPCODE_TRANSLATE:
- fprintf(f,"Translate %g %g %g\n", n[1].f, n[2].f, n[3].f );
+ _mesa_printf(ctx, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f );
break;
case OPCODE_BIND_TEXTURE:
- fprintf(f,"BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui),
- n[2].ui);
+ _mesa_printf(ctx, "BindTexture %s %d\n",
+ _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
break;
case OPCODE_SHADE_MODEL:
- fprintf(f,"ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui));
+ _mesa_printf(ctx, "ShadeModel %s\n",
+ _mesa_lookup_enum_by_nr(n[1].ui));
break;
case OPCODE_MAP1:
- fprintf(f,"Map1 %s %.3f %.3f %d %d\n",
+ _mesa_printf(ctx, "Map1 %s %.3f %.3f %d %d\n",
_mesa_lookup_enum_by_nr(n[1].ui),
n[2].f, n[3].f, n[4].i, n[5].i);
break;
case OPCODE_MAP2:
- fprintf(f,"Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
- _mesa_lookup_enum_by_nr(n[1].ui),
- n[2].f, n[3].f, n[4].f, n[5].f,
- n[6].i, n[7].i, n[8].i, n[9].i);
+ _mesa_printf(ctx, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
+ _mesa_lookup_enum_by_nr(n[1].ui),
+ n[2].f, n[3].f, n[4].f, n[5].f,
+ n[6].i, n[7].i, n[8].i, n[9].i);
break;
case OPCODE_MAPGRID1:
- fprintf(f,"MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
+ _mesa_printf(ctx, "MapGrid1 %d %.3f %.3f\n",
+ n[1].i, n[2].f, n[3].f);
break;
case OPCODE_MAPGRID2:
- fprintf(f,"MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
- n[1].i, n[2].f, n[3].f,
- n[4].i, n[5].f, n[6].f);
+ _mesa_printf(ctx, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
+ n[1].i, n[2].f, n[3].f,
+ n[4].i, n[5].f, n[6].f);
break;
case OPCODE_EVALMESH1:
- fprintf(f,"EvalMesh1 %d %d\n", n[1].i, n[2].i);
+ _mesa_printf(ctx, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
break;
case OPCODE_EVALMESH2:
- fprintf(f,"EvalMesh2 %d %d %d %d\n",
- n[1].i, n[2].i, n[3].i, n[4].i);
+ _mesa_printf(ctx, "EvalMesh2 %d %d %d %d\n",
+ n[1].i, n[2].i, n[3].i, n[4].i);
break;
/*
* meta opcodes/commands
*/
case OPCODE_ERROR:
- fprintf(f,"Error: %s %s\n", enum_string(n[1].e), (const char *)n[2].data );
+ _mesa_printf(ctx, "Error: %s %s\n",
+ enum_string(n[1].e), (const char *)n[2].data );
break;
case OPCODE_CONTINUE:
- fprintf(f,"DISPLAY-LIST-CONTINUE\n");
+ _mesa_printf(ctx, "DISPLAY-LIST-CONTINUE\n");
n = (Node *) n[1].next;
break;
case OPCODE_END_OF_LIST:
- fprintf(f,"END-LIST %u\n", list);
+ _mesa_printf(ctx, "END-LIST %u\n", list);
done = GL_TRUE;
break;
default:
if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
- fprintf(f,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
+ _mesa_printf(ctx,
+ "ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
opcode, (void*) n);
return;
}
else {
- fprintf(f,"command %d, %u operands\n",opcode,InstSize[opcode]);
+ _mesa_printf(ctx, "command %d, %u operands\n",
+ opcode, InstSize[opcode]);
}
}
/* increment n to point to next compiled command */
void mesa_print_display_list( GLuint list )
{
GET_CURRENT_CONTEXT(ctx);
- print_list( ctx, stderr, list );
+ print_list( ctx, list );
}
-/* $Id: drawpix.c,v 1.60 2002/05/09 21:54:16 brianp Exp $ */
+/* $Id: drawpix.c,v 1.61 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Current.RasterPos[0] += xmove;
ctx->Current.RasterPos[1] += ymove;
}
+
+
+
+#if 0 /* experimental */
+/*
+ * Execute glDrawDepthPixelsMESA(). This function accepts both a color
+ * image and depth (Z) image. Rasterization produces fragments with
+ * color and Z taken from these images. This function is intended for
+ * Z-compositing. Normally, this operation requires two glDrawPixels
+ * calls with stencil testing.
+ */
+void
+_mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height,
+ GLenum colorFormat, GLenum colorType,
+ const GLvoid *colors,
+ GLenum depthType, const GLvoid *depths )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glDrawDepthPixelsMESA(width or height < 0" );
+ return;
+ }
+
+ if (ctx->RenderMode==GL_RENDER) {
+ GLint x, y;
+ if (!colors || !depths || !ctx->Current.RasterPosValid) {
+ return;
+ }
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
+ x = IROUND(ctx->Current.RasterPos[0]);
+ y = IROUND(ctx->Current.RasterPos[1]);
+
+ ctx->OcclusionResult = GL_TRUE;
+ ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height,
+ colorFormat, colorType, colors,
+ depthType, depths, &ctx->Unpack);
+ }
+ else if (ctx->RenderMode==GL_FEEDBACK) {
+ /* Feedback the current raster pos info */
+ if (ctx->Current.RasterPosValid) {
+ FLUSH_CURRENT( ctx, 0 );
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+ _mesa_feedback_vertex( ctx,
+ ctx->Current.RasterPos,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterIndex,
+ ctx->Current.RasterTexCoords[0] );
+ }
+ }
+ else if (ctx->RenderMode==GL_SELECT) {
+ if (ctx->Current.RasterPosValid) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+ }
+}
+
+#endif
-/* $Id: enable.c,v 1.64 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: enable.c,v 1.65 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("%s %s (newstate is %x)\n",
+ _mesa_debug(ctx, "%s %s (newstate is %x)\n",
state ? "glEnable" : "glDisable",
_mesa_lookup_enum_by_nr(cap),
ctx->NewState);
-/* $Id: get.c,v 1.80 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: get.c,v 1.81 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug(ctx, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetBooleanv
&& (*ctx->Driver.GetBooleanv)(ctx, pname, params))
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug(ctx, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params))
return;
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug(ctx, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params))
return;
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug(ctx, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetIntegerv
&& (*ctx->Driver.GetIntegerv)(ctx, pname, params))
return;
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetPointerv
&& (*ctx->Driver.GetPointerv)(ctx, pname, params))
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
+ _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
return e;
-/* $Id: glheader.h,v 1.27 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: glheader.h,v 1.28 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
#endif
#endif
#include <float.h>
+#include <stdarg.h>
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
-#ifdef DEBUG
-#include <stdarg.h> /* for _mesa_debug() only */
-#endif
-
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
# define __WIN32__
#endif
+/*
+ * Provide a reasonable replacement for __FUNCTION__ when using
+ * non-GNU C compilers.
+ */
+#if !defined(__GNUC__)
+#define STRINGIZE(x) #x
+#define STRINGIZE_EVAL(x) STRINGIZE(x)
+#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__)
+#endif
+
+
/* Some compilers don't like some of Mesa's const usage */
#ifdef NO_CONST
# define CONST
-/* $Id: hint.c,v 1.11 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: hint.c,v 1.12 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- (void) _mesa_try_Hint( ctx, target, mode );
-}
-
-GLboolean
-_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
-{
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug("glHint %s %d\n", _mesa_lookup_enum_by_nr(target), mode);
if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) {
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)");
- return GL_FALSE;
+ return;
}
switch (target) {
case GL_FOG_HINT:
if (ctx->Hint.Fog == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.Fog = mode;
break;
case GL_LINE_SMOOTH_HINT:
if (ctx->Hint.LineSmooth == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.LineSmooth = mode;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
if (ctx->Hint.PerspectiveCorrection == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PerspectiveCorrection = mode;
break;
case GL_POINT_SMOOTH_HINT:
if (ctx->Hint.PointSmooth == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PointSmooth = mode;
break;
case GL_POLYGON_SMOOTH_HINT:
if (ctx->Hint.PolygonSmooth == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PolygonSmooth = mode;
break;
/* GL_EXT_clip_volume_hint */
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
if (ctx->Hint.ClipVolumeClipping == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.ClipVolumeClipping = mode;
break;
case GL_TEXTURE_COMPRESSION_HINT_ARB:
if (!ctx->Extensions.ARB_texture_compression) {
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
- return GL_FALSE;
+ return;
}
if (ctx->Hint.TextureCompression == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.TextureCompression = mode;
break;
case GL_GENERATE_MIPMAP_HINT_SGIS:
if (!ctx->Extensions.SGIS_generate_mipmap) {
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
- return GL_FALSE;
+ return;
}
if (ctx->Hint.GenerateMipmap == mode)
- return GL_TRUE;
+ return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.GenerateMipmap = mode;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
- return GL_FALSE;
+ return;
}
if (ctx->Driver.Hint) {
(*ctx->Driver.Hint)( ctx, target, mode );
}
-
- return GL_TRUE;
}
-/* $Id: hint.h,v 1.3 2001/01/24 04:56:20 brianp Exp $ */
+/* $Id: hint.h,v 1.4 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "mtypes.h"
-extern GLboolean
-_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode );
-
extern void
_mesa_Hint( GLenum target, GLenum mode );
-/* $Id: imports.c,v 1.12 2002/06/13 08:27:32 joukj Exp $ */
+/* $Id: imports.c,v 1.13 2002/06/15 02:38:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
* the renderer should use the XFree86-wrapped system calls.
*/
-#include <stdarg.h>
+/*
+ * XXX when we fully implement the __GLimports mechanism in Mesa, that
+ * should mean that we can remove <stdio.h>, <stdlib.h>, etc, from
+ * glheader.h. Strictly speaking, all system includes should be done
+ * from this file, and not glheader to ensure that core Mesa has no
+ * dependencies on external libraries. Someday...
+ */
+
+
#include "glheader.h"
#include "imports.h"
#include "mem.h"
-#include "mtypes.h"
+
static void *
_mesa_Malloc(__GLcontext *gc, size_t size)
-/* $Id: light.c,v 1.50 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: light.c,v 1.51 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
if (mode != GL_FLAT && mode != GL_SMOOTH) {
_mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
bitmask &= ~ctx->Light.ColorMaterialBitmask;
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- _mesa_debug("_mesa_update_material, mask 0x%x\n", bitmask);
+ _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask);
if (!bitmask)
return;
ctx->Light.Material[1].SpecularIndex = src[1].SpecularIndex;
}
- if (0)
- {
+ if (0) {
struct gl_material *mat = &ctx->Light.Material[0];
- _mesa_debug("update_mat emission : %f %f %f\n",
- mat->Emission[0],
- mat->Emission[1],
- mat->Emission[2]);
- _mesa_debug("update_mat specular : %f %f %f\n",
- mat->Specular[0],
- mat->Specular[1],
- mat->Specular[2]);
- _mesa_debug("update_mat diffuse : %f %f %f\n",
- mat->Diffuse[0],
- mat->Diffuse[1],
- mat->Diffuse[2]);
- _mesa_debug("update_mat ambient : %f %f %f\n",
- mat->Ambient[0],
- mat->Ambient[1],
- mat->Ambient[2]);
+ _mesa_debug(ctx, "update_mat emission : %f %f %f\n",
+ mat->Emission[0], mat->Emission[1], mat->Emission[2]);
+ _mesa_debug(ctx, "update_mat specular : %f %f %f\n",
+ mat->Specular[0], mat->Specular[1], mat->Specular[2]);
+ _mesa_debug(ctx, "update_mat diffuse : %f %f %f\n",
+ mat->Diffuse[0], mat->Diffuse[1], mat->Diffuse[2]);
+ _mesa_debug(ctx, "update_mat ambient : %f %f %f\n",
+ mat->Ambient[0], mat->Ambient[1], mat->Ambient[2]);
}
}
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- _mesa_debug("_mesa_update_color_material, mask 0x%x\n", bitmask);
+ _mesa_debug(ctx, "_mesa_update_color_material, mask 0x%x\n", bitmask);
/* update emissive colors */
if (bitmask & FRONT_EMISSION_BIT) {
}
}
- if (0)
- {
+ if (0) {
struct gl_material *mat = &ctx->Light.Material[0];
- _mesa_debug("update_color_mat emission : %f %f %f\n",
- mat->Emission[0],
- mat->Emission[1],
- mat->Emission[2]);
- _mesa_debug("update_color_mat specular : %f %f %f\n",
- mat->Specular[0],
- mat->Specular[1],
- mat->Specular[2]);
- _mesa_debug("update_color_mat diffuse : %f %f %f\n",
- mat->Diffuse[0],
- mat->Diffuse[1],
- mat->Diffuse[2]);
- _mesa_debug("update_color_mat ambient : %f %f %f\n",
- mat->Ambient[0],
- mat->Ambient[1],
- mat->Ambient[2]);
+ _mesa_debug(ctx, "update_color_mat emission : %f %f %f\n",
+ mat->Emission[0], mat->Emission[1], mat->Emission[2]);
+ _mesa_debug(ctx, "update_color_mat specular : %f %f %f\n",
+ mat->Specular[0], mat->Specular[1], mat->Specular[2]);
+ _mesa_debug(ctx, "update_color_mat diffuse : %f %f %f\n",
+ mat->Diffuse[0], mat->Diffuse[1], mat->Diffuse[2]);
+ _mesa_debug(ctx, "update_color_mat ambient : %f %f %f\n",
+ mat->Ambient[0], mat->Ambient[1], mat->Ambient[2]);
}
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glColorMaterial %s %s\n",
- _mesa_lookup_enum_by_nr(face),
- _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glColorMaterial %s %s\n",
+ _mesa_lookup_enum_by_nr(face),
+ _mesa_lookup_enum_by_nr(mode));
bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial");
-/* $Id: matrix.c,v 1.41 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: matrix.c,v 1.42 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glPushMatrix %s\n",
- _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
+ _mesa_debug(ctx, "glPushMatrix %s\n",
+ _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
if (stack->Depth + 1 >= stack->MaxDepth) {
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix" );
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glPopMatrix %s\n",
- _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
+ _mesa_debug(ctx, "glPopMatrix %s\n",
+ _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
if (stack->Depth == 0) {
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix" );
}
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glViewport %d %d %d %d\n", x, y, width, height);
+ _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
/* clamp width, and height to implementation dependent range */
width = CLAMP( width, 1, MAX_WIDTH );
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glDepthRange %f %f\n", nearval, farval);
+ _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
n = (GLfloat) CLAMP( nearval, 0.0, 1.0 );
f = (GLfloat) CLAMP( farval, 0.0, 1.0 );
-/* $Id: mtypes.h,v 1.78 2002/06/13 04:28:29 brianp Exp $ */
+/* $Id: mtypes.h,v 1.79 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define Elements(x) sizeof(x)/sizeof(*(x))
-/*
- * Provide a reasonable replacement for __FUNCTION__ when using
- * non-GNU C compilers.
- */
-#if !defined(__GNUC__)
-#define STRINGIZE(x) #x
-#define STRINGIZE_EVAL(x) STRINGIZE(x)
-#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__)
-#endif
/* Eventually let the driver specify what statechanges require a flush:
*/
-/* $Id: polygon.c,v 1.22 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: polygon.c,v 1.23 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glCullFace %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode));
if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) {
_mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" );
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
if (mode!=GL_CW && mode!=GL_CCW) {
_mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glPolygonMode %s %s\n",
+ _mesa_debug(ctx, "glPolygonMode %s %s\n",
_mesa_lookup_enum_by_nr(face),
_mesa_lookup_enum_by_nr(mode));
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glPolygonStipple\n");
+ _mesa_debug(ctx, "glPolygonStipple\n");
FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
_mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glGetPolygonStipple\n");
+ _mesa_debug(ctx, "glGetPolygonStipple\n");
_mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack);
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug("glPolygonOffset %f %f\n", factor, units);
+ _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units);
if (ctx->Polygon.OffsetFactor == factor &&
ctx->Polygon.OffsetUnits == units)
-/* $Id: texformat.c,v 1.11 2001/06/15 14:18:46 brianp Exp $ */
+/* $Id: texformat.c,v 1.12 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
};
+/* Big-endian */
+#if 0
+const struct gl_texture_format _mesa_texformat_abgr8888 = {
+ MESA_FORMAT_ABGR8888, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_INT_8_8_8_8, /* Type */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4, /* TexelBytes */
+ fetch_1d_texel_abgr8888, /* FetchTexel1D */
+ fetch_2d_texel_abgr8888, /* FetchTexel2D */
+ fetch_3d_texel_abgr8888, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_bgra8888 = {
+ MESA_FORMAT_BGRA8888, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_INT_8_8_8_8, /* Type */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4, /* TexelBytes */
+ fetch_1d_texel_bgra8888, /* FetchTexel1D */
+ fetch_2d_texel_bgra8888, /* FetchTexel2D */
+ fetch_3d_texel_bgra8888, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_bgr888 = {
+ MESA_FORMAT_BGR888, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_BYTE, /* Type */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 3, /* TexelBytes */
+ fetch_1d_texel_bgr888, /* FetchTexel1D */
+ fetch_2d_texel_bgr888, /* FetchTexel2D */
+ fetch_3d_texel_bgr888, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_bgr565 = {
+ MESA_FORMAT_BGR565, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_SHORT_5_6_5, /* Type */
+ 5, /* RedBits */
+ 6, /* GreenBits */
+ 5, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ fetch_1d_texel_bgr565, /* FetchTexel1D */
+ fetch_2d_texel_bgr565, /* FetchTexel2D */
+ fetch_3d_texel_bgr565, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_bgra4444 = {
+ MESA_FORMAT_BGRA4444, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */
+ 4, /* RedBits */
+ 4, /* GreenBits */
+ 4, /* BlueBits */
+ 4, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ fetch_1d_texel_bgra4444, /* FetchTexel1D */
+ fetch_2d_texel_bgra4444, /* FetchTexel2D */
+ fetch_3d_texel_bgra4444, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_bgra5551 = {
+ MESA_FORMAT_BGRA5551, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */
+ 5, /* RedBits */
+ 5, /* GreenBits */
+ 5, /* BlueBits */
+ 1, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ fetch_1d_texel_bgra1555, /* FetchTexel1D */
+ fetch_2d_texel_bgra1555, /* FetchTexel2D */
+ fetch_3d_texel_bgra1555, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_la88 = {
+ MESA_FORMAT_LA88, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_BYTE, /* Type */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8, /* AlphaBits */
+ 8, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ fetch_1d_texel_la88, /* FetchTexel1D */
+ fetch_2d_texel_la88, /* FetchTexel2D */
+ fetch_3d_texel_la88, /* FetchTexel3D */
+};
+
+const struct gl_texture_format _mesa_texformat_bgr233 = {
+ MESA_FORMAT_BGR233, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_BYTE_3_3_2, /* Type */
+ 3, /* RedBits */
+ 3, /* GreenBits */
+ 2, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1, /* TexelBytes */
+ fetch_1d_texel_bgr233, /* FetchTexel1D */
+ fetch_2d_texel_bgr233, /* FetchTexel2D */
+ fetch_3d_texel_bgr233, /* FetchTexel3D */
+};
+#endif
+
/* =============================================================
* Null format:
*/
/* Given an internal texture format (or 1, 2, 3, 4) return a pointer
* to a gl_texture_format which which to store the texture.
* This is called via ctx->Driver.ChooseTextureFormat().
- * Hardware drivers should not use this function, but instead a
- * specialized function.
+ * Hardware drivers typically override this function with a specialized
+ * version.
*/
const struct gl_texture_format *
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
-/* $Id: texformat.h,v 1.8 2002/06/12 00:52:50 brianp Exp $ */
+/* $Id: texformat.h,v 1.9 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "mtypes.h"
-/* The Mesa internal texture image types. These will be set to their
- * default value, but may be changed by drivers as required.
+/*
+ * The Mesa internal texture image types.
+ * All texture images must be stored in one of these formats.
*/
enum _format {
/* Hardware-friendly formats. Drivers can override the default
* formats and convert texture images to one of these as required.
+ * The driver's ChooseTextureFormat() function will choose one of
+ * these formats.
* These formats are all little endian, as shown below. They will be
* most useful for x86-based PC graphics card drivers.
*
*
* NOTE: Because these are based on the GLchan datatype, one cannot
* assume 8 bits per channel with these formats. If you require
- * GLubyte per channel, use one of the hardware formats above.
+ * GLubyte channels, use one of the hardware formats above.
*/
MESA_FORMAT_RGBA,
MESA_FORMAT_RGB,
-/* $Id: texformat_tmp.h,v 1.4 2002/05/09 20:51:05 keithw Exp $ */
+/* $Id: texformat_tmp.h,v 1.5 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
+/* big-endian */
+
+static void FETCH(abgr8888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
+ GLchan *rgba = (GLchan *) texel;
+ rgba[RCOMP] = UBYTE_TO_CHAN( src[3] );
+ rgba[GCOMP] = UBYTE_TO_CHAN( src[2] );
+ rgba[BCOMP] = UBYTE_TO_CHAN( src[1] );
+ rgba[ACOMP] = UBYTE_TO_CHAN( src[0] );
+}
+
+static void FETCH(bgra8888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
+ GLchan *rgba = (GLchan *) texel;
+ rgba[RCOMP] = UBYTE_TO_CHAN( src[2] );
+ rgba[GCOMP] = UBYTE_TO_CHAN( src[1] );
+ rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ rgba[ACOMP] = UBYTE_TO_CHAN( src[3] );
+}
+
+static void FETCH(bgr888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
+ GLchan *rgba = (GLchan *) texel;
+ rgba[RCOMP] = UBYTE_TO_CHAN( src[2] );
+ rgba[GCOMP] = UBYTE_TO_CHAN( src[1] );
+ rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ rgba[ACOMP] = CHAN_MAX;
+}
+
+static void FETCH(bgr565)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ GLchan *rgba = (GLchan *) texel; GLushort s = *src;
+ rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
+ rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
+ rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
+ rgba[ACOMP] = CHAN_MAX;
+}
+
+static void FETCH(bgra4444)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ GLchan *rgba = (GLchan *) texel; GLushort s = *src;
+ rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
+ rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
+ rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+}
+
+static void FETCH(bgra5551)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ GLchan *rgba = (GLchan *) texel; GLushort s = *src;
+ rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
+ rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
+ rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
+ rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+}
+
+static void FETCH(la88)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
+ GLchan *rgba = (GLchan *) texel;
+ rgba[RCOMP] = UBYTE_TO_CHAN( src[0] );
+ rgba[GCOMP] = UBYTE_TO_CHAN( src[0] );
+ rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ rgba[ACOMP] = UBYTE_TO_CHAN( src[1] );
+}
+
+static void FETCH(bgr233)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLvoid *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ GLchan *rgba = (GLchan *) texel; GLubyte s = *src;
+ rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
+ rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
+ rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 );
+ rgba[ACOMP] = CHAN_MAX;
+}
+
+
+
#undef CHAN_SRC
#undef UBYTE_SRC
#undef USHORT_SRC
-/* $Id: texobj.c,v 1.53 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: texobj.c,v 1.54 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glBindTexture %s %d\n",
+ _mesa_debug(ctx, "glBindTexture %s %d\n",
_mesa_lookup_enum_by_nr(target), (GLint) texName);
switch (target) {
-/* $Id: texstate.c,v 1.73 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: texstate.c,v 1.74 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glTexEnv %s %s %.1f(%s) ...\n",
+ _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n",
_mesa_lookup_enum_by_nr(target),
_mesa_lookup_enum_by_nr(pname),
*param,
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("texPARAM %s %s %d...\n",
+ _mesa_debug(ctx, "texPARAM %s %s %d...\n",
_mesa_lookup_enum_by_nr(target),
_mesa_lookup_enum_by_nr(pname),
eparam);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("texGEN %s %s %x...\n",
+ _mesa_debug(ctx, "texGEN %s %s %x...\n",
_mesa_lookup_enum_by_nr(coord),
_mesa_lookup_enum_by_nr(pname),
*(int *)params);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug("glActiveTexture %s\n",
+ _mesa_debug(ctx, "glActiveTexture %s\n",
_mesa_lookup_enum_by_nr(target));
if (texUnit > ctx->Const.MaxTextureUnits) {
-/* $Id: varray.c,v 1.44 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: varray.c,v 1.45 2002/06/15 02:38:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
- _mesa_debug("glVertexPointer( sz %d type %s stride %d )\n", size,
- _mesa_lookup_enum_by_nr( type ),
- stride);
+ _mesa_debug(ctx, "glVertexPointer( sz %d type %s stride %d )\n", size,
+ _mesa_lookup_enum_by_nr( type ), stride);
/* always need to check that <type> is legal */
switch (type) {
}
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
- _mesa_debug("glNormalPointer( type %s stride %d )\n",
- _mesa_lookup_enum_by_nr( type ),
- stride);
+ _mesa_debug(ctx, "glNormalPointer( type %s stride %d )\n",
+ _mesa_lookup_enum_by_nr( type ), stride);
switch (type) {
case GL_BYTE:
}
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
- _mesa_debug("glColorPointer( sz %d type %s stride %d )\n", size,
- _mesa_lookup_enum_by_nr( type ),
- stride);
+ _mesa_debug(ctx, "glColorPointer( sz %d type %s stride %d )\n", size,
+ _mesa_lookup_enum_by_nr( type ), stride);
switch (type) {
case GL_BYTE:
}
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
- _mesa_debug("glSecondaryColorPointer( sz %d type %s stride %d )\n",
+ _mesa_debug(ctx, "glSecondaryColorPointer( sz %d type %s stride %d )\n",
size, _mesa_lookup_enum_by_nr( type ), stride);
switch (type) {
}
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
- _mesa_debug("glTexCoordPointer( unit %u sz %d type %s stride %d )\n",
- texUnit,
- size,
- _mesa_lookup_enum_by_nr( type ),
- stride);
+ _mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n",
+ texUnit, size, _mesa_lookup_enum_by_nr( type ), stride);
/* always need to check that <type> is legal */
switch (type) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glLockArrays %d %d\n", first, count);
+ _mesa_debug(ctx, "glLockArrays %d %d\n", first, count);
if (first == 0 && count > 0 &&
count <= (GLint) ctx->Const.MaxArrayLockSize) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("glUnlockArrays\n");
+ _mesa_debug(ctx, "glUnlockArrays\n");
ctx->Array.LockFirst = 0;
ctx->Array.LockCount = 0;
-/* $Id: m_xform.c,v 1.15 2002/04/09 14:58:04 keithw Exp $ */
+/* $Id: m_xform.c,v 1.16 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
_math_test_all_cliptest_functions( "default" );
#endif
-#ifdef USE_X86_ASM
+#ifdef USE_X86_ASM_foo
_mesa_init_all_x86_transform_asm();
#endif
#ifdef USE_SPARC_ASM
-/* $Id: s_accum.c,v 1.16 2002/03/19 16:47:05 brianp Exp $ */
+/* $Id: s_accum.c,v 1.17 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
-#if CHAN_BITS == 8
+#if CHAN_BITS == 8 && ACCUM_BITS < 32
#define USE_OPTIMIZED_ACCUM /* enable the optimization */
#endif
-/* $Id: s_buffers.c,v 1.10 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: s_buffers.c,v 1.11 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) {
if (bufferBit & ctx->Color.DrawDestMask) {
if (bufferBit == FRONT_LEFT_BIT) {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
}
else if (bufferBit == FRONT_RIGHT_BIT) {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
}
else if (bufferBit == BACK_LEFT_BIT) {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
}
else {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
}
if (colorMask != 0xffffffff) {
-/* $Id: s_context.c,v 1.33 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: s_context.c,v 1.34 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
#include "glheader.h"
+#include "context.h"
#include "mtypes.h"
#include "mem.h"
* MULTI_DRAW_BIT flag. Also set it if we're drawing to no
* buffers or the RGBA or CI mask disables all writes.
*/
- if (ctx->Color.MultiDrawBuffer) {
- RasterMask |= MULTI_DRAW_BIT;
- }
- else if (ctx->Color.DrawBuffer==GL_NONE) {
+ if (ctx->Color.DrawBuffer == GL_FRONT_AND_BACK ||
+ ctx->Color.DrawBuffer == GL_NONE) {
RasterMask |= MULTI_DRAW_BIT;
}
else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) {
const SWvertex *v2, const SWvertex *v3 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Quad\n");
+ _mesa_debug(ctx, "_swrast_Quad\n");
_swrast_print_vertex( ctx, v0 );
_swrast_print_vertex( ctx, v1 );
_swrast_print_vertex( ctx, v2 );
const SWvertex *v1, const SWvertex *v2 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Triangle\n");
+ _mesa_debug(ctx, "_swrast_Triangle\n");
_swrast_print_vertex( ctx, v0 );
_swrast_print_vertex( ctx, v1 );
_swrast_print_vertex( ctx, v2 );
_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Line\n");
+ _mesa_debug(ctx, "_swrast_Line\n");
_swrast_print_vertex( ctx, v0 );
_swrast_print_vertex( ctx, v1 );
}
_swrast_Point( GLcontext *ctx, const SWvertex *v0 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Point\n");
+ _mesa_debug(ctx, "_swrast_Point\n");
_swrast_print_vertex( ctx, v0 );
}
SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
_swrast_InvalidateState( GLcontext *ctx, GLuint new_state )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_InvalidateState\n");
+ _mesa_debug(ctx, "_swrast_InvalidateState\n");
}
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state );
}
_swrast_ResetLineStipple( GLcontext *ctx )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_ResetLineStipple\n");
+ _mesa_debug(ctx, "_swrast_ResetLineStipple\n");
}
SWRAST_CONTEXT(ctx)->StippleCounter = 0;
}
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_allow_vertex_fog %d\n", value);
+ _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value);
}
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
SWRAST_CONTEXT(ctx)->AllowVertexFog = value;
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_allow_pixel_fog %d\n", value);
+ _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value);
}
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
SWRAST_CONTEXT(ctx)->AllowPixelFog = value;
SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_CreateContext\n");
+ _mesa_debug(ctx, "_swrast_CreateContext\n");
}
if (!swrast)
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_DestroyContext\n");
+ _mesa_debug(ctx, "_swrast_DestroyContext\n");
}
FREE( swrast->span );
GLuint i;
if (SWRAST_DEBUG_VERTICES) {
- _mesa_debug("win %f %f %f %f\n",
+ _mesa_debug(ctx, "win %f %f %f %f\n",
v->win[0], v->win[1], v->win[2], v->win[3]);
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Texture.Unit[i]._ReallyEnabled)
- _mesa_debug("texcoord[%d] %f %f %f %f\n", i,
+ _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
v->texcoord[i][0], v->texcoord[i][1],
v->texcoord[i][2], v->texcoord[i][3]);
#if CHAN_TYPE == GL_FLOAT
- _mesa_debug("color %f %f %f %f\n",
+ _mesa_debug(ctx, "color %f %f %f %f\n",
v->color[0], v->color[1], v->color[2], v->color[3]);
- _mesa_debug("spec %f %f %f %f\n",
+ _mesa_debug(ctx, "spec %f %f %f %f\n",
v->specular[0], v->specular[1],
v->specular[2], v->specular[3]);
#else
- _mesa_debug("color %d %d %d %d\n",
+ _mesa_debug(ctx, "color %d %d %d %d\n",
v->color[0], v->color[1], v->color[2], v->color[3]);
- _mesa_debug("spec %d %d %d %d\n",
+ _mesa_debug(ctx, "spec %d %d %d %d\n",
v->specular[0], v->specular[1],
v->specular[2], v->specular[3]);
#endif
- _mesa_debug("fog %f\n", v->fog);
- _mesa_debug("index %d\n", v->index);
- _mesa_debug("pointsize %f\n", v->pointSize);
- _mesa_debug("\n");
+ _mesa_debug(ctx, "fog %f\n", v->fog);
+ _mesa_debug(ctx, "index %d\n", v->index);
+ _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
+ _mesa_debug(ctx, "\n");
}
}
-/* $Id: s_drawpix.c,v 1.33 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.34 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Fog.Enabled)
_mesa_span_default_fog(ctx, span);
+ if (ctx->Texture._ReallyEnabled)
+ _mesa_span_default_texcoords(ctx, span);
if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
_mesa_span_default_z(ctx, span);
if (ctx->Fog.Enabled)
_mesa_span_default_fog(ctx, span);
+ if (ctx->Texture._ReallyEnabled)
+ _mesa_span_default_texcoords(ctx, span);
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
&& x + width <= (GLint) ctx->DrawBuffer->Width
SWcontext *swrast = SWRAST_CONTEXT(ctx);
(void) unpack;
-
if (swrast->NewState)
_swrast_validate_derived( ctx );
RENDER_START(swrast,ctx);
+
switch (format) {
case GL_STENCIL_INDEX:
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
RENDER_FINISH(swrast,ctx);
}
+
+
+
+#if 0 /* experimental */
+/*
+ * Execute glDrawDepthPixelsMESA().
+ */
+void
+_swrast_DrawDepthPixelsMESA( GLcontext *ctx,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum colorFormat, GLenum colorType,
+ const GLvoid *colors,
+ GLenum depthType, const GLvoid *depths,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ (void) unpack;
+
+ if (swrast->NewState)
+ _swrast_validate_derived( ctx );
+
+ RENDER_START(swrast,ctx);
+
+ switch (colorFormat) {
+ case GL_COLOR_INDEX:
+ if (ctx->Visual.rgbMode)
+ draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, colors);
+ else
+ draw_index_pixels(ctx, x, y, width, height, colorType, colors);
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, colors);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM,
+ "glDrawDepthPixelsMESA(colorFormat)" );
+ }
+
+ RENDER_FINISH(swrast,ctx);
+}
+#endif
-/* $Id: s_span.c,v 1.42 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: s_span.c,v 1.43 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
+/**
+ * Init span's texcoord interpolation values to the RasterPos texcoords.
+ * Used during setup for glDraw/CopyPixels.
+ */
+void
+_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span )
+{
+ GLuint i;
+ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ span->tex[i][0] = ctx->Current.RasterTexCoords[i][0];
+ span->tex[i][1] = ctx->Current.RasterTexCoords[i][1];
+ span->tex[i][2] = ctx->Current.RasterTexCoords[i][2];
+ span->tex[i][3] = ctx->Current.RasterTexCoords[i][3];
+ span->texStepX[i][0] = 0.0;
+ span->texStepX[i][1] = 0.0;
+ span->texStepX[i][2] = 0.0;
+ span->texStepX[i][3] = 0.0;
+ }
+ span->interpMask |= SPAN_TEXTURE;
+}
+
+
/* Fill in the span.color.rgba array from the interpolation values */
static void
interpolate_colors(GLcontext *ctx, struct sw_span *span)
-/* $Id: s_span.h,v 1.16 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_span.h,v 1.17 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
extern void
_mesa_span_default_color( GLcontext *ctx, struct sw_span *span );
+extern void
+_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span );
extern void
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span);
-/* $Id: ss_vb.c,v 1.17 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: ss_vb.c,v 1.18 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "glheader.h"
#include "colormac.h"
+#include "context.h"
#include "macros.h"
#include "mem.h"
* Initialization
***********************************************************************/
-
-
-
-
static void
emit_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
{
- _mesa_debug("swrast_setup: invalid setup function\n");
+ _mesa_debug(ctx, "swrast_setup: invalid setup function\n");
(void) (ctx && start && end && newinputs);
}
+
static void
interp_invalid( GLcontext *ctx, GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
{
- _mesa_debug("swrast_setup: invalid interp function\n");
+ _mesa_debug(ctx, "swrast_setup: invalid interp function\n");
(void) (ctx && t && edst && eout && ein && force_boundary);
}
+
static void
copy_pv_invalid( GLcontext *ctx, GLuint edst, GLuint esrc )
{
- _mesa_debug("swrast_setup: invalid copy_pv function\n");
+ _mesa_debug(ctx, "swrast_setup: invalid copy_pv function\n");
(void) (ctx && edst && esrc );
}
+
static void init_standard( void )
{
GLuint i;
init_index_fog_point();
}
-static void printSetupFlags(char *msg, GLuint flags )
+
+/* debug only */
+static void
+printSetupFlags(const GLcontext *ctx, char *msg, GLuint flags )
{
- _mesa_debug("%s(%x): %s%s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & COLOR) ? "color, " : "",
- (flags & INDEX) ? "index, " : "",
- (flags & TEX0) ? "tex0, " : "",
- (flags & MULTITEX) ? "multitex, " : "",
- (flags & SPEC) ? "spec, " : "",
- (flags & FOG) ? "fog, " : "",
- (flags & POINT) ? "point, " : "");
+ _mesa_debug(ctx, "%s(%x): %s%s%s%s%s%s%s\n",
+ msg,
+ (int) flags,
+ (flags & COLOR) ? "color, " : "",
+ (flags & INDEX) ? "index, " : "",
+ (flags & TEX0) ? "tex0, " : "",
+ (flags & MULTITEX) ? "multitex, " : "",
+ (flags & SPEC) ? "spec, " : "",
+ (flags & FOG) ? "fog, " : "",
+ (flags & POINT) ? "point, " : "");
}
-
void
_swsetup_choose_rastersetup_func(GLcontext *ctx)
{
{
(void) ctx;
init_standard();
- (void) printSetupFlags;
+ /*
+ printSetupFlags(ctx);
+ */
}
-/* $Id: t_imm_api.c,v 1.28 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: t_imm_api.c,v 1.29 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
- _mesa_debug("_tnl_flush_immediate IM: %d compiling: %d\n",
+ _mesa_debug(ctx, "_tnl_flush_immediate IM: %d compiling: %d\n",
IM->id, ctx->CompileFlag);
if (IM->FlushElt == FLUSH_ELT_EAGER) {
struct immediate *IM = TNL_CURRENT_IM(ctx);
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
- _mesa_debug("_tnl_flush_vertices flags %x IM(%d) %d..%d Flag[%d]: %x\n",
+ _mesa_debug(ctx,
+ "_tnl_flush_vertices flags %x IM(%d) %d..%d Flag[%d]: %x\n",
flags, IM->id, IM->Start, IM->Count, IM->Start,
IM->Flag[IM->Start]);
if (IM->Flag[IM->Start])
- if ((flags & FLUSH_UPDATE_CURRENT) || IM->Count > IM->Start)
+ if ((flags & FLUSH_UPDATE_CURRENT) ||
+ IM->Count > IM->Start ||
+ (IM->Flag[IM->Start] & (VERT_BEGIN|VERT_END)))
_tnl_flush_immediate( ctx, IM );
}
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint inflags, state;
-/* _mesa_debug("%s: before: %x\n", __FUNCTION__, IM->BeginState); */
+/* _mesa_debug(ctx, "%s: before: %x\n", __FUNCTION__, IM->BeginState); */
if (mode > GL_POLYGON) {
_mesa_compile_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" );
if (ctx->NewState)
_mesa_update_state(ctx);
+#if 000
/* if only a very few slots left, might as well flush now
*/
if (IM->Count > IMM_MAXDATA-8) {
_tnl_flush_immediate( ctx, IM );
IM = TNL_CURRENT_IM(ctx);
}
+#endif
/* Check for and flush buffered vertices from internal operations.
*/
ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
IM->BeginState = state;
- if (ctx->ExecuteFlag) {
- if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_Begin" );
- }
- else
- ctx->Driver.CurrentExecPrimitive = mode;
- }
-
-
- /* Update save_primitive now.
+ /* Update save_primitive now. Don't touch ExecPrimitive as this is
+ * updated in the replay of this cassette if we are in
+ * COMPILE_AND_EXECUTE mode.
*/
if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN)
ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
if (IM->Start == IM->Count &&
tnl->Driver.NotifyBegin &&
- tnl->Driver.NotifyBegin( ctx, mode ))
+ tnl->Driver.NotifyBegin( ctx, mode )) {
return;
+ }
assert( IM->SavedBeginState == 0 );
assert( IM->BeginState == 0 );
IM->LastPrimitive = count;
IM->BeginState = (VERT_BEGIN_0|VERT_BEGIN_1);
-/* _mesa_debug("%s: %x\n", __FUNCTION__, IM->BeginState); */
+/* _mesa_debug(ctx, "%s: %x\n", __FUNCTION__, IM->BeginState); */
ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
ctx->Driver.CurrentExecPrimitive = mode;
GLboolean
_tnl_hard_begin( GLcontext *ctx, GLenum p )
{
-/* _mesa_debug("%s\n", __FUNCTION__); */
+/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */
if (!ctx->CompileFlag) {
/* If not compiling, treat as a normal begin().
*/
-/* _mesa_debug("%s: treating as glBegin\n", __FUNCTION__); */
+/* _mesa_debug(ctx, "%s: treating as glBegin\n", __FUNCTION__); */
glBegin( p );
return GL_TRUE;
}
IM->BeginState = state;
- if (ctx->ExecuteFlag) {
+ if (!ctx->CompileFlag) {
if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END)
_mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_End" );
else
/* You can set this flag to get the old 'flush_vb on glEnd()'
* behaviour.
*/
- /* XXXX tempory change here */
- if (1 /*(MESA_DEBUG_FLAGS&DEBUG_ALWAYS_FLUSH)*/ )
+ if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_tnl_flush_immediate( ctx, IM );
}
return;
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug("_tnl_Materialfv\n");
+ _mesa_debug(ctx, "_tnl_Materialfv\n");
if (tnl->IsolateMaterials &&
!(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
-/* $Id: t_imm_dlist.c,v 1.41 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.42 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLuint new_beginstate;
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
- _mesa_debug("_tnl_compiled_cassette IM: %d\n", IM->id);
+ _mesa_debug(ctx, "_tnl_compiled_cassette IM: %d\n", IM->id);
if (IM->FlushElt) {
ASSERT (IM->FlushElt == FLUSH_ELT_LAZY);
_tnl_print_cassette( IM );
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) {
- _mesa_debug("Run cassette %d, rows %d..%d, beginstate %x ",
+ _mesa_debug(ctx, "Run cassette %d, rows %d..%d, beginstate %x ",
IM->id, IM->Start, IM->Count, IM->BeginState);
_tnl_print_vert_flags("orflag", IM->OrFlag);
}
TNLvertexcassette *node = (TNLvertexcassette *)data;
struct immediate *IM = node->IM;
- _mesa_debug("TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n",
+ _mesa_debug(ctx, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n",
node->IM->id, node->Start, node->Count);
IM->Start = node->Start;
-/* $Id: t_imm_elt.c,v 1.17 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: t_imm_elt.c,v 1.18 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLuint translate = ctx->Array._Enabled;
GLuint i;
- if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- _mesa_debug("exec_array_elements %d .. %d\n", start, count);
+ if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
+ _mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count);
if (translate & VERT_BIT_POS) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
-/* $Id: t_imm_exec.c,v 1.40 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.41 2002/06/15 02:38:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
MEMSET(IM->Flag + start, 0, sizeof(GLuint) * (IM->Count+2-start));
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
- _mesa_debug("reset_input: IM(%d) new %x\n", IM->id, beginstate);
+ _mesa_debug(ctx, "reset_input: IM(%d) new %x\n", IM->id, beginstate);
IM->Start = start;
IM->Count = start;