Mesa (master): mesa: add _mesa_add_sized_state_reference() helper

Timothy Arceri tarceri at kemper.freedesktop.org
Tue Mar 20 03:24:30 UTC 2018


Module: Mesa
Branch: master
Commit: 57ebab64c0dd1abd646f4f274d01f19c8e0e7293
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=57ebab64c0dd1abd646f4f274d01f19c8e0e7293

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Tue Mar 13 20:47:48 2018 +1100

mesa: add _mesa_add_sized_state_reference() helper

This will be used for adding packed builtin uniforms.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/program/prog_parameter.c | 36 ++++++++++++++++++++++--------------
 src/mesa/program/prog_parameter.h |  5 +++++
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index af9bb37cd5..88821cfba1 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -362,21 +362,11 @@ _mesa_add_typed_unnamed_constant(struct gl_program_parameter_list *paramList,
    return pos;
 }
 
-
-/**
- * Add a new state reference to the parameter list.
- * This will be used when the program contains something like this:
- *    PARAM ambient = state.material.front.ambient;
- *
- * \param paramList  the parameter list
- * \param stateTokens  an array of 5 (STATE_LENGTH) state tokens
- * \return index of the new parameter.
- */
 GLint
-_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
-                          const gl_state_index16 stateTokens[STATE_LENGTH])
+_mesa_add_sized_state_reference(struct gl_program_parameter_list *paramList,
+                                const gl_state_index16 stateTokens[STATE_LENGTH],
+                                const unsigned size, bool pad_and_align)
 {
-   const GLuint size = 4; /* XXX fix */
    char *name;
    GLint index;
 
@@ -391,7 +381,8 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
 
    name = _mesa_program_state_string(stateTokens);
    index = _mesa_add_parameter(paramList, PROGRAM_STATE_VAR, name,
-                               size, GL_NONE, NULL, stateTokens, true);
+                               size, GL_NONE, NULL, stateTokens,
+                               pad_and_align);
    paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
 
    /* free name string here since we duplicated it in add_parameter() */
@@ -399,3 +390,20 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
 
    return index;
 }
+
+
+/**
+ * Add a new state reference to the parameter list.
+ * This will be used when the program contains something like this:
+ *    PARAM ambient = state.material.front.ambient;
+ *
+ * \param paramList  the parameter list
+ * \param stateTokens  an array of 5 (STATE_LENGTH) state tokens
+ * \return index of the new parameter.
+ */
+GLint
+_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
+                          const gl_state_index16 stateTokens[STATE_LENGTH])
+{
+   return _mesa_add_sized_state_reference(paramList, stateTokens, 4, true);
+}
diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h
index 83eb0c5613..8e36a1c590 100644
--- a/src/mesa/program/prog_parameter.h
+++ b/src/mesa/program/prog_parameter.h
@@ -128,6 +128,11 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
 }
 
 extern GLint
+_mesa_add_sized_state_reference(struct gl_program_parameter_list *paramList,
+                                const gl_state_index16 stateTokens[STATE_LENGTH],
+                                const unsigned size, bool pad_and_align);
+
+extern GLint
 _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
                           const gl_state_index16 stateTokens[]);
 




More information about the mesa-commit mailing list