No subject


Wed Sep 28 00:13:44 PDT 2011


"Returns a value equal to the nearest integer to x.  A fractional part
of 0.5 will round toward the nearest even integer. (Both 3.5 and 4.5 for
x will return 4.0.)"

rint() does nearest integer, but probably not the mandated behavior for
0.5.  At least, not unless we configure the rounding mode.  Which I
don't think we have...

> +      }
> +      break;
> +
>     case ir_unop_ceil:
>        assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
>        for (unsigned c = 0; c < op[0]->type->components(); c++) {
> @@ -1324,6 +1331,9 @@ ir_call::constant_expression_value()
>  			    * op[1]->value.f[c];
>  	 }
>        }
> +   } else if (strcmp(callee, "round") == 0 ||
> +	      strcmp(callee, "roundEven") == 0) {
> +      expr = new(mem_ctx) ir_expression(ir_unop_round_even, op[0]);
>     } else if (strcmp(callee, "sign") == 0) {
>        expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL);
>     } else if (strcmp(callee, "sin") == 0) {



More information about the mesa-dev mailing list