D'oh! I didn't mean to push this yet. I had a git mishap. Ian, if you find any issues with this patch while testing, feel free to revert it. I'm heading to the airport in a few hours..
-Brian ________________________________________ From: mesa-commit-boun...@lists.freedesktop.org [mesa-commit-boun...@lists.freedesktop.org] On Behalf Of Brian Paul [bri...@kemper.freedesktop.org] Sent: Friday, December 18, 2009 2:03 PM To: mesa-com...@lists.freedesktop.org Subject: Mesa (mesa_7_6_branch): glsl: clear out shader code before compiling Module: Mesa Branch: mesa_7_6_branch Commit: 0478b745fe72360ce91988636b54f6e4834c1fae URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0478b745fe72360ce91988636b54f6e4834c1fae Author: Brian Paul <bri...@vmware.com> Date: Fri Dec 18 11:57:15 2009 -0700 glsl: clear out shader code before compiling When we start compiling a shader, first free the existing gl_program. This (mostly) fixes the piglit glsl-reload-source test. Without this change, we were actually appending the new GPU code onto the previous program. --- src/mesa/shader/slang/slang_compile.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index c1b97c7..95c44e3 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2738,6 +2738,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) slang_info_log info_log; slang_code_object obj; slang_unit_type type; + GLenum progTarget; if (shader->Type == GL_VERTEX_SHADER) { type = SLANG_UNIT_VERTEX_SHADER; @@ -2754,17 +2755,18 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) shader->Main = GL_FALSE; - if (!shader->Program) { - GLenum progTarget; - if (shader->Type == GL_VERTEX_SHADER) - progTarget = GL_VERTEX_PROGRAM_ARB; - else - progTarget = GL_FRAGMENT_PROGRAM_ARB; - shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); - shader->Program->Parameters = _mesa_new_parameter_list(); - shader->Program->Varying = _mesa_new_parameter_list(); - shader->Program->Attributes = _mesa_new_parameter_list(); - } + /* free the shader's old instructions, etc */ + _mesa_reference_program(ctx, &shader->Program, NULL); + + /* allocate new GPU program, parameter lists, etc. */ + if (shader->Type == GL_VERTEX_SHADER) + progTarget = GL_VERTEX_PROGRAM_ARB; + else + progTarget = GL_FRAGMENT_PROGRAM_ARB; + shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); + shader->Program->Parameters = _mesa_new_parameter_list(); + shader->Program->Varying = _mesa_new_parameter_list(); + shader->Program->Attributes = _mesa_new_parameter_list(); slang_info_log_construct(&info_log); _slang_code_object_ctr(&obj); _______________________________________________ mesa-commit mailing list mesa-com...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev