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

Return mapped buffer pointer directly for flush, WriteableRegion for textures #2494

Merged
merged 6 commits into from Jul 19, 2021

Commits on Jul 18, 2021

  1. Return mapped buffer pointer directly for flush, WriteableRegion for …

    …textures
    
    A few changes here to generally improve performance, even for platforms not using the persistent buffer flush.
    
    - Texture and buffer flush now return a ReadOnlySpan<byte>. It's guaranteed that this span is pinned in memory, but it will be overwritten on the next flush from that thread, so it is expected that the data is used before calling again.
    - As a result, persistent mappings no longer copy to a new array - rather the persistent map is returned directly as a Span<>. A similar host array is used for the glGet flushes instead of allocating new arrays each time.
    - Texture flushes now do their layout conversion into a WriteableRegion when the texture is not MultiRange, which allows the flush to happen directly into guest memory rather than into a temporary span, then copied over. This avoids another copy when doing layout conversion.
    
    Overall, this saves 1 data copy for buffer flush, 1 copy for linear textures with matching source/target stride, and 2 copies for block textures or linear textures with mismatching strides.
    riperiperi committed Jul 18, 2021
    Copy the full SHA
    51c894d View commit details
    Browse the repository at this point in the history
  2. Fix tests

    riperiperi committed Jul 18, 2021
    Copy the full SHA
    8b49593 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    597bbd8 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    470e0c3 View commit details
    Browse the repository at this point in the history
  5. Address some feedback

    riperiperi committed Jul 18, 2021
    Copy the full SHA
    b4aa65a View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    efb0292 View commit details
    Browse the repository at this point in the history