summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-08-26 14:27:50 +0200
committerJakob Bornecrantz <jakob@vmware.com>2009-08-26 14:27:50 +0200
commit57230d96ed3dc231c47ed8765f30e0e34e988d31 (patch)
tree80856397dbdfad6ad888d0b79ea1f6f580f93c00 /src/gallium
parent23fe960be0d0d27fcd676534c692ab164f854acb (diff)
st/xorg: Temporary fix for none stencil visuals
Should be replaced with something looking at the proper glx visual for the buffers.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c19
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 e72710befb..7d6954016f 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;