From 0fa1692f14f4a64b045bc3f26a5ab401d682b118 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 11 Sep 2009 08:04:37 -0600 Subject: [PATCH 1/7] mesa: raise GL_INVALID_ENUM not GL_INVALID_VALUE for glTexParamter errors Signed-off-by: Brian Paul --- src/mesa/main/texparam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index e60ab6aa123..35c3c920e70 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -69,7 +69,7 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) return GL_TRUE; } - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", wrap ); + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", wrap ); return GL_FALSE; } @@ -209,7 +209,7 @@ set_tex_parameteri(GLcontext *ctx, } /* fall-through */ default: - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", params[0] ); } return GL_FALSE; @@ -224,7 +224,7 @@ set_tex_parameteri(GLcontext *ctx, texObj->MagFilter = params[0]; return GL_TRUE; default: - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", params[0]); } return GL_FALSE; From 9c8b69302c2509d9ec8d6f87b7d1c34b6e215227 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 12 Sep 2009 09:27:01 -0700 Subject: [PATCH 2/7] Use CFLAGS as HOST_CFLAGS by default Unless we're cross compiling, the HOST_CFLAGS should be the same as the normal CFLAGS. This allows the x86 and x86_64 asm to be built correctly with a native compiler using -m32/-m64. Signed-off-by: Dan Nicholson --- configs/default | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/default b/configs/default index 773a6204d3a..7547703c560 100644 --- a/configs/default +++ b/configs/default @@ -23,6 +23,7 @@ HOST_CC = $(CC) CFLAGS = -O CXXFLAGS = -O LDFLAGS = +HOST_CFLAGS = $(CFLAGS) GLU_CFLAGS = # Compiler for building demos/tests/etc From 1402ea8f3984e5d8659ff2d923d438ecbf79042e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 14 Sep 2009 11:48:51 -0600 Subject: [PATCH 3/7] configure: fix comment --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 63cc27eec91..fe54dd5753b 100644 --- a/configure.ac +++ b/configure.ac @@ -1188,7 +1188,7 @@ if test "x$enable_gallium_radeon" = xyes; then fi dnl -dnl Gallium Radeon configuration +dnl Gallium Nouveau configuration dnl AC_ARG_ENABLE([gallium-nouveau], [AS_HELP_STRING([--enable-gallium-nouveau], From b8b774c775b672c89f1f4007c7b9575052d85739 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 17:24:25 -0600 Subject: [PATCH 4/7] glsl: remove extra #version directives from concatenated shader sources When we concatenate shaders to do our form of poor-man linking, if there's multiple #version directives, preprocessing fails. This change disables the extra #version directives by changing the first two chars to //. This should help with some Wine issues such as bug 23946. --- src/mesa/shader/slang/slang_link.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 387659ff300..3617ce1fb65 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -540,6 +540,32 @@ _slang_update_inputs_outputs(struct gl_program *prog) +/** + * Remove extra #version directives from the concatenated source string. + * Disable the extra ones by converting first two chars to //, a comment. + * This is a bit of hack to work around a preprocessor bug that only + * allows one #version directive per source. + */ +static void +remove_extra_version_directives(GLchar *source) +{ + GLuint verCount = 0; + while (1) { + char *ver = _mesa_strstr(source, "#version"); + if (ver) { + verCount++; + if (verCount > 1) { + ver[0] = '/'; + ver[1] = '/'; + } + source += 8; + } + else { + break; + } + } +} + /** @@ -587,6 +613,8 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); */ + remove_extra_version_directives(source); + newShader = CALLOC_STRUCT(gl_shader); newShader->Type = shaderType; newShader->Source = source; From 3129b2403e8430304c054611eebe709ed8b2ed97 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 17:27:47 -0600 Subject: [PATCH 5/7] docs: document linker/preprocessor bug fix --- docs/relnotes-7.5.2.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/relnotes-7.5.2.html b/docs/relnotes-7.5.2.html index 32100142c0c..ecdab29d5f7 100644 --- a/docs/relnotes-7.5.2.html +++ b/docs/relnotes-7.5.2.html @@ -45,6 +45,8 @@ tbd
  • Assorted bug fixes for i965/i945 drivers
  • Fixed Gallium glDrawPixels(GL_STENCIL_INDEX) failure. +
  • Fixed GLSL linker/preprocessor version directive issue seen in Wine + (such as bug 23946)
From ac3c8e3b53564b659e2ccaf8274b888f1e254511 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 17:32:03 -0600 Subject: [PATCH 6/7] glsl: added some link debug code (disabled) --- src/mesa/shader/shader_api.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index c36fc271a00..4d5d1bef3df 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1471,6 +1471,21 @@ _mesa_link_program(GLcontext *ctx, GLuint program) FLUSH_VERTICES(ctx, _NEW_PROGRAM); _slang_link(ctx, program, shProg); + + /* debug code */ + if (0) { + GLuint i; + + _mesa_printf("Link %u shaders in program %u: %s\n", + shProg->NumShaders, shProg->Name, + shProg->LinkStatus ? "Success" : "Failed"); + + for (i = 0; i < shProg->NumShaders; i++) { + _mesa_printf(" shader %u, type 0x%x\n", + shProg->Shaders[i]->Name, + shProg->Shaders[i]->Type); + } + } } From 799631acb18be93afab29e27241cde3780672e98 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 17:48:17 -0600 Subject: [PATCH 7/7] progs/vp: print program and error info when program does not compile --- progs/vp/vp-tris.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index 97995accdd1..1356242d971 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -119,6 +119,12 @@ static void Init( void ) glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, sz, (const GLubyte *) buf); + if (glGetError()) { + printf("Program failed to compile:\n%s\n", buf); + printf("Error: %s\n", + (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + exit(1); + } assert(glIsProgramARB(prognum)); }