gen7/pipeline: Actually use inputs_read from the VS for laying out inputs
[mesa.git] / src / glsl / ir_constant_expression.cpp
index 2853c1643b32240d886b2420e42f906335636fa3..5bf5ce54f78d58ed0a752f2eb1a05485133dfeaa 100644 (file)
 #include <math.h>
 #include "main/core.h" /* for MAX2, MIN2, CLAMP */
 #include "util/rounding.h" /* for _mesa_roundeven */
+#include "util/half_float.h"
 #include "ir.h"
 #include "glsl_types.h"
 #include "program/hash_table.h"
 
-#if defined(__SUNPRO_CC) && !defined(isnormal)
-#include <ieeefp.h>
-static int isnormal(double x)
-{
-   return fpclass(x) == FP_NORMAL;
-}
-#endif
-
 static float
 dot_f(ir_constant *op0, ir_constant *op1)
 {
@@ -230,12 +223,9 @@ pack_snorm_1x8(float x)
      *    follows:
      *
      *      packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
-     *
-     * We must first cast the float to an int, because casting a negative
-     * float to a uint is undefined.
      */
-   return (uint8_t) (int)
-          _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
+   return (uint8_t)
+          _mesa_lroundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
 }
 
 /**
@@ -252,12 +242,9 @@ pack_snorm_1x16(float x)
      *    follows:
      *
      *      packSnorm2x16: round(clamp(c, -1, +1) * 32767.0)
-     *
-     * We must first cast the float to an int, because casting a negative
-     * float to a uint is undefined.
      */
-   return (uint16_t) (int)
-          _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
+   return (uint16_t)
+          _mesa_lroundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
 }
 
 /**
@@ -661,14 +648,6 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
         data.u[c] = bitcast_f2u(op[0]->value.f[c]);
       }
       break;
-   case ir_unop_any:
-      assert(op[0]->type->is_boolean());
-      data.b[0] = false;
-      for (unsigned c = 0; c < op[0]->type->components(); c++) {
-        if (op[0]->value.b[c])
-           data.b[0] = true;
-      }
-      break;
    case ir_unop_d2f:
       assert(op[0]->type->base_type == GLSL_TYPE_DOUBLE);
       for (unsigned c = 0; c < op[0]->type->components(); c++) {