Skip to content
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

Create gles buffers with DYNAMIC_DRAW instead of STATIC_DRAW #3391

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

Dinnerbone
Copy link
Contributor

@Dinnerbone Dinnerbone commented Jan 17, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
This fixes #3371.

Description
wgpu currently creates buffers with STATIC_DRAW, but it actually updates the buffer once after creation to copy in the data from a staging buffer.
Some vendors take this usage hint literally, and freeze the buffer at the data it was created with - leaving it empty and unusable.

In an ideal world we'd be able to populate the data here in the constructor and keep it STATIC_DRAW for all but BufferUsage::COPY_DST, perhaps using a specialized path from create_buffer_init, but we don't live in that ideal world right now and have to pay the penalty of DYNAMIC_DRAW.

Testing
It passes all of the existing tests, and is confirmed to fix #3371 on affected devices.

@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2023

Codecov Report

Merging #3391 (2265209) into master (48fbb92) will increase coverage by 0.51%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3391      +/-   ##
==========================================
+ Coverage   64.70%   65.22%   +0.51%     
==========================================
  Files          66       86      +20     
  Lines       37336    42725    +5389     
==========================================
+ Hits        24159    27868    +3709     
- Misses      13177    14857    +1680     
Impacted Files Coverage Δ
wgpu-hal/src/gles/device.rs 81.40% <ø> (+1.32%) ⬆️
wgpu-core/src/hub.rs 61.13% <0.00%> (-3.45%) ⬇️
wgpu-core/src/instance.rs 65.67% <0.00%> (-2.04%) ⬇️
wgpu/src/lib.rs 51.06% <0.00%> (-0.28%) ⬇️
wgpu-core/src/device/queue.rs 70.17% <0.00%> (-0.02%) ⬇️
wgpu-hal/src/dx11/device.rs 0.00% <0.00%> (ø)
wgpu-hal/src/dx12/suballocation.rs 85.92% <0.00%> (ø)
wgpu-hal/src/dx12/mod.rs 27.27% <0.00%> (ø)
wgpu-hal/src/auxil/dxgi/result.rs 73.07% <0.00%> (ø)
wgpu-hal/src/dx12/view.rs 59.03% <0.00%> (ø)
... and 29 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@nical nical merged commit 0705c7a into gfx-rs:master Jan 17, 2023
@cwfitzgerald
Copy link
Member

Very nicely done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uniform buffers are all zeros on Intel ipgus on WebGL backend
4 participants