Closed dhardy closed 3 years ago
This is a part of the upstream issue https://github.com/gpuweb/gpuweb/issues/1498
We don't want to include the buffer size as an exception. We want a solid approach here, where the line between what we include and what we don't is clear.
why are lengths sometimes u32
Yes, buffers can be larger than u32.
Closing because this upstream issue will likely be resolved as is.
In some cases a
wgpu::Buffer
may be re-used, e.g. to upload the next frame's vertices. In such cases it's necessary to check the buffer length and recreate (or partition or ...) if the length is insufficient. Currently it's not really possible to do this (except perhaps viabuffer.slice(..).get_mapped_range().len()
).Solutions:
create_buffer_init
may add padding, though ignoring this is acceptable.Buffer::len
as a wrapper around the aboveu32
?) toBuffer
I think the last option is probably the best choice?
Slightly off-topic question: why are lengths sometimes
u32
(e.g. inRenderPass::draw
) and sometimes 64-bit (e.g.BufferSize
)? Are buffers larger thanu32::MAX
supported?