gallium: Fix uninitialized variable warning in compute test.
[mesa.git] / src / gallium / auxiliary / util / u_tile.h
index 986eee07435b5c7d3ccd1a9abb74724d4ac63163..dc1f568a8e5435b2c447d5c88d7b19568342f2ca 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 VMware, Inc.
  * All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,7 +18,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #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;
 
 /**
@@ -39,16 +42,16 @@ struct pipe_transfer;
  *
  * \return TRUE if tile is totally clipped, FALSE otherwise
  */
-static INLINE boolean
+static inline boolean
 u_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_box *box)
 {
-   if (x >= box->width)
+   if ((int) x >= box->width)
       return TRUE;
-   if (y >= box->height)
+   if ((int) y >= box->height)
       return TRUE;
-   if (x + *w > box->width)
+   if ((int) (x + *w) > box->width)
       *w = box->width - x;
-   if (y + *h > box->height)
+   if ((int) (y + *h) > box->height)
       *h = box->height - y;
    return FALSE;
 }
@@ -58,63 +61,102 @@ extern "C" {
 #endif
 
 void
-pipe_get_tile_raw(struct pipe_context *pipe,
-                  struct pipe_transfer *pt,
+pipe_get_tile_raw(struct pipe_transfer *pt,
+                  const void *src,
                   uint x, uint y, uint w, uint h,
                   void *p, int dst_stride);
 
 void
-pipe_put_tile_raw(struct pipe_context *pipe,
-                  struct pipe_transfer *pt,
+pipe_put_tile_raw(struct pipe_transfer *pt,
+                  void *dst,
                   uint x, uint y, uint w, uint h,
                   const void *p, int src_stride);
 
 
 void
-pipe_get_tile_rgba(struct pipe_context *pipe,
-                   struct pipe_transfer *pt,
+pipe_get_tile_rgba(struct pipe_transfer *pt,
+                   const void *src,
                    uint x, uint y, uint w, uint h,
                    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_transfer *pt,
+                          const void *src,
+                          uint x, uint y, uint w, uint h,
+                          enum pipe_format format,
+                          float *p);
 
 void
-pipe_put_tile_rgba(struct pipe_context *pipe,
-                   struct pipe_transfer *pt,
+pipe_put_tile_rgba(struct pipe_transfer *pt,
+                   void *dst,
                    uint x, uint y, uint w, uint h,
                    const float *p);
 
+void
+pipe_put_tile_rgba_format(struct pipe_transfer *pt,
+                          void *dst,
+                          uint x, uint y, uint w, uint h,
+                          enum pipe_format format,
+                          const float *p);
+
 
 void
-pipe_get_tile_z(struct pipe_context *pipe,
-                struct pipe_transfer *pt,
+pipe_get_tile_z(struct pipe_transfer *pt,
+                const void *src,
                 uint x, uint y, uint w, uint h,
                 uint *z);
 
 void
-pipe_put_tile_z(struct pipe_context *pipe,
-                struct pipe_transfer *pt,
+pipe_put_tile_z(struct pipe_transfer *pt,
+                void *dst,
                 uint x, uint y, uint w, uint h,
                 const uint *z);
 
 void
 pipe_tile_raw_to_rgba(enum pipe_format format,
-                      void *src,
+                      const void *src,
                       uint w, uint h,
                       float *dst, unsigned dst_stride);
 
+void
+pipe_tile_raw_to_unsigned(enum pipe_format format,
+                          const void *src,
+                          uint w, uint h,
+                          unsigned *dst, unsigned dst_stride);
+
+void
+pipe_tile_raw_to_signed(enum pipe_format format,
+                        void *src,
+                        uint w, uint h,
+                        int *dst, unsigned dst_stride);
+
+void
+pipe_get_tile_ui_format(struct pipe_transfer *pt,
+                        const void *src,
+                        uint x, uint y, uint w, uint h,
+                        enum pipe_format format,
+                        unsigned int *p);
+
+void
+pipe_get_tile_i_format(struct pipe_transfer *pt,
+                       const void *src,
+                       uint x, uint y, uint w, uint h,
+                       enum pipe_format format,
+                       int *p);
+
+void
+pipe_put_tile_ui_format(struct pipe_transfer *pt,
+                        void *dst,
+                        uint x, uint y, uint w, uint h,
+                        enum pipe_format format,
+                        const unsigned *p);
+
+void
+pipe_put_tile_i_format(struct pipe_transfer *pt,
+                       void *dst,
+                       uint x, uint y, uint w, uint h,
+                       enum pipe_format format,
+                       const int *p);
 
 #ifdef __cplusplus
 }