From 1a3de23509b8170ee87223dc63e992e195a04de5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 16:59:55 -0700 Subject: [PATCH] i965: Fix up and actually enable the NewShader and NewShaderProgram hooks. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 9 ++++++--- src/mesa/drivers/dri/i965/brw_program.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 11c79b11bfc..4a313a2e100 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -81,9 +81,9 @@ brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) struct brw_shader *shader; shader = talloc_zero(NULL, struct brw_shader); - shader->base.Type = type; - shader->base.Name = name; if (shader) { + shader->base.Type = type; + shader->base.Name = name; _mesa_init_shader(ctx, &shader->base); } @@ -96,6 +96,7 @@ brw_new_shader_program(GLcontext *ctx, GLuint name) struct brw_shader_program *prog; prog = talloc_zero(NULL, struct brw_shader_program); if (prog) { + prog->base.Name = name; _mesa_init_shader_program(ctx, &prog->base); } return &prog->base; @@ -123,6 +124,8 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) void *mem_ctx = talloc_new(NULL); bool progress; + if (shader->ir) + talloc_free(shader->ir); shader->ir = new(shader) exec_list; clone_ir_list(mem_ctx, shader->ir, shader->base.ir); @@ -140,7 +143,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) progress = do_common_optimization(shader->ir, true) || progress; } while (progress); - reparent_ir(shader->ir, shader); + reparent_ir(shader->ir, shader->ir); talloc_free(mem_ctx); } } diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index b6cf6c000eb..bc152204a42 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -232,6 +232,8 @@ void brwInitFragProgFuncs( struct dd_function_table *functions ) functions->IsProgramNative = brwIsProgramNative; functions->ProgramStringNotify = brwProgramStringNotify; + functions->NewShader = brw_new_shader; + functions->NewShaderProgram = brw_new_shader_program; functions->CompileShader = brw_compile_shader; functions->LinkShader = brw_link_shader; } -- 2.30.2