summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2013-03-01 23:27:41 +0100
committerRoland Scheidegger <[email protected]>2013-03-02 02:54:31 +0100
commit6ace2e41da7dded630d932d03bacb7e14a93d47a (patch)
treeadeff2f7bd1eb1968bf3e57bb3fe0a09f1bdb0f1 /src/gallium/drivers/softpipe
parentc7c7186045ec617c53f7899280cbe12e59503e4d (diff)
tgsi: add texel offsets and derivatives to sampler interface
Something I never got around to implement, but this is the tgsi execution side for implementing texel offsets (for ordinary texturing) and explicit derivatives for sampling (though I guess the ordering of the components for the derivs parameters is debatable). There is certainly a runtime cost associated with this. Unless there are different interfaces used depending on the "complexity" of the texture instructions, this is impossible to avoid. Offsets are always active (I think checking if they are active or not is probably not worth it since it should mostly be an add), whereas the sampler_control is extended for explicit derivatives. For now softpipe (the only user of this) just drops all those new values on the floor (which is the part I never implemented...). Additionally this also fixes (discovered by accident) inconsistent projective divide for the comparison coord - the code did do the projection for shadow2d targets, but not shadow1d ones. This also drops checking for projection modifier on array targets, since they aren't possible in any extension I know of (hence we don't actually know if the array layer should also be divided or not). Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 30ecc6f379b..8e16ff9e0f0 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -1645,6 +1645,8 @@ compute_lod(const struct pipe_sampler_state *sampler,
switch (control) {
case tgsi_sampler_lod_none:
case tgsi_sampler_lod_zero:
+ /* XXX FIXME */
+ case tgsi_sampler_derivs_explicit:
lod[0] = lod[1] = lod[2] = lod[3] = CLAMP(biased_lambda, min_lod, max_lod);
break;
case tgsi_sampler_lod_bias:
@@ -1687,6 +1689,8 @@ compute_lambda_lod(struct sp_sampler_variant *samp,
switch (control) {
case tgsi_sampler_lod_none:
+ /* XXX FIXME */
+ case tgsi_sampler_derivs_explicit:
lambda = samp->compute_lambda(samp, s, t, p) + lod_bias;
lod[0] = lod[1] = lod[2] = lod[3] = CLAMP(lambda, min_lod, max_lod);
break;
@@ -2085,7 +2089,9 @@ mip_filter_linear_aniso(struct sp_sampler_variant *samp,
float dvdy = (t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]) * t_to_v;
if (control == tgsi_sampler_lod_bias ||
- control == tgsi_sampler_lod_none) {
+ control == tgsi_sampler_lod_none ||
+ /* XXX FIXME */
+ control == tgsi_sampler_derivs_explicit) {
/* note: instead of working with Px and Py, we will use the
* squared length instead, to avoid sqrt.
*/
@@ -3051,6 +3057,8 @@ sp_tgsi_get_samples(struct tgsi_sampler *tgsi_sampler,
const float p[TGSI_QUAD_SIZE],
const float c0[TGSI_QUAD_SIZE],
const float lod[TGSI_QUAD_SIZE],
+ float derivs[3][2][TGSI_QUAD_SIZE],
+ const int8_t offset[3],
enum tgsi_sampler_control control,
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
{