summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-01-11 15:56:22 -0500
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-02-03 14:04:11 +0100
commitbc8a6842a95aac4e41d11817f8f05b287f3fea6c (patch)
tree62354ca68f6ca9f7a52645f98df6efb45aad6275
parent761c7d59c4403832c33d931bb097d060ed07e555 (diff)
mesa: add MESA_NO_MINMAX_CACHE environment variable
When set to a truish value, this globally disables the minmax cache for all buffer objects. No #ifdef DEBUG guards because this option can be interesting for benchmarking. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--docs/envvars.html1
-rw-r--r--src/mesa/main/bufferobj.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/docs/envvars.html b/docs/envvars.html
index 5bb7b1e65b..ba83335d0b 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -96,6 +96,7 @@ glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as
"130". Mesa will not really implement all the features of the given language version
if it's higher than what's normally reported. (for developers only)
<li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
+<li>MESA_NO_MINMAX_CACHE - when set, the minmax index cache is globally disabled.
</ul>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 3d93cf826b..dba6934bac 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -32,6 +32,7 @@
#include <stdbool.h>
#include <inttypes.h> /* for PRId64 macro */
+#include "util/debug.h"
#include "glheader.h"
#include "enums.h"
#include "hash.h"
@@ -521,6 +522,24 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
/**
+ * Get the value of MESA_NO_MINMAX_CACHE.
+ */
+static bool
+get_no_minmax_cache()
+{
+ static bool read = false;
+ static bool disable = false;
+
+ if (!read) {
+ disable = env_var_as_boolean("MESA_NO_MINMAX_CACHE", false);
+ read = true;
+ }
+
+ return disable;
+}
+
+
+/**
* Initialize a buffer object to default values.
*/
void
@@ -533,6 +552,9 @@ _mesa_initialize_buffer_object(struct gl_context *ctx,
obj->RefCount = 1;
obj->Name = name;
obj->Usage = GL_STATIC_DRAW_ARB;
+
+ if (get_no_minmax_cache())
+ obj->UsageHistory |= USAGE_DISABLE_MINMAX_CACHE;
}