summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-08-07 12:50:44 -0700
committerIan Romanick <[email protected]>2012-08-29 15:09:38 -0700
commit0e0d66446194ab0b2d114dc83e76ec9c9b1a01f1 (patch)
tree76d3f87d1cd51f386b1033dc655488e65db9ec3e /src/mesa/drivers/dri
parent2a33a997376e1b628ad91e609a090bedf5964704 (diff)
i965: Allow creation of OpenGL 3.1 contexts
v2: Fix API_OPENGL_CORE handling when TEXTURE_FLOAT_ENABLED is not defined. Based on review feedback from Eric Anholt. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 8d2e5c99e08..4e5aed69302 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -109,6 +109,25 @@ brwCreateContext(int api,
case API_OPENGLES:
case API_OPENGLES2:
break;
+ case API_OPENGL_CORE: {
+#ifdef TEXTURE_FLOAT_ENABLED
+ const unsigned max_version =
+ (screen->gen == 6 ||
+ (screen->gen == 7 && screen->kernel_has_gen7_sol_reset))
+ ? 31 : 0;
+ const unsigned req_version = major_version * 10 + minor_version;
+
+ if (req_version > max_version) {
+ *error = (max_version == 0)
+ ? __DRI_CTX_ERROR_BAD_API : __DRI_CTX_ERROR_BAD_VERSION;
+ return false;
+ }
+ break;
+#else
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return false;
+#endif
+ }
default:
*error = __DRI_CTX_ERROR_BAD_API;
return false;