diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/arbprogram.c | 4 | ||||
-rw-r--r-- | src/mesa/main/ffvertex_prog.c | 7 | ||||
-rw-r--r-- | src/mesa/main/nvprogram.c | 21 | ||||
-rw-r--r-- | src/mesa/main/shared.c | 10 | ||||
-rw-r--r-- | src/mesa/main/state.c | 15 |
5 files changed, 25 insertions, 32 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index b83369d9e04..ae91fd5a323 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -138,12 +138,12 @@ _mesa_BindProgram(GLenum target, GLuint id) /* bind newProg */ if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */ _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, - (struct gl_vertex_program *) newProg); + gl_vertex_program(newProg)); } else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, - (struct gl_fragment_program *) newProg); + gl_fragment_program(newProg)); } /* Never null pointers */ diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 5577683115a..e8a11d006d1 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1672,16 +1672,15 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) /* Look for an already-prepared program for this state: */ - prog = (struct gl_vertex_program *) - _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key)); + prog = gl_vertex_program( + _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key))); if (!prog) { /* OK, we'll have to build a new one */ if (0) printf("Build new TNL program\n"); - prog = (struct gl_vertex_program *) - ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + prog = gl_vertex_program(ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0)); if (!prog) return NULL; diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index dae11566e39..fc5749afc8a 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -71,7 +71,7 @@ _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) FLUSH_VERTICES(ctx, _NEW_PROGRAM); - vprog = (struct gl_vertex_program *) _mesa_lookup_program(ctx, id); + vprog = gl_vertex_program(_mesa_lookup_program(ctx, id)); if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV"); @@ -627,10 +627,9 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, if ((target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_STATE_PROGRAM_NV) && ctx->Extensions.NV_vertex_program) { - struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog; + struct gl_vertex_program *vprog = gl_vertex_program(prog); if (!vprog || prog == &_mesa_DummyProgram) { - vprog = (struct gl_vertex_program *) - ctx->Driver.NewProgram(ctx, target, id); + vprog = gl_vertex_program(ctx->Driver.NewProgram(ctx, target, id)); if (!vprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; @@ -647,10 +646,9 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } else if (target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) { - struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; + struct gl_fragment_program *fprog = gl_fragment_program(prog); if (!fprog || prog == &_mesa_DummyProgram) { - fprog = (struct gl_fragment_program *) - ctx->Driver.NewProgram(ctx, target, id); + fprog = gl_fragment_program(ctx->Driver.NewProgram(ctx, target, id)); if (!fprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; @@ -661,10 +659,9 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { - struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; + struct gl_fragment_program *fprog = gl_fragment_program(prog); if (!fprog || prog == &_mesa_DummyProgram) { - fprog = (struct gl_fragment_program *) - ctx->Driver.NewProgram(ctx, target, id); + fprog = gl_fragment_program(ctx->Driver.NewProgram(ctx, target, id)); if (!fprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; @@ -830,7 +827,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, return; } - fragProg = (struct gl_fragment_program *) prog; + fragProg = gl_fragment_program(prog); v = _mesa_lookup_parameter_value(fragProg->Base.Parameters, len, (char *) name); if (v) { @@ -895,7 +892,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, return; } - fragProg = (struct gl_fragment_program *) prog; + fragProg = gl_fragment_program(prog); v = _mesa_lookup_parameter_value(fragProg->Base.Parameters, len, (char *) name); if (v) { diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 226947638ca..58cbc525065 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -71,13 +71,15 @@ _mesa_alloc_shared_state(struct gl_context *ctx) shared->Programs = _mesa_NewHashTable(); #if FEATURE_ARB_vertex_program - shared->DefaultVertexProgram = (struct gl_vertex_program *) - ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + shared->DefaultVertexProgram = + gl_vertex_program(ctx->Driver.NewProgram(ctx, + GL_VERTEX_PROGRAM_ARB, 0)); #endif #if FEATURE_ARB_fragment_program - shared->DefaultFragmentProgram = (struct gl_fragment_program *) - ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + shared->DefaultFragmentProgram = + gl_fragment_program(ctx->Driver.NewProgram(ctx, + GL_FRAGMENT_PROGRAM_ARB, 0)); #endif #if FEATURE_ATI_fragment_shader diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index db0cc30ec9d..76946bd93eb 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -134,8 +134,7 @@ update_program(struct gl_context *ctx) &ctx->Shader._CurrentFragmentProgram, fsProg); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, - (struct gl_fragment_program *) - fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program); + gl_fragment_program(fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program)); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); } @@ -157,11 +156,9 @@ update_program(struct gl_context *ctx) &ctx->Shader._CurrentFragmentProgram, f); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, - (struct gl_fragment_program *) - f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program); + gl_fragment_program(f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program)); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, - (struct gl_fragment_program *) - f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program); + gl_fragment_program(f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program)); } else { /* No fragment program */ @@ -174,8 +171,7 @@ update_program(struct gl_context *ctx) && gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) { /* Use GLSL geometry shader */ _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, - (struct gl_geometry_program *) - gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program); + gl_geometry_program(gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program)); } else { /* No geometry program */ _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL); @@ -189,8 +185,7 @@ update_program(struct gl_context *ctx) && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) { /* Use GLSL vertex shader */ _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, - (struct gl_vertex_program *) - vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program); + gl_vertex_program(vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program)); } else if (ctx->VertexProgram._Enabled) { /* Use user-defined vertex program */ |