Hi! I'm new to mount. I tried this:
(defstate arena
:start (Arena/ofConfined)
:stop (.close arena))
(defn create-instance
[]
(.createInstance wgpu (WGPUInstanceDescriptor/allocate arena)))
(defstate instance
:start (create-instance)
:stop (release-instance instance))
And I get this error:
could not start [#'game.webgpu/instance] due to
class game.webgpu$arena cannot be cast to class java.lang.foreign.Arena
So apparently when trying to run (create-instance), arena is not an arena. But I thought the whole point of mount was that I would be able to do something like this. What is wrong? I also tried with taking the arena as an argument to create-instance, but that did not change anything.does calling:
(.createInstance wgpu (WGPUInstanceDescriptor/allocate (Arena/ofConfined))))
work as intended?
not sure what “`WGPUInstanceDescriptor`” and “`Arena`” are, but your assumption is correct, mount uses Clojure compiler to discover the dependencies, and the “`arena`” state would need to be compiled first before it can be used in “`create-instance`”WGPUInstanceDescriptor comes from WebGPU (graphics library) native bindings, and arena is a native memory segment. But anyway, I restarted my REPL to try everything from a fresh state and had some other problems, excuse me for a bit...
Hm, after restarting my REPL and fixing some other things (seemingly unrelated things) it now works.
I was refactoring my code to use mount and I don't know what weird state I ended up in.