Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
authorBrian Paul <brianp@vmware.com>
Fri, 11 Dec 2009 16:22:00 +0000 (09:22 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 11 Dec 2009 16:22:00 +0000 (09:22 -0700)
18 files changed:
progs/samples/rgbtoppm.c
progs/util/readtex.c
src/gallium/auxiliary/rbug/rbug_connection.c
src/mesa/drivers/dri/i915/i915_debug.c
src/mesa/drivers/dri/r600/r700_chip.c
src/mesa/main/fog.c
src/mesa/main/light.c
src/mesa/main/points.c
src/mesa/main/texgen.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/shader/nvfragparse.c
src/mesa/shader/prog_parameter.c
src/mesa/shader/program.c
src/mesa/shader/slang/slang_compile_operation.h
src/mesa/shader/slang/slang_simplify.c
src/mesa/sparc/xform.S
src/mesa/vbo/vbo_exec_eval.c

index 56ca5b0efe9e0e9753cab41a221ed2854d4df23c..dcb74228dfffde8743d802a6306e5070a836eed4 100644 (file)
@@ -93,7 +93,12 @@ static ImageRec *ImageOpen(char *fileName)
     fread(image, 1, 12, image->file);
 
     if (swapFlag) {
-        ConvertShort(&image->imagic, 6);
+        ConvertShort(&image->imagic, 1);
+        ConvertShort(&image->type, 1);
+        ConvertShort(&image->dim, 1);
+        ConvertShort(&image->xsize, 1);
+        ConvertShort(&image->ysize, 1);
+        ConvertShort(&image->zsize, 1);
     }
 
     image->tmp = (unsigned char *)malloc(image->xsize*256);
index 81cb626e911d5a4c501eec11fadfec0506ec45f8..d1c50a494aa3350dcadf2e02f67edb4ec00db5a7 100644 (file)
@@ -117,7 +117,12 @@ static rawImageRec *RawImageOpen(const char *fileName)
    fread(raw, 1, 12, raw->file);
 
    if (swapFlag) {
-      ConvertShort(&raw->imagic, 6);
+      ConvertShort(&raw->imagic, 1);
+      ConvertShort(&raw->type, 1);
+      ConvertShort(&raw->dim, 1);
+      ConvertShort(&raw->sizeX, 1);
+      ConvertShort(&raw->sizeY, 1);
+      ConvertShort(&raw->sizeZ, 1);
    }
 
    raw->tmp = (unsigned char *)malloc(raw->sizeX*256);
index 52acb700af9575cfc361695e53f6ba060ac0825c..ae4e27f9f6b99dd6b3122aa4d1e781f610ae2e21 100644 (file)
@@ -87,6 +87,7 @@ rbug_get_message(struct rbug_connection *c, uint32_t *serial)
    if (!data) {
       return NULL;
    }
+   data->opcode = 0;
 
    do {
       uint8_t *ptr = ((uint8_t*)data) + read;
index f7bb7ea44c9338ae4933d4551efb7d894142e8b3..fecfac30339cde498a5186173ab091dfb4ea9cfc 100644 (file)
@@ -806,6 +806,7 @@ static GLboolean i915_debug_packet( struct debug_stream *stream )
       default:
         return debug(stream, "", 0);
       }
+      break;
    default:
       assert(0);
       return 0;
index 8538e3582b1cdd513935166a9b030a8a8ffe88bd..02c56b98d9b224a044a118583248c74fa9ab8149 100644 (file)
@@ -1154,7 +1154,11 @@ static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom)
                count += 3;
 
        if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) {
-               for (ui = 0; ui < R700_MAX_RENDER_TARGETS; ui++) {
+               /* targets are enabled in r700SetRenderTarget but state
+                  size is calculated before that. Until MRT's are done
+                  hardcode target0 as enabled. */
+               count += 3;
+               for (ui = 1; ui < R700_MAX_RENDER_TARGETS; ui++) {
                         if (r700->render_target[ui].enabled)
                                count += 3;
                }
index 4323d3db8206a19c57a038f482e67164bd57d04d..269ff3f8b993bf5a33e11df4aec7bae83ac3f978 100644 (file)
 void GLAPIENTRY
 _mesa_Fogf(GLenum pname, GLfloat param)
 {
-   _mesa_Fogfv(pname, &param);
+   GLfloat fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_Fogfv(pname, fparam);
 }
 
 
 void GLAPIENTRY
 _mesa_Fogi(GLenum pname, GLint param )
 {
-   GLfloat fparam = (GLfloat) param;
-   _mesa_Fogfv(pname, &fparam);
+   GLfloat fparam[4];
+   fparam[0] = (GLfloat) param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_Fogfv(pname, fparam);
 }
 
 
index 1c8a081e9a66583f731da9e938af5fd6838ce5ef..654faa5c770d1202638a9dee0858b877a2fdfc0f 100644 (file)
@@ -206,7 +206,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
 void GLAPIENTRY
 _mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
 {
-   _mesa_Lightfv( light, pname, &param );
+   GLfloat fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_Lightfv( light, pname, fparam );
 }
 
 
@@ -285,7 +288,10 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
 void GLAPIENTRY
 _mesa_Lighti( GLenum light, GLenum pname, GLint param )
 {
-   _mesa_Lightiv( light, pname, &param );
+   GLint iparam[4];
+   iparam[0] = param;
+   iparam[1] = iparam[2] = iparam[3] = 0;
+   _mesa_Lightiv( light, pname, iparam );
 }
 
 
@@ -537,14 +543,20 @@ _mesa_LightModeliv( GLenum pname, const GLint *params )
 void GLAPIENTRY
 _mesa_LightModeli( GLenum pname, GLint param )
 {
-   _mesa_LightModeliv( pname, &param );
+   GLint iparam[4];
+   iparam[0] = param;
+   iparam[1] = iparam[2] = iparam[3] = 0;
+   _mesa_LightModeliv( pname, iparam );
 }
 
 
 void GLAPIENTRY
 _mesa_LightModelf( GLenum pname, GLfloat param )
 {
-   _mesa_LightModelfv( pname, &param );
+   GLfloat fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_LightModelfv( pname, fparam );
 }
 
 
index b3305448904a9e045f3c1cb095941d1280a93e46..dcaeccd90d4df4747320fae12024ee7f9065295d 100644 (file)
@@ -69,8 +69,10 @@ _mesa_PointSize( GLfloat size )
 void GLAPIENTRY
 _mesa_PointParameteri( GLenum pname, GLint param )
 {
-   const GLfloat value = (GLfloat) param;
-   _mesa_PointParameterfv(pname, &value);
+   GLfloat p[3];
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
@@ -90,7 +92,10 @@ _mesa_PointParameteriv( GLenum pname, const GLint *params )
 void GLAPIENTRY
 _mesa_PointParameterf( GLenum pname, GLfloat param)
 {
-   _mesa_PointParameterfv(pname, &param);
+   GLfloat p[3];
+   p[0] = param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
index 5abb1ff0ab60a772448230e657b4b9d5c43317ff..be4e03bc56c328d98d3027b24d0cd277ffecfcf7 100644 (file)
@@ -186,8 +186,10 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
 static void GLAPIENTRY
 _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
 {
-   GLfloat p = (GLfloat) param;
-   _mesa_TexGenfv( coord, pname, &p );
+   GLfloat p[4];
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = p[3] = 0.0F;
+   _mesa_TexGenfv( coord, pname, p );
 }
 
 
index aaccc03a7c6759eb84b4d9727d92aa09bc9779ef..237b6eb00d4391d4e7e97c6c1390026c5c418888 100644 (file)
@@ -415,7 +415,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
    /* Detect cases where the application set the base level to an invalid
     * value.
     */
-   if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) {
+   if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
       char s[100];
       _mesa_sprintf(s, "base level = %d is invalid", baseLevel);
       incomplete(t, s);
index 310d594cd55517e4d420a8c4b042aaa260b598a4..db4c7a5edad8a9c6ed8abd4c727b11eee0324962 100644 (file)
@@ -595,8 +595,10 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
    case GL_DEPTH_TEXTURE_MODE_ARB:
       {
          /* convert float param to int */
-         GLint p = (GLint) params[0];
-         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
+         GLint p[4];
+         p[0] = (GLint) params[0];
+         p[1] = p[2] = p[3] = 0;
+         need_update = set_tex_parameteri(ctx, texObj, pname, p);
       }
       break;
 
@@ -645,14 +647,21 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
    case GL_TEXTURE_LOD_BIAS:
    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
       {
-         GLfloat fparam = (GLfloat) param;
+         GLfloat fparam[4];
+         fparam[0] = (GLfloat) param;
+         fparam[1] = fparam[2] = fparam[3] = 0.0F;
          /* convert int param to float */
-         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
+         need_update = set_tex_parameterf(ctx, texObj, pname, fparam);
       }
       break;
    default:
       /* this will generate an error if pname is illegal */
-      need_update = set_tex_parameteri(ctx, texObj, pname, &param);
+      {
+         GLint iparam[4];
+         iparam[0] = param;
+         iparam[1] = iparam[2] = iparam[3] = 0;
+         need_update = set_tex_parameteri(ctx, texObj, pname, iparam);
+      }
    }
 
    if (ctx->Driver.TexParameter && need_update) {
@@ -694,8 +703,10 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
       {
          /* convert int param to float */
-         GLfloat fparam = (GLfloat) params[0];
-         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
+         GLfloat fparams[4];
+         fparams[0] = (GLfloat) params[0];
+         fparams[1] = fparams[2] = fparams[3] = 0.0F;
+         need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
       }
       break;
    default:
index 0fd55524abf19e03807a5342f12491ed4ddd55ae..b739a6aa07c951e57bd9838159149beb07aa2597 100644 (file)
@@ -217,6 +217,12 @@ MatchInstruction(const GLubyte *token)
    const struct instruction_pattern *inst;
    struct instruction_pattern result;
 
+   result.name = NULL;
+   result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
+   result.inputs = 0;
+   result.outputs = 0;
+   result.suffixes = 0;
+
    for (inst = Instructions; inst->name; inst++) {
       if (_mesa_strncmp((const char *) token, inst->name, 3) == 0) {
          /* matched! */
@@ -247,7 +253,7 @@ MatchInstruction(const GLubyte *token)
          return result;
       }
    }
-   result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
+
    return result;
 }
 
index 2f029b02e50a61bb13efce004d08dec75ca472cc..f22492e029e3a5e1c23a53f619bdf3b82a1e9308 100644 (file)
@@ -500,7 +500,7 @@ GLfloat *
 _mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
                              GLsizei nameLen, const char *name)
 {
-   GLuint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
+   GLint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
    if (i < 0)
       return NULL;
    else
index 532adf4d3600c1350e443c9ad135da4fcde6ddf7..6b8d94e66142354c0a09ef86e88e120372c496bd 100644 (file)
@@ -806,9 +806,17 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile)
       const struct prog_instruction *inst = prog->Instructions + i;
       const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
 
-      for (k = 0; k < n; k++) {
-         if (inst->SrcReg[k].File == regFile) {
-            used[inst->SrcReg[k].Index] = GL_TRUE;
+      /* check dst reg first */
+      if (inst->DstReg.File == regFile) {
+         used[inst->DstReg.Index] = GL_TRUE;
+      }
+      else {
+         /* check src regs otherwise */
+         for (k = 0; k < n; k++) {
+            if (inst->SrcReg[k].File == regFile) {
+               used[inst->SrcReg[k].Index] = GL_TRUE;
+               break;
+            }
          }
       }
    }
index 58f1edeed85f4b8199c6501f18238d8cddb464ae..1f15c1989637aecb1860a2da3d20372b7833ee78 100644 (file)
@@ -127,7 +127,6 @@ typedef struct slang_operation_
     * indicate such.  num_children indicates number of elements.
     */
    GLboolean array_constructor;
-   double x;
 } slang_operation;
 
 
index b8a21f642cb1375cf5938c26bb51e45e534e33b4..13b9ca3c877c73860a24adf5fd7021e3f553b183 100644 (file)
@@ -84,10 +84,11 @@ _slang_lookup_constant(const char *name)
    for (i = 0; info[i].Name; i++) {
       if (strcmp(info[i].Name, name) == 0) {
          /* found */
-         GLint value = -1;
-         _mesa_GetIntegerv(info[i].Token, &value);
-         ASSERT(value >= 0);  /* sanity check that glGetFloatv worked */
-         return value;
+         GLint values[16];
+         values[0] = -1;
+         _mesa_GetIntegerv(info[i].Token, values);
+         ASSERT(values[0] >= 0);  /* sanity check that glGetFloatv worked */
+         return values[0];
       }
    }
    return -1;
index f2b9674bf2d7b28185764eaa1b5a8339d2d9b94e..2a7cce41e5ad78b19e44df54432295121d9c1836 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "sparc_matrix.h"
 
-#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)
+#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) || defined(__arch64__)
        /* Solaris requires this for 64-bit. */
         .register %g2, #scratch
         .register %g3, #scratch
index 0c691b3a5cdc50fe2d65d8e45fe5c492e2538fa3..a7846213d0ce71a91f89ae01c84eac49a1db264f 100644 (file)
 
 static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr ) 
 {
+   assert(attr < Elements(exec->eval.map1));
    exec->eval.map1[attr].map = NULL;
 }
 
 static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr ) 
 {
+   assert(attr < Elements(exec->eval.map2));
    exec->eval.map2[attr].map = NULL;
 }
 
 static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim, 
                              struct gl_1d_map *map )
 {
+   assert(attr < Elements(exec->eval.map1));
    if (!exec->eval.map1[attr].map) {
       exec->eval.map1[attr].map = map;
       exec->eval.map1[attr].sz = dim;
@@ -55,6 +58,7 @@ static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint
 static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim, 
                              struct gl_2d_map *map )
 {
+   assert(attr < Elements(exec->eval.map2));
    if (!exec->eval.map2[attr].map) {
       exec->eval.map2[attr].map = map;
       exec->eval.map2[attr].sz = dim;
@@ -73,18 +77,6 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec )
       clear_active_eval2( exec, attr );
    }
 
-   /* _NEW_PROGRAM */
-   if (ctx->VertexProgram._Enabled) {
-      for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) {
-        /* _NEW_EVAL */
-        if (ctx->Eval.Map1Attrib[attr]) 
-           set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] );
-
-        if (ctx->Eval.Map2Attrib[attr]) 
-           set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] );
-      }
-   }
-
    if (ctx->Eval.Map1Color4) 
       set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );
       
@@ -125,6 +117,23 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec )
    else if (ctx->Eval.Map2Vertex3) 
       set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );
 
+   /* _NEW_PROGRAM */
+   if (ctx->VertexProgram._Enabled) {
+      /* These are the 16 evaluators which GL_NV_vertex_program defines.
+       * They alias and override the conventional vertex attributs.
+       */
+      for (attr = 0; attr < 16; attr++) {
+         /* _NEW_EVAL */
+         assert(attr < Elements(ctx->Eval.Map1Attrib));
+         if (ctx->Eval.Map1Attrib[attr]) 
+            set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] );
+
+         assert(attr < Elements(ctx->Eval.Map2Attrib));
+         if (ctx->Eval.Map2Attrib[attr]) 
+            set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] );
+      }
+   }
+
    exec->eval.recalculate_maps = 0;
 }