Mesa (master): mesa: In helpers, only check driver capability for meta
Nanley Chery
nchery at kemper.freedesktop.org
Thu Nov 12 21:12:09 UTC 2015
Module: Mesa
Branch: master
Commit: a16ffb743ced9fde80b2485dfc2d86ae74e86f25
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a16ffb743ced9fde80b2485dfc2d86ae74e86f25
Author: Nanley Chery <nanley.g.chery at intel.com>
Date: Thu Oct 15 12:34:43 2015 -0700
mesa: In helpers, only check driver capability for meta
Make API context and version checks done by the helper functions pass
unconditionally while meta is in progress. This transparently makes
extension checks solely dependent on struct gl_extensions while in meta.
v2: Use an 8-bit data type instead of a GLuint
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
Reviewed-by: Chad Versace <chad.versace at intel.com>
---
src/mesa/drivers/common/meta.c | 11 +++++++++++
src/mesa/drivers/common/meta.h | 1 +
src/mesa/main/extensions.h | 2 +-
src/mesa/main/mtypes.h | 6 ++++++
src/mesa/main/version.c | 1 +
5 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e27489d..0ffcd9c 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -449,6 +449,16 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->API = ctx->API;
ctx->API = API_OPENGL_COMPAT;
+ /* Mesa's extension helper functions use the current context's API to look up
+ * the version required by an extension as a step in determining whether or
+ * not it has been advertised. Since meta aims to only be restricted by the
+ * driver capability (and not by whether or not an extension has been
+ * advertised), set the helper functions' Version variable to a value that
+ * will make the checks on the context API and version unconditionally pass.
+ */
+ save->ExtensionsVersion = ctx->Extensions.Version;
+ ctx->Extensions.Version = ~0;
+
/* Pausing transform feedback needs to be done early, or else we won't be
* able to change other state.
*/
@@ -1222,6 +1232,7 @@ _mesa_meta_end(struct gl_context *ctx)
ctx->Meta->SaveStackDepth--;
ctx->API = save->API;
+ ctx->Extensions.Version = save->ExtensionsVersion;
}
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index d742eaa..d4bf0b6 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -72,6 +72,7 @@ struct save_state
/* Always saved/restored with meta. */
gl_api API;
+ uint8_t ExtensionsVersion;
/** MESA_META_CLEAR (and others?) */
struct gl_query_object *CurrentOcclusionObject;
diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h
index 4ea2af1..e4671be 100644
--- a/src/mesa/main/extensions.h
+++ b/src/mesa/main/extensions.h
@@ -91,7 +91,7 @@ enum {
static inline bool \
_mesa_has_##name_str(const struct gl_context *ctx) \
{ \
- return ctx->Extensions.driver_cap && (ctx->Version >= \
+ return ctx->Extensions.driver_cap && (ctx->Extensions.Version >= \
_mesa_extension_table[MESA_EXTENSION_##name_str].version[ctx->API]); \
}
#include "extensions_table.h"
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8de9c77..c4d8c6a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3820,6 +3820,12 @@ struct gl_extensions
const GLubyte *String;
/** Number of supported extensions */
GLuint Count;
+ /**
+ * The context version which extension helper functions compare against.
+ * By default, the value is equal to ctx->Version. This changes to ~0
+ * while meta is in progress.
+ */
+ GLubyte Version;
};
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 5635a64..314b26d 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -524,6 +524,7 @@ _mesa_compute_version(struct gl_context *ctx)
return;
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
+ ctx->Extensions.Version = ctx->Version;
/* Make sure that the GLSL version lines up with the GL version. In some
* cases it can be too high, e.g. if an extension is missing.
More information about the mesa-commit
mailing list