From: Adam Jackson Date: Fri, 6 Sep 2019 15:51:23 +0000 (-0400) Subject: mesa: Eliminate gl_config::have{Accum,Depth,Stencil}Buffer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=78e0fa6bb265afc11e7eab35ef6145b48b056ad0;p=mesa.git mesa: Eliminate gl_config::have{Accum,Depth,Stencil}Buffer Reviewed-by: Eric Anholt Reviewed-by: Marek Olšák --- diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 9317be29b3a..7898b088fc8 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -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 */ } diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index a2ef87fa10f..3e01922c982 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -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; diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 44e4e0f3720..8621c36e988 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -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; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 8fec35237c0..40102cfa4df 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -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, diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 8e8d6bd628e..2bf4f0b9fed 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -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 */); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index a065161b89e..5a3099af984 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -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 */ ); diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 6857789a011..63936ac3e16 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -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 ); diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index a0a206bea67..89ae31556d3 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -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; } diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 6beff9ed842..9221c7287a3 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -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; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0dd83e564b1..ee5eee32948 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -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; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 96efc0a4b54..727831e3d97 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -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); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5c633938f37..af5b60fcf5a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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; diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 4ef5429c58b..b49e269124c 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -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);