Skip to content

Commit

Permalink
Block ping-pong's back first
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Dec 19, 2018
1 parent d2d37ca commit 00f029a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions graphics/sync.lisp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(cl:in-package :cl-bodge.graphics)


(define-constant +default-fence-timeout+ (* 60 60 1000000))

(defclass ping-pong-side ()
((object :initform nil :initarg :object :reader ping-pong-side-object)
(fence :initform nil)
Expand All @@ -20,7 +22,7 @@
(with-slots (fence lock) side
(let ((fence (bt:with-recursive-lock-held (lock) fence)))
(when fence
(%gl:client-wait-sync fence :sync-flush-commands 1000000)))))
(%gl:client-wait-sync fence :sync-flush-commands +default-fence-timeout+)))))


(defun refresh-side-fence (side)
Expand Down Expand Up @@ -49,10 +51,10 @@

(defun ping-pong-swap (object)
(with-slots (front back) object
(with-side-locked (front)
(with-side-locked (back)
(with-side-locked (back)
(wait-for-side back)
(with-side-locked (front)
(wait-for-side front)
(wait-for-side back)
(let ((tmp front))
(setf front back
back tmp))))))
Expand Down

0 comments on commit 00f029a

Please sign in to comment.