aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/common/dri_drawable.c
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-04-24 13:36:09 +0100
committerJakob Bornecrantz <[email protected]>2010-04-26 00:40:17 +0100
commitea6a52a1f8e7fd72b5506218c31e58088131f1f5 (patch)
treed0eb24768f229a2ffe6b3cca4eb0ef356369d736 /src/gallium/state_trackers/dri/common/dri_drawable.c
parentab12d4f647702f0063c41dd090cef762aa95a0f9 (diff)
st/dri: Add hooks for framebuffer functions
Diffstat (limited to 'src/gallium/state_trackers/dri/common/dri_drawable.c')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index 88c17e81bfb..6b551ea3f96 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -90,4 +90,32 @@ dri_destroy_buffer(__DRIdrawable * dPriv)
FREE(drawable);
}
+/**
+ * Get the format and binding of an attachment.
+ */
+void
+dri_drawable_get_format(struct dri_drawable *drawable,
+ enum st_attachment_type statt,
+ enum pipe_format *format,
+ unsigned *bind)
+{
+ switch (statt) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_BACK_LEFT:
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ case ST_ATTACHMENT_BACK_RIGHT:
+ *format = drawable->stvis.color_format;
+ *bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ *format = drawable->stvis.depth_stencil_format;
+ *bind = PIPE_BIND_DEPTH_STENCIL; /* XXX sampler? */
+ break;
+ default:
+ *format = PIPE_FORMAT_NONE;
+ *bind = 0;
+ break;
+ }
+}
+
/* vim: set sw=3 ts=8 sts=3 expandtab: */