diff options
author | Eric Anholt <eric@anholt.net> | 2008-03-18 19:45:30 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2008-03-18 20:17:56 -0700 |
commit | b790b24ff9204eb6f305b14bd40bb903e65dd541 (patch) | |
tree | 5712fd2131b525e75a48bdbf7d06362f318701e0 /src/mesa/drivers | |
parent | c2814f2a3fbfa0e4ba6c45347fcadd3722b005ff (diff) |
[i915] Bug #13634: Fix bugs in 945 cube mipmap layout.
The most egregious, and the one the bug report and failure in the cubemap
demo were about was introduced with intel_mipmap_pitch_align(), where a
"* 2" for the pitch calculation was lost. The base size < 32 case also
failed to align, which may have caused problems with render to texture.
Another bug would have broken 2x2/1x1 base mipmap levels by placing the
data where the hardware wouldn't look for it.
Other bugs remain with the layout of the small mipmap faces (hardware looks
for them in X,Y,Z,-X,-Y,-Z order along the bottom row, but we lay them out
X,-X,Y,-Y,Z,-Z).
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_tex_layout.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index 87daec6710..b5085f49d4 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -37,22 +37,22 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE static GLint initial_offsets[6][2] = { - {0, 0}, - {0, 2}, - {1, 0}, - {1, 2}, - {1, 1}, - {1, 3} + [FACE_POS_X] = {0, 0}, + [FACE_POS_Y] = {1, 0}, + [FACE_POS_Z] = {1, 1}, + [FACE_NEG_X] = {0, 2}, + [FACE_NEG_Y] = {1, 2}, + [FACE_NEG_Z] = {1, 3}, }; static GLint step_offsets[6][2] = { - {0, 2}, - {0, 2}, - {-1, 2}, - {-1, 2}, - {-1, 1}, - {-1, 1} + [FACE_POS_X] = {0, 2}, + [FACE_POS_Y] = {-1, 2}, + [FACE_POS_Z] = {-1, 1}, + [FACE_NEG_X] = {0, 2}, + [FACE_NEG_Y] = {-1, 2}, + [FACE_NEG_Z] = {-1, 1}, }; /** @@ -320,11 +320,14 @@ i945_miptree_layout_cube(struct intel_context *intel, * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (dim > 32) - mt->pitch = intel_miptree_pitch_align (intel, mt, dim); + mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); else - mt->pitch = 14 * 8; + mt->pitch = intel_miptree_pitch_align (intel, mt, 14 * 8); - mt->total_height = dim * 4 + 4; + if (dim >= 4) + mt->total_height = dim * 4 + 4; + else + mt->total_height = 4; /* Set all the levels to effectively occupy the whole rectangular region. */ for (level = mt->first_level; level <= mt->last_level; level++) { |