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

WIP: MVKCommandBuffer: Optimize management of command storage. #1678

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on Dec 13, 2022

  1. 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.
    js6i authored and Jan Sikorski committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    e7eb5f4 View commit details
    Browse the repository at this point in the history
  2. MVKCmdRenderPass: Removed MVKCmdBeginRenderPassBase.

    js6i authored and Jan Sikorski committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    5556f89 View commit details
    Browse the repository at this point in the history
  3. MVKCommandBuffer: Add destroyOnReset() wrapper method. Explain.

    js6i authored and Jan Sikorski committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    4bc8192 View commit details
    Browse the repository at this point in the history
  4. MVKCommandPool: Release unused command buffers in trim().

    js6i authored and Jan Sikorski committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    1ba86d9 View commit details
    Browse the repository at this point in the history