softpipe: fix memcpy params to avoid static analysis warnings
authorBrian Paul <brianp@vmware.com>
Wed, 10 Mar 2010 20:09:00 +0000 (13:09 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 10 Mar 2010 20:09:03 +0000 (13:09 -0700)
See fd.o bug 26970.  Also added sanity check assertions.

src/gallium/drivers/softpipe/sp_fs_exec.c
src/gallium/drivers/softpipe/sp_fs_sse.c

index 27fa126b7c391e5e8e77e34b74af414b804c9206..67e2c8f8bc4223737fe3b24d0e6a4a7900b810f3 100644 (file)
@@ -145,8 +145,13 @@ exec_run( const struct sp_fragment_shader *base,
          case TGSI_SEMANTIC_COLOR:
             {
                uint cbuf = sem_index[i];
+
+               assert(sizeof(quad->output.color[cbuf]) ==
+                      sizeof(machine->Outputs[i]));
+
+               /* copy float[4][4] result */
                memcpy(quad->output.color[cbuf],
-                      &machine->Outputs[i].xyzw[0].f[0],
+                      &machine->Outputs[i],
                       sizeof(quad->output.color[0]) );
             }
             break;
index acee213670606864fdf399a8bdf094a97151422b..daa158df7c495a2296f1aa8429b939fac8aaacbd 100644 (file)
@@ -156,8 +156,13 @@ fs_sse_run( const struct sp_fragment_shader *base,
          case TGSI_SEMANTIC_COLOR:
             {
                uint cbuf = sem_index[i];
+
+               assert(sizeof(quad->output.color[cbuf]) ==
+                      sizeof(machine->Outputs[i]));
+
+               /* copy float[4][4] result */
                memcpy(quad->output.color[cbuf],
-                      &machine->Outputs[i].xyzw[0].f[0],
+                      &machine->Outputs[i],
                       sizeof(quad->output.color[0]) );
             }
             break;