diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2012-11-21 16:22:19 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2013-01-15 13:45:51 -0800 |
commit | a11fe62058ad9d44170be9346111e3f6630a3327 (patch) | |
tree | 6783caeef31bd5636de40194901407f01bb44f67 /src/mesa/drivers/dri/i915/i915_context.c | |
parent | 4945086f36d3ccec041e499f1e2861dc1cc45a44 (diff) | |
download | external_mesa3d-a11fe62058ad9d44170be9346111e3f6630a3327.zip external_mesa3d-a11fe62058ad9d44170be9346111e3f6630a3327.tar.gz external_mesa3d-a11fe62058ad9d44170be9346111e3f6630a3327.tar.bz2 |
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 <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i915/i915_context.c')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index a6b8e46..75a1a2c 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -168,33 +168,11 @@ i915CreateContext(int api, i915InitDriverFunctions(&functions); - if (!intelInitContext(intel, api, mesaVis, driContextPriv, - sharedContextPrivate, &functions)) { - *error = __DRI_CTX_ERROR_NO_MEMORY; - return false; - } - - /* Now that the extension bits are known, filter against the requested API - * and version. - */ - switch (api) { - case API_OPENGL_COMPAT: { - const unsigned max_version = - (ctx->Extensions.ARB_fragment_shader && - ctx->Extensions.ARB_occlusion_query) ? 20 : 15; - const unsigned req_version = major_version * 10 + minor_version; - - if (req_version > max_version) { - *error = __DRI_CTX_ERROR_BAD_VERSION; - return false; - } - break; - } - case API_OPENGLES: - case API_OPENGLES2: - break; - default: - *error = __DRI_CTX_ERROR_BAD_API; + if (!intelInitContext(intel, api, major_version, minor_version, + mesaVis, driContextPriv, + sharedContextPrivate, &functions, + error)) { + ralloc_free(i915); return false; } |