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

Ensure compute encoding state is marked dirty for non-dispatch commands. #1922

Merged
merged 1 commit into from
May 26, 2023

Conversation

billhollings
Copy link
Contributor

The same compute encoder is used across dispatches and other commands, which may override compute state, and end up breaking subsequent dispatches.

  • Mark compute encoding state dirty when following commands, which use Metal compute encoders, are issued:

    • vkCmdCopyBuffer()
    • vkCmdClearColorImage()
    • vkCmdClearDepthStencilImage()
    • vkCmdFillBuffer()
    • vkCmdCopyQueryPoolResults()
  • MVKCommandEncoder move marking compute state dirty from endCurrentMetalEncoding() to getMTLComputeEncoder().

  • For efficiency, don't prematurely force end of query copy compute encoder used on renderpass end, in case compute dispatches follow.

  • Update MoltenVK to 1.2.5 (unrelated).

Fixes issue #1874

The same compute encoder is used across dispatches and other commands,
which may override compute state, and end up breaking subsequent dispatches.

- Mark compute encoding state dirty when following commands,
  which use Metal compute encoders, are issued:
  - vkCmdCopyBuffer()
  - vkCmdClearColorImage()
  - vkCmdClearDepthStencilImage()
  - vkCmdFillBuffer()
  - vkCmdCopyQueryPoolResults()

- MVKCommandEncoder move marking compute state dirty from
  endCurrentMetalEncoding() to getMTLComputeEncoder().
- For efficiency, don't prematurely force end of query copy compute encoder
  used on renderpass end, in case compute dispatches follow.

- Update MoltenVK to 1.2.5 (unrelated).
@billhollings billhollings merged commit 2a4e415 into KhronosGroup:main May 26, 2023
6 checks passed
@billhollings billhollings deleted the fix-comp-enc-state branch May 26, 2023 12:21
mbechard added a commit to mbechard/MoltenVK that referenced this pull request Jul 19, 2023
Needed to complete fix for KhronosGroup#1874

We can't wait until getMTLComputeEncoder() is called to dirty the state,
because this call will be avoided by dirty checks themselves.
Those checks are comparing against leftover and now incorrect state since
the previous encoder has already ended.
It needs to be dirtied on encoder end.
mbechard added a commit to mbechard/MoltenVK that referenced this pull request Jul 19, 2023
Needed to complete fix for KhronosGroup#1874

We can't wait until getMTLComputeEncoder() is called to dirty the state,
because this call will be avoided by dirty checks themselves.
Those checks are comparing against leftover and now incorrect state since
the previous encoder has already ended.
It needs to be dirtied on encoder end.
billhollings added a commit that referenced this pull request Jul 19, 2023
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.

None yet

2 participants