I'm trying to achieve rendering to multiple targets with multiple viewports. Currently it does not work possibly because I have a single depth buffer so a first write to it with a specific viewport will not allow rewrite when using another viewport covering a similar area because the depth value is higher (comparison test is less). For this I'm using a geometry shader to select the target and viewport. I have this situation where the rendering to the second target does not need depth testing. So I would like to know if it is possible in the geometry shader to activate depth write when selecting the first target and deactivate it when selecting the second target.
Maybe this will not solve my problem but I'm interested to know if we can do this as it could give some improvement when not using the depth testing.