-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Hi! First off, huge props for publishing this awesome library. It is one of the most complete (and up-to-date) real-world example of a Metal rendering architecture that I've seen 👏
It is a shame that there is no simple example demo (the ImGui demo is out of date, and I'd like to see some different examples of passes). I wanted to try and see if I could implement the Xcode Metal Game starter project (rotating cube) using Substrate. This is what I got:
func render(in drawable: CAMetalDrawable) {
let pass = TestDrawPass(uniforms: uniforms, outputTexture: Texture(metalTexture: drawable.texture))
renderGraph.addPass(pass)
Task {
await renderGraph.execute()
drawable.present()
inFlightSemaphore.signal()
isRendering = false
}
}
func draw(in view: MTKView) {
guard !isRendering else { return }
isRendering = true
// autoreleasepool {
guard let drawable = view.currentDrawable else { return }
self.render(in: drawable)
// }
}TestDrawPass is not implemented yet, (execute is empty), but I already ran into an issue: CPU usage keeps climbing indefinitely until the app stalls:
I tried to profile it, but the problem is not exhibiting while profiling. This is on Xcode 14, Beta 5 on macOS Ventura.
Is there an issue with my setup so far? It is a bit unclear on how to set up the texture for the CADrawable manually, without going through the AppFramework (which imposes too much in terms of view and window management).
Do you think you could share a few more examples of Render Passes for drawing a simple instanced mesh? A sample project with a demo renderer would be so helpful.
I'd also like to know if there is any way to use Substrate in a static mode, where the graph is manually rebuilt rather than on every frame. This would make it more viable for use cases where the resources and passes do not change very often.
