Post

Replies

Boosts

Views

Activity

Writing the contents of MTKView.drawable.texture to a file
Hi folks! I'm an amateur working on an art project. I've made a ray marcher that I'm quite happy with, and it's running on my M1 Max at a beautiful 4k 60 fps. But I've found while I can generate these graphics live quite well, it's another thing to capture them. After getting disappointing results from a capture card and a second computer, I'm wondering whether it's possible to write the contents of drawable directly into a file. I'm using the method here: https://stackoverflow.com/questions/43838089/capture-metal-mtkview-as-movie-in-realtime/43860229#43860229 and while it works, it drops my frame rate from 60 to ~7. I don't really know what I'm doing, and am having a hard time reasoning about whether it would be possible to do this at a satisfactory rate. (When the capture function is off, I'm running about 11ms per frame.) I'm writing directly to drawable.texture from the shader, and then as per the stack overflow example, I'm calling MTLTexture.getBytes(...) to copy the pixels into an AVAssetWriter pixel buffer. I'm wondering if there's an obvious bottleneck here that I don't know enough to avoid, or whether this is a fool's errand in terms of e.g. memory bus speed between the GPU and CPU. Could I increase performance with a blit copy? Is operating directly on drawable introducing unnecessary constraints? Or is this just going to be impossible on current hardware?
0
0
533
Jan ’22
setDepthBias not working on Apple Silicon?
Hi folks - I'm an amateur working on a for-fun project, and don't really know what I'm doing. My app runs correctly on Big Sur on my old MacBook Pro, but I just received an M1 Mac Mini and it appears as though setDepthBias is no longer working (co-planar polygons are rendering as though no depth bias was set). I'm not getting any warnings and can see the depth bias commands in the captured frame, but the effect doesn't seem to be there. I haven't been able to google up any reference to this; does anyone have any ideas? Thanks!
3
1
929
Dec ’20