summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-03-18 08:21:32 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-03-18 09:44:40 +1000
commitb46fcf25be4d1d5a5d072fbce03c2490bf41203f (patch)
tree805d2ea13cbcdcd1a11f04456124cba1aa2b5e2b
parent5deefb7ea5a3c545a6b275d50753d1f232c905d5 (diff)
st/dri2: use pipe_screen.is_format_supported to choose depth/stencil format
-rw-r--r--src/gallium/state_trackers/dri2/dri_drawable.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.c b/src/gallium/state_trackers/dri2/dri_drawable.c
index aa86411190..2e3f4099e2 100644
--- a/src/gallium/state_trackers/dri2/dri_drawable.c
+++ b/src/gallium/state_trackers/dri2/dri_drawable.c
@@ -233,7 +233,9 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
boolean isPixmap)
{
enum pipe_format colorFormat, depthFormat, stencilFormat;
+ struct dri_screen *screen = sPriv->private;
struct dri_drawable *drawable = NULL;
+ struct pipe_screen *pscreen = screen->pipe_screen;
int i;
if (isPixmap)
@@ -252,14 +254,26 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
- if (visual->depthBits)
- depthFormat = PIPE_FORMAT_S8Z24_UNORM;
- else
+ if (visual->depthBits) {
+ if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+ else
+ depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+ } else
depthFormat = PIPE_FORMAT_NONE;
- if (visual->stencilBits)
- stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
- else
+ if (visual->stencilBits) {
+ if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
+ else
+ stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
+ } else
stencilFormat = PIPE_FORMAT_NONE;
drawable->stfb = st_create_framebuffer(visual,