st/mesa/r200/i915/i965: use rzalloc() to create gl_program
This allows us to use ralloc_parent() to see which data structure owns shader_info which allows us to fix a regression in nir_sweep(). This will also allow us to move some fields from gl_linked_shader to gl_program, which will allow us to do some clean-ups like storing gl_program directly in the CurrentProgram array in gl_pipeline_object enabling some small validation optimisations at draw time. Also it is error prone to depend on the gl_linked_shader for programs in current use because a failed linking attempt will free infomation about the current program. In i965 we could be trying to recompile a shader variant but may have lost some required fields. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -1148,13 +1148,13 @@ i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
|
||||
{
|
||||
switch (target) {
|
||||
case GL_VERTEX_PROGRAM_ARB: {
|
||||
struct gl_program *prog = CALLOC_STRUCT(gl_program);
|
||||
struct gl_program *prog = rzalloc(NULL, struct gl_program);
|
||||
return _mesa_init_gl_program(prog, target, id);
|
||||
}
|
||||
|
||||
case GL_FRAGMENT_PROGRAM_ARB:{
|
||||
struct i915_fragment_program *prog =
|
||||
CALLOC_STRUCT(i915_fragment_program);
|
||||
rzalloc(NULL, struct i915_fragment_program);
|
||||
if (prog) {
|
||||
i915_init_program(I915_CONTEXT(ctx), prog);
|
||||
|
||||
|
Reference in New Issue
Block a user