GLES external texture implementation#9485
Open
cmeissl wants to merge 3 commits intogfx-rs:trunkfrom
Open
Conversation
9e2cd8d to
45af623
Compare
Contributor
|
This probably closes #4528 as well? |
Author
Oh yeah, added, thanks! What I wonder is where the use of the external sampler and its expectation could be documented. |
This adds GLSL backend support for `ImageClass::External`. (ie WGSL's `external_texture` texture type). This is implemented similarily to the MSL implementation in gfx-rs#8117. The main difference to the MSL and HLSL implementation is that this uses GL_OES_EGL_image_external_essl3 instead of reading raw YUV data. This limits the usage to external textures imported through egl represented as a single RGBA texture. The YUV conversion is done in the driver. The WGSL builtins `textureDimensions()`, `textureLoad()`, and `textureSampleBaseClampToEdge()` are implemented using helper functions mapping to externalEOS.
This enables the use of GL_OES_EGL_image_external_essl3 on gles when the `EXTERNAL_TEXTURE` feature is requested and creates the required bindings.
On desktop Linux (Mesa), EGL reports both OpenGL and OpenGL ES as available client APIs. wgpu-hal automatically prefers desktop OpenGL, which prevents GLES-only features (e.g. EXTERNAL_TEXTURE / GL_OES_EGL_image_external_essl3) from being advertised by the adapter. Add a `GlClientApi` enum and a `client_api` field to `GlBackendOptions` so callers can explicitly request `OpenGlEs` (or `OpenGl`) instead of relying on the auto-detection heuristic.
45af623 to
2726221
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections
Part of #4386
closes #4528
Description
GLES implementation of external texture, similar to the implementation for HLSL in #8117.
The main difference is the use of OES_EGL_image_external_essl3 which will do the YUV color conversion implicitly in the driver.
sample/load/sizeare mapped to inserted helper functions usingsamplerExternalOES.An alternative would be to map the planes to multiple views and do the YUV-RGB
conversion in the shader. But I not sure this would work with all tiling formats as
some require shadow copies in the driver.
The last commit (gl api override) is not necessary for this feature, but was required for
testing the gles implementation on desktop mesa.
Testing
Naga tests for external textures enabled for glsl backend.
External test client using gstreamer and wgpu to render dmabuf based
video buffers.
Squash or Rebase?
Rebase
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.