i945 support for compressed cubemaps is completely broken
Submitted by Steinar H. Gunderson
Assigned to Eric Anholt @anholt
Description
Created attachment 25761 Test case source code
i945 hardware supports compressed cube maps. However, it seems like the texture memory layout completely forgets to handle the fact that they take up less memory.
I've made a small test program (attached; basically the same as in bugs 21691 and 21692, only with DXT1 instead of uncompressed textures) that creates a 64x64 cubemap and renders all faces at all mip levels. reference-cubemap.png is what it looks like on ATI and nVidia (well, actually, that's a white lie; in reality the colors are slightly wrong since DXT1 is 565 instead of 888, but you get the general idea). i945-compressed-cubemap.png is what it looks like on my i945 with unmodified Mesa 7.4.1. i945-compressed-cubemap-with-hack.png is what it looks like if I change the call to intel_miptree_set_image_offset() in i945_miptree_layout_cube() from
intel_miptree_set_image_offset(mt, level, face, x, y);
to
intel_miptree_set_image_offset(mt, level, face, x, y/4);
Of course, it's a hack, and it still doesn't work properly for the lower mip levels (probably related to bugs 21690 and/or 21691), but at least it shows that the layout has to be adjusted for lower memory use.
Attachment 25761, "Test case source code":
cmct.c