Skip to content

st/mesa: fix corrupted texture levels, when adding more levels than expected

Some of existing texture levels can be corruted, after calling 'glTexImage' with param 'level' higher than max expected value 'floor(log2(max(width, height, depth)))'.

To fix we prevent overwriting image buffer pointer in 'st_texture_object', if it was already allocated for multiple mip-levels storage.

Asked OpenGL on github, what behavior is expected in this case, since it not specified in spec. Waiting for their response at .

Also after applying this fix we got same behavior as on NVidia GPU: read garbage data from additional levels, but perfectly correct data from legal levels. Test results on Nvidia, Windows, with 7 levels on 32x32 texture uploaded here:

Signed-off-by: Yevhenii Kharchenko

Fixes piglit test: 'arb_copy_image add-illegal-levels' Merge request of this piglit test piglit!313 (merged)

Passes Intel CI:

Edited by Yevhenii Kharchenko

Merge request reports