i965: Fix up and actually enable the NewShader and NewShaderProgram hooks.

This commit is contained in:
Eric Anholt 2010-08-26 16:59:55 -07:00
parent fa2deb3ddc
commit 1a3de23509
2 changed files with 8 additions and 3 deletions

View file

@ -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);
}
}

View file

@ -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;
}