Split Mapped usage in MapWrite and MapRead

Also make use of CreateFrozenBufferFromData where possible in the
example to make the renaming easier.
This commit is contained in:
Corentin Wallez
2017-06-05 15:42:14 -04:00
committed by Corentin Wallez
parent 613eee30c3
commit f45bdb89c6
13 changed files with 35 additions and 138 deletions

View File

@@ -262,8 +262,8 @@ void CreateDefaultRenderPass(const nxt::Device& device, nxt::RenderPass* renderP
nxt::Buffer CreateFrozenBufferFromData(const nxt::Device& device, const void* data, uint32_t size, nxt::BufferUsageBit usage) {
nxt::Buffer buffer = device.CreateBufferBuilder()
.SetAllowedUsage(nxt::BufferUsageBit::Mapped | usage)
.SetInitialUsage(nxt::BufferUsageBit::Mapped)
.SetAllowedUsage(nxt::BufferUsageBit::MapWrite | usage)
.SetInitialUsage(nxt::BufferUsageBit::MapWrite)
.SetSize(size)
.GetResult();
buffer.SetSubData(0, size / sizeof(uint32_t), reinterpret_cast<const uint32_t*>(data));