Mesa (master): mesa: build a float[4] value in _mesa_add_sampler() to avoid random values

Brian Paul brianp at kemper.freedesktop.org
Fri Apr 17 22:13:53 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Apr 17 13:55:58 2009 -0600

mesa: build a float[4] value in _mesa_add_sampler() to avoid random values

---

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

diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index e9ed398..bcd8c5d 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -327,15 +327,16 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList,
    else {
       GLuint i;
       const GLint size = 1; /* a sampler is basically a texture unit number */
-      GLfloat value;
+      GLfloat value[4];
       GLint numSamplers = 0;
       for (i = 0; i < paramList->NumParameters; i++) {
          if (paramList->Parameters[i].Type == PROGRAM_SAMPLER)
             numSamplers++;
       }
-      value = (GLfloat) numSamplers;
+      value[0] = (GLfloat) numSamplers;
+      value[1] = value[2] = value[3] = 0.0F;
       (void) _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name,
-                                 size, datatype, &value, NULL, 0x0);
+                                 size, datatype, value, NULL, 0x0);
       return numSamplers;
    }
 }




More information about the mesa-commit mailing list