gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.4k stars 908 forks source link

[glsl-out] Feature to generate `samplerExternalOES` instead of `sampler2D` #4528

Open i509VCB opened 2 years ago

i509VCB commented 2 years ago

samplerExternalOES is defined in https://registry.khronos.org/OpenGL/extensions/OES/OES_EGL_image_external.txt

This sampler is needed if the texture from an EGLImage that could be backed by external memory such as AHardwareBuffer or dmabuf.

This is related to the work to enable https://github.com/gfx-rs/wgpu/issues/2320

jimblandy commented 2 years ago

Does this correspond to the texture_external type in WGSL? Naga hasn't implemented that yet.

i509VCB commented 1 year ago

I guess it will correspond to the texture_external type for gles3.

zarik5 commented 8 months ago

I would really like to see this implemented. I've tried to look into bypassing naga in the wgpu_hal glsl backend, but it's not trivial, the hack is more effort than it is worth. The solution of course would be to support texture_external in naga. For now I will work around this by executing a passthrough shader using raw opengl before passing the non-external textures to wgpu; this doesn't sound like a big deal but this has to run on VR mobile hardware where every draw call incurs in a performance hit.