zink: reference ubos and textures
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 26 Mar 2019 19:22:31 +0000 (20:22 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:44 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_context.c

index f87d66fd4fbe3c87e31b39780d7b4cb2f4745b5c..1d6282eed1338f1573a235c924163ecfe6474f08 100644 (file)
@@ -923,21 +923,24 @@ zink_draw_vbo(struct pipe_context *pctx,
          if (shader->bindings[j].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) {
             assert(ctx->ubos[i][index].buffer_size > 0);
             assert(ctx->ubos[i][index].buffer);
-            buffer_infos[num_buffer_info].buffer = zink_resource(ctx->ubos[i][index].buffer)->buffer;
+            struct zink_resource *res = zink_resource(ctx->ubos[i][index].buffer);
+            buffer_infos[num_buffer_info].buffer = res->buffer;
             buffer_infos[num_buffer_info].offset = ctx->ubos[i][index].buffer_offset;
             buffer_infos[num_buffer_info].range  = VK_WHOLE_SIZE;
             wds[num_wds].pBufferInfo = buffer_infos + num_buffer_info;
             ++num_buffer_info;
+            zink_cmdbuf_reference_resoure(cmdbuf, res);
          } else {
             struct pipe_sampler_view *psampler_view = ctx->image_views[i][index];
             assert(psampler_view);
             struct zink_sampler_view *sampler_view = (struct zink_sampler_view *)psampler_view;
-            struct zink_resource *resource = zink_resource(psampler_view->texture);
-            image_infos[num_image_info].imageLayout = resource->layout;
+            struct zink_resource *res = zink_resource(psampler_view->texture);
+            image_infos[num_image_info].imageLayout = res->layout;
             image_infos[num_image_info].imageView = sampler_view->image_view;
             image_infos[num_image_info].sampler = ctx->samplers[i][index];
             wds[num_wds].pImageInfo = image_infos + num_image_info;
             ++num_image_info;
+            zink_cmdbuf_reference_resoure(cmdbuf, res);
          }
 
          wds[num_wds].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;