radeonsi: unbind image before compute clear
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 20 Dec 2019 12:33:42 +0000 (13:33 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Jan 2020 10:10:15 +0000 (10:10 +0000)
It's not used and avoid infinite recursion when used from si_compute_expand_fmask

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3174>

src/gallium/drivers/radeonsi/si_compute_blit.c

index b75d4daa7cdcad51868f5bbce396d20624c9afea..967e9ee7d7f9e4ad803038b1bde258b9aeba0c3e 100644 (file)
@@ -173,6 +173,10 @@ static void si_compute_do_clear_or_copy(struct si_context *sctx,
        void *saved_cs = sctx->cs_shader_state.program;
        struct pipe_shader_buffer saved_sb[2] = {};
        si_get_shader_buffers(sctx, PIPE_SHADER_COMPUTE, 0, src ? 2 : 1, saved_sb);
+       struct pipe_image_view saved_image = {0};
+       util_copy_image_view(&saved_image, &sctx->images[PIPE_SHADER_COMPUTE].views[0]);
+       struct pipe_image_view image = {0};
+       ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 1, &image);
 
        unsigned saved_writable_mask = 0;
        for (unsigned i = 0; i < (src ? 2 : 1); i++) {
@@ -254,6 +258,7 @@ static void si_compute_do_clear_or_copy(struct si_context *sctx,
        ctx->bind_compute_state(ctx, saved_cs);
        ctx->set_shader_buffers(ctx, PIPE_SHADER_COMPUTE, 0, src ? 2 : 1, saved_sb,
                                saved_writable_mask);
+       ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 1, &saved_image);
        si_compute_internal_end(sctx);
        for (int i = 0; i < 2; i++)
                pipe_resource_reference(&saved_sb[i].buffer, NULL);