Skip to content

Conversation

@squidbus
Copy link
Contributor

@squidbus squidbus commented Aug 4, 2025

Implements timestamp query pools for Metal using counter sample buffers.

  • If an encoder is active and the required sampling point is supported for sampling in the current encoder, just encode a sampleCountersInBuffer in the active encoder.
  • If an encoder is not active, or sampling the current encoder is not supported, and blit sampling is supported, use a new blit encoder to encode a sampleCountersInBuffer.
  • In all other cases, end the current active encoder and use a temporary blit encoder to wait for a fence and perform stage-boundary sampling.

I've checked this with UnleashedRecomp and both the dependency graph and timestamps look similar to what I get from MoltenVK on an Apple GPU.

EDIT: Fixes #8.

@squidbus squidbus requested review from DarioSamo and dcvz and removed request for DarioSamo August 4, 2025 11:45
@squidbus squidbus force-pushed the mtl-query-pool branch 3 times, most recently from ce41069 to c91f3c1 Compare August 5, 2025 00:59
@squidbus
Copy link
Contributor Author

squidbus commented Aug 5, 2025

Rebased on latest main.

@DarioSamo DarioSamo requested a review from dcvz August 5, 2025 02:22
@DarioSamo
Copy link
Contributor

Gonna wait on an approval from @dcvz to make sure this works as intended first.

@DarioSamo
Copy link
Contributor

Needs a rebase.

@squidbus
Copy link
Contributor Author

squidbus commented Aug 6, 2025

Rebased

@DarioSamo DarioSamo self-requested a review August 6, 2025 17:24
@DarioSamo DarioSamo merged commit fbc36e9 into renderbag:main Aug 7, 2025
10 checks passed
@squidbus squidbus deleted the mtl-query-pool branch August 7, 2025 22:19
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.

Implement query pools on Metal.

3 participants