Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mechanism to trigger GPU capture without attaching a debugger. #2241

Merged
merged 1 commit into from
May 31, 2024

Conversation

js6i
Copy link
Collaborator

@js6i js6i commented May 28, 2024

Occasionally I want to capture a single GPU frame but have trouble attaching Xcode. I hacked in something of this sort several times already, so here it is cleaned up.

Copy link
Contributor

@billhollings billhollings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting approach. Thanks for submitting.

A few nitpick changes requested. And need to deal with the deprecation warning.

MoltenVK/MoltenVK/GPUObjects/MVKDevice.h Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKDevice.h Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/API/mvk_private_api.h Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKQueue.mm Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm Outdated Show resolved Hide resolved
if (getMVKConfig().autoGPUCaptureScope == MVK_CONFIG_AUTO_GPU_CAPTURE_SCOPE_ON_DEMAND) {
char pipeName[] = "/tmp/MoltenVKCapturePipe-XXXXXXXXXX";
mktemp(pipeName);
if (mkfifo(pipeName, 0600) < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If errno contains EEXIST, that means there was a collision and you should probably try this again with a new filename.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a little defensive to me, but fine.

@js6i js6i force-pushed the gpu-capture-pipe branch 2 times, most recently from 21c83b6 to 84c0ef3 Compare May 30, 2024 13:18
When MVK_CONFIG_AUTO_GPU_CAPTURE_SCOPE_ON_DEMAND is set, we will create a
temporary named pipe, and try reading it on each present. When data is written
to the pipe, for each byte that we read we will capture a single frame.
Copy link
Contributor

@billhollings billhollings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making changes. LGTM now.

There's some documentation still to be done in MoltenVK_Configuration_Parameters.md, but I'll take care of that, because I think I need to rethink how that is laid out, and the reference to Xcode.

@billhollings billhollings merged commit 72b42c1 into KhronosGroup:main May 31, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants