summaryrefslogtreecommitdiff
path: root/src/gallium/include
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-02-18 16:43:02 +0100
committerMichel Dänzer <daenzer@vmware.com>2009-02-18 16:43:02 +0100
commit3bd7c5ceffc88a052c5e8e114df2f2c7549ddb4a (patch)
treebdb352609c3ef21875a2699428e26b8c8c930f73 /src/gallium/include
parent76d8951fd3adbb91b2f71d461eec0f304619ca0b (diff)
parentb89aa1d87ad6cebdbb3f2067863c600f50bf0ff1 (diff)
Merge branch 'gallium-texture-transfer'
Conflicts: src/gallium/drivers/softpipe/sp_tile_cache.c
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_defines.h10
-rw-r--r--src/gallium/include/pipe/p_inlines.h23
-rw-r--r--src/gallium/include/pipe/p_screen.h24
-rw-r--r--src/gallium/include/pipe/p_state.h28
4 files changed, 53 insertions, 32 deletions
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 4f0b301f31..0d70348c11 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -194,6 +194,16 @@ enum pipe_texture_target {
/**
+ * Transfer object usage flags
+ */
+enum pipe_transfer_usage {
+ PIPE_TRANSFER_READ,
+ PIPE_TRANSFER_WRITE,
+ PIPE_TRANSFER_READ_WRITE //< Read/modify/write
+};
+
+
+/**
* Buffer usage flags
*/
#define PIPE_BUFFER_USAGE_CPU_READ (1 << 0)
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 1219c817b4..76460d2724 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -38,29 +38,6 @@ extern "C" {
#endif
-/* XXX: these are a kludge. will fix when all surfaces are views into
- * textures, and free-floating winsys surfaces go away.
- */
-static INLINE void *
-pipe_surface_map( struct pipe_surface *surf, unsigned flags )
-{
- struct pipe_screen *screen;
- assert(surf->texture);
- screen = surf->texture->screen;
- return screen->surface_map( screen, surf, flags );
-}
-
-static INLINE void
-pipe_surface_unmap( struct pipe_surface *surf )
-{
- struct pipe_screen *screen;
- assert(surf->texture);
- screen = surf->texture->screen;
- screen->surface_unmap( screen, surf );
-}
-
-
-
/**
* Set 'ptr' to point to 'surf' and update reference counting.
* The old thing pointed to, if any, will be unreferenced first.
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 17d1548253..341d1caea0 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -55,6 +55,7 @@ struct pipe_winsys;
struct pipe_buffer;
+
/**
* Gallium screen/adapter context. Basically everything
* hardware-specific that doesn't actually require a rendering
@@ -128,12 +129,25 @@ struct pipe_screen {
struct pipe_surface ** );
- void *(*surface_map)( struct pipe_screen *,
- struct pipe_surface *surface,
- unsigned flags );
+ /** Get a transfer object for transferring data to/from a texture */
+ struct pipe_transfer *(*get_tex_transfer)(struct pipe_screen *,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y,
+ unsigned w, unsigned h);
+
+ /* Transfer objects allocated by the above must be released here:
+ */
+ void (*tex_transfer_release)( struct pipe_screen *,
+ struct pipe_transfer ** );
+
+ void *(*transfer_map)( struct pipe_screen *,
+ struct pipe_transfer *transfer );
- void (*surface_unmap)( struct pipe_screen *,
- struct pipe_surface *surface );
+ void (*transfer_unmap)( struct pipe_screen *,
+ struct pipe_transfer *transfer );
/**
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 9dc541630c..a2e839da5c 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -280,10 +280,6 @@ struct pipe_surface
unsigned clear_value; /**< XXX may be temporary */
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
- struct pipe_format_block block;
- unsigned nblocksx; /**< allocated width in blocks */
- unsigned nblocksy; /**< allocated height in blocks */
- unsigned stride; /**< stride in bytes between rows of blocks */
unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */
unsigned offset; /**< offset from start of buffer, in bytes */
unsigned refcount;
@@ -297,6 +293,30 @@ struct pipe_surface
/**
+ * Transfer object. For data transfer to/from a texture.
+ */
+struct pipe_transfer
+{
+ enum pipe_format format; /**< PIPE_FORMAT_x */
+ unsigned x; /**< x offset from start of texture image */
+ unsigned y; /**< y offset from start of texture image */
+ unsigned width; /**< logical width in pixels */
+ unsigned height; /**< logical height in pixels */
+ struct pipe_format_block block;
+ unsigned nblocksx; /**< allocated width in blocks */
+ unsigned nblocksy; /**< allocated height in blocks */
+ unsigned stride; /**< stride in bytes between rows of blocks */
+ unsigned refcount;
+ unsigned usage; /**< PIPE_TRANSFER_* */
+
+ struct pipe_texture *texture; /**< texture to transfer to/from */
+ unsigned face;
+ unsigned level;
+ unsigned zslice;
+};
+
+
+/**
* Texture object.
*/
struct pipe_texture