aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-16 11:23:27 +0200
committermarha <marha@users.sourceforge.net>2013-10-16 11:23:27 +0200
commit9e23b44bfe1e6e85231b1c07d945cadf0c868648 (patch)
tree0bd2b4d0521570bf020452591c895b90bda51095 /mesalib/src/glsl/builtin_functions.cpp
parent81fd17c8678e89cea6610b8b2996b028b21eb5dc (diff)
downloadvcxsrv-9e23b44bfe1e6e85231b1c07d945cadf0c868648.tar.gz
vcxsrv-9e23b44bfe1e6e85231b1c07d945cadf0c868648.tar.bz2
vcxsrv-9e23b44bfe1e6e85231b1c07d945cadf0c868648.zip
fontconfig libxcb libxcb/xcb-proto xserver mesa pixman xkbcomp git update 16 oct 2013
xserver commit 7cf1b595c8c8f9776a39559d2878cf90af3f2859 libxcb commit e4e0c6eec861f4c69da12060dc8dbe7a63fa5eb6 libxcb/xcb-proto commit 55c75accecf0e76d2aa38656efd2be4044b9e643 xkbcomp commit 839ccda42d8b088d94324cd77c4be954859914d3 pixman commit 9e81419ed5c0ee490ddacf7bada516a25cae87eb fontconfig commit 5406919c5e186f74ccdade1a65344ce7b5c56a64 mesa commit 6e444a72c1f9e4446e025b8cb780523cb89f0584
Diffstat (limited to 'mesalib/src/glsl/builtin_functions.cpp')
-rw-r--r--mesalib/src/glsl/builtin_functions.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp
index b6451089c..d40888d38 100644
--- a/mesalib/src/glsl/builtin_functions.cpp
+++ b/mesalib/src/glsl/builtin_functions.cpp
@@ -531,6 +531,9 @@ private:
B1(fma)
B2(ldexp)
B2(frexp)
+ B1(uaddCarry)
+ B1(usubBorrow)
+ B1(mulExtended)
#undef B0
#undef B1
#undef B2
@@ -1947,6 +1950,30 @@ builtin_builder::create_builtins()
_frexp(glsl_type::vec3_type, glsl_type::ivec3_type),
_frexp(glsl_type::vec4_type, glsl_type::ivec4_type),
NULL);
+ add_function("uaddCarry",
+ _uaddCarry(glsl_type::uint_type),
+ _uaddCarry(glsl_type::uvec2_type),
+ _uaddCarry(glsl_type::uvec3_type),
+ _uaddCarry(glsl_type::uvec4_type),
+ NULL);
+ add_function("usubBorrow",
+ _usubBorrow(glsl_type::uint_type),
+ _usubBorrow(glsl_type::uvec2_type),
+ _usubBorrow(glsl_type::uvec3_type),
+ _usubBorrow(glsl_type::uvec4_type),
+ NULL);
+ add_function("imulExtended",
+ _mulExtended(glsl_type::int_type),
+ _mulExtended(glsl_type::ivec2_type),
+ _mulExtended(glsl_type::ivec3_type),
+ _mulExtended(glsl_type::ivec4_type),
+ NULL);
+ add_function("umulExtended",
+ _mulExtended(glsl_type::uint_type),
+ _mulExtended(glsl_type::uvec2_type),
+ _mulExtended(glsl_type::uvec3_type),
+ _mulExtended(glsl_type::uvec4_type),
+ NULL);
#undef F
#undef FI
#undef FIU
@@ -3720,6 +3747,52 @@ builtin_builder::_frexp(const glsl_type *x_type, const glsl_type *exp_type)
return sig;
}
+
+ir_function_signature *
+builtin_builder::_uaddCarry(const glsl_type *type)
+{
+ ir_variable *x = in_var(type, "x");
+ ir_variable *y = in_var(type, "y");
+ ir_variable *carry = out_var(type, "carry");
+ MAKE_SIG(type, gpu_shader5, 3, x, y, carry);
+
+ body.emit(assign(carry, ir_builder::carry(x, y)));
+ body.emit(ret(add(x, y)));
+
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_usubBorrow(const glsl_type *type)
+{
+ ir_variable *x = in_var(type, "x");
+ ir_variable *y = in_var(type, "y");
+ ir_variable *borrow = out_var(type, "borrow");
+ MAKE_SIG(type, gpu_shader5, 3, x, y, borrow);
+
+ body.emit(assign(borrow, ir_builder::borrow(x, y)));
+ body.emit(ret(sub(x, y)));
+
+ return sig;
+}
+
+/**
+ * For both imulExtended() and umulExtended() built-ins.
+ */
+ir_function_signature *
+builtin_builder::_mulExtended(const glsl_type *type)
+{
+ ir_variable *x = in_var(type, "x");
+ ir_variable *y = in_var(type, "y");
+ ir_variable *msb = out_var(type, "msb");
+ ir_variable *lsb = out_var(type, "lsb");
+ MAKE_SIG(glsl_type::void_type, gpu_shader5, 4, x, y, msb, lsb);
+
+ body.emit(assign(msb, imul_high(x, y)));
+ body.emit(assign(lsb, mul(x, y)));
+
+ return sig;
+}
/** @} */
/******************************************************************************/