Post

Replies

Boosts

Views

Activity

Multiple renders to single texture without blocking MTLCommandBuffer
I am trying to render 3 separate things to one texture in Metal. I have a MTLTexture that is used as a destination in 3 different MTLCommandBuffers. I commit them one after another. Each MTLCommandBuffer renders to a separate part of the texture - first draws in the 0 - 1/3 part, second draws the middle 1/3 - 2/3 and the last one draws 2/3 - 1. id<MTLTexture> dst_texture = ...; id<MTLCommandBuffer> buffer1 = [self drawToTexture:dst_texture]; [buffer1 commit]; id<MTLCommandBuffer> buffer2 = [self drawToTexture:dst_texture]; [buffer2 commit]; id<MTLCommandBuffer> buffer3 = [self drawToTexture:dst_texture]; [buffer3 commit]; The problem is that it seems I can't share the destination texture in the different command buffers - I get glitches, sometimes I can see only partial results on the destination texture... Inside drawToTexture I use dst_texture this way: _renderPassDescriptor.colorAttachments[0].texture = dst_texture; _renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionLoad; The problem gets fixed when I call [buffer waitUntilCompleted] after each individual commit but I suppose it affects the performance and I would love to have it without blocking/waiting. This works: id<MTLTexture> dst_texture = ...; id<MTLCommandBuffer> buffer1 = [self drawToTexture:dst_texture]; [buffer1 commit]; [buffer1 waitUntilCompleted]; id<MTLCommandBuffer> buffer2 = [self drawToTexture:dst_texture]; [buffer2 commit]; [buffer2 waitUntilCompleted]; id<MTLCommandBuffer> buffer3 = [self drawToTexture:dst_texture]; [buffer3 commit]; [buffer3 waitUntilCompleted]; What else I could do here to avoid waitUntilCompleted calls?
1
0
535
Sep ’21
FxPlug, Metal & FCPX 10.4.4
Hello!FCPX 10.4.4 has just been released and my question is - what's the best way to write the plugin for it? With the OpenGL &amp; OpenCL deprecation I still see that FxPlug SDK hasn't been updated and the only way to use GPU acceleration is through OpenGL texture... so what would be the best way to implement a GPU accelerated plugin?Is there any example that shows how to use Metal framework for FCPX plugin development?Thanks in advance,Tom
2
0
1.9k
Nov ’18