static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, GLuint id) { struct r300_vertex_program_cont *vp; struct r300_fragment_program *fp; switch (target) { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: vp = CALLOC_STRUCT(r300_vertex_program_cont); return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id); case GL_FRAGMENT_PROGRAM_ARB: fp = CALLOC_STRUCT(r300_fragment_program); fp->ctx = ctx; return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id); case GL_FRAGMENT_PROGRAM_NV: fp = CALLOC_STRUCT(r300_fragment_program); return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id); default: _mesa_problem(ctx, "Bad target in r300NewProgram"); } return NULL; }
static struct gl_program * i915NewProgram(GLcontext * ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: return _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), target, id); case GL_FRAGMENT_PROGRAM_ARB:{ struct i915_fragment_program *prog = CALLOC_STRUCT(i915_fragment_program); if (prog) { i915_init_program(I915_CONTEXT(ctx), prog); return _mesa_init_fragment_program(ctx, &prog->FragProg, target, id); } else return NULL; } default: /* Just fallback: */ return _mesa_new_program(ctx, target, id); } }
/** * Allocate and initialize a new fragment/vertex program object but * don't put it into the program hash table. Called via * ctx->Driver.NewProgram. May be overridden (ie. replaced) by a * device driver function to implement OO deriviation with additional * types not understood by this function. * * \param ctx context * \param id program id/number * \param target program target/type * \return pointer to new program object */ 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 */ case GL_VERTEX_STATE_PROGRAM_NV: prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), target, id ); break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: prog =_mesa_init_fragment_program(ctx, CALLOC_STRUCT(gl_fragment_program), target, id ); break; case MESA_GEOMETRY_PROGRAM: prog = _mesa_init_geometry_program(ctx, CALLOC_STRUCT(gl_geometry_program), target, id); break; default: _mesa_problem(ctx, "bad target in _mesa_new_program"); prog = NULL; } return prog; }
/** * Called via ctx->Driver.NewProgram() to allocate a new vertex or * fragment program. */ static struct gl_program * st_new_program(struct gl_context *ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program); return _mesa_init_vertex_program(ctx, &prog->Base, target, id); } case GL_FRAGMENT_PROGRAM_ARB: case GL_FRAGMENT_PROGRAM_NV: { struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program); return _mesa_init_fragment_program(ctx, &prog->Base, target, id); } case MESA_GEOMETRY_PROGRAM: { struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program); return _mesa_init_geometry_program(ctx, &prog->Base, target, id); } default: assert(0); return NULL; } }
static struct gl_program *brwNewProgram( struct gl_context *ctx, GLenum target, GLuint id ) { struct brw_context *brw = brw_context(ctx); switch (target) { case GL_VERTEX_PROGRAM_ARB: { struct brw_vertex_program *prog = CALLOC_STRUCT(brw_vertex_program); if (prog) { prog->id = brw->program_id++; return _mesa_init_vertex_program( ctx, &prog->program, target, id ); } else return NULL; } case GL_FRAGMENT_PROGRAM_ARB: { struct brw_fragment_program *prog = CALLOC_STRUCT(brw_fragment_program); if (prog) { prog->id = brw->program_id++; return _mesa_init_fragment_program( ctx, &prog->program, target, id ); } else return NULL; } default: return _mesa_new_program(ctx, target, id); } }
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_vertex_program(ctx, &vp->mesa_program, target, id); case GL_FRAGMENT_PROGRAM_ARB: return _mesa_init_fragment_program( ctx, CALLOC_STRUCT(gl_fragment_program), target, id ); default: _mesa_problem(ctx, "Bad target in r200NewProgram"); } return NULL; }
static struct gl_program *r700NewProgram(GLcontext * ctx, GLenum target, GLuint id) { struct gl_program *pProgram = NULL; struct r700_vertex_program_cont *vpc; struct r700_fragment_program *fp; radeon_print(RADEON_SHADER, RADEON_VERBOSE, "%s %u, %u\n", __func__, target, id); switch (target) { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: vpc = CALLOC_STRUCT(r700_vertex_program_cont); pProgram = _mesa_init_vertex_program(ctx, &vpc->mesa_program, target, id); break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: fp = CALLOC_STRUCT(r700_fragment_program); pProgram = _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id); fp->translated = GL_FALSE; fp->loaded = GL_FALSE; fp->shaderbo = NULL; fp->constbo0 = NULL; break; default: _mesa_problem(ctx, "Bad target in r700NewProgram"); } return pProgram; }