Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is work count being calculated correctly? #2

Open
shoxsz opened this issue May 7, 2018 · 0 comments
Open

Is work count being calculated correctly? #2

shoxsz opened this issue May 7, 2018 · 0 comments

Comments

@shoxsz
Copy link

shoxsz commented May 7, 2018

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:

_workCount = ((map->positions.size() + k_groupSize - 1) / k_groupSize) * k_groupSize;
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant