diff options
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 6 | ||||
-rw-r--r-- | src/mesa/shader/arbprogparse.h | 4 | ||||
-rw-r--r-- | src/mesa/shader/arbprogram.c | 14 | ||||
-rw-r--r-- | src/mesa/shader/nvfragparse.c | 10 | ||||
-rw-r--r-- | src/mesa/shader/nvfragparse.h | 4 | ||||
-rw-r--r-- | src/mesa/shader/nvprogram.c | 48 | ||||
-rw-r--r-- | src/mesa/shader/nvvertexec.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/nvvertexec.h | 2 | ||||
-rw-r--r-- | src/mesa/shader/nvvertparse.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/nvvertparse.h | 4 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 84 | ||||
-rw-r--r-- | src/mesa/shader/program.h | 42 |
12 files changed, 113 insertions, 111 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 12db64612ee..39e74576cee 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -51,7 +51,7 @@ */ struct arb_program { - struct program Base; + struct gl_program Base; GLuint Position; /* Just used for error reporting while parsing */ GLuint MajorVersion; @@ -4060,7 +4060,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, void _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, const GLvoid *str, GLsizei len, - struct fragment_program *program) + struct gl_fragment_program *program) { struct arb_program ap; GLuint i; @@ -4115,7 +4115,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, void _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, const GLvoid *str, GLsizei len, - struct vertex_program *program) + struct gl_vertex_program *program) { struct arb_program ap; diff --git a/src/mesa/shader/arbprogparse.h b/src/mesa/shader/arbprogparse.h index ad4046dfacf..4574e5cd553 100644 --- a/src/mesa/shader/arbprogparse.h +++ b/src/mesa/shader/arbprogparse.h @@ -31,11 +31,11 @@ extern void _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, const GLvoid *str, GLsizei len, - struct vertex_program *program); + struct gl_vertex_program *program); extern void _mesa_parse_arb_fragment_program(GLcontext *ctx, GLenum target, const GLvoid *str, GLsizei len, - struct fragment_program *program); + struct gl_fragment_program *program); #endif diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 8283033f864..346263d8668 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -195,7 +195,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { - struct vertex_program *prog = ctx->VertexProgram.Current; + struct gl_vertex_program *prog = ctx->VertexProgram.Current; _mesa_parse_arb_vertex_program(ctx, target, string, len, prog); if (ctx->Driver.ProgramStringNotify) @@ -203,7 +203,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { - struct fragment_program *prog = ctx->FragmentProgram.Current; + struct gl_fragment_program *prog = ctx->FragmentProgram.Current; _mesa_parse_arb_fragment_program(ctx, target, string, len, prog); if (ctx->Driver.ProgramStringNotify) @@ -335,7 +335,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); - struct program *prog; + struct gl_program *prog; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); @@ -416,7 +416,7 @@ void GLAPIENTRY _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params) { - const struct program *prog; + const struct gl_program *prog; GLuint maxParams; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -474,7 +474,7 @@ void GLAPIENTRY _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) { const struct gl_program_constants *limits; - struct program *prog; + struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) @@ -598,7 +598,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) * The following apply to fragment programs only (at this time) */ if (target == GL_FRAGMENT_PROGRAM_ARB) { - const struct fragment_program *fp = ctx->FragmentProgram.Current; + const struct gl_fragment_program *fp = ctx->FragmentProgram.Current; switch (pname) { case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: *params = fp->NumNativeAluInstructions; @@ -647,7 +647,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) { - const struct program *prog; + const struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 14de7cdd52b..364c7061ee1 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -146,9 +146,9 @@ struct parse_state { const GLubyte *start; /* start of program string */ const GLubyte *pos; /* current position */ const GLubyte *curLine; - struct fragment_program *program; /* current program */ + struct gl_fragment_program *program; /* current program */ - struct program_parameter_list *parameters; + struct gl_program_parameter_list *parameters; GLuint numInst; /* number of instructions parsed */ GLuint inputsRead; /* bitmask of input registers used */ @@ -1452,7 +1452,7 @@ Parse_InstructionSequence(struct parse_state *parseState, void _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, - struct fragment_program *program) + struct gl_fragment_program *program) { struct parse_state parseState; struct prog_instruction instBuffer[MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS]; @@ -1569,7 +1569,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, static void -PrintSrcReg(const struct fragment_program *program, +PrintSrcReg(const struct gl_fragment_program *program, const struct prog_src_register *src) { static const char comps[5] = "xyzw"; @@ -1731,7 +1731,7 @@ PrintDstReg(const struct prog_dst_register *dst) * Print (unparse) the given vertex program. Just for debugging. */ void -_mesa_print_nv_fragment_program(const struct fragment_program *program) +_mesa_print_nv_fragment_program(const struct gl_fragment_program *program) { const struct prog_instruction *inst; diff --git a/src/mesa/shader/nvfragparse.h b/src/mesa/shader/nvfragparse.h index 849a7fbc7d6..de45cf543db 100644 --- a/src/mesa/shader/nvfragparse.h +++ b/src/mesa/shader/nvfragparse.h @@ -34,11 +34,11 @@ extern void _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target, const GLubyte *str, GLsizei len, - struct fragment_program *program); + struct gl_fragment_program *program); extern void -_mesa_print_nv_fragment_program(const struct fragment_program *program); +_mesa_print_nv_fragment_program(const struct gl_fragment_program *program); extern const char * diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 758d62c1378..3a5c053b311 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -59,7 +59,7 @@ void GLAPIENTRY _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { - struct vertex_program *vprog; + struct gl_vertex_program *vprog; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -70,7 +70,7 @@ _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) FLUSH_VERTICES(ctx, _NEW_PROGRAM); - vprog = (struct vertex_program *) + vprog = (struct gl_vertex_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) { @@ -104,12 +104,12 @@ GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, } for (i = 0; i < n; i++) { - const struct program *prog; + const struct gl_program *prog; if (ids[i] == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV"); return GL_FALSE; } - prog = (const struct program *) + prog = (const struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); if (!prog) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV"); @@ -151,14 +151,14 @@ _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids) /* just error checking for now */ for (i = 0; i < n; i++) { - struct program *prog; + struct gl_program *prog; if (ids[i] == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); return; } - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); if (!prog) { _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); return; @@ -248,13 +248,13 @@ _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, void GLAPIENTRY _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) { - struct program *prog; + struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV"); return; @@ -285,7 +285,7 @@ _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) void GLAPIENTRY _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) { - struct program *prog; + struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) @@ -296,7 +296,7 @@ _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) return; } - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramStringNV"); return; @@ -506,7 +506,7 @@ void GLAPIENTRY _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program) { - struct program *prog; + struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -522,7 +522,7 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, FLUSH_VERTICES(ctx, _NEW_PROGRAM); - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (prog && prog->Target != 0 && prog->Target != target) { _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)"); @@ -532,9 +532,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 vertex_program *vprog = (struct vertex_program *) prog; + struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog; if (!vprog || prog == &_mesa_DummyProgram) { - vprog = (struct vertex_program *) + vprog = (struct gl_vertex_program *) ctx->Driver.NewProgram(ctx, target, id); if (!vprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); @@ -546,9 +546,9 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } else if (target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) { - struct fragment_program *fprog = (struct fragment_program *) prog; + struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; if (!fprog || prog == &_mesa_DummyProgram) { - fprog = (struct fragment_program *) + fprog = (struct gl_fragment_program *) ctx->Driver.NewProgram(ctx, target, id); if (!fprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); @@ -764,8 +764,8 @@ void GLAPIENTRY _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - struct program *prog; - struct fragment_program *fragProg; + struct gl_program *prog; + struct gl_fragment_program *fragProg; GLfloat *v; GET_CURRENT_CONTEXT(ctx); @@ -773,7 +773,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, FLUSH_VERTICES(ctx, _NEW_PROGRAM); - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramNamedParameterNV"); return; @@ -784,7 +784,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, return; } - fragProg = (struct fragment_program *) prog; + fragProg = (struct gl_fragment_program *) prog; v = _mesa_lookup_parameter_value(fragProg->Base.Parameters, len, (char *) name); if (v) { @@ -830,8 +830,8 @@ void GLAPIENTRY _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params) { - struct program *prog; - struct fragment_program *fragProg; + struct gl_program *prog; + struct gl_fragment_program *fragProg; const GLfloat *v; GET_CURRENT_CONTEXT(ctx); @@ -839,7 +839,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramNamedParameterNV"); return; @@ -850,7 +850,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, return; } - fragProg = (struct fragment_program *) prog; + fragProg = (struct gl_fragment_program *) prog; v = _mesa_lookup_parameter_value(fragProg->Base.Parameters, len, (char *) name); if (v) { diff --git a/src/mesa/shader/nvvertexec.c b/src/mesa/shader/nvvertexec.c index fc5837812e2..c436f4f0451 100644 --- a/src/mesa/shader/nvvertexec.c +++ b/src/mesa/shader/nvvertexec.c @@ -379,7 +379,7 @@ store_vector4( const struct prog_dst_register *dest, * Execute the given vertex program */ void -_mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) +_mesa_exec_vertex_program(GLcontext *ctx, const struct gl_vertex_program *program) { struct gl_vertex_program_state *state = &ctx->VertexProgram; const struct prog_instruction *inst; diff --git a/src/mesa/shader/nvvertexec.h b/src/mesa/shader/nvvertexec.h index cdf1bd588bf..e0fd46a7662 100644 --- a/src/mesa/shader/nvvertexec.h +++ b/src/mesa/shader/nvvertexec.h @@ -35,7 +35,7 @@ extern void _mesa_init_vp_per_primitive_registers(GLcontext *ctx); extern void -_mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program); +_mesa_exec_vertex_program(GLcontext *ctx, const struct gl_vertex_program *program); extern void _mesa_dump_vp_state( const struct gl_vertex_program_state *state ); diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index ebfe1fdeefd..927bf60c9fc 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -1290,7 +1290,7 @@ Parse_Program(struct parse_state *parseState, void _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, - struct vertex_program *program) + struct gl_vertex_program *program) { struct parse_state parseState; struct prog_instruction instBuffer[MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS]; @@ -1562,7 +1562,7 @@ _mesa_print_nv_vertex_instruction(const struct prog_instruction *inst) * Print (unparse) the given vertex program. Just for debugging. */ void -_mesa_print_nv_vertex_program(const struct vertex_program *program) +_mesa_print_nv_vertex_program(const struct gl_vertex_program *program) { const struct prog_instruction *inst; diff --git a/src/mesa/shader/nvvertparse.h b/src/mesa/shader/nvvertparse.h index d78d9fa1370..15fb03cd4e4 100644 --- a/src/mesa/shader/nvvertparse.h +++ b/src/mesa/shader/nvvertparse.h @@ -33,13 +33,13 @@ extern void _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target, const GLubyte *str, GLsizei len, - struct vertex_program *program); + struct gl_vertex_program *program); extern void _mesa_print_nv_vertex_instruction(const struct prog_instruction *inst); extern void -_mesa_print_nv_vertex_program(const struct vertex_program *program); +_mesa_print_nv_vertex_program(const struct gl_vertex_program *program); extern const char * _mesa_nv_vertex_input_register_name(GLuint i); diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 7a8950288ba..352ed93465e 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -57,7 +57,7 @@ make_state_flags(const GLint state[]); /* A pointer to this dummy program is put into the hash table when * glGenPrograms is called. */ -struct program _mesa_DummyProgram; +struct gl_program _mesa_DummyProgram; /** @@ -75,7 +75,7 @@ _mesa_init_program(GLcontext *ctx) ctx->VertexProgram.Enabled = GL_FALSE; ctx->VertexProgram.PointSizeEnabled = GL_FALSE; ctx->VertexProgram.TwoSideEnabled = GL_FALSE; - ctx->VertexProgram.Current = (struct vertex_program *) ctx->Shared->DefaultVertexProgram; + ctx->VertexProgram.Current = (struct gl_vertex_program *) ctx->Shared->DefaultVertexProgram; assert(ctx->VertexProgram.Current); ctx->VertexProgram.Current->Base.RefCount++; for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { @@ -86,7 +86,7 @@ _mesa_init_program(GLcontext *ctx) #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program ctx->FragmentProgram.Enabled = GL_FALSE; - ctx->FragmentProgram.Current = (struct fragment_program *) ctx->Shared->DefaultFragmentProgram; + ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram; assert(ctx->FragmentProgram.Current); ctx->FragmentProgram.Current->Base.RefCount++; #endif @@ -197,8 +197,8 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, /** * Initialize a new vertex/fragment program object. */ -static struct program * -_mesa_init_program_struct( GLcontext *ctx, struct program *prog, +static struct gl_program * +_mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, GLenum target, GLuint id) { (void) ctx; @@ -216,8 +216,8 @@ _mesa_init_program_struct( GLcontext *ctx, struct program *prog, /** * Initialize a new fragment program object. */ -struct program * -_mesa_init_fragment_program( GLcontext *ctx, struct fragment_program *prog, +struct gl_program * +_mesa_init_fragment_program( GLcontext *ctx, struct gl_fragment_program *prog, GLenum target, GLuint id) { if (prog) @@ -230,8 +230,8 @@ _mesa_init_fragment_program( GLcontext *ctx, struct fragment_program *prog, /** * Initialize a new vertex program object. */ -struct program * -_mesa_init_vertex_program( GLcontext *ctx, struct vertex_program *prog, +struct gl_program * +_mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, GLenum target, GLuint id) { if (prog) @@ -253,17 +253,18 @@ _mesa_init_vertex_program( GLcontext *ctx, struct vertex_program *prog, * \param target program target/type * \return pointer to new program object */ -struct program * +struct gl_program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - return _mesa_init_vertex_program( ctx, CALLOC_STRUCT(vertex_program), - target, id ); + return _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), + target, id ); case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: - return _mesa_init_fragment_program( ctx, CALLOC_STRUCT(fragment_program), - target, id ); + return _mesa_init_fragment_program(ctx, + CALLOC_STRUCT(gl_fragment_program), + target, id ); default: _mesa_problem(ctx, "bad target in _mesa_new_program"); return NULL; @@ -278,7 +279,7 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) * by a device driver function. */ void -_mesa_delete_program(GLcontext *ctx, struct program *prog) +_mesa_delete_program(GLcontext *ctx, struct gl_program *prog) { (void) ctx; ASSERT(prog); @@ -308,11 +309,11 @@ _mesa_delete_program(GLcontext *ctx, struct program *prog) /* Program parameter functions */ /**********************************************************************/ -struct program_parameter_list * +struct gl_program_parameter_list * _mesa_new_parameter_list(void) { - return (struct program_parameter_list *) - _mesa_calloc(sizeof(struct program_parameter_list)); + return (struct gl_program_parameter_list *) + _mesa_calloc(sizeof(struct gl_program_parameter_list)); } @@ -320,7 +321,7 @@ _mesa_new_parameter_list(void) * Free a parameter list and all its parameters */ void -_mesa_free_parameter_list(struct program_parameter_list *paramList) +_mesa_free_parameter_list(struct gl_program_parameter_list *paramList) { GLuint i; for (i = 0; i < paramList->NumParameters; i++) { @@ -343,7 +344,7 @@ _mesa_free_parameter_list(struct program_parameter_list *paramList) * \return index of new parameter in the list, or -1 if error (out of mem) */ static GLint -add_parameter(struct program_parameter_list *paramList, +add_parameter(struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4], enum register_file type) { @@ -357,10 +358,10 @@ add_parameter(struct program_parameter_list *paramList, paramList->Size *= 2; /* realloc arrays */ - paramList->Parameters = (struct program_parameter *) + paramList->Parameters = (struct gl_program_parameter *) _mesa_realloc(paramList->Parameters, - n * sizeof(struct program_parameter), - paramList->Size * sizeof(struct program_parameter)); + n * sizeof(struct gl_program_parameter), + paramList->Size * sizeof(struct gl_program_parameter)); paramList->ParameterValues = (GLfloat (*)[4]) _mesa_align_realloc(paramList->ParameterValues, /* old buf */ @@ -380,7 +381,7 @@ add_parameter(struct program_parameter_list *paramList, paramList->NumParameters = n + 1; _mesa_memset(¶mList->Parameters[n], 0, - sizeof(struct program_parameter)); + sizeof(struct gl_program_parameter)); paramList->Parameters[n].Name = name ? _mesa_strdup(name) : NULL; paramList->Parameters[n].Type = type; @@ -396,7 +397,7 @@ add_parameter(struct program_parameter_list *paramList, * \return index of the new entry in the parameter list */ GLint -_mesa_add_named_parameter(struct program_parameter_list *paramList, +_mesa_add_named_parameter(struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4]) { return add_parameter(paramList, name, values, PROGRAM_NAMED_PARAM); @@ -410,7 +411,7 @@ _mesa_add_named_parameter(struct program_parameter_list *paramList, * \return index of the new parameter. */ GLint -_mesa_add_named_constant(struct program_parameter_list *paramList, +_mesa_add_named_constant(struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4]) { return add_parameter(paramList, name, values, PROGRAM_CONSTANT); @@ -424,7 +425,7 @@ _mesa_add_named_constant(struct program_parameter_list *paramList, * \return index of the new parameter. */ GLint -_mesa_add_unnamed_constant(struct program_parameter_list *paramList, +_mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, const GLfloat values[4]) { return add_parameter(paramList, NULL, values, PROGRAM_CONSTANT); @@ -439,7 +440,7 @@ _mesa_add_unnamed_constant(struct program_parameter_list *paramList, * \return index of the new parameter. */ GLint -_mesa_add_state_reference(struct program_parameter_list *paramList, +_mesa_add_state_reference(struct gl_program_parameter_list *paramList, const GLint *stateTokens) { /* XXX we should probably search the current parameter list to see if @@ -471,7 +472,7 @@ _mesa_add_state_reference(struct program_parameter_list *paramList, * \return pointer to the float[4] values. */ GLfloat * -_mesa_lookup_parameter_value(struct program_parameter_list *paramList, +_mesa_lookup_parameter_value(struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name) { GLuint i; @@ -505,7 +506,7 @@ _mesa_lookup_parameter_value(struct program_parameter_list *paramList, * \return index of parameter in the list. */ GLint -_mesa_lookup_parameter_index(struct program_parameter_list *paramList, +_mesa_lookup_parameter_index(struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name) { GLint i; @@ -811,6 +812,7 @@ _mesa_fetch_state(GLcontext *ctx, const enum state_index state[], modifier == STATE_MATRIX_INVTRANS) { /* Be sure inverse is up to date: */ + _math_matrix_alloc_inv( (GLmatrix *) matrix ); _math_matrix_analyse( (GLmatrix*) matrix ); m = matrix->inv; } @@ -1246,7 +1248,7 @@ make_state_string(const GLint state[6]) */ void _mesa_load_state_parameters(GLcontext *ctx, - struct program_parameter_list *paramList) + struct gl_program_parameter_list *paramList) { GLuint i; @@ -1631,7 +1633,7 @@ _mesa_print_instruction(const struct prog_instruction *inst) * XXX this function could be greatly improved. */ void -_mesa_print_program(const struct program *prog) +_mesa_print_program(const struct gl_program *prog) { GLuint i; for (i = 0; i < prog->NumInstructions; i++) { @@ -1645,7 +1647,7 @@ _mesa_print_program(const struct program *prog) * Print all of a program's parameters. */ void -_mesa_print_program_parameters(GLcontext *ctx, const struct program *prog) +_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) { GLint i; @@ -1666,7 +1668,7 @@ _mesa_print_program_parameters(GLcontext *ctx, const struct program *prog) #endif for (i = 0; i < prog->Parameters->NumParameters; i++){ - struct program_parameter *param = prog->Parameters->Parameters + i; + struct gl_program_parameter *param = prog->Parameters->Parameters + i; const GLfloat *v = prog->Parameters->ParameterValues[i]; _mesa_printf("param[%d] %s = {%.3f, %.3f, %.3f, %.3f};\n", i, param->Name, v[0], v[1], v[2], v[3]); @@ -1688,7 +1690,7 @@ _mesa_print_program_parameters(GLcontext *ctx, const struct program *prog) void GLAPIENTRY _mesa_BindProgram(GLenum target, GLuint id) { - struct program *prog; + struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -1698,7 +1700,7 @@ _mesa_BindProgram(GLenum target, GLuint id) (ctx->Extensions.NV_vertex_program || ctx->Extensions.ARB_vertex_program)) { /*** Vertex program binding ***/ - struct vertex_program *curProg = ctx->VertexProgram.Current; + struct gl_vertex_program *curProg = ctx->VertexProgram.Current; if (curProg->Base.Id == id) { /* binding same program - no change */ return; @@ -1718,7 +1720,7 @@ _mesa_BindProgram(GLenum target, GLuint id) (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program)) { /*** Fragment program binding ***/ - struct fragment_program *curProg = ctx->FragmentProgram.Current; + struct gl_fragment_program *curProg = ctx->FragmentProgram.Current; if (curProg->Base.Id == id) { /* binding same program - no change */ return; @@ -1751,7 +1753,7 @@ _mesa_BindProgram(GLenum target, GLuint id) } else { /* Bind user program */ - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog == &_mesa_DummyProgram) { /* allocate a new program now */ prog = ctx->Driver.NewProgram(ctx, target, id); @@ -1770,10 +1772,10 @@ _mesa_BindProgram(GLenum target, GLuint id) /* bind now */ if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */ - ctx->VertexProgram.Current = (struct vertex_program *) prog; + ctx->VertexProgram.Current = (struct gl_vertex_program *) prog; } else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { - ctx->FragmentProgram.Current = (struct fragment_program *) prog; + ctx->FragmentProgram.Current = (struct gl_fragment_program *) prog; } /* Never null pointers */ @@ -1807,7 +1809,7 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids) for (i = 0; i < n; i++) { if (ids[i] != 0) { - struct program *prog = (struct program *) + struct gl_program *prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); if (prog == &_mesa_DummyProgram) { _mesa_HashRemove(ctx->Shared->Programs, ids[i]); diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index 4b227877d43..3d50c23b4ed 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -74,7 +74,7 @@ #define WRITEMASK_XYZW 0xf -extern struct program _mesa_DummyProgram; +extern struct gl_program _mesa_DummyProgram; /* @@ -95,21 +95,21 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, GLint *line, GLint *col); -extern struct program * +extern struct gl_program * _mesa_init_vertex_program(GLcontext *ctx, - struct vertex_program *prog, + struct gl_vertex_program *prog, GLenum target, GLuint id); -extern struct program * +extern struct gl_program * _mesa_init_fragment_program(GLcontext *ctx, - struct fragment_program *prog, + struct gl_fragment_program *prog, GLenum target, GLuint id); -extern struct program * +extern struct gl_program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id); extern void -_mesa_delete_program(GLcontext *ctx, struct program *prog); +_mesa_delete_program(GLcontext *ctx, struct gl_program *prog); @@ -190,7 +190,7 @@ enum state_index { * and ARB_fragment_program global state references. For the later, Name * might be "state.light[0].diffuse", for example. */ -struct program_parameter +struct gl_program_parameter { const char *Name; /**< Null-terminated string */ enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ @@ -201,11 +201,11 @@ struct program_parameter /** * A list of the above program_parameter instances. */ -struct program_parameter_list +struct gl_program_parameter_list { GLuint Size; /**< allocated size of Parameters, ParameterValues */ GLuint NumParameters; /**< number of parameters in arrays */ - struct program_parameter *Parameters; /**< Array [Size] */ + struct gl_program_parameter *Parameters; /**< Array [Size] */ GLfloat (*ParameterValues)[4]; /**< Array [Size] of GLfloat[4] */ GLbitfield StateFlags; /**< _NEW_* flags indicating which state changes might invalidate ParameterValues[] */ @@ -216,39 +216,39 @@ struct program_parameter_list * Program parameter functions */ -extern struct program_parameter_list * +extern struct gl_program_parameter_list * _mesa_new_parameter_list(void); extern void -_mesa_free_parameter_list(struct program_parameter_list *paramList); +_mesa_free_parameter_list(struct gl_program_parameter_list *paramList); extern GLint -_mesa_add_named_parameter(struct program_parameter_list *paramList, +_mesa_add_named_parameter(struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4]); extern GLint -_mesa_add_named_constant(struct program_parameter_list *paramList, +_mesa_add_named_constant(struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4]); extern GLint -_mesa_add_unnamed_constant(struct program_parameter_list *paramList, +_mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, const GLfloat values[4]); extern GLint -_mesa_add_state_reference(struct program_parameter_list *paramList, +_mesa_add_state_reference(struct gl_program_parameter_list *paramList, const GLint *stateTokens); extern GLfloat * -_mesa_lookup_parameter_value(struct program_parameter_list *paramList, +_mesa_lookup_parameter_value(struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name); extern GLint -_mesa_lookup_parameter_index(struct program_parameter_list *paramList, +_mesa_lookup_parameter_index(struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name); extern void _mesa_load_state_parameters(GLcontext *ctx, - struct program_parameter_list *paramList); + struct gl_program_parameter_list *paramList); @@ -256,10 +256,10 @@ extern void _mesa_print_instruction(const struct prog_instruction *inst); extern void -_mesa_print_program(const struct program *prog); +_mesa_print_program(const struct gl_program *prog); extern void -_mesa_print_program_parameters(GLcontext *ctx, const struct program *prog); +_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog); /* |