summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple/i915_surface.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2007-11-30 20:48:03 +0100
committerMichel Dänzer <[email protected]>2007-12-06 11:18:11 +0100
commit753db0d8407147393a7b0622ae3fa28f68d0353d (patch)
tree8c11ae7b18cb34ae65e984fc7d9be50616bf99d4 /src/mesa/pipe/i915simple/i915_surface.c
parent59356268187470c5fda9e9a1a7058607f938fb3b (diff)
Hide texture layout details from the state tracker.
pipe->get_tex_surface() has to be used for access to texture image data.
Diffstat (limited to 'src/mesa/pipe/i915simple/i915_surface.c')
-rw-r--r--src/mesa/pipe/i915simple/i915_surface.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c
index e4a5de00d77..385202507db 100644
--- a/src/mesa/pipe/i915simple/i915_surface.c
+++ b/src/mesa/pipe/i915simple/i915_surface.c
@@ -187,34 +187,35 @@ i915_put_tile(struct pipe_context *pipe,
*/
static struct pipe_surface *
i915_get_tex_surface(struct pipe_context *pipe,
- struct pipe_mipmap_tree *mt,
+ struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice)
{
+ struct i915_texture *tex = (struct i915_texture *)pt;
struct pipe_surface *ps;
unsigned offset; /* in bytes */
- offset = mt->level[level].level_offset;
+ offset = tex->level_offset[level];
- if (mt->target == PIPE_TEXTURE_CUBE) {
- offset += mt->level[level].image_offset[face] * mt->cpp;
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ offset += tex->image_offset[level][face] * pt->cpp;
}
- else if (mt->target == PIPE_TEXTURE_3D) {
- offset += mt->level[level].image_offset[zslice] * mt->cpp;
+ else if (pt->target == PIPE_TEXTURE_3D) {
+ offset += tex->image_offset[level][zslice] * pt->cpp;
}
else {
assert(face == 0);
assert(zslice == 0);
}
- ps = pipe->winsys->surface_alloc(pipe->winsys, mt->format);
+ ps = pipe->winsys->surface_alloc(pipe->winsys, pt->format);
if (ps) {
assert(ps->format);
assert(ps->refcount);
- pipe_region_reference(&ps->region, mt->region);
- ps->cpp = mt->cpp;
- ps->width = mt->level[level].width;
- ps->height = mt->level[level].height;
- ps->pitch = mt->pitch;
+ pipe_region_reference(&ps->region, tex->region);
+ ps->cpp = pt->cpp;
+ ps->width = pt->width[level];
+ ps->height = pt->height[level];
+ ps->pitch = tex->pitch;
ps->offset = offset;
}
return ps;