diff options
Diffstat (limited to 'mesalib')
-rw-r--r-- | mesalib/configure.ac | 8 | ||||
-rw-r--r-- | mesalib/docs/envvars.html | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_dump_state.c | 1 | ||||
-rw-r--r-- | mesalib/src/glsl/ir_constant_expression.cpp | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/SConscript | 43 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/version.c | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/main/version.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_draw.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 2 |
13 files changed, 98 insertions, 18 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac index b2606bf64..56aac7a81 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -1891,10 +1891,10 @@ ln -s autoconf configs/current ]) dnl Sort the dirs alphabetically -GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort|tr "\n" " "` -GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort|tr "\n" " "` -GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort|tr "\n" " "` -GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort|tr "\n" " "` +GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "` +GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort -u|tr "\n" " "` +GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "` +GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "` AC_OUTPUT diff --git a/mesalib/docs/envvars.html b/mesalib/docs/envvars.html index 6402ec507..8c5c6abf7 100644 --- a/mesalib/docs/envvars.html +++ b/mesalib/docs/envvars.html @@ -62,6 +62,10 @@ This is a work-around for that. glGetString(GL_VERSION). Valid values are point-separated version numbers, such as "3.0". Mesa will not really implement all the features of the given version if it's higher than what's normally reported. +<li>MESA_GLSL_VERSION_OVERRIDE - changes the value returned by +glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as +"130". Mesa will not really implement all the features of the given language version +if it's higher than what's normally reported. (for developers only) <li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a> </ul> diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_state.c b/mesalib/src/gallium/auxiliary/util/u_dump_state.c index 6bb369966..8a7ec5848 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dump_state.c +++ b/mesalib/src/gallium/auxiliary/util/u_dump_state.c @@ -332,6 +332,7 @@ util_dump_rasterizer_state(struct os_stream *stream, const struct pipe_rasterize util_dump_member(stream, float, state, point_size); util_dump_member(stream, float, state, offset_units); util_dump_member(stream, float, state, offset_scale); + util_dump_member(stream, float, state, offset_clamp); util_dump_struct_end(stream); } diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp index f0299a2c4..b3fe6cf96 100644 --- a/mesalib/src/glsl/ir_constant_expression.cpp +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -69,7 +69,9 @@ ir_expression::constant_expression_value() } if (op[1] != NULL) - assert(op[0]->type->base_type == op[1]->type->base_type); + assert(op[0]->type->base_type == op[1]->type->base_type || + this->operation == ir_binop_lshift || + this->operation == ir_binop_rshift); bool op0_scalar = op[0]->type->is_scalar(); bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar(); @@ -1371,6 +1373,8 @@ ir_call::constant_expression_value() data.f[m*i+j] += op[0]->value.f[i+n*j]; } } + } else if (strcmp(callee, "trunc") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_trunc, op[0]); } else { /* Unsupported builtin - some are not allowed in constant expressions. */ return NULL; diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index ff1ffe008..abcce4133 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -3,6 +3,9 @@ Import('*') +import filecmp +import os +import subprocess env = env.Clone() @@ -458,13 +461,41 @@ if env['gcc'] and env['platform'] != 'windows': env.Append(CPPPATH = [matypes[0].dir]) -# Create the git_sha1.h file if it doesn't exist already -try: - f = open('main/git_sha1.h', 'r') - f.close() -except IOError: - f = open('main/git_sha1.h', 'w') + + +def write_git_sha1_h_file(filename): + """Mesa looks for a git_sha1.h file at compile time in order to display + the current git hash id in the GL_VERSION string. This function tries + to retrieve the git hashid and write the header file. An empty file + will be created if anything goes wrong.""" + + args = [ 'git', 'log', '-n', '1', '--oneline' ] + try: + (commit, foo) = subprocess.Popen(args, stdout=subprocess.PIPE).communicate() + except: + # git log command didn't work + if not os.path.exists(filename): + # create an empty file if none already exists + f = open(filename, "w") + f.close() + return + + commit = '#define MESA_GIT_SHA1 "git-%s"\n' % commit[0:7] + tempfile = "git_sha1.h.tmp" + f = open(tempfile, "w") + f.write(commit) f.close() + if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename): + # The filename does not exist or it's different from the new file, + # so replace old file with new. + if os.path.exists(filename): + os.remove(filename) + os.rename(tempfile, filename) + return + + +# Create the git_sha1.h header file +write_git_sha1_h_file("main/git_sha1.h") # and update CPPPATH so the git_sha1.h header can be found env.Append(CPPPATH = ["#" + env['build_dir'] + "/mesa/main"]) diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index b20063c33..2532c47de 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -627,6 +627,7 @@ _mesa_init_constants(struct gl_context *ctx) /* Shading language version */ if (ctx->API == API_OPENGL) { ctx->Const.GLSLVersion = 120; + _mesa_override_glsl_version(ctx); } else if (ctx->API == API_OPENGLES2) { ctx->Const.GLSLVersion = 100; diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 74997eaaa..3ce14d154 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -137,6 +137,7 @@ _mesa_sizeof_glsl_type(GLenum type) switch (type) { case GL_FLOAT: case GL_INT: + case GL_UNSIGNED_INT: case GL_BOOL: case GL_SAMPLER_1D: case GL_SAMPLER_2D: diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index a5deeabd2..c49731747 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -44,7 +44,7 @@ override_version(struct gl_context *ctx, GLuint *major, GLuint *minor) return; } - n = sscanf(version, "%d.%d", major, minor); + n = sscanf(version, "%u.%u", major, minor); if (n != 2) { fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version); return; @@ -52,6 +52,30 @@ override_version(struct gl_context *ctx, GLuint *major, GLuint *minor) } /** + * Override the context's GLSL version if the environment variable + * MESA_GLSL_VERSION_OVERRIDE is set. Valid values for + * MESA_GLSL_VERSION_OVERRIDE are integers, such as "130". + */ +void +_mesa_override_glsl_version(struct gl_context *ctx) +{ + const char *env_var = "MESA_GLSL_VERSION_OVERRIDE"; + const char *version; + int n; + + version = getenv(env_var); + if (!version) { + return; + } + + n = sscanf(version, "%u", &ctx->Const.GLSLVersion); + if (n != 1) { + fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version); + return; + } +} + +/** * Examine enabled GL extensions to determine GL version. * Return major and minor version numbers. */ diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index 0a0512c33..32e141f0e 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -56,5 +56,7 @@ struct gl_context; extern void _mesa_compute_version(struct gl_context *ctx); +extern void +_mesa_override_glsl_version(struct gl_context *ctx); #endif /* VERSION_H */ diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 7b2c69fdb..c5b71b3f0 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -1456,14 +1456,22 @@ ir_to_mesa_visitor::visit(ir_expression *ir) emit_scalar(ir, OPCODE_POW, result_dst, op[0], op[1]); break; - case ir_unop_bit_not: + /* GLSL 1.30 integer ops are unsupported in Mesa IR, but since + * hardware backends have no way to avoid Mesa IR generation + * even if they don't use it, we need to emit "something" and + * continue. + */ case ir_binop_lshift: case ir_binop_rshift: case ir_binop_bit_and: case ir_binop_bit_xor: case ir_binop_bit_or: + emit(ir, OPCODE_ADD, result_dst, op[0], op[1]); + break; + + case ir_unop_bit_not: case ir_unop_round_even: - assert(!"GLSL 1.30 features unsupported"); + emit(ir, OPCODE_MOV, result_dst, op[0]); break; case ir_quadop_vector: diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 354e58de9..8df753f7c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -1707,7 +1707,7 @@ st_finalize_texture(struct gl_context *ctx, firstImage->base.Width2, firstImage->base.Height2, firstImage->base.Depth2, - stObj->base.BaseLevel, + firstImage->base.Level, &width, &height, &depth)) { width = stObj->width0; height = stObj->height0; diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c index 39a947df7..574802084 100644 --- a/mesalib/src/mesa/state_tracker/st_draw.c +++ b/mesalib/src/mesa/state_tracker/st_draw.c @@ -267,8 +267,8 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, /** - * This is very similar to vbo_all_varyings_in_vbos() but we test - * the stride. See bug 38626. + * This is very similar to vbo_all_varyings_in_vbos() but we are + * only interested in per-vertex data. See bug 38626. */ static GLboolean all_varyings_in_vbos(const struct gl_client_array *arrays[]) @@ -276,7 +276,9 @@ all_varyings_in_vbos(const struct gl_client_array *arrays[]) GLuint i; for (i = 0; i < VERT_ATTRIB_MAX; i++) - if (arrays[i]->StrideB && !_mesa_is_bufferobj(arrays[i]->BufferObj)) + if (arrays[i]->StrideB && + !arrays[i]->InstanceDivisor && + !_mesa_is_bufferobj(arrays[i]->BufferObj)) return GL_FALSE; return GL_TRUE; diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index ef284ad70..e6572c85a 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -30,6 +30,7 @@ #include "main/context.h" #include "main/macros.h" #include "main/mfeatures.h" +#include "main/version.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -216,6 +217,7 @@ void st_init_limits(struct st_context *st) c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET); c->GLSLVersion = 120; + _mesa_override_glsl_version(st->ctx); c->UniformBooleanTrue = ~0; } } |