From: Brian Paul Date: Sat, 7 Mar 2009 19:02:52 +0000 (-0700) Subject: mesa: gl_register_file enum typedef X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b4026d9be828bd0b6f60158456edf24994efb053;p=mesa.git mesa: gl_register_file enum typedef --- diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 562992fbb5c..a2561df579d 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -202,7 +202,7 @@ static unsigned long t_dst(struct prog_dst_register *dst) } } -static unsigned long t_src_class(enum register_file file) +static unsigned long t_src_class(gl_register_file file) { switch(file){ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index b6a4d306873..0ccb9187031 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -126,7 +126,7 @@ static unsigned long t_dst_mask(GLuint mask) return mask & VSF_FLAG_ALL; } -static unsigned long t_dst_class(enum register_file file) +static unsigned long t_dst_class(gl_register_file file) { switch (file) { @@ -161,7 +161,7 @@ static unsigned long t_dst_index(struct r300_vertex_program *vp, return dst->Index; } -static unsigned long t_src_class(enum register_file file) +static unsigned long t_src_class(gl_register_file file) { switch (file) { case PROGRAM_TEMPORARY: diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 17f6241e04e..57b7065b83e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1703,24 +1703,24 @@ struct gl_evaluators * be "uniform" variables since they can only be set outside glBegin/End. * They're also all stored in the same Parameters array. */ -enum register_file -{ - PROGRAM_TEMPORARY = 0, /**< machine->Temporary[] */ - PROGRAM_LOCAL_PARAM = 1, /**< gl_program->LocalParams[] */ - PROGRAM_ENV_PARAM = 2, /**< gl_program->Parameters[] */ - PROGRAM_STATE_VAR = 3, /**< gl_program->Parameters[] */ - PROGRAM_INPUT = 4, /**< machine->Inputs[] */ - PROGRAM_OUTPUT = 5, /**< machine->Outputs[] */ - PROGRAM_NAMED_PARAM = 6, /**< gl_program->Parameters[] */ - PROGRAM_CONSTANT = 7, /**< gl_program->Parameters[] */ - PROGRAM_UNIFORM = 8, /**< gl_program->Parameters[] */ - PROGRAM_VARYING = 9, /**< machine->Inputs[]/Outputs[] */ - PROGRAM_WRITE_ONLY = 10, /**< A dummy, write-only register */ - PROGRAM_ADDRESS = 11, /**< machine->AddressReg */ - PROGRAM_SAMPLER = 12, /**< for shader samplers, compile-time only */ - PROGRAM_UNDEFINED = 13, /**< Invalid value */ +typedef enum +{ + PROGRAM_TEMPORARY, /**< machine->Temporary[] */ + PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */ + PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */ + PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */ + PROGRAM_INPUT, /**< machine->Inputs[] */ + PROGRAM_OUTPUT, /**< machine->Outputs[] */ + PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */ + PROGRAM_CONSTANT, /**< gl_program->Parameters[] */ + PROGRAM_UNIFORM, /**< gl_program->Parameters[] */ + PROGRAM_VARYING, /**< machine->Inputs[]/Outputs[] */ + PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */ + PROGRAM_ADDRESS, /**< machine->AddressReg */ + PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */ + PROGRAM_UNDEFINED, /**< Invalid/TBD value */ PROGRAM_FILE_MAX -}; +} gl_register_file; /** Vertex and fragment instructions */ diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 75398cda903..cd6289deb58 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2246,7 +2246,7 @@ parse_declaration (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc static GLuint parse_masked_dst_reg (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, - enum register_file *File, GLuint *Index, GLint *WriteMask) + gl_register_file *File, GLuint *Index, GLint *WriteMask) { GLuint tmp, result; struct var_cache *dst; @@ -2478,7 +2478,7 @@ static GLuint parse_src_reg (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, - enum register_file * File, GLint * Index, + gl_register_file * File, GLint * Index, GLboolean *IsRelOffset ) { struct var_cache *src; @@ -2527,7 +2527,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 1; } - *File = (enum register_file) src->param_binding_type; + *File = (gl_register_file) src->param_binding_type; switch (*(*inst)++) { case ARRAY_INDEX_ABSOLUTE: @@ -2573,7 +2573,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, if (parse_param_use (ctx, inst, vc_head, Program, &src)) return 1; - *File = (enum register_file) src->param_binding_type; + *File = (gl_register_file) src->param_binding_type; *Index = src->param_binding_begin; break; } @@ -2598,7 +2598,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, /* XXX: We have to handle offsets someplace in here! -- or are those above? */ case vt_param: - *File = (enum register_file) src->param_binding_type; + *File = (gl_register_file) src->param_binding_type; *Index = src->param_binding_begin; break; @@ -2623,7 +2623,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, } if (*File == PROGRAM_STATE_VAR) { - enum register_file file; + gl_register_file file; /* If we're referencing the Program->Parameters[] array, check if the * parameter is really a constant/literal. If so, set File to CONSTANT. @@ -2652,7 +2652,7 @@ parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, struct arb_program *program, struct prog_src_register *reg) { - enum register_file file; + gl_register_file file; GLint index; GLubyte negateMask; GLubyte swizzle[4]; @@ -2686,7 +2686,7 @@ parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, struct arb_program *program, struct prog_src_register *reg) { - enum register_file file; + gl_register_file file; GLint index; GLubyte negateMask; GLubyte swizzle[4]; @@ -2722,7 +2722,7 @@ parse_dst_reg(GLcontext * ctx, const GLubyte ** inst, { GLint mask; GLuint idx; - enum register_file file; + gl_register_file file; if (parse_masked_dst_reg (ctx, inst, vc_head, program, &file, &idx, &mask)) return 1; @@ -3013,7 +3013,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, { GLubyte swizzle[4]; GLubyte negateMask; - enum register_file file; + gl_register_file file; GLint index; if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, &rel)) @@ -3354,7 +3354,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, GLubyte swizzle[4]; GLubyte negateMask; GLboolean relAddr; - enum register_file file; + gl_register_file file; GLint index; if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h index 8ceb7b092e8..adefc5439de 100644 --- a/src/mesa/shader/prog_execute.h +++ b/src/mesa/shader/prog_execute.h @@ -73,7 +73,7 @@ struct gl_program_machine extern void -_mesa_get_program_register(GLcontext *ctx, enum register_file file, +_mesa_get_program_register(GLcontext *ctx, gl_register_file file, GLuint index, GLfloat val[4]); extern GLboolean diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 8ae961241f6..60e9d074233 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -78,7 +78,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) */ GLint _mesa_add_parameter(struct gl_program_parameter_list *paramList, - enum register_file type, const char *name, + gl_register_file type, const char *name, GLuint size, GLenum datatype, const GLfloat *values, const gl_state_index state[STATE_LENGTH], GLbitfield flags) @@ -681,7 +681,7 @@ _mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA, */ GLuint _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, - enum register_file type) + gl_register_file type) { GLuint i, maxLen = 0; if (!list) @@ -702,7 +702,7 @@ _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, */ GLuint _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list, - enum register_file type) + gl_register_file type) { GLuint i, count = 0; if (list) { diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index 200f2c00458..01f5a0e179f 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -54,7 +54,7 @@ struct gl_program_parameter { const char *Name; /**< Null-terminated string */ - enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ + gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ GLuint Size; /**< Number of components (1..4) */ GLboolean Used; /**< Helper flag for GLSL uniform tracking */ @@ -102,7 +102,7 @@ _mesa_num_parameters(const struct gl_program_parameter_list *list) extern GLint _mesa_add_parameter(struct gl_program_parameter_list *paramList, - enum register_file type, const char *name, + gl_register_file type, const char *name, GLuint size, GLenum datatype, const GLfloat *values, const gl_state_index state[STATE_LENGTH], GLbitfield flags); @@ -161,11 +161,11 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list, extern GLuint _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, - enum register_file type); + gl_register_file type); extern GLuint _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list, - enum register_file type); + gl_register_file type); #endif /* PROG_PARAMETER_H */ diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 6988e9c052e..0a78a0a8667 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -43,7 +43,7 @@ * Return string name for given program/register file. */ static const char * -file_string(enum register_file f, gl_prog_print_mode mode) +file_string(gl_register_file f, gl_prog_print_mode mode) { switch (f) { case PROGRAM_TEMPORARY: @@ -219,7 +219,7 @@ arb_output_attrib_string(GLint index, GLenum progType) * \param prog pointer to containing program */ static const char * -reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, +reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, GLboolean relAddr, const struct gl_program *prog) { static char str[100]; @@ -432,7 +432,7 @@ fprint_dst_reg(FILE * f, const struct gl_program *prog) { _mesa_fprintf(f, "%s%s", - reg_string((enum register_file) dstReg->File, + reg_string((gl_register_file) dstReg->File, dstReg->Index, mode, dstReg->RelAddr, prog), _mesa_writemask_string(dstReg->WriteMask)); @@ -445,7 +445,7 @@ fprint_dst_reg(FILE * f, #if 0 _mesa_fprintf(f, "%s[%d]%s", - file_string((enum register_file) dstReg->File, mode), + file_string((gl_register_file) dstReg->File, mode), dstReg->Index, _mesa_writemask_string(dstReg->WriteMask)); #endif @@ -462,14 +462,14 @@ fprint_src_reg(FILE *f, _mesa_fprintf(f, "%s%s%s%s", abs, - reg_string((enum register_file) srcReg->File, + reg_string((gl_register_file) srcReg->File, srcReg->Index, mode, srcReg->RelAddr, prog), _mesa_swizzle_string(srcReg->Swizzle, srcReg->NegateBase, GL_FALSE), abs); #if 0 _mesa_fprintf(f, "%s[%d]%s", - file_string((enum register_file) srcReg->File, mode), + file_string((gl_register_file) srcReg->File, mode), srcReg->Index, _mesa_swizzle_string(srcReg->Swizzle, srcReg->NegateBase, GL_FALSE)); @@ -562,7 +562,7 @@ _mesa_fprint_instruction_opt(FILE *f, if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { _mesa_fprintf(f, ", "); _mesa_fprintf(f, "%s[%d]%s", - file_string((enum register_file) inst->SrcReg[0].File, + file_string((gl_register_file) inst->SrcReg[0].File, mode), inst->SrcReg[0].Index, _mesa_swizzle_string(inst->SrcReg[0].Swizzle, @@ -579,7 +579,7 @@ _mesa_fprint_instruction_opt(FILE *f, _mesa_fprintf(f, " "); fprint_dst_reg(f, &inst->DstReg, mode, prog); _mesa_fprintf(f, ", %s[%d], %s", - file_string((enum register_file) inst->SrcReg[0].File, + file_string((gl_register_file) inst->SrcReg[0].File, mode), inst->SrcReg[0].Index, _mesa_swizzle_string(inst->SrcReg[0].Swizzle, diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index 05d9bdf7ec7..e283f8933b2 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -375,7 +375,7 @@ _mesa_count_texture_instructions(struct gl_program *prog) * So, rewrite the program to use a temporary register in this case. */ void -_mesa_remove_output_reads(struct gl_program *prog, enum register_file type) +_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) { GLuint i; GLint outputMap[VERT_RESULT_MAX]; diff --git a/src/mesa/shader/programopt.h b/src/mesa/shader/programopt.h index 11572e64f5a..96acaf9566c 100644 --- a/src/mesa/shader/programopt.h +++ b/src/mesa/shader/programopt.h @@ -40,6 +40,6 @@ extern void _mesa_count_texture_instructions(struct gl_program *prog); extern void -_mesa_remove_output_reads(struct gl_program *prog, enum register_file type); +_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type); #endif /* PROGRAMOPT_H */ diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index ee24e2e1385..d8246ae75f8 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2998,7 +2998,7 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var, slang_ir_node *varDecl, *n; slang_ir_storage *store; GLint arrayLen, size, totalSize; /* if array then totalSize > size */ - enum register_file file; + gl_register_file file; /*assert(!var->declared);*/ var->declared = GL_TRUE; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 6a47585c7a1..94d0c084aaf 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -446,7 +446,7 @@ new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode) static struct prog_instruction * emit_arl_load(slang_emit_info *emitInfo, - enum register_file file, GLint index, GLuint swizzle) + gl_register_file file, GLint index, GLuint swizzle) { struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); inst->SrcReg[0].File = file; diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c index dc4086d8880..1c7f7474e71 100644 --- a/src/mesa/shader/slang/slang_ir.c +++ b/src/mesa/shader/slang/slang_ir.c @@ -121,7 +121,7 @@ _slang_ir_info(slang_ir_opcode opcode) void _slang_init_ir_storage(slang_ir_storage *st, - enum register_file file, GLint index, GLint size, + gl_register_file file, GLint index, GLint size, GLuint swizzle) { st->File = file; @@ -137,7 +137,7 @@ _slang_init_ir_storage(slang_ir_storage *st, * Return a new slang_ir_storage object. */ slang_ir_storage * -_slang_new_ir_storage(enum register_file file, GLint index, GLint size) +_slang_new_ir_storage(gl_register_file file, GLint index, GLint size) { slang_ir_storage *st; st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); @@ -157,7 +157,7 @@ _slang_new_ir_storage(enum register_file file, GLint index, GLint size) * Return a new slang_ir_storage object. */ slang_ir_storage * -_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size, +_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, GLuint swizzle) { slang_ir_storage *st; @@ -196,10 +196,10 @@ _slang_new_ir_storage_relative(GLint index, GLint size, slang_ir_storage * -_slang_new_ir_storage_indirect(enum register_file file, +_slang_new_ir_storage_indirect(gl_register_file file, GLint index, GLint size, - enum register_file indirectFile, + gl_register_file indirectFile, GLint indirectIndex, GLuint indirectSwizzle) { diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index d77feeadbab..0ec38b10a5a 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -171,7 +171,7 @@ typedef enum */ struct slang_ir_storage_ { - enum register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */ + gl_register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */ GLint Index; /**< -1 means unallocated */ GLint Size; /**< number of floats or ints */ GLuint Swizzle; /**< Swizzle AND writemask info */ @@ -180,7 +180,7 @@ struct slang_ir_storage_ GLboolean RelAddr; /* we'll remove this eventually */ GLboolean IsIndirect; - enum register_file IndirectFile; + gl_register_file IndirectFile; GLint IndirectIndex; GLuint IndirectSwizzle; GLuint TexTarget; /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */ @@ -235,15 +235,15 @@ _slang_ir_info(slang_ir_opcode opcode); extern void _slang_init_ir_storage(slang_ir_storage *st, - enum register_file file, GLint index, GLint size, + gl_register_file file, GLint index, GLint size, GLuint swizzle); extern slang_ir_storage * -_slang_new_ir_storage(enum register_file file, GLint index, GLint size); +_slang_new_ir_storage(gl_register_file file, GLint index, GLint size); extern slang_ir_storage * -_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size, +_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, GLuint swizzle); extern slang_ir_storage * @@ -252,10 +252,10 @@ _slang_new_ir_storage_relative(GLint index, GLint size, extern slang_ir_storage * -_slang_new_ir_storage_indirect(enum register_file file, +_slang_new_ir_storage_indirect(gl_register_file file, GLint index, GLint size, - enum register_file indirectFile, + gl_register_file indirectFile, GLint indirectIndex, GLuint indirectSwizzle); diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 8ce0b201135..cbf3f334c08 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -48,7 +48,7 @@ */ static GLuint map_register_file( - enum register_file file, + gl_register_file file, GLuint index, const GLuint immediateMapping[], GLboolean indirectAccess )