Mesa (master): st/xorg: Temporary fix for none stencil visuals
Jakob Bornecrantz
wallbraker at kemper.freedesktop.org
Wed Aug 26 13:38:52 UTC 2009
Module: Mesa
Branch: master
Commit: 57230d96ed3dc231c47ed8765f30e0e34e988d31
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=57230d96ed3dc231c47ed8765f30e0e34e988d31
Author: Jakob Bornecrantz <jakob at vmware.com>
Date: Wed Aug 26 14:27:50 2009 +0200
st/xorg: Temporary fix for none stencil visuals
Should be replaced with something looking at the proper
glx visual for the buffers.
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index e72710b..7d69540 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -60,6 +60,7 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
DRI2BufferPtr buffers;
PixmapPtr pPixmap;
unsigned stride, handle;
+ boolean have_depth = FALSE, have_stencil = FALSE;
int i;
buffers = xcalloc(count, sizeof *buffers);
@@ -70,6 +71,16 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
if (!privates)
goto fail_privates;
+ for (i = 0; i < count; i++) {
+ if (attachments[i] == DRI2BufferDepth)
+ have_depth = TRUE;
+ else if (attachments[i] == DRI2BufferStencil)
+ have_stencil = TRUE;
+ }
+
+ if (have_stencil && !have_depth)
+ FatalError("Doesn't support only stencil yet\n");
+
depth = NULL;
for (i = 0; i < count; i++) {
pPixmap = NULL;
@@ -88,8 +99,12 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
struct pipe_texture template;
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
- template.format = ms->ds_depth_bits_last ?
- PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
+ if (have_stencil)
+ template.format = ms->ds_depth_bits_last ?
+ PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
+ else
+ template.format = ms->d_depth_bits_last ?
+ PIPE_FORMAT_X8Z24_UNORM : PIPE_FORMAT_Z24X8_UNORM;
pf_get_block(template.format, &template.block);
template.width[0] = pDraw->width;
template.height[0] = pDraw->height;
More information about the mesa-commit
mailing list