I am using layered rendering for all my light sources to avoid rendering multiple times.
lightSourceCount many point lights and one sun, which is implemented as an orthographic light source (due to the large distance).
The sun light should be implemented as cascaded shadow mapping (4 cascades), because I would like to render landscapes.
The shadowmap resolution and format of the point lights and the cascaded shadow maps are equal.
Is it possible to define a GL_TEXTURE_2D_ARRAY with (
lightSourceCount * 6 + 4) layers as shadow maps. Render the scenario using layered rendering to fill these shadow maps. And afterwards use the first
lightSourceCount * 6 layeres as a GL_TEXTURE_CUBEMAP_ARRAY with
lightSourceCount layers within GLSL to be able to use
gvec4 texture(gsamplerCubeArray sampler, vec4 P, [float bias]); while the last 4 layers are able to be used with
gvec4 texture(gsampler2DArray sampler, vec3 P, [float bias]);?
If yes, how can I do that? Can I just bind the GL_TEXTURE_2D_ARRAY as a GL_TEXTURE_CUBEMAP_ARRAY?
And use the last 4 layers by binding the same Texture as GL_TEXTURE_2D_ARRAY and access the last 4 layers by using
texture(gsampler2DArray sampler, vec3(uvCoordinate, lightSourceCount * 6 + currentTexture))?