metal-frame-capture: Add screenshot to assets

TSR Berry 2024-03-16 19:52:24 +01:00
parent 5811eade37
commit 11dee22361
No known key found for this signature in database
GPG Key ID: 52353C0A4CCA15E2
2 changed files with 4 additions and 5 deletions

@ -2,15 +2,14 @@
Below is the method that I have found to produce reliable Metal GPU frame captures of Switch titles in Ryujinx, using Xcode and the lldb debugger. The first draft of this guide will be "quick and dirty;" hopefully, it will be updated continuously so it eventually conforms to best practices, insofar as such a thing can be said to exist in this situation.
<img width="1840" alt="ryufcap" src="https://gist.github.com/assets/6864788/6a364ca9-2505-48cb-ae26-8c2f8f24d867">
<img width="1840" alt="metal-frame-capture" src="Developer-Guides/assets/metal-frame-capture.png">
### External Build System Project in Xcode
Xcode seems to be more willing to harness an application properly if it's nominally in charge of the entire build process, even if the application isn't using a familiar C-family build toolchain. So we will add Ryujinx as an "External Build System" project, with `dotnet`, our favorite external build system.
1. Clone the Ryujinx github repository as normal: ```git clone https://github.com/Ryujinx/Ryujinx```
2. In Xcode, create a New Project. For the template, navigate to "Other", then search for or select "External Build System". For the "Build Tool", provide the location of your `dotnet` installation. For me, this is `/usr/local/share/dotnet/dotnet`. Create the project in any directory you wish; for convenience, you may want to create a folder in your cloned Ryujinx repository named `macos-xcode` or similar.
2. In Xcode, create a New Project. For the template, navigate to "Other", then search for or select "External Build System". For the "Build Tool", provide the location of your `dotnet` installation. For me, this is `/usr/local/share/dotnet/dotnet`. Create the project in any directory you wish; for convenience, you may want to create a folder in your cloned Ryujinx repository named `macos-xcode` or similar.
3. With your project created, for the build Arguments, substitute `build -c debug src/Ryujinx`. For the directory, browse and pick the base directory for your cloned Ryujinx repository that contains the `Ryujinx.sln` file. Uncheck "Pass build settings in environment."
* *If you have better knowledge of Ryujinx dotnet build arguments, please put whatever here for your preferred Ryujinx build settings. This is just the most minimal way I found to get it building without poring over Ryujinx build scripts.*
4. Optionally, add all project files to the project with "File->Add Files to...", creating folder references and selecting the build target.
@ -33,4 +32,4 @@ With debug MoltenVK in hand, replace the `libMoltenVK.dylib` binary in the `src/
You should now be able to produce frame captures stably within Xcode of Ryujinx titles. To save a capture as a shareable file, use the Export button in the Summary tab. A couple of other notes:
* You will need to tell lldb to ignore `SIGUSR1`; for whatever reason, this pops up everywhere once guest code is loaded. To do so within your current lldb debugger session, just enter ```pro hand -p true -s false SIGUSR1```.
* We did not enter any of the usual "secret sauce" for enabling capture, like adding `Metal Capture Enabled = YES` to the Info.plist file or `MTL_CAPTURE_ENABLE=1` to our environment variables. In my testing, none of these variables actually exposed the option for frame capture in Xcode. Rather, the important determinant in the option being enabled was what we did in Step 7. If you better integrate Ryujinx's build scripts, these other options might come into play more.
* The usual caveats for Ryujinx debugging apply. Mainly, if we aren't using the Hypervisor, we need to use the Software memory mode, or else hit segfaults nearly instantly in guest code.
* The usual caveats for Ryujinx debugging apply. Mainly, if we aren't using the Hypervisor, we need to use the Software memory mode, or else hit segfaults nearly instantly in guest code.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB