summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_context.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2013-08-02 01:39:35 -0400
committerZack Rusin <zackr@vmware.com>2013-08-02 20:11:18 -0400
commit05487ef88ded5fea0b1de7bc08d44846648d1ce2 (patch)
tree5a97df0f2d48c4c6e008be4eba0922d99a5304fb /src/gallium/auxiliary/draw/draw_context.c
parent2e46a1dcb33618f2873ebaaeb3ffe238f11a31a3 (diff)
downloadexternal_mesa3d-05487ef88ded5fea0b1de7bc08d44846648d1ce2.tar.gz
external_mesa3d-05487ef88ded5fea0b1de7bc08d44846648d1ce2.tar.bz2
external_mesa3d-05487ef88ded5fea0b1de7bc08d44846648d1ce2.zip
draw: stop crashing with extra shader outputs
Draw sometimes injects extra shader outputs (aa points, lines or front face), unfortunately most of the pipeline and llvm code didn't handle them at all. It only worked if number of inputs happened to be bigger or equal to the number of shader outputs plus the extra injected outputs. In particular when running the pipeline which depends on the vertex_id in the vertex_header things were completely broken. The patch adjust the code to correctly use the total number of shader outputs (the standard ones plus the injected ones) to make it all stop crashing and work. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 4a6ba1ac42..29bbc94d0a 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -605,6 +605,40 @@ draw_num_shader_outputs(const struct draw_context *draw)
/**
+ * Return total number of the vertex shader outputs. This function
+ * also counts any extra vertex output attributes that may
+ * be filled in by some draw stages (such as AA point, AA line,
+ * front face).
+ */
+uint
+draw_total_vs_outputs(const struct draw_context *draw)
+{
+ const struct tgsi_shader_info *info = &draw->vs.vertex_shader->info;
+
+ return info->num_outputs + draw->extra_shader_outputs.num;;
+}
+
+/**
+ * Return total number of the geometry shader outputs. This function
+ * also counts any extra geometry output attributes that may
+ * be filled in by some draw stages (such as AA point, AA line, front
+ * face).
+ */
+uint
+draw_total_gs_outputs(const struct draw_context *draw)
+{
+ const struct tgsi_shader_info *info;
+
+ if (!draw->gs.geometry_shader)
+ return 0;
+
+ info = &draw->gs.geometry_shader->info;
+
+ return info->num_outputs + draw->extra_shader_outputs.num;
+}
+
+
+/**
* Provide TGSI sampler objects for vertex/geometry shaders that use
* texture fetches. This state only needs to be set once per context.
* This might only be used by software drivers for the time being.