-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
Hello, I'm having trouble with buffer mapping. I'm trying to understand buffer mapping by testing the different options available but when I try to use waitAny to wait for the Future to get a result, the program panics and it tells me that it's not implemented.
I'm using Elie Michel's C++ wrapper, I generate a webgpu.hpp header from their generate.py script and I'm compiling with MSVC. I am using wgpu-native v25.0.2.1.
Here's the whole program output :
<wgpu::Instance 00000200A7FAA0D0>
<wgpu::Adapter 00000200A837CFD0>
<wgpu::Device 00000200A82EBB00>
<wgpu::Queue 00000200A83813B0>
<wgpu::Buffer 00000200A82ED600>
<wgpu::Buffer 00000200A82ECD00>
<wgpu::CommandEncoder 00000200A82ECD40>
thread '<unnamed>' panicked at src\unimplemented.rs:230:5:
not implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at library\core\src\panicking.rs:218:5:
panic in a function that cannot unwind
stack backtrace:
0: 0x7ff71727fbf2 - <unknown>
1: 0x7ff717258a0b - <unknown>
2: 0x7ff71727df97 - <unknown>
3: 0x7ff71727fa35 - <unknown>
4: 0x7ff7172813ac - <unknown>
5: 0x7ff717281142 - <unknown>
6: 0x7ff717281f8f - <unknown>
7: 0x7ff717281cf2 - <unknown>
8: 0x7ff7172802ff - <unknown>
9: 0x7ff71728192e - <unknown>
10: 0x7ff717606ad5 - <unknown>
11: 0x7ff717606b83 - <unknown>
12: 0x7ff717606c01 - <unknown>
13: 0x7ff717606933 - <unknown>
14: 0x7fff1a410430 - _CxxFrameHandler3
15: 0x7fff1a40342d - is_exception_typeof
16: 0x7fff3e2c6006 - RtlCaptureContext2
17: 0x7ff71760691a - <unknown>
18: 0x7ff7176053ba - <unknown>
19: 0x7ff7176057e0 - <unknown>
20: 0x7fff3d6ae8d7 - BaseThreadInitThunk
21: 0x7fff3e1dc34c - RtlUserThreadStart
thread caused non-unwinding panic. aborting.
Here's the thing I was trying :
struct OnBufferMappedContext {
bool operationEnded = false;
bool mappingSucceeded = false;
};
auto OnBufferMapped = [](WGPUMapAsyncStatus status, WGPUStringView message) {
//OnBufferMappedContext& context = *reinterpret_cast<OnBufferMappedContext*>(userdata1);
//context.operationEnded = true;
if (status == WGPUMapAsyncStatus_Success) {
std::cout << "Buffer mapped" << std::endl;
//context.mappingSucceeded = true;
}
else {
std::cerr << "Could not map buffer: " << status << std::endl;
std::cerr << message.data << std::endl;
}
};
OnBufferMappedContext mapContext {};
wgpu::Future bufferMapFuture = buffer2.mapAsync(wgpu::MapMode::Read, 0, 16 * sizeof(float), wgpu::CallbackMode::AllowProcessEvents, OnBufferMapped);
wgpu::FutureWaitInfo bufferMapFutureInfo {};
bufferMapFutureInfo.future = bufferMapFuture;
wgpu::WaitStatus status = instance.waitAny(1, &bufferMapFutureInfo, 200 * 1000);
while (!bufferMapFutureInfo.completed) {
//std::cout << "Waiting..." << std::endl;
}
buffer2.unmap();Did I do something wrong ? Thanks you kindly for your help.
ajvp
Metadata
Metadata
Assignees
Labels
No labels