Browse Source

Process textures in parallel

pitch-detection
Macoy Madson 10 months ago
parent
commit
72a91c97ec
  1. 2
      Dependencies/cakelisp
  2. 24
      test/src/VocalGame.cake

2
Dependencies/cakelisp

@ -1 +1 @@
Subproject commit 82195c8d442d4697f20d6cc35b896cecae4332f5
Subproject commit 5958efdae9e07f6acb6ddecc4c080f4e130517a2

24
test/src/VocalGame.cake

@ -584,6 +584,10 @@
;; TODO: Convert this to non-sequential to convert in parallel
(scope ;; Textures
(var texture-assets ([] (* (const char))) (array "Monkey_Texture"))
(var texture-process-results (<> std::vector int))
(on-call texture-process-results resize (array-size texture-assets))
(var max-num-processes int 4)
(var num-processes-running int 0)
(var i int 0)
(while (< i (array-size texture-assets))
(var texture-asset ([] MAX_PATH_LENGTH char) (array 0))
@ -595,12 +599,26 @@
(incr i)
(continue))
(run-process-sequential-or
;; Don't spin up too many processes
(when (>= num-processes-running max-num-processes)
(Log "wait for processes\n")
(waitForAllProcessesClosed null)
(set num-processes-running 0))
(set (at i texture-process-results) -1)
(run-process-start-or (addr (at i texture-process-results))
("convert" texture-asset texture-converted)
(Log "Asset-Building: failed to convert 2D texture. Is `convert` on your path? You may need to
(Log "Asset-Building: failed to convert 2D texture. Is 'convert' on your path? You may need to
install ImageMagick. See https://www.imagemagick.org/script/download.php\n")
(return false))
(incr i)))
(incr num-processes-running)
(incr i))
(waitForAllProcessesClosed null)
(for-in result int texture-process-results
(unless (= 0 result)
(Log "Asset-Building: failed to convert texture\n")
(return false))))
(return true))

Loading…
Cancel
Save