#sum everything to a single element with threads

1 messages · Page 1 of 1 (latest)

compact portal
compact portal
#

sum everything to a single element with threads

glass grotto
#

This is trivial task for compute shader:

StructuredBuffer<int> valuesArray;
RWStructuredBuffer<int> resultInFirstElement;

[numthreads(256, 1, 1)]
void ParallelSum(uint tid: SV_DispatchThreadID)
{
    InterlockedAdd(resultInFirstElement[0], valuesArray[tid]);
}