summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
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/drivers/dri
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/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c5
3 files changed, 7 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index a57125412ea..2ad9eb23e75 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -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);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 8f015026421..647f138f0a3 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -135,7 +135,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
case GL_TESS_EVALUATION_PROGRAM_NV:
case GL_GEOMETRY_PROGRAM_NV:
case GL_COMPUTE_PROGRAM_NV: {
- struct brw_program *prog = CALLOC_STRUCT(brw_program);
+ struct brw_program *prog = rzalloc(NULL, struct brw_program);
if (prog) {
prog->id = get_new_program_id(brw->screen);
@@ -149,7 +149,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
struct brw_program *prog;
if (brw->gen < 6) {
struct gen4_fragment_program *g4_prog =
- CALLOC_STRUCT(gen4_fragment_program);
+ rzalloc(NULL, struct gen4_fragment_program);
prog = &g4_prog->base;
} else {
prog = CALLOC_STRUCT(brw_program);
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 3f1d53e7270..5965c6e8048 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -1203,11 +1203,12 @@ r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id)
{
switch(target){
case GL_VERTEX_PROGRAM_ARB: {
- struct r200_vertex_program *vp = CALLOC_STRUCT(r200_vertex_program);
+ struct r200_vertex_program *vp = rzalloc(NULL,
+ struct r200_vertex_program);
return _mesa_init_gl_program(&vp->mesa_program, target, id);
}
case GL_FRAGMENT_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);
}
default: