Skip to content

Commit

Permalink
MVKCmdWaitEvents: end current encoder before encodeWait
Browse files Browse the repository at this point in the history
The Metal documentation for encodeWaitForEvent method says:

A command buffer can instruct the GPU to wait for an event only between passes,
not within a pass. If a command buffer has an active encoder, finish using the
encoder, call its endEncoding() method, and then call this method before
creating another encoder.

We should obey this rule and call endEncoding when there can be active encoder
around.
  • Loading branch information
dboyan committed Jan 17, 2025
1 parent bd0a550 commit bb66d2a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@

template <size_t N>
void MVKCmdWaitEvents<N>::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->endCurrentMetalEncoding();
for (MVKEvent* mvkEvt : _mvkEvents) {
mvkEvt->encodeWait(cmdEncoder->_mtlCmdBuffer);
}
Expand Down

0 comments on commit bb66d2a

Please sign in to comment.