aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_draw.cpp
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2017-09-13 21:06:44 -0500
committerGeorge Kyriazis <[email protected]>2017-09-26 18:09:15 -0500
commitb9aa0fa7d646f9ebb0a2e08d262c2eebfd875610 (patch)
treeb0a1dff425b91d5aef6657ef65d6f0fbe0e02fa6 /src/gallium/drivers/swr/swr_draw.cpp
parent016de7e15597c232fb9c300f41629a2d88841905 (diff)
swr: Handle resource across context changes
Swr caches fb contents in tiles. Those tiles are stored on a per-context basis. When switching contexts that share resources we need to make sure that the tiles of the old context are being stored and the tiles of the new context are being invalidated (marked as invalid, hence contents need to be reloaded). The context does not get any dirty bits to identify this case. This has to be, then, coordinated by the resources that are being shared between the contexts. Add a "curr_pipe" hook in swr_resource that will allow us to identify a MakeCurrent of the above form during swr_update_derived(). At that time, we invalidate the tiles of the new context. The old context, will need to have already store its tiles by that time, which happens during glFlush(). glFlush() is being called at the beginning of MakeCurrent. So, the sequence of operations is: - At the beginning of glXMakeCurrent(), glFlush() will store the tiles of all bound surfaces of the old context. - After the store, a fence will guarantee that the all tile store make it to the surface - During swr_update_derived(), when we validate the new context, we check all resources to see what changed, and if so, we invalidate the current tiles. Fixes rendering problems with CEI/Ensight. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_draw.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_draw.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp
index d7f24d6e346..57660c7464d 100644
--- a/src/gallium/drivers/swr/swr_draw.cpp
+++ b/src/gallium/drivers/swr/swr_draw.cpp
@@ -239,14 +239,17 @@ swr_flush(struct pipe_context *pipe,
{
struct swr_context *ctx = swr_context(pipe);
struct swr_screen *screen = swr_screen(pipe->screen);
- struct pipe_surface *cb = ctx->framebuffer.cbufs[0];
-
- /* If the current renderTarget is the display surface, store tiles back to
- * the surface, in preparation for present (swr_flush_frontbuffer).
- * Other renderTargets get stored back when attachment changes or
- * swr_surface_destroy */
- if (cb && swr_resource(cb->texture)->display_target)
- swr_store_dirty_resource(pipe, cb->texture, SWR_TILE_RESOLVED);
+
+ for (int i=0; i < ctx->framebuffer.nr_cbufs; i++) {
+ struct pipe_surface *cb = ctx->framebuffer.cbufs[i];
+ if (cb) {
+ swr_store_dirty_resource(pipe, cb->texture, SWR_TILE_RESOLVED);
+ }
+ }
+ if (ctx->framebuffer.zsbuf) {
+ swr_store_dirty_resource(pipe, ctx->framebuffer.zsbuf->texture,
+ SWR_TILE_RESOLVED);
+ }
if (fence)
swr_fence_reference(pipe->screen, fence, screen->flush_fence);