Asking questions here or on Matrix are both appropriate. Both are meant to be places where you can ask about using the API. It may take us some time to reply, so we appreciate your patience :)
We certainly do hope for Dawn to provide a good, stable C API. We're actively working on this, and it will eventually become stable, but we're not quite there yet. You can follow progress at
https://github.com/webgpu-native/webgpu-headers. The goal is that you'll be able to write applications in C or in other high level languages like C++/Go/Kotlin/Rust made with bindings on top of the C API - and that you'll then be able easily port those native applications to the Web using a toolchain like Emscripten. We
do intend for Dawn in native to be a use case, and we
do intend to support it. The approach is not at all novel; there are many individuals (and companies!) who are using Dawn in C/C++ or wgpu in Rust to successfully build native apps that also can be ported to the web.
Regarding the original question:
My interpretation is that you're using a buffer in a command buffer, then dropping it and making a new one; repeat. This should be valid. It would be helpful if you could use SetLabel to label your objects, and share specifically the error messages you're seeing.
// You have some buffer
wgpu::Buffer vertex_buffer = ...;
void Frame(wgpu::Device device, wgpu::Buffer& vertex_buffer) {
// You use the buffer in a command buffer that is submitted wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(...);
pass.SetVertexBuffer(0, vertex_buffer, ...);
...
pass.DrawIndexed(...);
...
pass.End();
wgpu::CommandBuffer commandBuffer = encoder.Finish();
device.GetQueue().Submit(1, &commandBuffer);
// You destroy the buffer, and make a new one.
vertex_buffer.Destroy();
vertex_buffer = device.CreateBuffer({ ... });
} The ordering of what really matters are the parts in bold.
If you destroy the buffer before submit, then you will get a validation error.
If you destroy the buffer after submit, then the submission should be valid, and the buffer will be considered destroyed for all future uses on the queue.
I'm not sure about the part where you said "GPU will point to memory that’s either not there anymore or filled in with rubbish", and I'm not sure about how your comments about buffer mapping tie into your use case. Any clarification would be helpful, or if you could even share a reduced test case, we could help more.
Some guesses: