Support for separate depth and stencil renderbuffers.
If the user creates several stencil renderbuffers and several depth
renderbuffers, any combination can get bound to a framebuffer object.
Since the hardware only supports combined depth+stencil buffers we
need to do some shuffling of buffer data to make things work.
This code deals with that.
Now fbotexture.c runs in hardware without the -ds flag.
Probably quite a few loose ends, clean-ups remain...
Fix a number of issues in the _mesa_extract/insert_stencil() functions.
Pass an attachment index to _mesa_update_depth/stencil_buffer() funcs to
facilitate "paired" depth/stencil renderbuffers in drivers.
New update_color_draw_buffers() and update_color_read_buffer() functions
to make the _mesa_update_framebuffer() function a little cleaner.
Reorganize the code relating to updating the framebuffer's _DepthBuffer
and _StencilBuffer fields.
These fields are often wrappers/adaptors around combined depth/stencil
renderbuffers.
Make _mesa_update_depth_buffer() and _mesa_update_stencil_buffer() public.
Lots of updates for new gl_renderbuffer ClassID and _ActualFormat fields.
Removed hw_stencil field from context. Now determine hw stencil from looking
at the stencil renderbuffer.
Enabled the GL_EXT_packed_depth_stencil extension. May not be permanent but
for now it allows hw stencil to work with the fbotexture.c demo (w/ -ds flag).
Using separate renderbuffers for GL_DEPTH_ATTACHMENT_EXT and
GL_STENCIL_ATTACHMENT_EXT works, but is currently a software fallback.
1. Added _ActualFormat field to record the actual storage format chosen by
Mesa or the driver. The InternalFormat field has to store the value that
the user passed into the glRenderbufferStorageEXT() function.
2. Added ClassID field so driver can distinguish between gl_renderbuffers
and intel_renderbuffers (for example). Not very OOP-like, but seems to
be a reasonable solution.
Need to set hardware viewport params depending on window vs. FBO rendering
and normal FBO vs. RTT. Fixes upside down teapot in fbotexture.c demo.
Still need to adjust glDraw/Read/CopyPixels Y direction depending on if
we're doing RTT.
Additional login in intel_draw_buffer() to check if any needed renderbuffers
are software/fallback cases.
The hardware's combined depth/stencil buffer is now treated as such
(ala GL_EXT_packed_depth_stencil). So the depth/stencil span functions
are effectively merged. Renderbuffers wrappers will extract the depth or
stencil values when needed.
- get gl_framebuffer pointer from dPriv.
- flush current context if bound to window we're swapping. Previous code
could try to flush a non-current context.