gallium: Add PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT
[mesa.git] / src / gallium / drivers / ilo / ilo_resource.h
index f78f9495233a251b5d440636577942fe0799737a..8378af54741b96bc038ba1749e9a632757be187d 100644 (file)
@@ -29,8 +29,8 @@
 #define ILO_RESOURCE_H
 
 #include "core/intel_winsys.h"
-#include "core/ilo_buffer.h"
 #include "core/ilo_image.h"
+#include "core/ilo_vma.h"
 
 #include "ilo_common.h"
 #include "ilo_screen.h"
@@ -66,16 +66,6 @@ enum ilo_texture_flags {
     * flags, the slice has been cleared to ilo_texture_slice::clear_value.
     */
    ILO_TEXTURE_CLEAR          = 1 << 6,
-
-   /*
-    * Set when HiZ can be enabled.
-    *
-    * It is never set in resolve flags.  When set in slice flags, the slice
-    * can have HiZ enabled.  It is to be noted that this bit is always set for
-    * either all or none of the slices in a level, allowing quick check in
-    * case of layered rendering.
-    */
-   ILO_TEXTURE_HIZ            = 1 << 7,
 };
 
 /**
@@ -102,7 +92,10 @@ struct ilo_texture {
 
    bool imported;
 
+   enum pipe_format image_format;
    struct ilo_image image;
+   struct ilo_vma vma;
+   struct ilo_vma aux_vma;
 
    /* XXX thread-safety */
    struct ilo_texture_slice *slices[PIPE_MAX_TEXTURE_LEVELS];
@@ -113,14 +106,15 @@ struct ilo_texture {
 struct ilo_buffer_resource {
    struct pipe_resource base;
 
-   struct ilo_buffer buffer;
+   uint32_t bo_size;
+   struct ilo_vma vma;
 };
 
-static inline struct ilo_buffer *
-ilo_buffer(struct pipe_resource *res)
+static inline struct ilo_buffer_resource *
+ilo_buffer_resource(struct pipe_resource *res)
 {
-   return (res && res->target == PIPE_BUFFER) ?
-      &((struct ilo_buffer_resource *) res)->buffer : NULL;
+   return (struct ilo_buffer_resource *)
+      ((res && res->target == PIPE_BUFFER) ? res : NULL);
 }
 
 static inline struct ilo_texture *
@@ -137,13 +131,14 @@ bool
 ilo_resource_rename_bo(struct pipe_resource *res);
 
 /**
- * Return the bo of the resource.
+ * Return the VMA of the resource.
  */
-static inline struct intel_bo *
-ilo_resource_get_bo(struct pipe_resource *res)
+static inline const struct ilo_vma *
+ilo_resource_get_vma(struct pipe_resource *res)
 {
    return (res->target == PIPE_BUFFER) ?
-      ilo_buffer(res)->bo : ilo_texture(res)->image.bo;
+      &((struct ilo_buffer_resource *) res)->vma :
+      &((struct ilo_texture *) res)->vma;
 }
 
 static inline struct ilo_texture_slice *
@@ -189,18 +184,4 @@ ilo_texture_set_slice_clear_value(struct ilo_texture *tex, unsigned level,
    }
 }
 
-static inline bool
-ilo_texture_can_enable_hiz(const struct ilo_texture *tex, unsigned level,
-                           unsigned first_slice, unsigned num_slices)
-{
-   /*
-    * Either all or none of the slices in the same level have ILO_TEXTURE_HIZ
-    * set.  It suffices to check only the first slice.
-    */
-   const struct ilo_texture_slice *slice =
-      ilo_texture_get_slice(tex, level, 0);
-
-   return (tex->image.aux_bo && (slice->flags & ILO_TEXTURE_HIZ));
-}
-
 #endif /* ILO_RESOURCE_H */