[PATCH] mesa: remove gl_config::haveDepth/Stencil/AccumBuffer fields
Brian Paul
brianp at vmware.com
Sun Nov 7 17:36:20 PST 2010
These fields come from the original GLcontextModesRec. They're
redundant. We can just test the depth/stencil/accumBits fields instead.
---
src/gallium/state_trackers/dri/common/dri_screen.c | 4 ++--
src/gallium/state_trackers/egl/x11/glcore.h | 4 ----
src/gallium/state_trackers/egl/x11/glxinit.c | 7 -------
src/gallium/state_trackers/glx/xlib/xm_api.c | 4 ----
src/mesa/drivers/dri/common/utils.c | 8 --------
src/mesa/drivers/dri/nouveau/nouveau_context.c | 6 +++---
src/mesa/drivers/dri/swrast/swrast.c | 6 +++---
src/mesa/drivers/dri/unichrome/via_context.c | 3 +--
src/mesa/drivers/fbdev/glfbdev.c | 6 +++---
src/mesa/drivers/osmesa/osmesa.c | 6 +++---
src/mesa/drivers/x11/xm_api.c | 6 +++---
src/mesa/main/accum.c | 2 +-
src/mesa/main/clear.c | 6 +++---
src/mesa/main/context.c | 10 +++-------
src/mesa/main/framebuffer.c | 3 ---
src/mesa/main/mtypes.h | 4 ----
src/mesa/state_tracker/st_manager.c | 5 -----
17 files changed, 25 insertions(+), 65 deletions(-)
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 252ad17..e5c7e38 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -267,7 +267,7 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
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;
@@ -279,7 +279,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->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/egl/x11/glcore.h b/src/gallium/state_trackers/egl/x11/glcore.h
index 547b111..7d0b788 100644
--- a/src/gallium/state_trackers/egl/x11/glcore.h
+++ b/src/gallium/state_trackers/egl/x11/glcore.h
@@ -74,10 +74,6 @@ typedef struct __GLcontextModesRec {
GLuint doubleBufferMode;
GLuint stereoMode;
- GLboolean haveAccumBuffer;
- GLboolean haveDepthBuffer;
- GLboolean haveStencilBuffer;
-
GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
GLuint redMask, greenMask, blueMask, alphaMask;
GLint rgbBits; /* total bits for rgb */
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index df8370f..33102f9 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -455,13 +455,6 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
config->renderType =
(config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- config->haveAccumBuffer = ((config->accumRedBits +
- config->accumGreenBits +
- config->accumBlueBits +
- config->accumAlphaBits) > 0);
- config->haveDepthBuffer = (config->depthBits > 0);
- config->haveStencilBuffer = (config->stencilBits > 0);
}
static __GLcontextModes *
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 8332633..8a5ca17 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -777,10 +777,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 = 0;
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 42be77f..2156fd1 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -633,14 +633,6 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
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 f80aaed..164afb8 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -198,11 +198,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 52ba3ac..ea4a38c 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -407,9 +407,9 @@ dri_create_buffer(__DRIscreen * sPriv,
/* add software renderbuffers */
_mesa_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/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 963609b..702826b 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -505,7 +505,6 @@ viaCreateContext(gl_api api,
vmesa->depth_clear_mask = 0xe << 28;
vmesa->ClearDepth = 0xffffff00;
- assert(visual->haveStencilBuffer);
assert(visual->stencilBits == 8);
vmesa->have_hw_stencil = GL_TRUE;
@@ -516,7 +515,7 @@ viaCreateContext(gl_api api,
case 32:
vmesa->hasDepth = GL_TRUE;
vmesa->depthBits = visual->depthBits;
- assert(!visual->haveStencilBuffer);
+ assert(visual->stencilBits == 0);
vmesa->have_hw_stencil = GL_FALSE;
vmesa->depth_max = (GLfloat)0xffffffff;
vmesa->depth_clear_mask = 0xf << 28;
diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c
index 5195bca..8be72ed 100644
--- a/src/mesa/drivers/fbdev/glfbdev.c
+++ b/src/mesa/drivers/fbdev/glfbdev.c
@@ -613,9 +613,9 @@ glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
/* add software renderbuffers */
_mesa_add_soft_renderbuffers(&buf->glframebuffer,
GL_FALSE, /* color */
- visual->glvisual.haveDepthBuffer,
- visual->glvisual.haveStencilBuffer,
- visual->glvisual.haveAccumBuffer,
+ visual->glvisual.depthBits > 0,
+ visual->glvisual.stencilBits > 0,
+ visual->glvisual.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 10ba6b7..cda5dc7 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1184,9 +1184,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
*/
_mesa_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 00ceb96..03cbe00 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -430,9 +430,9 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
*/
_mesa_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,
b->swAlpha,
vis->mesa_visual.numAuxBuffers > 0 );
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index 9026110..c5c58a9 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -74,7 +74,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 61bc836..4363ac8 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -223,17 +223,17 @@ _mesa_Clear( GLbitfield mask )
}
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 b60875b..a8e095d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -291,10 +291,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;
@@ -1302,11 +1298,11 @@ check_compatible(const struct gl_context *ctx, const struct gl_framebuffer *buff
#endif
if (ctxvis->stereoMode && !bufvis->stereoMode)
return GL_FALSE;
- if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer)
+ if (ctxvis->accumRedBits > 0 && bufvis->accumRedBits == 0)
return GL_FALSE;
- if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer)
+ if (ctxvis->depthBits > 0 && bufvis->depthBits == 0)
return GL_FALSE;
- if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer)
+ if (ctxvis->stencilBits > 0 && bufvis->stencilBits == 0)
return GL_FALSE;
if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask)
return GL_FALSE;
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 5530c51..15bf4de 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -562,7 +562,6 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_DEPTH].Renderbuffer;
const gl_format fmt = rb->Format;
- fb->Visual.haveDepthBuffer = GL_TRUE;
fb->Visual.depthBits = _mesa_get_format_bits(fmt, GL_DEPTH_BITS);
}
@@ -570,7 +569,6 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_STENCIL].Renderbuffer;
const gl_format fmt = rb->Format;
- fb->Visual.haveStencilBuffer = GL_TRUE;
fb->Visual.stencilBits = _mesa_get_format_bits(fmt, GL_STENCIL_BITS);
}
@@ -578,7 +576,6 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_ACCUM].Renderbuffer;
const gl_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 51378f7..fca3e4b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -466,10 +466,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 rgbBits; /* total bits for rgb */
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 183477a..8f42b84 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -337,14 +337,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);
--
1.7.1.1
--------------000300020708040701040800--
More information about the mesa-dev
mailing list