summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-03-13 14:52:43 +0000
committerKeith Whitwell <keithw@vmware.com>2010-03-13 15:08:34 +0000
commit90b4045fbc0a093fcd04efba7e045ec259c490b8 (patch)
treefdf6368a57a0c7ed49cf52d04b46299bf33b6af5
parenta80e33f40731f07e8a39896bfdcd1b1504aedc1f (diff)
wip
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h254
-rw-r--r--src/gallium/auxiliary/util/u_tile.h3
-rw-r--r--src/gallium/include/pipe/p_context.h63
-rw-r--r--src/gallium/include/pipe/p_defines.h140
-rw-r--r--src/gallium/include/pipe/p_screen.h113
-rw-r--r--src/gallium/include/pipe/p_state.h81
-rw-r--r--src/gallium/include/pipe/p_video_context.h2
-rw-r--r--src/gallium/include/pipe/p_video_state.h8
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c17
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c24
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c12
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c4
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c9
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c38
-rw-r--r--src/mesa/state_tracker/st_cb_blit.c2
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c118
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.h3
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c46
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c12
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.h4
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c16
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c44
-rw-r--r--src/mesa/state_tracker/st_context.c2
-rw-r--r--src/mesa/state_tracker/st_context.h4
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c4
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c24
-rw-r--r--src/mesa/state_tracker/st_inlines.h78
-rw-r--r--src/mesa/state_tracker/st_public.h4
-rw-r--r--src/mesa/state_tracker/st_texture.c48
-rw-r--r--src/mesa/state_tracker/st_texture.h28
30 files changed, 619 insertions, 586 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index e7255e3baa..5361b3b1e8 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -34,6 +34,7 @@
#include "pipe/p_screen.h"
#include "util/u_debug.h"
#include "util/u_atomic.h"
+#include "util/u_box.h"
#ifdef __cplusplus
@@ -95,8 +96,8 @@ pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf)
assert(ptr);
old_buf = *ptr;
- if (pipe_reference(&(*ptr)->reference, &buf->reference))
- old_buf->screen->buffer_destroy(old_buf);
+ if (pipe_reference(&(*ptr)->base.reference, &buf->base.reference))
+ old_buf->base.screen->resource_destroy(&old_buf->base);
*ptr = buf;
}
@@ -106,7 +107,7 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
struct pipe_surface *old_surf = *ptr;
if (pipe_reference(&(*ptr)->reference, &surf->reference))
- old_surf->texture->screen->tex_surface_destroy(old_surf);
+ old_surf->resource->screen->tex_surface_destroy(old_surf);
*ptr = surf;
}
@@ -115,8 +116,18 @@ pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex)
{
struct pipe_texture *old_tex = *ptr;
+ if (pipe_reference(&(*ptr)->base.reference, &tex->base.reference))
+ old_tex->base.screen->resource_destroy(&old_tex->base);
+ *ptr = tex;
+}
+
+static INLINE void
+pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex)
+{
+ struct pipe_resource *old_tex = *ptr;
+
if (pipe_reference(&(*ptr)->reference, &tex->reference))
- old_tex->screen->texture_destroy(old_tex);
+ old_tex->screen->resource_destroy(old_tex);
*ptr = tex;
}
@@ -129,87 +140,116 @@ static INLINE struct pipe_buffer *
pipe_buffer_create( struct pipe_screen *screen,
unsigned alignment, unsigned usage, unsigned size )
{
- return screen->buffer_create(screen, alignment, usage, size);
+ struct pipe_buffer buffer;
+ memset(&buffer, 0, sizeof buffer);
+ buffer.base.target = PIPE_RESOURCE_BUFFER;
+ buffer.base.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
+ buffer.base.usage = usage;
+ buffer.base.width0 = size;
+ buffer.base.height0 = 1;
+ buffer.base.depth0 = 1;
+ return (struct pipe_buffer *)screen->resource_create(screen, &buffer.base);
}
+#if 0
static INLINE struct pipe_buffer *
pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size )
{
return screen->user_buffer_create(screen, ptr, size);
}
+#endif
static INLINE void *
-pipe_buffer_map(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned usage)
+pipe_buffer_map_range(struct pipe_context *pipe,
+ struct pipe_buffer *buffer,
+ unsigned offset,
+ unsigned length,
+ unsigned usage,
+ struct pipe_transfer **transfer)
{
- if(screen->buffer_map_range) {
- unsigned offset = 0;
- unsigned length = buf->size;
- return screen->buffer_map_range(screen, buf, offset, length, usage);
- }
- else
- return screen->buffer_map(screen, buf, usage);
+ struct pipe_box box;
+
+ assert(offset < buffer->base.width0);
+ assert(offset + length <= buffer->base.width0);
+ assert(length);
+
+ u_box_1d(offset, length, &box);
+
+ *transfer = pipe->get_transfer( pipe,
+ &buffer->base,
+ u_subresource(0, 0),
+ usage,
+ &box);
+
+ if (*transfer == NULL)
+ return NULL;
+
+ return pipe->transfer_map( pipe, *transfer );
}
-static INLINE void
-pipe_buffer_unmap(struct pipe_screen *screen,
- struct pipe_buffer *buf)
+
+static INLINE void *
+pipe_buffer_map(struct pipe_context *pipe,
+ struct pipe_buffer *buffer,
+ unsigned usage,
+ struct pipe_transfer **transfer)
{
- screen->buffer_unmap(screen, buf);
+ return pipe_buffer_map_range(pipe, buffer, usage, 0, buffer->base.width0, transfer);
}
-static INLINE void *
-pipe_buffer_map_range(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length,
- unsigned usage)
+
+static INLINE void
+pipe_buffer_unmap(struct pipe_context *pipe,
+ struct pipe_buffer *buf,
+ struct pipe_transfer *transfer)
{
- assert(offset < buf->size);
- assert(offset + length <= buf->size);
- assert(length);
- if(screen->buffer_map_range)
- return screen->buffer_map_range(screen, buf, offset, length, usage);
- else
- return screen->buffer_map(screen, buf, usage);
+ if (transfer) {
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
+ }
}
static INLINE void
-pipe_buffer_flush_mapped_range(struct pipe_screen *screen,
- struct pipe_buffer *buf,
+pipe_buffer_flush_mapped_range(struct pipe_context *pipe,
+ struct pipe_transfer *transfer,
unsigned offset,
unsigned length)
{
- assert(offset < buf->size);
- assert(offset + length <= buf->size);
+ struct pipe_box box;
+
assert(length);
- if(screen->buffer_flush_mapped_range)
- screen->buffer_flush_mapped_range(screen, buf, offset, length);
+
+ u_box_1d(offset, length, &box);
+
+ pipe->transfer_flush_region(pipe, transfer, &box);
}
static INLINE void
-pipe_buffer_write(struct pipe_screen *screen,
+pipe_buffer_write(struct pipe_context *pipe,
struct pipe_buffer *buf,
- unsigned offset, unsigned size,
+ unsigned offset,
+ unsigned size,
const void *data)
{
- void *map;
-
- assert(offset < buf->size);
- assert(offset + size <= buf->size);
- assert(size);
-
- map = pipe_buffer_map_range(screen, buf, offset, size,
- PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
- PIPE_BUFFER_USAGE_DISCARD);
- assert(map);
- if(map) {
- memcpy((uint8_t *)map + offset, data, size);
- pipe_buffer_flush_mapped_range(screen, buf, offset, size);
- pipe_buffer_unmap(screen, buf);
- }
+ struct pipe_box box;
+ struct pipe_subresource subresource;
+
+ subresource.face = 0;
+ subresource.level = 0;
+
+ box.x = offset;
+ box.y = 0;
+ box.z = 0;
+ box.w = size;
+ box.h = 1;
+ box.d = 1;
+
+ pipe->transfer_inline_write( pipe,
+ &buf->base,
+ subresource,
+ PIPE_TRANSFER_WRITE,
+ &box,
+ data);
}
/**
@@ -219,86 +259,82 @@ pipe_buffer_write(struct pipe_screen *screen,
* been written before.
*/
static INLINE void
-pipe_buffer_write_nooverlap(struct pipe_screen *screen,
+pipe_buffer_write_nooverlap(struct pipe_context *pipe,
struct pipe_buffer *buf,
unsigned offset, unsigned size,
const void *data)
{
- void *map;
-
- assert(offset < buf->size);
- assert(offset + size <= buf->size);
- assert(size);
-
- map = pipe_buffer_map_range(screen, buf, offset, size,
- PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
- PIPE_BUFFER_USAGE_DISCARD |
- PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
- assert(map);
- if(map) {
- memcpy((uint8_t *)map + offset, data, size);
- pipe_buffer_flush_mapped_range(screen, buf, offset, size);
- pipe_buffer_unmap(screen, buf);
- }
+ struct pipe_box box;
+ struct pipe_subresource subresource;
+
+ subresource.face = 0;
+ subresource.level = 0;
+
+ box.x = offset;
+ box.y = 0;
+ box.z = 0;
+ box.w = size;
+ box.h = 1;
+ box.d = 1;
+
+ pipe->transfer_inline_write(pipe,
+ &buf->base,
+ subresource,
+ (PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_NOOVERWRITE),
+ &box,
+ data);
}
static INLINE void
-pipe_buffer_read(struct pipe_screen *screen,
+pipe_buffer_read(struct pipe_context *pipe,
struct pipe_buffer *buf,
unsigned offset, unsigned size,
void *data)
{
- void *map;
-
- assert(offset < buf->size);
- assert(offset + size <= buf->size);
- assert(size);
-
- map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_READ);
- assert(map);
- if(map) {
- memcpy(data, (const uint8_t *)map + offset, size);
- pipe_buffer_unmap(screen, buf);
- }
+ struct pipe_box box;
+ struct pipe_subresource subresource;
+
+ subresource.face = 0;
+ subresource.level = 0;
+
+ box.x = offset;
+ box.y = 0;
+ box.z = 0;
+ box.w = size;
+ box.h = 1;
+ box.d = 1;
+
+ pipe->transfer_inline_read( pipe,
+ &buf->base,
+ subresource,
+ PIPE_TRANSFER_READ,
+ &box,
+ data);
}
static INLINE void *
pipe_transfer_map( struct pipe_context *context,
- struct pipe_transfer *transf )
+ struct pipe_transfer *transfer )
{
- return context->transfer_map(context, transf);
+ return context->transfer_map( context, transfer );
}
static INLINE void
pipe_transfer_unmap( struct pipe_context *context,
- struct pipe_transfer *transf )
+ struct pipe_transfer *transfer )
{
- context->transfer_unmap(context, transf);
+ context->transfer_unmap( context, transfer );
}
+
static INLINE void
-pipe_transfer_destroy( struct pipe_context *context,
- struct pipe_transfer *transfer )
+pipe_transfer_destroy( struct pipe_context *context,
+ struct pipe_transfer *transfer )
{
- context->tex_transfer_destroy(context, transfer);
+ context->transfer_destroy(context, transfer);
}
-static INLINE unsigned
-pipe_transfer_buffer_flags( struct pipe_transfer *transf )
-{
- switch (transf->usage & PIPE_TRANSFER_READ_WRITE) {
- case PIPE_TRANSFER_READ_WRITE:
- return PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE;
- case PIPE_TRANSFER_READ:
- return PIPE_BUFFER_USAGE_CPU_READ;
- case PIPE_TRANSFER_WRITE:
- return PIPE_BUFFER_USAGE_CPU_WRITE;
- default:
- debug_assert(0);
- return 0;
- }
-}
#ifdef __cplusplus
}
diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h
index 8329087cfa..eff285b0ae 100644
--- a/src/gallium/auxiliary/util/u_tile.h
+++ b/src/gallium/auxiliary/util/u_tile.h
@@ -32,7 +32,7 @@
struct pipe_transfer;
-
+#if 0
/**
* Clip tile against transfer dims.
* \return TRUE if tile is totally clipped, FALSE otherwise
@@ -50,6 +50,7 @@ pipe_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_transfer *pt)
*h = pt->height - y;
return FALSE;
}
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index a7f12fb81e..82f60c3804 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -291,22 +291,9 @@ struct pipe_context {
* \param level mipmap level.
* \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
*/
- unsigned int (*is_texture_referenced)(struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level);
-
- /**
- * Check whether a buffer is referenced by an unflushed hw command.
- * The state-tracker uses this function to avoid unnecessary flushes.
- * It is safe (but wasteful) to always return
- * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
- * \param pipe context whose unflushed hw commands will be checked.
- * \param buf buffer to check.
- * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
- */
- unsigned int (*is_buffer_referenced)(struct pipe_context *pipe,
- struct pipe_buffer *buf);
-
+ unsigned int (*is_resource_referenced)(struct pipe_context *pipe,
+ struct pipe_resource *texture,
+ unsigned face, unsigned level);
/**
@@ -315,24 +302,50 @@ struct pipe_context {
* Transfers are (by default) context-private and allow uploads to be
* interleaved with
*/
- struct pipe_transfer *(*get_tex_transfer)(struct pipe_context *,
- struct pipe_texture *texture,
- unsigned face, unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y,
- unsigned w, unsigned h);
-
- void (*tex_transfer_destroy)(struct pipe_context *,
+ struct pipe_transfer *(*get_transfer)(struct pipe_context *,
+ struct pipe_resource *resource,
+ struct pipe_subresource,
+ enum pipe_transfer_usage,
+ const struct pipe_box *);
+
+ void (*transfer_destroy)(struct pipe_context *,
struct pipe_transfer *);
void *(*transfer_map)( struct pipe_context *,
struct pipe_transfer *transfer );
+ /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the
+ * regions specified with this call are guaranteed to be written to
+ * the resource.
+ */
+ void (*transfer_flush_region)( struct pipe_context *,
+ struct pipe_transfer *transfer,
+ const struct pipe_box *);
+
void (*transfer_unmap)( struct pipe_context *,
struct pipe_transfer *transfer );
+ /* One-shot transfer operation with data supplied in a user
+ * pointer. XXX: strides??
+ */
+ void (*transfer_inline_write)( struct pipe_context *,
+ struct pipe_resource *,
+ struct pipe_subresource,
+ enum pipe_transfer_usage,
+ const struct pipe_box *,
+ const void *data );
+
+ /* One-shot read transfer operation with data returned in a user
+ * pointer. XXX: strides??
+ */
+ void (*transfer_inline_read)( struct pipe_context *,
+ struct pipe_resource *,
+ struct pipe_subresource,
+ enum pipe_transfer_usage,
+ const struct pipe_box *,
+ void *data );
+
};
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 5c97dc87e8..4b50142aa7 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -137,10 +137,11 @@ enum pipe_error {
/** Texture types */
enum pipe_texture_target {
- PIPE_TEXTURE_1D = 0,
- PIPE_TEXTURE_2D = 1,
- PIPE_TEXTURE_3D = 2,
- PIPE_TEXTURE_CUBE = 3,
+ PIPE_BUFFER = 0,
+ PIPE_TEXTURE_1D = 1,
+ PIPE_TEXTURE_2D = 2,
+ PIPE_TEXTURE_3D = 3,
+ PIPE_TEXTURE_CUBE = 4,
PIPE_MAX_TEXTURE_TYPES
};
@@ -208,10 +209,23 @@ enum pipe_texture_target {
* Transfer object usage flags
*/
enum pipe_transfer_usage {
+ /**
+ * Resource contents read back (or accessed directly) at transfer
+ * create time.
+ */
PIPE_TRANSFER_READ = (1 << 0),
+
+ /**
+ * Resource contents will be written back at transfer_destroy
+ * time (or modified as a result of being accessed directly).
+ */
PIPE_TRANSFER_WRITE = (1 << 1),
- /** Read/modify/write */
+
+ /**
+ * Read/modify/write
+ */
PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE,
+
/**
* The transfer should map the texture storage directly. The driver may
* return NULL if that isn't possible, and the state tracker needs to cope
@@ -221,7 +235,54 @@ enum pipe_transfer_usage {
* does read/modify/write cycles on them directly, and a more complicated
* path which uses minimal read and write transfers.
*/
- PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2)
+ PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2),
+
+ /**
+ * Discards the memory within the mapped region.
+ *
+ * It should not be used with PIPE_TRANSFER_CPU_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
+ * - Direct3D's D3DLOCK_DISCARD flag.
+ */
+ PIPE_TRANSFER_DISCARD = (1 << 8),
+
+ /**
+ * Fail if the resource cannot be mapped immediately.
+ *
+ * See also:
+ * - Direct3D's D3DLOCK_DONOTWAIT flag.
+ * - Mesa3D's MESA_MAP_NOWAIT_BIT flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag.
+ */
+ PIPE_TRANSFER_DONTBLOCK = (1 << 9),
+
+ /**
+ * Do not attempt to synchronize pending operations on the resource when mapping.
+ *
+ * It should not be used with PIPE_TRANSFER_CPU_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag.
+ * - Direct3D's D3DLOCK_NOOVERWRITE flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag.
+ */
+ PIPE_TRANSFER_UNSYNCHRONIZED = (1 << 10),
+ PIPE_TRANSFER_NOOVERWRITE = (1 << 10), /* are these really the same?? */
+
+ /**
+ * Written ranges will be notified later with
+ * pipe_context::transfer_flush_region.
+ *
+ * It should not be used with PIPE_TRANSFER_CPU_READ.
+ *
+ * See also:
+ * - pipe_context::transfer_flush_region
+ * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
+ */
+ PIPE_TRANSFER_FLUSH_EXPLICIT = (1 << 11),
+
};
@@ -238,73 +299,6 @@ enum pipe_transfer_usage {
#define PIPE_BUFFER_USAGE_INDEX (1 << 6)
#define PIPE_BUFFER_USAGE_CONSTANT (1 << 7)
-/*
- * CPU access flags.
- *
- * These flags should only be used for texture transfers or when mapping
- * buffers.
- *
- * Note that the PIPE_BUFFER_USAGE_CPU_xxx flags above are also used for
- * mapping. Either PIPE_BUFFER_USAGE_CPU_READ or PIPE_BUFFER_USAGE_CPU_WRITE
- * must be set.
- */
-
-/**
- * Discards the memory within the mapped region.
- *
- * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
- *
- * See also:
- * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
- * - Direct3D's D3DLOCK_DISCARD flag.
- */
-#define PIPE_BUFFER_USAGE_DISCARD (1 << 8)
-
-/**
- * Fail if the resource cannot be mapped immediately.
- *
- * See also:
- * - Direct3D's D3DLOCK_DONOTWAIT flag.
- * - Mesa3D's MESA_MAP_NOWAIT_BIT flag.
- * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag.
- */
-#define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9)
-
-/**
- * Do not attempt to synchronize pending operations on the resource when mapping.
- *
- * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
- *
- * See also:
- * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag.
- * - Direct3D's D3DLOCK_NOOVERWRITE flag.
- * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag.
- */
-#define PIPE_BUFFER_USAGE_UNSYNCHRONIZED (1 << 10)
-
-/**
- * Written ranges will be notified later with
- * pipe_screen::buffer_flush_mapped_range.
- *
- * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
- *
- * See also:
- * - pipe_screen::buffer_flush_mapped_range
- * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
- */
-#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 11)
-
-/** Pipe driver custom usage flags should be greater or equal to this value */
-#define PIPE_BUFFER_USAGE_CUSTOM (1 << 16)
-
-/* Convenient shortcuts */
-#define PIPE_BUFFER_USAGE_CPU_READ_WRITE \
- ( PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE )
-#define PIPE_BUFFER_USAGE_GPU_READ_WRITE \
- ( PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE )
-#define PIPE_BUFFER_USAGE_WRITE \
- ( PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_GPU_WRITE )
-
/**
* Flush types:
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b7cb83abbe..379b8ed906 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -56,6 +56,7 @@ struct pipe_fence_handle;
struct pipe_winsys;
struct pipe_buffer;
struct pipe_texture;
+struct pipe_resource;
struct pipe_surface;
struct pipe_video_surface;
struct pipe_transfer;
@@ -106,35 +107,35 @@ struct pipe_screen {
/**
* Create a new texture object, using the given template info.
*/
- struct pipe_texture * (*texture_create)(struct pipe_screen *,
- const struct pipe_texture *templat);
+ struct pipe_resource * (*resource_create)(struct pipe_screen *,
+ const struct pipe_resource *template);
/**
* Create a texture from a winsys_handle. The handle is often created in
* another process by first creating a pipe texture and then calling
* texture_get_handle.
*/
- struct pipe_texture * (*texture_from_handle)(struct pipe_screen *,
- const struct pipe_texture *templat,
- struct winsys_handle *handle);
+ struct pipe_resource * (*resource_from_handle)(struct pipe_screen *,
+ const struct pipe_resource *template,
+ struct winsys_handle *handle);
/**
* Get a winsys_handle from a texture. Some platforms/winsys requires
* that the texture is created with a special usage flag like
* DISPLAYTARGET or PRIMARY.
*/
- boolean (*texture_get_handle)(struct pipe_screen *,
- struct pipe_texture *tex,
- struct winsys_handle *handle);
+ boolean (*resource_get_handle)(struct pipe_screen *,
+ struct pipe_resource *tex,
+ struct winsys_handle *handle);
- void (*texture_destroy)(struct pipe_texture *pt);
+ void (*resource_destroy)(struct pipe_resource *pt);
/** Get a 2D surface which is a "view" into a texture
* \param usage bitmaks of PIPE_BUFFER_USAGE_* read/write flags
*/
struct pipe_surface *(*get_tex_surface)(struct pipe_screen *,
- struct pipe_texture *texture,
+ struct pipe_resource *resource,
unsigned face, unsigned level,
unsigned zslice,
unsigned usage );
@@ -144,98 +145,6 @@ struct pipe_screen {
/**
- * Create a new buffer.
- * \param alignment buffer start address alignment in bytes
- * \param usage bitmask of PIPE_BUFFER_USAGE_x
- * \param size size in bytes
- */
- struct pipe_buffer *(*buffer_create)( struct pipe_screen *screen,
- unsigned alignment,
- unsigned usage,
- unsigned size );
-
- /**
- * Create a buffer that wraps user-space data.
- *
- * Effectively this schedules a delayed call to buffer_create
- * followed by an upload of the data at *some point in the future*,
- * or perhaps never. Basically the allocate/upload is delayed
- * until the buffer is actually passed to hardware.
- *
- * The intention is to provide a quick way to turn regular data
- * into a buffer, and secondly to avoid a copy operation if that
- * data subsequently turns out to be only accessed by the CPU.
- *
- * Common example is OpenGL vertex buffers that are subsequently
- * processed either by software TNL in the driver or by passing to
- * hardware.
- *
- * XXX: What happens if the delayed call to buffer_create() fails?
- *
- * Note that ptr may be accessed at any time upto the time when the
- * buffer is destroyed, so the data must not be freed before then.
- */
- struct pipe_buffer *(*user_buffer_create)(struct pipe_screen *screen,
- void *ptr,
- unsigned bytes);
-
-
-
- /**
- * Map the entire data store of a buffer object into the client's address.
- * flags is bitmask of PIPE_BUFFER_USAGE_CPU_READ/WRITE flags.
- */
- void *(*buffer_map)( struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned usage );
- /**
- * Map a subrange of the buffer data store into the client's address space.
- *
- * The returned pointer is always relative to buffer start, regardless of
- * the specified range. This is different from the ARB_map_buffer_range
- * semantics because we don't forbid multiple mappings of the same buffer
- * (yet).
- */
- void *(*buffer_map_range)( struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length,
- unsigned usage);
-
- /**
- * Notify a range that was actually written into.
- *
- * Can only be used if the buffer was mapped with the
- * PIPE_BUFFER_USAGE_CPU_WRITE and PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flags
- * set.
- *
- * The range is relative to the buffer start, regardless of the range
- * specified to buffer_map_range. This is different from the
- * ARB_map_buffer_range semantics because we don't forbid multiple mappings
- * of the same buffer (yet).
- *
- */
- void (*buffer_flush_mapped_range)( struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length);
-
- /**
- * Unmap buffer.
- *
- * If the buffer was mapped with PIPE_BUFFER_USAGE_CPU_WRITE flag but not
- * PIPE_BUFFER_USAGE_FLUSH_EXPLICIT then the pipe driver will
- * assume that the whole buffer was written. This is mostly for backward
- * compatibility purposes and may affect performance -- the state tracker
- * should always specify exactly what got written while the buffer was
- * mapped.
- */
- void (*buffer_unmap)( struct pipe_screen *screen,
- struct pipe_buffer *buf );
-
- void (*buffer_destroy)( struct pipe_buffer *buf );
-
- /**
* Create a video surface suitable for use as a decoding target by the
* driver's pipe_video_context.
*/
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 3a97d888ce..5c8d452e2a 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -71,19 +71,6 @@ struct pipe_reference
};
-/**
- * The driver will certainly subclass this to include actual memory
- * management information.
- */
-struct pipe_buffer
-{
- struct pipe_reference reference;
- unsigned size;
- struct pipe_screen *screen;
- unsigned alignment;
- unsigned usage;
-};
-
/**
* Primitive (point/line/tri) rasterization info
@@ -285,62 +272,86 @@ struct pipe_sampler_state
struct pipe_surface
{
struct pipe_reference reference;
+ struct pipe_resource *resource; /**< resource into which this is a view */
enum pipe_format format;
+
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_BUFFER_USAGE_x */
unsigned zslice;
- struct pipe_texture *texture; /**< texture into which this is a view */
unsigned face;
unsigned level;
};
+
+
+
/**
* Transfer object. For data transfer to/from a texture.
*/
struct pipe_transfer
{
- 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 */
- unsigned stride; /**< stride in bytes between rows of blocks */
- enum pipe_transfer_usage usage; /**< PIPE_TRANSFER_* */
-
- struct pipe_texture *texture; /**< texture to transfer to/from */
- unsigned face;
- unsigned level;
- unsigned zslice;
+ struct pipe_resource *texture; /**< resource to transfer to/from */
+ unsigned stride;
+ unsigned slice_stride;
+ void *data;
};
-/**
- * Texture object.
- */
-struct pipe_texture
-{
- struct pipe_reference reference;
+#define PIPE_RESOURCE_BUFFER 1
+#define PIPE_RESOURCE_TEXTURE 2
+/* etc */
+struct pipe_resource
+{
+ struct pipe_reference reference;
+ struct pipe_screen *screen; /**< screen that this texture belongs to */
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
enum pipe_format format; /**< PIPE_FORMAT_x */
unsigned width0;
unsigned height0;
unsigned depth0;
-
unsigned last_level:8; /**< Index of last mipmap level present/defined */
-
unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */
+ unsigned usage; /* xxx: unify with tex_usage */
unsigned tex_usage; /**< bitmask of PIPE_TEXTURE_USAGE_* */
+};
- struct pipe_screen *screen; /**< screen that this texture belongs to */
+/* Transition helpers:
+ */
+struct pipe_buffer {
+ struct pipe_resource base;
+};
+
+struct pipe_texture {
+ struct pipe_resource base;
+};
+
+
+struct pipe_subresource
+{
+ unsigned face:16;
+ unsigned level:16;
};
+struct pipe_box
+{
+ unsigned x;
+ unsigned y;
+ unsigned z;
+ unsigned w;
+ unsigned h;
+ unsigned d;
+};
+
+
/**
* A vertex buffer. Typically, all the vertex data/attributes for
@@ -352,7 +363,7 @@ struct pipe_vertex_buffer
unsigned stride; /**< stride to same attrib in next vertex, in bytes */
unsigned max_index; /**< number of vertices in this buffer */
unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */
- struct pipe_buffer *buffer; /**< the actual buffer */
+ struct pipe_resource *buffer; /**< the actual buffer */
};
diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h
index 6ae31418fa..927bdf15d7 100644
--- a/src/gallium/include/pipe/p_video_context.h
+++ b/src/gallium/include/pipe/p_video_context.h
@@ -63,7 +63,7 @@ struct pipe_video_context
/*@{*/
void (*decode_bitstream)(struct pipe_video_context *vpipe,
unsigned num_bufs,
- struct pipe_buffer **bitstream_buf);
+ struct pipe_resource **bitstream_buf);
void (*decode_macroblocks)(struct pipe_video_context *vpipe,
struct pipe_video_surface *past,
diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
index 77e22d0a56..2f2164ace7 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -171,10 +171,10 @@ struct pipe_mpeg12_picture_desc
unsigned alternate_scan;
unsigned full_pel_forward_vector;
unsigned full_pel_backward_vector;
- struct pipe_buffer *intra_quantizer_matrix;
- struct pipe_buffer *non_intra_quantizer_matrix;
- struct pipe_buffer *chroma_intra_quantizer_matrix;
- struct pipe_buffer *chroma_non_intra_quantizer_matrix;
+ struct pipe_resource *intra_quantizer_matrix;
+ struct pipe_resource *non_intra_quantizer_matrix;
+ struct pipe_resource *chroma_intra_quantizer_matrix;
+ struct pipe_resource *chroma_non_intra_quantizer_matrix;
};
#endif
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index bdec0e254f..f94cca4c90 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -264,15 +264,20 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
assert(pPix->drawable.width <= priv->tex->width0);
assert(pPix->drawable.height <= priv->tex->height0);
+ u_box_wh(&box,
+ pPix->drawable.width,
+ pPix->drawable.height);
+
priv->map_transfer =
- exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0,
+ exa->pipe->get_transfer(exa->pipe,
+ priv->tex,
+ u_subresource(0, 0),
#ifdef EXA_MIXED_PIXMAPS
- PIPE_TRANSFER_MAP_DIRECTLY |
+ PIPE_TRANSFER_MAP_DIRECTLY |
#endif
- PIPE_TRANSFER_READ_WRITE,
- 0, 0,
- pPix->drawable.width,
- pPix->drawable.height );
+ PIPE_TRANSFER_READ_WRITE,
+
+ &box );
if (!priv->map_transfer)
#ifdef EXA_MIXED_PIXMAPS
return FALSE;
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index fba7bfe2ce..bd32ffec0e 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -46,7 +46,7 @@
/**
* When doing GL render to texture, we have to be sure that finalize_texture()
- * didn't yank out the pipe_texture that we earlier created a surface for.
+ * didn't yank out the pipe_resource that we earlier created a surface for.
* Check for that here and create a new surface if needed.
*/
static void
@@ -54,29 +54,29 @@ update_renderbuffer_surface(struct st_context *st,
struct st_renderbuffer *strb)
{
struct pipe_screen *screen = st->pipe->screen;
- struct pipe_texture *texture = strb->rtt->pt;
+ struct pipe_resource *resource = strb->rtt->pt;
int rtt_width = strb->Base.Width;
int rtt_height = strb->Base.Height;
if (!strb->surface ||
- strb->surface->texture != texture ||
+ strb->surface->resource != resource ||
strb->surface->width != rtt_width ||
strb->surface->height != rtt_height) {
GLuint level;
/* find matching mipmap level size */
- for (level = 0; level <= texture->last_level; level++) {
- if (u_minify(texture->width0, level) == rtt_width &&
- u_minify(texture->height0, level) == rtt_height) {
+ for (level = 0; level <= resource->last_level; level++) {
+ if (u_minify(resource->width0, level) == rtt_width &&
+ u_minify(resource->height0, level) == rtt_height) {
pipe_surface_reference(&strb->surface, NULL);
strb->surface = screen->get_tex_surface(screen,
- texture,
- strb->rtt_face,
- level,
- strb->rtt_slice,
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ resource,
+ strb->rtt_face,
+ level,
+ strb->rtt_slice,
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE);
#if 0
printf("-- alloc new surface %d x %d into tex %p\n",
strb->surface->width, strb->surface->height,
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index b446b2079c..37f356afb3 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -112,11 +112,11 @@ make_state_key(GLcontext *ctx, struct state_key *key)
}
-static struct pipe_texture *
+static struct pipe_resource *
create_color_map_texture(GLcontext *ctx)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
enum pipe_format format;
const uint texSize = 256; /* simple, and usually perfect */
@@ -135,7 +135,7 @@ create_color_map_texture(GLcontext *ctx)
* Update the pixelmap texture with the contents of the R/G/B/A pixel maps.
*/
static void
-load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
+load_color_map_texture(GLcontext *ctx, struct pipe_resource *pt)
{
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_transfer *transfer;
@@ -150,7 +150,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
transfer = st_cond_flush_get_tex_transfer(st_context(ctx),
pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
0, 0, texSize, texSize);
- dest = (uint *) pipe->transfer_map(pipe, transfer);
+ dest = (uint *) pipe_transfer_map(pipe, transfer);
/* Pack four 1D maps into a 2D texture:
* R map is placed horizontally, indexed by S, in channel 0
@@ -171,8 +171,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
}
}
- pipe->transfer_unmap(pipe, transfer);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe_transfer_unmap(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 57b71c1e7b..aae9a2dc1b 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -56,7 +56,7 @@ update_textures(struct st_context *st)
/* loop over sampler units (aka tex image units) */
for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) {
- struct pipe_texture *pt = NULL;
+ struct pipe_resource *pt = NULL;
if (samplersUsed & (1 << su)) {
struct gl_texture_object *texObj;
@@ -96,7 +96,7 @@ update_textures(struct st_context *st)
}
*/
- pipe_texture_reference(&st->state.sampler_texture[su], pt);
+ pipe_resource_reference(&st->state.sampler_texture[su], pt);
}
cso_set_sampler_textures(st->cso_context,
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 01aba3e3dd..a693141921 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -137,7 +137,8 @@ accum_accum(struct st_context *st, GLfloat value,
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
- color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture,
+ color_trans = st_cond_flush_get_tex_transfer(st,
+ color_strb->texture,
0, 0, 0,
PIPE_TRANSFER_READ, xpos, ypos,
width, height);
@@ -165,7 +166,7 @@ accum_accum(struct st_context *st, GLfloat value,
}
free(buf);
- pipe->tex_transfer_destroy(pipe, color_trans);
+ pipe->transfer_destroy(pipe, color_trans);
}
@@ -213,7 +214,7 @@ accum_load(struct st_context *st, GLfloat value,
}
free(buf);
- pipe->tex_transfer_destroy(pipe, color_trans);
+ pipe->transfer_destroy(pipe, color_trans);
}
@@ -280,7 +281,7 @@ accum_return(GLcontext *ctx, GLfloat value,
pipe_put_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
free(buf);
- pipe->tex_transfer_destroy(pipe, color_trans);
+ pipe->transfer_destroy(pipe, color_trans);
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index dfd8925edf..46352488bb 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -92,7 +92,7 @@ struct bitmap_cache
/** Bitmap's Z position */
GLfloat zpos;
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
struct pipe_transfer *trans;
GLboolean empty;
@@ -253,7 +253,7 @@ unpack_bitmap(struct st_context *st,
/**
* Create a texture which represents a bitmap image.
*/
-static struct pipe_texture *
+static struct pipe_resource *
make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap)
@@ -261,7 +261,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_transfer *transfer;
ubyte *dest;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
/* PBO source... */
bitmap = _mesa_map_pbo_source(ctx, unpack, bitmap);
@@ -284,7 +284,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
PIPE_TRANSFER_WRITE,
0, 0, width, height);
- dest = pipe->transfer_map(pipe, transfer);
+ dest = pipe_transfer_map(pipe, transfer);
/* Put image into texture transfer */
memset(dest, 0xff, height * transfer->stride);
@@ -294,8 +294,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
_mesa_unmap_pbo_source(ctx, unpack);
/* Release transfer */
- pipe->transfer_unmap(pipe, transfer);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe_transfer_unmap(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
return pt;
}
@@ -397,7 +397,7 @@ setup_bitmap_vertex_data(struct st_context *st,
static void
draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
const GLfloat *color)
{
struct st_context *st = ctx->st;
@@ -465,7 +465,7 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* user textures, plus the bitmap texture */
{
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
+ struct pipe_resource *textures[PIPE_MAX_SAMPLERS];
uint num = MAX2(stfp->bitmap_sampler + 1, st->state.num_textures);
memcpy(textures, st->state.sampler_texture, sizeof(textures));
textures[stfp->bitmap_sampler] = pt;
@@ -530,7 +530,7 @@ reset_cache(struct st_context *st)
cache->ymax = -1000000;
if (cache->trans) {
- pipe->tex_transfer_destroy(pipe, cache->trans);
+ pipe->transfer_destroy(pipe, cache->trans);
cache->trans = NULL;
}
@@ -580,7 +580,7 @@ create_cache_trans(struct st_context *st)
PIPE_TRANSFER_WRITE, 0, 0,
BITMAP_CACHE_WIDTH,
BITMAP_CACHE_HEIGHT);
- cache->buffer = pipe->transfer_map(pipe, cache->trans);
+ cache->buffer = pipe_transfer_map(pipe, cache->trans);
/* init image to all 0xff */
memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT);
@@ -613,10 +613,10 @@ st_flush_bitmap_cache(struct st_context *st)
if (cache->trans) {
if (0)
print_cache(cache);
- pipe->transfer_unmap(pipe, cache->trans);
+ pipe_transfer_unmap(pipe, cache->trans);
cache->buffer = NULL;
- pipe->tex_transfer_destroy(pipe, cache->trans);
+ pipe->transfer_destroy(pipe, cache->trans);
cache->trans = NULL;
}
@@ -630,7 +630,7 @@ st_flush_bitmap_cache(struct st_context *st)
}
/* release/free the texture */
- pipe_texture_reference(&cache->texture, NULL);
+ pipe_resource_reference(&cache->texture, NULL);
reset_cache(st);
}
@@ -726,7 +726,7 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
{
struct st_context *st = ctx->st;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
if (width == 0 || height == 0)
return;
@@ -749,12 +749,12 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
pt = make_bitmap_texture(ctx, width, height, unpack, bitmap);
if (pt) {
- assert(pt->target == PIPE_TEXTURE_2D);
+ assert(pt->base.target == PIPE_TEXTURE_2D);
draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
width, height, pt,
st->ctx->Current.RasterColor);
/* release/free the texture */
- pipe_texture_reference(&pt, NULL);
+ pipe_resource_reference(&pt, NULL);
}
}
@@ -835,10 +835,10 @@ st_destroy_bitmap(struct st_context *st)
if (cache) {
if (cache->trans) {
- pipe->transfer_unmap(pipe, cache->trans);
- pipe->tex_transfer_destroy(pipe, cache->trans);
+ pipe_transfer_unmap(pipe, cache->trans);
+ pipe->transfer_destroy(pipe, cache->trans);
}
- pipe_texture_reference(&st->bitmap.cache->texture, NULL);
+ pipe_resource_reference(&st->bitmap.cache->texture, NULL);
free(st->bitmap.cache);
st->bitmap.cache = NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c
index 36e03018d9..2700e7d2ac 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -123,7 +123,7 @@ st_BlitFramebuffer(GLcontext *ctx,
return;
srcSurf = screen->get_tex_surface(screen,
- srcObj->pt,
+ &srcObj->pt->base,
srcAtt->CubeMapFace,
srcAtt->TextureLevel,
srcAtt->Zoffset,
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index b55a085cc7..2bda0a3196 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -76,6 +76,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
struct st_buffer_object *st_obj = st_buffer_object(obj);
assert(obj->RefCount == 0);
+ assert(st_obj->transfer == NULL);
if (st_obj->buffer)
pipe_buffer_reference(&st_obj->buffer, NULL);
@@ -116,8 +117,15 @@ st_bufferobj_subdata(GLcontext *ctx,
if (!data)
return;
- st_cond_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer,
- offset, size, data);
+ /* Now that transfers are per-context, we don't have to figure out
+ * flushing here. Usually drivers won't need to flush in this case
+ * even if the buffer is currently referenced by hardware - they
+ * just queue the upload as dma rather than mapping the underlying
+ * buffer directly.
+ */
+ pipe_buffer_write(st_context(ctx)->pipe,
+ st_obj->buffer,
+ offset, size, data);
}
@@ -141,7 +149,8 @@ st_bufferobj_get_subdata(GLcontext *ctx,
if (!size)
return;
- st_cond_flush_pipe_buffer_read(st_context(ctx), st_obj->buffer,
+ st_cond_flush_pipe_buffer_read(st_context(ctx),
+ st_obj->buffer,
offset, size, data);
}
@@ -211,6 +220,8 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
struct gl_buffer_object *obj)
{
struct st_buffer_object *st_obj = st_buffer_object(obj);
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct pipe_box box;
uint flags;
switch (access) {
@@ -227,9 +238,16 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
break;
}
- obj->Pointer = st_cond_flush_pipe_buffer_map(st_context(ctx),
- st_obj->buffer,
- flags);
+ u_box_1d( 0, st_obj->buffer->base.width0, &box );
+
+ st_obj->transfer = pipe->get_transfer( pipe,
+ &st_obj->buffer->base,
+ u_subresource(0, 0),
+ flags,
+ &box);
+
+ obj->Pointer = pipe_transfer_map( pipe,
+ st_obj->transfer );
if (obj->Pointer) {
obj->Offset = 0;
obj->Length = obj->Size;
@@ -255,25 +273,26 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
- uint flags = 0x0;
+ enum pipe_transfer_usage flags = 0x0;
+ struct pipe_box box;
if (access & GL_MAP_WRITE_BIT)
- flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+ flags |= PIPE_TRANSFER_WRITE;
if (access & GL_MAP_READ_BIT)
- flags |= PIPE_BUFFER_USAGE_CPU_READ;
+ flags |= PIPE_TRANSFER_READ;
if (access & GL_MAP_FLUSH_EXPLICIT_BIT)
- flags |= PIPE_BUFFER_USAGE_FLUSH_EXPLICIT;
+ flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
if (access & GL_MAP_UNSYNCHRONIZED_BIT)
- flags |= PIPE_BUFFER_USAGE_UNSYNCHRONIZED;
+ flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
/* ... other flags ...
*/
if (access & MESA_MAP_NOWAIT_BIT)
- flags |= PIPE_BUFFER_USAGE_DONTBLOCK;
+ flags |= PIPE_TRANSFER_DONTBLOCK;
assert(offset >= 0);
assert(length >= 0);
@@ -286,13 +305,22 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
*/
if (!length) {
obj->Pointer = &st_bufferobj_zero_length_range;
+ return obj->Pointer;
}
- else {
- obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags);
- if (obj->Pointer) {
- obj->Pointer = (ubyte *) obj->Pointer + offset;
- }
- }
+
+ u_box_1d( offset, length, &box );
+
+ st_obj->transfer = pipe->get_transfer(pipe,
+ &st_obj->buffer->base,
+ u_subresource(0,0),
+ flags,
+ &box);
+ if (st_obj->transfer == NULL)
+ goto fail;
+
+ obj->Pointer = pipe->transfer_map(pipe, st_obj->transfer);
+ if (obj->Pointer == NULL)
+ goto fail;
if (obj->Pointer) {
obj->Offset = offset;
@@ -301,6 +329,12 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
}
return obj->Pointer;
+
+fail:
+ if (st_obj->transfer)
+ pipe->transfer_destroy( pipe, st_obj->transfer );
+
+ return NULL;
}
@@ -311,17 +345,23 @@ st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
+ struct pipe_box box;
/* Subrange is relative to mapped range */
assert(offset >= 0);
assert(length >= 0);
assert(offset + length <= obj->Length);
+ assert(st_obj->transfer);
+ assert(obj->Pointer);
if (!length)
return;
- pipe_buffer_flush_mapped_range(pipe->screen, st_obj->buffer,
- obj->Offset + offset, length);
+ u_box_1d(offset, length, &box);
+
+ pipe->transfer_flush_region(pipe,
+ st_obj->transfer,
+ &box);
}
@@ -334,9 +374,14 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
- if(obj->Length)
- pipe_buffer_unmap(pipe->screen, st_obj->buffer);
+ /* Special case again for zero-length maps:
+ */
+ if (obj->Length) {
+ pipe->transfer_unmap(pipe, st_obj->transfer);
+ pipe->transfer_destroy(pipe, st_obj->transfer);
+ }
+ st_obj->transfer = NULL;
obj->Pointer = NULL;
obj->Offset = 0;
obj->Length = 0;
@@ -357,6 +402,8 @@ st_copy_buffer_subdata(GLcontext *ctx,
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *srcObj = st_buffer_object(src);
struct st_buffer_object *dstObj = st_buffer_object(dst);
+ struct pipe_transfer *src_transfer;
+ struct pipe_transfer *dst_transfer;
ubyte *srcPtr, *dstPtr;
if(!size)
@@ -366,21 +413,36 @@ st_copy_buffer_subdata(GLcontext *ctx,
assert(!src->Pointer);
assert(!dst->Pointer);
- srcPtr = (ubyte *) pipe_buffer_map_range(pipe->screen,
+ srcPtr = (ubyte *) pipe_buffer_map_range(pipe,
srcObj->buffer,
readOffset, size,
- PIPE_BUFFER_USAGE_CPU_READ);
+ PIPE_TRANSFER_READ,
+ &src_transfer);
- dstPtr = (ubyte *) pipe_buffer_map_range(pipe->screen,
+ dstPtr = (ubyte *) pipe_buffer_map_range(pipe,
dstObj->buffer,
writeOffset, size,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ PIPE_TRANSFER_WRITE,
+ &dst_transfer);
if (srcPtr && dstPtr)
memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
- pipe_buffer_unmap(pipe->screen, srcObj->buffer);
- pipe_buffer_unmap(pipe->screen, dstObj->buffer);
+ pipe_buffer_unmap(pipe, srcObj->buffer, src_transfer);
+ pipe_buffer_unmap(pipe, dstObj->buffer, dst_transfer);
+}
+
+
+/* TODO: if buffer wasn't created with appropriate usage flags, need
+ * to recreate it now and copy contents -- or possibly create a
+ * gallium entrypoint to extend the usage flags and let the driver
+ * decide if a copy is necessary.
+ */
+void
+st_bufferobj_validate_usage(struct st_context *st,
+ struct st_buffer_object *obj,
+ unsigned usage)
+{
}
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h b/src/mesa/state_tracker/st_cb_bufferobjects.h
index fda6d05dd3..527b489e60 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -39,7 +39,8 @@ struct pipe_buffer;
struct st_buffer_object
{
struct gl_buffer_object Base;
- struct pipe_buffer *buffer;
+ struct pipe_buffer *buffer; /* GPU storage */
+ struct pipe_transfer *transfer; /* In-progress map information */
};
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index c44d0fc3e8..eef5affbc9 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -297,13 +297,13 @@ base_format(GLenum format)
* If width, height are not POT and the driver only handles POT textures,
* allocate the next larger size of texture that is POT.
*/
-static struct pipe_texture *
+static struct pipe_resource *
alloc_texture(struct st_context *st, GLsizei width, GLsizei height,
enum pipe_format texFormat)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
int ptw, pth;
ptw = width;
@@ -341,7 +341,7 @@ alloc_texture(struct st_context *st, GLsizei width, GLsizei height,
* Make texture containing an image for glDrawPixels image.
* If 'pixels' is NULL, leave the texture image data undefined.
*/
-static struct pipe_texture *
+static struct pipe_resource *
make_texture(struct st_context *st,
GLsizei width, GLsizei height, GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
@@ -350,7 +350,7 @@ make_texture(struct st_context *st,
GLcontext *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
gl_format mformat;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
enum pipe_format pipeFormat;
GLuint cpp;
GLenum baseFormat;
@@ -390,7 +390,7 @@ make_texture(struct st_context *st,
width, height);
/* map texture transfer */
- dest = pipe->transfer_map(pipe, transfer);
+ dest = pipe_transfer_map(pipe, transfer);
/* Put image into texture transfer.
@@ -410,8 +410,8 @@ make_texture(struct st_context *st,
unpack);
/* unmap */
- pipe->transfer_unmap(pipe, transfer);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe_transfer_unmap(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
assert(success);
@@ -525,7 +525,7 @@ static void
draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
GLfloat zoomX, GLfloat zoomY,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
void *driver_vp,
void *driver_fp,
const GLfloat *color,
@@ -608,7 +608,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* texture state: */
if (st->pixel_xfer.pixelmap_enabled) {
- struct pipe_texture *textures[2];
+ struct pipe_resource *textures[2];
textures[0] = pt;
textures[1] = st->pixel_xfer.pixelmap_texture;
pipe->set_fragment_sampler_textures(pipe, 2, textures);
@@ -690,7 +690,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
usage, x, y,
width, height);
- stmap = pipe->transfer_map(pipe, pt);
+ stmap = pipe_transfer_map(pipe, pt);
pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels);
assert(pixels);
@@ -790,8 +790,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
_mesa_unmap_pbo_source(ctx, &clippedUnpack);
/* unmap the stencil buffer */
- pipe->transfer_unmap(pipe, pt);
- pipe->tex_transfer_destroy(pipe, pt);
+ pipe_transfer_unmap(pipe, pt);
+ pipe->transfer_destroy(pipe, pt);
}
@@ -832,7 +832,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* draw with textured quad */
{
- struct pipe_texture *pt
+ struct pipe_resource *pt
= make_texture(st, width, height, format, type, unpack, pixels);
if (pt) {
draw_textured_quad(ctx, x, y, ctx->Current.RasterPos[2],
@@ -841,7 +841,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
driver_vp,
driver_fp,
color, GL_FALSE);
- pipe_texture_reference(&pt, NULL);
+ pipe_resource_reference(&pt, NULL);
}
}
}
@@ -890,7 +890,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
assert(util_format_get_blockheight(ptDraw->texture->format) == 1);
/* map the stencil buffer */
- drawMap = pipe->transfer_map(pipe, ptDraw);
+ drawMap = pipe_transfer_map(pipe, ptDraw);
/* draw */
/* XXX PixelZoom not handled yet */
@@ -943,8 +943,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
free(buffer);
/* unmap the stencil buffer */
- pipe->transfer_unmap(pipe, ptDraw);
- pipe->tex_transfer_destroy(pipe, ptDraw);
+ pipe_transfer_unmap(pipe, ptDraw);
+ pipe->transfer_destroy(pipe, ptDraw);
}
@@ -958,7 +958,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
struct pipe_screen *screen = pipe->screen;
struct st_renderbuffer *rbRead;
void *driver_vp, *driver_fp;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
GLfloat *color;
enum pipe_format srcFormat, texFormat;
GLboolean invertTex = GL_FALSE;
@@ -1015,7 +1015,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
}
- srcFormat = rbRead->texture->format;
+ srcFormat = rbRead->texture->base.format;
if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
@@ -1101,7 +1101,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
- if (type == GL_DEPTH && util_format_is_depth_and_stencil(pt->format))
+ if (type == GL_DEPTH && util_format_is_depth_and_stencil(pt->base.format))
transfer_usage = PIPE_TRANSFER_READ_WRITE;
else
transfer_usage = PIPE_TRANSFER_WRITE;
@@ -1126,8 +1126,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
free(buf);
}
- pipe->tex_transfer_destroy(pipe, ptRead);
- pipe->tex_transfer_destroy(pipe, ptTex);
+ pipe->transfer_destroy(pipe, ptRead);
+ pipe->transfer_destroy(pipe, ptTex);
}
/* draw textured quad */
@@ -1138,7 +1138,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
driver_fp,
color, invertTex);
- pipe_texture_reference(&pt, NULL);
+ pipe_resource_reference(&pt, NULL);
}
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index abf0c8d6cb..f15ff3c761 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -96,13 +96,13 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
return strb->data != NULL;
}
else {
- struct pipe_texture template;
+ struct pipe_resource template;
unsigned surface_usage;
/* Free the old surface and texture
*/
pipe_surface_reference( &strb->surface, NULL );
- pipe_texture_reference( &strb->texture, NULL );
+ pipe_resource_reference( &strb->texture, NULL );
/* Setup new texture template.
*/
@@ -131,7 +131,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
PIPE_BUFFER_USAGE_CPU_WRITE);
#endif
- strb->texture = screen->texture_create(screen, &template);
+ strb->texture = screen->resource_create(screen, &template);
if (!strb->texture)
return FALSE;
@@ -161,7 +161,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb)
struct st_renderbuffer *strb = st_renderbuffer(rb);
ASSERT(strb);
pipe_surface_reference(&strb->surface, NULL);
- pipe_texture_reference(&strb->texture, NULL);
+ pipe_resource_reference(&strb->texture, NULL);
free(strb->data);
free(strb);
}
@@ -321,7 +321,7 @@ st_render_texture(GLcontext *ctx,
struct pipe_screen *screen = ctx->st->pipe->screen;
struct st_renderbuffer *strb;
struct gl_renderbuffer *rb;
- struct pipe_texture *pt = st_get_texobj_texture(att->Texture);
+ struct pipe_resource *pt = st_get_texobj_texture(att->Texture);
struct st_texture_object *stObj;
const struct gl_texture_image *texImage;
GLint pt_level;
@@ -364,7 +364,7 @@ st_render_texture(GLcontext *ctx,
/*printf("***** pipe texture %d x %d\n", pt->width0, pt->height0);*/
- pipe_texture_reference( &strb->texture, pt );
+ pipe_resource_reference( &strb->texture, pt );
pipe_surface_reference(&strb->surface, NULL);
diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h
index bea6eb89c3..50de67269a 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -37,7 +37,7 @@
struct st_renderbuffer
{
struct gl_renderbuffer Base;
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
struct pipe_surface *surface; /* temporary view into texture */
enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */
GLboolean defined; /**< defined contents? */
@@ -53,7 +53,7 @@ struct st_renderbuffer
int rtt_level, rtt_face, rtt_slice;
/** Render to texture state */
- struct pipe_texture *texture_save;
+ struct pipe_resource *texture_save;
struct pipe_surface *surface_save;
};
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 080a5f9bfb..0d338ef985 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -81,7 +81,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
width, height);
/* map the stencil buffer */
- stmap = pipe->transfer_map(pipe, pt);
+ stmap = pipe_transfer_map(pipe, pt);
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
@@ -161,8 +161,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
/* unmap the stencil buffer */
- pipe->transfer_unmap(pipe, pt);
- pipe->tex_transfer_destroy(pipe, pt);
+ pipe_transfer_unmap(pipe, pt);
+ pipe->transfer_destroy(pipe, pt);
}
@@ -252,9 +252,9 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
return GL_FALSE;
}
- map = pipe->transfer_map(pipe, trans);
+ map = pipe_transfer_map(pipe, trans);
if (!map) {
- pipe->tex_transfer_destroy(pipe, trans);
+ pipe->transfer_destroy(pipe, trans);
return GL_FALSE;
}
@@ -316,8 +316,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
; /* nothing */
}
- pipe->transfer_unmap(pipe, trans);
- pipe->tex_transfer_destroy(pipe, trans);
+ pipe_transfer_unmap(pipe, trans);
+ pipe->transfer_destroy(pipe, trans);
}
return GL_TRUE;
@@ -539,7 +539,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- pipe->tex_transfer_destroy(pipe, trans);
+ pipe->transfer_destroy(pipe, trans);
_mesa_unmap_pbo_dest(ctx, &clippedPacking);
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 626e6ad660..4213a7f843 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -122,7 +122,7 @@ st_DeleteTextureObject(GLcontext *ctx,
{
struct st_texture_object *stObj = st_texture_object(texObj);
if (stObj->pt)
- pipe_texture_reference(&stObj->pt, NULL);
+ pipe_resource_reference(&stObj->pt, NULL);
_mesa_delete_texture_object(ctx, texObj);
}
@@ -137,7 +137,7 @@ st_FreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
DBG("%s\n", __FUNCTION__);
if (stImage->pt) {
- pipe_texture_reference(&stImage->pt, NULL);
+ pipe_resource_reference(&stImage->pt, NULL);
}
if (texImage->Data) {
@@ -213,7 +213,7 @@ default_usage(enum pipe_format fmt)
/**
- * Allocate a pipe_texture object for the given st_texture_object using
+ * Allocate a pipe_resource object for the given st_texture_object using
* the given st_texture_image to guess the mipmap size/levels.
*
* [comments...]
@@ -374,8 +374,8 @@ compress_with_blit(GLcontext * ctx,
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_screen *screen = pipe->screen;
gl_format mesa_format;
- struct pipe_texture templ;
- struct pipe_texture *src_tex;
+ struct pipe_resource templ;
+ struct pipe_resource *src_tex;
struct pipe_surface *dst_surface;
struct pipe_transfer *tex_xfer;
void *map;
@@ -422,7 +422,7 @@ compress_with_blit(GLcontext * ctx,
0, 0, 0, /* face, level are zero */
PIPE_TRANSFER_WRITE,
0, 0, width, height); /* x, y, w, h */
- map = pipe->transfer_map(pipe, tex_xfer);
+ map = pipe_transfer_map(pipe, tex_xfer);
_mesa_texstore(ctx, 2, GL_RGBA, mesa_format,
map, /* dest ptr */
@@ -434,12 +434,12 @@ compress_with_blit(GLcontext * ctx,
pixels, /* source data */
unpack); /* source data packing */
- pipe->transfer_unmap(pipe, tex_xfer);
- pipe->tex_transfer_destroy(pipe, tex_xfer);
+ pipe_transfer_unmap(pipe, tex_xfer);
+ pipe->transfer_destroy(pipe, tex_xfer);
/* copy / compress image */
util_blit_pixels_tex(ctx->st->blit,
- src_tex, /* pipe_texture (src) */
+ src_tex, /* pipe_resource (src) */
0, 0, /* src x0, y0 */
width, height, /* src x1, y1 */
dst_surface, /* pipe_surface (dst) */
@@ -450,7 +450,7 @@ compress_with_blit(GLcontext * ctx,
PIPE_TEX_MIPFILTER_NEAREST);
pipe_surface_reference(&dst_surface, NULL);
- pipe_texture_reference(&src_tex, NULL);
+ pipe_resource_reference(&src_tex, NULL);
return GL_TRUE;
}
@@ -537,7 +537,7 @@ st_TexImage(GLcontext * ctx,
* Release any old malloced memory.
*/
if (stImage->pt) {
- pipe_texture_reference(&stImage->pt, NULL);
+ pipe_resource_reference(&stImage->pt, NULL);
assert(!texImage->Data);
}
else if (texImage->Data) {
@@ -554,7 +554,7 @@ st_TexImage(GLcontext * ctx,
!st_texture_match_image(stObj->pt, &stImage->base,
stImage->face, stImage->level)) {
DBG("release it\n");
- pipe_texture_reference(&stObj->pt, NULL);
+ pipe_resource_reference(&stObj->pt, NULL);
assert(!stObj->pt);
stObj->teximage_realloc = FALSE;
}
@@ -586,7 +586,7 @@ st_TexImage(GLcontext * ctx,
st_texture_match_image(stObj->pt, &stImage->base,
stImage->face, stImage->level)) {
- pipe_texture_reference(&stImage->pt, stObj->pt);
+ pipe_resource_reference(&stImage->pt, stObj->pt);
assert(stImage->pt);
}
@@ -816,7 +816,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
struct pipe_surface *dst_surface;
- struct pipe_texture *dst_texture;
+ struct pipe_resource *dst_texture;
struct pipe_transfer *tex_xfer;
/* create temp / dest surface */
@@ -829,7 +829,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
/* blit/render/decompress */
util_blit_pixels_tex(ctx->st->blit,
- stImage->pt, /* pipe_texture (src) */
+ stImage->pt, /* pipe_resource (src) */
0, 0, /* src x0, y0 */
width, height, /* src x1, y1 */
dst_surface, /* pipe_surface (dst) */
@@ -850,7 +850,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
if (st_equal_formats(stImage->pt->format, format, type)) {
/* memcpy */
const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
- ubyte *map = pipe->transfer_map(pipe, tex_xfer);
+ ubyte *map = pipe_transfer_map(pipe, tex_xfer);
GLuint row;
for (row = 0; row < height; row++) {
GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
@@ -858,7 +858,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
memcpy(dest, map, bytesPerRow);
map += tex_xfer->stride;
}
- pipe->transfer_unmap(pipe, tex_xfer);
+ pipe_transfer_unmap(pipe, tex_xfer);
}
else {
/* format translation via floats */
@@ -1364,7 +1364,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
}
st_texture_image_unmap(ctx->st, stImage);
- pipe->tex_transfer_destroy(pipe, src_trans);
+ pipe->transfer_destroy(pipe, src_trans);
}
@@ -1720,7 +1720,7 @@ copy_image_data_to_texture(struct st_context *st,
stImage->pt, /* src texture */
stImage->face);
- pipe_texture_reference(&stImage->pt, NULL);
+ pipe_resource_reference(&stImage->pt, NULL);
}
else if (stImage->base.Data) {
/* More straightforward upload.
@@ -1742,7 +1742,7 @@ copy_image_data_to_texture(struct st_context *st,
stImage->base.Data = NULL;
}
- pipe_texture_reference(&stImage->pt, stObj->pt);
+ pipe_resource_reference(&stImage->pt, stObj->pt);
}
@@ -1788,7 +1788,7 @@ st_finalize_texture(GLcontext *ctx,
if (firstImage->pt &&
firstImage->pt != stObj->pt &&
firstImage->pt->last_level >= stObj->lastLevel) {
- pipe_texture_reference(&stObj->pt, firstImage->pt);
+ pipe_resource_reference(&stObj->pt, firstImage->pt);
}
/* bytes per pixel block (blocks are usually 1x1) */
@@ -1807,7 +1807,7 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt->height0 != firstImage->base.Height2 ||
stObj->pt->depth0 != firstImage->base.Depth2)
{
- pipe_texture_reference(&stObj->pt, NULL);
+ pipe_resource_reference(&stObj->pt, NULL);
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index ca6d4dfb06..f0546b0a6a 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -216,7 +216,7 @@ static void st_destroy_context_priv( struct st_context *st )
#endif
for (i = 0; i < Elements(st->state.sampler_texture); i++) {
- pipe_texture_reference(&st->state.sampler_texture[i], NULL);
+ pipe_resource_reference(&st->state.sampler_texture[i], NULL);
}
for (i = 0; i < Elements(st->state.constants); i++) {
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index e2d34fb3d1..e0fe498083 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -94,7 +94,7 @@ struct st_context
struct pipe_clip_state clip;
struct pipe_buffer *constants[2];
struct pipe_framebuffer_state framebuffer;
- struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
+ struct pipe_resource *sampler_texture[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
@@ -140,7 +140,7 @@ struct st_context
GLuint user_prog_sn; /**< user fragment program serial no. */
struct st_fragment_program *combined_prog;
GLuint combined_prog_sn;
- struct pipe_texture *pixelmap_texture;
+ struct pipe_resource *pixelmap_texture;
boolean pixelmap_enabled; /**< use the pixelmap texture? */
} pixel_xfer;
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 0a91183f89..9cc42f2f5e 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -196,7 +196,7 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
/* replace the renderbuffer's surface/texture pointers */
pipe_surface_reference( &strb->surface, surf );
- pipe_texture_reference( &strb->texture, surf->texture );
+ pipe_resource_reference( &strb->texture, surf->texture );
if (ctx) {
/* If ctx isn't set, we've likely not made current yet.
@@ -242,7 +242,7 @@ st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct p
}
int
-st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex, struct pipe_texture **texture)
+st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex, struct pipe_resource **texture)
{
struct st_renderbuffer *strb;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index b2521433c8..6cfb68030d 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -79,7 +79,7 @@ st_destroy_generate_mipmap(struct st_context *st)
static boolean
st_render_mipmap(struct st_context *st,
GLenum target,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = st->pipe;
@@ -106,7 +106,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_texture *pt = st_get_texobj_texture(texObj);
+ struct pipe_resource *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
const uint lastLevel = pt->last_level;
const uint face = _mesa_tex_target_to_face(target), zslice = 0;
@@ -141,8 +141,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcData = (ubyte *) pipe->transfer_map(pipe, srcTrans);
- dstData = (ubyte *) pipe->transfer_map(pipe, dstTrans);
+ srcData = (ubyte *) pipe_transfer_map(pipe, srcTrans);
+ dstData = (ubyte *) pipe_transfer_map(pipe, dstTrans);
srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->texture->format);
dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->texture->format);
@@ -160,11 +160,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
dstData,
dstStride); /* stride in texels */
- pipe->transfer_unmap(pipe, srcTrans);
- pipe->transfer_unmap(pipe, dstTrans);
+ pipe_transfer_unmap(pipe, srcTrans);
+ pipe_transfer_unmap(pipe, dstTrans);
- pipe->tex_transfer_destroy(pipe, srcTrans);
- pipe->tex_transfer_destroy(pipe, dstTrans);
+ pipe->transfer_destroy(pipe, srcTrans);
+ pipe->transfer_destroy(pipe, dstTrans);
}
}
@@ -211,7 +211,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct st_context *st = ctx->st;
- struct pipe_texture *pt = st_get_texobj_texture(texObj);
+ struct pipe_resource *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
uint lastLevel;
uint dstLevel;
@@ -230,7 +230,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
* mipmap levels we need to generate. So allocate a new texture.
*/
struct st_texture_object *stObj = st_texture_object(texObj);
- struct pipe_texture *oldTex = stObj->pt;
+ struct pipe_resource *oldTex = stObj->pt;
GLboolean needFlush;
/* create new texture with space for more levels */
@@ -254,7 +254,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
st_finalize_texture(ctx, st->pipe, texObj, &needFlush);
/* release the old tex (will likely be freed too) */
- pipe_texture_reference(&oldTex, NULL);
+ pipe_resource_reference(&oldTex, NULL);
pt = stObj->pt;
}
@@ -297,6 +297,6 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
dstImage->TexFormat = srcImage->TexFormat;
stImage = (struct st_texture_image *) dstImage;
- pipe_texture_reference(&stImage->pt, pt);
+ pipe_resource_reference(&stImage->pt, pt);
}
}
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index 7fcde7b1a9..1fca180c53 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -37,6 +37,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
+#include "util/u_box.h"
#include "pipe/p_state.h"
#include "st_context.h"
@@ -45,7 +46,7 @@
static INLINE struct pipe_transfer *
st_cond_flush_get_tex_transfer(struct st_context *st,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
unsigned int face,
unsigned int level,
unsigned int zslice,
@@ -54,15 +55,31 @@ st_cond_flush_get_tex_transfer(struct st_context *st,
unsigned int w, unsigned int h)
{
struct pipe_context *context = st->pipe;
+ struct pipe_subresource subresource;
+ struct pipe_box box;
+
+ subresource.face = face;
+ subresource.level = level;
+
+ box.x = x;
+ box.y = y;
+ box.z = zslice;
+ box.w = w;
+ box.h = h;
+ box.d = 1;
st_teximage_flush_before_map(st, pt, face, level, usage);
- return context->get_tex_transfer(context, pt, face, level, zslice, usage,
- x, y, w, h);
+
+ return context->get_transfer(context,
+ pt,
+ subresource,
+ usage,
+ &box);
}
static INLINE struct pipe_transfer *
st_no_flush_get_tex_transfer(struct st_context *st,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
unsigned int face,
unsigned int level,
unsigned int zslice,
@@ -71,32 +88,18 @@ st_no_flush_get_tex_transfer(struct st_context *st,
unsigned int w, unsigned int h)
{
struct pipe_context *context = st->pipe;
-
- return context->get_tex_transfer(context, pt, face, level,
- zslice, usage, x, y, w, h);
-}
-
-static INLINE void *
-st_cond_flush_pipe_buffer_map(struct st_context *st,
- struct pipe_buffer *buf,
- unsigned int map_flags)
-{
- struct pipe_context *pipe = st->pipe;
- unsigned int referenced = pipe->is_buffer_referenced(pipe, buf);
-
- if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- (map_flags & PIPE_BUFFER_USAGE_CPU_WRITE)))
- st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
- return pipe_buffer_map(pipe->screen, buf, map_flags);
-}
-
-static INLINE void *
-st_no_flush_pipe_buffer_map(struct st_context *st,
- struct pipe_buffer *buf,
- unsigned int map_flags)
-{
- return pipe_buffer_map(st->pipe->screen, buf, map_flags);
+ struct pipe_box box;
+ struct pipe_subresource subresource = u_subresource( face, level );
+
+ u_box_2d_zslice( x, y, zslice,
+ w, h,
+ &box );
+
+ return context->get_transfer(context,
+ pt,
+ subresource,
+ usage,
+ &box);
}
@@ -109,10 +112,7 @@ st_cond_flush_pipe_buffer_write(struct st_context *st,
{
struct pipe_context *pipe = st->pipe;
- if (pipe->is_buffer_referenced(pipe, buf))
- st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
- pipe_buffer_write(pipe->screen, buf, offset, size, data);
+ pipe_buffer_write(pipe, buf, offset, size, data);
}
static INLINE void
@@ -122,7 +122,7 @@ st_no_flush_pipe_buffer_write(struct st_context *st,
unsigned int size,
const void * data)
{
- pipe_buffer_write(st->pipe->screen, buf, offset, size, data);
+ pipe_buffer_write(st->pipe, buf, offset, size, data);
}
static INLINE void
@@ -132,7 +132,7 @@ st_no_flush_pipe_buffer_write_nooverlap(struct st_context *st,
unsigned int size,
const void * data)
{
- pipe_buffer_write_nooverlap(st->pipe->screen, buf, offset, size, data);
+ pipe_buffer_write_nooverlap(st->pipe, buf, offset, size, data);
}
static INLINE void
@@ -144,10 +144,10 @@ st_cond_flush_pipe_buffer_read(struct st_context *st,
{
struct pipe_context *pipe = st->pipe;
- if (pipe->is_buffer_referenced(pipe, buf) & PIPE_REFERENCED_FOR_WRITE)
+ if (pipe->is_resource_referenced(pipe, &buf->base, 0, 0) & PIPE_REFERENCED_FOR_WRITE)
st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
- pipe_buffer_read(pipe->screen, buf, offset, size, data);
+ pipe_buffer_read(pipe, buf, offset, size, data);
}
static INLINE void
@@ -157,7 +157,7 @@ st_no_flush_pipe_buffer_read(struct st_context *st,
unsigned int size,
void * data)
{
- pipe_buffer_read(st->pipe->screen, buf, offset, size, data);
+ pipe_buffer_read(st->pipe, buf, offset, size, data);
}
#endif
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 4b40d6d044..18f82132b9 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -53,7 +53,7 @@ struct st_framebuffer;
struct pipe_context;
struct pipe_fence_handle;
struct pipe_surface;
-struct pipe_texture;
+struct pipe_resource;
PUBLIC
@@ -94,7 +94,7 @@ int st_get_framebuffer_surface(struct st_framebuffer *stfb,
PUBLIC
int st_get_framebuffer_texture(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_texture **texture);
+ uint surfIndex, struct pipe_resource **texture);
PUBLIC
void *st_framebuffer_private( struct st_framebuffer *stfb );
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 10a38befb4..6ccf4a71da 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -69,14 +69,14 @@ target_to_target(GLenum target)
/**
- * Allocate a new pipe_texture object
+ * Allocate a new pipe_resource object
* width0, height0, depth0 are the dimensions of the level 0 image
* (the highest resolution). last_level indicates how many mipmap levels
* to allocate storage for. For non-mipmapped textures, this will be zero.
*/
-struct pipe_texture *
+struct pipe_resource *
st_texture_create(struct st_context *st,
- enum pipe_texture_target target,
+ enum pipe_resource_target target,
enum pipe_format format,
GLuint last_level,
GLuint width0,
@@ -84,7 +84,7 @@ st_texture_create(struct st_context *st,
GLuint depth0,
GLuint usage )
{
- struct pipe_texture pt, *newtex;
+ struct pipe_resource pt, *newtex;
struct pipe_screen *screen = st->pipe->screen;
assert(target <= PIPE_TEXTURE_CUBE);
@@ -118,7 +118,7 @@ st_texture_create(struct st_context *st,
* Check if a texture image can be pulled into a unified mipmap texture.
*/
GLboolean
-st_texture_match_image(const struct pipe_texture *pt,
+st_texture_match_image(const struct pipe_resource *pt,
const struct gl_texture_image *image,
GLuint face, GLuint level)
{
@@ -152,7 +152,7 @@ st_texture_match_image(const struct pipe_texture *pt,
* These functions present that view to mesa:
*/
const GLuint *
-st_texture_depth_offsets(struct pipe_texture *pt, GLuint level)
+st_texture_depth_offsets(struct pipe_resource *pt, GLuint level)
{
static const GLuint zero = 0;
@@ -168,7 +168,7 @@ st_texture_depth_offsets(struct pipe_texture *pt, GLuint level)
* texture memory buffer, in bytes.
*/
GLuint
-st_texture_image_offset(const struct pipe_texture * pt,
+st_texture_image_offset(const struct pipe_resource * pt,
GLuint face, GLuint level)
{
if (pt->target == PIPE_TEXTURE_CUBE)
@@ -192,7 +192,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
GLuint x, GLuint y, GLuint w, GLuint h)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_texture *pt = stImage->pt;
+ struct pipe_resource *pt = stImage->pt;
DBG("%s \n", __FUNCTION__);
@@ -201,7 +201,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
usage, x, y, w, h);
if (stImage->transfer)
- return pipe->transfer_map(pipe, stImage->transfer);
+ return pipe_transfer_map(pipe, stImage->transfer);
else
return NULL;
}
@@ -215,9 +215,9 @@ st_texture_image_unmap(struct st_context *st,
DBG("%s\n", __FUNCTION__);
- pipe->transfer_unmap(pipe, stImage->transfer);
+ pipe_transfer_unmap(pipe, stImage->transfer);
- pipe->tex_transfer_destroy(pipe, stImage->transfer);
+ pipe->transfer_destroy(pipe, stImage->transfer);
}
@@ -237,7 +237,7 @@ st_surface_data(struct pipe_context *pipe,
const void *src, unsigned src_stride,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
- void *map = pipe->transfer_map(pipe, dst);
+ void *map = pipe_transfer_map(pipe, dst);
assert(dst->texture);
util_copy_rect(map,
@@ -248,7 +248,7 @@ st_surface_data(struct pipe_context *pipe,
src, src_stride,
srcx, srcy);
- pipe->transfer_unmap(pipe, dst);
+ pipe_transfer_unmap(pipe, dst);
}
@@ -256,7 +256,7 @@ st_surface_data(struct pipe_context *pipe,
*/
void
st_texture_image_data(struct st_context *st,
- struct pipe_texture *dst,
+ struct pipe_resource *dst,
GLuint face,
GLuint level,
void *src,
@@ -284,7 +284,7 @@ st_texture_image_data(struct st_context *st,
u_minify(dst->width0, level),
u_minify(dst->height0, level)); /* width, height */
- pipe->tex_transfer_destroy(pipe, dst_transfer);
+ pipe->transfer_destroy(pipe, dst_transfer);
srcUB += src_image_stride;
}
@@ -295,8 +295,8 @@ st_texture_image_data(struct st_context *st,
*/
void
st_texture_image_copy(struct pipe_context *pipe,
- struct pipe_texture *dst, GLuint dstLevel,
- struct pipe_texture *src,
+ struct pipe_resource *dst, GLuint dstLevel,
+ struct pipe_resource *src,
GLuint face)
{
struct pipe_screen *screen = pipe->screen;
@@ -425,7 +425,7 @@ st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
texImage->TexFormat = st_ChooseTextureFormat(ctx, internalFormat,
GL_RGBA, GL_UNSIGNED_BYTE);
_mesa_set_fetch_functions(texImage, 2);
- pipe_texture_reference(&stImage->pt, ps->texture);
+ pipe_resource_reference(&stImage->pt, ps->texture);
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
_mesa_unlock_texture(ctx, texObj);
@@ -475,7 +475,7 @@ st_unbind_texture_surface(struct pipe_surface *ps, int target, int level)
/* Make sure the pipe surface is still bound. The texture object is still
* considered surface based even if this is the last bound surface. */
if (stImage->pt == ps->texture) {
- pipe_texture_reference(&stImage->pt, NULL);
+ pipe_resource_reference(&stImage->pt, NULL);
_mesa_clear_texture_image(ctx, texImage);
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
@@ -526,11 +526,11 @@ st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
/* save the renderbuffer's surface/texture info */
- pipe_texture_reference(&strb->texture_save, strb->texture);
+ pipe_resource_reference(&strb->texture_save, strb->texture);
pipe_surface_reference(&strb->surface_save, strb->surface);
/* plug in new surface/texture info */
- pipe_texture_reference(&strb->texture, stImage->pt);
+ pipe_resource_reference(&strb->texture, stImage->pt);
strb->surface = screen->get_tex_surface(screen, strb->texture,
face, level, slice,
(PIPE_BUFFER_USAGE_GPU_READ |
@@ -564,10 +564,10 @@ st_release_teximage(struct st_framebuffer *stfb, uint surfIndex,
/* free tex surface, restore original */
pipe_surface_reference(&strb->surface, strb->surface_save);
- pipe_texture_reference(&strb->texture, strb->texture_save);
+ pipe_resource_reference(&strb->texture, strb->texture_save);
pipe_surface_reference(&strb->surface_save, NULL);
- pipe_texture_reference(&strb->texture_save, NULL);
+ pipe_resource_reference(&strb->texture_save, NULL);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
@@ -576,7 +576,7 @@ st_release_teximage(struct st_framebuffer *stfb, uint surfIndex,
void
st_teximage_flush_before_map(struct st_context *st,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
unsigned int face,
unsigned int level,
enum pipe_transfer_usage usage)
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index 60868ce067..7f52c9b74c 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -32,7 +32,7 @@
#include "main/mtypes.h"
struct pipe_context;
-struct pipe_texture;
+struct pipe_resource;
struct st_texture_image
@@ -48,7 +48,7 @@ struct st_texture_image
* Else if stImage->base.Data != NULL, image is stored there.
* Else there is no image data.
*/
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
struct pipe_transfer *transfer;
};
@@ -66,7 +66,7 @@ struct st_texture_object
/* On validation any active images held in main memory or in other
* textures will be copied to this texture and the old storage freed.
*/
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
GLboolean teximage_realloc;
@@ -90,7 +90,7 @@ st_texture_object(struct gl_texture_object *obj)
}
-static INLINE struct pipe_texture *
+static INLINE struct pipe_resource *
st_get_texobj_texture(struct gl_texture_object *texObj)
{
struct st_texture_object *stObj = st_texture_object(texObj);
@@ -98,14 +98,14 @@ st_get_texobj_texture(struct gl_texture_object *texObj)
}
-static INLINE struct pipe_texture *
+static INLINE struct pipe_resource *
st_get_stobj_texture(struct st_texture_object *stObj)
{
return stObj ? stObj->pt : NULL;
}
-extern struct pipe_texture *
+extern struct pipe_resource *
st_texture_create(struct st_context *st,
enum pipe_texture_target target,
enum pipe_format format,
@@ -119,7 +119,7 @@ st_texture_create(struct st_context *st,
/* Check if an image fits into an existing texture object.
*/
extern GLboolean
-st_texture_match_image(const struct pipe_texture *pt,
+st_texture_match_image(const struct pipe_resource *pt,
const struct gl_texture_image *image,
GLuint face, GLuint level);
@@ -143,17 +143,17 @@ st_texture_image_unmap(struct st_context *st,
* value.
*/
extern const GLuint *
-st_texture_depth_offsets(struct pipe_texture *pt, GLuint level);
+st_texture_depth_offsets(struct pipe_resource *pt, GLuint level);
/* Return the linear offset of an image relative to the start of its region.
*/
extern GLuint
-st_texture_image_offset(const struct pipe_texture *pt,
+st_texture_image_offset(const struct pipe_resource *pt,
GLuint face, GLuint level);
extern GLuint
-st_texture_texel_offset(const struct pipe_texture * pt,
+st_texture_texel_offset(const struct pipe_resource * pt,
GLuint face, GLuint level,
GLuint col, GLuint row, GLuint img);
@@ -162,7 +162,7 @@ st_texture_texel_offset(const struct pipe_texture * pt,
*/
extern void
st_texture_image_data(struct st_context *st,
- struct pipe_texture *dst,
+ struct pipe_resource *dst,
GLuint face, GLuint level, void *src,
GLuint src_row_pitch, GLuint src_image_pitch);
@@ -171,13 +171,13 @@ st_texture_image_data(struct st_context *st,
*/
extern void
st_texture_image_copy(struct pipe_context *pipe,
- struct pipe_texture *dst, GLuint dstLevel,
- struct pipe_texture *src,
+ struct pipe_resource *dst, GLuint dstLevel,
+ struct pipe_resource *src,
GLuint face);
extern void
st_teximage_flush_before_map(struct st_context *st,
- struct pipe_texture *pt,
+ struct pipe_resource *pt,
unsigned int face,
unsigned int level,
enum pipe_transfer_usage usage);