summaryrefslogtreecommitdiff
path: root/src/gallium/include/pipe/p_inlines.h
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-01 18:13:46 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-02 11:11:27 +0100
commit731e7b961cd081ac6a64b636937716ce3a623c2c (patch)
tree16457f762c90edfe6059f8221368e96020bb8a7c /src/gallium/include/pipe/p_inlines.h
parent251db95945c6b484a093336e7bf12aed6091de54 (diff)
re-add pipe_surface map/unmap inlines
Diffstat (limited to 'src/gallium/include/pipe/p_inlines.h')
-rw-r--r--src/gallium/include/pipe/p_inlines.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 592c3c87c..1e4b98edb 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -39,6 +39,39 @@ extern "C" {
#endif
+/* XXX: these are a kludge. will fix when all surfaces are views into
+ * textures, and free-floating winsys surfaces go away.
+ */
+static INLINE void *
+pipe_surface_map( struct pipe_surface *surf, unsigned flags )
+{
+ if (surf->texture) {
+ struct pipe_screen *screen = surf->texture->screen;
+ return surf->texture->screen->surface_map( screen, surf, flags );
+ }
+ else {
+ struct pipe_winsys *winsys = surf->winsys;
+ char *map = (char *)winsys->buffer_map( winsys, surf->buffer, flags );
+ if (map == NULL)
+ return NULL;
+ return (void *)(map + surf->offset);
+ }
+}
+
+static INLINE void
+pipe_surface_unmap( struct pipe_surface *surf )
+{
+ if (surf->texture) {
+ struct pipe_screen *screen = surf->texture->screen;
+ surf->texture->screen->surface_unmap( screen, surf );
+ }
+ else {
+ struct pipe_winsys *winsys = surf->winsys;
+ winsys->buffer_unmap( winsys, surf->buffer );
+ }
+}
+
+
/**
* Set 'ptr' to point to 'surf' and update reference counting.