gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 548 forks source link

[mtl] Use Once for delegate initialization #3616

Closed kvark closed 3 years ago

kvark commented 3 years ago

Fixes the following errors in wgpu-rs test log:

objc[21181]: Class GfxManagedMetalLayerDelegate is implemented in both ?? (0x7f99dbe04520) and ?? (0x7f99dbd04520). One of the two will be used. Which one is undefined.

I think the reason is that class registration is not instantaneous, and not blocking. So with the current code (as of #3585) we could still try to register the same class twice.

PR checklist:

kvark commented 3 years ago

bors r+

bors[bot] commented 3 years ago

Build succeeded: