diff options
author | Mathias Fröhlich <[email protected]> | 2018-06-01 19:10:08 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-06-05 07:05:24 +0200 |
commit | 1ac4439d6278e6c5f9da5499bbc50362f0c6759b (patch) | |
tree | 036f347b512becd479d16164b5b4100e20e7ef9a /src/mesa/vbo/vbo_exec_array.c | |
parent | a7b74a77fa63efe6d6462ff4f201bea03fa23a33 (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/vbo/vbo_exec_array.c')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index e74e1bd458c..792907ac044 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -530,9 +530,9 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n", _mesa_enum_to_string(mode), start, count); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -568,10 +568,9 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n", _mesa_enum_to_string(mode), start, count, numInstances); + FLUSH_FOR_DRAW(ctx); if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); - _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -610,9 +609,9 @@ vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first, _mesa_enum_to_string(mode), first, count, numInstances, baseInstance); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -650,9 +649,9 @@ vbo_exec_MultiDrawArrays(GLenum mode, const GLint *first, "glMultiDrawArrays(%s, %p, %p, %d)\n", _mesa_enum_to_string(mode), first, count, primcount); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -873,9 +872,9 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, _mesa_enum_to_string(mode), start, end, count, _mesa_enum_to_string(type), indices, basevertex); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -984,9 +983,9 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, _mesa_enum_to_string(mode), count, _mesa_enum_to_string(type), indices); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1017,9 +1016,9 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, _mesa_enum_to_string(mode), count, _mesa_enum_to_string(type), indices); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1050,9 +1049,9 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, _mesa_enum_to_string(mode), count, _mesa_enum_to_string(type), indices); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1089,9 +1088,9 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, _mesa_enum_to_string(type), indices, numInstances, basevertex); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1130,9 +1129,9 @@ vbo_exec_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, _mesa_enum_to_string(type), indices, numInstances, baseInstance); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1173,9 +1172,9 @@ vbo_exec_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, _mesa_enum_to_string(type), indices, numInstances, basevertex, baseInstance); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1337,6 +1336,8 @@ vbo_exec_MultiDrawElements(GLenum mode, { GET_CURRENT_CONTEXT(ctx); + FLUSH_FOR_DRAW(ctx); + _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices, @@ -1360,9 +1361,9 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, { GET_CURRENT_CONTEXT(ctx); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1398,9 +1399,9 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, { struct _mesa_prim prim; - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1615,9 +1616,9 @@ vbo_exec_DrawArraysIndirect(GLenum mode, const GLvoid *indirect) _mesa_debug(ctx, "glDrawArraysIndirect(%s, %p)\n", _mesa_enum_to_string(mode), indirect); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1646,9 +1647,9 @@ vbo_exec_DrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect) _mesa_enum_to_string(mode), _mesa_enum_to_string(type), indirect); - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1681,9 +1682,9 @@ vbo_exec_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect, if (stride == 0) stride = 4 * sizeof(GLuint); /* sizeof(DrawArraysIndirectCommand) */ - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1720,9 +1721,9 @@ vbo_exec_MultiDrawElementsIndirect(GLenum mode, GLenum type, if (stride == 0) stride = 5 * sizeof(GLuint); /* sizeof(DrawElementsIndirectCommand) */ - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1815,9 +1816,9 @@ vbo_exec_MultiDrawArraysIndirectCount(GLenum mode, GLintptr indirect, if (stride == 0) stride = 4 * sizeof(GLuint); /* sizeof(DrawArraysIndirectCommand) */ - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) @@ -1860,9 +1861,9 @@ vbo_exec_MultiDrawElementsIndirectCount(GLenum mode, GLenum type, if (stride == 0) stride = 5 * sizeof(GLuint); /* sizeof(DrawElementsIndirectCommand) */ - if (_mesa_is_no_error_enabled(ctx)) { - FLUSH_CURRENT(ctx, 0); + FLUSH_FOR_DRAW(ctx); + if (_mesa_is_no_error_enabled(ctx)) { _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx)); if (ctx->NewState) |