/** * Helper to create a buffer. * * \param[in] data pointer to the start of the raw data * \param[in] size number of bytes in \a data * \param[in] usage type of buffer */ private static IntPtr CreateBuffer(void *data, ulong size, WGPUBufferUsage usage) { WGPUBufferDescriptor desc = new WGPUBufferDescriptor { usage = WGPUBufferUsage.WGPUBufferUsage_CopyDst | usage, size = size }; IntPtr buffer = WebGPUNative.wgpuDeviceCreateBuffer(Device, ref desc); WebGPUNative.wgpuQueueWriteBuffer(Queue, buffer, 0, data, size); return(buffer); }