diff --git a/projects/CUDA/utils/Primitives.cpp b/projects/CUDA/utils/Primitives.cpp index 361b09f451..de5bddf298 100644 --- a/projects/CUDA/utils/Primitives.cpp +++ b/projects/CUDA/utils/Primitives.cpp @@ -1659,14 +1659,14 @@ struct PrimDemoteVertAttribs : INode { }); /// demote std::vector vCnts(verts.size()); - pol(range(loops.size()), [&](int i) { + pol(range(loops.size()), [&, tag = wrapv{}](int i) { auto loopI = loops.values[i]; auto uvI = loopUvIds[i]; - atomic_add(wrapv{}, &vertUvs[loopI][0], uvs.values[uvI][0]); - atomic_add(wrapv{}, &vertUvs[loopI][1], uvs.values[uvI][1]); + atomic_add(tag, &vertUvs[loopI][0], uvs.values[uvI][0]); + atomic_add(tag, &vertUvs[loopI][1], uvs.values[uvI][1]); vertUvs[loopI][2] = 0; - atomic_add(wrapv{}, &vCnts[loopI], 1); + atomic_add(tag, &vCnts[loopI], 1); for (const auto &attribTag : demoteAttribs) { if (attribTag == "uv") continue; @@ -1675,12 +1675,12 @@ struct PrimDemoteVertAttribs : INode { using T = std::decay_t; const auto &uvAttrib = uvs.attr(attribTag); if constexpr (std::is_same_v || std::is_same_v) { - atomic_add(wrapv{}, &vertAttrib[loopI], uvAttrib[uvI]); + atomic_add(tag, &vertAttrib[loopI], uvAttrib[uvI]); } else { using TT = typename T::value_type; constexpr int dim = std::tuple_size_v; for (int d = 0; d != dim; ++d) - atomic_add(wrapv{}, &vertAttrib[loopI][d], uvAttrib[uvI][d]); + atomic_add(tag, &vertAttrib[loopI][d], uvAttrib[uvI][d]); } })(verts.attr(attribTag)); } @@ -1769,14 +1769,14 @@ struct PrimAttributePromote : INode { }); /// demote std::vector vCnts(verts.size()); - pol(range(loops.size()), [&](int i) { + pol(range(loops.size()), [&, tag = wrapv{}](int i) { auto loopI = loops.values[i]; auto uvI = loopUvIds[i]; - atomic_add(wrapv{}, &vertUvs[loopI][0], uvs.values[uvI][0]); - atomic_add(wrapv{}, &vertUvs[loopI][1], uvs.values[uvI][1]); + atomic_add(tag, &vertUvs[loopI][0], uvs.values[uvI][0]); + atomic_add(tag, &vertUvs[loopI][1], uvs.values[uvI][1]); vertUvs[loopI][2] = 0; - atomic_add(wrapv{}, &vCnts[loopI], 1); + atomic_add(tag, &vCnts[loopI], 1); for (const auto &attribTag : promoteAttribs) { if (attribTag == "uv") continue; @@ -1785,12 +1785,12 @@ struct PrimAttributePromote : INode { using T = std::decay_t; const auto &uvAttrib = uvs.attr(attribTag); if constexpr (std::is_same_v || std::is_same_v) { - atomic_add(wrapv{}, &vertAttrib[loopI], uvAttrib[uvI]); + atomic_add(tag, &vertAttrib[loopI], uvAttrib[uvI]); } else { using TT = typename T::value_type; constexpr int dim = std::tuple_size_v; for (int d = 0; d != dim; ++d) - atomic_add(wrapv{}, &vertAttrib[loopI][d], uvAttrib[uvI][d]); + atomic_add(tag, &vertAttrib[loopI][d], uvAttrib[uvI][d]); } })(verts.attr(attribTag)); }