From 8d418d16165624a59b2049d4097b4ab0dc82ffa9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 14 Oct 2012 16:43:15 -0700 Subject: [PATCH] mesa: Remove support for named parameters. These were only part of NV_fragment_program, so we can kill them. The fact that PROGRAM_NAMED_PARAM appears in r200_vertprog.c is rather comedic, but also demonstrates that people just spam the various types of parameters everywhere because they're confusing. Reviewed-by: Brian Paul Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i915/i915_fragprog.c | 1 - src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 4 +--- src/mesa/drivers/dri/r200/r200_vertprog.c | 2 -- src/mesa/main/mtypes.h | 3 +-- src/mesa/program/prog_execute.c | 2 -- src/mesa/program/prog_parameter.c | 14 -------------- src/mesa/program/prog_parameter.h | 6 +----- src/mesa/program/prog_print.c | 2 -- src/mesa/program/program.c | 3 --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 ----- src/mesa/state_tracker/st_mesa_to_tgsi.c | 3 --- 11 files changed, 3 insertions(+), 42 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 3038d84f3ed..23f2f0f9da0 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -173,7 +173,6 @@ src_vector(struct i915_fragment_program *p, case PROGRAM_CONSTANT: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_UNIFORM: src = i915_emit_param4fv(p, &program->Base.Parameters->ParameterValues[source->Index][0].f); diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index be00f6ea8f5..080435b5114 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -599,7 +599,7 @@ fs_visitor::setup_fp_regs() for (int i = 0; i < num_temp; i++) fp_temp_regs[i] = fs_reg(this, glsl_type::vec4_type); - /* PROGRAM_STATE_VAR, PROGRAM_NAMED_PARAM, etc. */ + /* PROGRAM_STATE_VAR etc. */ if (c->dispatch_width == 8) { for (unsigned p = 0; p < c->fp->program.Base.Parameters->NumParameters; p++) { @@ -722,13 +722,11 @@ fs_visitor::get_fp_src_reg(const prog_src_register *src) case PROGRAM_STATE_VAR: case PROGRAM_UNIFORM: case PROGRAM_CONSTANT: - case PROGRAM_NAMED_PARAM: /* We actually want to look at the type in the Parameters list for this, * because this lets us upload constant builtin uniforms, as actual * constants. */ switch (plist->Parameters[src->Index].Type) { - case PROGRAM_NAMED_PARAM: case PROGRAM_CONSTANT: { result = fs_reg(this, glsl_type::vec4_type); diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index a3d8be95126..20664dd0c97 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -123,7 +123,6 @@ static GLboolean r200VertexProgUpdateParams(struct gl_context *ctx, struct r200_ for(pi = 0; pi < paramList->NumParameters; pi++) { switch(paramList->Parameters[pi].Type) { case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: //fprintf(stderr, "%s", vp->Parameters->Parameters[pi].Name); case PROGRAM_CONSTANT: *fcmd++ = paramList->ParameterValues[pi][0].f; @@ -214,7 +213,6 @@ static unsigned long t_src_class(gl_register_file file) case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: - case PROGRAM_NAMED_PARAM: case PROGRAM_CONSTANT: case PROGRAM_STATE_VAR: return VSF_IN_CLASS_PARAM; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 7444df9c46b..8bff789ac80 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1841,7 +1841,7 @@ struct gl_transform_feedback_state * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c) * All values should fit in a 4-bit field. * - * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR, PROGRAM_NAMED_PARAM, + * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR, * PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be considered to * be "uniform" variables since they can only be set outside glBegin/End. * They're also all stored in the same Parameters array. @@ -1855,7 +1855,6 @@ typedef enum PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */ PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */ PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */ - PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */ PROGRAM_CONSTANT, /**< gl_program->Parameters[] */ PROGRAM_UNIFORM, /**< gl_program->Parameters[] */ PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */ diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index f57027c0756..5b6a5c14927 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -136,8 +136,6 @@ get_src_register_pointer(const struct prog_src_register *source, case PROGRAM_CONSTANT: /* Fallthrough */ case PROGRAM_UNIFORM: - /* Fallthrough */ - case PROGRAM_NAMED_PARAM: if (reg >= (GLint) prog->Parameters->NumParameters) return ZeroVec; return (GLfloat *) prog->Parameters->ParameterValues[reg]; diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index b9f4d9d572a..ed421b5a15f 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -179,20 +179,6 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, } -/** - * Add a new named program parameter (Ex: NV_fragment_program DEFINE statement) - * \return index of the new entry in the parameter list - */ -GLint -_mesa_add_named_parameter(struct gl_program_parameter_list *paramList, - const char *name, const gl_constant_value values[4]) -{ - return _mesa_add_parameter(paramList, PROGRAM_NAMED_PARAM, name, - 4, GL_NONE, values, NULL, 0x0); - -} - - /** * Add a new named constant to the parameter list. * This will be used when the program contains something like this: diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h index 3c6dc8cf996..d17069090ef 100644 --- a/src/mesa/program/prog_parameter.h +++ b/src/mesa/program/prog_parameter.h @@ -71,7 +71,7 @@ typedef union gl_constant_value struct gl_program_parameter { const char *Name; /**< Null-terminated string */ - gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ + gl_register_file Type; /**< PROGRAM_CONSTANT or STATE_VAR */ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ /** * Number of components (1..4), or more. @@ -133,10 +133,6 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, const gl_state_index state[STATE_LENGTH], GLbitfield flags); -extern GLint -_mesa_add_named_parameter(struct gl_program_parameter_list *paramList, - const char *name, const gl_constant_value values[4]); - extern GLint _mesa_add_named_constant(struct gl_program_parameter_list *paramList, const char *name, const gl_constant_value values[4], diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 99623c1f152..26191baa6e5 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -60,8 +60,6 @@ _mesa_register_file_name(gl_register_file f) return "INPUT"; case PROGRAM_OUTPUT: return "OUTPUT"; - case PROGRAM_NAMED_PARAM: - return "NAMED"; case PROGRAM_CONSTANT: return "CONST"; case PROGRAM_UNIFORM: diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index 4c533a9035d..993803dd5ff 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -916,9 +916,6 @@ _mesa_valid_register_index(const struct gl_context *ctx, case PROGRAM_LOCAL_PARAM: return index >= 0 && index < c->MaxLocalParams; - case PROGRAM_NAMED_PARAM: - return index >= 0 && index < c->MaxParameters; - case PROGRAM_UNIFORM: case PROGRAM_STATE_VAR: /* aka constant buffer */ diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 852dceaf618..705f2b055af 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -74,7 +74,6 @@ extern "C" { #define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \ (1 << PROGRAM_ENV_PARAM) | \ (1 << PROGRAM_STATE_VAR) | \ - (1 << PROGRAM_NAMED_PARAM) | \ (1 << PROGRAM_CONSTANT) | \ (1 << PROGRAM_UNIFORM)) @@ -536,7 +535,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: this->indirect_addr_consts = true; @@ -558,7 +556,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: this->indirect_addr_consts = true; @@ -4041,7 +4038,6 @@ src_register(struct st_translate *t, t->temps[index] = ureg_DECL_local_temporary(t->ureg); return ureg_src(t->temps[index]); - case PROGRAM_NAMED_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_UNIFORM: @@ -4692,7 +4688,6 @@ st_translate_program( case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_UNIFORM: t->constants[i] = ureg_DECL_constant(ureg, i); break; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index daf34192c6a..8f2ba7c8e18 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -49,7 +49,6 @@ #define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \ (1 << PROGRAM_ENV_PARAM) | \ (1 << PROGRAM_STATE_VAR) | \ - (1 << PROGRAM_NAMED_PARAM) | \ (1 << PROGRAM_CONSTANT) | \ (1 << PROGRAM_UNIFORM)) @@ -221,7 +220,6 @@ src_register( struct st_translate *t, t->temps[index] = ureg_DECL_temporary( t->ureg ); return ureg_src(t->temps[index]); - case PROGRAM_NAMED_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_UNIFORM: @@ -1209,7 +1207,6 @@ st_translate_mesa_program( case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_UNIFORM: t->constants[i] = ureg_DECL_constant( ureg, i ); break; -- 2.30.2