Fornos
Fornos copied to clipboard
Is work count being calculated correctly?
Hello, maybe i'm confusing something, but i was reading Fornos code and i think i have found a little problem:
This line of code: https://github.com/caosdoar/Fornos/blob/75e8ec52d7a2e834e9eb193de18c5d5397e32f00/Src/meshmapping.cpp#L165 calculates the total work that the shader must do, but isn't it going to force an index out of range(which is silently suppresed in the shader)?
Here for example:
uint gid = gl_GlobalInvocationID.x + workOffset;
if (gid >= workCount) return;
Pix pix = pixels[gid];
But the size of pixels is less than workCount:
workCount = ((map->positions.size() + k_groupSize - 1) / k_groupSize) * k_groupSize;
sixeOfPixels = map->positions.size();
So if map->positions.size() is not a multiple of k_groupSize, then in some point there will be an index out of range because this: if (gid >= workCount) return; will not be evaluated while gid >= sizeOfPixels is true.