Skip to content

Commit

Permalink
Usurp nested buffer transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Jul 6, 2019
1 parent e7d84e2 commit 1bf3ad3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions assets/uniform-buffer.lisp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@
(defmethod update-buffer-data ((buffer uniform-buffer) (data (eql T)) &key) (defmethod update-buffer-data ((buffer uniform-buffer) (data (eql T)) &key)
(update-buffer-data/ptr buffer (static-vector-pointer (buffer-data buffer)) (size buffer))) (update-buffer-data/ptr buffer (static-vector-pointer (buffer-data buffer)) (size buffer)))


(defvar *buffers-in-tx* ())
(defmacro with-buffer-tx ((struct buffer) &body body) (defmacro with-buffer-tx ((struct buffer) &body body)
;; FIXME: Usurp nested transactions on same buffer.
(let ((bufferg (gensym "BUFFER"))) (let ((bufferg (gensym "BUFFER")))
`(let* ((,bufferg ,buffer) `(let ((,bufferg ,buffer))
(,struct (struct ,bufferg)))
(multiple-value-prog1 (multiple-value-prog1
(progn ,@body) (let ((*buffers-in-tx* (list* ,bufferg *buffers-in-tx*))
(with-context (*context*) (,struct (struct ,bufferg)))
(update-buffer-data ,bufferg T)))))) ,@body)
(unless (find ,bufferg *buffers-in-tx*)
(with-context (*context*)
(update-buffer-data ,bufferg T)))))))

0 comments on commit 1bf3ad3

Please sign in to comment.