summaryrefslogtreecommitdiff
path: root/src/mesa/main/framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/framebuffer.c')
-rw-r--r--src/mesa/main/framebuffer.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 154dedacd5..d958dbf7d4 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -969,3 +969,29 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
/* OK */
return GL_TRUE;
}
+
+GLenum
+_mesa_get_color_read_format(GLcontext *ctx)
+{
+ switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
+ case MESA_FORMAT_ARGB8888:
+ return GL_BGRA;
+ case MESA_FORMAT_RGB565:
+ return GL_BGR;
+ default:
+ return GL_RGBA;
+ }
+}
+
+GLenum
+_mesa_get_color_read_type(GLcontext *ctx)
+{
+ switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
+ case MESA_FORMAT_ARGB8888:
+ return GL_UNSIGNED_BYTE;
+ case MESA_FORMAT_RGB565:
+ return GL_UNSIGNED_SHORT_5_6_5_REV;
+ default:
+ return GL_UNSIGNED_BYTE;
+ }
+}