gallium: added draw_num_vs_outputs() to query number of post-transform vertex attribs
authorBrian <brian@i915.localnet.net>
Thu, 28 Feb 2008 01:46:54 +0000 (18:46 -0700)
committerBrian <brian@i915.localnet.net>
Thu, 28 Feb 2008 01:46:54 +0000 (18:46 -0700)
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/drivers/softpipe/sp_state_derived.c

index 64ada8ce047dda5cb85b30f0aa8dd1d7e2288ebe..3500c34811c5fa59309e36574ea8ef3a5b1ae983 100644 (file)
@@ -281,6 +281,19 @@ draw_find_vs_output(struct draw_context *draw,
 }
 
 
+/**
+ * Return number of vertex shader outputs.
+ */
+uint
+draw_num_vs_outputs(struct draw_context *draw)
+{
+   uint count = draw->vertex_shader->info.num_outputs;
+   if (draw->extra_vp_outputs.slot >= 0)
+      count++;
+   return count;
+}
+
+
 /**
  * Allocate space for temporary post-transform vertices, such as for clipping.
  */
index d6685f479b163933fb705af718799b176d3cb571..99bfef55f43e75055873ef8050ead791227ef5fe 100644 (file)
@@ -112,6 +112,10 @@ int
 draw_find_vs_output(struct draw_context *draw,
                     uint semantic_name, uint semantic_index);
 
+uint
+draw_num_vs_outputs(struct draw_context *draw);
+
+
 
 /*
  * Vertex shader functions
index aa6e3291167e1a2f0af1c64197bb3375138d9311..eafbaed4b94e12ba1840c4c01ac42e97c4be5b11 100644 (file)
@@ -61,7 +61,6 @@ 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 sp_fragment_shader *spfs = softpipe->fs;
       const enum interp_mode colorInterp
          = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
@@ -74,7 +73,8 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
          struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
          vinfo_vbuf->num_attribs = 0;
          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;
       }