[Mesa-dev] [PATCH 8/9] i965/vec4: Handle saturated constants in opt_vector_float

Jason Ekstrand jason at jlekstrand.net
Thu Mar 17 17:21:45 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_vec4.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 155a550..02a00b3 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -384,7 +384,13 @@ vec4_visitor::opt_vector_float()
          continue;
       }
 
-      int vf = brw_float_to_vf(inst->src[0].f);
+      float f = inst->src[0].f;
+      if (inst->saturate) {
+         assert(inst->dst.type == BRW_REGISTER_TYPE_F);
+         f = CLAMP(f, 0.0f, 1.0f);
+      }
+
+      int vf = brw_float_to_vf(f);
       if (vf == -1)
          continue;
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list