summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-11-30 12:16:19 -0800
committerIan Romanick <[email protected]>2011-12-23 08:49:53 -0800
commit1ab545494a6750527cb8b945c286f23a6524826a (patch)
treebc6b09c9651a138f810e7778539e5c54350e5674
parentd18152028e1825c05c7de33acacee3336350a096 (diff)
dri2: Add createContextAttribs entry point for DRI2 version 3
Signed-off-by: Ian Romanick <[email protected]>
-rw-r--r--include/GL/internal/dri_interface.h52
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c8
2 files changed, 56 insertions, 4 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 4f768f0c829..add03c72147 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -781,11 +781,45 @@ struct __DRIdri2LoaderExtensionRec {
* constructors for DRI2.
*/
#define __DRI_DRI2 "DRI_DRI2"
-#define __DRI_DRI2_VERSION 2
+#define __DRI_DRI2_VERSION 3
-#define __DRI_API_OPENGL 0
+#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
#define __DRI_API_GLES 1
#define __DRI_API_GLES2 2
+#define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
+
+#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
+#define __DRI_CTX_ATTRIB_MINOR_VERSION 1
+#define __DRI_CTX_ATTRIB_FLAGS 2
+
+#define __DRI_CTX_FLAG_DEBUG 0x00000001
+#define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
+
+/**
+ * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
+ */
+/*@{*/
+/** Success! */
+#define __DRI_CTX_ERROR_SUCCESS 0
+
+/** Memory allocation failure */
+#define __DRI_CTX_ERROR_NO_MEMORY 1
+
+/** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */
+#define __DRI_CTX_ERROR_BAD_API 2
+
+/** Client requested an API version that the driver can't do. */
+#define __DRI_CTX_ERROR_BAD_VERSION 3
+
+/** Client requested a flag or combination of flags the driver can't do. */
+#define __DRI_CTX_ERROR_BAD_FLAG 4
+
+/** Client requested an attribute the driver doesn't understand. */
+#define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5
+
+/** Client requested a flag the driver doesn't understand. */
+#define __DRI_CTX_ERROR_UNKNOWN_FLAG 6
+/*@}*/
struct __DRIdri2ExtensionRec {
__DRIextension base;
@@ -820,6 +854,20 @@ struct __DRIdri2ExtensionRec {
int height);
void (*releaseBuffer)(__DRIscreen *screen,
__DRIbuffer *buffer);
+
+ /**
+ * Create a context for a particular API with a set of attributes
+ *
+ * \since version 3
+ */
+ __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
+ int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ unsigned *error,
+ void *loaderPrivate);
};
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 1640c14480d..a153d525d9c 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -454,14 +454,18 @@ const __DRIcoreExtension driCoreExtension = {
/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
- { __DRI_DRI2, __DRI_DRI2_VERSION },
+ /* Force the version to 2 because the underlying drivers don't (can't!)
+ * support the extra requirements of CreateContextAttribs.
+ */
+ { __DRI_DRI2, 2 },
dri2CreateNewScreen,
dri2CreateNewDrawable,
dri2CreateNewContext,
dri2GetAPIMask,
dri2CreateNewContextForAPI,
dri2AllocateBuffer,
- dri2ReleaseBuffer
+ dri2ReleaseBuffer,
+ NULL
};
const __DRI2configQueryExtension dri2ConfigQueryExtension = {