summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texfetch_tmp.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-04-19 14:00:22 -0700
committerEric Anholt <[email protected]>2013-04-30 10:40:44 -0700
commitf91823f026fc5996f9b2ffa1dc48573810f1e4fd (patch)
treec2851bf3b56424a01c76a962cb5713ceeb932f39 /src/mesa/swrast/s_texfetch_tmp.h
parent35e179b18c6f266f8ec3ebb9352ad0cd3552c2a3 (diff)
swrast: Make a teximage's stored RowStride be in terms of bytes per row.
For hardware drivers with pitch alignment requirements, a non-power-of-two-sized texture format won't end up being an integer number of pixels per row. Also, avoids having to change our units between MapTextureImage's rowStride and swrast's RowStride. This doesn't fully convert the compressed texel fetch path, but does make sure we don't drop any bits (not that we'd expect to). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_texfetch_tmp.h')
-rw-r--r--src/mesa/swrast/s_texfetch_tmp.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index 4cd42c06dfe..c9991cd84d9 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -52,15 +52,16 @@
#define TEXEL_ADDR( type, image, i, j, k, size ) \
((void) (k), \
- ((type *)(image)->ImageSlices[0] + ((image)->RowStride * (j) + (i)) * (size)))
+ ((type *)((image)->ImageSlices[0] + (image)->RowStride * (j)) + \
+ (i) * (size)))
#define FETCH(x) fetch_texel_2d_##x
#elif DIM == 3
#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((type *)(image)->ImageSlices[k] + \
- ((image)->RowStride * (j) + (i)) * (size))
+ ((type *)((image)->ImageSlices[k] + \
+ (image)->RowStride * (j)) + (i) * (size))
#define FETCH(x) fetch_texel_3d_##x