aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_program.c
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/state_tracker/st_cb_program.c
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/state_tracker/st_cb_program.c')
-rw-r--r--src/mesa/state_tracker/st_cb_program.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 40f2af0e550..26d128abd38 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -102,29 +102,31 @@ st_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
static struct gl_program *
st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
{
- struct gl_program *prog;
-
switch (target) {
- case GL_VERTEX_PROGRAM_ARB:
- prog = (struct gl_program*)ST_CALLOC_STRUCT(st_vertex_program);
- break;
- case GL_FRAGMENT_PROGRAM_ARB:
- prog = (struct gl_program*)ST_CALLOC_STRUCT(st_fragment_program);
- break;
- case GL_GEOMETRY_PROGRAM_NV:
- prog = (struct gl_program*)ST_CALLOC_STRUCT(st_geometry_program);
- break;
- case GL_TESS_CONTROL_PROGRAM_NV:
- prog = (struct gl_program*)ST_CALLOC_STRUCT(st_tessctrl_program);
- break;
- case GL_TESS_EVALUATION_PROGRAM_NV:
- prog = (struct gl_program*)ST_CALLOC_STRUCT(st_tesseval_program);
- break;
+ case GL_VERTEX_PROGRAM_ARB: {
+ struct st_vertex_program *prog = ST_CALLOC_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);
+ 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);
+ 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);
+ 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);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
default:
assert(0);
return NULL;
}
- return _mesa_init_gl_program(prog, target, id);
}