@@ -41,14 +41,16 @@ struct BdaAccessor
41
41
return target.template deref ().store (value);
42
42
}
43
43
44
- enable_if_t<is_integral<T>::value && (sizeof (T) == 4 || sizeof (T) == 8 ), T>
44
+ template<typename S = T>
45
+ enable_if_t<is_same_v<S,T> && is_integral<T>::value && (sizeof (T) == 4 || sizeof (T) == 8 ), T>
45
46
atomicAdd (const uint64_t index, const T value)
46
47
{
47
48
bda::__ptr<T> target = ptr + index;
48
49
return glsl::atomicAdd (target.template deref ().get_ptr (), value);
49
50
}
50
51
51
- enable_if_t<is_integral<T>::value && (sizeof (T) == 4 || sizeof (T) == 8 ), T>
52
+ template<typename S = T>
53
+ enable_if_t<is_same_v<S,T> && is_integral<T>::value && (sizeof (T) == 4 || sizeof (T) == 8 ), T>
52
54
atomicSub (const uint64_t index, const T value)
53
55
{
54
56
bda::__ptr<T> target = ptr + index;
@@ -58,6 +60,40 @@ struct BdaAccessor
58
60
bda::__ptr<T> ptr;
59
61
};
60
62
63
+ template<typename T>
64
+ struct DoubleBdaAccessor
65
+ {
66
+ using type_t = T;
67
+ static DoubleBdaAccessor<T> create (const bda::__ptr<T> inputPtr, const bda::__ptr<T> outputPtr)
68
+ {
69
+ DoubleBdaAccessor<T> accessor;
70
+ accessor.inputPtr = inputPtr;
71
+ accessor.outputPtr = outputPtr;
72
+ return accessor;
73
+ }
74
+
75
+ T get (const uint64_t index)
76
+ {
77
+ bda::__ptr<T> target = inputPtr + index;
78
+ return target.template deref ().load ();
79
+ }
80
+
81
+ void get (const uint64_t index, NBL_REF_ARG (T) value)
82
+ {
83
+ bda::__ptr<T> target = inputPtr + index;
84
+ value = target.template deref ().load ();
85
+ }
86
+
87
+ void set (const uint64_t index, const T value)
88
+ {
89
+ bda::__ptr<T> target = outputPtr + index;
90
+ return target.template deref ().store (value);
91
+ }
92
+
93
+ bda::__ptr<T> inputPtr, outputPtr;
94
+ };
95
+
96
+
61
97
}
62
98
}
63
99
0 commit comments