microZEUS
The whole stack, hand-drawn.

◄ Wiki / Graphics

gl_Layer

gl_Layer is a shader built-in variable that selects which layer of a layered render target to draw into.

Some framebuffers have multiple layers — think slices of a texture array or the faces of a cubemap. By writing to gl_Layer, a shader (often a geometry shader) chooses which layer each primitive is rendered into, enabling techniques like rendering all six cubemap faces in one pass. It is how a single draw can fan out across multiple render-target slices.

See also

  • gl_PrimitiveIDgl_PrimitiveID is a shader built-in giving the index number of the primitive currently being processed.
  • geometry shaderA geometry shader is a programmable GPU stage that can take a primitive and emit new primitives from it.
  • framebufferA framebuffer is the block of memory holding the image being rendered, essentially the picture that becomes the screen.

Referenced by

framebuffer · gl_PrimitiveID · gl_PrimitiveID / gl_Layer