summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/state_tracker
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-09-10 10:31:06 +0800
committerChia-I Wu <[email protected]>2010-09-10 15:37:43 +0800
commit4531356817ec8383ac35932903773de67af92e37 (patch)
treebb9c6262af2ca8261db6b0d325622d122ef04c70 /src/gallium/include/state_tracker
parentfcae8ca57512f84c51b7445456aab7ec92a21254 (diff)
gallium: Add context profile support to st_api.
Add struct st_context_attribs to describe context profiles and attributes. Modify st_api::create_context to take the new struct instead of an st_visual. st_context_attribs can be used to support GLX_ARB_create_context_profile and GLX_EXT_create_context_es2_profile in the future. But the motivation for doing it now is to be able to replace ST_API_OPENGL_ES1 and ST_API_OPENGL_ES2 by profiles. Having 3 st_api's to provide OpenGL, OpenGL ES 1.1, and OpenGL ES 2.0 is not a sane abstraction, since all of them share glapi for current context/dispatch management.
Diffstat (limited to 'src/gallium/include/state_tracker')
-rw-r--r--src/gallium/include/state_tracker/st_api.h63
1 files changed, 61 insertions, 2 deletions
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 11424611881..9e87c8e0d40 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -55,6 +55,23 @@ enum st_api_type {
};
/**
+ * The profile of a context.
+ */
+enum st_profile_type
+{
+ ST_PROFILE_DEFAULT,
+ ST_PROFILE_OPENGL_CORE,
+ ST_PROFILE_OPENGL_ES1,
+ ST_PROFILE_OPENGL_ES2
+};
+
+/* for profile_mask in st_api */
+#define ST_PROFILE_DEFAULT_MASK (1 << ST_PROFILE_DEFAULT)
+#define ST_PROFILE_OPENGL_CORE_MASK (1 << ST_PROFILE_OPENGL_CORE)
+#define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1)
+#define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2)
+
+/**
* Used in st_context_iface->teximage.
*/
enum st_texture_type {
@@ -180,6 +197,37 @@ struct st_visual
};
/**
+ * Represent the attributes of a context.
+ */
+struct st_context_attribs
+{
+ /**
+ * The profile and minimal version to support.
+ *
+ * The valid profiles and versions are rendering API dependent. The latest
+ * version satisfying the request should be returned, unless
+ * forward_compatiible is true.
+ */
+ enum st_profile_type profile;
+ int major, minor;
+
+ /**
+ * Enable debugging.
+ */
+ boolean debug;
+
+ /**
+ * Return the exact version and disallow the use of deprecated features.
+ */
+ boolean forward_compatible;
+
+ /**
+ * The visual of the framebuffers the context will be bound to.
+ */
+ struct st_visual visual;
+};
+
+/**
* Represent a windowing system drawable.
*
* The framebuffer is implemented by the state tracker manager and
@@ -357,6 +405,16 @@ struct st_manager
struct st_api
{
/**
+ * The supported rendering API.
+ */
+ enum st_api_type api;
+
+ /**
+ * The supported profiles. Tested with ST_PROFILE_*_MASK.
+ */
+ unsigned profile_mask;
+
+ /**
* Destroy the API.
*/
void (*destroy)(struct st_api *stapi);
@@ -373,13 +431,14 @@ struct st_api
*/
struct st_context_iface *(*create_context)(struct st_api *stapi,
struct st_manager *smapi,
- const struct st_visual *visual,
+ const struct st_context_attribs *attribs,
struct st_context_iface *stsharei);
/**
* Bind the context to the calling thread with draw and read as drawables.
*
- * The framebuffers might have different visuals than the context does.
+ * The framebuffers might be NULL, or might have different visuals than the
+ * context does.
*/
boolean (*make_current)(struct st_api *stapi,
struct st_context_iface *stctxi,