zink: handle null samplerview in get_imageview_for_binding()
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 11 Jul 2022 17:06:06 +0000 (13:06 -0400)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 20 Jul 2022 13:21:30 +0000 (09:21 -0400)
this is legal

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17639>

src/gallium/drivers/zink/zink_context.c

index 4131a84..52b2740 100644 (file)
@@ -470,7 +470,7 @@ get_imageview_for_binding(struct zink_context *ctx, enum pipe_shader_type stage,
    switch (type) {
    case ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW: {
       struct zink_sampler_view *sampler_view = zink_sampler_view(ctx->sampler_views[stage][idx]);
-      if (!sampler_view->base.texture)
+      if (!sampler_view || !sampler_view->base.texture)
          return NULL;
       /* if this is a non-seamless cube sampler, return the cube array view */
       return (ctx->di.emulate_nonseamless[stage] & ctx->di.cubes[stage] & BITFIELD_BIT(idx)) ?