zink: add inline for checking whether a resource has any binds
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 3 Sep 2021 14:15:14 +0000 (10:15 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Sep 2021 03:40:54 +0000 (03:40 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12822>

src/gallium/drivers/zink/zink_resource.h

index 626d1ca..e2dc8a3 100644 (file)
@@ -117,7 +117,10 @@ struct zink_resource {
    uint32_t sampler_binds[PIPE_SHADER_TYPES];
    uint16_t image_bind_count[2]; //gfx, compute
    uint16_t write_bind_count[2]; //gfx, compute
-   uint16_t bind_count[2]; //gfx, compute
+   union {
+      uint16_t bind_count[2]; //gfx, compute
+      uint32_t all_binds;
+   };
 
    struct sw_displaytarget *dt;
    unsigned dt_stride;
@@ -182,6 +185,12 @@ zink_resource_tmp_buffer(struct zink_screen *screen, struct zink_resource *res,
 bool
 zink_resource_object_init_storage(struct zink_context *ctx, struct zink_resource *res);
 
+static inline bool
+zink_resource_has_binds(const struct zink_resource *res)
+{
+   return res->all_binds > 0;
+}
+
 #ifndef __cplusplus
 #include "zink_bo.h"