st/xorg: Find out correct type for depth stencil buffers
authorJakob Bornecrantz <jakob@vmware.com>
Wed, 26 Aug 2009 11:45:31 +0000 (13:45 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Wed, 26 Aug 2009 11:45:31 +0000 (13:45 +0200)
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_tracker.h

index f089965b03c8c061d956b73735f45e5f5fdbb615..e72710befb0ea31ef28b04a0f82d9e0b9e6c15ac 100644 (file)
@@ -88,7 +88,8 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
            struct pipe_texture template;
            memset(&template, 0, sizeof(template));
            template.target = PIPE_TEXTURE_2D;
-           template.format = PIPE_FORMAT_S8Z24_UNORM;
+           template.format = ms->ds_depth_bits_last ?
+               PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
            pf_get_block(template.format, &template.block);
            template.width[0] = pDraw->width;
            template.height[0] = pDraw->height;
@@ -270,6 +271,15 @@ driScreenInit(ScreenPtr pScreen)
     dri2info.DestroyBuffers = driDestroyBuffers;
     dri2info.CopyRegion = driCopyRegion;
 
+    ms->d_depth_bits_last =
+        ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_X8Z24_UNORM,
+                                        PIPE_TEXTURE_2D,
+                                        PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
+    ms->ds_depth_bits_last =
+        ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_S8Z24_UNORM,
+                                        PIPE_TEXTURE_2D,
+                                        PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
+
     return DRI2ScreenInit(pScreen, &dri2info);
 }
 
index da850bbf6498a95c848ba32e0d16927d07cd429d..8c60d50927defc6eca0e501d63422cfb1142abcb 100644 (file)
@@ -87,6 +87,8 @@ typedef struct _modesettingRec
     struct drm_api *api;
     struct pipe_screen *screen;
     struct pipe_context *ctx;
+    boolean d_depth_bits_last;
+    boolean ds_depth_bits_last;
 
     /* exa */
     void *exa;