From: Brian Paul Date: Fri, 31 Mar 2000 01:05:51 +0000 (+0000) Subject: added _mesa_create/destroy_visual() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b371e0da2b51da7d941de557b62434aaaca5be02;p=mesa.git added _mesa_create/destroy_visual() --- diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e19fecedd94..92077533126 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.51 2000/03/27 17:54:17 brianp Exp $ */ +/* $Id: context.c,v 1.52 2000/03/31 01:05:51 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -267,18 +267,23 @@ static void print_timings( GLcontext *ctx ) * 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; @@ -294,7 +299,16 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, 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; } @@ -311,10 +325,13 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, 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; @@ -334,10 +351,38 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, } +/* 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); } @@ -381,7 +426,9 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual, } 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); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index b9cc69bc69d..8e691445f10 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,4 +1,4 @@ -/* $Id: context.h,v 1.14 2000/03/19 01:10:11 brianp Exp $ */ +/* $Id: context.h,v 1.15 2000/03/31 01:05:51 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -57,6 +57,25 @@ * the colorbuffer, depth buffer, stencil buffer and accum buffer which will * be used by the GL context and framebuffer. */ +extern 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 ); + +/* this function is obsolete */ extern GLvisual *gl_create_visual( GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag, @@ -70,7 +89,11 @@ extern GLvisual *gl_create_visual( GLboolean rgbFlag, GLint blueBits, GLint alphaBits ); -extern void gl_destroy_visual( GLvisual *vis ); + +extern void +_mesa_destroy_visual( GLvisual *vis ); + +/*obsolete */ extern void gl_destroy_visual( GLvisual *vis ); /*