summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-01-05 16:00:57 -0700
committerBrian <[email protected]>2007-01-05 16:00:57 -0700
commit9805e7674424182b17ca355da2cb3b14fab8a41c (patch)
tree3fabc82c85a06e33cfdebf5864a2b114cae886fb
parent4cc90ee0b0fa30a71c275abe4cad68b7e99d025a (diff)
added _mesa_add_sampler()
-rw-r--r--src/mesa/shader/prog_parameter.c17
-rw-r--r--src/mesa/shader/prog_parameter.h15
2 files changed, 27 insertions, 5 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index cdc8a200019..d09cc659376 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -223,6 +223,23 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList,
GLint
+_mesa_add_sampler(struct gl_program_parameter_list *paramList,
+ const char *name)
+{
+ GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
+ if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) {
+ /* already in list */
+ return i;
+ }
+ else {
+ const GLint size = 1;
+ i = _mesa_add_parameter(paramList, name, NULL, size, PROGRAM_SAMPLER);
+ return i;
+ }
+}
+
+
+GLint
_mesa_add_varying(struct gl_program_parameter_list *paramList,
const char *name, GLuint size)
{
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h
index 6ce96c79728..0db2bcd314f 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/shader/prog_parameter.h
@@ -35,10 +35,11 @@
/**
- * Named program parameters
- * Used for NV_fragment_program "DEFINE"d constants and "DECLARE"d parameters,
- * and ARB_fragment_program global state references. For the later, Name
- * might be "state.light[0].diffuse", for example.
+ * Program parameter.
+ * Used for NV_fragment_program for "DEFINE"d constants and "DECLARE"d
+ * parameters.
+ * Also used by ARB_vertex/fragment_programs for state variables, etc.
+ * Used by shaders for uniforms, constants, varying vars, etc.
*/
struct gl_program_parameter
{
@@ -53,7 +54,7 @@ struct gl_program_parameter
/**
- * A list of the above program_parameter instances.
+ * List of gl_program_parameter instances.
*/
struct gl_program_parameter_list
{
@@ -99,6 +100,10 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList,
const char *name, GLuint size);
extern GLint
+_mesa_add_sampler(struct gl_program_parameter_list *paramList,
+ const char *name);
+
+extern GLint
_mesa_add_varying(struct gl_program_parameter_list *paramList,
const char *name, GLuint size);