Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ By @SupaMaggie70Incorporated in [#8206](https://github.com/gfx-rs/wgpu/pull/8206
#### GLES

- Fix race when downloading texture from compute shader pass. By @SpeedCrash100 in [#8527](https://github.com/gfx-rs/wgpu/pull/8527)
- Fix double window class registration when dynamic libraries are used. By @Azorlogh in [#8548](https://github.com/gfx-rs/wgpu/pull/8548)

#### hal

Expand Down
15 changes: 15 additions & 0 deletions wgpu-hal/src/gles/wgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,21 @@ fn create_global_window_class() -> Result<CString, crate::InstanceError> {
let name = format!("wgpu Device Class {:x}\0", class_addr as usize);
let name = CString::from_vec_with_nul(name.into_bytes()).unwrap();

// The window class may already be registered if we are a dynamic library that got
// unloaded & loaded back into the same process. If so, just skip creation.
let already_exists = unsafe {
let mut wc = mem::zeroed::<WindowsAndMessaging::WNDCLASSEXA>();
WindowsAndMessaging::GetClassInfoExA(
Some(instance.into()),
PCSTR(name.as_ptr().cast()),
&mut wc,
)
.is_ok()
};
if already_exists {
return Ok(name);
}

// Use a wrapper function for compatibility with `windows-rs`.
unsafe extern "system" fn wnd_proc(
window: Foundation::HWND,
Expand Down