aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2010-02-10 22:15:24 -0500
committerZack Rusin <[email protected]>2010-02-12 16:00:45 -0500
commitfd40b9ff32ac0ed02928a2b5516c8d678431806f (patch)
tree5c66506f61ce747ebe421aa038d9062b1b56aba5
parent59b4146a5dbeb108b53fc9c4132095e264ba04be (diff)
st/dri: don't expose visuals we'll have trouble supporting
without getBuffersWithFormat some visuals will just cause headaches (crashes), so if we're running on an older system simply don't advertise them.
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 4064976b234..b36ea43db5f 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -97,12 +97,6 @@ dri_fill_in_modes(struct dri_screen *screen,
stencil_bits_array[0] = 0;
depth_buffer_factor = 1;
- pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
- pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
@@ -115,9 +109,6 @@ dri_fill_in_modes(struct dri_screen *screen,
pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24S8_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
- pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
pf_a8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_A8R8G8B8_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
@@ -125,6 +116,26 @@ dri_fill_in_modes(struct dri_screen *screen,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
+ /* we support buffers with different depths only if we can tell the driver
+ * the actual depth of each of them. */
+ if (screen->sPriv->dri2.loader
+ && (screen->sPriv->dri2.loader->base.version > 2)
+ && (screen->sPriv->dri2.loader->getBuffersWithFormat != NULL)) {
+ pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
+ pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
+ pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_R5G6B5_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
+ } else {
+ pf_z16 = FALSE;
+ pf_z32 = FALSE;
+ pf_r5g6b5 = FALSE;
+ }
+
if (pf_z16) {
depth_bits_array[depth_buffer_factor] = 16;
stencil_bits_array[depth_buffer_factor++] = 0;