summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-11-12 14:20:53 -0500
committerIlia Mirkin <[email protected]>2016-11-15 20:25:48 -0500
commita2c1d58ddbd77692a1c07a3e7606f6472722a93c (patch)
treea8e4651c8c7ef24afb5bba171e3a3eacfe4db501
parent7caed50ff4224b0966bae7628cf99f8163cac4dc (diff)
swr: make sure that all rendering is finished on shader destroy
Rendering could still be ongoing (or have yet to start) when the shader is deleted. There's no refcounting on the shader text, so insert a pipeline stall unconditionally when this happens. [Note, we should instead introduce a way to attach work to fences, so that the freeing can be done in the current fence.] Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Bruce Cherniak <[email protected]>
-rw-r--r--src/gallium/drivers/swr/swr_state.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index 783afba2b42..c1beeebeda1 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -371,6 +371,10 @@ swr_delete_vs_state(struct pipe_context *pipe, void *vs)
{
struct swr_vertex_shader *swr_vs = (swr_vertex_shader *)vs;
FREE((void *)swr_vs->pipe.tokens);
+ struct swr_screen *screen = swr_screen(pipe->screen);
+ if (!swr_is_fence_pending(screen->flush_fence))
+ swr_fence_submit(swr_context(pipe), screen->flush_fence);
+ swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
delete swr_vs;
}
@@ -407,6 +411,10 @@ swr_delete_fs_state(struct pipe_context *pipe, void *fs)
{
struct swr_fragment_shader *swr_fs = (swr_fragment_shader *)fs;
FREE((void *)swr_fs->pipe.tokens);
+ struct swr_screen *screen = swr_screen(pipe->screen);
+ if (!swr_is_fence_pending(screen->flush_fence))
+ swr_fence_submit(swr_context(pipe), screen->flush_fence);
+ swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
delete swr_fs;
}