Mesa (gallium-array-textures): gallium: fix array texture interface changes bugs, docs

Roland Scheidegger sroland at
Thu Jun 10 15:44:11 UTC 2010

Module: Mesa
Branch: gallium-array-textures
Commit: 08436d27ddd59857c22827c609b692aa0c407b7b

Author: Roland Scheidegger <sroland at>
Date:   Thu Jun 10 17:42:52 2010 +0200

gallium: fix array texture interface changes bugs, docs


 src/gallium/docs/d3d11ddi.txt        |    4 ++--
 src/gallium/docs/source/context.rst  |    3 +--
 src/gallium/docs/source/glossary.rst |    8 ++++++++
 src/gallium/docs/source/screen.rst   |   26 ++++++++++++++++----------
 src/gallium/include/pipe/p_context.h |   11 ++++++-----
 src/gallium/include/pipe/p_state.h   |    5 +++--
 6 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt
index e3368fd..93fe7ae 100644
--- a/src/gallium/docs/d3d11ddi.txt
+++ b/src/gallium/docs/d3d11ddi.txt
@@ -165,8 +165,8 @@ CreateDepthStencilState -> create_depth_stencil_alpha_state
 	+ Gallium has per-face writemask/valuemasks, D3D11 uses the same value for back and front
 	+ Gallium supports the alpha test, which D3D11 lacks
-CreateDepthStencilView -> get_tex_surface
-CreateRenderTargetView -> get_tex_surface
+CreateDepthStencilView -> create_surface
+CreateRenderTargetView -> create_surface
 	! Gallium merges depthstencil and rendertarget views into pipe_surface, which also doubles as a 2D surface abstraction
 	- lack of texture array support
 	- lack of render-to-buffer support
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index 16c7e83..d7ff973 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -136,8 +136,7 @@ used by GL), and always clears the whole surfaces (no scissoring as used by
 GL clear or explicit rectangles like d3d9 uses). It can, however, also clear
 only depth or stencil in a combined depth/stencil surface, if the driver
-If a surface includes several layers/slices (XXX: not yet...) then all layers
-will be cleared.
+If a surface includes several layers then all layers will be cleared.
 ``clear_render_target`` clears a single color rendertarget with the specified
 color value. While it is only possible to clear one surface at a time (which can
diff --git a/src/gallium/docs/source/glossary.rst b/src/gallium/docs/source/glossary.rst
index 0696cb5..8d69453 100644
--- a/src/gallium/docs/source/glossary.rst
+++ b/src/gallium/docs/source/glossary.rst
@@ -21,3 +21,11 @@ Glossary
       Level of Detail. Also spelled "LoD." The value that determines when the
       switches between mipmaps occur during texture sampling.
+   layer
+      This term is used as the name of the "3rd coordinate" of a resource.
+      3D textures have zslices, cube maps have faces, 1D and 2D array textures
+      have array members (other resources do not have multiple layers).
+      Since the functions only take one parameter no matter what type of
+      resource is used, use the term "layer" instead of a resource type
+      specific one.
\ No newline at end of file
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 48d9d57..e318244 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -250,25 +250,31 @@ resource_create
 Create a new resource from a template.
 The following fields of the pipe_resource must be specified in the template:
+**target** one of the pipe_texture_target enums.
+Note that PIPE_BUFFER and PIPE_TEXTURE_X are not really fundamentally different.
+Modern APIs allow using buffers as shader resources.
+**format** one of the pipe_format enums.
+**width0** the width of the base mip level of the texture or size of the buffer.
+**height0** the height of the base mip level of the texture
+(1 for 1D or 1D array textures).
+**depth0** the depth of the base mip level of the texture.
+1 for 1D or 2D textures, 6 for cube map textures, and depth for 3d textures.
+For array textures (both 1D and 2D) this specifies the array size.
+**last_level** the last mip map level present.
+**nr_samples** the nr of msaa samples. 0 (or 1) specifies a resource
+which isn't multisampled.
+**usage** one of the PIPE_USAGE flags.
+**bind** bitmask of the PIPE_BIND flags.
+**flags** bitmask of PIPE_RESOURCE_FLAG flags.
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 73a7331..0509416 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -249,11 +249,11 @@ struct pipe_context {
    void (*resource_copy_region)(struct pipe_context *pipe,
                                 struct pipe_resource *dst,
-                                unsigned level,
+                                unsigned dst_level,
                                 unsigned dstx, unsigned dsty, unsigned dstz,
                                 struct pipe_resource *src,
-                                unsigned level,
-                                const struct pipe_box *);
+                                unsigned src_level,
+                                const struct pipe_box *src_box);
     * Resolve a multisampled resource into a non-multisampled one.
@@ -344,14 +344,15 @@ struct pipe_context {
     * render target / depth stencil stages.
     * \param usage  bitmaks of PIPE_BIND_* flags
-   struct pipe_surface *(*create_surface)(struct pipe_screen *,
+   struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
                                           struct pipe_resource *resource,
                                           unsigned level,
                                           unsigned first_layer,
                                           unsigned last_layer,
                                           unsigned usage );
-   void (*surface_destroy)(struct pipe_surface *);
+   void (*surface_destroy)(struct pipe_context *ctx,
+                           struct pipe_surface *);
     * Get a transfer object for transferring data to/from a texture.
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 0fdf408..a195409 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -269,13 +269,14 @@ struct pipe_sampler_state
- * 2D surface.  This is basically a view into a memory buffer.
- * May be a renderbuffer, texture mipmap level, etc.
+ * A view into a texture that can be bound to a color render target /
+ * depth stencil attachment point.
 struct pipe_surface
    struct pipe_reference reference;
    struct pipe_resource *texture; /**< resource into which this is a view  */
+   struct pipe_context *context; /**< context this view belongs to */
    enum pipe_format format;
    unsigned width;               /**< logical width in pixels */

More information about the mesa-commit mailing list