trace: Fix trace_context_transfer_unmap methods.
[mesa.git] / src / gallium / auxiliary / util / u_box.h
index 520a3d596cbe1a9863672fb34dac345bb62bdd0e..b3f478e7bfc4086a27bca1ee41c2aa78a82ae73d 100644 (file)
@@ -4,10 +4,8 @@
 #include "pipe/p_state.h"
 #include "util/u_math.h"
 
-static INLINE
-void u_box_1d( unsigned x,
-              unsigned w,
-              struct pipe_box *box )
+static inline void
+u_box_1d(unsigned x, unsigned w, struct pipe_box *box)
 {
    box->x = x;
    box->y = 0;
@@ -17,12 +15,8 @@ void u_box_1d( unsigned x,
    box->depth = 1;
 }
 
-static INLINE
-void u_box_2d( unsigned x,
-              unsigned y,
-              unsigned w,
-              unsigned h,
-              struct pipe_box *box )
+static inline void
+u_box_2d(unsigned x,unsigned y, unsigned w, unsigned h, struct pipe_box *box)
 {
    box->x = x;
    box->y = y;
@@ -32,10 +26,8 @@ void u_box_2d( unsigned x,
    box->depth = 1;
 }
 
-static INLINE
-void u_box_origin_2d( unsigned w,
-                     unsigned h,
-                     struct pipe_box *box )
+static inline void
+u_box_origin_2d(unsigned w, unsigned h, struct pipe_box *box)
 {
    box->x = 0;
    box->y = 0;
@@ -45,13 +37,9 @@ void u_box_origin_2d( unsigned w,
    box->depth = 1;
 }
 
-static INLINE
-void u_box_2d_zslice( unsigned x,
-                     unsigned y,
-                     unsigned z,
-                     unsigned w,
-                     unsigned h,
-                     struct pipe_box *box )
+static inline void
+u_box_2d_zslice(unsigned x, unsigned y, unsigned z,
+                unsigned w, unsigned h, struct pipe_box *box)
 {
    box->x = x;
    box->y = y;
@@ -61,14 +49,10 @@ void u_box_2d_zslice( unsigned x,
    box->depth = 1;
 }
 
-static INLINE
-void u_box_3d( unsigned x,
-              unsigned y,
-              unsigned z,
-              unsigned w,
-              unsigned h,
-              unsigned d,
-              struct pipe_box *box )
+static inline void
+u_box_3d(unsigned x, unsigned y, unsigned z,
+         unsigned w, unsigned h, unsigned d,
+         struct pipe_box *box)
 {
    box->x = x;
    box->y = y;
@@ -86,7 +70,7 @@ void u_box_3d( unsigned x,
  *          3 if both width and height have been reduced.
  * Aliasing permitted.
  */
-static INLINE int
+static inline int
 u_box_clip_2d(struct pipe_box *dst,
               const struct pipe_box *box, int w, int h)
 {
@@ -129,39 +113,48 @@ u_box_clip_2d(struct pipe_box *dst,
    return res;
 }
 
-static INLINE int64_t
+static inline int64_t
 u_box_volume_3d(const struct pipe_box *box)
 {
    return (int64_t)box->width * box->height * box->depth;
 }
 
 /* Aliasing of @dst permitted. */
-static INLINE void
+static inline void
 u_box_union_2d(struct pipe_box *dst,
                const struct pipe_box *a, const struct pipe_box *b)
 {
-   dst->x = MIN2(a->x, b->x);
-   dst->y = MIN2(a->y, b->y);
+   int x, y;
 
-   dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x;
-   dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y;
+   x = MIN2(a->x, b->x);
+   y = MIN2(a->y, b->y);
+
+   dst->width = MAX2(a->x + a->width, b->x + b->width) - x;
+   dst->height = MAX2(a->y + a->height, b->y + b->height) - y;
+   dst->x = x;
+   dst->y = y;
 }
 
 /* Aliasing of @dst permitted. */
-static INLINE void
+static inline void
 u_box_union_3d(struct pipe_box *dst,
                const struct pipe_box *a, const struct pipe_box *b)
 {
-   dst->x = MIN2(a->x, b->x);
-   dst->y = MIN2(a->y, b->y);
-   dst->z = MIN2(a->z, b->z);
-
-   dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x;
-   dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y;
-   dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - dst->z;
+   int x, y, z;
+
+   x = MIN2(a->x, b->x);
+   y = MIN2(a->y, b->y);
+   z = MIN2(a->z, b->z);
+
+   dst->width = MAX2(a->x + a->width, b->x + b->width) - x;
+   dst->height = MAX2(a->y + a->height, b->y + b->height) - y;
+   dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - z;
+   dst->x = x;
+   dst->y = y;
+   dst->z = z;
 }
 
-static INLINE boolean
+static inline boolean
 u_box_test_intersection_2d(const struct pipe_box *a,
                            const struct pipe_box *b)
 {
@@ -185,7 +178,7 @@ u_box_test_intersection_2d(const struct pipe_box *a,
    return TRUE;
 }
 
-static INLINE void
+static inline void
 u_box_minify_2d(struct pipe_box *dst,
                 const struct pipe_box *src, unsigned l)
 {
@@ -195,4 +188,16 @@ u_box_minify_2d(struct pipe_box *dst,
    dst->height = MAX2(src->height >> l, 1);
 }
 
+static inline void
+u_box_minify_3d(struct pipe_box *dst,
+                const struct pipe_box *src, unsigned l)
+{
+   dst->x = src->x >> l;
+   dst->y = src->y >> l;
+   dst->z = src->z >> l;
+   dst->width = MAX2(src->width >> l, 1);
+   dst->height = MAX2(src->height >> l, 1);
+   dst->depth = MAX2(src->depth >> l, 1);
+}
+
 #endif