Mesa (master): glsl: rename min(), max() functions to fix MSVC build

Brian Paul brianp at kemper.freedesktop.org
Tue Jan 7 00:02:07 UTC 2014


Module: Mesa
Branch: master
Commit: 8d1400fe123dc229e87a3a6316b0697f864695a3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d1400fe123dc229e87a3a6316b0697f864695a3

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jan  6 16:11:21 2014 -0700

glsl: rename min(), max() functions to fix MSVC build

Evidently, there's some other definition of "min" and "max" that
causes MSVC to choke on these function names.  Renaming to min2()
and max2() fixes things.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/builtin_functions.cpp |    6 +++---
 src/glsl/ir_builder.cpp        |    4 ++--
 src/glsl/ir_builder.h          |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index f56be0c..10127f3 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -4073,7 +4073,7 @@ builtin_builder::_min3(builtin_available_predicate avail,
    ir_variable *z = in_var(z_type, "z");
    MAKE_SIG(x_type, avail, 3, x, y, z);
 
-   ir_expression *min3 = min(x, min(y,z));
+   ir_expression *min3 = min2(x, min2(y,z));
    body.emit(ret(min3));
 
    return sig;
@@ -4089,7 +4089,7 @@ builtin_builder::_max3(builtin_available_predicate avail,
    ir_variable *z = in_var(z_type, "z");
    MAKE_SIG(x_type, avail, 3, x, y, z);
 
-   ir_expression *max3 = max(x, max(y,z));
+   ir_expression *max3 = max2(x, max2(y,z));
    body.emit(ret(max3));
 
    return sig;
@@ -4105,7 +4105,7 @@ builtin_builder::_mid3(builtin_available_predicate avail,
    ir_variable *z = in_var(z_type, "z");
    MAKE_SIG(x_type, avail, 3, x, y, z);
 
-   ir_expression *mid3 = max(min(x, y), max(min(x, z), min(y, z)));
+   ir_expression *mid3 = max2(min2(x, y), max2(min2(x, z), min2(y, z)));
    body.emit(ret(mid3));
 
    return sig;
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 31ed191..7f41ed6 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -211,12 +211,12 @@ ir_expression *sub(operand a, operand b)
    return expr(ir_binop_sub, a, b);
 }
 
-ir_expression *min(operand a, operand b)
+ir_expression *min2(operand a, operand b)
 {
    return expr(ir_binop_min, a, b);
 }
 
-ir_expression *max(operand a, operand b)
+ir_expression *max2(operand a, operand b)
 {
    return expr(ir_binop_max, a, b);
 }
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 4b85ea1..f00e6f3 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -184,8 +184,8 @@ ir_expression *i2b(operand a);
 ir_expression *f2b(operand a);
 ir_expression *b2f(operand a);
 
-ir_expression *min(operand a, operand b);
-ir_expression *max(operand a, operand b);
+ir_expression *min2(operand a, operand b);
+ir_expression *max2(operand a, operand b);
 
 ir_expression *fma(operand a, operand b, operand c);
 ir_expression *lrp(operand x, operand y, operand a);




More information about the mesa-commit mailing list