G-code and Gerber polygons are terms from electronic circuit board design?
In any case, the idea of ‘filling’ polygons is an oversimplification. The polygons are drawn by the graphics card, using the rendering pipeline. There are two (principal) pieces of code involved, the vertex shader, which calculates the position and characteristics of each vertex and then passes the results to the fragment shader, which interpolates the results across a polygon face, although there can be other inputs to the fragment shader as well, such as lights, textures, mouse position, time etc.
So in a way the fragment shader is the filling algorithm. But it has a lot of power beyond just filling faces. Have a look at shadertoy.com - every example there is written just using a fragment shader.
On the other hand if you want to create a fragment shader that just fills a polygon, say with a single color or texture, that’s pretty easy to do.