Reset the queue state between each command buffer on queue submit (#3589)

This commit is contained in:
Jeremy Leibs 2023-03-22 20:08:53 +01:00 committed by GitHub
parent ca9341b988
commit 63ede074d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -43,6 +43,13 @@ Bottom level categories:
#### GLES #### GLES
- Fix `Vertex buffer is not big enough for the draw call.` for ANGLE/Web when rendering with instance attributes on a single instance. By @wumpf in [#3596](https://github.com/gfx-rs/wgpu/pull/3596) - Fix `Vertex buffer is not big enough for the draw call.` for ANGLE/Web when rendering with instance attributes on a single instance. By @wumpf in [#3596](https://github.com/gfx-rs/wgpu/pull/3596)
### Bug Fixes
#### GLES
- 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)
## wgpu-0.15.2 (2023-03-08) ## wgpu-0.15.2 (2023-03-08)
### Bug Fixes ### Bug Fixes

View File

@ -70,6 +70,7 @@ impl super::Queue {
unsafe { gl.disable(glow::BLEND) }; unsafe { gl.disable(glow::BLEND) };
unsafe { gl.disable(glow::CULL_FACE) }; unsafe { gl.disable(glow::CULL_FACE) };
unsafe { gl.disable(glow::POLYGON_OFFSET_FILL) }; unsafe { gl.disable(glow::POLYGON_OFFSET_FILL) };
unsafe { gl.disable(glow::SAMPLE_ALPHA_TO_COVERAGE) };
if self.features.contains(wgt::Features::DEPTH_CLIP_CONTROL) { if self.features.contains(wgt::Features::DEPTH_CLIP_CONTROL) {
unsafe { gl.disable(glow::DEPTH_CLAMP) }; unsafe { gl.disable(glow::DEPTH_CLAMP) };
} }
@ -1464,8 +1465,12 @@ impl crate::Queue<super::Api> for super::Queue {
) -> Result<(), crate::DeviceError> { ) -> Result<(), crate::DeviceError> {
let shared = Arc::clone(&self.shared); let shared = Arc::clone(&self.shared);
let gl = &shared.context.lock(); let gl = &shared.context.lock();
unsafe { self.reset_state(gl) };
for cmd_buf in command_buffers.iter() { 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"))] #[cfg(not(target_arch = "wasm32"))]
if let Some(ref label) = cmd_buf.label { if let Some(ref label) = cmd_buf.label {
unsafe { gl.push_debug_group(glow::DEBUG_SOURCE_APPLICATION, DEBUG_ID, label) }; unsafe { gl.push_debug_group(glow::DEBUG_SOURCE_APPLICATION, DEBUG_ID, label) };