mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
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:
committed by
Corentin Wallez
parent
613eee30c3
commit
f45bdb89c6
@@ -66,8 +66,8 @@ void init() {
|
||||
.GetResult();
|
||||
|
||||
buffer = device.CreateBufferBuilder()
|
||||
.SetAllowedUsage(nxt::BufferUsageBit::Mapped | nxt::BufferUsageBit::Uniform)
|
||||
.SetInitialUsage(nxt::BufferUsageBit::Mapped)
|
||||
.SetAllowedUsage(nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::Uniform)
|
||||
.SetInitialUsage(nxt::BufferUsageBit::MapWrite)
|
||||
.SetSize(sizeof(s))
|
||||
.GetResult();
|
||||
|
||||
@@ -87,7 +87,7 @@ void frame() {
|
||||
s.b += 0.02;
|
||||
if (s.b >= 1.0f) {s.b = 0.0f;}
|
||||
|
||||
buffer.TransitionUsage(nxt::BufferUsageBit::Mapped);
|
||||
buffer.TransitionUsage(nxt::BufferUsageBit::MapWrite);
|
||||
buffer.SetSubData(0, sizeof(s) / sizeof(uint32_t), reinterpret_cast<uint32_t*>(&s));
|
||||
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
|
||||
Reference in New Issue
Block a user