Skip to content

Conversation

alextechcc
Copy link

@alextechcc alextechcc commented Jul 28, 2025

Connections

Description

Fundamental issue is that webgpu's textures and texture views are incompatible with opengl's textures and texture views because they are mappings of vulkan's images and image views.

Originally posted by @tasogare3710 in #7428

Testing

  • Currently tested by replicating the error messages by creating a single layer D2Array and binding a texture view to it. Error is resolved and rendering is fixed. You can see this in the PR in examples/features/cube, I've disabled all examples except this one.
WGPU_BACKEND=gl cargo run --features gles --bin wgpu-examples cube

Squash or Rebase?

  • Not ready to be merged yet, undecided.

Checklist
(keeping, as draft)

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

MarijnS95 and others added 2 commits July 26, 2025 23:36
This allows platforms like GLES with EGL context backend to properly
initialize such that their `EGLDisplay` and `EGLContext` are compatible
with an incoming `Surface`, which is otherwise impossible if not for
hotpatching the context (and loosing all resources created on it) when a
surface comes in and that compositor connection becomes known.

This hotpatching is known to break quite a few systems and
initialization ordering (i.e. the alternative is forcing users to create
surfaces before querying adapters, which isn't feasible on platform like
Android), and is better avoided or at least made possible by using the
`(Raw)DisplayHandle` abstraction provided by `raw_display_handle` in the
way it's intended to be used (additionally, removing it from the surface
would be a sensible decision).

There may however be cases where users want to initialize multiple
`Instance`s or perhaps `Adapter`s for independent `RawDisplayHandle`s,
and certain backends may be designed specifically to cope with this
(i.e. Vulkan).

Note that this PR does nothing to address many other soundness problems
inside the EGL backend.
@alextechcc alextechcc requested review from crowlKats and a team as code owners July 28, 2025 00:05
@alextechcc alextechcc marked this pull request as draft July 28, 2025 00:06
@alextechcc
Copy link
Author

It's worth noting that this is currently a breaking change for every single create_texture call.

@cwfitzgerald
Copy link
Member

Sorry I'm not sure this got on my radar - besides being based on the other PR - would want the final version of the PR to be without it - we do want this!

@alextechcc
Copy link
Author

Sorry I'm not sure this got on my radar - besides being based on the other PR - would want the final version of the PR to be without it - we do want this!

Sorry a bit confused at the wording here - do you mean rebasing without #8012 ? Can do if so - just difficult to test without it.

Is it okay that this is a breaking change for create_texture? If this is being used to implement WebGPU for Firefox I can imagine that the answer is that it can't be a feature flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants