summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-03 09:18:17 +1100
committerTimothy Arceri <[email protected]>2016-11-03 10:39:13 +1100
commitcc6aa1d161280f10ded7834d1ec2413bc97589fe (patch)
tree5b124517f421f6581a8f518bac4b719c93162129 /src/mesa/state_tracker
parent548b5fee6b4a71d1b7b52b2268ef809a2cb90149 (diff)
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 <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_program.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 48720a3656e..77b7a263796 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -58,27 +58,33 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
{
switch (target) {
case GL_VERTEX_PROGRAM_ARB: {
- struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
+ struct st_vertex_program *prog = rzalloc(NULL,
+ struct st_vertex_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_FRAGMENT_PROGRAM_ARB: {
- struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
+ struct st_fragment_program *prog = rzalloc(NULL,
+ struct st_fragment_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_GEOMETRY_PROGRAM_NV: {
- struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program);
+ struct st_geometry_program *prog = rzalloc(NULL,
+ struct st_geometry_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_TESS_CONTROL_PROGRAM_NV: {
- struct st_tessctrl_program *prog = ST_CALLOC_STRUCT(st_tessctrl_program);
+ struct st_tessctrl_program *prog = rzalloc(NULL,
+ struct st_tessctrl_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_TESS_EVALUATION_PROGRAM_NV: {
- struct st_tesseval_program *prog = ST_CALLOC_STRUCT(st_tesseval_program);
+ struct st_tesseval_program *prog = rzalloc(NULL,
+ struct st_tesseval_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_COMPUTE_PROGRAM_NV: {
- struct st_compute_program *prog = ST_CALLOC_STRUCT(st_compute_program);
+ struct st_compute_program *prog = rzalloc(NULL,
+ struct st_compute_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
default: