Skip to content
Browse files

Usurp nested buffer transactions

  • Loading branch information...
Shinmera committed Jul 6, 2019
1 parent e7d84e2 commit 1bf3ad30fad2fc27e711a248aba7a0b907ad9c8c
Showing with 8 additions and 6 deletions.
  1. +8 −6 assets/uniform-buffer.lisp
@@ -97,12 +97,14 @@
(defmethod update-buffer-data ((buffer uniform-buffer) (data (eql T)) &key)
(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)
;; FIXME: Usurp nested transactions on same buffer.
(let ((bufferg (gensym "BUFFER")))
`(let* ((,bufferg ,buffer)
(,struct (struct ,bufferg)))
`(let ((,bufferg ,buffer))
(progn ,@body)
(with-context (*context*)
(update-buffer-data ,bufferg T))))))
(let ((*buffers-in-tx* (list* ,bufferg *buffers-in-tx*))
(,struct (struct ,bufferg)))
(unless (find ,bufferg *buffers-in-tx*)
(with-context (*context*)
(update-buffer-data ,bufferg T)))))))

0 comments on commit 1bf3ad3

Please sign in to comment.
You can’t perform that action at this time.