aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/xwininfo/dsimple.c4
-rw-r--r--apps/xwininfo/dsimple.h4
-rw-r--r--libXft/src/xftdpy.c8
-rw-r--r--libXft/src/xftfreetype.c2
-rw-r--r--libXft/src/xftinit.c2
-rw-r--r--libXft/src/xftint.h2
-rw-r--r--mesalib/configure.ac8
-rw-r--r--mesalib/docs/envvars.html4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_dump_state.c1
-rw-r--r--mesalib/src/glsl/ir_constant_expression.cpp6
-rw-r--r--mesalib/src/mesa/SConscript43
-rw-r--r--mesalib/src/mesa/main/context.c1
-rw-r--r--mesalib/src/mesa/main/shaderapi.c1
-rw-r--r--mesalib/src/mesa/main/version.c26
-rw-r--r--mesalib/src/mesa/main/version.h2
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp12
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c2
19 files changed, 109 insertions, 29 deletions
diff --git a/apps/xwininfo/dsimple.c b/apps/xwininfo/dsimple.c
index 8a5d7cbeb..23b81848a 100644
--- a/apps/xwininfo/dsimple.c
+++ b/apps/xwininfo/dsimple.c
@@ -76,7 +76,7 @@ from The Open Group.
/* This stuff is defined in the calling program by dsimple.h */
-char *program_name = "unknown_program";
+const char *program_name = "unknown_program";
/*
* Get_Display_Name (argc, argv) - return string representing display name
@@ -404,7 +404,7 @@ Window_With_Name (
/*
* Standard fatal error routine - call like printf
*/
-void Fatal_Error (char *msg, ...)
+void Fatal_Error (const char *msg, ...)
{
va_list args;
fflush (stdout);
diff --git a/apps/xwininfo/dsimple.h b/apps/xwininfo/dsimple.h
index d5aff6cfe..d0dd71ae9 100644
--- a/apps/xwininfo/dsimple.h
+++ b/apps/xwininfo/dsimple.h
@@ -44,7 +44,7 @@ typedef int Bool;
#define True 1
/* Global variables used by routines in dsimple.c */
-extern char *program_name; /* Name of this program */
+extern const char *program_name; /* Name of this program */
/* Declarations for functions in dsimple.c */
@@ -55,7 +55,7 @@ void Setup_Display_And_Screen (const char *displayname,
xcb_window_t Select_Window (xcb_connection_t *, const xcb_screen_t *, int);
xcb_window_t Window_With_Name (xcb_connection_t *, xcb_window_t, const char *);
-void Fatal_Error (char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1, 2);
+void Fatal_Error (const char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1, 2);
void Print_X_Error (xcb_connection_t *, xcb_generic_error_t *);
diff --git a/libXft/src/xftdpy.c b/libXft/src/xftdpy.c
index 747b8db81..8f453b30d 100644
--- a/libXft/src/xftdpy.c
+++ b/libXft/src/xftdpy.c
@@ -282,7 +282,7 @@ XftDefaultSet (Display *dpy, FcPattern *defaults)
}
_X_HIDDEN int
-XftDefaultParseBool (char *v)
+XftDefaultParseBool (const char *v)
{
char c0, c1;
@@ -307,7 +307,7 @@ XftDefaultParseBool (char *v)
}
static Bool
-_XftDefaultInitBool (Display *dpy, FcPattern *pat, char *option)
+_XftDefaultInitBool (Display *dpy, FcPattern *pat, const char *option)
{
char *v;
int i;
@@ -319,7 +319,7 @@ _XftDefaultInitBool (Display *dpy, FcPattern *pat, char *option)
}
static Bool
-_XftDefaultInitDouble (Display *dpy, FcPattern *pat, char *option)
+_XftDefaultInitDouble (Display *dpy, FcPattern *pat, const char *option)
{
char *v, *e;
double d;
@@ -335,7 +335,7 @@ _XftDefaultInitDouble (Display *dpy, FcPattern *pat, char *option)
}
static Bool
-_XftDefaultInitInteger (Display *dpy, FcPattern *pat, char *option)
+_XftDefaultInitInteger (Display *dpy, FcPattern *pat, const char *option)
{
char *v, *e;
int i;
diff --git a/libXft/src/xftfreetype.c b/libXft/src/xftfreetype.c
index 3d930be78..3f8dfef8c 100644
--- a/libXft/src/xftfreetype.c
+++ b/libXft/src/xftfreetype.c
@@ -164,7 +164,7 @@ _XftLockFile (XftFtFile *f)
}
static void
-_XftLockError (char *reason)
+_XftLockError (const char *reason)
{
fprintf (stderr, "Xft: locking error %s\n", reason);
}
diff --git a/libXft/src/xftinit.c b/libXft/src/xftinit.c
index 0205e4b36..ff2372297 100644
--- a/libXft/src/xftinit.c
+++ b/libXft/src/xftinit.c
@@ -43,7 +43,7 @@ XftGetVersion (void)
}
static struct {
- char *name;
+ const char *name;
int alloc_count;
int alloc_mem;
int free_count;
diff --git a/libXft/src/xftint.h b/libXft/src/xftint.h
index 43f9ebec9..eb9257ea7 100644
--- a/libXft/src/xftint.h
+++ b/libXft/src/xftint.h
@@ -376,7 +376,7 @@ void
_XftDisplayManageMemory (Display *dpy);
int
-XftDefaultParseBool (char *v);
+XftDefaultParseBool (const char *v);
FcBool
XftDefaultGetBool (Display *dpy, const char *object, int screen, FcBool def);
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 3b5a78d1b..738b5cb61 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;
}
}