Skip to content

Commit

Permalink
Restructured bounds checks to avoid some performance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Nov 26, 2021
1 parent 93bc3fb commit 1f47d35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/glscopeclient/shaders/waveform-compute-core.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ void main()
#endif

//Clip to window size
starty = min(starty, MAX_HEIGHT-1);
endy = min(endy, MAX_HEIGHT-1);
starty = min(starty, MAX_HEIGHT - 1);
endy = min(endy, MAX_HEIGHT - 1);
starty = max(starty, 0);
endy = max(endy, 0);

//Sort Y coordinates from min to max
g_blockmin[gl_LocalInvocationID.y] = int(min(starty, endy));
Expand Down Expand Up @@ -165,8 +167,6 @@ void main()
{
//Parallel fill
int ymin = g_blockmin[y];
if(ymin < 0)
ymin = 0;
int len = g_blockmax[y] - ymin;
for(uint y=gl_LocalInvocationID.y; y <= len; y += ROWS_PER_BLOCK)
{
Expand Down

0 comments on commit 1f47d35

Please sign in to comment.