summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-24 18:14:53 -0700
committerBrian <[email protected]>2007-02-24 18:14:53 -0700
commit53170942e37ccdf58e06a2cfbfeef6c0ec086ee6 (patch)
tree46b4fbd12d745036927053061d1e8a9b4cad7949 /src
parentaeaad937b92ac0f5286343ed75c5c9f6876e2650 (diff)
Fix broken cubemap mipmap layout (the cubemap.c demo was segfaulting).
In i915_miptree_layout() change the width, height parameters that are passed to intel_miptree_set_level_info(). As it was, the width, height values were larger than the source image dimensions and we segfaulted in memcpy() when copying the original texture data into the texture buffer region. This fix should probably be checked by someone more familiar with the code (Keith?)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_tex_layout.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c
index 333fefef859..c844f5351d2 100644
--- a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c
+++ b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c
@@ -62,15 +62,23 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
case GL_TEXTURE_CUBE_MAP:{
const GLuint dim = mt->width0;
GLuint face;
+ GLuint lvlWidth = mt->width0, lvlHeight = mt->height0;
+
+ assert(lvlWidth == lvlHeight); /* cubemap images are square */
/* double pitch for cube layouts */
mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
mt->total_height = dim * 4;
- for (level = mt->first_level; level <= mt->last_level; level++)
+ for (level = mt->first_level; level <= mt->last_level; level++) {
intel_miptree_set_level_info(mt, level, 6,
0, 0,
- mt->pitch, mt->total_height, 1);
+ /*OLD: mt->pitch, mt->total_height,*/
+ lvlWidth, lvlHeight,
+ 1);
+ lvlWidth /= 2;
+ lvlHeight /= 2;
+ }
for (face = 0; face < 6; face++) {
GLuint x = initial_offsets[face][0] * dim;