-/* $Id: context.c,v 1.44 2000/03/03 17:47:39 brianp Exp $ */
+/* $Id: context.c,v 1.52 2000/03/31 01:05:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Return: pointer to new GLvisual or NULL if requested parameters can't
* be met.
*/
-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 )
+GLvisual *
+_mesa_create_visual( GLboolean rgbFlag,
+ GLboolean alphaFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples )
{
GLvisual *vis;
if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) {
return NULL;
}
- if (accumBits < 0 || accumBits > (GLint) (8 * sizeof(GLaccum))) {
+ if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) {
+ return NULL;
+ }
+ if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) {
+ return NULL;
+ }
+ if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) {
+ return NULL;
+ }
+ if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) {
return NULL;
}
vis->BlueBits = blueBits;
vis->AlphaBits = alphaFlag ? (8 * sizeof(GLubyte)) : alphaBits;
- vis->IndexBits = indexBits;
- vis->DepthBits = depthBits;
- vis->AccumBits = (accumBits > 0) ? (8 * sizeof(GLaccum)) : 0;
- vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0;
+ vis->IndexBits = indexBits;
+ vis->DepthBits = depthBits;
+ vis->AccumRedBits = (accumRedBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->AccumGreenBits = (accumGreenBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->AccumBlueBits = (accumBlueBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->AccumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0;
vis->SoftwareAlpha = alphaFlag;
}
+/* 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 )
+{
+ return _mesa_create_visual(rgbFlag, alphaFlag, dbFlag, stereoFlag,
+ redBits, greenBits, blueBits, alphaBits,
+ indexBits, depthBits, stencilBits,
+ accumBits, accumBits, accumBits, accumBits, 0);
+}
+
+void
+_mesa_destroy_visual( GLvisual *vis )
+{
+ FREE(vis);
+}
+
+
+/* obsolete */
void gl_destroy_visual( GLvisual *vis )
{
- FREE( vis );
+ _mesa_destroy_visual(vis);
}
}
if (softwareAccum) {
assert(visual->RGBAflag);
- assert(visual->AccumBits > 0);
+ assert(visual->AccumRedBits > 0);
+ assert(visual->AccumGreenBits > 0);
+ assert(visual->AccumBlueBits > 0);
}
if (softwareAlpha) {
assert(visual->RGBAflag);
void gl_destroy_framebuffer( GLframebuffer *buffer )
{
if (buffer) {
- if (buffer->Depth) {
- FREE( buffer->Depth );
+ if (buffer->DepthBuffer) {
+ FREE( buffer->DepthBuffer );
}
if (buffer->Accum) {
FREE( buffer->Accum );
gl_init_clip();
gl_init_eval();
_mesa_init_fog();
- gl_init_math();
+ _mesa_init_math();
gl_init_lists();
gl_init_shade();
gl_init_texture();
gl_matrix_alloc_inv( &ctx->ModelView );
ctx->ModelViewStackDepth = 0;
- for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) {
+ for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) {
gl_matrix_ctr( &ctx->ModelViewStack[i] );
gl_matrix_alloc_inv( &ctx->ModelViewStack[i] );
}
ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */
ctx->NearFarStack[0][1] = 0.0; /* sense mathematically. */
- for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) {
+ for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) {
gl_matrix_ctr( &ctx->ProjectionStack[i] );
gl_matrix_alloc_inv( &ctx->ProjectionStack[i] );
}
for (i=0; i<MAX_TEXTURE_UNITS; i++) {
gl_matrix_ctr( &ctx->TextureMatrix[i] );
ctx->TextureStackDepth[i] = 0;
- for (j = 0 ; j < MAX_TEXTURE_STACK_DEPTH ; j++) {
+ for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) {
ctx->TextureStack[i][j].inv = 0;
}
}
ctx->Depth.Clear = 1.0;
ctx->Depth.Func = GL_LESS;
ctx->Depth.Mask = GL_TRUE;
+ ctx->Depth.OcclusionTest = GL_FALSE;
/* Evaluators group */
ctx->Eval.Map1Color4 = GL_FALSE;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
ctx->CatchSignals = GL_TRUE;
+ ctx->OcclusionResult = GL_FALSE;
/* For debug/development only */
ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
out_of_memory = GL_FALSE;
for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
- ctx->Texture.Proxy1D->Image[i] = gl_alloc_texture_image();
- ctx->Texture.Proxy2D->Image[i] = gl_alloc_texture_image();
- ctx->Texture.Proxy3D->Image[i] = gl_alloc_texture_image();
+ ctx->Texture.Proxy1D->Image[i] = _mesa_alloc_texture_image();
+ ctx->Texture.Proxy2D->Image[i] = _mesa_alloc_texture_image();
+ ctx->Texture.Proxy3D->Image[i] = _mesa_alloc_texture_image();
if (!ctx->Texture.Proxy1D->Image[i]
|| !ctx->Texture.Proxy2D->Image[i]
|| !ctx->Texture.Proxy3D->Image[i]) {
if (out_of_memory) {
for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
if (ctx->Texture.Proxy1D->Image[i]) {
- gl_free_texture_image(ctx->Texture.Proxy1D->Image[i]);
+ _mesa_free_texture_image(ctx->Texture.Proxy1D->Image[i]);
}
if (ctx->Texture.Proxy2D->Image[i]) {
- gl_free_texture_image(ctx->Texture.Proxy2D->Image[i]);
+ _mesa_free_texture_image(ctx->Texture.Proxy2D->Image[i]);
}
if (ctx->Texture.Proxy3D->Image[i]) {
- gl_free_texture_image(ctx->Texture.Proxy3D->Image[i]);
+ _mesa_free_texture_image(ctx->Texture.Proxy3D->Image[i]);
}
}
gl_free_texture_object(NULL, ctx->Texture.Proxy1D);
}
/* setup API dispatch tables */
- ctx->Exec = CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *));
- ctx->Save = CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *));
+ ctx->Exec = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *));
+ ctx->Save = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *));
if (!ctx->Exec || !ctx->Save) {
free_shared_state(ctx, ctx->Shared);
FREE(ctx->VB);
*/
void gl_free_context_data( GLcontext *ctx )
{
- GLuint i;
struct gl_shine_tab *s, *tmps;
+ GLuint i, j;
/* if we're destroying the current context, unbind it first */
if (ctx == gl_get_current_context()) {
#endif
gl_matrix_dtr( &ctx->ModelView );
- for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) {
+ for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) {
gl_matrix_dtr( &ctx->ModelViewStack[i] );
}
gl_matrix_dtr( &ctx->ProjectionMatrix );
- for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) {
+ for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) {
gl_matrix_dtr( &ctx->ProjectionStack[i] );
}
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+ gl_matrix_dtr( &ctx->TextureMatrix[i] );
+ for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) {
+ gl_matrix_dtr( &ctx->TextureStack[i][j] );
+ }
+ }
FREE( ctx->PB );