summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2015-10-13 11:26:09 +0100
committerEmil Velikov <[email protected]>2015-10-15 13:30:52 +0100
commitbcb56c2c69dd1695d7828d831d71c957e7e497c6 (patch)
treec2ac6d67a12ebdb58197894c1213f75c55408564 /src/mesa/drivers/dri
parent2034bdd46ce757a18fdb3498f6a0232db16522f3 (diff)
program: convert _mesa_init_gl_program() to take struct gl_program *
Rather than accepting a void pointer, only to down and up cast around it, convert the function to take the base (struct gl_program) pointer. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c6
-rw-r--r--src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp2
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c17
7 files changed, 21 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 237d219289b..59d795998c6 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -1315,9 +1315,10 @@ static struct gl_program *
i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
{
switch (target) {
- case GL_VERTEX_PROGRAM_ARB:
- return _mesa_init_gl_program(CALLOC_STRUCT(gl_vertex_program),
- target, id);
+ case GL_VERTEX_PROGRAM_ARB: {
+ struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
case GL_FRAGMENT_PROGRAM_ARB:{
struct i915_fragment_program *prog =
@@ -1325,7 +1326,7 @@ i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
if (prog) {
i915_init_program(I915_CONTEXT(ctx), prog);
- return _mesa_init_gl_program(prog, target, id);
+ return _mesa_init_gl_program(&prog->FragProg.Base, target, id);
}
else
return NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 164c3d76c99..b547d07f0ca 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -69,7 +69,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
if (prog) {
prog->id = get_new_program_id(brw->intelScreen);
- return _mesa_init_gl_program(&prog->program, target, id);
+ return _mesa_init_gl_program(&prog->program.Base, target, id);
}
else
return NULL;
@@ -80,7 +80,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
if (prog) {
prog->id = get_new_program_id(brw->intelScreen);
- return _mesa_init_gl_program(&prog->program, target, id);
+ return _mesa_init_gl_program(&prog->program.Base, target, id);
}
else
return NULL;
@@ -102,7 +102,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
if (prog) {
prog->id = get_new_program_id(brw->intelScreen);
- return _mesa_init_gl_program(&prog->program, target, id);
+ return _mesa_init_gl_program(&prog->program.Base, target, id);
} else {
return NULL;
}
diff --git a/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp
index 7eee42630a6..5f80f90a91d 100644
--- a/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp
@@ -66,7 +66,7 @@ void cmod_propagation_test::SetUp()
v = new cmod_propagation_fs_visitor(compiler, prog_data, shader);
- _mesa_init_gl_program(&fp->program, GL_FRAGMENT_SHADER, 0);
+ _mesa_init_gl_program(&fp->program.Base, GL_FRAGMENT_SHADER, 0);
devinfo->gen = 4;
}
diff --git a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
index fefde4bb7bf..32e8b8f8867 100644
--- a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
@@ -66,7 +66,7 @@ void saturate_propagation_test::SetUp()
v = new saturate_propagation_fs_visitor(compiler, prog_data, shader);
- _mesa_init_gl_program(&fp->program, GL_FRAGMENT_SHADER, 0);
+ _mesa_init_gl_program(&fp->program.Base, GL_FRAGMENT_SHADER, 0);
devinfo->gen = 4;
}
diff --git a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
index 4a87e6eff96..e80b71b558d 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
@@ -98,7 +98,7 @@ void copy_propagation_test::SetUp()
v = new copy_propagation_vec4_visitor(compiler, shader);
- _mesa_init_gl_program(&vp->program, GL_VERTEX_SHADER, 0);
+ _mesa_init_gl_program(&vp->program.Base, GL_VERTEX_SHADER, 0);
devinfo->gen = 4;
}
diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
index 92d75e79837..2f824617454 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
@@ -101,7 +101,7 @@ void register_coalesce_test::SetUp()
v = new register_coalesce_vec4_visitor(compiler, shader);
- _mesa_init_gl_program(&vp->program, GL_VERTEX_SHADER, 0);
+ _mesa_init_gl_program(&vp->program.Base, GL_VERTEX_SHADER, 0);
devinfo->gen = 4;
}
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index d173605d110..628c5708090 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -1200,18 +1200,19 @@ r200BindProgram(struct gl_context *ctx, GLenum target, struct gl_program *prog)
static struct gl_program *
r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id)
{
- struct r200_vertex_program *vp;
-
switch(target){
- case GL_VERTEX_PROGRAM_ARB:
- vp = CALLOC_STRUCT(r200_vertex_program);
- return _mesa_init_gl_program(&vp->mesa_program, target, id);
- case GL_FRAGMENT_PROGRAM_ARB:
- return _mesa_init_gl_program(CALLOC_STRUCT(gl_fragment_program), target, id);
+ case GL_VERTEX_PROGRAM_ARB: {
+ struct r200_vertex_program *vp = CALLOC_STRUCT(r200_vertex_program);
+ return _mesa_init_gl_program(&vp->mesa_program.Base, target, id);
+ }
+ case GL_FRAGMENT_PROGRAM_ARB: {
+ struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
default:
_mesa_problem(ctx, "Bad target in r200NewProgram");
+ return NULL;
}
- return NULL;
}