gfx-rs / wgpu-rs

Rust bindings to wgpu native library
https://wgpu.rs
Mozilla Public License 2.0
1.69k stars 186 forks source link

Remove dead code #870

Closed dhardy closed 3 years ago

dhardy commented 3 years ago

Also, why bother setting the padding bytes to 0?

bors[bot] commented 3 years ago

Build succeeded:

grovesNL commented 3 years ago

@kvark should we expect the padded range to be zeroed already though? If not, could we move this zeroing down to wgpu-core?

kvark commented 3 years ago

@grovesNL in wgpu-core you can't create a mapped buffer that is not rounded to 4 bytes already. So it doesn't have a problem. Only wgpu-rs utils have this issue, since they try to be more flexible than wgpu-core itself.

grovesNL commented 3 years ago

Alright yeah that makes sense to me. In that case though how could we end up with non-zero values in the extra padded range (i.e. the last unpadded_size % 4 bytes)? I thought zeroing it here would be redundant, because it should be zeroed already (in wgpu-core/Gecko)

kvark commented 3 years ago

Indeed, you are right, wgpu-core recently got this functionality. We can remove that code now from utils.

dhardy commented 3 years ago

Already merged or I would adjust this PR. I'll let you fold into another.

But good to know that the zeroing is redundant. :+1: