Has anyone tried single-pass stereo rendering?
OpenGL provides a mechanism to render the same output multiple times to different viewports via geometry shaders. Once of the examples in the red book actually shows multiple different views of a single 3D model. It seems like it should be possible to adapt this technique to perform both eye rendering passes concurrently.
You'll still have the same amount of rasterization and fragment processing, but you'll only have to do the vertex processing once. It seems like this would be beneficial if your bottleneck is somehow in the vertex processing, although from my reading that's usually tantamount to saying your bottleneck is in the OpenGL call layer because you're using draw calls inefficiently.
In cases where your bottleneck is the fragment shader, this clearly wouldn't help and may actually hurt due to the inclusion of an otherwise unnecessary geometry shader, but of course the SDK already provides a reasonable mechanism for dynamically changing the effective offscreen texture resolution.
- Set up distortion rendering to use a single offscreen texture
- Set up the viewports to each target half of the texture
- Add a geometry shader which uses instancing or geometry amplification to effectively fork the incoming vertex processing for the two views
- Apply the projection matrices and per-eye translation offset matrices in the geometry shader
You'll still have the same amount of rasterization and fragment processing, but you'll only have to do the vertex processing once. It seems like this would be beneficial if your bottleneck is somehow in the vertex processing, although from my reading that's usually tantamount to saying your bottleneck is in the OpenGL call layer because you're using draw calls inefficiently.
In cases where your bottleneck is the fragment shader, this clearly wouldn't help and may actually hurt due to the inclusion of an otherwise unnecessary geometry shader, but of course the SDK already provides a reasonable mechanism for dynamically changing the effective offscreen texture resolution.
