Mesa (master): zink: fix crash when restoring sampler-states

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 29 08:48:59 UTC 2019


Module: Mesa
Branch: master
Commit: f2188e58cea14c4b4e05634b7b82c4743d1c5c1d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2188e58cea14c4b4e05634b7b82c4743d1c5c1d

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu Nov 28 18:22:24 2019 +0100

zink: fix crash when restoring sampler-states

When I changed to heap-allocated sampler-objects, I missed the code-path
that restores sampler-states after the blitter; it needs an array of
pointers, not an array of VkSampler objects to behave.

This fixes spec at arb_texture_cube_map@copyteximage for me.

Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Fixes: 5ea787950f6 ("zink: heap-allocate samplers objects")
Reviewed-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/zink/zink_blit.c    | 2 +-
 src/gallium/drivers/zink/zink_context.c | 1 +
 src/gallium/drivers/zink/zink_context.h | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_blit.c b/src/gallium/drivers/zink/zink_blit.c
index 9ec6e1ebe78..bc788556bb8 100644
--- a/src/gallium/drivers/zink/zink_blit.c
+++ b/src/gallium/drivers/zink/zink_blit.c
@@ -171,7 +171,7 @@ zink_blit(struct pipe_context *pctx,
    util_blitter_save_scissor(ctx->blitter, ctx->scissor_states);
    util_blitter_save_fragment_sampler_states(ctx->blitter,
                                              ctx->num_samplers[PIPE_SHADER_FRAGMENT],
-                                             (void **)ctx->samplers[PIPE_SHADER_FRAGMENT]);
+                                             ctx->sampler_states[PIPE_SHADER_FRAGMENT]);
    util_blitter_save_fragment_sampler_views(ctx->blitter,
                                             ctx->num_image_views[PIPE_SHADER_FRAGMENT],
                                             ctx->image_views[PIPE_SHADER_FRAGMENT]);
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index a9549ad1e98..9b057fa165e 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -173,6 +173,7 @@ zink_bind_sampler_states(struct pipe_context *pctx,
    struct zink_context *ctx = zink_context(pctx);
    for (unsigned i = 0; i < num_samplers; ++i) {
       VkSampler *sampler = samplers[i];
+      ctx->sampler_states[shader][start_slot + i] = sampler;
       ctx->samplers[shader][start_slot + i] = sampler ? *sampler : VK_NULL_HANDLE;
    }
    ctx->num_samplers[shader] = start_slot + num_samplers;
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 026a2e9791c..e46cb8017da 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -97,6 +97,7 @@ struct zink_context {
    struct pipe_vertex_buffer buffers[PIPE_MAX_ATTRIBS];
    uint32_t buffers_enabled_mask;
 
+   void *sampler_states[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
    VkSampler samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
    unsigned num_samplers[PIPE_SHADER_TYPES];
    struct pipe_sampler_view *image_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];




More information about the mesa-commit mailing list