From bcb56c2c69dd1695d7828d831d71c957e7e497c6 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 13 Oct 2015 11:26:09 +0100 Subject: program: convert _mesa_init_gl_program() to take struct gl_program * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_cb_program.c | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/mesa/state_tracker/st_cb_program.c') 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); } -- cgit v1.2.3