Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Allow Xcode to profile macOS standalone build (generate a project or otherwise)

Discussion in '2019.1 Beta' started by bitinn, Dec 20, 2018.

  1. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Hi,

    I spent the last a few days looking for information about how to use Xcode frame capture and shader profiler with a Unity standalone build for macOS, and come to the belief it's simply not possible today.

    - Xcode require a project to exist in order to capture the build.
    - Unity doesn't generate a project explicitly for macOS standalone build (unlike its iOS build).

    But Unity must have generated something that link the macOS build to Xcode (as it requires Xcode tool to build), so can Unity create a Xcode project for macOS build too?

    Without it, I am not seeing a way to examine shader performance metrics like ALU on macOS platform.

    (I do use Intel GPA and it's powerful, but I don't see it offering the same metrics like Xcode shader profiler. AFAIK Intel GPA and Xcode are the only tools we got to analyze macOS Metal API frames, there are no other options available)

    Thx!
     
    Last edited: Dec 20, 2018
  2. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Last edited: Mar 20, 2019
  3. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Allow me to dig out this old post and ask one more question:

    - Has anyone been able to use Xcode to profile a Unity macOS build's GPU frame performance?

    - I was able to capture and analyze the shader code and instructions count, but never GPU frame stats, like how long a draw call spent in this frame?

    Xcode GPU capture isn't quite the full replacement Unity doc claim to be, at least for macOS Build.

    (The whole reasons is because Unity on macOS doesn't support Metal GPU profiling.)
     
  4. SteveM_Unity

    SteveM_Unity

    Unity Technologies

    Joined:
    Nov 21, 2017
    Posts:
    41
    I was involved in a conversation recently about how to profile GPU for standalone Mac builds. This was what we came up with:

    Create a new empty XCode project. Add a new Scheme to it and then select the executable you want it to launch. I was able to launch an existing Standalone build from that. If you don’t see the FPS counter on the left-hand side of the screen after clicking the “Show the Debug Navigator” button at the top of the left column, you may need to play with the Scheme a bit. Go to Product > Scheme > Edit Scheme… > Options and monkey around with the settings for GPU Frame Capture and Metal API Validation and restart the game to see if the counter appears. I never worked out any particular pattern of options that makes the FPS counter appear, but one of them will
     
  5. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Hi Steve, thx, however, I should clarify, I do know how to view the FPS counter in Xcode (figured it out last December).

    Screen Shot 2019-03-21 at 23.23.12.png

    I am asking specifically about the performance metrics and pipeline activity when you are in GPU frame capture mode. Which should appear when you click on the performance section of a draw call. They are outline here (see the number 4.27us next to the draw call):


    Apple Doc: https://developer.apple.com/documen...viewing_performance_metrics_with_gpu_counters

    I also asked Apple's Xcode Metal Debugger lead on this, no response so far, unfortunately (you can see my capture doesn't show performance metrics, in neither Mono build nor IL2CPP build):



    ref: https://twitter.com/bitinn/status/1108331058490040320

    I should note that other metrics such as pipeline stats works fine, so I suspect something is missing from Unity's macOS Build that cause Xcode to not be able to collect performance metrics.

    Screen Shot 2019-03-21 at 23.28.55.png

    If you know a way, please let me know!
     
    Last edited: Mar 21, 2019