cepl icon indicating copy to clipboard operation
cepl copied to clipboard

Is gpu fence working correctly here?

Open cbaggers opened this issue 7 years ago • 0 comments

(in-package :play-with-verts)

(defun test ()
  (let ((data-a (make-c-array (loop :for i :below 5 :collect (v! 1 1 i))))
        (data-b (make-c-array (loop :for i :below 5 :collect (v! 2 2 i))))
        (iarr (make-gpu-array '(0 1 2 3 4) :element-type :ushort)))
    (destructuring-bind (garr-a garr-b)
        (make-gpu-arrays (list data-a data-b))
      (let* ((str-a (make-buffer-stream garr-a :index-array iarr))
             (str-b (make-buffer-stream garr-b :index-array iarr
                                        ;;:sharing str-a
                                        ))
             (pipeline
              (pipeline-g ()
                :vertex (lambda-g ((elem :vec3))
                          (values
                           (v! 1 2 3 4)
                           (:feedback elem)))))
             (feedback-garr
              (make-gpu-array nil :element-type :vec3 :dimensions 5))
             (tfs (make-transform-feedback-stream feedback-garr)))
        (break "hi ~a ~a" str-a str-b)
        (with-transform-feedback (tfs)
          (map-g pipeline str-a))
        (wait-on-gpu-fence (make-gpu-fence) 0)
        (print (pull-g feedback-garr))
        (with-transform-feedback (tfs)
          (map-g pipeline str-b))
        (wait-on-gpu-fence (make-gpu-fence))
        (print (pull-g feedback-garr))))))

cbaggers avatar Sep 26 '18 19:09 cbaggers