Ok so I am trying to understand how to combine these 2 techniques and I am failing.
The main goal is to reach the O(lights+fragments) complexity of deferred rendering, instead of O(lights*fragments) of naive/forward rendering.
This is how I am currently doing things:
Say we have n lights. Then we generate n shadow maps O(n)
Now we do one render pass to generate the normal, diffuse color, depth.... information in the geometry buffers.
Then we check for every fragment whether it is occluded in ALL lights. and shadow it if it is.
This has an O(Lights*Fragments) complexity, which is wrong, so how can you reach the ideal asymptotic complexity? What should you do?