Skip to content

Commit 351ca3e

Browse files
authored
Fix webgl srgb blit not setting the viewport correctly (#3093)
* Fix webgl srgb blit not setting the viewport correctly * Add changelog notes
1 parent eca04f5 commit 351ca3e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Bottom level categories:
5656

5757
#### GLES
5858

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

6161
### Bug Fixes
6262

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

72+
#### GLES
73+
74+
- 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)
75+
7276
### Examples
7377
- Log adapter info in hello example on wasm target by @JolifantoBambla in [#2858](https://github.com/gfx-rs/wgpu/pull/2858)
7478

wgpu-hal/src/gles/web.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ impl Surface {
171171
))?;
172172

173173
if swapchain.format.describe().srgb {
174+
// Important to set the viewport since we don't know in what state the user left it.
175+
gl.viewport(
176+
0,
177+
0,
178+
swapchain.extent.width as _,
179+
swapchain.extent.height as _,
180+
);
174181
gl.bind_framebuffer(glow::DRAW_FRAMEBUFFER, None);
175182
gl.bind_sampler(0, None);
176183
gl.active_texture(glow::TEXTURE0);

0 commit comments

Comments
 (0)