[Mesa-dev] [PATCH 1/3] Remove gl_config::haveDepthBuffer, haveAccumBuffer, haveStencilBuffer fields
Brian Paul
brianp at vmware.com
Sun Jun 9 09:18:41 PDT 2013
On 06/08/2013 07:35 AM, Arnas Milasevicius wrote:
>
> Changed code checking `if(visual->haveDepthBuffer)` to `if(visual->DepthBits > 0)`
> ---
> src/gallium/state_trackers/dri/common/dri_screen.c | 2 +-
> src/mesa/drivers/dri/nouveau/nouveau_context.c | 4 ++--
> src/mesa/main/clear.c | 2 +-
> src/mesa/main/context.c | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
> index e09fe1d..4e0f987 100644
> --- a/src/gallium/state_trackers/dri/common/dri_screen.c
> +++ b/src/gallium/state_trackers/dri/common/dri_screen.c
> @@ -304,7 +304,7 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
> stvis->buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
> }
>
> - if (mode->haveDepthBuffer || mode->haveStencilBuffer)
> + if ((mode->depthBits > 0) || mode->haveStencilBuffer)
> stvis->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
> /* let the state tracker allocate the accum buffer */
> }
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
> index b216c60..45fcada 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
> @@ -266,9 +266,9 @@ 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.haveStencilBuffer)
> 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)
> attachments[i++] = __DRI_BUFFER_STENCIL;
> diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
> index 304d135..a6a9b84 100644
> --- a/src/mesa/main/clear.c
> +++ b/src/mesa/main/clear.c
> @@ -184,7 +184,7 @@ _mesa_Clear( GLbitfield mask )
> }
>
> if ((mask & GL_DEPTH_BUFFER_BIT)
> - && ctx->DrawBuffer->Visual.haveDepthBuffer) {
> + && (ctx->DrawBuffer->Visual.depthBits > 0)) {
> bufferMask |= BUFFER_BIT_DEPTH;
> }
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index c59f755..26f2878 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -1365,7 +1365,7 @@ check_compatible(const struct gl_context *ctx,
> return GL_FALSE;
> if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer)
> return GL_FALSE;
> - if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer)
> + if (ctxvis->depthBits > 0 && !(bufvis->depthBits > 0))
> return GL_FALSE;
> if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer)
> return GL_FALSE;
>
You can remove the field from gl_config in mtypes.h too.
And it looks like you missed some other occurences in context.c,
st_manager, and framebuffer.c (and maybe elsewhere).
-Brian
More information about the mesa-dev
mailing list