intel: Move validation of context version into intelInitContext
[mesa.git] / src / mesa / drivers / dri / i965 / brw_context.c
index cf4cedd3df58cc6b15a7243773bf86fc3526f002..70657b7d5b408e68eac4b9f5fd997bb5c549315b 100644 (file)
@@ -87,47 +87,8 @@ brwCreateContext(int api,
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
    struct intel_screen *screen = sPriv->driverPrivate;
    struct dd_function_table functions;
-   const unsigned req_version = major_version * 10 + minor_version;
-   unsigned max_supported_version = 0;
    unsigned i;
 
-#ifdef TEXTURE_FLOAT_ENABLED
-   bool has_texture_float = true;
-#else
-   bool has_texture_float = false;
-#endif
-
-   bool supports_gl30 = has_texture_float &&
-                        (screen->gen == 6 ||
-                         (screen->gen == 7 &&
-                          screen->kernel_has_gen7_sol_reset));
-
-   /* Determine max_supported_version. */
-   switch (api) {
-   case API_OPENGL_COMPAT:
-      max_supported_version = supports_gl30 ? 30 : 21;
-      break;
-   case API_OPENGLES:
-      max_supported_version = 11;
-      break;
-   case API_OPENGLES2:
-      max_supported_version = 20;
-      break;
-   case API_OPENGL_CORE:
-      max_supported_version = supports_gl30 ? 31 : 0;
-      break;
-   default:
-      break;
-   }
-
-   if (max_supported_version == 0) {
-      *error = __DRI_CTX_ERROR_BAD_API;
-      return false;
-   } else if (req_version > max_supported_version) {
-      *error = __DRI_CTX_ERROR_BAD_VERSION;
-      return false;
-   }
-
    struct brw_context *brw = rzalloc(NULL, struct brw_context);
    if (!brw) {
       printf("%s: failed to alloc context\n", __FUNCTION__);
@@ -147,10 +108,12 @@ brwCreateContext(int api,
    struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &intel->ctx;
 
-   if (!intelInitContext( intel, api, mesaVis, driContextPriv,
-                         sharedContextPrivate, &functions )) {
+   if (!intelInitContext( intel, api, major_version, minor_version,
+                          mesaVis, driContextPriv,
+                         sharedContextPrivate, &functions,
+                         error)) {
       printf("%s: failed to init intel context\n", __FUNCTION__);
-      *error = __DRI_CTX_ERROR_NO_MEMORY;
+      ralloc_free(brw);
       return false;
    }