aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-27 18:46:54 -0700
committerBrian <[email protected]>2008-02-27 18:46:54 -0700
commit1774b177b858f9f87d00e54b0bf00e9634e375e9 (patch)
treed657dba4bcadf9bedaac1bcbba3f4b56e7fc593a
parent627efcaa8009bb7ed6a7f266f8122df800bb2706 (diff)
gallium: added draw_num_vs_outputs() to query number of post-transform vertex attribs
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_state_derived.c4
3 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 64ada8ce047..3500c34811c 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -282,6 +282,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.
*/
void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr )
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index d6685f479b1..99bfef55f43 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -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
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
index aa6e3291167..eafbaed4b94 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -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;
}