added _mesa_create/destroy_visual()
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 31 Mar 2000 01:05:51 +0000 (01:05 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 31 Mar 2000 01:05:51 +0000 (01:05 +0000)
src/mesa/main/context.c
src/mesa/main/context.h

index e19fecedd94506d9eb7cb353904c61992b962201..92077533126a74340c5ecf2e9acc1ce90f7a69e2 100644 (file)
@@ -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);
index b9cc69bc69d936880e723b40e642fa8d1a475d40..8e691445f1081ce26371b4c2097261f053764076 100644 (file)
@@ -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
  * 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 );
 
 
 /*