}
/**
+ * Same as pipe_surface_release, but used when pipe_context doesn't exist
+ * anymore.
+ */
+static inline void
+pipe_surface_release_no_context(struct pipe_surface **ptr)
+{
+ struct pipe_surface *surf = *ptr;
+
+ if (pipe_reference_described(&surf->reference, NULL,
+ (debug_reference_descriptor)
+ debug_describe_surface)) {
+ /* trivially destroy pipe_surface */
+ pipe_resource_reference(&surf->texture, NULL);
+ free(surf);
+ }
+ *ptr = NULL;
+}
+
+/**
* Set *dst to \p src with proper reference counting.
*
* The caller must guarantee that \p src and *dst were created in
struct st_context *st = st_context(ctx);
pipe_surface_release(st->pipe, &strb->surface_srgb);
pipe_surface_release(st->pipe, &strb->surface_linear);
- strb->surface = NULL;
+ } else {
+ pipe_surface_release_no_context(&strb->surface_srgb);
+ pipe_surface_release_no_context(&strb->surface_linear);
}
+ strb->surface = NULL;
pipe_resource_reference(&strb->texture, NULL);
free(strb->data);
_mesa_delete_renderbuffer(ctx, rb);