diff options
author | Roland Scheidegger <[email protected]> | 2013-08-14 18:35:00 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-08-15 00:40:14 +0200 |
commit | e58c2310b845ca809bb99d5fcdab909ff8598c28 (patch) | |
tree | 45504f46a39ae10fa6d1fcfe74788b7d25894756 /src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | |
parent | d4b43cedb65978e76f67c80d8715c7db8b2ea667 (diff) |
gallivm: already pass coords in the right place in the sampler interface
This makes things a bit nicer, and more importantly it fixes an issue
where a "downgraded" array texture (due to view reduced to 1 layer and
addressed with (non-array) samplec instruction) would use the wrong
coord as shadow reference value. (This could also be fixed by passing
target through the sampler interface much the same way as is done for
size queries, might do this eventually anyway.)
And if we'd ever want to support (shadow) cube map arrays, we'd need
5 coords in any case.
v2: fix bugs (texel fetch using wrong layer coord for 1d, shadow tex
using wrong shadow coord for 2d...). Plus need to project the shadow
coord, and just for fun keep projecting the layer coord too.
Reviewed-by: Zack Rusin <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 745e9158768..15632bcf448 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1574,7 +1574,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm, unsigned target = static_texture_state->target; unsigned dims = texture_dims(target); unsigned num_quads = type.length / 4; - unsigned mip_filter; + unsigned mip_filter, i; struct lp_build_sample_context bld; struct lp_static_sampler_state derived_sampler_state = *static_sampler_state; LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context); @@ -1726,30 +1726,8 @@ lp_build_sample_soa(struct gallivm_state *gallivm, } } - /* - * always use the same coords for layer, shadow cmp, should probably - * put that into gallivm sampler interface I get real tired shuffling - * coordinates. - */ - newcoords[0] = coords[0]; /* 1st coord */ - newcoords[1] = coords[1]; /* 2nd coord */ - newcoords[2] = coords[2]; /* 3rd coord (for cube, 3d and layer) */ - newcoords[3] = coords[3]; /* 4th coord (intended for cube array layer) */ - newcoords[4] = coords[2]; /* shadow cmp coord */ - if (target == PIPE_TEXTURE_1D_ARRAY) { - newcoords[2] = coords[1]; /* layer coord */ - /* FIXME: shadow cmp coord can be wrong if we don't take target from shader decl. */ - } - else if (target == PIPE_TEXTURE_2D_ARRAY) { - newcoords[2] = coords[2]; - newcoords[4] = coords[3]; - } - else if (target == PIPE_TEXTURE_CUBE) { - newcoords[4] = coords[3]; - } - else if (target == PIPE_TEXTURE_CUBE_ARRAY) { - assert(0); /* not handled */ - // layer coord is ok but shadow coord is impossible */ + for (i = 0; i < 5; i++) { + newcoords[i] = coords[i]; } if (0) { |