#include "framebuffer.h"
#include "renderbuffer.h"
#include "texobj.h"
+#include "glformats.h"
/**
+ * 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
struct gl_config;
struct gl_context;
+struct gl_renderbuffer;
extern struct gl_framebuffer *
_mesa_create_framebuffer(const struct gl_config *visual);
extern GLenum
_mesa_get_color_read_format(struct gl_context *ctx);
+extern struct gl_renderbuffer *
+_mesa_get_read_renderbuffer_for_format(struct gl_context *ctx,
+ GLenum format);
+
extern void
_mesa_print_framebuffer(const struct gl_framebuffer *fb);