From 75d99673a8f47f62458034b0566d6c0221fae5d1 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Feb 2013 18:42:17 -0800 Subject: softpipe: clean up lod computation This should handle the new lod_zero modifier more correctly. The runtime-conditional is a bit more complex however we now also do scalar lod computation when appropriate which should more than make up for it. The refactoring should also fix an issue with explicit lods (lod clamp wasn't applied to them). Also, always pass lod as the 5th element from tgsi executor, which simplifies things (get rid of annoying conditionals later). v2: based on Brian's feedback, use switch in a couple of places, fix up some function parameter names, fix up comments. Reviewed-by: Brian Paul --- src/gallium/auxiliary/tgsi/tgsi_exec.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/gallium/auxiliary/tgsi/tgsi_exec.h') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 1a7d979ca21..a66c9197f75 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -89,8 +89,11 @@ struct tgsi_interp_coef }; enum tgsi_sampler_control { + tgsi_sampler_lod_none, tgsi_sampler_lod_bias, - tgsi_sampler_lod_explicit + tgsi_sampler_lod_explicit, + tgsi_sampler_lod_zero + /* FIXME: tgsi_sampler_derivs_explicit */ }; /** @@ -107,15 +110,14 @@ struct tgsi_sampler layer for 1D arrays. * p - the third coordinate for sampling for 3D, cube, cube arrays, * layer for 2D arrays. Compare value for 1D/2D shadows. - * c0 - lod value for lod variants, compare value for shadow cube - * and shadow 2d arrays. - * c1 - cube array only - lod for cube map arrays - * compare for shadow cube map arrays. + * c0 - Compare value for shadow cube and shadow 2d arrays, + * layer for cube arrays. + * lod - lod value, except for shadow cube arrays (compare value there). */ void (*get_samples)(struct tgsi_sampler *sampler, const float s[TGSI_QUAD_SIZE], const float t[TGSI_QUAD_SIZE], - const float p[TGSI_QUAD_SIZE], + const float r[TGSI_QUAD_SIZE], const float c0[TGSI_QUAD_SIZE], const float c1[TGSI_QUAD_SIZE], enum tgsi_sampler_control control, -- cgit v1.2.3