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

Reset the queue state between each command buffer on queue submit #3593

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ By @teoxoy in [#3534](https://github.com/gfx-rs/wgpu/pull/3534)
- [gles] fix: Set FORCE_POINT_SIZE if it is vertex shader with mesh consist of point list. By @REASY in [3440](https://github.com/gfx-rs/wgpu/pull/3440)
- [gles] fix: enable `WEBGL_debug_renderer_info` before querying unmasked vendor/renderer to avoid crashing on emscripten in [#3519](https://github.com/gfx-rs/wgpu/pull/3519)
- Remove unwraps inside `surface.configure`. By @cwfitzgerald in [#3585](https://github.com/gfx-rs/wgpu/pull/3585)
- Reset all queue state between command buffers in a submit. By @jleibs [#3589](https://github.com/gfx-rs/wgpu/pull/3589)
- Reset the state of `SAMPLE_ALPHA_TO_COVERAGE` on queue reset. By @jleibs [#3589](https://github.com/gfx-rs/wgpu/pull/3589)

#### General

Expand Down
7 changes: 6 additions & 1 deletion wgpu-hal/src/gles/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ impl super::Queue {
unsafe { gl.disable(glow::BLEND) };
unsafe { gl.disable(glow::CULL_FACE) };
unsafe { gl.disable(glow::POLYGON_OFFSET_FILL) };
unsafe { gl.disable(glow::SAMPLE_ALPHA_TO_COVERAGE) };
if self.features.contains(wgt::Features::DEPTH_CLIP_CONTROL) {
unsafe { gl.disable(glow::DEPTH_CLAMP) };
}
Expand Down Expand Up @@ -1522,8 +1523,12 @@ impl crate::Queue<super::Api> for super::Queue {
) -> Result<(), crate::DeviceError> {
let shared = Arc::clone(&self.shared);
let gl = &shared.context.lock();
unsafe { self.reset_state(gl) };
for cmd_buf in command_buffers.iter() {
// The command encoder assumes a default state when encoding the command buffer.
// Always reset the state between command_buffers to reflect this assumption. Do
// this at the beginning of the loop in case something outside of wgpu modified
// this state prior to commit.
unsafe { self.reset_state(gl) };
#[cfg(not(target_arch = "wasm32"))]
if let Some(ref label) = cmd_buf.label {
unsafe { gl.push_debug_group(glow::DEBUG_SOURCE_APPLICATION, DEBUG_ID, label) };
Expand Down