I currently have a scenario where I am rendering terrain with a shadow map. I have two passes, one for the depth buffer to create the shadow map (which is rendered to a texture) and a second that takes the shadow map texture as input and actually shadows the terrain, the terrain gets drawn once for each pass. Within the second shader I also texture the terrain.
I now want to split the second shader so that shadows and texturing are separate shaders. How do I go about getting the output from the shadow shader to the texture shader (or vice versa), or do I simply do it in the same way as I have with the shadows (rendering to a texture, passing it as an input).