gallivm: fix incorrect type for undefined texcoords
authorBrian Paul <brianp@vmware.com>
Wed, 7 Dec 2022 21:49:11 +0000 (14:49 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 9 Dec 2022 05:04:37 +0000 (05:04 +0000)
commitbc048f5c513ac9f5860572995a2972eb23ea4ae5
tree608a041f114389043a37daabc80e4fff5318c296
parent5233551e1912519b456515ac8da7a62c9779fca8
gallivm: fix incorrect type for undefined texcoords

Texcoords may be 1-5 components in length.  We initialize the
unused components with an LLVMGetUndef().  But we were using
an int vec type rather than a float vec type.

This eventually led to a failed assertion in lp_build_clamp()
where 'a' was a vec of int[8] but 'min' and 'max' were float[8]
in a trace of the game Tom Clancy's Splinter Cell: Blacklist.

The game seems to have a bug where a texture sampler mistakenly has
shadow comparison turned on, but the shader's tex sample instructions
are sampling a 2D R8G8B8A8_UNORM texture.  The instruction has a
2-component texcoord so when we do the sampler comparison operation
we're using the undefined 5th coordinate component.

Signed-off-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20233>
src/gallium/auxiliary/gallivm/lp_bld_nir.c