diff options
author | marha <marha@users.sourceforge.net> | 2015-04-30 23:26:47 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2015-04-30 23:29:47 +0200 |
commit | 055e5645a789d2822d3c4e5a3bc81ff6a969ff31 (patch) | |
tree | 8a923f19c3586f9341114be6c81784ab9018aef8 /mesalib/src/mesa/main | |
parent | 0f7871ff824bcf064db3ab6bdfe26645ba6c8087 (diff) | |
parent | a71d524ecad48837e0124a03124bc05f59a48be7 (diff) | |
download | vcxsrv-055e5645a789d2822d3c4e5a3bc81ff6a969ff31.tar.gz vcxsrv-055e5645a789d2822d3c4e5a3bc81ff6a969ff31.tar.bz2 vcxsrv-055e5645a789d2822d3c4e5a3bc81ff6a969ff31.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/compiler.h | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/main/ffvertex_prog.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 2 | ||||
-rwxr-xr-x | mesalib/src/mesa/main/macros.h | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 13 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shader_query.cpp | 56 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texgetimage.c | 54 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texobj.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texturebarrier.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniform_query.cpp | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/main/version.c | 63 |
16 files changed, 183 insertions, 77 deletions
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index 55152fdef..93b4e6f12 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -60,11 +60,6 @@ extern "C" { #endif -/* XXX: Use standard `__func__` instead */ -#ifndef __FUNCTION__ -# define __FUNCTION__ __func__ -#endif - /** * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32. * Do not use these unless absolutely necessary! diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index adf64976e..4aaf8b1af 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -894,14 +894,14 @@ update_default_objects(struct gl_context *ctx) * If there's no current OpenGL context for the calling thread, we can * print a message to stderr. * - * \param name the name of the OpenGL function, without the "gl" prefix + * \param name the name of the OpenGL function */ static void nop_handler(const char *name) { GET_CURRENT_CONTEXT(ctx); if (ctx) { - _mesa_error(ctx, GL_INVALID_OPERATION, "gl%s(invalid call)", name); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid call)", name); } #if defined(DEBUG) else if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { @@ -936,7 +936,7 @@ alloc_dispatch_table(void) { /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI - * Mesa we do this to accomodate different versions of libGL and various + * Mesa we do this to accommodate different versions of libGL and various * DRI drivers. */ GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 861b15006..9be8993b0 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -186,6 +186,7 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 }, { "GL_ARB_texture_rgb10_a2ui", o(ARB_texture_rgb10_a2ui), GL, 2009 }, { "GL_ARB_texture_rg", o(ARB_texture_rg), GL, 2008 }, + { "GL_ARB_texture_stencil8", o(ARB_texture_stencil8), GL, 2013 }, { "GL_ARB_texture_storage", o(dummy_true), GL, 2011 }, { "GL_ARB_texture_storage_multisample", o(ARB_texture_multisample), GL, 2012 }, { "GL_ARB_texture_view", o(ARB_texture_view), GL, 2012 }, @@ -297,6 +298,7 @@ static const struct extension extension_table[] = { { "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 }, { "GL_OES_depth_texture_cube_map", o(OES_depth_texture_cube_map), ES2, 2012 }, { "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 }, + { "GL_OES_EGL_sync", o(dummy_true), ES1 | ES2, 2010 }, /* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */ { "GL_OES_EGL_image", o(OES_EGL_image), GL | ES1 | ES2, 2006 }, { "GL_OES_EGL_image_external", o(OES_EGL_image_external), ES1 | ES2, 2010 }, diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 8032585ab..27cf97f17 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -813,8 +813,10 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format, if (ctx->Extensions.ARB_depth_texture && baseFormat == GL_DEPTH_STENCIL) { /* OK */ - } - else { + } else if (ctx->Extensions.ARB_texture_stencil8 && + baseFormat == GL_STENCIL_INDEX) { + /* OK */ + } else { /* no such thing as stencil-only textures */ att_incomplete("illegal stencil texture"); att->Complete = GL_FALSE; @@ -978,7 +980,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) && - !is_legal_depth_format(ctx, f)) { + !is_legal_depth_format(ctx, f) && + f != GL_STENCIL_INDEX) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; fbo_incomplete(ctx, "texture attachment incomplete", -1); return; diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c index edf7e3390..7fdd9bab6 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.c +++ b/mesalib/src/mesa/main/ffvertex_prog.c @@ -1657,7 +1657,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) struct gl_vertex_program *prog; struct state_key key; - /* Grab all the relevent state and put it in a single structure: + /* Grab all the relevant state and put it in a single structure: */ make_state_key(ctx, &key); diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 2bc8bcad9..8af44e905 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -811,7 +811,7 @@ _mesa_format_image_size(mesa_format format, GLsizei width, /** * Same as _mesa_format_image_size() but returns a 64-bit value to - * accomodate very large textures. + * accommodate very large textures. */ uint64_t _mesa_format_image_size64(mesa_format format, GLsizei width, diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index 5680b2ee1..2a5731f8c 100755 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -31,6 +31,7 @@ #ifndef MACROS_H #define MACROS_H +#include "util/macros.h" #include "util/u_math.h" #include "imports.h" @@ -800,10 +801,6 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y) } -/** Compute ceiling of integer quotient of A divided by B. */ -#define DIV_ROUND_UP( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) - - /** casts to silence warnings with some compilers */ #define ENUM_TO_INT(E) ((GLint)(E)) #define ENUM_TO_FLOAT(E) ((GLfloat)(GLint)(E)) diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 1c751cfff..fb4143086 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2365,16 +2365,6 @@ struct gl_ati_fragment_shader_state }; -/** Set by #pragma directives */ -struct gl_sl_pragmas -{ - GLboolean IgnoreOptimize; /**< ignore #pragma optimize(on/off) ? */ - GLboolean IgnoreDebug; /**< ignore #pragma debug(on/off) ? */ - GLboolean Optimize; /**< defaults on */ - GLboolean Debug; /**< defaults off */ -}; - - /** * A GLSL vertex or fragment shader object. */ @@ -2397,7 +2387,6 @@ struct gl_shader struct gl_program *Program; /**< Post-compile assembly code */ GLchar *InfoLog; - struct gl_sl_pragmas Pragmas; unsigned Version; /**< GLSL version used for linking */ @@ -2903,8 +2892,6 @@ struct gl_shader_compiler_options */ GLboolean OptimizeForAOS; - struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ - const struct nir_shader_compiler_options *NirOptions; }; diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp index b5f1d082c..d2ca49b43 100644 --- a/mesalib/src/mesa/main/shader_query.cpp +++ b/mesalib/src/mesa/main/shader_query.cpp @@ -291,7 +291,6 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name) return (loc >= 0) ? loc : -1; } - unsigned _mesa_count_active_attribs(struct gl_shader_program *shProg) { @@ -300,19 +299,15 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg) return 0; } - exec_list *const ir = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->ir; - unsigned i = 0; - - foreach_in_list(ir_instruction, node, ir) { - const ir_variable *const var = node->as_variable(); - - if (!is_active_attrib(var)) - continue; - - i++; + struct gl_program_resource *res = shProg->ProgramResourceList; + unsigned count = 0; + for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) { + if (res->Type == GL_PROGRAM_INPUT && + res->StageReferences & (1 << MESA_SHADER_VERTEX) && + is_active_attrib(RESOURCE_VAR(res))) + count++; } - - return i; + return count; } @@ -324,20 +319,16 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg) return 0; } - exec_list *const ir = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->ir; + struct gl_program_resource *res = shProg->ProgramResourceList; size_t longest = 0; + for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) { + if (res->Type == GL_PROGRAM_INPUT && + res->StageReferences & (1 << MESA_SHADER_VERTEX)) { - foreach_in_list(ir_instruction, node, ir) { - const ir_variable *const var = node->as_variable(); - - if (var == NULL - || var->data.mode != ir_var_shader_in - || var->data.location == -1) - continue; - - const size_t len = strlen(var->name); - if (len >= longest) - longest = len + 1; + const size_t length = strlen(RESOURCE_VAR(res)->name); + if (length >= longest) + longest = length + 1; + } } return longest; @@ -537,6 +528,7 @@ array_index_of_resource(struct gl_program_resource *res, return get_matching_index(RESOURCE_VAR(res), name); default: assert(!"support for resource type not implemented"); + return -1; } } @@ -634,7 +626,7 @@ _mesa_program_resource_find_index(struct gl_shader_program *shProg, case GL_ATOMIC_COUNTER_BUFFER: if (_mesa_program_resource_index(shProg, res) == index) return res; - + break; case GL_TRANSFORM_FEEDBACK_VARYING: case GL_PROGRAM_INPUT: case GL_PROGRAM_OUTPUT: @@ -860,13 +852,23 @@ get_buffer_property(struct gl_shader_program *shProg, *val = RESOURCE_UBO(res)->UniformBufferSize; return 1; case GL_NUM_ACTIVE_VARIABLES: - *val = RESOURCE_UBO(res)->NumUniforms; + *val = 0; + for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) { + const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName; + struct gl_program_resource *uni = + _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname); + if (!uni) + continue; + (*val)++; + } return 1; case GL_ACTIVE_VARIABLES: for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) { const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName; struct gl_program_resource *uni = _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname); + if (!uni) + continue; *val++ = _mesa_program_resource_index(shProg, uni); } diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 77e2b8745..a04b28711 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -115,9 +115,6 @@ _mesa_init_shader_state(struct gl_context *ctx) options.MaxUnrollIterations = 32; options.MaxIfDepth = UINT_MAX; - /* Default pragma settings */ - options.DefaultPragmas.Optimize = GL_TRUE; - for (sh = 0; sh < MESA_SHADER_STAGES; ++sh) memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options)); @@ -864,17 +861,11 @@ static void compile_shader(struct gl_context *ctx, GLuint shaderObj) { struct gl_shader *sh; - struct gl_shader_compiler_options *options; sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader"); if (!sh) return; - options = &ctx->Const.ShaderCompilerOptions[sh->Stage]; - - /* set default pragma state for shader */ - sh->Pragmas = options->DefaultPragmas; - if (!sh->Source) { /* If the user called glCompileShader without first calling * glShaderSource, we should fail to compile, but not raise a GL_ERROR. diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 255d36559..92b4d6795 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -175,6 +175,51 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions, } } +/** + * glGetTexImage for stencil pixels. + */ +static void +get_tex_stencil(struct gl_context *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + GLint img, row; + + assert(format == GL_STENCIL_INDEX); + + for (img = 0; img < depth; img++) { + GLubyte *srcMap; + GLint rowstride; + + /* map src texture buffer */ + ctx->Driver.MapTextureImage(ctx, texImage, img, + 0, 0, width, height, GL_MAP_READ_BIT, + &srcMap, &rowstride); + + if (srcMap) { + for (row = 0; row < height; row++) { + const GLubyte *src = srcMap + row * rowstride; + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + _mesa_unpack_ubyte_stencil_row(texImage->TexFormat, + width, + (const GLuint *) src, + dest); + } + + ctx->Driver.UnmapTextureImage(ctx, texImage, img); + } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); + break; + } + } +} + /** * glGetTexImage for YCbCr pixels. @@ -285,7 +330,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions, } /* Depending on the base format involved we may need to apply a rebase - * tranaform (for example: if we download to a Luminance format we want + * transform (for example: if we download to a Luminance format we want * G=0 and B=0). */ if (baseFormat == GL_LUMINANCE || @@ -388,7 +433,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, } /* Depending on the base format involved we may need to apply a rebase - * tranaform (for example: if we download to a Luminance format we want + * transform (for example: if we download to a Luminance format we want * G=0 and B=0). */ if (texImage->_BaseFormat == GL_LUMINANCE || @@ -684,6 +729,9 @@ _mesa_GetTexImage_sw(struct gl_context *ctx, else if (format == GL_DEPTH_STENCIL_EXT) { get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage); } + else if (format == GL_STENCIL_INDEX) { + get_tex_stencil(ctx, dimensions, format, type, pixels, texImage); + } else if (format == GL_YCBCR_MESA) { get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage); } @@ -879,7 +927,7 @@ getteximage_error_check(struct gl_context *ctx, "glGetTex%sImage(format mismatch)", suffix); return GL_TRUE; } - else if (_mesa_is_enum_format_integer(format) != + else if (!_mesa_is_stencil_format(format) && _mesa_is_enum_format_integer(format) != _mesa_is_format_integer(texImage->TexFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTex%sImage(format mismatch)", suffix); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 8d9d7cfc1..7bc1da7f8 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1997,7 +1997,8 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx, const char *caller) { if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT - || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) { + || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL + || _mesa_base_tex_format(ctx, internalFormat) == GL_STENCIL_INDEX) { /* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core * Profile spec says: * @@ -3319,7 +3320,9 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, if (!sizeOK) { _mesa_error(ctx, GL_OUT_OF_MEMORY, - "glTexImage%uD(image too large)", dims); + "glTexImage%uD(image too large: %d x %d x %d, %s format)", + dims, width, height, depth, + _mesa_lookup_enum_by_nr(internalFormat)); return; } diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index e018ab910..c563f1e74 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -30,7 +30,6 @@ #include <stdio.h> #include "bufferobj.h" -#include "colortab.h" #include "context.h" #include "enums.h" #include "fbobject.h" diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c index 08ff56150..d879eed57 100644 --- a/mesalib/src/mesa/main/texturebarrier.c +++ b/mesalib/src/mesa/main/texturebarrier.c @@ -49,5 +49,11 @@ _mesa_TextureBarrierNV(void) { GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.NV_texture_barrier) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureBarrier(not supported)"); + return; + } + ctx->Driver.TextureBarrier(ctx); } diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index 4e77b3284..3e857ed10 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -129,14 +129,26 @@ _mesa_GetActiveUniformsiv(GLuint program, res_prop = resource_prop_from_uniform_prop(pname); + /* We need to first verify that each entry exists as active uniform. If + * not, generate error and do not cause any other side effects. + * + * In the case of and error condition, Page 16 (section 2.3.1 Errors) + * of the OpenGL 4.5 spec says: + * + * "If the generating command modifies values through a pointer argu- + * ment, no change is made to these values." + */ for (int i = 0; i < uniformCount; i++) { - res = _mesa_program_resource_find_index(shProg, GL_UNIFORM, - uniformIndices[i]); - if (!res) { + if (!_mesa_program_resource_find_index(shProg, GL_UNIFORM, + uniformIndices[i])) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)"); - break; + return; } + } + for (int i = 0; i < uniformCount; i++) { + res = _mesa_program_resource_find_index(shProg, GL_UNIFORM, + uniformIndices[i]); if (!_mesa_program_resource_prop(shProg, res, uniformIndices[i], res_prop, ¶ms[i], "glGetActiveUniformsiv")) diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index 5df5a2922..c561ab3cb 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/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 && + 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_shading_language_packing && + 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; } @@ -439,6 +483,23 @@ _mesa_compute_version(struct gl_context *ctx) ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API); + /* 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. + */ + if (ctx->API == API_OPENGL_CORE) { + switch (ctx->Version) { + case 31: + ctx->Const.GLSLVersion = 140; + break; + case 32: + ctx->Const.GLSLVersion = 150; + break; + default: + ctx->Const.GLSLVersion = ctx->Version * 10; + break; + } + } + switch (ctx->API) { case API_OPENGL_COMPAT: case API_OPENGL_CORE: |