GLvisual inside GLframebuffer is no longer a pointer, copy the struct instead.
Added context/drawbuffer visual config sanity checking in _mesa_make_current2(). Added some 'const' keywords.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: context.c,v 1.123 2001/02/27 16:14:35 keithw Exp $ */
|
||||
/* $Id: context.c,v 1.124 2001/02/28 00:27:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -303,16 +303,15 @@ _mesa_destroy_visual( GLvisual *vis )
|
||||
* Create a new framebuffer. A GLframebuffer is a struct which
|
||||
* encapsulates the depth, stencil and accum buffers and related
|
||||
* parameters.
|
||||
* Input: visual - a GLvisual pointer
|
||||
* Input: visual - a GLvisual pointer (we copy the struct contents)
|
||||
* softwareDepth - create/use a software depth buffer?
|
||||
* softwareStencil - create/use a software stencil buffer?
|
||||
* softwareAccum - create/use a software accum buffer?
|
||||
* softwareAlpha - create/use a software alpha buffer?
|
||||
|
||||
* Return: pointer to new GLframebuffer struct or NULL if error.
|
||||
*/
|
||||
GLframebuffer *
|
||||
_mesa_create_framebuffer( GLvisual *visual,
|
||||
_mesa_create_framebuffer( const GLvisual *visual,
|
||||
GLboolean softwareDepth,
|
||||
GLboolean softwareStencil,
|
||||
GLboolean softwareAccum,
|
||||
@@ -335,7 +334,7 @@ _mesa_create_framebuffer( GLvisual *visual,
|
||||
*/
|
||||
void
|
||||
_mesa_initialize_framebuffer( GLframebuffer *buffer,
|
||||
GLvisual *visual,
|
||||
const GLvisual *visual,
|
||||
GLboolean softwareDepth,
|
||||
GLboolean softwareStencil,
|
||||
GLboolean softwareAccum,
|
||||
@@ -362,7 +361,7 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer,
|
||||
assert(visual->alphaBits > 0);
|
||||
}
|
||||
|
||||
buffer->Visual = visual; /* XXX copy instead? */
|
||||
buffer->Visual = *visual; /* XXX copy instead? */
|
||||
buffer->UseSoftwareDepthBuffer = softwareDepth;
|
||||
buffer->UseSoftwareStencilBuffer = softwareStencil;
|
||||
buffer->UseSoftwareAccumBuffer = softwareAccum;
|
||||
@@ -1342,7 +1341,7 @@ alloc_proxy_textures( GLcontext *ctx )
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_initialize_context( GLcontext *ctx,
|
||||
GLvisual *visual,
|
||||
const GLvisual *visual,
|
||||
GLcontext *share_list,
|
||||
void *driver_ctx,
|
||||
GLboolean direct )
|
||||
@@ -1495,13 +1494,13 @@ _mesa_initialize_context( GLcontext *ctx,
|
||||
|
||||
/*
|
||||
* Allocate and initialize a GLcontext structure.
|
||||
* Input: visual - a GLvisual pointer
|
||||
* Input: visual - a GLvisual pointer (we copy the struct contents)
|
||||
* sharelist - another context to share display lists with or NULL
|
||||
* driver_ctx - pointer to device driver's context state struct
|
||||
* Return: pointer to a new __GLcontextRec or NULL if error.
|
||||
*/
|
||||
GLcontext *
|
||||
_mesa_create_context( GLvisual *visual,
|
||||
_mesa_create_context( const GLvisual *visual,
|
||||
GLcontext *share_list,
|
||||
void *driver_ctx,
|
||||
GLboolean direct )
|
||||
@@ -1775,6 +1774,20 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
||||
if (MESA_VERBOSE)
|
||||
fprintf(stderr, "_mesa_make_current2()\n");
|
||||
|
||||
/* Check that the context's and framebuffer's visuals are compatible.
|
||||
* We could do a lot more checking here but this'll catch obvious
|
||||
* problems.
|
||||
*/
|
||||
if (newCtx && drawBuffer && readBuffer) {
|
||||
if (newCtx->Visual.rgbMode != drawBuffer->Visual.rgbMode ||
|
||||
newCtx->Visual.redBits != drawBuffer->Visual.redBits ||
|
||||
newCtx->Visual.depthBits != drawBuffer->Visual.depthBits ||
|
||||
newCtx->Visual.stencilBits != drawBuffer->Visual.stencilBits ||
|
||||
newCtx->Visual.accumRedBits != drawBuffer->Visual.accumRedBits) {
|
||||
return; /* incompatible */
|
||||
}
|
||||
}
|
||||
|
||||
/* We call this function periodically (just here for now) in
|
||||
* order to detect when multithreading has begun.
|
||||
*/
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: context.h,v 1.22 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: context.h,v 1.23 2001/02/28 00:27:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -103,7 +103,7 @@ _mesa_destroy_visual( GLvisual *vis );
|
||||
* single entity.
|
||||
*/
|
||||
extern GLframebuffer *
|
||||
_mesa_create_framebuffer( GLvisual *visual,
|
||||
_mesa_create_framebuffer( const GLvisual *visual,
|
||||
GLboolean softwareDepth,
|
||||
GLboolean softwareStencil,
|
||||
GLboolean softwareAccum,
|
||||
@@ -111,7 +111,7 @@ _mesa_create_framebuffer( GLvisual *visual,
|
||||
|
||||
extern void
|
||||
_mesa_initialize_framebuffer( GLframebuffer *fb,
|
||||
GLvisual *visual,
|
||||
const GLvisual *visual,
|
||||
GLboolean softwareDepth,
|
||||
GLboolean softwareStencil,
|
||||
GLboolean softwareAccum,
|
||||
@@ -127,14 +127,14 @@ _mesa_destroy_framebuffer( GLframebuffer *buffer );
|
||||
* contains the rendering state.
|
||||
*/
|
||||
extern GLcontext *
|
||||
_mesa_create_context( GLvisual *visual,
|
||||
_mesa_create_context( const GLvisual *visual,
|
||||
GLcontext *share_list,
|
||||
void *driver_ctx,
|
||||
GLboolean direct);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_initialize_context( GLcontext *ctx,
|
||||
GLvisual *visual,
|
||||
const GLvisual *visual,
|
||||
GLcontext *share_list,
|
||||
void *driver_ctx,
|
||||
GLboolean direct );
|
||||
@@ -160,7 +160,7 @@ _mesa_make_current( GLcontext *ctx, GLframebuffer *buffer );
|
||||
|
||||
extern void
|
||||
_mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
|
||||
GLframebuffer *readBuffer );
|
||||
GLframebuffer *readBuffer );
|
||||
|
||||
|
||||
extern GLcontext *
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: mtypes.h,v 1.21 2001/02/20 16:42:25 brianp Exp $ */
|
||||
/* $Id: mtypes.h,v 1.22 2001/02/28 00:27:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -1118,7 +1118,7 @@ struct gl_shared_state {
|
||||
* will make derived classes.
|
||||
*/
|
||||
struct gl_frame_buffer {
|
||||
GLvisual *Visual; /* The corresponding visual */
|
||||
GLvisual Visual; /* The corresponding visual */
|
||||
|
||||
GLint Width, Height; /* size of frame buffer in pixels */
|
||||
|
||||
|
Reference in New Issue
Block a user