[Mesa-dev] [PATCH] mesa: add support for exposing up to GL4.2

Ilia Mirkin imirkin at alum.mit.edu
Thu Apr 23 07:53:29 PDT 2015


Add the 4.0/4.1/4.2 extensions lists to compute_version. A coule of
extensions aren't in mesa yet, so those are marked with 0 until they
become supported.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

I wasn't 100% sure about shading_language_packing -- it includes a
couple of functions that don't appear until GL 4.2. However since it's
enabled for all the drivers that matter in mesa, wtvr.

I'm planning on making an integration branch for nvc0 that includes
Dave's work on subroutines and 64-bit attribs along with Chris and my
tess patches, to be able to expose GL4.1. Having this in tree would be
convenient. [And GL4.2 was easy enough to include, so I went ahead with it.]

 src/mesa/main/version.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 7c6d994..738b406 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -295,7 +295,51 @@ compute_version(const struct gl_extensions *extensions,
                               extensions->EXT_texture_swizzle);
                               /* ARB_sampler_objects is always enabled in mesa */
 
-   if (ver_3_3) {
+   const GLboolean ver_4_0 = (ver_3_3 &&
+                              consts->GLSLVersion >= 400 &&
+                              extensions->ARB_draw_buffers_blend &&
+                              extensions->ARB_draw_indirect &&
+                              extensions->ARB_gpu_shader5 &&
+                              extensions->ARB_gpu_shader_fp64 &&
+                              extensions->ARB_sample_shading &&
+                              extensions->ARB_shading_language_packing &&
+                              0/*extensions->ARB_shader_subroutine*/ &&
+                              extensions->ARB_tessellation_shader &&
+                              extensions->ARB_texture_buffer_object_rgb32 &&
+                              extensions->ARB_texture_cube_map_array &&
+                              extensions->ARB_texture_query_lod &&
+                              extensions->ARB_transform_feedback2 &&
+                              extensions->ARB_transform_feedback3);
+   const GLboolean ver_4_1 = (ver_4_0 &&
+                              consts->GLSLVersion >= 410 &&
+                              extensions->ARB_ES2_compatibility &&
+                              extensions->ARB_shader_precision &&
+                              0/*extensions->ARB_vertex_attrib_64bit*/ &&
+                              extensions->ARB_viewport_array);
+   const GLboolean ver_4_2 = (ver_4_1 &&
+                              consts->GLSLVersion >= 420 &&
+                              extensions->ARB_base_instance &&
+                              extensions->ARB_conservative_depth &&
+                              extensions->ARB_internalformat_query &&
+                              extensions->ARB_shader_atomic_counters &&
+                              extensions->ARB_shader_image_load_store &&
+                              extensions->ARB_shading_language_420pack &&
+                              extensions->ARB_texture_compression_bptc &&
+                              extensions->ARB_transform_feedback_instanced);
+
+   if (ver_4_2) {
+      major = 4;
+      minor = 2;
+   }
+   else if (ver_4_1) {
+      major = 4;
+      minor = 1;
+   }
+   else if (ver_4_0) {
+      major = 4;
+      minor = 0;
+   }
+   else if (ver_3_3) {
       major = 3;
       minor = 3;
    }
-- 
2.0.5



More information about the mesa-dev mailing list