Rotartsi
Rotartsi

Reputation: 567

Should I call `vkMapMemory` each time I write to a buffer?

Are there any benefits to using a single vkMapMemory, a memsets for each write, and a single vkUnmapMemory as opposed to using a vkMapMemory, memset, and vkUnmapMemory for each write to a buffer?

Upvotes: 0

Views: 850

Answers (1)

krOoze
krOoze

Reputation: 13246

Yes, it is beneficial to map only once. vkMapMemory likely needs to do some system calls, so it is not free.

Authoritative quote, e.g. https://developer.samsung.com/game/usage#buffermanagement:

Frequent Map/Unmap calls should be avoided.

Upvotes: 4

Related Questions