mesa_api = API_OPENGLES2;
break;
case __DRI_API_OPENGL_CORE:
+ mesa_api = API_OPENGL_CORE;
+ break;
default:
*error = __DRI_CTX_ERROR_BAD_API;
return NULL;
}
}
+ /* Mesa does not support the GL_ARB_compatibilty extension or the
+ * compatibility profile. This means that we treat a API_OPENGL 3.1 as
+ * API_OPENGL_CORE and reject API_OPENGL 3.2+.
+ */
+ if (mesa_api == API_OPENGL && major_version == 3 && minor_version == 1)
+ mesa_api = API_OPENGL_CORE;
+
+ if (mesa_api == API_OPENGL
+ && ((major_version > 3)
+ || (major_version == 3 && minor_version >= 2))) {
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return NULL;
+ }
+
/* The EGL_KHR_create_context spec says:
*
* "Flags are only defined for OpenGL context creation, and specifying
struct intel_screen *intelScreen = sPriv->driverPrivate;
bool success = false;
+ switch (api) {
+ case API_OPENGL:
+ case API_OPENGLES:
+ break;
+ case API_OPENGLES2:
+#ifdef I915
+ if (!IS_9XX(intelScreen->deviceID)) {
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return false;
+ }
+#endif
+ break;
+ case API_OPENGL_CORE:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ }
+
#ifdef I915
if (IS_9XX(intelScreen->deviceID)) {
if (!IS_965(intelScreen->deviceID)) {
struct nouveau_context *nctx;
struct gl_context *ctx;
+ switch (api) {
+ case API_OPENGL:
+ /* Do after-the-fact version checking (below).
+ */
+ break;
+ case API_OPENGLES:
+ /* NV10 and NV20 can support OpenGL ES 1.0 only. Older chips
+ * cannot do even that.
+ */
+ if ((screen->device->chipset & 0xf0) == 0x00) {
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ } else if (minor_version != 0) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES2:
+ case API_OPENGL_CORE:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ }
+
/* API and flag filtering is handled in dri2CreateContextAttribs.
*/
- (void) api;
(void) flags;
ctx = screen->driver->context_create(screen, visual, share_ctx);
int i;
int tcl_mode;
- /* API and flag filtering is handled in dri2CreateContextAttribs.
+ switch (api) {
+ case API_OPENGL:
+ if (major_version > 1 || minor_version > 3) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES:
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ }
+
+ /* Flag filtering is handled in dri2CreateContextAttribs.
*/
- (void) api;
(void) flags;
assert(glVisual);
}
_mesa_compute_version(ctx);
- if (ctx->Version < major_version * 10 + minor_version) {
- r200DestroyContext(driContextPriv);
- *error = __DRI_CTX_ERROR_BAD_VERSION;
- return GL_FALSE;
- }
*error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
int i;
int tcl_mode, fthrottle_mode;
- /* API and flag filtering is handled in dri2CreateContextAttribs.
+ switch (api) {
+ case API_OPENGL:
+ if (major_version > 1 || minor_version > 3) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES:
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ }
+
+ /* Flag filtering is handled in dri2CreateContextAttribs.
*/
- (void) api;
(void) flags;
assert(glVisual);
}
_mesa_compute_version(ctx);
- if (ctx->Version < major_version * 10 + minor_version) {
- radeonDestroyContext(driContextPriv);
- *error = __DRI_CTX_ERROR_BAD_VERSION;
- return GL_FALSE;
- }
*error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
*/
(void) flags;
- if (api == API_OPENGL
- && (major_version > 2
- || (major_version == 2 && minor_version > 1))) {
- *error = __DRI_CTX_ERROR_BAD_VERSION;
- goto context_fail;
+ switch (api) {
+ case API_OPENGL:
+ if (major_version > 2
+ || (major_version == 2 && minor_version > 1)) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES:
+ case API_OPENGLES2:
+ break;
+ case API_OPENGL_CORE:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
}
ctx = CALLOC_STRUCT(dri_context);