summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-26 16:59:55 -0700
committerEric Anholt <[email protected]>2010-08-26 17:00:30 -0700
commit1a3de23509b8170ee87223dc63e992e195a04de5 (patch)
treed0ccb5c0c915773668b03d5faa76521d4d83636d
parentfa2deb3ddc8dc9e3eedf7f3dc1d2d2945a95f79b (diff)
i965: Fix up and actually enable the NewShader and NewShaderProgram hooks.
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp9
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c2
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;
}