summaryrefslogtreecommitdiff
path: root/src/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities.cpp')
-rw-r--r--src/utilities.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utilities.cpp b/src/utilities.cpp
index 68e480c5..11a6c439 100644
--- a/src/utilities.cpp
+++ b/src/utilities.cpp
@@ -332,6 +332,14 @@ void FloatToHalfBuffer(Buffer<half>& result, const Buffer<float>& source, cl_com
result.Write(queue, size, result_cpu);
}
+// Converts a 'real' value to a 'real argument' value to be passed to a kernel. Normally there is
+// no conversion, but half-precision is not supported as kernel argument so it is converted to float.
+template <> typename RealArg<half>::Type GetRealArg(const half value) { return HalfToFloat(value); }
+template <> typename RealArg<float>::Type GetRealArg(const float value) { return value; }
+template <> typename RealArg<double>::Type GetRealArg(const double value) { return value; }
+template <> typename RealArg<float2>::Type GetRealArg(const float2 value) { return value; }
+template <> typename RealArg<double2>::Type GetRealArg(const double2 value) { return value; }
+
// =================================================================================================
// Rounding functions performing ceiling and division operations