summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@tungstengraphics.com>2008-06-19 17:09:09 +0200
committerJakob Bornecrantz <jakob@tungstengraphics.com>2008-06-19 17:11:06 +0200
commit8d0329fb6af657a53cb010a3d7a8f4282e2715b8 (patch)
tree7cc706f0c6b0e99653e58d874b2070eda5a9b451 /src
parent6fbfcf922210ddf29b73290557f9d40171b09d2e (diff)
i915: Fixed cubemap layouts
Apprently we shouldn't do all the advanced layout operation for none compressed formats. The compressed code was also broken, its currently disabled, but should be fixed once i915simple starts to support compressed formats.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 09518fafe7..9cd32e3919 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -142,6 +142,7 @@ i915_miptree_set_image_offset(struct i915_texture *tex,
assert(img < tex->nr_images[level]);
tex->image_offset[level][img] = (x + y * tex->pitch);
+
/*
printf("%s level %d img %d pos %d,%d image_offset %x\n",
__FUNCTION__, level, img, x, y, tex->image_offset[level][img]);
@@ -266,9 +267,17 @@ i945_miptree_layout_cube(struct i915_texture *tex)
unsigned face;
unsigned lvlWidth = pt->width[0], lvlHeight = pt->height[0];
+ /*
+ printf("%s %i, %i\n", __FUNCTION__, pt->width[0], pt->height[0]);
+ */
+
assert(lvlWidth == lvlHeight); /* cubemap images are square */
- /* Depending on the size of the largest images, pitch can be
+ /*
+ * XXX Should only be used for compressed formats. But lets
+ * keep this code active just in case.
+ *
+ * Depending on the size of the largest images, pitch can be
* determined either by the old-style packing of cubemap faces,
* or the final row of 4x4, 2x2 and 1x1 faces below this.
*/
@@ -277,6 +286,9 @@ i945_miptree_layout_cube(struct i915_texture *tex)
else
tex->pitch = 14 * 8;
+ /*
+ * XXX The 4 is only needed for compressed formats. See above.
+ */
tex->total_height = dim * 4 + 4;
/* Set all the levels to effectively occupy the whole rectangular region.
@@ -292,6 +304,7 @@ i945_miptree_layout_cube(struct i915_texture *tex)
unsigned y = initial_offsets[face][1] * dim;
unsigned d = dim;
+#if 0 /* Fix and enable this code for compressed formats */
if (dim == 4 && face >= 4) {
y = tex->total_height - 4;
x = (face - 4) * 8;
@@ -300,12 +313,14 @@ i945_miptree_layout_cube(struct i915_texture *tex)
y = tex->total_height - 4;
x = face * 8;
}
+#endif
for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_image_offset(tex, level, face, x, y);
d >>= 1;
+#if 0 /* Fix and enable this code for compressed formats */
switch (d) {
case 4:
switch (face) {
@@ -325,7 +340,6 @@ i945_miptree_layout_cube(struct i915_texture *tex)
x = (face - 4) * 8;
break;
}
-
case 2:
y = tex->total_height - 4;
x = 16 + face * 8;
@@ -334,12 +348,14 @@ i945_miptree_layout_cube(struct i915_texture *tex)
case 1:
x += 48;
break;
-
default:
+#endif
x += step_offsets[face][0] * d;
y += step_offsets[face][1] * d;
+#if 0
break;
}
+#endif
}
}
}