softpipe: add a better fake implementation of fences
authorMarek Olšák <maraeo@gmail.com>
Wed, 1 Jun 2011 22:50:45 +0000 (00:50 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 2 Jun 2011 14:50:46 +0000 (16:50 +0200)
The flush function, when asked for, should not return a NULL fence.

NULL can only be returned if fences are not implemented, and st/mesa
doesn't call any of the fence functions if it receives a NULL fence
(because some drivers don't even set the fence hooks).

ARB_sync is exposed if fence_finish is set.

src/gallium/drivers/softpipe/sp_fence.c
src/gallium/drivers/softpipe/sp_flush.c

index 7b79a0df4ea3e5b98d069204d4441394e32fbf68..c2897ed1ef878772ba89e4f530f0301cadfa85d7 100644 (file)
@@ -36,8 +36,7 @@ softpipe_fence_reference(struct pipe_screen *screen,
                          struct pipe_fence_handle **ptr,
                          struct pipe_fence_handle *fence)
 {
-   assert(!*ptr);
-   assert(!fence);
+   *ptr = fence;
 }
 
 
@@ -45,7 +44,7 @@ static boolean
 softpipe_fence_signalled(struct pipe_screen *screen,
                          struct pipe_fence_handle *fence)
 {
-   assert(!fence);
+   assert(fence);
    return TRUE;
 }
 
@@ -55,7 +54,7 @@ softpipe_fence_finish(struct pipe_screen *screen,
                       struct pipe_fence_handle *fence,
                       uint64_t timeout)
 {
-   assert(!fence);
+   assert(fence);
    return TRUE;
 }
 
index 720fea83cb219967fd961b99a96138cf026eee3b..a2733e95878f52f386f82653696b75076c79822b 100644 (file)
@@ -96,9 +96,9 @@ softpipe_flush( struct pipe_context *pipe,
       ++frame_no;
    }
 #endif
-   
+
    if (fence)
-      *fence = NULL;
+      *fence = (void*)(intptr_t)1;
 }
 
 void