-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading mapped buffer data yields zeros when the data is written using the mapping API #305
Comments
Addition: the same problem occurs when:
|
Yes, that's to be expected. You should not write into a buffer mapping
|
I'm confused.
Why? This seems to me like a legit way to work with a buffer. I feel like I am missing something 🤔 |
Sorry, I intended to write without and not with: You should not write into a buffer mapping without the WRITE bit set.
Sorry again my brain was locked on something else, I misread your post and answered too quickly.
|
What about when using |
It seems that today is one of those days where I should have slept more and not engaged with the outside world because my output's full of nonsense. I guess what should happen in your original example (although take it with a grain of salt I still need sleep) , is that mapping the buffer again should not be possible until the device has been polled (typically after submission). I don't know how the map API is implemented in your python example, but in Rust I would expect that It would help to write a test in rust and debug what is happening under the hood. |
😆 one of those days, eh ...
edited: I did try adding calls to Anyway ... I think its best if I demonstrate the issue with an example in C or Rust that can easily be reproduced here. |
To reproduce:
mapped_at_creation=True
and the MAP_READ flag.wgpuBufferGetMappedRange
to get mapped memory and write data to it.wgpuBufferGetMappedRange
to get mapped memory and read data from it.If I submit an empty command buffer to the queue between unmap and mapping it again, it does work. So it looks like the written data is not actually submitted yet.
Here's some Python code illustrating the same. It uses an uncommitted version of wgpu-py (I'm working on the buffer mapping API), so consider this pseudo-code to help illustrate the issue.
My questions are:
Is this expected behavior (from the POV of the WebGPU spec) or something we should fix?
If the intent is to fix it, where should this happen, here or wgpu-core?
The text was updated successfully, but these errors were encountered: