diff options
-rw-r--r-- | src/gallium/drivers/swr/swr_draw.cpp | 19 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_resource.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_state.cpp | 5 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp index 4e6426d7ec0..f85076b74cc 100644 --- a/src/gallium/drivers/swr/swr_draw.cpp +++ b/src/gallium/drivers/swr/swr_draw.cpp @@ -219,6 +219,25 @@ swr_finish(struct pipe_context *pipe) swr_fence_reference(pipe->screen, &fence, NULL); } +/* + * Invalidate tiles so they can be reloaded back when needed + */ +void +swr_invalidate_render_target(struct pipe_context *pipe, + uint32_t attachment, + uint16_t width, uint16_t height) +{ + struct swr_context *ctx = swr_context(pipe); + + /* grab the rect from the passed in arguments */ + swr_update_draw_context(ctx); + SWR_RECT full_rect = + {0, 0, (int32_t)width, (int32_t)height}; + SwrInvalidateTiles(ctx->swrContext, + 1 << attachment, + full_rect); +} + /* * Store SWR HotTiles back to renderTarget surface. diff --git a/src/gallium/drivers/swr/swr_resource.h b/src/gallium/drivers/swr/swr_resource.h index ae9954c1e7d..4effd4604f4 100644 --- a/src/gallium/drivers/swr/swr_resource.h +++ b/src/gallium/drivers/swr/swr_resource.h @@ -96,6 +96,10 @@ swr_resource_data(struct pipe_resource *resource) } +void swr_invalidate_render_target(struct pipe_context *pipe, + uint32_t attachment, + uint16_t width, uint16_t height); + void swr_store_render_target(struct pipe_context *pipe, uint32_t attachment, enum SWR_TILE_STATE post_tile_state); diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 12da99fc480..f65e6427534 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -935,6 +935,11 @@ swr_change_rt(struct swr_context *ctx, * INVALID so they are reloaded from surface. */ swr_store_render_target(&ctx->pipe, attachment, SWR_TILE_INVALID); need_fence = true; + } else { + /* if no previous attachment, invalidate tiles that may be marked + * RESOLVED because of an old attachment */ + swr_invalidate_render_target(&ctx->pipe, attachment, sf->width, sf->height); + /* no need to set fence here */ } /* Make new attachment */ |