From 57230d96ed3dc231c47ed8765f30e0e34e988d31 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 26 Aug 2009 14:27:50 +0200 Subject: 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 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/gallium/state_trackers') 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; -- cgit v1.2.3