aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.h
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-06-01 19:10:08 +0200
committerMathias Fröhlich <[email protected]>2018-06-05 07:05:24 +0200
commit1ac4439d6278e6c5f9da5499bbc50362f0c6759b (patch)
tree036f347b512becd479d16164b5b4100e20e7ef9a /src/mesa/main/context.h
parenta7b74a77fa63efe6d6462ff4f201bea03fa23a33 (diff)
mesa: Make sure that imm draws are flushed before other draws execute.
The recent patch mesa: Remove FLUSH_VERTICES from VAO state changes. Pending draw calls on immediate mode or display list calls do not depend on changes of the VAO state. So, remove calls to FLUSH_VERTICES and flag _NEW_ARRAY as appropriate. uncovered a problem that non immediate mode draw calls do only flush outstanding immediate mode draws if FLUSH_UPDATE_CURRENT is set in ctx->Driver.NeedFlush. In that case, due to the sequence of _mesa_set_draw_vao commands we could end up with the VAO from the FLUSH_VERTICES call set into gl_context::Array._DrawVAO when the array draw is executed. So the change pulls FLUSH_CURRENT out of _mesa_validate_* calls into the array draw calls being validated. The change introduces a new macro FLUSH_FOR_DRAW beside FLUSH_VERTICES and FLUSH_CURRENT that flushes on changed current attributes as well as on outstanding immediate mode draw calls. Use FLUSH_FOR_DRAW in the non immediate mode draw code paths. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Kai Wasserbäch <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106594 Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/main/context.h')
-rw-r--r--src/mesa/main/context.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 77520f678ff..d50438fd7f9 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -233,6 +233,22 @@ do { \
} while (0)
/**
+ * Flush vertices.
+ *
+ * \param ctx GL context.
+ *
+ * Checks if dd_function_table::NeedFlush is marked to flush stored vertices
+ * or current state and calls dd_function_table::FlushVertices if so.
+ */
+#define FLUSH_FOR_DRAW(ctx) \
+do { \
+ if (MESA_VERBOSE & VERBOSE_STATE) \
+ _mesa_debug(ctx, "FLUSH_FOR_DRAW in %s\n", __func__); \
+ if (ctx->Driver.NeedFlush) \
+ vbo_exec_FlushVertices(ctx, ctx->Driver.NeedFlush); \
+} while (0)
+
+/**
* Macro to assert that the API call was made outside the
* glBegin()/glEnd() pair, with return value.
*