diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 6c46c5599..eb5c3ade8 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -523,6 +523,8 @@ impl crate::CommandEncoder for super::CommandEncoder { .any(|at| match at.target.view.inner { #[cfg(webgl)] super::TextureInner::ExternalFramebuffer { .. } => true, + #[cfg(native)] + super::TextureInner::ExternalNativeFramebuffer { .. } => true, _ => false, }); diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index c5539eae3..852042e8e 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -969,6 +969,8 @@ impl crate::Device for super::Device { } #[cfg(webgl)] super::TextureInner::ExternalFramebuffer { .. } => {} + #[cfg(native)] + super::TextureInner::ExternalNativeFramebuffer { .. } => {} } } diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index c96973281..4df93e9a9 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -366,9 +366,21 @@ pub enum TextureInner { target: BindTarget, }, #[cfg(webgl)] + /// Render to a `WebGLFramebuffer` + /// + /// This is a web feature ExternalFramebuffer { inner: web_sys::WebGlFramebuffer, }, + #[cfg(native)] + /// Render to a `glow::NativeFramebuffer` + /// Useful when the framebuffer to draw to + /// has a non-zero framebuffer ID + /// + /// This is a native feature + ExternalNativeFramebuffer { + inner: glow::NativeFramebuffer, + }, } #[cfg(send_sync)] @@ -385,6 +397,8 @@ impl TextureInner { Self::Texture { raw, target } => (raw, target), #[cfg(webgl)] Self::ExternalFramebuffer { .. } => panic!("Unexpected external framebuffer"), + #[cfg(native)] + Self::ExternalNativeFramebuffer { .. } => panic!("unexpected external framebuffer"), } } } diff --git a/wgpu-hal/src/gles/queue.rs b/wgpu-hal/src/gles/queue.rs index 57cf07d38..d653e7d2d 100644 --- a/wgpu-hal/src/gles/queue.rs +++ b/wgpu-hal/src/gles/queue.rs @@ -158,6 +158,10 @@ impl super::Queue { super::TextureInner::ExternalFramebuffer { ref inner } => unsafe { gl.bind_external_framebuffer(glow::FRAMEBUFFER, inner); }, + #[cfg(native)] + super::TextureInner::ExternalNativeFramebuffer { ref inner } => unsafe { + gl.bind_framebuffer(glow::FRAMEBUFFER, Some(*inner)); + }, } }