[Mesa-dev] [PATCH 15/23] mesa: Remove support for named parameters.
Kenneth Graunke
kenneth at whitecape.org
Sun Oct 14 17:43:15 PDT 2012
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.
---
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 3038d84..23f2f0f 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 be00f6e..080435b 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 a3d8be9..20664dd 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 745c831..b22d183 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 8bfeec6..b32e72a 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -153,8 +153,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 b9f4d9d..ed421b5 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -180,20 +180,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:
* PARAM myVals = { 0, 1, 2, 3 };
diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h
index 3c6dc8c..d170690 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.
@@ -134,10 +134,6 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
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],
GLuint size);
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 99623c1..26191ba 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 4c533a9..993803d 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 852dcea..705f2b0 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 c614bde..e49cd7f 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:
@@ -1211,7 +1209,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;
--
1.7.12.2
More information about the mesa-dev
mailing list