Mesa (master): softpipe: minor code simplification for face/ zslice offset calculation
Brian Paul
brianp at kemper.freedesktop.org
Wed Feb 25 04:10:23 UTC 2009
Module: Mesa
Branch: master
Commit: 981b7c08ae54b80cd4750dc15f4e63bd7bf0a0a6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=981b7c08ae54b80cd4750dc15f4e63bd7bf0a0a6
Author: Brian Paul <brianp at vmware.com>
Date: Tue Feb 24 21:01:07 2009 -0700
softpipe: minor code simplification for face/zslice offset calculation
---
src/gallium/drivers/softpipe/sp_texture.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 4112710..142ce23 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -243,9 +243,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
ps->level = level;
ps->zslice = zslice;
- if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
- ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
- pt->nblocksy[level] * spt->stride[level];
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ ps->offset += face * pt->nblocksy[level] * spt->stride[level];
+ }
+ else if (pt->target == PIPE_TEXTURE_3D) {
+ ps->offset += zslice * pt->nblocksy[level] * spt->stride[level];
}
else {
assert(face == 0);
@@ -308,10 +310,11 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
spt->offset = sptex->level_offset[level];
- if (texture->target == PIPE_TEXTURE_CUBE ||
- texture->target == PIPE_TEXTURE_3D) {
- spt->offset += ((texture->target == PIPE_TEXTURE_CUBE) ? face :
- zslice) * pt->nblocksy * pt->stride;
+ if (texture->target == PIPE_TEXTURE_CUBE) {
+ spt->offset += face * pt->nblocksy * pt->stride;
+ }
+ else if (texture->target == PIPE_TEXTURE_3D) {
+ spt->offset += zslice * pt->nblocksy * pt->stride;
}
else {
assert(face == 0);
More information about the mesa-commit
mailing list