mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
External gles framebuffer (#7671)
This commit is contained in:
parent
70b06b19a1
commit
1da7cd4811
@ -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,
|
||||
});
|
||||
|
||||
|
||||
@ -969,6 +969,8 @@ impl crate::Device for super::Device {
|
||||
}
|
||||
#[cfg(webgl)]
|
||||
super::TextureInner::ExternalFramebuffer { .. } => {}
|
||||
#[cfg(native)]
|
||||
super::TextureInner::ExternalNativeFramebuffer { .. } => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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));
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user