gallium/util: add 1d/2d mipmap generation support
[mesa.git] / src / gallium / auxiliary / util / u_tile.h
index 1d8ce7d8cbc3f7402812e9eeed33776a16be883a..0ba274308fe41ed3dace4e28d08072e0dd2de941 100644 (file)
 #define P_TILE_H
 
 #include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
 
+struct pipe_context;
 struct pipe_transfer;
 
-
 /**
  * Clip tile against transfer dims.
+ *
+ * XXX: this only clips width and height!
+ *
  * \return TRUE if tile is totally clipped, FALSE otherwise
  */
 static INLINE boolean
-pipe_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_transfer *pt)
+u_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_box *box)
 {
-   if (x >= pt->width)
+   if (x >= box->width)
       return TRUE;
-   if (y >= pt->height)
+   if (y >= box->height)
       return TRUE;
-   if (x + *w > pt->width)
-      *w = pt->width - x;
-   if (y + *h > pt->height)
-      *h = pt->height - y;
+   if (x + *w > box->width)
+      *w = box->width - x;
+   if (y + *h > box->height)
+      *h = box->height - y;
    return FALSE;
 }
 
@@ -75,18 +80,11 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
                    float *p);
 
 void
-pipe_get_tile_swizzle(struct pipe_context *pipe,
-                     struct pipe_transfer *pt,
-                      uint x,
-                      uint y,
-                      uint w,
-                      uint h,
-                      uint swizzle_r,
-                      uint swizzle_g,
-                      uint swizzle_b,
-                      uint swizzle_a,
-                      enum pipe_format format,
-                      float *p);
+pipe_get_tile_rgba_format(struct pipe_context *pipe,
+                          struct pipe_transfer *pt,
+                          uint x, uint y, uint w, uint h,
+                          enum pipe_format format,
+                          float *p);
 
 void
 pipe_put_tile_rgba(struct pipe_context *pipe,
@@ -94,6 +92,13 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
                    uint x, uint y, uint w, uint h,
                    const float *p);
 
+void
+pipe_put_tile_rgba_format(struct pipe_context *pipe,
+                          struct pipe_transfer *pt,
+                          uint x, uint y, uint w, uint h,
+                          enum pipe_format format,
+                          const float *p);
+
 
 void
 pipe_get_tile_z(struct pipe_context *pipe,