Mesa (gallium-array-textures): gallium: more interface changes

Roland Scheidegger sroland at kemper.freedesktop.org
Wed Jun 16 16:48:20 UTC 2010


Module: Mesa
Branch: gallium-array-textures
Commit: 2d17f5efe166b2c3d51957c76294165ab30b8ae2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d17f5efe166b2c3d51957c76294165ab30b8ae2

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Wed Jun 16 17:46:14 2010 +0100

gallium: more interface changes

In particular to enable usage of buffers in views, and ability to use a
different pipe_format in pipe_surface.
Get rid of layout and offset parameter in pipe_surface - the former was
not used in any (public) code anyway, and the latter should either be computed
on-demand or driver can use subclass of pipe_surface.
Also make create_surface() use a template to be more consistent with
other functions.

---

 src/gallium/include/pipe/p_context.h |    5 +----
 src/gallium/include/pipe/p_state.h   |   33 ++++++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index b2fd8f4..b98c316 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -370,10 +370,7 @@ struct pipe_context {
     */
    struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
                                           struct pipe_resource *resource,
-                                          unsigned level,
-                                          unsigned first_layer,
-                                          unsigned last_layer,
-                                          unsigned usage );
+                                          const struct pipe_surface *templat);
 
    void (*surface_destroy)(struct pipe_context *ctx,
                            struct pipe_surface *);
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 502a7f0..5123948 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -281,16 +281,23 @@ struct pipe_surface
    struct pipe_context *context; /**< context this view belongs to */
    enum pipe_format format;
 
+   /* XXX width/height should be removed */
    unsigned width;               /**< logical width in pixels */
    unsigned height;              /**< logical height in pixels */
 
-   unsigned layout;              /**< PIPE_SURFACE_LAYOUT_x */
-   unsigned offset;              /**< offset from start of buffer, in bytes */
    unsigned usage;               /**< bitmask of PIPE_BIND_x */
 
-   unsigned level;
-   unsigned first_layer;
-   unsigned last_layer;
+   union {
+      struct {
+         unsigned level;
+         unsigned first_layer:16;
+         unsigned last_layer:16;
+      } tex;
+      struct {
+         unsigned element_offset;
+         unsigned element_width;
+      } buf;
+   } u;
 };
 
 
@@ -303,10 +310,18 @@ struct pipe_sampler_view
    enum pipe_format format;      /**< typed PIPE_FORMAT_x */
    struct pipe_resource *texture; /**< texture into which this is a view  */
    struct pipe_context *context; /**< context this view belongs to */
-   unsigned first_level:8;       /**< first mipmap level */
-   unsigned last_level:8;        /**< last mipmap level */
-   unsigned first_layer:16;      /**< first layer to use for array textures */
-   unsigned last_layer:16;       /**< last layer to use for array textures */
+   union {
+      struct {
+         unsigned first_layer:16;     /**< first layer to use for array textures */
+         unsigned last_layer:16;      /**< last layer to use for array textures */
+         unsigned first_level:8;      /**< first mipmap level to use */
+         unsigned last_level:8;       /**< last mipmap level to use */
+      } tex;
+      struct {
+         unsigned element_offset;
+         unsigned element_width;
+      } buf;
+   } u;
    unsigned swizzle_r:3;         /**< PIPE_SWIZZLE_x for red component */
    unsigned swizzle_g:3;         /**< PIPE_SWIZZLE_x for green component */
    unsigned swizzle_b:3;         /**< PIPE_SWIZZLE_x for blue component */




More information about the mesa-commit mailing list