summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_resource_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i965/brw_resource_texture.c')
-rw-r--r--src/gallium/drivers/i965/brw_resource_texture.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/gallium/drivers/i965/brw_resource_texture.c b/src/gallium/drivers/i965/brw_resource_texture.c
index 3860d18a7a..fded2da382 100644
--- a/src/gallium/drivers/i965/brw_resource_texture.c
+++ b/src/gallium/drivers/i965/brw_resource_texture.c
@@ -229,8 +229,8 @@ static void brw_texture_destroy(struct pipe_screen *screen,
static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
struct pipe_resource *texture,
- unsigned face,
- unsigned level )
+ unsigned level,
+ int layer )
{
struct brw_context *brw = brw_context(pipe);
struct brw_screen *bscreen = brw_screen(pipe->screen);
@@ -246,7 +246,7 @@ static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
if (bscreen->sws->bo_references( batch_bo, tex->bo ))
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
- /* Find any view on this texture for this face/level and see if it
+ /* Find any view on this texture for this level/layer and see if it
* is referenced:
*/
for (i = 0; i < 2; i++) {
@@ -254,7 +254,7 @@ static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
if (surf->bo == tex->bo)
continue;
- if (surf->id.bits.face != face ||
+ if (!(layer == -1 || surf->id.bits.layer == layer) ||
surf->id.bits.level != level)
continue;
@@ -274,10 +274,10 @@ static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
static struct pipe_transfer *
brw_texture_get_transfer(struct pipe_context *context,
- struct pipe_resource *resource,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box)
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box)
{
struct brw_texture *tex = brw_texture(resource);
struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
@@ -285,10 +285,11 @@ brw_texture_get_transfer(struct pipe_context *context,
return NULL;
transfer->resource = resource;
- transfer->sr = sr;
+ transfer->level = level;
transfer->usage = usage;
transfer->box = *box;
transfer->stride = tex->pitch * tex->cpp;
+ /* FIXME: layer_stride */
return transfer;
}
@@ -301,24 +302,16 @@ brw_texture_transfer_map(struct pipe_context *pipe,
struct pipe_resource *resource = transfer->resource;
struct brw_texture *tex = brw_texture(transfer->resource);
struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws;
- struct pipe_subresource sr = transfer->sr;
struct pipe_box *box = &transfer->box;
enum pipe_format format = resource->format;
unsigned usage = transfer->usage;
unsigned offset;
char *map;
- if (resource->target == PIPE_TEXTURE_CUBE) {
- offset = tex->image_offset[sr.level][sr.face];
- }
- else if (resource->target == PIPE_TEXTURE_3D) {
- offset = tex->image_offset[sr.level][box->z];
- }
- else {
- offset = tex->image_offset[sr.level][0];
- assert(sr.face == 0);
+ if (resource->target != PIPE_TEXTURE_3D &&
+ resource->target != PIPE_TEXTURE_CUBE)
assert(box->z == 0);
- }
+ offset = tex->image_offset[transfer->level][box->z];
map = sws->bo_map(tex->bo,
BRW_DATA_OTHER,