summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_texture.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c69
1 files changed, 33 insertions, 36 deletions
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 3533c4fd4f0..d7ee292c655 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -291,8 +291,8 @@ softpipe_get_transfer(struct pipe_context *pipe,
unsigned usage,
const struct pipe_box *box)
{
- struct softpipe_resource *sprex = softpipe_resource(resource);
- struct softpipe_transfer *spr;
+ struct softpipe_resource *spr = softpipe_resource(resource);
+ struct softpipe_transfer *spt;
assert(resource);
assert(sr.level <= resource->last_level);
@@ -323,9 +323,9 @@ softpipe_get_transfer(struct pipe_context *pipe,
}
}
- spr = CALLOC_STRUCT(softpipe_transfer);
- if (spr) {
- struct pipe_transfer *pt = &spr->base;
+ spt = CALLOC_STRUCT(softpipe_transfer);
+ if (spt) {
+ struct pipe_transfer *pt = &spt->base;
enum pipe_format format = resource->format;
int nblocksy = util_format_get_nblocksy(resource->format,
u_minify(resource->height0, sr.level));
@@ -333,23 +333,23 @@ softpipe_get_transfer(struct pipe_context *pipe,
pt->sr = sr;
pt->usage = usage;
pt->box = *box;
- pt->stride = sprex->stride[sr.level];
+ pt->stride = spr->stride[sr.level];
- spr->offset = sprex->level_offset[sr.level];
+ spt->offset = spr->level_offset[sr.level];
if (resource->target == PIPE_TEXTURE_CUBE) {
- spr->offset += sr.face * nblocksy * pt->stride;
+ spt->offset += sr.face * nblocksy * pt->stride;
}
else if (resource->target == PIPE_TEXTURE_3D) {
- spr->offset += box->z * nblocksy * pt->stride;
+ spt->offset += box->z * nblocksy * pt->stride;
}
else {
assert(sr.face == 0);
assert(box->z == 0);
}
- spr->offset +=
- box->y / util_format_get_blockheight(format) * spr->base.stride +
+ spt->offset +=
+ box->y / util_format_get_blockheight(format) * spt->base.stride +
box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
return pt;
@@ -378,26 +378,24 @@ static void *
softpipe_transfer_map(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
- struct softpipe_transfer *sp_transfer = softpipe_transfer(transfer);
- struct softpipe_resource *sp_resource = softpipe_resource(transfer->resource);
+ struct softpipe_transfer *spt = softpipe_transfer(transfer);
+ struct softpipe_resource *spr = softpipe_resource(transfer->resource);
struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys;
uint8_t *map;
/* resources backed by display target treated specially:
*/
- if (sp_resource->dt) {
- map = winsys->displaytarget_map(winsys,
- sp_resource->dt,
- transfer->usage);
+ if (spr->dt) {
+ map = winsys->displaytarget_map(winsys, spr->dt, transfer->usage);
}
else {
- map = sp_resource->data;
+ map = spr->data;
}
if (map == NULL)
return NULL;
else
- return map + sp_transfer->offset;
+ return map + spt->offset;
}
@@ -434,26 +432,25 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
unsigned bytes,
unsigned bind_flags)
{
- struct softpipe_resource *buffer;
+ struct softpipe_resource *spr;
- buffer = CALLOC_STRUCT(softpipe_resource);
- if(!buffer)
+ spr = CALLOC_STRUCT(softpipe_resource);
+ if (!spr)
return NULL;
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.screen = screen;
- buffer->base.format = PIPE_FORMAT_R8_UNORM; /* ?? */
- buffer->base.bind = bind_flags;
- buffer->base.usage = PIPE_USAGE_IMMUTABLE;
- buffer->base.flags = 0;
- buffer->base.width0 = bytes;
- buffer->base.height0 = 1;
- buffer->base.depth0 = 1;
- buffer->userBuffer = TRUE;
- buffer->data = ptr;
-
- return &buffer->base;
+ pipe_reference_init(&spr->base.reference, 1);
+ spr->base.screen = screen;
+ spr->base.format = PIPE_FORMAT_R8_UNORM; /* ?? */
+ spr->base.bind = bind_flags;
+ spr->base.usage = PIPE_USAGE_IMMUTABLE;
+ spr->base.flags = 0;
+ spr->base.width0 = bytes;
+ spr->base.height0 = 1;
+ spr->base.depth0 = 1;
+ spr->userBuffer = TRUE;
+ spr->data = ptr;
+
+ return &spr->base;
}