Hey,
I'm trying to use layered rendering in opengl in the geometry shader but I'm not sure if I fully understand how it works. When I use gl_layer in the geometry shader I can pick which layer to render to in a framebuffer. How does that work then when it goes on to the fragment shader stage. Which layer does the fragment shader use? Does the fragment shader run for all the layers? I can't really find any information on how that process works internally when it comes to using layers in a geometry shader and then everything going onto the fragment shader stage. Also if that is how it works (fragment shader runs for all layer outputs) how can I know what layer is currently being used in the fragment shader so I can specify what data of an array I want to use depending on the layer in the fragment shader. This might not make any sense if my understanding of layered rendering is off.
Thanks.