0

I want to render an environment map into a cubemap framebuffer but I dislike the fact, that I have to use the geometry shader to set gl_Layer because the geometry shader would be a basic passthrough shader. Additionally a geometry shader could stall the pipeline and decrease performance.

I would rather like to use instanced rendering and set gl_Layer in the vertex shader but unfortunately this is only possible with the AMD_vertex_shader_layer extension.

Is there any other way to set the layer in the shader?

tly
  • 1,202
  • 14
  • 17
  • If the geometry shader is a basic pass-through, I get the impression you are doing it wrong. The whole point of using a geometry shader for layered rendering is so that you can apply a different transformation to the same set of input geometry and emit something different for each layer. Realistically that may not the best way to draw into a cubemap anyway because each of the 6 views will often have a disjoint set of visible geometry. 6 separate passes using only the geometry visible to each is usually quicker in my experience, especially on early DX10 hardware. – Andon M. Coleman Feb 08 '15 at 21:00
  • yes , this is how id like to do it. if i render every side as a separate call the only reason that id use the geometry shader is to set `gl_Layer`. – tly Feb 08 '15 at 23:53
  • Relevant overview of latest OpenGL extensions, including a description of rendering a cubemap in the most optimal way: https://www.slideshare.net/Mark_Kilgard/nvidia-opengl-in-2016 Seems like "NV_geometry_shader_passthrough" would be helpful to you (though I realize I'm a bit late to the party) – Philip Guin Apr 04 '17 at 23:20

0 Answers0