zink: avoid crashing when bindless texture updates aren't used
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 18 Jul 2022 18:05:40 +0000 (14:05 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 25 Jul 2022 00:11:54 +0000 (00:11 +0000)
some apps trigger the texture update path far in advance of when the
texture will be used, so don't crash and wait to do the update

cc: mesa-stable

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

src/gallium/drivers/zink/zink_draw.cpp

index 743531e..abda8aa 100644 (file)
@@ -740,7 +740,10 @@ zink_draw(struct pipe_context *pctx,
    if (zink_program_has_descriptors(&ctx->curr_program->base))
       screen->descriptors_update(ctx, false);
 
-   if (ctx->di.any_bindless_dirty && ctx->curr_program->base.dd->bindless)
+   if (ctx->di.any_bindless_dirty &&
+       /* some apps (d3dretrace) call MakeTextureHandleResidentARB randomly */
+       zink_program_has_descriptors(&ctx->curr_program->base) &&
+       ctx->curr_program->base.dd->bindless)
       zink_descriptors_update_bindless(ctx);
 
    if (reads_basevertex) {