(Compute shader dispatch)!

6, Apr, 2020

OpenGL has compute shader functionality built for some time. Regardless of the funcitonality itself, you may dispatch 3d grid of shader workgroups - that is nx * ny *nz. This probably was designed to easy texture and voxel data computations tasks. No more index to 2/3D indices calculation. For 1D problems, in theory, one may set nx=n, ny=1, nz=1. But only in theory. In practice 1D data may be large, and OpenGL gives you limits on number of work groups in each direction. The limits are platform dependent, with 65536 as a minimum portable value required. This is much less than any 1D data that anybody would like to put to GPU in first place. So, trivial index calculation for one set of operations was exchanged to not so trivial closest integer factorization problem for other.

OOP great again ;)

4, Apr, 2020

The last annoying error was like that - mouse handling function got spinning handling 100% of one CPU. And it was buried under tons of oop abstraction, which was disorienting even the profiler. This reminded me function to check mouse position on amiga:

unsigned short xy = *(unsigned short volatile*)0xdff0a;
unsigned short x = xy >> 8;
unsigned short y = xy  & 0xff;

Yeap, so simple. I know there is int to pointer conversion. I know this maybe shall a little enhancement in some cases (you may want to track mouse more than 256 impulses). But, it was at most direct function call.