summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen6_sol.c
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2011-12-09 16:40:32 -0800
committerPaul Berry <stereotype441@gmail.com>2011-12-20 15:00:29 -0800
commit63cf7fad13fc9cfdd2ae7b031426f79107000300 (patch)
tree1db2139bac237abcd17886292b9bd51e97583934 /src/mesa/drivers/dri/i965/gen6_sol.c
parentc3161b629f342b21756f4fdb4414417b82d3e033 (diff)
downloadexternal_mesa3d-63cf7fad13fc9cfdd2ae7b031426f79107000300.zip
external_mesa3d-63cf7fad13fc9cfdd2ae7b031426f79107000300.tar.gz
external_mesa3d-63cf7fad13fc9cfdd2ae7b031426f79107000300.tar.bz2
i965: Flush pipeline on EndTransformFeedback.
A common use case for transform feedback is to perform one draw operation that writes transform feedback output to a buffer, followed by a second draw operation that consumes that buffer as vertex input. Since vertex input is consumed at an earlier pipeline stage than writing transform feedback output, we need to flush the pipeline to ensure that the transform feedback output is completely written before the data is consumed. In an ideal world, we would do some dependency tracking, so that we would only flush the pipeline if the next draw call was about to consume data generated by a previous draw call in the same batch. However, since we don't have that sort of dependency tracking infrastructure right now, we just unconditionally flush the buffer every time glEndTransformFeedback() is called. This will cause a performance hit compared to the ideal case (since we will sometimes flush the pipeline unnecessarily), but fortunately the performance hit will be confined to circumstances where transform feedback is in use. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_sol.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sol.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 491b39c..38aedcc 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -27,6 +27,7 @@
*/
#include "brw_context.h"
+#include "intel_batchbuffer.h"
#include "brw_defines.h"
static void
@@ -69,3 +70,18 @@ const struct brw_tracked_state gen6_sol_surface = {
},
.emit = gen6_update_sol_surfaces,
};
+
+void
+brw_end_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj)
+{
+ /* After EndTransformFeedback, it's likely that the client program will try
+ * to draw using the contents of the transform feedback buffer as vertex
+ * input. In order for this to work, we need to flush the data through at
+ * least the GS stage of the pipeline, and flush out the render cache. For
+ * simplicity, just do a full flush.
+ */
+ struct brw_context *brw = brw_context(ctx);
+ struct intel_context *intel = &brw->intel;
+ intel_batchbuffer_emit_mi_flush(intel);
+}