updates for separate R/G/B/A accum buffer sizes
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 31 Mar 2000 01:07:13 +0000 (01:07 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 31 Mar 2000 01:07:13 +0000 (01:07 +0000)
src/mesa/drivers/ggi/ggimesa.c
src/mesa/drivers/glide/fxapi.c
src/mesa/drivers/osmesa/osmesa.c
src/mesa/drivers/svga/svgamesa.c
src/mesa/drivers/x11/fakeglx.c
src/mesa/drivers/x11/xmesaP.h

index cc8f0cc8f46ef5097d1ba2b39030f1d35cb83e98..ddd280931cc96b55492bc171d617875c5fe7245d 100644 (file)
@@ -413,7 +413,7 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
        ctx->gl_buffer = gl_create_framebuffer(ctx->gl_vis,
                                               ctx->gl_vis->DepthBits > 0,
                                               ctx->gl_vis->StencilBits > 0,
-                                              ctx->gl_vis->AccumBits > 0,
+                                              ctx->gl_vis->AccumRedBits > 0,
                                               ctx->gl_vis->AlphaBits > 0);
                                               
 
index 6aea93fbf0c3d2bbcb29ec75251283de8953d940..534139fd5d8190a2791dc3591a1b9e2c541b8043 100644 (file)
@@ -1046,7 +1046,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
    fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis,
                                           GL_FALSE,  /* no software depth */
                                           fxMesa->glVis->StencilBits > 0,
-                                          fxMesa->glVis->AccumBits > 0,
+                                          fxMesa->glVis->AccumRedBits > 0,
                                           fxMesa->glVis->AlphaBits > 0 );
    if (!fxMesa->glBuffer) {
       errorstr = "gl_create_framebuffer";
index 3cbfcc453e7f1ca49154e63db936ab9bab41da4f..69e8286c7cd350116512edb6424811d6f1e927aa 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.12 2000/03/28 16:59:39 rjfrank Exp $ */
+/* $Id: osmesa.c,v 1.13 2000/03/31 01:07:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -229,7 +229,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
       osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual,
                                            osmesa->gl_visual->DepthBits > 0,
                                            osmesa->gl_visual->StencilBits > 0,
-                                           osmesa->gl_visual->AccumBits > 0,
+                                           osmesa->gl_visual->AccumRedBits > 0,
                                            osmesa->gl_visual->AlphaBits > 0 );
 
       if (!osmesa->gl_buffer) {
index f7175fe63e866216226abedcc30e09b4e2ab265a..1b4a45e1ae3000f2b6b3f70193566a6eecacd2b1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: svgamesa.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */
+/* $Id: svgamesa.c,v 1.5 2000/03/31 01:07:14 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -426,7 +426,7 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer )
    ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis,
                                            ctx->gl_vis->DepthBits > 0,
                                            ctx->gl_vis->StencilBits > 0,
-                                           ctx->gl_vis->AccumBits > 0,
+                                           ctx->gl_vis->AccumRedBits > 0,
                                            ctx->gl_vis->AlphaBits > 0 );
 
    ctx->index = 1;
index d7f840980f9ce5c77d1ba53b50b81129ce421b4f..08e01c76675f036d976fe067185df3bee8d5e875 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: fakeglx.c,v 1.26 2000/03/17 15:33:09 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.27 2000/03/31 01:07:14 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -228,7 +228,9 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
                  GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag,
                  GLboolean stereoFlag,
                  GLint depth_size, GLint stencil_size,
-                 GLint accum_size, GLint level )
+                 GLint accumRedSize, GLint accumGreenSize,
+                 GLint accumBlueSize, GLint accumAlphaSize,
+                 GLint level )
 {
    GLboolean ximageFlag = GL_TRUE;
    XMesaVisual xmvis;
@@ -271,7 +273,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
           && (v->gl_visual->AlphaBits > 0) == alphaFlag
           && (v->gl_visual->DepthBits >= depth_size || depth_size == 0)
           && (v->gl_visual->StencilBits >= stencil_size || stencil_size == 0)
-          && (v->gl_visual->AccumBits >= accum_size || accum_size == 0)) {
+          && (v->gl_visual->AccumRedBits >= accumRedSize || accumRedSize == 0)
+          && (v->gl_visual->AccumGreenBits >= accumGreenSize || accumGreenSize == 0)
+          && (v->gl_visual->AccumBlueBits >= accumBlueSize || accumBlueSize == 0)
+          && (v->gl_visual->AccumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) {
          /* now either compare XVisualInfo pointers or visual IDs */
          if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
              || (comparePointers && v->vishandle == vinfo)) {
@@ -287,9 +292,12 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
       return NULL;
    }
 
-   xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag,
-                              stereoFlag, ximageFlag,
-                              depth_size, stencil_size, accum_size, level );
+   xmvis = XMesaCreateVisual2( dpy, vinfo, rgbFlag, alphaFlag, dbFlag,
+                               stereoFlag, ximageFlag,
+                               depth_size, stencil_size,
+                               accumRedSize, accumBlueSize,
+                               accumBlueSize, accumAlphaSize, 0, level,
+                               GLX_NONE_EXT );
    if (xmvis) {
       VisualTable[NumVisuals] = xmvis;
       NumVisuals++;
@@ -322,7 +330,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
                               GL_FALSE,  /* stereo */
                               0,         /* depth bits */
                               0,         /* stencil bits */
-                              0,         /* accum bits */
+                              0,0,0,0,   /* accum bits */
                               vislevel   /* level */
                             );
    }
@@ -337,7 +345,10 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
                               GL_FALSE,  /* stereo */
                               DEFAULT_SOFTWARE_DEPTH_BITS,
                               8 * sizeof(GLstencil),
-                              8 * sizeof(GLaccum),
+                              8 * sizeof(GLaccum), /* r */
+                              8 * sizeof(GLaccum), /* g */
+                              8 * sizeof(GLaccum), /* b */
+                              8 * sizeof(GLaccum), /* a */
                               0          /* level */
                             );
    }
@@ -867,7 +878,10 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
    GLboolean stereo_flag = GL_FALSE;
    GLint depth_size = 0;
    GLint stencil_size = 0;
-   GLint accum_size = 0;
+   GLint accumRedSize = 0;
+   GLint accumGreenSize = 0;
+   GLint accumBlueSize = 0;
+   GLint accumAlphaSize = 0;
    int level = 0;
    int visual_type = DONT_CARE;
    int trans_type = DONT_CARE;
@@ -934,13 +948,31 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
            stencil_size = *parselist++;
            break;
         case GLX_ACCUM_RED_SIZE:
+           parselist++;
+            {
+               GLint size = *parselist++;
+               accumRedSize = MAX2( accumRedSize, size );
+            }
+            break;
         case GLX_ACCUM_GREEN_SIZE:
+           parselist++;
+            {
+               GLint size = *parselist++;
+               accumGreenSize = MAX2( accumGreenSize, size );
+            }
+            break;
         case GLX_ACCUM_BLUE_SIZE:
+           parselist++;
+            {
+               GLint size = *parselist++;
+               accumBlueSize = MAX2( accumBlueSize, size );
+            }
+            break;
         case GLX_ACCUM_ALPHA_SIZE:
            parselist++;
             {
                GLint size = *parselist++;
-               accum_size = MAX2( accum_size, size );
+               accumAlphaSize = MAX2( accumAlphaSize, size );
             }
            break;
 
@@ -997,7 +1029,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
       else {
          /* Get a color index visual */
          vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type );
-         accum_size = 0;
+         accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0;
       }
    }
    else {
@@ -1034,11 +1066,19 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
       /* we only support one size of stencil and accum buffers. */
       if (stencil_size > 0)
          stencil_size = STENCIL_BITS;
-      if (accum_size > 0)
-         accum_size = ACCUM_BITS;
+      if (accumRedSize > 0)
+         accumRedSize = ACCUM_BITS;
+      if (accumGreenSize > 0)
+         accumGreenSize = ACCUM_BITS;
+      if (accumBlueSize > 0)
+         accumBlueSize = ACCUM_BITS;
+      if (accumAlphaSize > 0)
+         accumAlphaSize = ACCUM_BITS;
       if (!save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
-                            stereo_flag,
-                            depth_size, stencil_size, accum_size, level ))
+                            stereo_flag, depth_size, stencil_size,
+                            accumRedSize, accumGreenSize,
+                            accumBlueSize, accumAlphaSize,
+                            level ))
          return NULL;
    }
 
@@ -1396,15 +1436,16 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
         *value = glxvis->gl_visual->StencilBits;
         return 0;
       case GLX_ACCUM_RED_SIZE:
+        *value = glxvis->gl_visual->AccumRedBits;
+        return 0;
       case GLX_ACCUM_GREEN_SIZE:
+        *value = glxvis->gl_visual->AccumGreenBits;
+        return 0;
       case GLX_ACCUM_BLUE_SIZE:
-        *value = glxvis->gl_visual->AccumBits;
+        *value = glxvis->gl_visual->AccumBlueBits;
         return 0;
       case GLX_ACCUM_ALPHA_SIZE:
-         if (glxvis->gl_visual->AlphaBits > 0)
-            *value = glxvis->gl_visual->AccumBits;
-         else
-            *value = 0;
+         *value = glxvis->gl_visual->AccumAlphaBits;
         return 0;
 
       /*
@@ -1461,6 +1502,12 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
          /* undefined */
          return 0;
 
+      /*
+       * GLX_EXT_visual_info extension
+       */
+      case GLX_VISUAL_CAVEAT_EXT:
+         return glxvis->VisualCaveat;
+
       /*
        * Extensions
        */
index 537d7105e6e8d3757a7de42b4d9e8c60ea1eef11..2c6a17a7042a246500df2d0bd90c5597c920c0ab 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: xmesaP.h,v 1.8 2000/02/25 20:36:03 brianp Exp $ */
+/* $Id: xmesaP.h,v 1.9 2000/03/31 01:07:14 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -86,6 +86,7 @@ struct xmesa_visual {
    GLint BitsPerPixel;         /* True bits per pixel for XImages */
 
    GLint level;                        /* 0=normal, 1=overlay, etc */
+   GLint VisualCaveat;          /* for GLX_EXT_visual_rating extension */
 
    GLboolean ximage_flag;      /* Use XImage for back buffer (not pixmap)? */