Mesa (main): zink: handle null samplerview/image rebinds more gracefully

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 20 18:03:40 UTC 2022


Module: Mesa
Branch: main
Commit: 153983328d914733ac077fec8f33b27421dbeb1d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=153983328d914733ac077fec8f33b27421dbeb1d

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Jul 20 10:41:53 2022 -0400

zink: handle null samplerview/image rebinds more gracefully

fixes a crash in nine

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17656>

---

 src/gallium/drivers/zink/zink_context.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 94e08214905..4a5bb4852ba 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -4203,6 +4203,8 @@ zink_rebind_all_images(struct zink_context *ctx)
     for (unsigned i = 0; i < PIPE_SHADER_TYPES; i++) {
       for (unsigned j = 0; j < ctx->di.num_sampler_views[i]; j++) {
          struct zink_sampler_view *sv = zink_sampler_view(ctx->sampler_views[i][j]);
+         if (!sv)
+            continue;
          struct zink_resource *res = zink_resource(sv->image_view->base.texture);
          if (res->obj != sv->image_view->obj) {
              struct pipe_surface *psurf = &sv->image_view->base;
@@ -4215,6 +4217,8 @@ zink_rebind_all_images(struct zink_context *ctx)
       for (unsigned j = 0; j < ctx->di.num_images[i]; j++) {
          struct zink_image_view *image_view = &ctx->image_views[i][j];
          struct zink_resource *res = zink_resource(image_view->base.resource);
+         if (!res)
+            continue;
          if (ctx->image_views[i][j].surface->obj != res->obj) {
             zink_surface_reference(zink_screen(ctx->base.screen), &image_view->surface, NULL);
             image_view->surface = create_image_surface(ctx, &image_view->base, i == PIPE_SHADER_COMPUTE);



More information about the mesa-commit mailing list