gallium: fix some compiler warnings
[mesa.git] / src / gallium / drivers / softpipe / sp_state_derived.c
index 4c6313001f4c5ddeba51f0d8170d74c6da3d8fef..82cb31ece73ea934bf2be6e44f155654be63270f 100644 (file)
@@ -61,8 +61,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
 
    if (vinfo->num_attribs == 0) {
       /* compute vertex layout now */
-      const struct pipe_shader_state *vs = &softpipe->vs->shader;
-      const struct pipe_shader_state *fs = &softpipe->fs->shader;
+      const struct sp_fragment_shader *spfs = softpipe->fs;
       const enum interp_mode colorInterp
          = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
       uint i;
@@ -72,10 +71,25 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
           * simply emit the whole post-xform vertex as-is:
           */
          struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
+#if 0
          vinfo_vbuf->num_attribs = 0;
+         /* special-case to allow memcpy of whole vertex */
          draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0);
-         vinfo_vbuf->size = 4 * vs->num_outputs
+         /* size in dwords or floats */
+         vinfo_vbuf->size = 4 * draw_num_vs_outputs(softpipe->draw)
                           + sizeof(struct vertex_header) / 4;
+#else
+         /* for pass-through mode, we need a more explicit list of attribs */
+         const uint num = draw_num_vs_outputs(softpipe->draw);
+         uint i;
+
+         vinfo_vbuf->num_attribs = 0;
+         draw_emit_vertex_attr(vinfo_vbuf, EMIT_HEADER, INTERP_NONE, 0);
+         for (i = 0; i < num; i++) {
+            draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i);
+         }
+         draw_compute_vertex_size(vinfo_vbuf);
+#endif
       }
 
       /*
@@ -83,9 +97,9 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
        * from the vertex shader.
        */
       vinfo->num_attribs = 0;
-      for (i = 0; i < fs->num_inputs; i++) {
+      for (i = 0; i < spfs->info.num_inputs; i++) {
          int src;
-         switch (fs->input_semantic_name[i]) {
+         switch (spfs->info.input_semantic_name[i]) {
          case TGSI_SEMANTIC_POSITION:
             src = draw_find_vs_output(softpipe->draw,
                                       TGSI_SEMANTIC_POSITION, 0);
@@ -94,7 +108,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
 
          case TGSI_SEMANTIC_COLOR:
             src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_COLOR, 
-                                 fs->input_semantic_index[i]);
+                                 spfs->info.input_semantic_index[i]);
             draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
             break;
 
@@ -106,7 +120,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
          case TGSI_SEMANTIC_GENERIC:
             /* this includes texcoords and varying vars */
             src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC,
-                                 fs->input_semantic_index[i]);
+                                      spfs->info.input_semantic_index[i]);
             draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
             break;