diff options
author | Jordan Justen <[email protected]> | 2012-12-28 10:55:33 -0800 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2013-01-14 20:48:14 -0800 |
commit | 161a3cd9fcfea61cf16eb75ba35546ecc12a6766 (patch) | |
tree | 2882eb77eee2ffcdd2217e02cc483f673d276d8b /src/mesa/main/framebuffer.c | |
parent | f5a3d151b0741ab00cc0954c6de094484706a666 (diff) |
framebuffer: add _mesa_get_read_renderbuffer
This returns the current read renderbuffer for the specified
format type.
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/framebuffer.c')
-rw-r--r-- | src/mesa/main/framebuffer.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 13887f8f54b..8cbfbd6bcfb 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -42,6 +42,7 @@ #include "framebuffer.h" #include "renderbuffer.h" #include "texobj.h" +#include "glformats.h" @@ -899,6 +900,26 @@ _mesa_get_color_read_type(struct gl_context *ctx) /** + * Returns the read renderbuffer for the specified format. + */ +struct gl_renderbuffer * +_mesa_get_read_renderbuffer_for_format(struct gl_context *ctx, + GLenum format) +{ + struct gl_framebuffer *rfb = ctx->ReadBuffer; + + if (_mesa_is_color_format(format)) { + return rfb->Attachment[rfb->_ColorReadBufferIndex].Renderbuffer; + } else if (_mesa_is_depth_format(format) || + _mesa_is_depthstencil_format(format)) { + return rfb->Attachment[BUFFER_DEPTH].Renderbuffer; + } else { + return rfb->Attachment[BUFFER_STENCIL].Renderbuffer; + } +} + + +/** * Print framebuffer info to stderr, for debugging. */ void |