aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-07-28 18:15:53 +0000
committermarha <marha@users.sourceforge.net>2010-07-28 18:15:53 +0000
commit022d9c6cf6a67385d84ff33ce095f5c7f9f6d0cc (patch)
tree1c6bef40b9b16775f2d9b39f88d6224e0bea69ff /mesalib/src/mesa
parent51e3b8e993cc874f4ac4ba4162c7aea00fe1a8eb (diff)
downloadvcxsrv-022d9c6cf6a67385d84ff33ce095f5c7f9f6d0cc.tar.gz
vcxsrv-022d9c6cf6a67385d84ff33ce095f5c7f9f6d0cc.tar.bz2
vcxsrv-022d9c6cf6a67385d84ff33ce095f5c7f9f6d0cc.zip
Update to mesa 7,8,2
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c36
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c2
-rw-r--r--mesalib/src/mesa/glapi/glapi_nop.c20
-rw-r--r--mesalib/src/mesa/main/fbobject.c6
-rw-r--r--mesalib/src/mesa/main/imports.c3
-rw-r--r--mesalib/src/mesa/main/imports.h6
-rw-r--r--mesalib/src/mesa/main/texenvprogram.c43
-rw-r--r--mesalib/src/mesa/main/texfetch_tmp.h16
-rw-r--r--mesalib/src/mesa/main/version.h4
-rw-r--r--mesalib/src/mesa/shader/program.c4
-rw-r--r--mesalib/src/mesa/shader/shader_api.c79
-rw-r--r--mesalib/src/mesa/shader/slang/slang_codegen.c3
-rw-r--r--mesalib/src/mesa/shader/slang/slang_compile_variable.h2
-rw-r--r--mesalib/src/mesa/shader/slang/slang_link.c5
14 files changed, 158 insertions, 71 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index b97b760f1..89ca476f9 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -424,6 +424,7 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_SCISSOR) {
save->Scissor = ctx->Scissor; /* struct copy */
+ _mesa_set_enable(ctx, GL_SCISSOR_TEST, GL_FALSE);
}
if (state & META_SHADER) {
@@ -812,6 +813,21 @@ _mesa_meta_end(GLcontext *ctx)
/**
+ * Convert Z from a normalized value in the range [0, 1] to an object-space
+ * Z coordinate in [-1, +1] so that drawing at the new Z position with the
+ * default/identity ortho projection results in the original Z value.
+ * Used by the meta-Clear, Draw/CopyPixels and Bitmap functions where the Z
+ * value comes from the clear value or raster position.
+ */
+static INLINE GLfloat
+invert_z(GLfloat normZ)
+{
+ GLfloat objZ = 1.0 - 2.0 * normZ;
+ return objZ;
+}
+
+
+/**
* One-time init for a temp_texture object.
* Choose tex target, compute max tex size, etc.
*/
@@ -1112,8 +1128,10 @@ blitframebuffer_texture(GLcontext *ctx,
_mesa_BindTexture(target, texObj->Name);
_mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter);
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
+ if (target != GL_TEXTURE_RECTANGLE_ARB) {
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
+ }
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@@ -1171,8 +1189,10 @@ blitframebuffer_texture(GLcontext *ctx,
*/
_mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
+ if (target != GL_TEXTURE_RECTANGLE_ARB) {
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
+ }
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave);
@@ -1428,7 +1448,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin;
const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax;
const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax;
- const GLfloat z = 1.0 - 2.0 * ctx->Depth.Clear;
+ const GLfloat z = invert_z(ctx->Depth.Clear);
GLuint i;
verts[0].x = x0;
@@ -1534,7 +1554,7 @@ _mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY,
const GLfloat dstY0 = (GLfloat) dstY;
const GLfloat dstX1 = dstX + width * ctx->Pixel.ZoomX;
const GLfloat dstY1 = dstY + height * ctx->Pixel.ZoomY;
- const GLfloat z = ctx->Current.RasterPos[2];
+ const GLfloat z = invert_z(ctx->Current.RasterPos[2]);
verts[0].x = dstX0;
verts[0].y = dstY0;
@@ -1823,7 +1843,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
const GLfloat y0 = (GLfloat) y;
const GLfloat x1 = x + width * ctx->Pixel.ZoomX;
const GLfloat y1 = y + height * ctx->Pixel.ZoomY;
- const GLfloat z = ctx->Current.RasterPos[2];
+ const GLfloat z = invert_z(ctx->Current.RasterPos[2]);
verts[0].x = x0;
verts[0].y = y0;
@@ -2026,7 +2046,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
const GLfloat y0 = (GLfloat) y;
const GLfloat x1 = (GLfloat) (x + width);
const GLfloat y1 = (GLfloat) (y + height);
- const GLfloat z = ctx->Current.RasterPos[2];
+ const GLfloat z = invert_z(ctx->Current.RasterPos[2]);
GLuint i;
verts[0].x = x0;
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index 477259ea7..a6d6c999a 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -65,7 +65,7 @@ extern char *program_invocation_name, *program_invocation_short_name;
#endif
#if !defined(GET_PROGRAM_NAME)
-# if defined(OpenBSD) || defined(NetBSD) || defined(__UCLIBC__)
+# if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__)
/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU.
* Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's
* used as a last resort, if there is no documented facility available. */
diff --git a/mesalib/src/mesa/glapi/glapi_nop.c b/mesalib/src/mesa/glapi/glapi_nop.c
index df9c58728..4257b1fbc 100644
--- a/mesalib/src/mesa/glapi/glapi_nop.c
+++ b/mesalib/src/mesa/glapi/glapi_nop.c
@@ -48,6 +48,26 @@
#include "glapi/glapi.h"
+
+/*
+ * These stubs are kept so that the old DRI drivers still load.
+ */
+PUBLIC void
+_glapi_noop_enable_warnings(GLboolean enable);
+
+PUBLIC void
+_glapi_set_warning_func(_glapi_proc func);
+
+void
+_glapi_noop_enable_warnings(GLboolean enable)
+{
+}
+
+void
+_glapi_set_warning_func(_glapi_proc func)
+{
+}
+
#ifdef DEBUG
/**
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 14c533e0d..cc20f7479 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1766,10 +1766,10 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
rb = NULL;
}
- if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+ if (attachment == GL_DEPTH_STENCIL_ATTACHMENT &&
+ rb && rb->Format != MESA_FORMAT_NONE) {
/* make sure the renderbuffer is a depth/stencil format */
- const GLenum baseFormat =
- _mesa_get_format_base_format(att->Renderbuffer->Format);
+ const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
if (baseFormat != GL_DEPTH_STENCIL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferRenderbufferEXT(renderbuffer"
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c
index 1ae085336..b1389b25f 100644
--- a/mesalib/src/mesa/main/imports.c
+++ b/mesalib/src/mesa/main/imports.c
@@ -564,7 +564,8 @@ _mesa_ffsll(int64_t val)
unsigned int
_mesa_bitcount(unsigned int n)
{
-#if defined(__GNUC__)
+#if defined(__GNUC__) && \
+ ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
return __builtin_popcount(n);
#else
unsigned int bits;
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index d28f4ad12..1c263aabc 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -404,7 +404,8 @@ _mesa_is_pow_two(int x)
static INLINE int32_t
_mesa_next_pow_two_32(uint32_t x)
{
-#ifdef __GNUC__
+#if defined(__GNUC__) && \
+ ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
uint32_t y = (x != 1);
return (1 + y) << ((__builtin_clz(x - y) ^ 31) );
#else
@@ -422,7 +423,8 @@ _mesa_next_pow_two_32(uint32_t x)
static INLINE int64_t
_mesa_next_pow_two_64(uint64_t x)
{
-#ifdef __GNUC__
+#if defined(__GNUC__) && \
+ ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
uint64_t y = (x != 1);
if (sizeof(x) == sizeof(long))
return (1 + y) << ((__builtin_clzl(x - y) ^ 63));
diff --git a/mesalib/src/mesa/main/texenvprogram.c b/mesalib/src/mesa/main/texenvprogram.c
index 7b8a8b85f..964ba13c7 100644
--- a/mesalib/src/mesa/main/texenvprogram.c
+++ b/mesalib/src/mesa/main/texenvprogram.c
@@ -1415,6 +1415,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
struct texenv_fragment_program p;
GLuint unit;
struct ureg cf, out;
+ int i;
memset(&p, 0, sizeof(p));
p.state = key;
@@ -1436,7 +1437,13 @@ create_new_program(GLcontext *ctx, struct state_key *key,
p.program->Base.NumAddressRegs = 0;
p.program->Base.Parameters = _mesa_new_parameter_list();
p.program->Base.InputsRead = 0x0;
- p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
+
+ if (ctx->DrawBuffer->_NumColorDrawBuffers == 1)
+ p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
+ else {
+ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++)
+ p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i));
+ }
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
p.src_texture[unit] = undef;
@@ -1485,22 +1492,28 @@ create_new_program(GLcontext *ctx, struct state_key *key,
}
cf = get_source( &p, SRC_PREVIOUS, 0 );
- out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
- if (key->separate_specular) {
- /* Emit specular add.
- */
- struct ureg s = register_input(&p, FRAG_ATTRIB_COL1);
- emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
- emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
- }
- else if (memcmp(&cf, &out, sizeof(cf)) != 0) {
- /* Will wind up in here if no texture enabled or a couple of
- * other scenarios (GL_REPLACE for instance).
- */
- emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef );
- }
+ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
+ if (ctx->DrawBuffer->_NumColorDrawBuffers == 1)
+ out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
+ else {
+ out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i );
+ }
+ if (key->separate_specular) {
+ /* Emit specular add.
+ */
+ struct ureg s = register_input(&p, FRAG_ATTRIB_COL1);
+ emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
+ emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
+ }
+ else if (memcmp(&cf, &out, sizeof(cf)) != 0) {
+ /* Will wind up in here if no texture enabled or a couple of
+ * other scenarios (GL_REPLACE for instance).
+ */
+ emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef );
+ }
+ }
/* Finish up:
*/
emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef);
diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h
index e6772c89f..b11ed5c39 100644
--- a/mesalib/src/mesa/main/texfetch_tmp.h
+++ b/mesalib/src/mesa/main/texfetch_tmp.h
@@ -1215,10 +1215,10 @@ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) );
- texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
- texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff );
- texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff );
+ texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
+ texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) );
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
}
#if DIM == 3
@@ -1235,10 +1235,10 @@ static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff );
- texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff );
- texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
- texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) );
+ texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
+ texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) );
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
}
#if DIM == 3
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index cd760beba..9955be24a 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -34,8 +34,8 @@
/* Mesa version */
#define MESA_MAJOR 7
#define MESA_MINOR 8
-#define MESA_PATCH 1
-#define MESA_VERSION_STRING "7.8.1"
+#define MESA_PATCH 2
+#define MESA_VERSION_STRING "7.8.2"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/mesalib/src/mesa/shader/program.c b/mesalib/src/mesa/shader/program.c
index f4f701b54..f77a77375 100644
--- a/mesalib/src/mesa/shader/program.c
+++ b/mesalib/src/mesa/shader/program.c
@@ -625,7 +625,7 @@ replace_registers(struct prog_instruction *inst, GLuint numInst,
GLuint i, j;
for (i = 0; i < numInst; i++) {
/* src regs */
- for (j = 0; j < _mesa_num_inst_src_regs(inst->Opcode); j++) {
+ for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
if (inst[i].SrcReg[j].File == oldFile &&
inst[i].SrcReg[j].Index == oldIndex) {
inst[i].SrcReg[j].File = newFile;
@@ -652,7 +652,7 @@ adjust_param_indexes(struct prog_instruction *inst, GLuint numInst,
{
GLuint i, j;
for (i = 0; i < numInst; i++) {
- for (j = 0; j < _mesa_num_inst_src_regs(inst->Opcode); j++) {
+ for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
GLuint f = inst[i].SrcReg[j].File;
if (f == PROGRAM_CONSTANT ||
f == PROGRAM_UNIFORM ||
diff --git a/mesalib/src/mesa/shader/shader_api.c b/mesalib/src/mesa/shader/shader_api.c
index 940fe2d03..5e87bb405 100644
--- a/mesalib/src/mesa/shader/shader_api.c
+++ b/mesalib/src/mesa/shader/shader_api.c
@@ -1260,6 +1260,54 @@ lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location,
/**
+ * GLGL uniform arrays and structs require special handling.
+ *
+ * The GL_ARB_shader_objects spec says that if you use
+ * glGetUniformLocation to get the location of an array, you CANNOT
+ * access other elements of the array by adding an offset to the
+ * returned location. For example, you must call
+ * glGetUniformLocation("foo[16]") if you want to set the 16th element
+ * of the array with glUniform().
+ *
+ * HOWEVER, some other OpenGL drivers allow accessing array elements
+ * by adding an offset to the returned array location. And some apps
+ * seem to depend on that behaviour.
+ *
+ * Mesa's gl_uniform_list doesn't directly support this since each
+ * entry in the list describes one uniform variable, not one uniform
+ * element. We could insert dummy entries in the list for each array
+ * element after [0] but that causes complications elsewhere.
+ *
+ * We solve this problem by encoding two values in the location that's
+ * returned by glGetUniformLocation():
+ * a) index into gl_uniform_list::Uniforms[] for the uniform
+ * b) an array/field offset (0 for simple types)
+ *
+ * These two values are encoded in the high and low halves of a GLint.
+ * By putting the uniform number in the high part and the offset in the
+ * low part, we can support the unofficial ability to index into arrays
+ * by adding offsets to the location value.
+ */
+static void
+merge_location_offset(GLint *location, GLint offset)
+{
+ *location = (*location << 16) | offset;
+}
+
+
+/**
+ * Seperate the uniform location and parameter offset. See above.
+ */
+static void
+split_location_offset(GLint *location, GLint *offset)
+{
+ *offset = *location & 0xffff;
+ *location = *location >> 16;
+}
+
+
+
+/**
* Called via ctx->Driver.GetUniformfv().
*/
static void
@@ -1268,6 +1316,9 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
{
struct gl_program *prog;
GLint paramPos;
+ GLint offset;
+
+ split_location_offset(&location, &offset);
lookup_uniform_parameter(ctx, program, location, &prog, &paramPos);
@@ -1298,7 +1349,10 @@ _mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location,
{
struct gl_program *prog;
GLint paramPos;
+ GLint offset;
+ split_location_offset(&location, &offset);
+
lookup_uniform_parameter(ctx, program, location, &prog, &paramPos);
if (prog) {
@@ -1319,31 +1373,6 @@ _mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location,
/**
- * The value returned by GetUniformLocation actually encodes two things:
- * 1. the index into the prog->Uniforms[] array for the uniform
- * 2. an offset in the prog->ParameterValues[] array for specifying array
- * elements or structure fields.
- * This function merges those two values.
- */
-static void
-merge_location_offset(GLint *location, GLint offset)
-{
- *location = *location | (offset << 16);
-}
-
-
-/**
- * Seperate the uniform location and parameter offset. See above.
- */
-static void
-split_location_offset(GLint *location, GLint *offset)
-{
- *offset = (*location >> 16);
- *location = *location & 0xffff;
-}
-
-
-/**
* Called via ctx->Driver.GetUniformLocation().
*
* The return value will encode two values, the uniform location and an
diff --git a/mesalib/src/mesa/shader/slang/slang_codegen.c b/mesalib/src/mesa/shader/slang/slang_codegen.c
index ecb2f6d5c..7d5e5eb29 100644
--- a/mesalib/src/mesa/shader/slang/slang_codegen.c
+++ b/mesalib/src/mesa/shader/slang/slang_codegen.c
@@ -4187,11 +4187,10 @@ _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper)
slang_atom name = oper->var ? oper->var->a_name : oper->a_id;
slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE);
slang_ir_node *n;
- if (!var) {
+ if (!var || !var->declared) {
slang_info_log_error(A->log, "undefined variable '%s'", (char *) name);
return NULL;
}
- assert(var->declared);
n = new_var(A, var);
return n;
}
diff --git a/mesalib/src/mesa/shader/slang/slang_compile_variable.h b/mesalib/src/mesa/shader/slang/slang_compile_variable.h
index b4585599f..5c9d248b3 100644
--- a/mesalib/src/mesa/shader/slang/slang_compile_variable.h
+++ b/mesalib/src/mesa/shader/slang/slang_compile_variable.h
@@ -41,7 +41,7 @@ typedef struct slang_variable_
GLuint size; /**< Variable's size in bytes */
GLboolean is_global;
GLboolean isTemp; /**< a named temporary (__resultTmp) */
- GLboolean declared; /**< for debug */
+ GLboolean declared; /**< has the var been declared? */
struct slang_ir_storage_ *store; /**< Storage for this var */
} slang_variable;
diff --git a/mesalib/src/mesa/shader/slang/slang_link.c b/mesalib/src/mesa/shader/slang/slang_link.c
index 7c7bfbdbc..e8dca0142 100644
--- a/mesalib/src/mesa/shader/slang/slang_link.c
+++ b/mesalib/src/mesa/shader/slang/slang_link.c
@@ -921,7 +921,10 @@ _slang_link(GLcontext *ctx,
if (!vertNotify || !fragNotify) {
/* driver rejected one/both of the vertex/fragment programs */
- link_error(shProg, "Vertex and/or fragment program rejected by driver\n");
+ if (!shProg->InfoLog) {
+ link_error(shProg,
+ "Vertex and/or fragment program rejected by driver\n");
+ }
}
else {
shProg->LinkStatus = (shProg->VertexProgram || shProg->FragmentProgram);