summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-03-13 20:24:05 -0600
committerBrian Paul <[email protected]>2013-03-15 07:05:01 -0600
commitfec8733d4ed573c5a3e1cb0e837bcfa1986bbeff (patch)
tree0c08e4eda0b3d01bb8db7906e5c834a1bf59c090 /src/gallium/state_trackers
parent5d1b3097e2ee7c0a8197562a47a09beb0930acfc (diff)
st/dri: add support for the always_have_depth_buffer option
This involved adding another driOptionCache to dri_screen. The existing one just held the default values. But now we also need to have the values from the DRI config file so that we can get at the always_have_depth_buffer config option, which is per-screen.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.c5
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c27
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.h7
3 files changed, 28 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index 00b9b0aebe2..4698feb54d8 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -114,7 +114,8 @@ dri_create_context(gl_api api, const struct gl_config * visual,
ctx->sPriv = sPriv;
driParseConfigFiles(&ctx->optionCache,
- &screen->optionCache, sPriv->myNum, driver_descriptor.name);
+ &screen->optionCacheDefaults,
+ sPriv->myNum, driver_descriptor.name);
dri_fill_st_options(&attribs.options, &ctx->optionCache);
dri_fill_st_visual(&attribs.visual, screen, visual);
@@ -174,7 +175,7 @@ dri_destroy_context(__DRIcontext * cPriv)
/* note: we are freeing values and nothing more because
* driParseConfigFiles allocated values only - the rest
- * is owned by screen optionCache.
+ * is owned by screen optionCacheDefaults.
*/
free(ctx->optionCache.values);
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index a908e28be76..2f525a24c3c 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -38,6 +38,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_format.h"
#include "state_tracker/st_gl_api.h" /* for st_gl_api_create */
+#include "state_tracker/drm_driver.h"
#include "util/u_debug.h"
@@ -67,11 +68,14 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
DRI_CONF_SECTION_END
+ DRI_CONF_SECTION_MISCELLANEOUS
+ DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(false)
+ DRI_CONF_SECTION_END
DRI_CONF_END;
#define false 0
-static const uint __driNConfigOptions = 10;
+static const uint __driNConfigOptions = 11;
static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen)
@@ -100,10 +104,16 @@ dri_fill_in_modes(struct dri_screen *screen)
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
};
- depth_bits_array[0] = 0;
- stencil_bits_array[0] = 0;
- depth_buffer_factor = 1;
-
+ if (driQueryOptionb(&screen->optionCache, "always_have_depth_buffer")) {
+ /* all visuals will have a depth buffer */
+ depth_buffer_factor = 0;
+ }
+ else {
+ depth_bits_array[0] = 0;
+ stencil_bits_array[0] = 0;
+ depth_buffer_factor = 1;
+ }
+
msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS_MASK)
? MSAA_VISUAL_MAX_SAMPLES : 1;
@@ -397,9 +407,14 @@ dri_init_screen_helper(struct dri_screen *screen,
else
screen->target = PIPE_TEXTURE_RECT;
- driParseOptionInfo(&screen->optionCache,
+ driParseOptionInfo(&screen->optionCacheDefaults,
__driConfigOptions, __driNConfigOptions);
+ driParseConfigFiles(&screen->optionCache,
+ &screen->optionCacheDefaults,
+ screen->sPriv->myNum,
+ driver_descriptor.name);
+
return dri_fill_in_modes(screen);
}
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h
index 181b22f20b7..859ebfd7f32 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -57,9 +57,10 @@ struct dri_screen
boolean throttling_enabled;
int default_throttle_frames;
- /**
- * Configuration cache with default values for all contexts
- */
+ /** Configuration cache with default values for all contexts */
+ driOptionCache optionCacheDefaults;
+
+ /** The screen's effective configuration options */
driOptionCache optionCache;
/* drm */