#include <stdio.h>
+#include "context.h"
#include "imports.h"
#include "mtypes.h"
#include "version.h"
}
/**
- * Builds the MESA version string.
+ * Builds the Mesa version string.
*/
static void
create_version_string(struct gl_context *ctx, const char *prefix)
{
if (_mesa_override_gl_version_contextless(&ctx->Const, &ctx->API,
&ctx->Version)) {
- create_version_string(ctx, "");
+ /* We need to include API in version string for OpenGL ES, otherwise
+ * application can not detect GLES via glGetString(GL_VERSION) query.
+ *
+ * From OpenGL ES 3.2 spec, Page 436:
+ *
+ * "The VERSION string is laid out as follows:
+ *
+ * OpenGL ES N.M vendor-specific information"
+ *
+ * From OpenGL 4.5 spec, Page 538:
+ *
+ * "The VERSION and SHADING_LANGUAGE_VERSION strings are laid out as
+ * follows:
+ *
+ * <version number><space><vendor-specific information>"
+ */
+ create_version_string(ctx, _mesa_is_gles(ctx) ? "OpenGL ES " : "");
+ ctx->Extensions.Version = ctx->Version;
}
}
extensions->ARB_shading_language_packing &&
extensions->ARB_texture_compression_bptc &&
extensions->ARB_transform_feedback_instanced);
-
- if (ver_4_2) {
+ const bool ver_4_3 = (ver_4_2 &&
+ consts->GLSLVersion >= 430 &&
+ extensions->ARB_ES3_compatibility &&
+ extensions->ARB_arrays_of_arrays &&
+ extensions->ARB_compute_shader &&
+ extensions->ARB_copy_image &&
+ extensions->ARB_explicit_uniform_location &&
+ extensions->ARB_fragment_layer_viewport &&
+ extensions->ARB_framebuffer_no_attachments &&
+ extensions->ARB_internalformat_query2 &&
+ extensions->ARB_robust_buffer_access_behavior &&
+ extensions->ARB_shader_image_size &&
+ extensions->ARB_shader_storage_buffer_object &&
+ extensions->ARB_stencil_texturing &&
+ extensions->ARB_texture_buffer_range &&
+ extensions->ARB_texture_query_levels &&
+ extensions->ARB_texture_view);
+ const bool ver_4_4 = (ver_4_3 &&
+ consts->GLSLVersion >= 440 &&
+ extensions->ARB_buffer_storage &&
+ extensions->ARB_clear_texture &&
+ extensions->ARB_enhanced_layouts &&
+ extensions->ARB_query_buffer_object &&
+ extensions->ARB_texture_mirror_clamp_to_edge &&
+ extensions->ARB_texture_stencil8 &&
+ extensions->ARB_vertex_type_10f_11f_11f_rev);
+ const bool ver_4_5 = (ver_4_4 &&
+ consts->GLSLVersion >= 450 &&
+ extensions->ARB_ES3_1_compatibility &&
+ extensions->ARB_clip_control &&
+ extensions->ARB_conditional_render_inverted &&
+ extensions->ARB_cull_distance &&
+ extensions->ARB_derivative_control &&
+ extensions->ARB_shader_texture_image_samples &&
+ extensions->NV_texture_barrier);
+
+ if (ver_4_5) {
+ major = 4;
+ minor = 5;
+ }
+ else if (ver_4_4) {
+ major = 4;
+ minor = 4;
+ }
+ else if (ver_4_3) {
+ major = 4;
+ minor = 3;
+ }
+ else if (ver_4_2) {
major = 4;
minor = 2;
}
}
static GLuint
-compute_version_es2(const struct gl_extensions *extensions)
+compute_version_es2(const struct gl_extensions *extensions,
+ const struct gl_constants *consts)
{
/* OpenGL ES 2.0 is derived from OpenGL 2.0 */
const bool ver_2_0 = (extensions->ARB_texture_cube_map &&
extensions->EXT_texture_snorm &&
extensions->NV_primitive_restart &&
extensions->OES_depth_texture_cube_map);
+ const bool es31_compute_shader =
+ consts->MaxComputeWorkGroupInvocations >= 128;
const bool ver_3_1 = (ver_3_0 &&
extensions->ARB_arrays_of_arrays &&
- extensions->ARB_compute_shader &&
+ es31_compute_shader &&
extensions->ARB_draw_indirect &&
- false /*extensions->ARB_framebuffer_no_attachments*/ &&
+ extensions->ARB_explicit_uniform_location &&
+ extensions->ARB_framebuffer_no_attachments &&
extensions->ARB_shader_atomic_counters &&
extensions->ARB_shader_image_load_store &&
- false /*extensions->ARB_shader_image_size*/ &&
- false /*extensions->ARB_shader_storage_buffer_object*/ &&
+ extensions->ARB_shader_image_size &&
+ extensions->ARB_shader_storage_buffer_object &&
extensions->ARB_shading_language_packing &&
extensions->ARB_stencil_texturing &&
+ extensions->ARB_texture_multisample &&
extensions->ARB_gpu_shader5 &&
extensions->EXT_shader_integer_mix);
+ const bool ver_3_2 = (ver_3_1 &&
+ /*extensions->KHR_blend_equation_advanced*/ false &&
+ extensions->KHR_texture_compression_astc_ldr &&
+ extensions->OES_copy_image &&
+ extensions->ARB_draw_buffers_blend &&
+ extensions->ARB_draw_elements_base_vertex &&
+ extensions->OES_geometry_shader &&
+ /*extensions->OES_primitive_bounding_box*/ false &&
+ extensions->OES_sample_variables &&
+ extensions->ARB_tessellation_shader &&
+ extensions->ARB_texture_border_clamp &&
+ extensions->OES_texture_buffer &&
+ extensions->ARB_texture_cube_map_array &&
+ extensions->ARB_texture_stencil8);
- if (ver_3_1) {
+ if (ver_3_2) {
+ return 32;
+ } else if (ver_3_1) {
return 31;
} else if (ver_3_0) {
return 30;
case API_OPENGLES:
return compute_version_es1(extensions);
case API_OPENGLES2:
- return compute_version_es2(extensions);
+ return compute_version_es2(extensions, consts);
}
return 0;
}
return;
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
+ ctx->Extensions.Version = ctx->Version;
/* Make sure that the GLSL version lines up with the GL version. In some
* cases it can be too high, e.g. if an extension is missing.