Post

Replies

Boosts

Views

Activity

Reply to dispatch_async_f does not return immediatly
Hi, @Apple Graphics The queue is serial type. The code calling dispatch_async_f does not run on the same queue. It's running on a separate worker thread. I used CACurrentMediaTime() to measure duration of dispatch_async_f. Duration still increases progressively from almost instant to 3ms while rendering a static scene for 2mins. @endecotp Yes the functions I enqueue do run. If i pause randomly, I land in this dispatch_async_f 50% of the times. Call statck shows dispatch_async_f()->dispatch_async_f_slow()->ulockWait(). Thanks
Oct ’22
Reply to Unable to create shader debug session
Found the issue: the "macOS Deployment Target" in the sample project was incorrect. While trying with a different sample I got this error message: [Metal Diagnostics Warning] Application Deployment Target Version (10.12) does not match OS Version (13.1) - diagnostics may be missing debug information Changing the target version to 13 fixed the shader debugger.
Jan ’23
Reply to Does Metal on iOS do async compute by default?
After some investigation, it looks like this overlap in the graph is a bug in the Metal profiler. Let Texture_A be the output of the render pass (1) and the input of the compute pass (2). Playing with the content of Texture_A confirms that the compute pass runs after the render pass. Clearing Texture_A early in the frame has no effect on the compute pass. Clearing Texture_A between the render pass and the compute pass shows that the compute pass input has changed. I'll report this to Apple.
Topic: Graphics & Games SubTopic: General Tags:
Mar ’23
Reply to Does Metal on iOS do async compute by default?
Thanks Alecazam. One important thing I didn't mention is that our game uses "untracked" ressources. In this same thread mentioned earlier, the Apple engineer mentions : You must use a fence to sychronize untracked resource across command buffers from the same queue. So if command buffer 1 writes to an untracked texture and later excute command buffer 2 which reads from it, you need a fence That is a little confusing. Apple's documentation states that the scope of a fence is limited to a single command buffer: An MTLFence synchronizes access to one or more resources across different passes within a command buffer. Use fences to specify any inter-pass resource dependencies within the same command buffer. I made a request to Apple to add a note in the documentation about that. Adding a fence fixed all the flickering on our side.
Topic: Graphics & Games SubTopic: General Tags:
Mar ’23
Reply to dispatch_async_f does not return immediatly
Hi, @Apple Graphics The queue is serial type. The code calling dispatch_async_f does not run on the same queue. It's running on a separate worker thread. I used CACurrentMediaTime() to measure duration of dispatch_async_f. Duration still increases progressively from almost instant to 3ms while rendering a static scene for 2mins. @endecotp Yes the functions I enqueue do run. If i pause randomly, I land in this dispatch_async_f 50% of the times. Call statck shows dispatch_async_f()->dispatch_async_f_slow()->ulockWait(). Thanks
Replies
Boosts
Views
Activity
Oct ’22
Reply to dispatch_async_f does not return immediatly
@endcopt I made i mistake. The actual callstack is dispatch_async_f()->dispatch_async_f_slow()->gcd_queue_item_enqueue_hook
Replies
Boosts
Views
Activity
Oct ’22
Reply to dispatch_async_f does not return immediatly
Thanks @eskimo! That fixed the issue. Is the game doing something wrong to cause this?
Replies
Boosts
Views
Activity
Oct ’22
Reply to Metal object is being destroyed while required by command buffer
Retain and then release the drawable in a handler fixed the issue. Thank you so much! Are you creating command buffers with -[MTLCommandQueue commandBufferWithUnretainedReferences] Yes we do. Does this occur after/during a resize of the window? It occurs at launch. I cannot confirm it happens on a resize. Are you double or triple buffered? Triple.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’22
Reply to Unable to create shader debug session
When I say the "debug button" I mean this one.
Replies
Boosts
Views
Activity
Jan ’23
Reply to Unable to create shader debug session
Found the issue: the "macOS Deployment Target" in the sample project was incorrect. While trying with a different sample I got this error message: [Metal Diagnostics Warning] Application Deployment Target Version (10.12) does not match OS Version (13.1) - diagnostics may be missing debug information Changing the target version to 13 fixed the shader debugger.
Replies
Boosts
Views
Activity
Jan ’23
Reply to What does it mean when there are two rows of shaders in Metal performance graph?
I must add that, in this example, I have 1 draw call per command buffer. Since there is only one command queue, i am expecting each draw to execute one after another.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to Does Metal on iOS do async compute by default?
After some investigation, it looks like this overlap in the graph is a bug in the Metal profiler. Let Texture_A be the output of the render pass (1) and the input of the compute pass (2). Playing with the content of Texture_A confirms that the compute pass runs after the render pass. Clearing Texture_A early in the frame has no effect on the compute pass. Clearing Texture_A between the render pass and the compute pass shows that the compute pass input has changed. I'll report this to Apple.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to Does Metal on iOS do async compute by default?
Thanks Alecazam. One important thing I didn't mention is that our game uses "untracked" ressources. In this same thread mentioned earlier, the Apple engineer mentions : You must use a fence to sychronize untracked resource across command buffers from the same queue. So if command buffer 1 writes to an untracked texture and later excute command buffer 2 which reads from it, you need a fence That is a little confusing. Apple's documentation states that the scope of a fence is limited to a single command buffer: An MTLFence synchronizes access to one or more resources across different passes within a command buffer. Use fences to specify any inter-pass resource dependencies within the same command buffer. I made a request to Apple to add a note in the documentation about that. Adding a fence fixed all the flickering on our side.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to Current EDR headroom does not increase when lowering iPhone brightness.
Right. I think what this bar chart explanation misses is: for iOS, when brightness is lowered, the peak luminance is also capped to keep headroom concistent.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to How to use imageblock_slice
After some try and fail: img_block.slice(0) 0 because i am reading from color attachment 0;
Topic: Graphics & Games SubTopic: Metal Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Tile Shaders performance when writing to tile texture vs. resolve texture
Sure! I created a feedback ticket and attached Code sample and Metal captures. FB16427191
Topic: Graphics & Games SubTopic: Metal Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to Tile Shaders performance when writing to tile texture vs. resolve texture
Regarding this, an Apple Engineer in charge of our product reached out to me. He pointed out that writing to the UAV disables lossless compression and causes the slow down. Thank you for taking the time to answer.
Topic: Graphics & Games SubTopic: Metal Tags:
Replies
Boosts
Views
Activity
Feb ’25