mesa: Eliminate gl_config::have{Accum,Depth,Stencil}Buffer
authorAdam Jackson <ajax@redhat.com>
Fri, 6 Sep 2019 15:51:23 +0000 (11:51 -0400)
committerAdam Jackson <ajax@redhat.com>
Mon, 9 Sep 2019 18:12:57 +0000 (14:12 -0400)
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
13 files changed:
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/state_trackers/glx/xlib/xm_api.c
src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/nouveau/nouveau_context.c
src/mesa/drivers/dri/swrast/swrast.c
src/mesa/drivers/osmesa/osmesa.c
src/mesa/drivers/x11/xm_api.c
src/mesa/main/accum.c
src/mesa/main/clear.c
src/mesa/main/context.c
src/mesa/main/framebuffer.c
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_manager.c

index 9317be29b3afef65208c32bf3e70b65ef7cd8b6f..7898b088fc8ec018344957776607ef5d48862e30 100644 (file)
@@ -426,7 +426,7 @@ dri_fill_st_visual(struct st_visual *stvis,
       break;
    }
 
-   stvis->accum_format = (mode->haveAccumBuffer) ?
+   stvis->accum_format = (mode->accumRedBits > 0) ?
       PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
 
    stvis->buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
@@ -441,7 +441,7 @@ dri_fill_st_visual(struct st_visual *stvis,
          stvis->buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
    }
 
-   if (mode->haveDepthBuffer || mode->haveStencilBuffer)
+   if (mode->depthBits > 0 || mode->stencilBits > 0)
       stvis->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
    /* let the state tracker allocate the accum buffer */
 }
index a2ef87fa10f20352e4ec55dce0e32c4c18d6ef5d..3e01922c982765d388a63cad84a45c2b50706c35 100644 (file)
@@ -866,10 +866,6 @@ XMesaVisual XMesaCreateVisual( Display *display,
       vis->accumBlueBits  = accum_blue_size;
       vis->accumAlphaBits = accum_alpha_size;
 
-      vis->haveAccumBuffer   = accum_red_size > 0;
-      vis->haveDepthBuffer   = depth_size > 0;
-      vis->haveStencilBuffer = stencil_size > 0;
-
       vis->numAuxBuffers = 0;
       vis->level = 0;
       vis->sampleBuffers = num_samples > 1;
index 44e4e0f3720621418c5faf872a7ba5df0d9508cf..8621c36e9885aac587d661d2f63510a552e81d48 100644 (file)
@@ -369,14 +369,6 @@ driCreateConfigs(mesa_format format,
                    modes->samples = msaa_samples[h];
                    modes->sampleBuffers = modes->samples ? 1 : 0;
 
-
-                   modes->haveAccumBuffer = ((modes->accumRedBits +
-                                          modes->accumGreenBits +
-                                          modes->accumBlueBits +
-                                          modes->accumAlphaBits) > 0);
-                   modes->haveDepthBuffer = (modes->depthBits > 0);
-                   modes->haveStencilBuffer = (modes->stencilBits > 0);
-
                    modes->bindToTextureRgb = GL_TRUE;
                    modes->bindToTextureRgba = GL_TRUE;
                    modes->bindToMipmapTexture = GL_FALSE;
index 8fec35237c0917686e9e00277f45b9f95050e020..40102cfa4dfd86f25a81ad48cbd8a3c59a22d3de 100644 (file)
@@ -250,11 +250,11 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
                attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
        if (fb->Visual.doubleBufferMode)
                attachments[i++] = __DRI_BUFFER_BACK_LEFT;
-       if (fb->Visual.haveDepthBuffer && fb->Visual.haveStencilBuffer)
+       if (fb->Visual.depthBits > 0 && fb->Visual.stencilBits > 0)
                attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
-       else if (fb->Visual.haveDepthBuffer)
+       else if (fb->Visual.depthBits > 0)
                attachments[i++] = __DRI_BUFFER_DEPTH;
-       else if (fb->Visual.haveStencilBuffer)
+       else if (fb->Visual.stencilBits > 0)
                attachments[i++] = __DRI_BUFFER_STENCIL;
 
        buffers = screen->dri2.loader->getBuffers(draw, &draw->w, &draw->h,
index 8e8d6bd628e33c9d0041f8b1a67307e5bf15c41c..2bf4f0b9fed33068905264367693257b0095821e 100644 (file)
@@ -584,9 +584,9 @@ dri_create_buffer(__DRIscreen * sPriv,
     /* add software renderbuffers */
     _swrast_add_soft_renderbuffers(fb,
                                    GL_FALSE, /* color */
-                                   visual->haveDepthBuffer,
-                                   visual->haveStencilBuffer,
-                                   visual->haveAccumBuffer,
+                                   visual->depthBits > 0,
+                                   visual->stencilBits > 0,
+                                   visual->accumRedBits > 0,
                                    GL_FALSE, /* alpha */
                                    GL_FALSE /* aux bufs */);
 
index a065161b89ef7f28e02aa0a020727ef1928d31d2..5a3099af984aaea01b2b6fbeb03c02e543ca5fcd 100644 (file)
@@ -864,9 +864,9 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist)
        */
       _swrast_add_soft_renderbuffers(osmesa->gl_buffer,
                                      GL_FALSE, /* color */
-                                     osmesa->gl_visual->haveDepthBuffer,
-                                     osmesa->gl_visual->haveStencilBuffer,
-                                     osmesa->gl_visual->haveAccumBuffer,
+                                     osmesa->gl_visual->depthBits > 0,
+                                     osmesa->gl_visual->stencilBits > 0,
+                                     osmesa->gl_visual->accumRedBits > 0,
                                      GL_FALSE, /* alpha */
                                      GL_FALSE /* aux */ );
 
index 6857789a01122c6e5a3560954b067abd28cef42a..63936ac3e1661617d1fa966a90d0c8e5389cb685 100644 (file)
@@ -338,9 +338,9 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
     */
    _swrast_add_soft_renderbuffers(&b->mesa_buffer,
                                   GL_FALSE,  /* color */
-                                  vis->mesa_visual.haveDepthBuffer,
-                                  vis->mesa_visual.haveStencilBuffer,
-                                  vis->mesa_visual.haveAccumBuffer,
+                                  vis->mesa_visual.depthBits > 0,
+                                  vis->mesa_visual.stencilBits > 0,
+                                  vis->mesa_visual.accumRedBits > 0,
                                   GL_FALSE,  /* software alpha buffer */
                                   vis->mesa_visual.numAuxBuffers > 0 );
 
index a0a206bea6720ce7c2a6c3c2bde469b404619587..89ae31556d324d6b6c8433f9a635fcc54bce7a31 100644 (file)
@@ -468,7 +468,7 @@ _mesa_Accum( GLenum op, GLfloat value )
       return;
    }
 
-   if (ctx->DrawBuffer->Visual.haveAccumBuffer == 0) {
+   if (ctx->DrawBuffer->Visual.accumRedBits == 0) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glAccum(no accum buffer)");
       return;
    }
index 6beff9ed842bc7e38a8cd93429c92298b8184c1f..9221c7287a33a52e2314bbe06882319d5ea3a561 100644 (file)
@@ -203,17 +203,17 @@ clear(struct gl_context *ctx, GLbitfield mask, bool no_error)
       }
 
       if ((mask & GL_DEPTH_BUFFER_BIT)
-          && ctx->DrawBuffer->Visual.haveDepthBuffer) {
+          && ctx->DrawBuffer->Visual.depthBits > 0) {
          bufferMask |= BUFFER_BIT_DEPTH;
       }
 
       if ((mask & GL_STENCIL_BUFFER_BIT)
-          && ctx->DrawBuffer->Visual.haveStencilBuffer) {
+          && ctx->DrawBuffer->Visual.stencilBits > 0) {
          bufferMask |= BUFFER_BIT_STENCIL;
       }
 
       if ((mask & GL_ACCUM_BUFFER_BIT)
-          && ctx->DrawBuffer->Visual.haveAccumBuffer) {
+          && ctx->DrawBuffer->Visual.accumRedBits > 0) {
          bufferMask |= BUFFER_BIT_ACCUM;
       }
 
index 0dd83e564b12b7f8205bd7a939708517234d290f..ee5eee32948b659833bbff7ddbcb94296ecf6215 100644 (file)
@@ -305,10 +305,6 @@ _mesa_initialize_visual( struct gl_config *vis,
    vis->accumBlueBits  = accumBlueBits;
    vis->accumAlphaBits = accumAlphaBits;
 
-   vis->haveAccumBuffer   = accumRedBits > 0;
-   vis->haveDepthBuffer   = depthBits > 0;
-   vis->haveStencilBuffer = stencilBits > 0;
-
    vis->numAuxBuffers = 0;
    vis->level = 0;
    vis->sampleBuffers = numSamples > 0 ? 1 : 0;
index 96efc0a4b54f585ae54270d081ae3066f6f9066d..727831e3d9717a6ba1e5824d7258375755fb3ad9 100644 (file)
@@ -482,7 +482,6 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
       const struct gl_renderbuffer *rb =
          fb->Attachment[BUFFER_DEPTH].Renderbuffer;
       const mesa_format fmt = rb->Format;
-      fb->Visual.haveDepthBuffer = GL_TRUE;
       fb->Visual.depthBits = _mesa_get_format_bits(fmt, GL_DEPTH_BITS);
    }
 
@@ -490,7 +489,6 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
       const struct gl_renderbuffer *rb =
          fb->Attachment[BUFFER_STENCIL].Renderbuffer;
       const mesa_format fmt = rb->Format;
-      fb->Visual.haveStencilBuffer = GL_TRUE;
       fb->Visual.stencilBits = _mesa_get_format_bits(fmt, GL_STENCIL_BITS);
    }
 
@@ -498,7 +496,6 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
       const struct gl_renderbuffer *rb =
          fb->Attachment[BUFFER_ACCUM].Renderbuffer;
       const mesa_format fmt = rb->Format;
-      fb->Visual.haveAccumBuffer = GL_TRUE;
       fb->Visual.accumRedBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
       fb->Visual.accumGreenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
       fb->Visual.accumBlueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);
index 5c633938f37217973dd032cd26bd4f298f89f958..af5b60fcf5a83ba04479008ee7502e969944c6fa 100644 (file)
@@ -164,10 +164,6 @@ struct gl_config
    GLuint doubleBufferMode;
    GLuint stereoMode;
 
-   GLboolean haveAccumBuffer;
-   GLboolean haveDepthBuffer;
-   GLboolean haveStencilBuffer;
-
    GLint redBits, greenBits, blueBits, alphaBits;      /* bits per comp */
    GLuint redMask, greenMask, blueMask, alphaMask;
    GLint redShift, greenShift, blueShift, alphaShift;
index 4ef5429c58baf752f75b9deb109a6ad8aa7d577b..b49e269124c187514e1cbb3556d5e9938def6c3f 100644 (file)
@@ -407,14 +407,9 @@ st_visual_to_context_mode(const struct st_visual *visual,
       mode->stencilBits =
          util_format_get_component_bits(visual->depth_stencil_format,
                UTIL_FORMAT_COLORSPACE_ZS, 1);
-
-      mode->haveDepthBuffer = mode->depthBits > 0;
-      mode->haveStencilBuffer = mode->stencilBits > 0;
    }
 
    if (visual->accum_format != PIPE_FORMAT_NONE) {
-      mode->haveAccumBuffer = GL_TRUE;
-
       mode->accumRedBits =
          util_format_get_component_bits(visual->accum_format,
                UTIL_FORMAT_COLORSPACE_RGB, 0);