Can't seem to print the contents of a buffer (getting 0 values) #3989
-
Hey all! I've been following various resources (but mostly the wgpu repo's example for compute buffers https://github.com/gfx-rs/wgpu/tree/trunk/examples/hello-compute) to be able to access a buffer's contents. I'm initializing a buffer with the contents of a vector of a single f32 value (12.0 as a random number) and I would expect this value to print out after it's been copied to the contents of the other buffer. All I'm seeing printed out is
Here's my code:
And my cargo.toml if it's helpful
Side note: I've tried running this on my M1 Mac (my primary machine) as well as my PC with a dedicated graphics card, both with the same results. I'm absolutely out of ideas and would appreciate any pointers if you have any for me! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'll leave this up as a cautionary tale for "always double-check your data types"... solved :) |
Beta Was this translation helpful? Give feedback.
I'll leave this up as a cautionary tale for "always double-check your data types"...
As you can see, I was casting this data into a Vec, when my data was actually of type Vec<64>. Because my number was so small and it was only gathering the first few bits of the floating point number, it was printing out 0...
solved :)