OSDN Git Service

i965/miptree: Don't shrink textures when augmenting for more levels
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 15 Nov 2016 20:27:12 +0000 (22:27 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Wed, 23 Nov 2016 09:06:52 +0000 (11:06 +0200)
commitca84e190a446bbc29c3ef2864ba4ea5c7358a89a
tree3d306e909e1bba5762fa64a5a5501b42d9e058c2
parent6e8f12619f921673b48f18f9856d9e919869e1ed
i965/miptree: Don't shrink textures when augmenting for more levels

This was detected when examining CCS_E failures with piglit test:
"fbo-generatemipmap-formats". Test creates a 2D texture with
dimensions 293x277. It manually loops over all levels and calls
glTexImage2D(). Level one triggers creation of full miptree:
intel_alloc_texture_image_buffer() realizes that there is only one
level in the miptree and calls intel_miptree_create_for_teximage()
to re-allocate the miptree with all 9 levels. However, the end result
is a miptree with level zero dimensions of 292x276.

Related, and possibly calling for treatment of its own is mip-map
generation:
After calling glTexImage2D() against every level test continues by
replacing content for levels one to eight with data derived from level
zero by calling glGenerateMipmapEXT(). This results into the miptree
being allocated anew for every level:
Mip-map generation goes thru meta which ends up validating the texture
(brw_validate_textures()->intel_finalize_mipmap_tree()->
intel_miptree_match_image()) where one finds texture with base level
size 292:276. This results into new miptree being created for the npot
size 293:277. Only here intel_finalize_mipmap_tree() is asked for only
one level, and therefore such is created. Generation for level one in
turn finds right base level size but only one level when two is needed.
And the same goes on for all eight levels.

This patch prevents the shrink maintaining the NPOT size of 293x277.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/intel_tex_image.c