OSDN Git Service

llvmpipe: fix bogus handling of first_layer when setting up texture sampling
authorRoland Scheidegger <sroland@vmware.com>
Fri, 17 May 2013 21:19:05 +0000 (23:19 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Fri, 17 May 2013 22:32:18 +0000 (00:32 +0200)
commit87978518e996d02e055174d7152fff150fe3cd13
treec1d7c1ca62fc574e30bda00754d24229a396add2
parentd7e811c0b0f51df85a624a5784518e274a1db173
llvmpipe: fix bogus handling of first_layer when setting up texture sampling

The code avoided first_layer parameter in the sampler interface (and needing
to do another calculation at runtime) by fixing up the base texture pointer
instead. Unfortunately, this didn't actually work as we have mip-first
texture layout so fixing up the base ptr by a fixed amount is very wrong if
there are mipmaps present. The wrong offsets caused misrendering and crashes.
Fix this by just adjusting the individual mip level offsets instead.
Spotted by Jose.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c