Post

Replies

Boosts

Views

Activity

"xcrun metal" vs. "MTLDevice::newLibraryWithSource()" compile options
Hi, when compiling shaders, metal command line tool has more options than MTLDevice::newLibraryWithSource(). For instance, "man metal" mentions 10 levels of optimization (-O0, -O1, -O2, -O3, -Ofast, -Os ...) while MTLCompileOptions doc only shows 2 levels (Default, Size). Is there a way to pass -O2 as optimization level to MTLDevice::newLibraryWithSource()? Thanks
1
0
377
Jan ’24
Current EDR headroom does not increase when lowering iPhone brightness.
I am using an iPhone 13 Pro. It has an HDR display with potential EDR headroom of 8. I measured the following: Phone brightness: from 0 to 60% --> EDR Headroom = 8 Phone brightness: from 60 to 100% --> EDR Headroom ranges from 8 to 2.2 Why does currentEDRHeadroom remain constant when decreasing the iPhone screen brightness from 60% to the minimum? Shouldn't both value decrease continuously?
2
0
1k
May ’23
Does Metal on iOS do async compute by default?
Hi, Let's assume I commit 2 CommandBuffers to the same CommandQueue: The 1st buffer contains a render pass The 2nd buffer contains a compute pass. I used enqueue() to make sure the buffers would run in that order. Will the GPU wait for the end of the render pass (1) before to run the compute pass (2)? Or will it run them concurrently? I am asking because while porting our game to iOS we ran into flickering artefacts. We took a capture and it seems 2 passes with dependencies are running concurently (see screenshot). Yet, they belong to separate command buffers. Do I need to add MTLEvent to prevent this from happening? I thought there was no need for dependency tracking between command buffers running on the same queue. Thank you for your help.
4
0
943
Mar ’23
What does it mean when there are two rows of shaders in Metal performance graph?
Hi, does someone know what it means when there are two rows of fragments shaders in the performance graph of the Metal debugger? This capture was taken on an iPhone 13 Pro. In the section highlighted in red, it looks like there are two command queues rendering stuff in parallel. But I am positive I only create one. When I unfold the fragment shader row, i can see the details of shaders invokations and they seem sequentials. So I am confused. Are the shaders running sequentially or concurrently? Thank you!
2
0
480
Mar ’23
Unable to create shader debug session
"Source is unavailble" I want to test Metal shader debugger. I downloaded this sample code from Apple: https://developer.apple.com/documentation/metal/compute_passes/processing_a_texture_in_a_compute_function?language=objc In the project build settings, "Metal compiler - Build Options" -> "Produce Debugging Information", I set the value to "Yes, include source code". Then run and take a capture. In the Metal debugger, when I hit the debug button on the draw call, i get an error "Source is unavailable". Clicking the "import source" button in the dialog doesn't solve the issue. What am i doing wrong? My workstation: Mac mini M1 2020, Mac OS Ventura 13.1, XCode 14.1 (14B47b)
3
0
1.2k
Jan ’23
Metal object is being destroyed while required by command buffer
Hi, I work on a app with Metal-cpp rendering. The app does not use an MTKView. Instead, it requests a drawable from the MetalLayer and renders to the drawable's texture. When calling [CAMetalLayer nextDrawable] i sometime get this error: -[MTLDebugDevice notifyExternalReferencesNonZeroOnDealloc:]:2885: failed assertion `The following Metal object is being destroyed while still required to be alive by the command buffer 0x142944a00 (label: <no label set>): <MTLToolsObject: 0x16e22b0a0> -> <AGXG13GFamilyTexture: 0x16e232a80> label = CAMetalLayer Display Drawable textureType = MTLTextureType2D The call stack shows that nextDrawable tries to delete some textures. 1- I am confused by this message. Can someone confirm which object "is being destroyed"? The AGXG13GFamilyTexture or the MTLToolsObject? 2- I did a memory graph but i see no direct or indirect link between the texture and the command buffer. How can I find who is preventing the object from being destroyed? My workstation: M1 Mac mini, MacOS Ventura 13.0.1, XCode 14.1
2
0
1.5k
Dec ’22
dispatch_async_f does not return immediatly
Hi, I work on a game for iOS and the framerate decreases progressively when the debugger is attached. Running it for 2mins, it went from 30 to 1 FPS while rendering a simple static scene. I narrowed it down to a call to dispatch_async_f which takes longer to execute over time. clock_t t1 = clock(); dispatch_async_f(queue, context, function); clock_t t2 = clock(); double duration = (double)(t2 -t1)/(double)CLOCKS_PER_SEC; Dodumentation says dispatch_async_f is supposed to return immediatly. So what could explain duration to increases in debug? Am i measuring this incorrectly? The game is written in mixed C++ and ObjC. It uses Metal as graphic API and GCD for dispatching jobs. I have Xcode 13.4.1 and test on an iPhone 13 Pro with iOS 15.7. Thanks.
7
0
1.8k
Oct ’22