Sfoglia il codice sorgente

First batch of OpenGL SI related changes:

Renamed struct gl_context to struct __GLcontextRec.
Include glcore.h, setup GL imports/exports.
Replaced gl_ prefix with _mesa_ prefix in context.[ch] functions.
GLcontext's Visual field is no longer a pointer.
tags/mesa_3_5
Brian Paul 26 anni fa
parent
commit
b1394fa92a
43 ha cambiato i file con 836 aggiunte e 597 eliminazioni
  1. 2
    1
      src/mesa/Makefile.X11
  2. 56
    56
      src/mesa/drivers/allegro/amesa.c
  3. 27
    14
      src/mesa/drivers/beos/GLView.cpp
  4. 34
    34
      src/mesa/drivers/d3d/WGL.C
  5. 29
    23
      src/mesa/drivers/dos/dosmesa.c
  6. 21
    18
      src/mesa/drivers/ggi/ggimesa.c
  7. 23
    23
      src/mesa/drivers/glide/fxapi.c
  8. 1
    1
      src/mesa/drivers/glide/fxdd.c
  9. 18
    18
      src/mesa/drivers/osmesa/osmesa.c
  10. 26
    26
      src/mesa/drivers/svga/svgamesa.c
  11. 19
    19
      src/mesa/drivers/windows/wmesa.c
  12. 18
    17
      src/mesa/drivers/windows/wmesa_stereo.c
  13. 26
    26
      src/mesa/drivers/x11/xm_api.c
  14. 2
    2
      src/mesa/drivers/x11/xm_line.c
  15. 3
    3
      src/mesa/drivers/x11/xm_tri.c
  16. 2
    2
      src/mesa/drivers/x11/xmesaP.h
  17. 2
    1
      src/mesa/main/Makefile.X11
  18. 4
    4
      src/mesa/main/accum.c
  19. 2
    2
      src/mesa/main/attrib.c
  20. 27
    28
      src/mesa/main/buffers.c
  21. 2
    2
      src/mesa/main/clip.c
  22. 5
    5
      src/mesa/main/config.h
  23. 117
    92
      src/mesa/main/context.c
  24. 20
    38
      src/mesa/main/context.h
  25. 15
    15
      src/mesa/main/depth.c
  26. 2
    2
      src/mesa/main/dlist.c
  27. 15
    15
      src/mesa/main/drawpix.c
  28. 9
    9
      src/mesa/main/enable.c
  29. 9
    9
      src/mesa/main/feedback.c
  30. 2
    2
      src/mesa/main/fog.c
  31. 61
    61
      src/mesa/main/get.c
  32. 7
    1
      src/mesa/main/glheader.h
  33. 4
    4
      src/mesa/main/image.c
  34. 163
    0
      src/mesa/main/imports.c
  35. 39
    0
      src/mesa/main/imports.h
  36. 2
    2
      src/mesa/main/light.c
  37. 2
    2
      src/mesa/main/lines.c
  38. 5
    5
      src/mesa/main/matrix.c
  39. 2
    2
      src/mesa/main/points.c
  40. 3
    3
      src/mesa/main/polygon.c
  41. 4
    4
      src/mesa/main/rastpos.c
  42. 4
    4
      src/mesa/main/state.c
  43. 2
    2
      src/mesa/main/stencil.c

+ 2
- 1
src/mesa/Makefile.X11 Vedi File

# $Id: Makefile.X11,v 1.23 2000/09/26 15:27:23 brianp Exp $
# $Id: Makefile.X11,v 1.24 2000/09/26 20:53:53 brianp Exp $


# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.5 # Version: 3.5
hint.c \ hint.c \
image.c \ image.c \
imaging.c \ imaging.c \
imports.c \
light.c \ light.c \
lines.c \ lines.c \
logic.c \ logic.c \

+ 56
- 56
src/mesa/drivers/allegro/amesa.c Vedi File

visual->DBFlag = dbFlag; visual->DBFlag = dbFlag;
visual->Depth = depth; visual->Depth = depth;
visual->GLVisual = gl_create_visual(GL_TRUE, /* rgb mode */
GL_TRUE, /* software alpha */
dbFlag, /* db_flag */
GL_FALSE, /* stereo */
depthSize, /* depth bits */
stencilSize,/* stencil bits */
accumSize, /* accum bits */
0, /* index bits */
redBits, greenBits, blueBits, 0);
visual->GLVisual = _mesa_create_visual(GL_TRUE, /* rgb mode */
dbFlag, /* db_flag */
GL_FALSE, /* stereo */
redBits, greenBits, blueBits, 8,
0, /* index bits */
depthSize, /* depth bits */
stencilSize,/* stencil bits */
accumSize, /* accum bits */
accumSize, /* accum bits */
accumSize, /* accum bits */
accumSize, /* accum bits */
1 );
if (!visual->GLVisual) if (!visual->GLVisual)
{ {
free(visual); free(visual);
void AMesaDestroyVisual(AMesaVisual visual) void AMesaDestroyVisual(AMesaVisual visual)
{ {
gl_destroy_visual(visual->GLVisual);
free(visual);
_mesa_destroy_visual(visual->GLVisual);
free(visual);
} }
} }
} }
buffer->GLBuffer = gl_create_framebuffer(visual->GLVisual);
buffer->GLBuffer = _mesa_create_framebuffer(visual->GLVisual);
if (!buffer->GLBuffer) if (!buffer->GLBuffer)
{ {
if (buffer->Background) destroy_bitmap(buffer->Background); if (buffer->Background) destroy_bitmap(buffer->Background);
void AMesaDestroyBuffer(AMesaBuffer buffer) void AMesaDestroyBuffer(AMesaBuffer buffer)
{
if (buffer->Screen) destroy_bitmap(buffer->Screen);
if (buffer->Background) destroy_bitmap(buffer->Background);
gl_destroy_framebuffer(buffer->GLBuffer);
free(buffer);
}
{
if (buffer->Screen) destroy_bitmap(buffer->Screen);
if (buffer->Background) destroy_bitmap(buffer->Background);
_mesa_destroy_framebuffer(buffer->GLBuffer);
free(buffer);
}
AMesaContext AMesaCreateContext(AMesaVisual visual, AMesaContext AMesaCreateContext(AMesaVisual visual,
context->Buffer = NULL; context->Buffer = NULL;
context->ClearColor = 0; context->ClearColor = 0;
context->CurrentColor = 0; context->CurrentColor = 0;
context->GLContext = gl_create_context(visual->GLVisual,
context->GLContext = _mesa_create_context(visual->GLVisual,
share ? share->GLContext : NULL, share ? share->GLContext : NULL,
(void*)context, (void*)context,
direct); direct);
void AMesaDestroyContext(AMesaContext context) void AMesaDestroyContext(AMesaContext context)
{
gl_destroy_context(context->GLContext);
free(context);
}
{
_mesa_destroy_context(context->GLContext);
free(context);
}
GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer) GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer)
{
if (context && buffer)
{
set_color_depth(context->Visual->Depth);
if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0)
return GL_FALSE;
context->Buffer = buffer;
buffer->Screen = screen;
buffer->Active = buffer->Background ? buffer->Background : screen;
{
if (context && buffer) {
set_color_depth(context->Visual->Depth);
if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0)
return GL_FALSE;
context->Buffer = buffer;
buffer->Screen = screen;
buffer->Active = buffer->Background ? buffer->Background : screen;
setup_dd_pointers(context->GLContext);
gl_make_current(context->GLContext, buffer->GLBuffer);
gl_Viewport(context->GLContext, 0, 0, buffer->Width, buffer->Height);
}
else
{
destroy_bitmap(context->Buffer->Screen);
context->Buffer->Screen = NULL;
context->Buffer->Active = NULL;
context->Buffer = NULL;
gl_make_current(NULL, NULL);
}
return GL_TRUE;
}
setup_dd_pointers(context->GLContext);
_mesa_make_current(context->GLContext, buffer->GLBuffer);
gl_Viewport(context->GLContext, 0, 0, buffer->Width, buffer->Height);
}
else {
destroy_bitmap(context->Buffer->Screen);
context->Buffer->Screen = NULL;
context->Buffer->Active = NULL;
context->Buffer = NULL;
_mesa_make_current(NULL, NULL);
}
return GL_TRUE;
}
void AMesaSwapBuffers(AMesaBuffer buffer) void AMesaSwapBuffers(AMesaBuffer buffer)
{
if (buffer->Background)
{
blit(buffer->Background, buffer->Screen,
0, 0, 0, 0,
buffer->Width, buffer->Height);
}
}
{
if (buffer->Background) {
blit(buffer->Background, buffer->Screen,
0, 0, 0, 0,
buffer->Width, buffer->Height);
}
}

+ 27
- 14
src/mesa/drivers/beos/GLView.cpp Vedi File

/* $Id: GLView.cpp,v 1.2 2000/03/19 01:13:13 brianp Exp $ */
/* $Id: GLView.cpp,v 1.3 2000/09/26 20:54:09 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.5
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),


/* /*
* $Log: GLView.cpp,v $ * $Log: GLView.cpp,v $
* Revision 1.3 2000/09/26 20:54:09 brianp
* First batch of OpenGL SI related changes:
* Renamed struct gl_context to struct __GLcontextRec.
* Include glcore.h, setup GL imports/exports.
* Replaced gl_ prefix with _mesa_ prefix in context.[ch] functions.
* GLcontext's Visual field is no longer a pointer.
*
* Revision 1.2 2000/03/19 01:13:13 brianp * Revision 1.2 2000/03/19 01:13:13 brianp
* updated for Mesa 3.3 * updated for Mesa 3.3
* *
AuxInfo::~AuxInfo() AuxInfo::~AuxInfo()
{ {


gl_destroy_visual(mVisual);
gl_destroy_framebuffer(mBuffer);
gl_destroy_context(mContext);
_mesa_destroy_visual(mVisual);
_mesa_destroy_framebuffer(mBuffer);
_mesa_destroy_context(mContext);
} }




void AuxInfo::MakeCurrent() void AuxInfo::MakeCurrent()
{ {
UpdateState(mContext); UpdateState(mContext);
gl_make_current(mContext, mBuffer);
_mesa_make_current(mContext, mBuffer);
} }




AuxInfo *aux = new AuxInfo; AuxInfo *aux = new AuxInfo;


// examine option flags and create gl_context struct // examine option flags and create gl_context struct
GLvisual *visual = gl_create_visual( rgbFlag, alphaFlag,
dblFlag, stereoFlag,
depth, stencil, accum, index,
red, green, blue, alpha);
GLvisual *visual = _mesa__create_visual( rgbFlag,
dblFlag,
stereoFlag,
red, green, blue, alpha,
index,
depth,
stencil,
accum, accum, accum, accum,
1
);


// create core framebuffer // create core framebuffer
GLframebuffer *buffer = gl_create_framebuffer(visual,
GLframebuffer *buffer = _mesa_create_framebuffer(visual,
depth > 0 ? GL_TRUE : GL_FALSE, depth > 0 ? GL_TRUE : GL_FALSE,
stencil > 0 ? GL_TRUE: GL_FALSE, stencil > 0 ? GL_TRUE: GL_FALSE,
accum > 0 ? GL_TRUE : GL_FALSE, accum > 0 ? GL_TRUE : GL_FALSE,


// create core context // create core context
const GLboolean direct = GL_TRUE; const GLboolean direct = GL_TRUE;
GLcontext *ctx = gl_create_context( visual, NULL, aux, direct );
GLcontext *ctx = _mesa_create_context( visual, NULL, aux, direct );


aux->Init(this, ctx, visual, buffer ); aux->Init(this, ctx, visual, buffer );


{ {
AuxInfo *aux = (AuxInfo *) m_gc; AuxInfo *aux = (AuxInfo *) m_gc;
assert(aux); assert(aux);
// Could call gl_make_current(NULL, NULL) but it would just
// Could call _mesa_make_current(NULL, NULL) but it would just
// hinder performance // hinder performance
} }



+ 34
- 34
src/mesa/drivers/d3d/WGL.C Vedi File

/*========================================================================*/ /*========================================================================*/
/* Do all core Mesa stuff. */ /* Do all core Mesa stuff. */
/*========================================================================*/ /*========================================================================*/
pD3DDefault->gl_visual = gl_create_visual( TRUE,
GL_FALSE, /* software alpha */
FALSE, /* db_flag */
GL_FALSE, /* stereo */
16, /* depth_bits */
8, /* stencil_bits */
8, /* accum_bits */
0, /* index bits */
8,8,8,8 ); /* r, g, b, a bits */
pD3DDefault->gl_visual = _mesa_create_visual( TRUE,
FALSE, /* db_flag */
GL_FALSE, /* stereo */
8,8,8,8, /* r, g, b, a bits */
0, /* index bits */
16, /* depth_bits */
8, /* stencil_bits */
8,8,8,8, /* accum_bits */
1 );
if ( pD3DDefault->gl_visual == NULL) if ( pD3DDefault->gl_visual == NULL)
{ {
} }
/* Allocate a new Mesa context */ /* Allocate a new Mesa context */
pD3DDefault->gl_ctx = gl_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE );
pD3DDefault->gl_ctx = _mesa_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE );
if ( pD3DDefault->gl_ctx == NULL ) if ( pD3DDefault->gl_ctx == NULL )
{ {
gl_destroy_visual( pD3DDefault->gl_visual );
_mesa_destroy_visual( pD3DDefault->gl_visual );
FREE( pD3DDefault ); FREE( pD3DDefault );
return FALSE; return FALSE;
} }
/* Allocate a new Mesa frame buffer */ /* Allocate a new Mesa frame buffer */
pD3DDefault->gl_buffer = gl_create_framebuffer( pD3DDefault->gl_visual );
pD3DDefault->gl_buffer = _mesa_create_framebuffer( pD3DDefault->gl_visual );
if ( pD3DDefault->gl_buffer == NULL ) if ( pD3DDefault->gl_buffer == NULL )
{ {
gl_destroy_visual( pD3DDefault->gl_visual );
gl_destroy_context( pD3DDefault->gl_ctx );
_mesa_destroy_visual( pD3DDefault->gl_visual );
_mesa_destroy_context( pD3DDefault->gl_ctx );
FREE( pD3DDefault ); FREE( pD3DDefault );
return FALSE; return FALSE;
} }
SetupDDPointers( pD3DDefault->gl_ctx ); SetupDDPointers( pD3DDefault->gl_ctx );
gl_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer );
_mesa_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer );
return TRUE; return TRUE;
} }
/*========================================================================*/ /*========================================================================*/
/* TODO: support more then one visual. */ /* TODO: support more then one visual. */
pNewContext->gl_visual = gl_create_visual( TRUE,
GL_TRUE, /* software alpha */
TRUE, /* db_flag */
GL_FALSE, /* stereo */
16, /* depth_bits */
8, /* stencil_bits */
8, /* accum_bits */
0, /* index bits */
8,8,8,8 ); /* r, g, b, a bits */
pNewContext->gl_visual = _mesa_create_visual( TRUE,
TRUE, /* db_flag */
GL_FALSE, /* stereo */
8,8,8,8, /* r, g, b, a bits */
0, /* index bits */
16, /* depth_bits */
8, /* stencil_bits */
16,16,16,16,/* accum_bits */
1 );
if ( pNewContext->gl_visual == NULL) if ( pNewContext->gl_visual == NULL)
{ {
FREE( pNewContext ); FREE( pNewContext );
} }
/* Allocate a new Mesa context */ /* Allocate a new Mesa context */
pNewContext->gl_ctx = gl_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE );
pNewContext->gl_ctx = _mesa_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE );
if ( pNewContext->gl_ctx == NULL ) if ( pNewContext->gl_ctx == NULL )
{ {
gl_destroy_visual( pNewContext->gl_visual );
_mesa_destroy_visual( pNewContext->gl_visual );
FREE( pNewContext ); FREE( pNewContext );
SetLastError( 0 ); SetLastError( 0 );
return (HGLRC)NULL; return (HGLRC)NULL;
} }
/* Allocate a new Mesa frame buffer */ /* Allocate a new Mesa frame buffer */
pNewContext->gl_buffer = gl_create_framebuffer( pNewContext->gl_visual );
pNewContext->gl_buffer = _mesa_create_framebuffer( pNewContext->gl_visual );
if ( pNewContext->gl_buffer == NULL ) if ( pNewContext->gl_buffer == NULL )
{ {
gl_destroy_visual( pNewContext->gl_visual );
gl_destroy_context( pNewContext->gl_ctx );
_mesa_destroy_visual( pNewContext->gl_visual );
_mesa_destroy_context( pNewContext->gl_ctx );
FREE( pNewContext ); FREE( pNewContext );
SetLastError( 0 ); SetLastError( 0 );
return (HGLRC)NULL; return (HGLRC)NULL;
/* Let Mesa-3.0 we have a new context. */ /* Let Mesa-3.0 we have a new context. */
/*=====================================*/ /*=====================================*/
SetupDDPointers( pContext->gl_ctx ); SetupDDPointers( pContext->gl_ctx );
gl_make_current( pContext->gl_ctx, pContext->gl_buffer );
_mesa_make_current( pContext->gl_ctx, pContext->gl_buffer );
/* We are done so set the internal current context. */ /* We are done so set the internal current context. */
if ( pContext != pD3DDefault ) if ( pContext != pD3DDefault )
/* Update Mesa as we might have changed from SW <-> HW. */ /* Update Mesa as we might have changed from SW <-> HW. */
SetupDDPointers( pContext->gl_ctx ); SetupDDPointers( pContext->gl_ctx );
gl_make_current( pContext->gl_ctx, pContext->gl_buffer );
_mesa_make_current( pContext->gl_ctx, pContext->gl_buffer );
/* If we are in HW we need to load the current texture if there is one already. */ /* If we are in HW we need to load the current texture if there is one already. */
// if ( (ctx->Texture.Set[ctx->Texture.CurrentSet].Current != NULL) && // if ( (ctx->Texture.Set[ctx->Texture.CurrentSet].Current != NULL) &&
/* Free the Mesa stuff. */ /* Free the Mesa stuff. */
if ( pContext->gl_visual ) if ( pContext->gl_visual )
{ {
gl_destroy_visual( pContext->gl_visual );
_mesa_destroy_visual( pContext->gl_visual );
pContext->gl_visual = NULL; pContext->gl_visual = NULL;
} }
if ( pContext->gl_buffer ) if ( pContext->gl_buffer )
{ {
gl_destroy_framebuffer( pContext->gl_buffer );
_mesa_destroy_framebuffer( pContext->gl_buffer );
pContext->gl_buffer = NULL; pContext->gl_buffer = NULL;
} }
if ( pContext->gl_ctx ) if ( pContext->gl_ctx )
{ {
gl_destroy_context( pContext->gl_ctx );
_mesa_destroy_context( pContext->gl_ctx );
pContext->gl_ctx = NULL; pContext->gl_ctx = NULL;
} }

+ 29
- 23
src/mesa/drivers/dos/dosmesa.c Vedi File

/* $Id: dosmesa.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: dosmesa.c,v 1.2 2000/09/26 20:54:10 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
/* /*
* $Log: dosmesa.c,v $ * $Log: dosmesa.c,v $
* Revision 1.1 1999/08/19 00:55:41 jtg
* Initial revision
* Revision 1.2 2000/09/26 20:54:10 brianp
* First batch of OpenGL SI related changes:
* Renamed struct gl_context to struct __GLcontextRec.
* Include glcore.h, setup GL imports/exports.
* Replaced gl_ prefix with _mesa_ prefix in context.[ch] functions.
* GLcontext's Visual field is no longer a pointer.
*
* Revision 1.1.1.1 1999/08/19 00:55:41 jtg
* Imported sources
* *
* Revision 1.2 1999/03/28 21:11:57 brianp * Revision 1.2 1999/03/28 21:11:57 brianp
* updated SetBuffer driver function * updated SetBuffer driver function
return NULL; return NULL;
} }
ctx->gl_vis = gl_create_visual( rgb_flag,
alpha_flag,
db_flag,
16, /* depth_size */
8, /* stencil_size */
16, /* accum_size */
index_bits,
redscale,
greenscale,
bluescale,
alphascale,
redbits, greenbits,
bluebits, alphabits);
ctx->gl_ctx = gl_create_context( ctx->gl_vis,
ctx->gl_vis = _mesa_create_visual( rgb_flag,
db_flag,
GL_FALSE, /* stereo */
redbits,
greenbits,
bluebits,
alphabits,
index_bits,
16, /* depth_size */
8, /* stencil_size */
16, 16, 16, 16, /* accum_size */
1 );
ctx->gl_ctx = _mesa_create_context( ctx->gl_vis,
NULL, /* share list context */ NULL, /* share list context */
(void *) ctx (void *) ctx
); );
ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis );
ctx->gl_buffer = _mesa_create_framebuffer( ctx->gl_vis );
ctx->index = 1; ctx->index = 1;
ctx->red = ctx->green = ctx->blue = 255; ctx->red = ctx->green = ctx->blue = 255;
void DOSMesaDestroyContext( DOSMesaContext ctx ) void DOSMesaDestroyContext( DOSMesaContext ctx )
{ {
if (ctx) { if (ctx) {
gl_destroy_visual( ctx->gl_vis );
gl_destroy_context( ctx->gl_ctx );
gl_destroy_framebuffer( ctx->gl_buffer );
_mesa_destroy_visual( ctx->gl_vis );
_mesa_destroy_context( ctx->gl_ctx );
_mesa_destroy_framebuffer( ctx->gl_buffer );
free( ctx ); free( ctx );
if (ctx==DOSMesa) { if (ctx==DOSMesa) {
DOSMesa = NULL; DOSMesa = NULL;
void DOSMesaMakeCurrent( DOSMesaContext ctx ) void DOSMesaMakeCurrent( DOSMesaContext ctx )
{ {
DOSMesa = ctx; DOSMesa = ctx;
gl_make_current( ctx->gl_ctx, ctx->gl_buffer );
_mesa_make_current( ctx->gl_ctx, ctx->gl_buffer );
DOSmesa_setup_DD_pointers( ctx->gl_ctx ); DOSmesa_setup_DD_pointers( ctx->gl_ctx );
if (ctx->width==0 || ctx->height==0) { if (ctx->width==0 || ctx->height==0) {

+ 21
- 18
src/mesa/drivers/ggi/ggimesa.c Vedi File

ctx->viewport_init = GL_FALSE; ctx->viewport_init = GL_FALSE;
ctx->gl_vis->DBflag = GL_FALSE; ctx->gl_vis->DBflag = GL_FALSE;


ctx->gl_ctx = gl_create_context(ctx->gl_vis, NULL, (void *)ctx, GL_TRUE);
ctx->gl_ctx = _mesa_create_context(ctx->gl_vis, NULL, (void *)ctx, GL_TRUE);
if (!ctx->gl_ctx) if (!ctx->gl_ctx)
return NULL; return NULL;
{ {
if (ctx) if (ctx)
{ {
gl_destroy_visual(ctx->gl_vis);
gl_destroy_context(ctx->gl_ctx);
gl_destroy_framebuffer(ctx->gl_buffer);
_mesa_destroy_visual(ctx->gl_vis);
_mesa_destroy_context(ctx->gl_ctx);
_mesa_destroy_framebuffer(ctx->gl_buffer);
if (ctx == GGIMesa) if (ctx == GGIMesa)
GGIMesa = NULL; GGIMesa = NULL;
if (ctx->ggi_vis) if (ctx->ggi_vis)
changed(vis, GGI_CHG_APILIST); changed(vis, GGI_CHG_APILIST);
if (ctx->gl_vis) if (ctx->gl_vis)
gl_destroy_visual(ctx->gl_vis);
_mesa_destroy_visual(ctx->gl_vis);


if (ctx->gl_buffer) if (ctx->gl_buffer)
gl_destroy_framebuffer(ctx->gl_buffer); gl_destroy_framebuffer(ctx->gl_buffer);
if (err) if (err)
return -1; return -1;


ctx->gl_vis = gl_create_visual(info.rgb_flag,
info.alpha_flag,
info.db_flag,
GL_FALSE,
info.depth_bits,
info.stencil_bits,
info.accum_bits,
info.index_bits,
info.red_bits, info.green_bits,
info.blue_bits, info.alpha_bits);
ctx->gl_vis = _mesa_create_visual(info.rgb_flag,
info.db_flag,
GL_FALSE, /*stereo*/
info.red_bits, info.green_bits,
info.blue_bits, info.alpha_bits,
info.index_bits,
info.depth_bits,
info.stencil_bits,
info.accum_bits,
info.accum_bits,
info.accum_bits,
info.accum_bits,
1);
if (!ctx->gl_vis) if (!ctx->gl_vis)
{ {
fprintf(stderr, "Can't create gl_visual!\n"); fprintf(stderr, "Can't create gl_visual!\n");
return -1; return -1;
} }


ctx->gl_buffer = gl_create_framebuffer(ctx->gl_vis,
ctx->gl_buffer = _mesa_create_framebuffer(ctx->gl_vis,
ctx->gl_vis->DepthBits > 0, ctx->gl_vis->DepthBits > 0,
ctx->gl_vis->StencilBits > 0, ctx->gl_vis->StencilBits > 0,
ctx->gl_vis->AccumRedBits > 0, ctx->gl_vis->AccumRedBits > 0,
ctx->gl_ctx->Color.DrawBuffer = (db_flag) ? GL_BACK : GL_FRONT; ctx->gl_ctx->Color.DrawBuffer = (db_flag) ? GL_BACK : GL_FRONT;


if (GGIMesa == ctx) if (GGIMesa == ctx)
gl_make_current(ctx->gl_ctx, ctx->gl_buffer);
_mesa_make_current(ctx->gl_ctx, ctx->gl_buffer);


if (rgb_flag && mode.graphtype==GT_8BIT) if (rgb_flag && mode.graphtype==GT_8BIT)
{ {
return; return;
GGIMesa = ctx; GGIMesa = ctx;
gl_make_current(ctx->gl_ctx, ctx->gl_buffer);
_mesa_make_current(ctx->gl_ctx, ctx->gl_buffer);
if (!ctx->viewport_init) if (!ctx->viewport_init)
{ {

+ 23
- 23
src/mesa/drivers/glide/fxapi.c Vedi File

fprintf(stderr,"Voodoo Glide screen size: %dx%d\n", fprintf(stderr,"Voodoo Glide screen size: %dx%d\n",
(int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight()); (int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight());


fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */
alphaBuffer,
doubleBuffer,
GL_FALSE, /* stereo */
depthSize, /* depth_size */
stencilSize, /* stencil_size */
accumSize, /* accum_size */
0, /* index bits */
5,6,5,0); /* RGBA bits */
fxMesa->glVis=_mesa_create_visual(GL_TRUE, /* RGB mode */
doubleBuffer,
GL_FALSE, /* stereo */
5,6,5,0, /* RGBA bits */
0, /* index bits */
depthSize, /* depth_size */
stencilSize, /* stencil_size */
accumSize, accumSize, accumSize, accumSize,
1 );
if (!fxMesa->glVis) { if (!fxMesa->glVis) {
errorstr = "gl_create_visual";
errorstr = "_mesa_create_visual";
goto errorhandler; goto errorhandler;
} }


ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis,
ctx = fxMesa->glCtx=_mesa_create_context(fxMesa->glVis,
shareCtx, /* share list context */ shareCtx, /* share list context */
(void *) fxMesa, GL_TRUE); (void *) fxMesa, GL_TRUE);
if (!ctx) { if (!ctx) {
errorstr = "gl_create_context";
errorstr = "_mesa_create_context";
goto errorhandler; goto errorhandler;
} }


} }




fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis,
fxMesa->glBuffer=_mesa_create_framebuffer(fxMesa->glVis,
GL_FALSE, /* no software depth */ GL_FALSE, /* no software depth */
fxMesa->glVis->StencilBits > 0, fxMesa->glVis->StencilBits > 0,
fxMesa->glVis->AccumRedBits > 0, fxMesa->glVis->AccumRedBits > 0,
fxMesa->glVis->AlphaBits > 0 ); fxMesa->glVis->AlphaBits > 0 );
if (!fxMesa->glBuffer) { if (!fxMesa->glBuffer) {
errorstr = "gl_create_framebuffer";
errorstr = "_mesa_create_framebuffer";
goto errorhandler; goto errorhandler;
} }
if (fxMesa->fogTable) if (fxMesa->fogTable)
free(fxMesa->fogTable); free(fxMesa->fogTable);
if (fxMesa->glBuffer) if (fxMesa->glBuffer)
gl_destroy_framebuffer(fxMesa->glBuffer);
_mesa_destroy_framebuffer(fxMesa->glBuffer);
if (fxMesa->glVis) if (fxMesa->glVis)
gl_destroy_visual(fxMesa->glVis);
_mesa_destroy_visual(fxMesa->glVis);
if (fxMesa->glCtx) if (fxMesa->glCtx)
gl_destroy_context(fxMesa->glCtx);
_mesa_destroy_context(fxMesa->glCtx);
free(fxMesa); free(fxMesa);
} }
} }


if(fxMesa) { if(fxMesa) {
gl_destroy_visual(fxMesa->glVis);
gl_destroy_context(fxMesa->glCtx);
gl_destroy_framebuffer(fxMesa->glBuffer);
_mesa_destroy_visual(fxMesa->glVis);
_mesa_destroy_context(fxMesa->glCtx);
_mesa_destroy_framebuffer(fxMesa->glBuffer);


glbTotNumCtx--; glbTotNumCtx--;


} }


if(!fxMesa) { if(!fxMesa) {
gl_make_current(NULL,NULL);
_mesa_make_current(NULL,NULL);
fxMesaCurrentCtx=NULL; fxMesaCurrentCtx=NULL;


if (MESA_VERBOSE&VERBOSE_DRIVER) { if (MESA_VERBOSE&VERBOSE_DRIVER) {


/* if this context is already the current one, we can return early */ /* if this context is already the current one, we can return early */
if (fxMesaCurrentCtx == fxMesa if (fxMesaCurrentCtx == fxMesa
&& fxMesaCurrentCtx->glCtx == gl_get_current_context()) {
&& fxMesaCurrentCtx->glCtx == _mesa_get_current_context()) {
if (MESA_VERBOSE&VERBOSE_DRIVER) { if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaMakeCurrent(fxMesaCurrentCtx==fxMesa) End\n"); fprintf(stderr,"fxmesa: fxMesaMakeCurrent(fxMesaCurrentCtx==fxMesa) End\n");
} }
grSstSelect(fxMesa->board); grSstSelect(fxMesa->board);
grGlideSetState((GrState*)fxMesa->state); grGlideSetState((GrState*)fxMesa->state);


gl_make_current(fxMesa->glCtx,fxMesa->glBuffer);
_mesa_make_current(fxMesa->glCtx,fxMesa->glBuffer);


fxSetupDDPointers(fxMesa->glCtx); fxSetupDDPointers(fxMesa->glCtx);



+ 1
- 1
src/mesa/drivers/glide/fxdd.c Vedi File

fxMesa->glCtx->NrPipelineStages); fxMesa->glCtx->NrPipelineStages);


/* Run the config file */ /* Run the config file */
gl_context_initialize( fxMesa->glCtx );
_mesa_context_initialize( fxMesa->glCtx );


return 1; return 1;
} }

+ 18
- 18
src/mesa/drivers/osmesa/osmesa.c Vedi File

/* $Id: osmesa.c,v 1.20 2000/09/08 16:41:39 brianp Exp $ */
/* $Id: osmesa.c,v 1.21 2000/09/26 20:54:12 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* *
* Note on thread safety: this driver is thread safe. All * Note on thread safety: this driver is thread safe. All
* functions are reentrant. The notion of current context is * functions are reentrant. The notion of current context is
* managed by the core gl_make_current() and gl_get_current_context()
* managed by the core _mesa_make_current() and _mesa_get_current_context()
* functions. Those functions are thread-safe. * functions. Those functions are thread-safe.
*/ */


gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map"); gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map");
gl_extensions_enable(&(osmesa->gl_ctx), "GL_EXT_texture_env_combine"); gl_extensions_enable(&(osmesa->gl_ctx), "GL_EXT_texture_env_combine");


osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual,
osmesa->gl_visual->DepthBits > 0,
osmesa->gl_visual->StencilBits > 0,
osmesa->gl_visual->AccumRedBits > 0,
osmesa->gl_visual->AlphaBits > 0 );
osmesa->gl_buffer = _mesa_create_framebuffer( osmesa->gl_visual,
osmesa->gl_visual->DepthBits > 0,
osmesa->gl_visual->StencilBits > 0,
osmesa->gl_visual->AccumRedBits > 0,
osmesa->gl_visual->AlphaBits > 0 );


if (!osmesa->gl_buffer) { if (!osmesa->gl_buffer) {
gl_destroy_visual( osmesa->gl_visual );
gl_free_context_data( &osmesa->gl_ctx );
_mesa_destroy_visual( osmesa->gl_visual );
_mesa_free_context_data( &osmesa->gl_ctx );
FREE(osmesa); FREE(osmesa);
return NULL; return NULL;
} }
void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ) void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx )
{ {
if (ctx) { if (ctx) {
gl_destroy_visual( ctx->gl_visual );
gl_destroy_framebuffer( ctx->gl_buffer );
gl_free_context_data( &ctx->gl_ctx );
_mesa_destroy_visual( ctx->gl_visual );
_mesa_destroy_framebuffer( ctx->gl_buffer );
_mesa_free_context_data( &ctx->gl_ctx );
FREE( ctx ); FREE( ctx );
} }
} }
} }


osmesa_update_state( &ctx->gl_ctx ); osmesa_update_state( &ctx->gl_ctx );
gl_make_current( &ctx->gl_ctx, ctx->gl_buffer );
_mesa_make_current( &ctx->gl_ctx, ctx->gl_buffer );


ctx->buffer = buffer; ctx->buffer = buffer;
ctx->width = width; ctx->width = width;


OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void )
{ {
GLcontext *ctx = gl_get_current_context();
GLcontext *ctx = _mesa_get_current_context();
if (ctx) if (ctx)
return (OSMesaContext) ctx; return (OSMesaContext) ctx;
else else
if (ctx->RasterMask==DEPTH_BIT if (ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_TRUE && ctx->Depth.Mask==GL_TRUE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS) {
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS) {
switch(osmesa->format) { switch(osmesa->format) {
case OSMESA_RGBA: case OSMESA_RGBA:
case OSMESA_BGRA: case OSMESA_BGRA:
if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT)
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_TRUE && ctx->Depth.Mask==GL_TRUE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Color.BlendSrcRGB==GL_SRC_ALPHA && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA
&& ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA
&& ctx->Color.BlendSrcA==GL_SRC_ALPHA && ctx->Color.BlendSrcA==GL_SRC_ALPHA
if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT)
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_FALSE && ctx->Depth.Mask==GL_FALSE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Color.BlendSrcRGB==GL_SRC_ALPHA && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA
&& ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA
&& ctx->Color.BlendSrcA==GL_SRC_ALPHA && ctx->Color.BlendSrcA==GL_SRC_ALPHA
if (ctx->RasterMask==DEPTH_BIT if (ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_TRUE && ctx->Depth.Mask==GL_TRUE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& osmesa->format!=OSMESA_COLOR_INDEX) { && osmesa->format!=OSMESA_COLOR_INDEX) {
if (ctx->Light.ShadeModel==GL_SMOOTH) { if (ctx->Light.ShadeModel==GL_SMOOTH) {
return smooth_rgba_z_triangle; return smooth_rgba_z_triangle;

+ 26
- 26
src/mesa/drivers/svga/svgamesa.c Vedi File

/* $Id: svgamesa.c,v 1.5 2000/03/31 01:07:14 brianp Exp $ */
/* $Id: svgamesa.c,v 1.6 2000/09/26 20:54:12 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#ifndef DEV #ifndef DEV
GLboolean rgb_flag; GLboolean rgb_flag;
GLfloat redscale, greenscale, bluescale, alphascale; GLfloat redscale, greenscale, bluescale, alphascale;
GLboolean alpha_flag = GL_FALSE;
GLint index_bits; GLint index_bits;
GLint redbits, greenbits, bluebits, alphabits; GLint redbits, greenbits, bluebits, alphabits;
/* determine if we're in RGB or color index mode */ /* determine if we're in RGB or color index mode */
return NULL; return NULL;
} }


ctx->gl_vis = gl_create_visual( rgb_flag,
alpha_flag,
doubleBuffer,
GL_FALSE, /* stereo */
16, /* depth_size */
8, /* stencil_size */
16, /* accum_size */
index_bits,
redbits, greenbits,
bluebits, alphabits );

ctx->gl_ctx = gl_create_context( ctx->gl_vis,
NULL, /* share list context */
(void *) ctx, GL_TRUE );

ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis,
ctx->gl_vis->DepthBits > 0,
ctx->gl_vis->StencilBits > 0,
ctx->gl_vis->AccumRedBits > 0,
ctx->gl_vis->AlphaBits > 0 );
ctx->gl_vis = _mesa_create_visual( rgb_flag,
doubleBuffer,
GL_FALSE, /* stereo */
redbits, greenbits,
bluebits, alphabits,
index_bits,
16, /* depth_size */
8, /* stencil_size */
16, 16, 16, 16, /* accum_size */
1 /* samples */
);

ctx->gl_ctx = _mesa_create_context( ctx->gl_vis,
NULL, /* share list context */
(void *) ctx, GL_TRUE );

ctx->gl_buffer = _mesa_create_framebuffer( ctx->gl_vis,
ctx->gl_vis->DepthBits > 0,
ctx->gl_vis->StencilBits > 0,
ctx->gl_vis->AccumRedBits > 0,
ctx->gl_vis->AlphaBits > 0 );


ctx->index = 1; ctx->index = 1;
ctx->red = ctx->green = ctx->blue = 255; ctx->red = ctx->green = ctx->blue = 255;
{ {
#ifndef DEV #ifndef DEV
if (ctx) { if (ctx) {
gl_destroy_visual( ctx->gl_vis );
gl_destroy_context( ctx->gl_ctx );
gl_destroy_framebuffer( ctx->gl_buffer );
_mesa_destroy_visual( ctx->gl_vis );
_mesa_destroy_context( ctx->gl_ctx );
_mesa_destroy_framebuffer( ctx->gl_buffer );
free( ctx ); free( ctx );
if (ctx==SVGAMesa) { if (ctx==SVGAMesa) {
SVGAMesa = NULL; SVGAMesa = NULL;
#ifndef DEV #ifndef DEV
SVGAMesa = ctx; SVGAMesa = ctx;
svgamesa_update_state( ctx->gl_ctx ); svgamesa_update_state( ctx->gl_ctx );
gl_make_current( ctx->gl_ctx, ctx->gl_buffer );
_mesa_make_current( ctx->gl_ctx, ctx->gl_buffer );


if (ctx->width==0 || ctx->height==0) { if (ctx->width==0 || ctx->height==0) {
/* setup initial viewport */ /* setup initial viewport */

+ 19
- 19
src/mesa/drivers/windows/wmesa.c Vedi File

/* $Id: wmesa.c,v 1.7 2000/09/12 15:46:43 brianp Exp $ */
/* $Id: wmesa.c,v 1.8 2000/09/26 20:54:13 brianp Exp $ */


/* /*
* Windows (Win32) device driver for Mesa 3.4 * Windows (Win32) device driver for Mesa 3.4
#endif #endif




c->gl_visual = gl_create_visual(rgb_flag,
GL_FALSE, /* software alpha */
db_flag, /* db_flag */
GL_FALSE, /* stereo */
16, /* depth_bits */
8, /* stencil_bits */
8, /* accum_bits */
0, /* index bits */
8,8,8,8 ); /* r, g, b, a bits */
c->gl_visual = _mesa_create_visual(rgb_flag,
db_flag, /* db_flag */
GL_FALSE, /* stereo */
8,8,8,8, /* r, g, b, a bits */
0, /* index bits */
16, /* depth_bits */
8, /* stencil_bits */
16,16,16,16,/* accum_bits */
1);


if (!c->gl_visual) { if (!c->gl_visual) {
return NULL; return NULL;
} }


/* allocate a new Mesa context */ /* allocate a new Mesa context */
c->gl_ctx = gl_create_context( c->gl_visual, NULL, c, GL_TRUE);
c->gl_ctx = _mesa_create_context( c->gl_visual, NULL, c, GL_TRUE);


if (!c->gl_ctx) { if (!c->gl_ctx) {
gl_destroy_visual( c->gl_visual );
_mesa_destroy_visual( c->gl_visual );
free(c); free(c);
return NULL; return NULL;
} }


c->gl_buffer = gl_create_framebuffer( c->gl_visual,
c->gl_buffer = _mesa_create_framebuffer( c->gl_visual,
c->gl_visual->DepthBits > 0, c->gl_visual->DepthBits > 0,
c->gl_visual->StencilBits > 0, c->gl_visual->StencilBits > 0,
c->gl_visual->AccumRedBits > 0, c->gl_visual->AccumRedBits > 0,
c->gl_visual->AlphaBits > 0 ); c->gl_visual->AlphaBits > 0 );
if (!c->gl_buffer) { if (!c->gl_buffer) {
gl_destroy_visual( c->gl_visual );
gl_destroy_context( c->gl_ctx );
_mesa_destroy_visual( c->gl_visual );
_mesa_destroy_context( c->gl_ctx );
free(c); free(c);
return NULL; return NULL;
} }
WC = c; WC = c;
if(c->hPalHalfTone != NULL) if(c->hPalHalfTone != NULL)
DeleteObject(c->hPalHalfTone); DeleteObject(c->hPalHalfTone);
gl_destroy_visual( c->gl_visual );
gl_destroy_framebuffer( c->gl_buffer );
gl_destroy_context( c->gl_ctx );
_mesa_destroy_visual( c->gl_visual );
_mesa_destroy_framebuffer( c->gl_buffer );
_mesa_destroy_context( c->gl_ctx );


if (c->db_flag) if (c->db_flag)
#ifdef DDRAW #ifdef DDRAW
return; return;


//gl_set_context( c->gl_ctx ); //gl_set_context( c->gl_ctx );
gl_make_current(c->gl_ctx, c->gl_buffer);
_mesa_make_current(c->gl_ctx, c->gl_buffer);
setup_DD_pointers(c->gl_ctx); setup_DD_pointers(c->gl_ctx);
Current = c; Current = c;
if (Current->gl_ctx->Viewport.Width==0) { if (Current->gl_ctx->Viewport.Width==0) {

+ 18
- 17
src/mesa/drivers/windows/wmesa_stereo.c Vedi File

c->gl_visual = gl_create_visual(rgb_flag,
GL_FALSE, /* software alpha */
db_flag, /* db_flag */
16, /* depth_bits */
8, /* stencil_bits */
8, /* accum_bits */
8,
255.0, 255.0, 255.0, 255.0 );
c->gl_visual = _mesa_create_visual(rgb_flag,
db_flag, /* db_flag */
GL_TRUE, /* stereo */
8, 8, 8, 8,/* rgba bits */
0, /* index bits */
16, /* depth_bits */
8, /* stencil_bits */
16,16,16,16,/* accum_bits */
1 );
if (!c->gl_visual) { if (!c->gl_visual) {
return NULL; return NULL;
} }
/* allocate a new Mesa context */ /* allocate a new Mesa context */
c->gl_ctx = gl_create_context( c->gl_visual, NULL,c);
c->gl_ctx = _mesa_create_context( c->gl_visual, NULL,c);
if (!c->gl_ctx) { if (!c->gl_ctx) {
gl_destroy_visual( c->gl_visual );
_mesa_destroy_visual( c->gl_visual );
free(c); free(c);
return NULL; return NULL;
} }
c->gl_buffer = gl_create_framebuffer( c->gl_visual );
c->gl_buffer = _mesa_create_framebuffer( c->gl_visual );
if (!c->gl_buffer) { if (!c->gl_buffer) {
gl_destroy_visual( c->gl_visual );
gl_destroy_context( c->gl_ctx );
_mesa_destroy_visual( c->gl_visual );
_mesa_destroy_context( c->gl_ctx );
free(c); free(c);
return NULL; return NULL;
} }
ReleaseDC(c->Window,c->hDC); ReleaseDC(c->Window,c->hDC);
WC = c; WC = c;
gl_destroy_visual( c->gl_visual );
gl_destroy_framebuffer( c->gl_buffer );
gl_destroy_context( c->gl_ctx );
_mesa_destroy_visual( c->gl_visual );
_mesa_destroy_framebuffer( c->gl_buffer );
_mesa_destroy_context( c->gl_ctx );
if (c->db_flag){ if (c->db_flag){
wmDeleteBackingStore(c); wmDeleteBackingStore(c);
return; return;
//gl_set_context( c->gl_ctx ); //gl_set_context( c->gl_ctx );
gl_make_current(c->gl_ctx, c->gl_buffer);
_mesa_make_current(c->gl_ctx, c->gl_buffer);
Current = c; Current = c;
setup_DD_pointers(c->gl_ctx); setup_DD_pointers(c->gl_ctx);
if (Current->gl_ctx->Viewport.Width==0) { if (Current->gl_ctx->Viewport.Width==0) {

+ 26
- 26
src/mesa/drivers/x11/xm_api.c Vedi File

/* $Id: xm_api.c,v 1.1 2000/09/07 15:40:30 brianp Exp $ */
/* $Id: xm_api.c,v 1.2 2000/09/26 20:54:13 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
return NULL; return NULL;
} }


c->gl_ctx = gl_create_context( v->gl_visual,
c->gl_ctx = _mesa_create_context( v->gl_visual,
share_list ? share_list->gl_ctx : (GLcontext *) NULL, share_list ? share_list->gl_ctx : (GLcontext *) NULL,
(void *) c, direct ); (void *) c, direct );
if (!c->gl_ctx) { if (!c->gl_ctx) {
#endif #endif


/* Run the config file */ /* Run the config file */
gl_context_initialize( c->gl_ctx );
_mesa_context_initialize( c->gl_ctx );


return c; return c;
} }
fxMesaDestroyContext(c->xm_buffer->FXctx); fxMesaDestroyContext(c->xm_buffer->FXctx);
#endif #endif
if (c->gl_ctx) if (c->gl_ctx)
gl_destroy_context( c->gl_ctx );
_mesa_destroy_context( c->gl_ctx );


/* Disassociate old buffer with this context */ /* Disassociate old buffer with this context */
if (c->xm_buffer) if (c->xm_buffer)
b->db_state = 0; b->db_state = 0;
} }


b->gl_buffer = gl_create_framebuffer( v->gl_visual,
v->gl_visual->DepthBits > 0,
v->gl_visual->StencilBits > 0,
v->gl_visual->AccumRedBits > 0,
v->gl_visual->AlphaBits > 0 );
b->gl_buffer = _mesa_create_framebuffer( v->gl_visual,
v->gl_visual->DepthBits > 0,
v->gl_visual->StencilBits > 0,
v->gl_visual->AccumRedBits > 0,
v->gl_visual->AlphaBits > 0 );
if (!b->gl_buffer) { if (!b->gl_buffer) {
free_xmesa_buffer(client, b); free_xmesa_buffer(client, b);
return NULL; return NULL;


if (!initialize_visual_and_buffer( client, v, b, v->gl_visual->RGBAflag, if (!initialize_visual_and_buffer( client, v, b, v->gl_visual->RGBAflag,
(XMesaDrawable)w, b->cmap )) { (XMesaDrawable)w, b->cmap )) {
gl_destroy_framebuffer( b->gl_buffer );
_mesa_destroy_framebuffer( b->gl_buffer );
free_xmesa_buffer(client, b); free_xmesa_buffer(client, b);
return NULL; return NULL;
} }
b->db_state = 0; b->db_state = 0;
} }


b->gl_buffer = gl_create_framebuffer( v->gl_visual,
v->gl_visual->DepthBits > 0,
v->gl_visual->StencilBits > 0,
v->gl_visual->AccumRedBits +
v->gl_visual->AccumGreenBits +
v->gl_visual->AccumBlueBits > 0,
v->gl_visual->AlphaBits > 0 );
b->gl_buffer = _mesa_create_framebuffer( v->gl_visual,
v->gl_visual->DepthBits > 0,
v->gl_visual->StencilBits > 0,
v->gl_visual->AccumRedBits +
v->gl_visual->AccumGreenBits +
v->gl_visual->AccumBlueBits > 0,
v->gl_visual->AlphaBits > 0 );
if (!b->gl_buffer) { if (!b->gl_buffer) {
free_xmesa_buffer(client, b); free_xmesa_buffer(client, b);
return NULL; return NULL;


if (!initialize_visual_and_buffer(client, v, b, v->gl_visual->RGBAflag, if (!initialize_visual_and_buffer(client, v, b, v->gl_visual->RGBAflag,
(XMesaDrawable)p, cmap)) { (XMesaDrawable)p, cmap)) {
gl_destroy_framebuffer( b->gl_buffer );
_mesa_destroy_framebuffer( b->gl_buffer );
free_xmesa_buffer(client, b); free_xmesa_buffer(client, b);
return NULL; return NULL;
} }
if (b->xm_context) if (b->xm_context)
b->xm_context->xm_buffer = NULL; b->xm_context->xm_buffer = NULL;


gl_destroy_framebuffer( b->gl_buffer );
_mesa_destroy_framebuffer( b->gl_buffer );
free_xmesa_buffer(client, b); free_xmesa_buffer(client, b);
} }


return GL_TRUE; return GL_TRUE;
} }
#endif #endif
if (c->gl_ctx == gl_get_current_context()
if (c->gl_ctx == _mesa_get_current_context()
&& c->xm_buffer == drawBuffer && c->xm_buffer == drawBuffer
&& c->xm_read_buffer == readBuffer && c->xm_read_buffer == readBuffer
&& c->xm_buffer->wasCurrent) { && c->xm_buffer->wasCurrent) {
c->xm_read_buffer = readBuffer; c->xm_read_buffer = readBuffer;
c->use_read_buffer = (drawBuffer != readBuffer); c->use_read_buffer = (drawBuffer != readBuffer);


gl_make_current2(c->gl_ctx, drawBuffer->gl_buffer, readBuffer->gl_buffer);
_mesa_make_current2(c->gl_ctx, drawBuffer->gl_buffer, readBuffer->gl_buffer);


if (c->gl_ctx->Viewport.Width == 0) { if (c->gl_ctx->Viewport.Width == 0) {
/* initialize viewport to window size */ /* initialize viewport to window size */
} }
else { else {
/* Detach */ /* Detach */
gl_make_current2( NULL, NULL, NULL );
_mesa_make_current2( NULL, NULL, NULL );
} }
return GL_TRUE; return GL_TRUE;
} }
GLboolean XMesaForceCurrent(XMesaContext c) GLboolean XMesaForceCurrent(XMesaContext c)
{ {
if (c) { if (c) {
if (c->gl_ctx != gl_get_current_context()) {
gl_make_current(c->gl_ctx, c->xm_buffer->gl_buffer);
if (c->gl_ctx != _mesa_get_current_context()) {
_mesa_make_current(c->gl_ctx, c->xm_buffer->gl_buffer);
} }
} }
else { else {
gl_make_current(NULL, NULL);
_mesa_make_current(NULL, NULL);
} }
return GL_TRUE; return GL_TRUE;
} }
GLboolean XMesaLoseCurrent(XMesaContext c) GLboolean XMesaLoseCurrent(XMesaContext c)
{ {
(void) c; (void) c;
gl_make_current(NULL, NULL);
_mesa_make_current(NULL, NULL);
return GL_TRUE; return GL_TRUE;
} }



+ 2
- 2
src/mesa/drivers/x11/xm_line.c Vedi File

/* $Id: xm_line.c,v 1.2 2000/09/12 17:03:59 brianp Exp $ */
/* $Id: xm_line.c,v 1.3 2000/09/26 20:54:13 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
&& ctx->RasterMask==DEPTH_BIT && ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_TRUE && ctx->Depth.Mask==GL_TRUE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Line.Width==1.0F) { && ctx->Line.Width==1.0F) {
switch (xmesa->pixelformat) { switch (xmesa->pixelformat) {
case PF_TRUECOLOR: case PF_TRUECOLOR:

+ 3
- 3
src/mesa/drivers/x11/xm_tri.c Vedi File

/* $Id: xm_tri.c,v 1.2 2000/09/12 17:03:59 brianp Exp $ */
/* $Id: xm_tri.c,v 1.3 2000/09/26 20:54:13 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
&& ctx->RasterMask==DEPTH_BIT && ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_TRUE && ctx->Depth.Mask==GL_TRUE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Polygon.StippleFlag==GL_FALSE) { && ctx->Polygon.StippleFlag==GL_FALSE) {
switch (xmesa->pixelformat) { switch (xmesa->pixelformat) {
case PF_TRUECOLOR: case PF_TRUECOLOR:
&& ctx->RasterMask==DEPTH_BIT && ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
&& ctx->Depth.Mask==GL_TRUE && ctx->Depth.Mask==GL_TRUE
&& ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS
&& ctx->Polygon.StippleFlag==GL_FALSE) { && ctx->Polygon.StippleFlag==GL_FALSE) {
switch (xmesa->pixelformat) { switch (xmesa->pixelformat) {
case PF_TRUECOLOR: case PF_TRUECOLOR:

+ 2
- 2
src/mesa/drivers/x11/xmesaP.h Vedi File

/* $Id: xmesaP.h,v 1.12 2000/09/07 15:42:38 brianp Exp $ */
/* $Id: xmesaP.h,v 1.13 2000/09/26 20:54:13 brianp Exp $ */


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




/* /*
* "Derived" from gl_context. Basically corresponds to a GLXContext.
* "Derived" from __GLcontextRec. Basically corresponds to a GLXContext.
*/ */
struct xmesa_context { struct xmesa_context {
GLcontext *gl_ctx; /* the core library context */ GLcontext *gl_ctx; /* the core library context */

+ 2
- 1
src/mesa/main/Makefile.X11 Vedi File

# $Id: Makefile.X11,v 1.23 2000/09/26 15:27:23 brianp Exp $
# $Id: Makefile.X11,v 1.24 2000/09/26 20:53:53 brianp Exp $


# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.5 # Version: 3.5
hint.c \ hint.c \
image.c \ image.c \
imaging.c \ imaging.c \
imports.c \
light.c \ light.c \
lines.c \ lines.c \
logic.c \ logic.c \

+ 4
- 4
src/mesa/main/accum.c Vedi File

/* $Id: accum.c,v 1.25 2000/09/08 21:28:04 brianp Exp $ */
/* $Id: accum.c,v 1.26 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");


if (ctx->Visual->AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) {
if (ctx->Visual.AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) {
gl_error(ctx, GL_INVALID_OPERATION, "glAccum"); gl_error(ctx, GL_INVALID_OPERATION, "glAccum");
return; return;
} }


if (!ctx->DrawBuffer->Accum) { if (!ctx->DrawBuffer->Accum) {
gl_warning(ctx, "Calling glAccum() without an accumulation buffer (low memory?)");
_mesa_warning(ctx, "Calling glAccum() without an accumulation buffer (low memory?)");
return; return;
} }


GLuint buffersize; GLuint buffersize;
GLfloat acc_scale; GLfloat acc_scale;


if (ctx->Visual->AccumRedBits==0) {
if (ctx->Visual.AccumRedBits==0) {
/* No accumulation buffer! */ /* No accumulation buffer! */
return; return;
} }

+ 2
- 2
src/mesa/main/attrib.c Vedi File

/* $Id: attrib.c,v 1.26 2000/08/21 14:22:24 brianp Exp $ */
/* $Id: attrib.c,v 1.27 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
ctx->Driver.LogicOpcode) { ctx->Driver.LogicOpcode) {
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp ); ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
} }
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);

+ 27
- 28
src/mesa/main/buffers.c Vedi File

/* $Id: buffers.c,v 1.11 2000/09/08 21:28:04 brianp Exp $ */
/* $Id: buffers.c,v 1.12 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex");
ctx->Color.ClearIndex = (GLuint) c; ctx->Color.ClearIndex = (GLuint) c;
if (!ctx->Visual->RGBAflag) {
if (!ctx->Visual.RGBAflag) {
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
(*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
} }
ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F ); ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F );
ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F ); ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );


if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin; const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin; const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;


if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
/* RGBA mode */ /* RGBA mode */
const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin; const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);


if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
/* RGBA mode */ /* RGBA mode */
const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
else { else {
/* Color index mode */ /* Color index mode */
ASSERT(ctx->Color.IndexMask == ~0); ASSERT(ctx->Color.IndexMask == ~0);
if (ctx->Visual->IndexBits == 8) {
if (ctx->Visual.IndexBits == 8) {
/* 8-bit clear */ /* 8-bit clear */
GLubyte span[MAX_WIDTH]; GLubyte span[MAX_WIDTH];
GLint i; GLint i;
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
case GL_RIGHT: case GL_RIGHT:
if (!ctx->Visual->StereoFlag) {
if (!ctx->Visual.StereoFlag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return;
}
if (ctx->Visual->DBflag)
return;}
if (ctx->Visual.DBflag)
ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT; ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
else else
ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; ctx->Color.DrawDestMask = FRONT_RIGHT_BIT;
break; break;
case GL_FRONT_RIGHT: case GL_FRONT_RIGHT:
if (!ctx->Visual->StereoFlag) {
if (!ctx->Visual.StereoFlag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
} }
ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; ctx->Color.DrawDestMask = FRONT_RIGHT_BIT;
break; break;
case GL_BACK_RIGHT: case GL_BACK_RIGHT:
if (!ctx->Visual->StereoFlag) {
if (!ctx->Visual.StereoFlag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
} }
if (!ctx->Visual->DBflag) {
if (!ctx->Visual.DBflag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
} }
ctx->Color.DrawDestMask = BACK_RIGHT_BIT; ctx->Color.DrawDestMask = BACK_RIGHT_BIT;
break; break;
case GL_BACK_LEFT: case GL_BACK_LEFT:
if (!ctx->Visual->DBflag) {
if (!ctx->Visual.DBflag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
} }
ctx->Color.DrawDestMask = BACK_LEFT_BIT; ctx->Color.DrawDestMask = BACK_LEFT_BIT;
break; break;
case GL_FRONT_AND_BACK: case GL_FRONT_AND_BACK:
if (!ctx->Visual->DBflag) {
if (!ctx->Visual.DBflag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
} }
if (ctx->Visual->StereoFlag)
if (ctx->Visual.StereoFlag)
ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT
| FRONT_RIGHT_BIT | BACK_RIGHT_BIT; | FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
else else
ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
break; break;
case GL_BACK: case GL_BACK:
if (!ctx->Visual->DBflag) {
if (!ctx->Visual.DBflag) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
return; return;
} }
if (ctx->Visual->StereoFlag)
if (ctx->Visual.StereoFlag)
ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT; ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT;
else else
ctx->Color.DrawDestMask = BACK_LEFT_BIT; ctx->Color.DrawDestMask = BACK_LEFT_BIT;
break; break;
case GL_LEFT: case GL_LEFT:
/* never an error */ /* never an error */
if (ctx->Visual->DBflag)
if (ctx->Visual.DBflag)
ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
else else
ctx->Color.DrawDestMask = FRONT_LEFT_BIT; ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
break; break;
case GL_FRONT: case GL_FRONT:
/* never an error */ /* never an error */
if (ctx->Visual->StereoFlag)
if (ctx->Visual.StereoFlag)
ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT; ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT;
else else
ctx->Color.DrawDestMask = FRONT_LEFT_BIT; ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
/* /*
* Make the dest buffer mode more precise if possible * Make the dest buffer mode more precise if possible
*/ */
if (mode == GL_LEFT && !ctx->Visual->DBflag)
if (mode == GL_LEFT && !ctx->Visual.DBflag)
ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT;
else if (mode == GL_RIGHT && !ctx->Visual->DBflag)
else if (mode == GL_RIGHT && !ctx->Visual.DBflag)
ctx->Color.DriverDrawBuffer = GL_FRONT_RIGHT; ctx->Color.DriverDrawBuffer = GL_FRONT_RIGHT;
else if (mode == GL_FRONT && !ctx->Visual->StereoFlag)
else if (mode == GL_FRONT && !ctx->Visual.StereoFlag)
ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT;
else if (mode == GL_BACK && !ctx->Visual->StereoFlag)
else if (mode == GL_BACK && !ctx->Visual.StereoFlag)
ctx->Color.DriverDrawBuffer = GL_BACK_LEFT; ctx->Color.DriverDrawBuffer = GL_BACK_LEFT;
else else
ctx->Color.DriverDrawBuffer = mode; ctx->Color.DriverDrawBuffer = mode;
case GL_BACK: case GL_BACK:
case GL_BACK_LEFT: case GL_BACK_LEFT:
/* Back-Left buffer, requires double buffering */ /* Back-Left buffer, requires double buffering */
if (!ctx->Visual->DBflag) {
if (!ctx->Visual.DBflag) {
gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
return; return;
} }
break; break;
case GL_FRONT_RIGHT: case GL_FRONT_RIGHT:
case GL_RIGHT: case GL_RIGHT:
if (!ctx->Visual->StereoFlag) {
if (!ctx->Visual.StereoFlag) {
gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
return; return;
} }
ctx->Pixel.DriverReadBuffer = GL_FRONT_RIGHT; ctx->Pixel.DriverReadBuffer = GL_FRONT_RIGHT;
break; break;
case GL_BACK_RIGHT: case GL_BACK_RIGHT:
if (!ctx->Visual->StereoFlag || !ctx->Visual->DBflag) {
if (!ctx->Visual.StereoFlag || !ctx->Visual.DBflag) {
gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
return; return;
} }
void void
_mesa_ResizeBuffersMESA( void ) _mesa_ResizeBuffersMESA( void )
{ {
GLcontext *ctx = gl_get_current_context();
GLcontext *ctx = _mesa_get_current_context();


GLuint buf_width, buf_height; GLuint buf_width, buf_height;



+ 2
- 2
src/mesa/main/clip.c Vedi File

/* $Id: clip.c,v 1.8 2000/04/17 18:18:00 keithw Exp $ */
/* $Id: clip.c,v 1.9 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
{ {
GLuint mask = 0; GLuint mask = 0;


if (ctx->Visual->RGBAflag)
if (ctx->Visual.RGBAflag)
{ {
mask |= CLIP_RGBA0; mask |= CLIP_RGBA0;

+ 5
- 5
src/mesa/main/config.h Vedi File

/* $Id: config.h,v 1.16 2000/08/21 14:24:53 brianp Exp $ */
/* $Id: config.h,v 1.17 2000/09/26 20:53:53 brianp Exp $ */


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


/* /*
* Bits per depth buffer value: 16 or 32 (GLushort or GLuint) * Bits per depth buffer value: 16 or 32 (GLushort or GLuint)
* gl_create_visual() can select any depth in [0, 32].
* _mesa_create_visual() can specify any depth in [0, 32].
*/ */
#define DEFAULT_SOFTWARE_DEPTH_BITS 16 #define DEFAULT_SOFTWARE_DEPTH_BITS 16
#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort #define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort
#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS) #define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS)





typedef struct gl_context GLcontext;
typedef struct __GLcontextRec GLcontext;


extern void extern void
gl_read_config_file( struct gl_context *ctx );
gl_read_config_file(GLcontext *ctx);


extern void extern void
gl_register_config_var(const char *name, void (*notify)( const char *, int )); gl_register_config_var(const char *name, void (*notify)( const char *, int ));



#endif #endif

+ 117
- 92
src/mesa/main/context.c Vedi File

/* $Id: context.c,v 1.89 2000/09/26 15:27:22 brianp Exp $ */
/* $Id: context.c,v 1.90 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#include "all.h" #include "all.h"
#else #else
#include "glheader.h" #include "glheader.h"
#include "accum.h"
#include "alphabuf.h"
#include "buffers.h"
#include "clip.h" #include "clip.h"
#include "colortab.h" #include "colortab.h"
#include "context.h" #include "context.h"
#include "cva.h" #include "cva.h"
#include "depth.h"
#include "dlist.h" #include "dlist.h"
#include "eval.h" #include "eval.h"
#include "enums.h" #include "enums.h"
#include "extensions.h" #include "extensions.h"
#include "fog.h" #include "fog.h"
#include "get.h" #include "get.h"
#include "glapi.h"
#include "glapinoop.h" #include "glapinoop.h"
#include "glthread.h" #include "glthread.h"
#include "hash.h" #include "hash.h"
#include "imports.h"
#include "light.h" #include "light.h"
#include "macros.h" #include "macros.h"
#include "matrix.h" #include "matrix.h"
#include "pipeline.h" #include "pipeline.h"
#include "shade.h" #include "shade.h"
#include "simple_list.h" #include "simple_list.h"
#include "stencil.h"
#include "stages.h" #include "stages.h"
#include "state.h" #include "state.h"
#include "translate.h" #include "translate.h"
#include "teximage.h" #include "teximage.h"
#include "texobj.h" #include "texobj.h"
#include "texstate.h"
#include "texture.h" #include "texture.h"
#include "types.h" #include "types.h"
#include "varray.h" #include "varray.h"
#include "vb.h" #include "vb.h"
#include "vbcull.h"
#include "vbrender.h" #include "vbrender.h"
#include "vbxform.h" #include "vbxform.h"
#include "vertices.h" #include "vertices.h"
#include "xform.h" #include "xform.h"
#endif #endif



#if defined(MESA_TRACE) #if defined(MESA_TRACE)
#include "Trace/tr_context.h" #include "Trace/tr_context.h"
#include "Trace/tr_wrapper.h" #include "Trace/tr_wrapper.h"
#endif #endif





/**********************************************************************/
/***** OpenGL SI-style interface (new in Mesa 3.5) *****/
/**********************************************************************/

static GLboolean
_mesa_DestroyContext(__GLcontext *gc)
{
if (gc) {
_mesa_free_context_data(gc);
(*gc->imports.free)(gc, gc);
}
return GL_TRUE;
}


/* exported OpenGL SI interface */
__GLcontext *
__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes)
{
GLcontext *ctx;

ctx = (GLcontext *) (*imports->calloc)(0, 1, sizeof(GLcontext));
if (ctx == NULL) {
return NULL;
}
ctx->imports = *imports;

_mesa_initialize_visual(&ctx->Visual,
modes->rgbMode,
modes->doubleBufferMode,
modes->stereoMode,
modes->redBits,
modes->greenBits,
modes->blueBits,
modes->alphaBits,
modes->indexBits,
modes->depthBits,
modes->stencilBits,
modes->accumRedBits,
modes->accumGreenBits,
modes->accumBlueBits,
modes->accumAlphaBits,
0);

_mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->wscx, GL_FALSE);

ctx->exports.destroyContext = _mesa_DestroyContext;

return ctx;
}


/* exported OpenGL SI interface */
void
__glCoreNopDispatch(void)
{
#if 0
/* SI */
__gl_dispatch = __glNopDispatchState;
#else
/* Mesa */
_glapi_set_dispatch(NULL);
#endif
}


/**********************************************************************/ /**********************************************************************/
/***** Context and Thread management *****/ /***** Context and Thread management *****/
/**********************************************************************/ /**********************************************************************/
indexBits, depthBits, stencilBits, indexBits, depthBits, stencilBits,
accumRedBits, accumGreenBits, accumRedBits, accumGreenBits,
accumBlueBits, accumAlphaBits, accumBlueBits, accumAlphaBits,
numSamples )) {
numSamples)) {
FREE(vis); FREE(vis);
return NULL; return NULL;
} }
} }




/* This function should no longer be used. Use _mesa_create_visual() instead */
GLvisual *
gl_create_visual( GLboolean rgbFlag,
GLboolean alphaFlag,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint depthBits,
GLint stencilBits,
GLint accumBits,
GLint indexBits,
GLint redBits,
GLint greenBits,
GLint blueBits,
GLint alphaBits )
{
(void) alphaFlag;
return _mesa_create_visual(rgbFlag, dbFlag, stereoFlag,
redBits, greenBits, blueBits, alphaBits,
indexBits, depthBits, stencilBits,
accumBits, accumBits, accumBits, accumBits, 0);
}


void void
_mesa_destroy_visual( GLvisual *vis ) _mesa_destroy_visual( GLvisual *vis )
{ {
} }




/* obsolete */
void
gl_destroy_visual( GLvisual *vis )
{
_mesa_destroy_visual(vis);
}



/**********************************************************************/ /**********************************************************************/
/***** GL Framebuffer allocation/destruction *****/ /***** GL Framebuffer allocation/destruction *****/
/**********************************************************************/ /**********************************************************************/
* Return: pointer to new GLframebuffer struct or NULL if error. * Return: pointer to new GLframebuffer struct or NULL if error.
*/ */
GLframebuffer * GLframebuffer *
gl_create_framebuffer( GLvisual *visual,
GLboolean softwareDepth,
GLboolean softwareStencil,
GLboolean softwareAccum,
GLboolean softwareAlpha )
_mesa_create_framebuffer( GLvisual *visual,
GLboolean softwareDepth,
GLboolean softwareStencil,
GLboolean softwareAccum,
GLboolean softwareAlpha )
{ {
GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer); GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer);
assert(visual); assert(visual);


/* /*
* Initialize a GLframebuffer object. * Initialize a GLframebuffer object.
* Input: See gl_create_framebuffer() above.
* Input: See _mesa_create_framebuffer() above.
*/ */
void void
_mesa_initialize_framebuffer( GLframebuffer *buffer, _mesa_initialize_framebuffer( GLframebuffer *buffer,
* Free a framebuffer struct and its buffers. * Free a framebuffer struct and its buffers.
*/ */
void void
gl_destroy_framebuffer( GLframebuffer *buffer )
_mesa_destroy_framebuffer( GLframebuffer *buffer )
{ {
if (buffer) { if (buffer) {
if (buffer->DepthBuffer) { if (buffer->DepthBuffer) {
ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000;
ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000;




/* Pipeline */ /* Pipeline */
gl_pipeline_init( ctx ); gl_pipeline_init( ctx );
gl_cva_init( ctx ); gl_cva_init( ctx );


#define Sz 10 #define Sz 10
#define Tz 14 #define Tz 14
ctx->Viewport.WindowMap.m[Sz] = 0.5 * ctx->Visual->DepthMaxF;
ctx->Viewport.WindowMap.m[Tz] = 0.5 * ctx->Visual->DepthMaxF;
ctx->Viewport.WindowMap.m[Sz] = 0.5 * ctx->Visual.DepthMaxF;
ctx->Viewport.WindowMap.m[Tz] = 0.5 * ctx->Visual.DepthMaxF;
#undef Sz #undef Sz
#undef Tz #undef Tz


} }





/* /*
* Initialize a GLcontext struct. This includes allocating all the * Initialize a GLcontext struct. This includes allocating all the
* other structs and arrays which hang off of the context by pointers. * other structs and arrays which hang off of the context by pointers.
/* misc one-time initializations */ /* misc one-time initializations */
one_time_init(); one_time_init();


/**
** OpenGL SI stuff
**/
if (!ctx->imports.malloc) {
_mesa_InitDefaultImports(&ctx->imports, driver_ctx, NULL);
}
/* exports are setup by the device driver */

ctx->DriverCtx = driver_ctx; ctx->DriverCtx = driver_ctx;
ctx->Visual = visual;
ctx->Visual = *visual;
ctx->DrawBuffer = NULL; ctx->DrawBuffer = NULL;
ctx->ReadBuffer = NULL; ctx->ReadBuffer = NULL;


* Input: visual - a GLvisual pointer * Input: visual - a GLvisual pointer
* sharelist - another context to share display lists with or NULL * sharelist - another context to share display lists with or NULL
* driver_ctx - pointer to device driver's context state struct * driver_ctx - pointer to device driver's context state struct
* Return: pointer to a new gl_context struct or NULL if error.
* Return: pointer to a new __GLcontextRec or NULL if error.
*/ */
GLcontext * GLcontext *
gl_create_context( GLvisual *visual,
GLcontext *share_list,
void *driver_ctx,
GLboolean direct )
_mesa_create_context( GLvisual *visual,
GLcontext *share_list,
void *driver_ctx,
GLboolean direct )
{ {
GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) ); GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) );
if (!ctx) { if (!ctx) {
* But don't free() the GLcontext struct itself! * But don't free() the GLcontext struct itself!
*/ */
void void
gl_free_context_data( GLcontext *ctx )
_mesa_free_context_data( GLcontext *ctx )
{ {
struct gl_shine_tab *s, *tmps; struct gl_shine_tab *s, *tmps;
GLuint i, j; GLuint i, j;


/* if we're destroying the current context, unbind it first */ /* if we're destroying the current context, unbind it first */
if (ctx == gl_get_current_context()) {
gl_make_current(NULL, NULL);
if (ctx == _mesa_get_current_context()) {
_mesa_make_current(NULL, NULL);
} }


gl_matrix_dtr( &ctx->ModelView ); gl_matrix_dtr( &ctx->ModelView );
* Destroy a GLcontext structure. * Destroy a GLcontext structure.
*/ */
void void
gl_destroy_context( GLcontext *ctx )
_mesa_destroy_context( GLcontext *ctx )
{ {
if (ctx) { if (ctx) {
gl_free_context_data(ctx);
_mesa_free_context_data(ctx);
FREE( (void *) ctx ); FREE( (void *) ctx );
} }
} }
* initialized. Currently just reads the config file. * initialized. Currently just reads the config file.
*/ */
void void
gl_context_initialize( GLcontext *ctx )
_mesa_context_initialize( GLcontext *ctx )
{ {
gl_read_config_file( ctx ); gl_read_config_file( ctx );
} }
* mask - bitwise OR of GL_*_BIT flags * mask - bitwise OR of GL_*_BIT flags
*/ */
void void
gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
{ {
if (mask & GL_ACCUM_BUFFER_BIT) { if (mask & GL_ACCUM_BUFFER_BIT) {
MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) ); MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) );
/* /*
* Set the current context, binding the given frame buffer to the context. * Set the current context, binding the given frame buffer to the context.
*/ */
void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer )
void
_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer )
{ {
gl_make_current2( newCtx, buffer, buffer );
_mesa_make_current2( newCtx, buffer, buffer );
} }




* Bind the given context to the given draw-buffer and read-buffer * Bind the given context to the given draw-buffer and read-buffer
* and make it the current context for this thread. * and make it the current context for this thread.
*/ */
void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer )
void
_mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer )
{ {
#if 0 #if 0
GLcontext *oldCtx = gl_get_context(); GLcontext *oldCtx = gl_get_context();
/* Flush the old context /* Flush the old context
*/ */
if (oldCtx) { if (oldCtx) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "gl_make_current");
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "_mesa_make_current");


/* unbind frame buffers from context */ /* unbind frame buffers from context */
if (oldCtx->DrawBuffer) { if (oldCtx->DrawBuffer) {
_glapi_check_multithread(); _glapi_check_multithread();


_glapi_set_context((void *) newCtx); _glapi_set_context((void *) newCtx);
ASSERT(gl_get_current_context() == newCtx);
ASSERT(_mesa_get_current_context() == newCtx);
if (newCtx) { if (newCtx) {
SET_IMMEDIATE(newCtx, newCtx->input); SET_IMMEDIATE(newCtx, newCtx->input);
_glapi_set_dispatch(newCtx->CurrentDispatch); _glapi_set_dispatch(newCtx->CurrentDispatch);
_glapi_set_dispatch(NULL); /* none current */ _glapi_set_dispatch(NULL); /* none current */
} }


if (MESA_VERBOSE) fprintf(stderr, "gl_make_current()\n");
if (MESA_VERBOSE) fprintf(stderr, "_mesa_make_current()\n");


if (newCtx && drawBuffer && readBuffer) { if (newCtx && drawBuffer && readBuffer) {
/* TODO: check if newCtx and buffer's visual match??? */ /* TODO: check if newCtx and buffer's visual match??? */
* This isn't the fastest way to get the current context. * This isn't the fastest way to get the current context.
* If you need speed, see the GET_CURRENT_CONTEXT() macro in context.h * If you need speed, see the GET_CURRENT_CONTEXT() macro in context.h
*/ */
GLcontext *gl_get_current_context( void )
GLcontext *
_mesa_get_current_context( void )
{ {
return (GLcontext *) _glapi_get_context(); return (GLcontext *) _glapi_get_context();
} }
* something illogical or if there's likely a bug in their program * something illogical or if there's likely a bug in their program
* (like enabled depth testing without a depth buffer). * (like enabled depth testing without a depth buffer).
*/ */
void gl_warning( const GLcontext *ctx, const char *s )
void
_mesa_warning( const GLcontext *ctx, const char *s )
{ {
GLboolean debug;
#ifdef DEBUG
debug = GL_TRUE;
#else
if (getenv("MESA_DEBUG")) {
debug = GL_TRUE;
}
else {
debug = GL_FALSE;
}
#endif
if (debug) {
fprintf( stderr, "Mesa warning: %s\n", s );
}
(void) ctx;
(*ctx->imports.warning)((__GLcontext *) ctx, (char *) s);
} }




/* /*
* Compile an error into current display list. * Compile an error into current display list.
*/ */
void gl_compile_error( GLcontext *ctx, GLenum error, const char *s )
void
_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s )
{ {
if (ctx->CompileFlag) if (ctx->CompileFlag)
gl_save_error( ctx, error, s ); gl_save_error( ctx, error, s );

+ 20
- 38
src/mesa/main/context.h Vedi File

/* $Id: context.h,v 1.18 2000/05/24 15:04:45 brianp Exp $ */
/* $Id: context.h,v 1.19 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLint accumAlphaBits, GLint accumAlphaBits,
GLint numSamples ); GLint numSamples );


/* this function is obsolete */
extern GLvisual *
gl_create_visual( GLboolean rgbFlag,
GLboolean alphaFlag,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint depthBits,
GLint stencilBits,
GLint accumBits,
GLint indexBits,
GLint redBits,
GLint greenBits,
GLint blueBits,
GLint alphaBits );


extern void extern void
_mesa_destroy_visual( GLvisual *vis ); _mesa_destroy_visual( GLvisual *vis );


/*obsolete */ extern void gl_destroy_visual( GLvisual *vis );





/* /*
* single entity. * single entity.
*/ */
extern GLframebuffer * extern GLframebuffer *
gl_create_framebuffer( GLvisual *visual,
GLboolean softwareDepth,
GLboolean softwareStencil,
GLboolean softwareAccum,
GLboolean softwareAlpha );
_mesa_create_framebuffer( GLvisual *visual,
GLboolean softwareDepth,
GLboolean softwareStencil,
GLboolean softwareAccum,
GLboolean softwareAlpha );


extern void extern void
_mesa_initialize_framebuffer( GLframebuffer *fb, _mesa_initialize_framebuffer( GLframebuffer *fb,
GLboolean softwareAlpha ); GLboolean softwareAlpha );


extern void extern void
gl_destroy_framebuffer( GLframebuffer *buffer );
_mesa_destroy_framebuffer( GLframebuffer *buffer );






* contains the rendering state. * contains the rendering state.
*/ */
extern GLcontext * extern GLcontext *
gl_create_context( GLvisual *visual,
GLcontext *share_list,
void *driver_ctx,
GLboolean direct);
_mesa_create_context( GLvisual *visual,
GLcontext *share_list,
void *driver_ctx,
GLboolean direct);


extern GLboolean extern GLboolean
_mesa_initialize_context( GLcontext *ctx, _mesa_initialize_context( GLcontext *ctx,
GLboolean direct ); GLboolean direct );


extern void extern void
gl_free_context_data( GLcontext *ctx );
_mesa_free_context_data( GLcontext *ctx );


extern void extern void
gl_destroy_context( GLcontext *ctx );
_mesa_destroy_context( GLcontext *ctx );




extern void extern void
gl_context_initialize( GLcontext *ctx );
_mesa_context_initialize( GLcontext *ctx );




extern void extern void
gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);




extern void extern void
gl_make_current( GLcontext *ctx, GLframebuffer *buffer );
_mesa_make_current( GLcontext *ctx, GLframebuffer *buffer );




extern void extern void
gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
_mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer ); GLframebuffer *readBuffer );




extern GLcontext * extern GLcontext *
gl_get_current_context(void);
_mesa_get_current_context(void);






gl_problem( const GLcontext *ctx, const char *s ); gl_problem( const GLcontext *ctx, const char *s );


extern void extern void
gl_warning( const GLcontext *ctx, const char *s );
_mesa_warning( const GLcontext *ctx, const char *s );


extern void extern void
gl_error( GLcontext *ctx, GLenum error, const char *s ); gl_error( GLcontext *ctx, GLenum error, const char *s );


extern void extern void
gl_compile_error( GLcontext *ctx, GLenum error, const char *s );
_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s );







+ 15
- 15
src/mesa/main/depth.c Vedi File

/* $Id: depth.c,v 1.18 2000/09/08 21:28:04 brianp Exp $ */
/* $Id: depth.c,v 1.19 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLvoid * GLvoid *
_mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y) _mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y)
{ {
if (ctx->Visual->DepthBits <= 16)
if (ctx->Visual.DepthBits <= 16)
return (GLushort *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x; return (GLushort *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x;
else else
return (GLuint *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x; return (GLuint *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x;
} }
else { else {
/* software depth buffer */ /* software depth buffer */
if (ctx->Visual->DepthBits <= 16) {
if (ctx->Visual.DepthBits <= 16) {
GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y); GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y);
GLuint passed = depth_test_span16(ctx, n, x, y, zptr, z, mask); GLuint passed = depth_test_span16(ctx, n, x, y, zptr, z, mask);
return passed; return passed;
} }
else { else {
/* software depth testing */ /* software depth testing */
if (ctx->Visual->DepthBits <= 16)
if (ctx->Visual.DepthBits <= 16)
software_depth_test_pixels16(ctx, n, x, y, z, mask); software_depth_test_pixels16(ctx, n, x, y, z, mask);
else else
software_depth_test_pixels32(ctx, n, x, y, z, mask); software_depth_test_pixels32(ctx, n, x, y, z, mask);


if (ctx->DrawBuffer->DepthBuffer) { if (ctx->DrawBuffer->DepthBuffer) {
/* read from software depth buffer */ /* read from software depth buffer */
if (ctx->Visual->DepthBits <= 16) {
if (ctx->Visual.DepthBits <= 16) {
const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); const GLushort *zptr = Z_ADDRESS16( ctx, x, y );
GLuint i; GLuint i;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
_mesa_read_depth_span_float( GLcontext *ctx, _mesa_read_depth_span_float( GLcontext *ctx,
GLint n, GLint x, GLint y, GLfloat depth[] ) GLint n, GLint x, GLint y, GLfloat depth[] )
{ {
const GLfloat scale = 1.0F / ctx->Visual->DepthMaxF;
const GLfloat scale = 1.0F / ctx->Visual.DepthMaxF;


if (y < 0 || y >= ctx->DrawBuffer->Height || if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) { x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {


if (ctx->DrawBuffer->DepthBuffer) { if (ctx->DrawBuffer->DepthBuffer) {
/* read from software depth buffer */ /* read from software depth buffer */
if (ctx->Visual->DepthBits <= 16) {
if (ctx->Visual.DepthBits <= 16) {
const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); const GLushort *zptr = Z_ADDRESS16( ctx, x, y );
GLuint i; GLuint i;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
} }


/* allocate new depth buffer, but don't initialize it */ /* allocate new depth buffer, but don't initialize it */
if (ctx->Visual->DepthBits <= 16)
if (ctx->Visual.DepthBits <= 16)
bytesPerValue = sizeof(GLushort); bytesPerValue = sizeof(GLushort);
else else
bytesPerValue = sizeof(GLuint); bytesPerValue = sizeof(GLuint);
void void
_mesa_clear_depth_buffer( GLcontext *ctx ) _mesa_clear_depth_buffer( GLcontext *ctx )
{ {
if (ctx->Visual->DepthBits == 0
if (ctx->Visual.DepthBits == 0
|| !ctx->DrawBuffer->DepthBuffer || !ctx->DrawBuffer->DepthBuffer
|| !ctx->Depth.Mask) { || !ctx->Depth.Mask) {
/* no depth buffer, or writing to it is disabled */ /* no depth buffer, or writing to it is disabled */


if (ctx->Scissor.Enabled) { if (ctx->Scissor.Enabled) {
/* only clear scissor region */ /* only clear scissor region */
if (ctx->Visual->DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax);
if (ctx->Visual.DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual.DepthMax);
const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin; const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Width; const GLint width = ctx->DrawBuffer->Width;
GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer
} }
} }
else { else {
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax);
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual.DepthMax);
const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin; const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Width; const GLint width = ctx->DrawBuffer->Width;
GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer
} }
else { else {
/* clear whole buffer */ /* clear whole buffer */
if (ctx->Visual->DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax);
if (ctx->Visual.DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual.DepthMax);
if ((clearValue & 0xff) == (clearValue >> 8)) { if ((clearValue & 0xff) == (clearValue >> 8)) {
if (clearValue == 0) { if (clearValue == 0) {
BZERO(ctx->DrawBuffer->DepthBuffer, BZERO(ctx->DrawBuffer->DepthBuffer,
} }
else { else {
/* >16 bit depth buffer */ /* >16 bit depth buffer */
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax);
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual.DepthMax);
if (clearValue == 0) { if (clearValue == 0) {
BZERO(ctx->DrawBuffer->DepthBuffer, BZERO(ctx->DrawBuffer->DepthBuffer,
ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint)); ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint));

+ 2
- 2
src/mesa/main/dlist.c Vedi File

/* $Id: dlist.c,v 1.45 2000/08/23 14:33:04 brianp Exp $ */
/* $Id: dlist.c,v 1.46 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
save_PolygonOffset(factor, ctx->Visual->DepthMaxF * bias);
save_PolygonOffset(factor, ctx->Visual.DepthMaxF * bias);
} }





+ 15
- 15
src/mesa/main/drawpix.c Vedi File

/* $Id: drawpix.c,v 1.34 2000/09/12 21:09:24 brianp Exp $ */
/* $Id: drawpix.c,v 1.35 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
} }
else { else {
/* setup array of fragment Z value to pass to zoom function */ /* setup array of fragment Z value to pass to zoom function */
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF);
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF);
GLint i; GLint i;
ASSERT(drawWidth < MAX_WIDTH); ASSERT(drawWidth < MAX_WIDTH);
for (i=0; i<drawWidth; i++) for (i=0; i<drawWidth; i++)
*/ */


if (format==GL_RGBA && type==GL_UNSIGNED_BYTE) { if (format==GL_RGBA && type==GL_UNSIGNED_BYTE) {
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLubyte *src = (GLubyte *) pixels GLubyte *src = (GLubyte *) pixels
+ (skipRows * rowLength + skipPixels) * 4; + (skipRows * rowLength + skipPixels) * 4;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
return GL_TRUE; return GL_TRUE;
} }
else if (format==GL_RGB && type==GL_UNSIGNED_BYTE) { else if (format==GL_RGB && type==GL_UNSIGNED_BYTE) {
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLubyte *src = (GLubyte *) pixels GLubyte *src = (GLubyte *) pixels
+ (skipRows * rowLength + skipPixels) * 3; + (skipRows * rowLength + skipPixels) * 3;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
return GL_TRUE; return GL_TRUE;
} }
else if (format==GL_LUMINANCE && type==GL_UNSIGNED_BYTE) { else if (format==GL_LUMINANCE && type==GL_UNSIGNED_BYTE) {
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLubyte *src = (GLubyte *) pixels GLubyte *src = (GLubyte *) pixels
+ (skipRows * rowLength + skipPixels); + (skipRows * rowLength + skipPixels);
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
return GL_TRUE; return GL_TRUE;
} }
else if (format==GL_LUMINANCE_ALPHA && type==GL_UNSIGNED_BYTE) { else if (format==GL_LUMINANCE_ALPHA && type==GL_UNSIGNED_BYTE) {
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLubyte *src = (GLubyte *) pixels GLubyte *src = (GLubyte *) pixels
+ (skipRows * rowLength + skipPixels)*2; + (skipRows * rowLength + skipPixels)*2;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
} }
else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) { else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) {
GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels; GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels;
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
/* convert CI data to RGBA */ /* convert CI data to RGBA */
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */ /* no zooming */


/* Fragment depth values */ /* Fragment depth values */
if (ctx->Depth.Test || ctx->Fog.Enabled) { if (ctx->Depth.Test || ctx->Fog.Enabled) {
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF);
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF);
GLint i; GLint i;
for (i = 0; i < drawWidth; i++) { for (i = 0; i < drawWidth; i++) {
zspan[i] = zval; zspan[i] = zval;
} }


/* Colors or indexes */ /* Colors or indexes */
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0F); GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0F);
GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0F); GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0F);
GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0F); GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0F);
} }


if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort) if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort)
&& !bias_or_scale && !zoom && ctx->Visual->RGBAflag) {
&& !bias_or_scale && !zoom && ctx->Visual.RGBAflag) {
/* Special case: directly write 16-bit depth values */ /* Special case: directly write 16-bit depth values */
GLint row; GLint row;
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP );
} }
} }
else if (type==GL_UNSIGNED_INT && ctx->Visual->DepthBits == 32
&& !bias_or_scale && !zoom && ctx->Visual->RGBAflag) {
else if (type==GL_UNSIGNED_INT && ctx->Visual.DepthBits == 32
&& !bias_or_scale && !zoom && ctx->Visual.RGBAflag) {
/* Special case: directly write 32-bit depth values */ /* Special case: directly write 32-bit depth values */
GLint row; GLint row;
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
_mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src, _mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src,
&ctx->Unpack, ctx->ImageTransferState ); &ctx->Unpack, ctx->ImageTransferState );
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
if (zoom) { if (zoom) {
gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, gl_write_zoomed_rgba_span(ctx, width, x, y, zspan,
(const GLubyte (*)[4])rgba, desty); (const GLubyte (*)[4])rgba, desty);
/* Fragment depth values */ /* Fragment depth values */
if (ctx->Depth.Test || ctx->Fog.Enabled) { if (ctx->Depth.Test || ctx->Fog.Enabled) {
/* fill in array of z values */ /* fill in array of z values */
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF);
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF);
GLint i; GLint i;
for (i=0;i<width;i++) { for (i=0;i<width;i++) {
zspan[i] = z; zspan[i] = z;
draw_depth_pixels( ctx, x, y, width, height, type, pixels ); draw_depth_pixels( ctx, x, y, width, height, type, pixels );
break; break;
case GL_COLOR_INDEX: case GL_COLOR_INDEX:
if (ctx->Visual->RGBAflag)
if (ctx->Visual.RGBAflag)
draw_rgba_pixels(ctx, x,y, width, height, format, type, pixels); draw_rgba_pixels(ctx, x,y, width, height, format, type, pixels);
else else
draw_index_pixels(ctx, x, y, width, height, type, pixels); draw_index_pixels(ctx, x, y, width, height, type, pixels);

+ 9
- 9
src/mesa/main/enable.c Vedi File

/* $Id: enable.c,v 1.23 2000/08/30 18:21:06 brianp Exp $ */
/* $Id: enable.c,v 1.24 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
} }
break; break;
case GL_DEPTH_TEST: case GL_DEPTH_TEST:
if (state && ctx->Visual->DepthBits==0) {
gl_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
if (state && ctx->Visual.DepthBits==0) {
_mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
return; return;
} }
if (ctx->Depth.Test!=state) { if (ctx->Depth.Test!=state) {
ctx->Texture.SharedPalette = state; ctx->Texture.SharedPalette = state;
break; break;
case GL_STENCIL_TEST: case GL_STENCIL_TEST:
if (state && ctx->Visual->StencilBits==0) {
gl_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
if (state && ctx->Visual.StencilBits==0) {
_mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
return; return;
} }
if (ctx->Stencil.Enabled!=state) { if (ctx->Stencil.Enabled!=state) {
} }
break; break;
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit; const GLuint curr = ctx->Texture.CurrentUnit;
const GLuint flag = TEXTURE0_1D << (curr * 4); const GLuint flag = TEXTURE0_1D << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
} }
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit; const GLuint curr = ctx->Texture.CurrentUnit;
const GLuint flag = TEXTURE0_2D << (curr * 4); const GLuint flag = TEXTURE0_2D << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
} }
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit; const GLuint curr = ctx->Texture.CurrentUnit;
const GLuint flag = TEXTURE0_3D << (curr * 4); const GLuint flag = TEXTURE0_3D << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
/* GL_ARB_texture_cube_map */ /* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB: case GL_TEXTURE_CUBE_MAP_ARB:
if (ctx->Extensions.HaveTextureCubeMap) { if (ctx->Extensions.HaveTextureCubeMap) {
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit; const GLuint curr = ctx->Texture.CurrentUnit;
const GLuint flag = TEXTURE0_CUBE << (curr * 4); const GLuint flag = TEXTURE0_CUBE << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];

+ 9
- 9
src/mesa/main/feedback.c Vedi File

/* $Id: feedback.c,v 1.10 2000/05/09 23:54:09 brianp Exp $ */
/* $Id: feedback.c,v 1.11 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
break; break;
case GL_3D_COLOR: case GL_3D_COLOR:
ctx->Feedback.Mask = FB_3D ctx->Feedback.Mask = FB_3D
| (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX);
| (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX);
ctx->Feedback.Type = type; ctx->Feedback.Type = type;
break; break;
case GL_3D_COLOR_TEXTURE: case GL_3D_COLOR_TEXTURE:
ctx->Feedback.Mask = FB_3D ctx->Feedback.Mask = FB_3D
| (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX)
| (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)
| FB_TEXTURE; | FB_TEXTURE;
ctx->Feedback.Type = type; ctx->Feedback.Type = type;
break; break;
case GL_4D_COLOR_TEXTURE: case GL_4D_COLOR_TEXTURE:
ctx->Feedback.Mask = FB_3D | FB_4D ctx->Feedback.Mask = FB_3D | FB_4D
| (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX)
| (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)
| FB_TEXTURE; | FB_TEXTURE;
ctx->Feedback.Type = type; ctx->Feedback.Type = type;
break; break;


win[0] = VB->Win.data[v][0]; win[0] = VB->Win.data[v][0];
win[1] = VB->Win.data[v][1]; win[1] = VB->Win.data[v][1];
win[2] = VB->Win.data[v][2] / ctx->Visual->DepthMaxF;
win[2] = VB->Win.data[v][2] / ctx->Visual.DepthMaxF;
win[3] = 1.0 / VB->Win.data[v][3]; win[3] = 1.0 / VB->Win.data[v][3];


if (ctx->Light.ShadeModel == GL_SMOOTH) if (ctx->Light.ShadeModel == GL_SMOOTH)
const struct vertex_buffer *VB = ctx->VB; const struct vertex_buffer *VB = ctx->VB;


if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) { if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) {
const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF;
const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF;
gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs );
gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs );
gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs );
GLuint v0, GLuint v1, GLuint pv ) GLuint v0, GLuint v1, GLuint pv )
{ {
const struct vertex_buffer *VB = ctx->VB; const struct vertex_buffer *VB = ctx->VB;
const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF;
const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF;
gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs );
gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs );
} }
void gl_select_points( GLcontext *ctx, GLuint first, GLuint last ) void gl_select_points( GLcontext *ctx, GLuint first, GLuint last )
{ {
struct vertex_buffer *VB = ctx->VB; struct vertex_buffer *VB = ctx->VB;
const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF;
const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF;
GLuint i; GLuint i;


for (i=first;i<=last;i++) { for (i=first;i<=last;i++) {
if (ctx->Select.BufferCount > ctx->Select.BufferSize) { if (ctx->Select.BufferCount > ctx->Select.BufferSize) {
/* overflow */ /* overflow */
#ifdef DEBUG #ifdef DEBUG
gl_warning(ctx, "Feedback buffer overflow");
_mesa_warning(ctx, "Feedback buffer overflow");
#endif #endif
result = -1; result = -1;
} }

+ 2
- 2
src/mesa/main/fog.c Vedi File

/* $Id: fog.c,v 1.19 2000/07/07 15:10:35 keithw Exp $ */
/* $Id: fog.c,v 1.20 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLcontext *ctx = VB->ctx; GLcontext *ctx = VB->ctx;
GLuint i = VB->CullMode & 1; GLuint i = VB->CullMode & 1;


if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
/* Fog RGB colors */ /* Fog RGB colors */
if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT ); fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT );

+ 61
- 61
src/mesa/main/get.c Vedi File

/* $Id: get.c,v 1.33 2000/09/15 19:57:51 brianp Exp $ */
/* $Id: get.c,v 1.34 2000/09/26 20:53:53 brianp Exp $ */


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


switch (pname) { switch (pname) {
case GL_ACCUM_RED_BITS: case GL_ACCUM_RED_BITS:
*params = INT_TO_BOOL(ctx->Visual->AccumRedBits);
*params = INT_TO_BOOL(ctx->Visual.AccumRedBits);
break; break;
case GL_ACCUM_GREEN_BITS: case GL_ACCUM_GREEN_BITS:
*params = INT_TO_BOOL(ctx->Visual->AccumGreenBits);
*params = INT_TO_BOOL(ctx->Visual.AccumGreenBits);
break; break;
case GL_ACCUM_BLUE_BITS: case GL_ACCUM_BLUE_BITS:
*params = INT_TO_BOOL(ctx->Visual->AccumBlueBits);
*params = INT_TO_BOOL(ctx->Visual.AccumBlueBits);
break; break;
case GL_ACCUM_ALPHA_BITS: case GL_ACCUM_ALPHA_BITS:
*params = INT_TO_BOOL(ctx->Visual->AccumAlphaBits);
*params = INT_TO_BOOL(ctx->Visual.AccumAlphaBits);
break; break;
case GL_ACCUM_CLEAR_VALUE: case GL_ACCUM_CLEAR_VALUE:
params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]); params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]);
*params = FLOAT_TO_BOOL(ctx->Pixel.AlphaBias); *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaBias);
break; break;
case GL_ALPHA_BITS: case GL_ALPHA_BITS:
*params = INT_TO_BOOL(ctx->Visual->AlphaBits);
*params = INT_TO_BOOL(ctx->Visual.AlphaBits);
break; break;
case GL_ALPHA_SCALE: case GL_ALPHA_SCALE:
*params = FLOAT_TO_BOOL(ctx->Pixel.AlphaScale); *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaScale);
*params = FLOAT_TO_BOOL(ctx->Pixel.BlueBias); *params = FLOAT_TO_BOOL(ctx->Pixel.BlueBias);
break; break;
case GL_BLUE_BITS: case GL_BLUE_BITS:
*params = INT_TO_BOOL( ctx->Visual->BlueBits );
*params = INT_TO_BOOL( ctx->Visual.BlueBits );
break; break;
case GL_BLUE_SCALE: case GL_BLUE_SCALE:
*params = FLOAT_TO_BOOL(ctx->Pixel.BlueScale); *params = FLOAT_TO_BOOL(ctx->Pixel.BlueScale);
*params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias); *params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias);
break; break;
case GL_DEPTH_BITS: case GL_DEPTH_BITS:
*params = INT_TO_BOOL(ctx->Visual->DepthBits);
*params = INT_TO_BOOL(ctx->Visual.DepthBits);
break; break;
case GL_DEPTH_CLEAR_VALUE: case GL_DEPTH_CLEAR_VALUE:
*params = FLOAT_TO_BOOL(ctx->Depth.Clear); *params = FLOAT_TO_BOOL(ctx->Depth.Clear);
*params = ctx->Color.DitherFlag; *params = ctx->Color.DitherFlag;
break; break;
case GL_DOUBLEBUFFER: case GL_DOUBLEBUFFER:
*params = ctx->Visual->DBflag;
*params = ctx->Visual.DBflag;
break; break;
case GL_DRAW_BUFFER: case GL_DRAW_BUFFER:
*params = ENUM_TO_BOOL(ctx->Color.DrawBuffer); *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer);
*params = FLOAT_TO_BOOL(ctx->Pixel.GreenBias); *params = FLOAT_TO_BOOL(ctx->Pixel.GreenBias);
break; break;
case GL_GREEN_BITS: case GL_GREEN_BITS:
*params = INT_TO_BOOL( ctx->Visual->GreenBits );
*params = INT_TO_BOOL( ctx->Visual.GreenBits );
break; break;
case GL_GREEN_SCALE: case GL_GREEN_SCALE:
*params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale);
} }
break; break;
case GL_INDEX_BITS: case GL_INDEX_BITS:
*params = INT_TO_BOOL( ctx->Visual->IndexBits );
*params = INT_TO_BOOL( ctx->Visual.IndexBits );
break; break;
case GL_INDEX_CLEAR_VALUE: case GL_INDEX_CLEAR_VALUE:
*params = INT_TO_BOOL(ctx->Color.ClearIndex); *params = INT_TO_BOOL(ctx->Color.ClearIndex);
break; break;
case GL_INDEX_MODE: case GL_INDEX_MODE:
*params = ctx->Visual->RGBAflag ? GL_FALSE : GL_TRUE;
*params = ctx->Visual.RGBAflag ? GL_FALSE : GL_TRUE;
break; break;
case GL_INDEX_OFFSET: case GL_INDEX_OFFSET:
*params = INT_TO_BOOL(ctx->Pixel.IndexOffset); *params = INT_TO_BOOL(ctx->Pixel.IndexOffset);
*params = FLOAT_TO_BOOL(ctx->Pixel.RedBias); *params = FLOAT_TO_BOOL(ctx->Pixel.RedBias);
break; break;
case GL_RED_BITS: case GL_RED_BITS:
*params = INT_TO_BOOL( ctx->Visual->RedBits );
*params = INT_TO_BOOL( ctx->Visual.RedBits );
break; break;
case GL_RED_SCALE: case GL_RED_SCALE:
*params = FLOAT_TO_BOOL(ctx->Pixel.RedScale); *params = FLOAT_TO_BOOL(ctx->Pixel.RedScale);
*params = ENUM_TO_BOOL(ctx->RenderMode); *params = ENUM_TO_BOOL(ctx->RenderMode);
break; break;
case GL_RGBA_MODE: case GL_RGBA_MODE:
*params = ctx->Visual->RGBAflag;
*params = ctx->Visual.RGBAflag;
break; break;
case GL_SCISSOR_BOX: case GL_SCISSOR_BOX:
params[0] = INT_TO_BOOL(ctx->Scissor.X); params[0] = INT_TO_BOOL(ctx->Scissor.X);
*params = ctx->Texture.SharedPalette; *params = ctx->Texture.SharedPalette;
break; break;
case GL_STENCIL_BITS: case GL_STENCIL_BITS:
*params = INT_TO_BOOL(ctx->Visual->StencilBits);
*params = INT_TO_BOOL(ctx->Visual.StencilBits);
break; break;
case GL_STENCIL_CLEAR_VALUE: case GL_STENCIL_CLEAR_VALUE:
*params = INT_TO_BOOL(ctx->Stencil.Clear); *params = INT_TO_BOOL(ctx->Stencil.Clear);
*params = INT_TO_BOOL(ctx->Stencil.WriteMask); *params = INT_TO_BOOL(ctx->Stencil.WriteMask);
break; break;
case GL_STEREO: case GL_STEREO:
*params = ctx->Visual->StereoFlag;
*params = ctx->Visual.StereoFlag;
break; break;
case GL_SUBPIXEL_BITS: case GL_SUBPIXEL_BITS:
*params = INT_TO_BOOL(ctx->Const.SubPixelBits); *params = INT_TO_BOOL(ctx->Const.SubPixelBits);


switch (pname) { switch (pname) {
case GL_ACCUM_RED_BITS: case GL_ACCUM_RED_BITS:
*params = (GLdouble) ctx->Visual->AccumRedBits;
*params = (GLdouble) ctx->Visual.AccumRedBits;
break; break;
case GL_ACCUM_GREEN_BITS: case GL_ACCUM_GREEN_BITS:
*params = (GLdouble) ctx->Visual->AccumGreenBits;
*params = (GLdouble) ctx->Visual.AccumGreenBits;
break; break;
case GL_ACCUM_BLUE_BITS: case GL_ACCUM_BLUE_BITS:
*params = (GLdouble) ctx->Visual->AccumBlueBits;
*params = (GLdouble) ctx->Visual.AccumBlueBits;
break; break;
case GL_ACCUM_ALPHA_BITS: case GL_ACCUM_ALPHA_BITS:
*params = (GLdouble) ctx->Visual->AccumAlphaBits;
*params = (GLdouble) ctx->Visual.AccumAlphaBits;
break; break;
case GL_ACCUM_CLEAR_VALUE: case GL_ACCUM_CLEAR_VALUE:
params[0] = (GLdouble) ctx->Accum.ClearColor[0]; params[0] = (GLdouble) ctx->Accum.ClearColor[0];
*params = (GLdouble) ctx->Pixel.AlphaBias; *params = (GLdouble) ctx->Pixel.AlphaBias;
break; break;
case GL_ALPHA_BITS: case GL_ALPHA_BITS:
*params = (GLdouble) ctx->Visual->AlphaBits;
*params = (GLdouble) ctx->Visual.AlphaBits;
break; break;
case GL_ALPHA_SCALE: case GL_ALPHA_SCALE:
*params = (GLdouble) ctx->Pixel.AlphaScale; *params = (GLdouble) ctx->Pixel.AlphaScale;
*params = (GLdouble) ctx->Pixel.BlueBias; *params = (GLdouble) ctx->Pixel.BlueBias;
break; break;
case GL_BLUE_BITS: case GL_BLUE_BITS:
*params = (GLdouble) ctx->Visual->BlueBits;
*params = (GLdouble) ctx->Visual.BlueBits;
break; break;
case GL_BLUE_SCALE: case GL_BLUE_SCALE:
*params = (GLdouble) ctx->Pixel.BlueScale; *params = (GLdouble) ctx->Pixel.BlueScale;
*params = (GLdouble) ctx->Pixel.DepthBias; *params = (GLdouble) ctx->Pixel.DepthBias;
break; break;
case GL_DEPTH_BITS: case GL_DEPTH_BITS:
*params = (GLdouble) ctx->Visual->DepthBits;
*params = (GLdouble) ctx->Visual.DepthBits;
break; break;
case GL_DEPTH_CLEAR_VALUE: case GL_DEPTH_CLEAR_VALUE:
*params = (GLdouble) ctx->Depth.Clear; *params = (GLdouble) ctx->Depth.Clear;
*params = (GLdouble) ctx->Color.DitherFlag; *params = (GLdouble) ctx->Color.DitherFlag;
break; break;
case GL_DOUBLEBUFFER: case GL_DOUBLEBUFFER:
*params = (GLdouble) ctx->Visual->DBflag;
*params = (GLdouble) ctx->Visual.DBflag;
break; break;
case GL_DRAW_BUFFER: case GL_DRAW_BUFFER:
*params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer); *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer);
*params = (GLdouble) ctx->Pixel.GreenBias; *params = (GLdouble) ctx->Pixel.GreenBias;
break; break;
case GL_GREEN_BITS: case GL_GREEN_BITS:
*params = (GLdouble) ctx->Visual->GreenBits;
*params = (GLdouble) ctx->Visual.GreenBits;
break; break;
case GL_GREEN_SCALE: case GL_GREEN_SCALE:
*params = (GLdouble) ctx->Pixel.GreenScale; *params = (GLdouble) ctx->Pixel.GreenScale;
} }
break; break;
case GL_INDEX_BITS: case GL_INDEX_BITS:
*params = (GLdouble) ctx->Visual->IndexBits;
*params = (GLdouble) ctx->Visual.IndexBits;
break; break;
case GL_INDEX_CLEAR_VALUE: case GL_INDEX_CLEAR_VALUE:
*params = (GLdouble) ctx->Color.ClearIndex; *params = (GLdouble) ctx->Color.ClearIndex;
break; break;
case GL_INDEX_MODE: case GL_INDEX_MODE:
*params = ctx->Visual->RGBAflag ? 0.0 : 1.0;
*params = ctx->Visual.RGBAflag ? 0.0 : 1.0;
break; break;
case GL_INDEX_OFFSET: case GL_INDEX_OFFSET:
*params = (GLdouble) ctx->Pixel.IndexOffset; *params = (GLdouble) ctx->Pixel.IndexOffset;
*params = (GLdouble) ctx->Pixel.RedBias; *params = (GLdouble) ctx->Pixel.RedBias;
break; break;
case GL_RED_BITS: case GL_RED_BITS:
*params = (GLdouble) ctx->Visual->RedBits;
*params = (GLdouble) ctx->Visual.RedBits;
break; break;
case GL_RED_SCALE: case GL_RED_SCALE:
*params = (GLdouble) ctx->Pixel.RedScale; *params = (GLdouble) ctx->Pixel.RedScale;
*params = ENUM_TO_DOUBLE(ctx->RenderMode); *params = ENUM_TO_DOUBLE(ctx->RenderMode);
break; break;
case GL_RGBA_MODE: case GL_RGBA_MODE:
*params = (GLdouble) ctx->Visual->RGBAflag;
*params = (GLdouble) ctx->Visual.RGBAflag;
break; break;
case GL_SCISSOR_BOX: case GL_SCISSOR_BOX:
params[0] = (GLdouble) ctx->Scissor.X; params[0] = (GLdouble) ctx->Scissor.X;
*params = (GLdouble) ctx->Texture.SharedPalette; *params = (GLdouble) ctx->Texture.SharedPalette;
break; break;
case GL_STENCIL_BITS: case GL_STENCIL_BITS:
*params = (GLdouble) ctx->Visual->StencilBits;
*params = (GLdouble) ctx->Visual.StencilBits;
break; break;
case GL_STENCIL_CLEAR_VALUE: case GL_STENCIL_CLEAR_VALUE:
*params = (GLdouble) ctx->Stencil.Clear; *params = (GLdouble) ctx->Stencil.Clear;
*params = (GLdouble) ctx->Stencil.WriteMask; *params = (GLdouble) ctx->Stencil.WriteMask;
break; break;
case GL_STEREO: case GL_STEREO:
*params = (GLdouble) ctx->Visual->StereoFlag;
*params = (GLdouble) ctx->Visual.StereoFlag;
break; break;
case GL_SUBPIXEL_BITS: case GL_SUBPIXEL_BITS:
*params = (GLdouble) ctx->Const.SubPixelBits; *params = (GLdouble) ctx->Const.SubPixelBits;


switch (pname) { switch (pname) {
case GL_ACCUM_RED_BITS: case GL_ACCUM_RED_BITS:
*params = (GLfloat) ctx->Visual->AccumRedBits;
*params = (GLfloat) ctx->Visual.AccumRedBits;
break; break;
case GL_ACCUM_GREEN_BITS: case GL_ACCUM_GREEN_BITS:
*params = (GLfloat) ctx->Visual->AccumGreenBits;
*params = (GLfloat) ctx->Visual.AccumGreenBits;
break; break;
case GL_ACCUM_BLUE_BITS: case GL_ACCUM_BLUE_BITS:
*params = (GLfloat) ctx->Visual->AccumBlueBits;
*params = (GLfloat) ctx->Visual.AccumBlueBits;
break; break;
case GL_ACCUM_ALPHA_BITS: case GL_ACCUM_ALPHA_BITS:
*params = (GLfloat) ctx->Visual->AccumAlphaBits;
*params = (GLfloat) ctx->Visual.AccumAlphaBits;
break; break;
case GL_ACCUM_CLEAR_VALUE: case GL_ACCUM_CLEAR_VALUE:
params[0] = ctx->Accum.ClearColor[0]; params[0] = ctx->Accum.ClearColor[0];
*params = ctx->Pixel.AlphaBias; *params = ctx->Pixel.AlphaBias;
break; break;
case GL_ALPHA_BITS: case GL_ALPHA_BITS:
*params = (GLfloat) ctx->Visual->AlphaBits;
*params = (GLfloat) ctx->Visual.AlphaBits;
break; break;
case GL_ALPHA_SCALE: case GL_ALPHA_SCALE:
*params = ctx->Pixel.AlphaScale; *params = ctx->Pixel.AlphaScale;
*params = ctx->Pixel.BlueBias; *params = ctx->Pixel.BlueBias;
break; break;
case GL_BLUE_BITS: case GL_BLUE_BITS:
*params = (GLfloat) ctx->Visual->BlueBits;
*params = (GLfloat) ctx->Visual.BlueBits;
break; break;
case GL_BLUE_SCALE: case GL_BLUE_SCALE:
*params = ctx->Pixel.BlueScale; *params = ctx->Pixel.BlueScale;
*params = (GLfloat) ctx->Pixel.DepthBias; *params = (GLfloat) ctx->Pixel.DepthBias;
break; break;
case GL_DEPTH_BITS: case GL_DEPTH_BITS:
*params = (GLfloat) ctx->Visual->DepthBits;
*params = (GLfloat) ctx->Visual.DepthBits;
break; break;
case GL_DEPTH_CLEAR_VALUE: case GL_DEPTH_CLEAR_VALUE:
*params = (GLfloat) ctx->Depth.Clear; *params = (GLfloat) ctx->Depth.Clear;
*params = (GLfloat) ctx->Color.DitherFlag; *params = (GLfloat) ctx->Color.DitherFlag;
break; break;
case GL_DOUBLEBUFFER: case GL_DOUBLEBUFFER:
*params = (GLfloat) ctx->Visual->DBflag;
*params = (GLfloat) ctx->Visual.DBflag;
break; break;
case GL_DRAW_BUFFER: case GL_DRAW_BUFFER:
*params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer); *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer);
*params = (GLfloat) ctx->Pixel.GreenBias; *params = (GLfloat) ctx->Pixel.GreenBias;
break; break;
case GL_GREEN_BITS: case GL_GREEN_BITS:
*params = (GLfloat) ctx->Visual->GreenBits;
*params = (GLfloat) ctx->Visual.GreenBits;
break; break;
case GL_GREEN_SCALE: case GL_GREEN_SCALE:
*params = (GLfloat) ctx->Pixel.GreenScale; *params = (GLfloat) ctx->Pixel.GreenScale;
} }
break; break;
case GL_INDEX_BITS: case GL_INDEX_BITS:
*params = (GLfloat) ctx->Visual->IndexBits;
*params = (GLfloat) ctx->Visual.IndexBits;
break; break;
case GL_INDEX_CLEAR_VALUE: case GL_INDEX_CLEAR_VALUE:
*params = (GLfloat) ctx->Color.ClearIndex; *params = (GLfloat) ctx->Color.ClearIndex;
break; break;
case GL_INDEX_MODE: case GL_INDEX_MODE:
*params = ctx->Visual->RGBAflag ? 0.0F : 1.0F;
*params = ctx->Visual.RGBAflag ? 0.0F : 1.0F;
break; break;
case GL_INDEX_OFFSET: case GL_INDEX_OFFSET:
*params = (GLfloat) ctx->Pixel.IndexOffset; *params = (GLfloat) ctx->Pixel.IndexOffset;
*params = ctx->Pixel.RedBias; *params = ctx->Pixel.RedBias;
break; break;
case GL_RED_BITS: case GL_RED_BITS:
*params = (GLfloat) ctx->Visual->RedBits;
*params = (GLfloat) ctx->Visual.RedBits;
break; break;
case GL_RED_SCALE: case GL_RED_SCALE:
*params = ctx->Pixel.RedScale; *params = ctx->Pixel.RedScale;
*params = ENUM_TO_FLOAT(ctx->RenderMode); *params = ENUM_TO_FLOAT(ctx->RenderMode);
break; break;
case GL_RGBA_MODE: case GL_RGBA_MODE:
*params = (GLfloat) ctx->Visual->RGBAflag;
*params = (GLfloat) ctx->Visual.RGBAflag;
break; break;
case GL_SCISSOR_BOX: case GL_SCISSOR_BOX:
params[0] = (GLfloat) ctx->Scissor.X; params[0] = (GLfloat) ctx->Scissor.X;
*params = (GLfloat) ctx->Texture.SharedPalette; *params = (GLfloat) ctx->Texture.SharedPalette;
break; break;
case GL_STENCIL_BITS: case GL_STENCIL_BITS:
*params = (GLfloat) ctx->Visual->StencilBits;
*params = (GLfloat) ctx->Visual.StencilBits;
break; break;
case GL_STENCIL_CLEAR_VALUE: case GL_STENCIL_CLEAR_VALUE:
*params = (GLfloat) ctx->Stencil.Clear; *params = (GLfloat) ctx->Stencil.Clear;
*params = (GLfloat) ctx->Stencil.WriteMask; *params = (GLfloat) ctx->Stencil.WriteMask;
break; break;
case GL_STEREO: case GL_STEREO:
*params = (GLfloat) ctx->Visual->StereoFlag;
*params = (GLfloat) ctx->Visual.StereoFlag;
break; break;
case GL_SUBPIXEL_BITS: case GL_SUBPIXEL_BITS:
*params = (GLfloat) ctx->Const.SubPixelBits; *params = (GLfloat) ctx->Const.SubPixelBits;


switch (pname) { switch (pname) {
case GL_ACCUM_RED_BITS: case GL_ACCUM_RED_BITS:
*params = (GLint) ctx->Visual->AccumRedBits;
*params = (GLint) ctx->Visual.AccumRedBits;
break; break;
case GL_ACCUM_GREEN_BITS: case GL_ACCUM_GREEN_BITS:
*params = (GLint) ctx->Visual->AccumGreenBits;
*params = (GLint) ctx->Visual.AccumGreenBits;
break; break;
case GL_ACCUM_BLUE_BITS: case GL_ACCUM_BLUE_BITS:
*params = (GLint) ctx->Visual->AccumBlueBits;
*params = (GLint) ctx->Visual.AccumBlueBits;
break; break;
case GL_ACCUM_ALPHA_BITS: case GL_ACCUM_ALPHA_BITS:
*params = (GLint) ctx->Visual->AccumAlphaBits;
*params = (GLint) ctx->Visual.AccumAlphaBits;
break; break;
case GL_ACCUM_CLEAR_VALUE: case GL_ACCUM_CLEAR_VALUE:
params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] ); params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] );
*params = (GLint) ctx->Pixel.AlphaBias; *params = (GLint) ctx->Pixel.AlphaBias;
break; break;
case GL_ALPHA_BITS: case GL_ALPHA_BITS:
*params = ctx->Visual->AlphaBits;
*params = ctx->Visual.AlphaBits;
break; break;
case GL_ALPHA_SCALE: case GL_ALPHA_SCALE:
*params = (GLint) ctx->Pixel.AlphaScale; *params = (GLint) ctx->Pixel.AlphaScale;
*params = (GLint) ctx->Pixel.BlueBias; *params = (GLint) ctx->Pixel.BlueBias;
break; break;
case GL_BLUE_BITS: case GL_BLUE_BITS:
*params = (GLint) ctx->Visual->BlueBits;
*params = (GLint) ctx->Visual.BlueBits;
break; break;
case GL_BLUE_SCALE: case GL_BLUE_SCALE:
*params = (GLint) ctx->Pixel.BlueScale; *params = (GLint) ctx->Pixel.BlueScale;
*params = (GLint) ctx->Pixel.DepthBias; *params = (GLint) ctx->Pixel.DepthBias;
break; break;
case GL_DEPTH_BITS: case GL_DEPTH_BITS:
*params = ctx->Visual->DepthBits;
*params = ctx->Visual.DepthBits;
break; break;
case GL_DEPTH_CLEAR_VALUE: case GL_DEPTH_CLEAR_VALUE:
*params = (GLint) ctx->Depth.Clear; *params = (GLint) ctx->Depth.Clear;
*params = (GLint) ctx->Color.DitherFlag; *params = (GLint) ctx->Color.DitherFlag;
break; break;
case GL_DOUBLEBUFFER: case GL_DOUBLEBUFFER:
*params = (GLint) ctx->Visual->DBflag;
*params = (GLint) ctx->Visual.DBflag;
break; break;
case GL_DRAW_BUFFER: case GL_DRAW_BUFFER:
*params = (GLint) ctx->Color.DrawBuffer; *params = (GLint) ctx->Color.DrawBuffer;
*params = (GLint) ctx->Pixel.GreenBias; *params = (GLint) ctx->Pixel.GreenBias;
break; break;
case GL_GREEN_BITS: case GL_GREEN_BITS:
*params = (GLint) ctx->Visual->GreenBits;
*params = (GLint) ctx->Visual.GreenBits;
break; break;
case GL_GREEN_SCALE: case GL_GREEN_SCALE:
*params = (GLint) ctx->Pixel.GreenScale; *params = (GLint) ctx->Pixel.GreenScale;
} }
break; break;
case GL_INDEX_BITS: case GL_INDEX_BITS:
*params = (GLint) ctx->Visual->IndexBits;
*params = (GLint) ctx->Visual.IndexBits;
break; break;
case GL_INDEX_CLEAR_VALUE: case GL_INDEX_CLEAR_VALUE:
*params = (GLint) ctx->Color.ClearIndex; *params = (GLint) ctx->Color.ClearIndex;
break; break;
case GL_INDEX_MODE: case GL_INDEX_MODE:
*params = ctx->Visual->RGBAflag ? 0 : 1;
*params = ctx->Visual.RGBAflag ? 0 : 1;
break; break;
case GL_INDEX_OFFSET: case GL_INDEX_OFFSET:
*params = ctx->Pixel.IndexOffset; *params = ctx->Pixel.IndexOffset;
*params = (GLint) ctx->Pixel.RedBias; *params = (GLint) ctx->Pixel.RedBias;
break; break;
case GL_RED_BITS: case GL_RED_BITS:
*params = (GLint) ctx->Visual->RedBits;
*params = (GLint) ctx->Visual.RedBits;
break; break;
case GL_RED_SCALE: case GL_RED_SCALE:
*params = (GLint) ctx->Pixel.RedScale; *params = (GLint) ctx->Pixel.RedScale;
*params = (GLint) ctx->RenderMode; *params = (GLint) ctx->RenderMode;
break; break;
case GL_RGBA_MODE: case GL_RGBA_MODE:
*params = (GLint) ctx->Visual->RGBAflag;
*params = (GLint) ctx->Visual.RGBAflag;
break; break;
case GL_SCISSOR_BOX: case GL_SCISSOR_BOX:
params[0] = (GLint) ctx->Scissor.X; params[0] = (GLint) ctx->Scissor.X;
*params = (GLint) ctx->Texture.SharedPalette; *params = (GLint) ctx->Texture.SharedPalette;
break; break;
case GL_STENCIL_BITS: case GL_STENCIL_BITS:
*params = ctx->Visual->StencilBits;
*params = ctx->Visual.StencilBits;
break; break;
case GL_STENCIL_CLEAR_VALUE: case GL_STENCIL_CLEAR_VALUE:
*params = (GLint) ctx->Stencil.Clear; *params = (GLint) ctx->Stencil.Clear;
*params = (GLint) ctx->Stencil.WriteMask; *params = (GLint) ctx->Stencil.WriteMask;
break; break;
case GL_STEREO: case GL_STEREO:
*params = (GLint) ctx->Visual->StereoFlag;
*params = (GLint) ctx->Visual.StereoFlag;
break; break;
case GL_SUBPIXEL_BITS: case GL_SUBPIXEL_BITS:
*params = ctx->Const.SubPixelBits; *params = ctx->Const.SubPixelBits;

+ 7
- 1
src/mesa/main/glheader.h Vedi File

/* $Id: glheader.h,v 1.14 2000/09/15 15:42:45 brianp Exp $ */
/* $Id: glheader.h,v 1.15 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#include "GL/glext.h" #include "GL/glext.h"




#ifndef CAPI
#define CAPI
#endif
#include "glcore.h"




/* Disable unreachable code warnings for Watcom C++ */ /* Disable unreachable code warnings for Watcom C++ */
#ifdef __WATCOMC__ #ifdef __WATCOMC__

+ 4
- 4
src/mesa/main/image.c Vedi File

/* $Id: image.c,v 1.41 2000/09/14 23:13:51 brianp Exp $ */
/* $Id: image.c,v 1.42 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
srcType == GL_UNSIGNED_INT_2_10_10_10_REV); srcType == GL_UNSIGNED_INT_2_10_10_10_REV);


/* this is intended for RGBA mode only */ /* this is intended for RGBA mode only */
assert(ctx->Visual->RGBAflag);
assert(ctx->Visual.RGBAflag);


/* Try simple cases first */ /* Try simple cases first */
if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE) { if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE) {
srcType == GL_UNSIGNED_INT_2_10_10_10_REV); srcType == GL_UNSIGNED_INT_2_10_10_10_REV);


/* this is intended for RGBA mode only */ /* this is intended for RGBA mode only */
assert(ctx->Visual->RGBAflag);
assert(ctx->Visual.RGBAflag);


/* general solution, no special cases, yet */ /* general solution, no special cases, yet */
{ {


/* clamp depth values to [0,1] and convert from floats to integers */ /* clamp depth values to [0,1] and convert from floats to integers */
{ {
const GLfloat zs = ctx->Visual->DepthMaxF;
const GLfloat zs = ctx->Visual.DepthMaxF;
GLuint i; GLuint i;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * zs); dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * zs);

+ 163
- 0
src/mesa/main/imports.c Vedi File

/* $Id: imports.c,v 1.1 2000/09/26 20:53:53 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2000 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


/*
* Imports are functions which the device driver or window system or
* operating system provides to the core renderer. The core renderer (Mesa)
* will call these functions in order to do memory allocation, simple I/O,
* etc.
*
* Some drivers will need to implement these functions themselves but
* many (most?) Mesa drivers will be fine using these.
*
* A server-side GL renderer will likely not use these functions since
* the renderer should use the XFree86-wrapped system calls.
*/


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


static void *
_mesa_Malloc(__GLcontext *gc, size_t size)
{
return MALLOC(size);
}

static void *
_mesa_Calloc(__GLcontext *gc, size_t numElem, size_t elemSize)
{
return CALLOC(numElem * elemSize);
}

static void *
_mesa_Realloc(__GLcontext *gc, void *oldAddr, size_t newSize)
{
return realloc(oldAddr, newSize);
}

static void
_mesa_Free(__GLcontext *gc, void *addr)
{
FREE(addr);
}

static void
_mesa_warning(__GLcontext *gc, char *str)
{
GLboolean debug;
#ifdef DEBUG
debug = GL_TRUE;
#else
if (gc->imports.getenv("MESA_DEBUG")) {
debug = GL_TRUE;
}
else {
debug = GL_FALSE;
}
#endif
if (debug) {
fprintf(stderr, "Mesa warning: %s\n", str);
}
}

static void
_mesa_fatal(__GLcontext *gc, char *str)
{
fprintf(stderr, "%s\n", str);
abort();
}

static char *
_mesa_getenv(__GLcontext *gc, const char *var)
{
(void) gc;
return getenv(var);
}

static int
_mesa_atoi(__GLcontext *gc, const char *str)
{
(void) gc;
return atoi(str);
}

static int
_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...)
{
/* XXX fix this */
return sprintf(str, fmt);
}

static void *
_mesa_fopen(__GLcontext *gc, const char *path, const char *mode)
{
return fopen(path, mode);
}

static int
_mesa_fclose(__GLcontext *gc, void *stream)
{
return fclose(stream);
}

static int
_mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
{
/* XXX fix this */
return fprintf(stream, fmt);
}

/* XXX this really is driver-specific and can't be here */
static __GLdrawablePrivate *
_mesa_GetDrawablePrivate(__GLcontext *gc)
{
return NULL;
}


void
_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other)
{
imports->malloc = _mesa_Malloc;
imports->calloc = _mesa_Calloc;
imports->realloc = _mesa_Realloc;
imports->free = _mesa_Free;
imports->warning = _mesa_warning;
imports->fatal = _mesa_fatal;
imports->getenv = _mesa_getenv;
imports->atoi = _mesa_atoi;
imports->sprintf = _mesa_sprintf;
imports->fopen = _mesa_fopen;
imports->fclose = _mesa_fclose;
imports->fprintf = _mesa_fprintf;
imports->getDrawablePrivate = _mesa_GetDrawablePrivate;
imports->wscx = driverCtx;
imports->other = other;
}

+ 39
- 0
src/mesa/main/imports.h Vedi File

/* $Id: imports.h,v 1.1 2000/09/26 20:53:53 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2000 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


#ifndef IMPORTS_H
#define IMPORTS_H


#include "glheader.h"


extern void
_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other);


#endif

+ 2
- 2
src/mesa/main/light.c Vedi File

/* $Id: light.c,v 1.16 2000/07/18 16:55:56 brianp Exp $ */
/* $Id: light.c,v 1.17 2000/09/26 20:53:53 brianp Exp $ */


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


/* Precompute some shading values. /* Precompute some shading values.
*/ */
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
GLuint sides = ((ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1); GLuint sides = ((ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1);
GLuint side; GLuint side;
for (side=0; side < sides; side++) { for (side=0; side < sides; side++) {

+ 2
- 2
src/mesa/main/lines.c Vedi File

/* $Id: lines.c,v 1.12 2000/07/14 14:04:07 brianp Exp $ */
/* $Id: lines.c,v 1.13 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */
void gl_set_line_function( GLcontext *ctx ) void gl_set_line_function( GLcontext *ctx )
{ {
GLboolean rgbmode = ctx->Visual->RGBAflag;
GLboolean rgbmode = ctx->Visual.RGBAflag;
/* TODO: antialiased lines */ /* TODO: antialiased lines */


if (ctx->RenderMode==GL_RENDER) { if (ctx->RenderMode==GL_RENDER) {

+ 5
- 5
src/mesa/main/matrix.c Vedi File

/* $Id: matrix.c,v 1.20 2000/09/17 21:56:07 brianp Exp $ */
/* $Id: matrix.c,v 1.21 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
ctx->Viewport.WindowMap.m[MAT_TX] = ctx->Viewport.WindowMap.m[MAT_SX] + x; ctx->Viewport.WindowMap.m[MAT_TX] = ctx->Viewport.WindowMap.m[MAT_SX] + x;
ctx->Viewport.WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F; ctx->Viewport.WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F;
ctx->Viewport.WindowMap.m[MAT_TY] = ctx->Viewport.WindowMap.m[MAT_SY] + y; ctx->Viewport.WindowMap.m[MAT_TY] = ctx->Viewport.WindowMap.m[MAT_SY] + y;
ctx->Viewport.WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual->DepthMaxF;
ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual->DepthMaxF;
ctx->Viewport.WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual.DepthMaxF;
ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual.DepthMaxF;


ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION;
ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT;


ctx->Viewport.Near = n; ctx->Viewport.Near = n;
ctx->Viewport.Far = f; ctx->Viewport.Far = f;
ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0);
ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0 + n);
ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0);
ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0 + n);


ctx->ModelProjectWinMatrixUptodate = GL_FALSE; ctx->ModelProjectWinMatrixUptodate = GL_FALSE;



+ 2
- 2
src/mesa/main/points.c Vedi File

/* $Id: points.c,v 1.12 2000/08/16 17:26:06 brianp Exp $ */
/* $Id: points.c,v 1.13 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */
void gl_set_point_function( GLcontext *ctx ) void gl_set_point_function( GLcontext *ctx )
{ {
GLboolean rgbmode = ctx->Visual->RGBAflag;
GLboolean rgbmode = ctx->Visual.RGBAflag;


if (ctx->RenderMode==GL_RENDER) { if (ctx->RenderMode==GL_RENDER) {
if (ctx->NoRaster) { if (ctx->NoRaster) {

+ 3
- 3
src/mesa/main/polygon.c Vedi File

/* $Id: polygon.c,v 1.11 2000/03/13 18:32:37 brianp Exp $ */
/* $Id: polygon.c,v 1.12 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.3
* Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT");
_mesa_PolygonOffset(factor, bias * ctx->Visual->DepthMaxF );
_mesa_PolygonOffset(factor, bias * ctx->Visual.DepthMaxF );
} }

+ 4
- 4
src/mesa/main/rastpos.c Vedi File

/* $Id: rastpos.c,v 1.6 2000/03/03 17:47:39 brianp Exp $ */
/* $Id: rastpos.c,v 1.7 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.3
* Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
} }
else { else {
/* use current color or index */ /* use current color or index */
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor, UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
ctx->Current.ByteColor); ctx->Current.ByteColor);
} }
ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport.WindowMap.m[MAT_SY] + ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport.WindowMap.m[MAT_SY] +
ctx->Viewport.WindowMap.m[MAT_TY]); ctx->Viewport.WindowMap.m[MAT_TY]);
ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport.WindowMap.m[MAT_SZ] + ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport.WindowMap.m[MAT_SZ] +
ctx->Viewport.WindowMap.m[MAT_TZ]) / ctx->Visual->DepthMaxF;
ctx->Viewport.WindowMap.m[MAT_TZ]) / ctx->Visual.DepthMaxF;
ctx->Current.RasterPos[3] = clip[3]; ctx->Current.RasterPos[3] = clip[3];
ctx->Current.RasterPosValid = GL_TRUE; ctx->Current.RasterPosValid = GL_TRUE;



+ 4
- 4
src/mesa/main/state.c Vedi File

/* $Id: state.c,v 1.27 2000/09/08 22:07:29 brianp Exp $ */
/* $Id: state.c,v 1.28 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
if (ctx->FogMode == FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT; if (ctx->FogMode == FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT;
if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
if (ctx->Visual->RGBAflag) {
if (ctx->Visual.RGBAflag) {
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
if (colorMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT; if (colorMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT;
if (ctx->Color.ColorLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT; if (ctx->Color.ColorLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
ctx->RasterMask |= MULTI_DRAW_BIT; ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW; ctx->TriangleCaps |= DD_MULTIDRAW;
} }
else if (ctx->Visual->RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) {
else if (ctx->Visual.RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) {
/* all RGBA channels disabled */ /* all RGBA channels disabled */
ctx->RasterMask |= MULTI_DRAW_BIT; ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW; ctx->TriangleCaps |= DD_MULTIDRAW;
} }
else if (!ctx->Visual->RGBAflag && ctx->Color.IndexMask==0) {
else if (!ctx->Visual.RGBAflag && ctx->Color.IndexMask==0) {
/* all color index bits disabled */ /* all color index bits disabled */
ctx->RasterMask |= MULTI_DRAW_BIT; ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW; ctx->TriangleCaps |= DD_MULTIDRAW;

+ 2
- 2
src/mesa/main/stencil.c Vedi File

/* $Id: stencil.c,v 1.18 2000/09/08 21:28:04 brianp Exp $ */
/* $Id: stencil.c,v 1.19 2000/09/26 20:53:53 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
static void static void
clear_software_stencil_buffer( GLcontext *ctx ) clear_software_stencil_buffer( GLcontext *ctx )
{ {
if (ctx->Visual->StencilBits==0 || !ctx->DrawBuffer->Stencil) {
if (ctx->Visual.StencilBits==0 || !ctx->DrawBuffer->Stencil) {
/* no stencil buffer */ /* no stencil buffer */
return; return;
} }

Loading…
Annulla
Salva