summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe/sp_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/softpipe/sp_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/softpipe/sp_surface.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index a6ab4046037..c41bbc59b90 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -565,34 +565,35 @@ z24s8_get_tile(struct pipe_surface *ps,
*/
struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
- struct pipe_mipmap_tree *mt,
+ struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice)
{
+ struct softpipe_texture *spt = (struct softpipe_texture *)pt;
struct pipe_surface *ps;
unsigned offset; /* in bytes */
- offset = mt->level[level].level_offset;
+ offset = spt->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 += spt->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 += spt->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, spt->region);
+ ps->cpp = pt->cpp;
+ ps->width = pt->width[level];
+ ps->height = pt->height[level];
+ ps->pitch = spt->pitch;
ps->offset = offset;
}
return ps;