From 796c96de808790826d9c9077d159390ebee62888 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Fri, 11 Sep 2009 01:28:34 +0300 Subject: radeon: Remove structure allocation from iterator variable. dma_bo varaible is only used for iterating so allocating memory for it only causes memory leaks. --- src/mesa/drivers/dri/radeon/radeon_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 2eefa3f2b1b..c9a32c808be 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -263,7 +263,7 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa, void radeonFreeDmaRegions(radeonContextPtr rmesa) { - struct radeon_dma_bo *dma_bo = CALLOC_STRUCT(radeon_dma_bo); + struct radeon_dma_bo *dma_bo; struct radeon_dma_bo *temp; if (RADEON_DEBUG & RADEON_DMA) fprintf(stderr, "%s\n", __FUNCTION__); -- cgit v1.2.3 From 0fa1692f14f4a64b045bc3f26a5ab401d682b118 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 11 Sep 2009 08:04:37 -0600 Subject: 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(-) (limited to 'src/mesa') 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; -- cgit v1.2.3 From b8b774c775b672c89f1f4007c7b9575052d85739 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 17:24:25 -0600 Subject: 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(+) (limited to 'src/mesa') 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; -- cgit v1.2.3 From ac3c8e3b53564b659e2ccaf8274b888f1e254511 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 17:32:03 -0600 Subject: glsl: added some link debug code (disabled) --- src/mesa/shader/shader_api.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mesa') 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); + } + } } -- cgit v1.2.3