Define FLAMEGPU_CUSTOM_REDUCTION

Define Documentation

FLAMEGPU_CUSTOM_REDUCTION(funcName, a, b)

Macro for defining custom reduction functions with the correct inputs.

(a, b)->(c)

These functions must be valid CUDA code, and have no access to the FLAMEGPU DeviceAPI.

Saves users from manually defining custom reductions, e.g.:

// User Implemented custom reduction
struct SomeCustomReduction_impl {
 public:
    template <typename OutT>
    struct binary_function {
        __device__ __forceinline__ OutT operator()(const OutT &a, const OutT &b) const {
             // reduce something
             return a + b;
        }
    };
};
SomeCustomReduction_impl SomeCustomReduction;