Mesa (master): mesa: change constant search behaviour in _mesa_add_unnamed_constant()

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Jan 6 13:52:33 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Jan  5 09:57:41 2010 -0700

mesa: change constant search behaviour in _mesa_add_unnamed_constant()

Only search for an existing, matching constant if swizzleOut is non-null.
We need to be able to disable constant consolidation when building an
array of constants which will be indexed indirectly.

---

 src/mesa/shader/prog_parameter.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index f22492e..5822510 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -230,9 +230,8 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
  * Add a new unnamed constant to the parameter list.  This will be used
  * when a fragment/vertex program contains something like this:
  *    MOV r, { 0, 1, 2, 3 };
- * We'll search the parameter list for an existing instance of the
- * constant.  If swizzleOut is non-null, we'll try swizzling when
- * looking for a match.
+ * If swizzleOut is non-null we'll search the parameter list for an
+ * existing instance of the constant which matches with a swizzle.
  *
  * \param paramList  the parameter list
  * \param values  four float values
@@ -248,7 +247,8 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
    ASSERT(size >= 1);
    ASSERT(size <= 4);
 
-   if (_mesa_lookup_parameter_constant(paramList, values,
+   if (swizzleOut &&
+       _mesa_lookup_parameter_constant(paramList, values,
                                        size, &pos, swizzleOut)) {
       return pos;
    }




More information about the mesa-commit mailing list