Commit 9a023586 authored by Keith Whitwell's avatar Keith Whitwell

gallium: remove inline_read transfer

parent a6ba315e
......@@ -230,7 +230,9 @@ pipe_buffer_write(struct pipe_context *pipe,
u_subresource(0,0),
PIPE_TRANSFER_WRITE,
&box,
data);
data,
size,
0);
}
/**
......@@ -255,7 +257,8 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
(PIPE_TRANSFER_WRITE |
PIPE_TRANSFER_NOOVERWRITE),
&box,
data);
data,
0, 0);
}
static INLINE void
......@@ -264,16 +267,19 @@ pipe_buffer_read(struct pipe_context *pipe,
unsigned offset, unsigned size,
void *data)
{
struct pipe_box box;
struct pipe_transfer *src_transfer;
ubyte *map;
u_box_1d(offset, size, &box);
map = (ubyte *) pipe_buffer_map_range(pipe,
buf,
offset, size,
PIPE_TRANSFER_READ,
&src_transfer);
pipe->transfer_inline_read( pipe,
buf,
u_subresource(0,0),
PIPE_TRANSFER_READ,
&box,
data);
if (map)
memcpy(data, map, size);
pipe_buffer_unmap(pipe, buf, src_transfer);
}
static INLINE struct pipe_transfer *
......
......@@ -7,11 +7,13 @@
* pointer. XXX: strides??
*/
void u_transfer_inline_write( struct pipe_context *pipe,
struct pipe_resource *resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
const void *data )
struct pipe_resource *resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
const void *data,
unsigned stride,
unsigned slice_stride)
{
struct pipe_transfer *transfer = NULL;
uint8_t *map = NULL;
......@@ -50,51 +52,6 @@ out:
/* One-shot read transfer operation with data returned in a user
* pointer. XXX: strides??
*/
void u_transfer_inline_read( struct pipe_context *pipe,
struct pipe_resource *resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
void *data )
{
struct pipe_transfer *transfer = NULL;
uint8_t *map = NULL;
transfer = pipe->get_transfer(pipe,
resource,
sr,
usage,
box );
if (transfer == NULL)
goto out;
map = pipe_transfer_map(pipe, transfer);
if (map == NULL)
goto out;
assert(box->depth == 1); /* XXX: fix me */
util_copy_rect(data,
resource->format,
transfer->stride, /* bytes? */
0, 0,
box->width,
box->height,
map,
box->width, /* bytes? texels? */
0, 0);
out:
if (map)
pipe_transfer_unmap(pipe, transfer);
if (transfer)
pipe_transfer_destroy(pipe, transfer);
}
void u_transfer_flush_region_noop( struct pipe_context *pipe,
......
......@@ -11,17 +11,13 @@ struct pipe_context;
void u_transfer_inline_write( struct pipe_context *pipe,
struct pipe_resource *resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
const void *data );
void u_transfer_inline_read( struct pipe_context *pipe,
struct pipe_resource *resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
void *data );
const void *data,
unsigned stride,
unsigned slice_stride);
void u_transfer_flush_region_noop( struct pipe_context *pipe,
struct pipe_transfer *transfer,
......
......@@ -817,7 +817,9 @@ identity_context_transfer_inline_write( struct pipe_context *_context,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
const void *data )
const void *data,
unsigned stride,
unsigned slice_stride)
{
struct identity_context *id_context = identity_context(_context);
struct identity_resource *id_resource = identity_resource(_resource);
......@@ -829,29 +831,11 @@ identity_context_transfer_inline_write( struct pipe_context *_context,
sr,
usage,
box,
data);
data,
stride,
slice_stride);
}
static void
identity_context_transfer_inline_read( struct pipe_context *_context,
struct pipe_resource *_resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
void *data )
{
struct identity_context *id_context = identity_context(_context);
struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *context = id_context->pipe;
struct pipe_resource *texture = id_resource->resource;
context->transfer_inline_read(context,
texture,
sr,
usage,
box,
data);
}
struct pipe_context *
identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
......@@ -925,7 +909,6 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.transfer_unmap = identity_context_transfer_unmap;
id_pipe->base.transfer_flush_region = identity_context_transfer_flush_region;
id_pipe->base.transfer_inline_write = identity_context_transfer_inline_write;
id_pipe->base.transfer_inline_read = identity_context_transfer_inline_read;
id_pipe->pipe = pipe;
......
......@@ -421,7 +421,6 @@ softpipe_init_texture_funcs(struct pipe_context *pipe)
pipe->transfer_flush_region = u_transfer_flush_region_noop;
pipe->transfer_inline_write = u_transfer_inline_write;
pipe->transfer_inline_read = u_transfer_inline_read;
}
void
......
......@@ -139,19 +139,32 @@ st_bufferobj_get_subdata(GLcontext *ctx,
GLsizeiptrARB size,
GLvoid * data, struct gl_buffer_object *obj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
struct pipe_transfer *src_transfer;
ubyte *srcPtr;
if(!size)
return;
/* we may be called from VBO code, so double-check params here */
ASSERT(offset >= 0);
ASSERT(size >= 0);
ASSERT(offset + size <= obj->Size);
if (!size)
return;
/* buffer should not already be mapped */
assert(!obj->Pointer);
srcPtr = (ubyte *) pipe_buffer_map_range(pipe,
st_obj->buffer,
offset, size,
PIPE_TRANSFER_READ,
&src_transfer);
if (srcPtr)
memcpy(data, srcPtr, size);
st_cond_flush_pipe_buffer_read(st_context(ctx),
st_obj->buffer,
offset, size, data);
pipe_buffer_unmap(pipe, st_obj->buffer, src_transfer);
}
......@@ -426,7 +439,7 @@ st_copy_buffer_subdata(GLcontext *ctx,
&dst_transfer);
if (srcPtr && dstPtr)
memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
memcpy(dstPtr, srcPtr, size);
pipe_buffer_unmap(pipe, srcObj->buffer, src_transfer);
pipe_buffer_unmap(pipe, dstObj->buffer, dst_transfer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment