3Shain / dxmt

Metal-based implementation of D3D11 for MacOS / Wine
MIT License
345 stars 12 forks source link

Improve USAGE_DEFAULT constant buffer update performance via renaming #32

Closed 3Shain closed 1 month ago

3Shain commented 1 month ago

Certain UE4 games create constant buffer of D3D11_USAGE_DEFAULT and update the full content via UpdateSubresource frequently (before every draw call). Albeit I don't understand why they don't use dynamic buffer and map/unmap with MAP_WRITE_DISCARD flag, probably it's an optimized path for the red/green factory. However this introduces a huge performance impact on our current implementation: a render encoder is forced to be cut in the middle point multiple times to insert blit commands in between, thus a lot of unnecessary attachments load/store occur.

The absurd dependency graph:

Screenshot 2024-10-05 at 21 18 11