summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-05-26 14:55:54 -0700
committerChad Versace <[email protected]>2011-06-08 10:06:40 -0700
commitf4efb7ff4f9cb0f6386e9b53f4dcfd9ef23dc9d1 (patch)
tree88c58655c7a99de52222182d26c6daff8e90ec1c
parent89d34cfd3e7c96cefc489fbb995124e2dc4a97ec (diff)
intel: Add assertions to intelCreateBuffer()
Assert that the GLX config has an expected depth/stencil bit combination: one of d24/s8, d16/s0, d0/s0. These are the only depth/stencil configurations that we advertise. Remove the check for software stencil, because given the assertions' constraints the check always fails. CC: Ian Romanick <[email protected]> CC: Kristian Høgsberg <[email protected]> Acked-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 646b96051d9..21dc8dc0930 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -364,8 +364,6 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
return GL_FALSE; /* not implemented */
}
else {
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
gl_format rgbFormat;
struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
@@ -391,6 +389,11 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base);
}
+ /*
+ * Assert here that the gl_config has an expected depth/stencil bit
+ * combination: one of d24/s8, d16/s0, d0/s0. (See intelInitScreen2(),
+ * which constructs the advertised configs.)
+ */
if (mesaVis->depthBits == 24) {
assert(mesaVis->stencilBits == 8);
/* combined depth/stencil buffer */
@@ -401,17 +404,23 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base);
}
else if (mesaVis->depthBits == 16) {
+ assert(mesaVis->stencilBits == 0);
/* just 16-bit depth buffer, no hw stencil */
struct intel_renderbuffer *depthRb
= intel_create_renderbuffer(MESA_FORMAT_Z16);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
+ else {
+ assert(mesaVis->depthBits == 0);
+ assert(mesaVis->stencilBits == 0);
+ }
/* now add any/all software-based renderbuffers we may need */
_mesa_add_soft_renderbuffers(fb,
GL_FALSE, /* never sw color */
GL_FALSE, /* never sw depth */
- swStencil, mesaVis->accumRedBits > 0,
+ GL_FALSE, /* never sw stencil */
+ mesaVis->accumRedBits > 0,
GL_FALSE, /* never sw alpha */
GL_FALSE /* never sw aux */ );
driDrawPriv->driverPrivate = fb;