summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2012-11-21 16:22:19 -0800
committerIan Romanick <[email protected]>2013-01-15 13:45:51 -0800
commita11fe62058ad9d44170be9346111e3f6630a3327 (patch)
tree6783caeef31bd5636de40194901407f01bb44f67 /src/mesa/drivers/dri/i965
parent4945086f36d3ccec041e499f1e2861dc1cc45a44 (diff)
intel: Move validation of context version into intelInitContext
Each driver (i830, i915, i965) used independent but similar code to validate the requested context version. With the rececnt arrival of GLES3, that logic has needed an update. Rather than apply identical updates to each drivers validation code, let's just move the validation into the shared routine intelInitContext. This refactor required some incidental changes to functions i830CreateContext and intelInitContext. For each function, this patch: - Adds context version parameters to the signature. - Adds a DRI_CTX_ERROR out param to the signature. - Sets the DRI_CTX_ERROR at each early return. Tested against gen6 with piglit egl-create-context-verify-gl-flavor. Verified that this patch does not change the set of exposed EGL context flavors. Signed-off-by: Chad Versace <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c47
1 files changed, 5 insertions, 42 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index cf4cedd3df5..70657b7d5b4 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -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;
}