v2: Fix *.expected files to match.
Reviewed-by: Paul Berry <strereotype441@gmail.com>
switch (ir->type->base_type) {
case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break;
case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break;
- case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break;
+ case GLSL_TYPE_FLOAT:
+ if (ir->value.f[i] == 0.0f)
+ /* 0.0 == -0.0, so print with %f to get the proper sign. */
+ printf("%.1f", ir->value.f[i]);
+ else if (abs(ir->value.f[i]) < 0.000001f)
+ printf("%a", ir->value.f[i]);
+ else if (abs(ir->value.f[i]) > 1000000.0f)
+ printf("%e", ir->value.f[i]);
+ else
+ printf("%f", ir->value.f[i]);
+ break;
case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break;
default: assert(0);
}
(signature void (parameters)
((loop () () () ()
((assign (x) (var_ref a) (constant float (1.000000)))
- (if (expression bool > (var_ref b) (constant float (0.000000))) (break)
+ (if (expression bool > (var_ref b) (constant float (0.0))) (break)
())))))))
(signature void (parameters)
((loop () () () ()
((assign (x) (var_ref a) (constant float (1.000000)))
- (if (expression bool > (var_ref b) (constant float (0.000000)))
+ (if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref c) (constant float (1.000000))) break)
())))))))
(signature void (parameters)
((loop () () () ()
((assign (x) (var_ref a) (constant float (1.000000)))
- (if (expression bool > (var_ref b) (constant float (0.000000))) ()
+ (if (expression bool > (var_ref b) (constant float (0.0))) ()
(break))))))))
(signature void (parameters)
((loop () () () ()
((assign (x) (var_ref a) (constant float (1.000000)))
- (if (expression bool > (var_ref b) (constant float (0.000000))) ()
+ (if (expression bool > (var_ref b) (constant float (0.0))) ()
((assign (x) (var_ref c) (constant float (1.000000))) break))))))))
(loop () () () ()
((declare (temporary) bool execute_flag)
(assign (x) (var_ref execute_flag) (constant bool (1)))
- (if (expression bool > (var_ref a) (constant float (0.000000)))
- ((if (expression bool > (var_ref ba) (constant float (0.000000)))
- ((if (expression bool > (var_ref bb) (constant float (0.000000)))
+ (if (expression bool > (var_ref a) (constant float (0.0)))
+ ((if (expression bool > (var_ref ba) (constant float (0.0)))
+ ((if (expression bool > (var_ref bb) (constant float (0.0)))
((assign (x) (var_ref execute_flag) (constant bool (0))))
()))
())
(if (var_ref execute_flag)
- ((if (expression bool > (var_ref ca) (constant float (0.000000)))
- ((if (expression bool > (var_ref cb) (constant float (0.000000)))
+ ((if (expression bool > (var_ref ca) (constant float (0.0)))
+ ((if (expression bool > (var_ref cb) (constant float (0.0)))
((assign (x) (var_ref break_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))
(loop () () () ()
((declare (temporary) bool execute_flag)
(assign (x) (var_ref execute_flag) (constant bool (1)))
- (if (expression bool > (var_ref aa) (constant float (0.000000)))
- ((if (expression bool > (var_ref ab) (constant float (0.000000)))
+ (if (expression bool > (var_ref aa) (constant float (0.0)))
+ ((if (expression bool > (var_ref ab) (constant float (0.0)))
((assign (x) (var_ref execute_flag) (constant bool (0))))
()))
())
(if (var_ref execute_flag)
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref break_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))
(assign (x) (var_ref execute_flag) (constant bool (1)))
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (if (expression bool > (var_ref aa) (constant float (0.000000)))
- ((if (expression bool > (var_ref ab) (constant float (0.000000)))
+ (if (expression bool > (var_ref aa) (constant float (0.0)))
+ ((if (expression bool > (var_ref ab) (constant float (0.0)))
((assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))
())
(if (var_ref execute_flag)
((loop () () () ()
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
- ((if (expression bool > (var_ref c) (constant float (0.000000))) ()
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
+ ((if (expression bool > (var_ref c) (constant float (0.0))) ()
(continue)))
((assign (x) (var_ref return_flag) (constant bool (1)))))
break))
(declare (temporary) float return_value)
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (if (expression bool > (var_ref a) (constant float (0.000000)))
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
+ (if (expression bool > (var_ref a) (constant float (0.0)))
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref return_value) (constant float (1.000000)))
(assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
(declare (temporary) float return_value)
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (if (expression bool > (var_ref a) (constant float (0.000000)))
+ (if (expression bool > (var_ref a) (constant float (0.0)))
((assign (x) (var_ref return_value) (constant float (1.000000)))
(assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
((declare (in) float a) (declare (in) float b)
(function main
(signature void (parameters)
- ((if (expression bool > (var_ref a) (constant float (0.000000)))
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
+ ((if (expression bool > (var_ref a) (constant float (0.0)))
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
((return))
()))
())))))
(assign (x) (var_ref execute_flag) (constant bool (1)))
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (if (expression bool > (var_ref a) (constant float (0.000000)))
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
+ (if (expression bool > (var_ref a) (constant float (0.0)))
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))
((declare (in) float a) (declare (in) float b)
(function sub
(signature void (parameters)
- ((if (expression bool > (var_ref a) (constant float (0.000000)))
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
+ ((if (expression bool > (var_ref a) (constant float (0.0)))
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
((return))
()))
())))))
(assign (x) (var_ref execute_flag) (constant bool (1)))
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (if (expression bool > (var_ref a) (constant float (0.000000)))
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
+ (if (expression bool > (var_ref a) (constant float (0.0)))
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))
(assign (x) (var_ref execute_flag) (constant bool (1)))
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (if (expression bool > (var_ref aa) (constant float (0.000000)))
- ((if (expression bool > (var_ref ab) (constant float (0.000000)))
+ (if (expression bool > (var_ref aa) (constant float (0.0)))
+ ((if (expression bool > (var_ref ab) (constant float (0.0)))
((assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))
())
(if (var_ref execute_flag)
- ((if (expression bool > (var_ref b) (constant float (0.000000)))
- ((if (expression bool > (var_ref c) (constant float (0.000000))) () ())
+ ((if (expression bool > (var_ref b) (constant float (0.0)))
+ ((if (expression bool > (var_ref c) (constant float (0.0))) () ())
(assign (x) (var_ref return_flag) (constant bool (1)))
(assign (x) (var_ref execute_flag) (constant bool (0))))
()))