In my application, I have partitioned the screen into different regions. These are given by the polygon boundaries. Once this partition has happened in the CPU, the shader should now give each pixel a value corresponding to the region it is in.
At the moment, I am doing a point-in-polygon test for each pixel, which is of course pretty slow. To accelerate, I also compute the bounding boxes for each polygon for a first pre-check.
Is there a faster way of doing this in principle? I looked into some flood fill algorithms, but they do not seem to be fit for use in shaders.
Or, if I have to do point-in-polygon checks for each pixel, is there an algorithm to compute a simplified polygon contained in the original one, to further enhance performance? This would only leave me to do the point-in-polygon checks with the original polygon for the few cases where pixels are in the bounding box, but not in the simplified polygon.