summaryrefslogtreecommitdiff
path: root/src/glitz_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glitz_context.c')
-rw-r--r--src/glitz_context.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/glitz_context.c b/src/glitz_context.c
index 249d933..fe0e637 100644
--- a/src/glitz_context.c
+++ b/src/glitz_context.c
@@ -186,3 +186,63 @@ glitz_context_bind_texture (glitz_context_t *context,
&texture->param);
}
slim_hidden_def(glitz_context_bind_texture);
+
+void
+glitz_context_draw_buffers (glitz_context_t *context,
+ const glitz_drawable_buffer_t *buffers,
+ int n)
+{
+ unsigned int mask = 0;
+
+#define FRONT_BIT (1 << 0)
+#define BACK_BIT (1 << 1)
+
+ while (n--)
+ {
+ switch (*buffers++) {
+ case GLITZ_DRAWABLE_BUFFER_FRONT_COLOR:
+ mask |= FRONT_BIT;
+ break;
+ case GLITZ_DRAWABLE_BUFFER_BACK_COLOR:
+ mask |= BACK_BIT;
+ default:
+ break;
+ }
+ }
+
+ if (mask)
+ {
+ if (mask == (FRONT_BIT | BACK_BIT))
+ context->drawable->backend->draw_buffer (context->drawable,
+ GLITZ_GL_FRONT_AND_BACK);
+ else if (mask == FRONT_BIT)
+ context->drawable->backend->draw_buffer (context->drawable,
+ GLITZ_GL_FRONT);
+ else
+ context->drawable->backend->draw_buffer (context->drawable,
+ GLITZ_GL_BACK);
+ }
+
+#undef FRONT_BIT
+#undef BACK_BIT
+
+}
+slim_hidden_def(glitz_context_draw_buffers);
+
+void
+glitz_context_read_buffer (glitz_context_t *context,
+ const glitz_drawable_buffer_t buffer)
+{
+ switch (buffer) {
+ case GLITZ_DRAWABLE_BUFFER_FRONT_COLOR:
+ context->drawable->backend->read_buffer (context->drawable,
+ GLITZ_GL_FRONT);
+ break;
+ case GLITZ_DRAWABLE_BUFFER_BACK_COLOR:
+ context->drawable->backend->read_buffer (context->drawable,
+ GLITZ_GL_BACK);
+ default:
+ break;
+ }
+}
+slim_hidden_def(glitz_context_read_buffer);