OSDN Git Service

gallivm: fix small but severe bug in handling multiple lod level strides
authorRoland Scheidegger <sroland@vmware.com>
Mon, 15 Apr 2013 01:57:23 +0000 (03:57 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 15 Apr 2013 13:23:40 +0000 (15:23 +0200)
commit1d6eb23f2dc1bb53636802cb698e6788ca0a26ac
tree9493dc9552da9f0a1fca663b0a3a28e778823df2
parent02b808b08acc73b9b3d31832a7f137a9aae4bdd9
gallivm: fix small but severe bug in handling multiple lod level strides

Inserting the value for the second quad in the wrong place for the
following shuffle. This meant the row or image stride was undefined which is
quite catastrophic, can lead to bogus texels fetched or just segfault.
This code is only hit for SoA path currently, still surprising it
didn't crash more or caused more visible issues (I think llvm used a
broadcast shuffle for the undefined parts of the vector, hence the undefined
value for the second quad was just the same as that from the first quad,
so as long as both quads hit the same mip level everything was fine, and since
lower mips always have the same large stride it made it less likely to
hit out-of-bound memory in case of differing lods).

Note: this is a candidate for stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_sample.c