From 93ce3caa703194204e9ce6e6a2af25b5833afe7c Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 11 Mar 2015 12:45:09 +0100 Subject: [PATCH 1/2] i965: Lower texture gradients also for non-shadow samplers in IvyBridge We will need this to enable the EWA algorithm for isotropic cases because in that case the hardware will not always compute the correct LOD from the gradients. We can do the same for other hardware generations if we are interested, we would only need to ignore the fact that they have the sample_d_c message, which is currently preventing the lowering from happening in these cases. --- src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp b/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp index 0424003..3871056 100644 --- a/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp +++ b/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp @@ -89,8 +89,15 @@ txs_type(const glsl_type *type) ir_visitor_status lower_texture_grad_visitor::visit_leave(ir_texture *ir) { - /* Only lower textureGrad with shadow samplers */ - if (ir->op != ir_txd || !ir->shadow_comparitor) + if (ir->op != ir_txd) + return visit_continue; + + /* Only lower textureGrad with shadow samplers except for IVB + * (has_sample_d_c == false), where we want to enable EWA for isotropic + * cases, which needs that we compute the LOD from the gradients manually + * because the hardware won't copute a correct LOD in all cases. + */ + if (!ir->shadow_comparitor && has_sample_d_c) return visit_continue; /* Lower textureGrad() with samplerCubeShadow even if we have the sample_d_c -- 1.9.1