re-add pipe_surface map/unmap inlines
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 1 May 2008 17:13:46 +0000 (18:13 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Fri, 2 May 2008 10:11:27 +0000 (11:11 +0100)
src/gallium/auxiliary/draw/draw_vs_sse.c
src/gallium/drivers/softpipe/sp_surface.c
src/gallium/include/pipe/p_inlines.h

index 90926aec850103cb9f97183d9b67c50fd13705c8..07f85bc448f2fc8c02dcfeb7bd95c5beb84eeafd 100644 (file)
@@ -47,7 +47,7 @@
 #include "tgsi/util/tgsi_parse.h"
 
 #define SSE_MAX_VERTICES 4
-#define SSE_SWIZZLES 0
+#define SSE_SWIZZLES 1
 
 #if SSE_SWIZZLES
 typedef void (XSTDCALL *codegen_function) (
index b82b1a8f37d378a658986bad9d25e7183c478809..29a1e92416ee15e1f9b470868dcfb9af1200d32f 100644 (file)
@@ -46,7 +46,6 @@ sp_surface_copy(struct pipe_context *pipe,
                struct pipe_surface *src,
                unsigned srcx, unsigned srcy, unsigned width, unsigned height)
 {
-   assert( dst->cpp == src->cpp );
    void *dst_map = pipe->screen->surface_map( pipe->screen,
                                               dst,
                                               PIPE_BUFFER_USAGE_CPU_WRITE );
@@ -55,6 +54,7 @@ sp_surface_copy(struct pipe_context *pipe,
                                                     src,
                                                     PIPE_BUFFER_USAGE_CPU_READ );
 
+   assert( dst->cpp == src->cpp );
    assert(src_map && dst_map);
 
    pipe_copy_rect(dst_map,
index 592c3c87c263f12431e0c63f727ac0796a6c5838..1e4b98edb4883eca0c05794968ae00e87e5807e7 100644 (file)
@@ -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.