diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-10-03 11:25:59 +0200 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-10-03 11:25:59 +0200 |
commit | 58cdd1dc520d211b65f05fd06b5ba472f552853c (patch) | |
tree | 90fd6f998f06e478ff522155013db9d97eb32fee /src/mesa/drivers/dri | |
parent | 1bc84102ad4df377df6c8bf5734b886b7683b939 (diff) |
i915: Only align texture pitch to 64 bytes when textures can be render targets.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_mipmap_tree.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c index aefb89ac83..2c167a9ab7 100644 --- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c @@ -99,19 +99,27 @@ intel_miptree_create(struct intel_context *intel, if (ok) { if (!mt->compressed) { - /* XXX: Align pitch to multiple of 64 bytes for now to allow - * render-to-texture to work in all cases. This should probably be - * replaced at some point by some scheme to only do this when really - * necessary. - */ - mt->pitch = (mt->pitch * cpp + 63) & ~63; + int align; + + if (intel->intelScreen->ttm) { + /* XXX: Align pitch to multiple of 64 bytes for now to allow + * render-to-texture to work in all cases. This should probably be + * replaced at some point by some scheme to only do this when really + * necessary. + */ + align = 63; + } else { + align = 3; + } + + mt->pitch = (mt->pitch * cpp + align) & ~align; /* XXX: At least the i915 seems very upset when the pitch is a multiple * of 1024 and sometimes 512 bytes - performance can drop by several - * times. Go to the next multiple of 64 for now. + * times. Go to the next multiple of the required alignment for now. */ if (!(mt->pitch & 511)) - mt->pitch += 64; + mt->pitch += align + 1; mt->pitch /= cpp; } |