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 =
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;
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;
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
* Initialize a new gl_program object.
*/
struct gl_program *
-_mesa_init_gl_program(void *_prog, GLenum target, GLuint id)
+_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id)
{
- struct gl_program *prog = (struct gl_program*)_prog;
GLuint i;
if (!prog)
struct gl_program *
_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
{
- struct gl_program *prog;
switch (target) {
- case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
- prog = _mesa_init_gl_program(CALLOC_STRUCT(gl_vertex_program),
- target, id);
- break;
+ case GL_VERTEX_PROGRAM_ARB: { /* == GL_VERTEX_PROGRAM_NV */
+ struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
case GL_FRAGMENT_PROGRAM_NV:
- case GL_FRAGMENT_PROGRAM_ARB:
- prog =_mesa_init_gl_program(CALLOC_STRUCT(gl_fragment_program),
- target, id);
- break;
- case GL_GEOMETRY_PROGRAM_NV:
- prog = _mesa_init_gl_program(CALLOC_STRUCT(gl_geometry_program),
- target, id);
- break;
- case GL_TESS_CONTROL_PROGRAM_NV:
- prog = _mesa_init_gl_program(CALLOC_STRUCT(gl_tess_ctrl_program),
- target, id);
- break;
- case GL_TESS_EVALUATION_PROGRAM_NV:
- prog = _mesa_init_gl_program(CALLOC_STRUCT(gl_tess_eval_program),
- target, id);
- break;
- case GL_COMPUTE_PROGRAM_NV:
- prog = _mesa_init_gl_program(CALLOC_STRUCT(gl_compute_program),
- target, id);
- break;
+ case GL_FRAGMENT_PROGRAM_ARB: {
+ struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
+ case GL_GEOMETRY_PROGRAM_NV: {
+ struct gl_geometry_program *prog = CALLOC_STRUCT(gl_geometry_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
+ case GL_TESS_CONTROL_PROGRAM_NV: {
+ struct gl_tess_ctrl_program *prog = CALLOC_STRUCT(gl_tess_ctrl_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
+ case GL_TESS_EVALUATION_PROGRAM_NV: {
+ struct gl_tess_eval_program *prog = CALLOC_STRUCT(gl_tess_eval_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
+ case GL_COMPUTE_PROGRAM_NV: {
+ struct gl_compute_program *prog = CALLOC_STRUCT(gl_compute_program);
+ return _mesa_init_gl_program(&prog->Base, target, id);
+ }
default:
_mesa_problem(ctx, "bad target in _mesa_new_program");
- prog = NULL;
+ return NULL;
}
- return prog;
}
_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string);
extern struct gl_program *
-_mesa_init_gl_program(void *prog, GLenum target, GLuint id);
+_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id);
extern struct gl_program *
_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id);
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);
}