Skip to content

Commit

Permalink
Fix webgl srgb blit not setting the viewport correctly (#3093)
Browse files Browse the repository at this point in the history
* Fix webgl srgb blit not setting the viewport correctly

* Add changelog notes
  • Loading branch information
Wumpf authored Oct 11, 2022
1 parent eca04f5 commit 351ca3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Bottom level categories:

#### GLES

- Surfaces support now `TextureFormat::Rgba8Unorm` and (non-web only) `TextureFormat::Bgra8Unorm`
- Surfaces support now `TextureFormat::Rgba8Unorm` and (non-web only) `TextureFormat::Bgra8Unorm`. By @Wumpf in [#3070](https://github.com/gfx-rs/wgpu/pull/3070)

### Bug Fixes

Expand All @@ -69,6 +69,10 @@ Bottom level categories:
#### WebGPU
- Use `log` instead of `println` in hello example by @JolifantoBambla in [#2858](https://github.com/gfx-rs/wgpu/pull/2858)

#### GLES

- Fixed WebGL not displaying srgb targets correctly if a non-screen filling viewport was previously set. By @Wumpf in [#3093](https://github.com/gfx-rs/wgpu/pull/3093)

### Examples
- Log adapter info in hello example on wasm target by @JolifantoBambla in [#2858](https://github.com/gfx-rs/wgpu/pull/2858)

Expand Down
7 changes: 7 additions & 0 deletions wgpu-hal/src/gles/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ impl Surface {
))?;

if swapchain.format.describe().srgb {
// Important to set the viewport since we don't know in what state the user left it.
gl.viewport(
0,
0,
swapchain.extent.width as _,
swapchain.extent.height as _,
);
gl.bind_framebuffer(glow::DRAW_FRAMEBUFFER, None);
gl.bind_sampler(0, None);
gl.active_texture(glow::TEXTURE0);
Expand Down

0 comments on commit 351ca3e

Please sign in to comment.