Mesa (master): mesa: added const qualifiers, move local var

Brian Paul brianp at kemper.freedesktop.org
Mon Aug 31 17:23:23 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Aug 31 11:17:59 2009 -0600

mesa: added const qualifiers, move local var

---

 src/mesa/main/texenvprogram.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 847db5c..3e5d65c 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -952,7 +952,7 @@ static struct ureg emit_combine_source( struct texenv_fragment_program *p,
    }
 }
 
-static GLboolean args_match( struct state_key *key, GLuint unit )
+static GLboolean args_match( const struct state_key *key, GLuint unit )
 {
    GLuint i, nr = key->unit[unit].NumArgsRGB;
 
@@ -1112,11 +1112,10 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
 static struct ureg
 emit_texenv(struct texenv_fragment_program *p, GLuint unit)
 {
-   struct state_key *key = p->state;
+   const struct state_key *key = p->state;
    GLboolean saturate;
    GLuint rgb_shift, alpha_shift;
-   struct ureg out, shift;
-   struct ureg dest;
+   struct ureg out, dest;
 
    if (!key->unit[unit].enabled) {
       return get_source(p, SRC_PREVIOUS, 0);
@@ -1168,7 +1167,6 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
    }
    else if (key->unit[unit].ModeRGB == MODE_DOT3_RGBA_EXT ||
 	    key->unit[unit].ModeRGB == MODE_DOT3_RGBA) {
-
       out = emit_combine( p, dest, WRITEMASK_XYZW, saturate,
 			  unit,
 			  key->unit[unit].NumArgsRGB,
@@ -1194,7 +1192,10 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
    /* Deal with the final shift:
     */
    if (alpha_shift || rgb_shift) {
+      struct ureg shift;
+
       saturate = GL_TRUE;  /* always saturate at this point */
+
       if (rgb_shift == alpha_shift) {
 	 shift = register_scalar_const(p, (GLfloat)(1<<rgb_shift));
       }
@@ -1294,7 +1295,7 @@ static GLboolean load_texenv_source( struct texenv_fragment_program *p,
 static GLboolean
 load_texunit_sources( struct texenv_fragment_program *p, int unit )
 {
-   struct state_key *key = p->state;
+   const struct state_key *key = p->state;
    GLuint i;
 
    for (i = 0; i < key->unit[unit].NumArgsRGB; i++) {
@@ -1314,7 +1315,7 @@ load_texunit_sources( struct texenv_fragment_program *p, int unit )
 static GLboolean
 load_texunit_bumpmap( struct texenv_fragment_program *p, int unit )
 {
-   struct state_key *key = p->state;
+   const struct state_key *key = p->state;
    GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0;
    struct ureg texcDst, bumpMapRes;
    struct ureg constdudvcolor = register_const4f(p, 0.0, 0.0, 0.0, 1.0);




More information about the mesa-commit mailing list