diff options
author | Chad Versace <[email protected]> | 2011-06-03 16:33:32 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2011-06-08 10:06:40 -0700 |
commit | aea2236af60aee329e6ea73a41f2410d8eacc7b6 (patch) | |
tree | dfc69b045e2b36479c0032c42e0a6a0c400d9bde /src/mesa/drivers/dri/intel/intel_screen.c | |
parent | f4efb7ff4f9cb0f6386e9b53f4dcfd9ef23dc9d1 (diff) |
intel: Request DRI2 buffers for separate stencil and hiz
When it is sensible to do so,
1) intelCreateBuffer() now attaches separate depth and stencil
buffers
to the framebuffer it creates.
2) intel_update_renderbuffers() requests for the framebuffer
a separate stencil buffer (DRI2BufferStencil).
The criteria for "sensible" is:
- The GLX config has nonzero depth and stencil bits.
- The hardware supports separate stencil.
- The X driver supports separate stencil, or its support has not yet
been determined.
If the hardware supports hiz too, then intel_update_renderbuffers()
also requests DRI2BufferHiz.
If after requesting DRI2BufferStencil we determine that X driver did not
actually support separate stencil, we clean up the mistake and never ask
for DRI2BufferStencil again.
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]>
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_screen.c')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 21dc8dc0930..e915ca04fe0 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -359,6 +359,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, const struct gl_config * mesaVis, GLboolean isPixmap) { struct intel_renderbuffer *rb; + struct intel_screen *screen = (struct intel_screen*) driScrnPriv->private; if (isPixmap) { return GL_FALSE; /* not implemented */ @@ -396,12 +397,27 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, */ if (mesaVis->depthBits == 24) { assert(mesaVis->stencilBits == 8); - /* combined depth/stencil buffer */ - struct intel_renderbuffer *depthStencilRb - = intel_create_renderbuffer(MESA_FORMAT_S8_Z24); - /* note: bind RB to two attachment points */ - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthStencilRb->Base); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base); + + if (screen->hw_has_separate_stencil + && screen->dri2_has_hiz != INTEL_DRI2_HAS_HIZ_FALSE) { + /* + * Request a separate stencil buffer even if we do not yet know if + * the screen supports it. (See comments for + * enum intel_dri2_has_hiz). + */ + rb = intel_create_renderbuffer(MESA_FORMAT_X8_Z24); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base); + rb = intel_create_renderbuffer(MESA_FORMAT_S8); + _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base); + } else { + /* + * Use combined depth/stencil. Note that the renderbuffer is + * attached to two attachment points. + */ + rb = intel_create_renderbuffer(MESA_FORMAT_S8_Z24); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base); + _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base); + } } else if (mesaVis->depthBits == 16) { assert(mesaVis->stencilBits == 0); |