iris: Fix major resource leak in iris_set_shader_images
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 27 Jun 2019 23:54:47 +0000 (16:54 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 28 Jun 2019 02:08:46 +0000 (19:08 -0700)
We were failing to unreference the old image resource.  Instead of open
coding this and doing it badly, just use the copier function which does
the right thing.

src/gallium/drivers/iris/iris_state.c

index 01cd9dbcec75ca0004a901a6e786994c2271c313..e09a3ddbcc9aae37c7b59b5feee5c541f188dde4 100644 (file)
@@ -2098,9 +2098,7 @@ iris_set_shader_images(struct pipe_context *ctx,
          if (!unlikely(map))
             return;
 
-         iv->base = *img;
-         iv->base.resource = NULL;
-         pipe_resource_reference(&iv->base.resource, &res->base);
+         util_copy_image_view(&iv->base, img);
 
          shs->bound_image_views |= 1 << (start_slot + i);