Not quite sure what the layering part has to do with the shader.
I found this tutorial extremely helpful when I implemented lighting into my 2d engine:
When it comes to layers I simply render each layer into a separate render target, using three layers whereof each has unique lighting, for instance;
- a light in the landscape layer is only affecting objects rendered within the same layer
- a object within the layer in front of the landscape layer is not affected by the lighting in the landscape layer
This is of course by design and related to the rendering process itself rather than the shader.
Another helpful resource is the this tutorial:
http://www.soolstyle.com/2010/02/15/2d-deferred-lightning/