-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MVKCommandBuffer: Optimize management of command storage.
The main motivation behind this commit is to reduce the time needed to free or reset a command buffer. With the current scheme, we need to loop over all recorded commands and return them to their pools. This can take a significant amount of time in games, of the order of a millisecond. With this change, instead of pooling individual commands by their type, we instead keep chunks of memory in each command buffer, from which we bump allocate memory for the commands to be recorded. MVKCommandVector is introduced to use the same memory pool for dynamic arrays of data associated with the commands. Pointers to commands that actually have non-trivial destructors (i.e. they keep references to other objects) are stored separately, so that we can call their destructors when reseting the command buffer. All the memory simply gets discarded by setting the current chunk's index and offset to zero. As a side note, specific applications might opt to not retain pipeline layouts in bind/push descriptor commands (introduced by 30113fc) if it's known not to be needed, to further reduce time spent resetting command buffers.
- Loading branch information
Showing
21 changed files
with
345 additions
and
866 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.