Add initial support for WebGL 2 BlitFramebuffer (#26389)

Add initial support for the WebGL2 BlitFramebuffer call.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Istvan <istvan.miklos@h-lab.eu>
This commit is contained in:
Josh Matthews 2025-01-06 13:37:35 -05:00 committed by GitHub
parent 2575a0daf1
commit c43762faea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1686 additions and 31 deletions

View file

@ -234,6 +234,25 @@ impl WebGLFramebuffer {
self.size.get()
}
pub fn get_attachment_formats(&self) -> WebGLResult<(Option<u32>, Option<u32>, Option<u32>)> {
if self.check_status() != constants::FRAMEBUFFER_COMPLETE {
return Err(WebGLError::InvalidFramebufferOperation);
}
let color = match self.attachment(constants::COLOR_ATTACHMENT0) {
Some(WebGLFramebufferAttachmentRoot::Renderbuffer(rb)) => Some(rb.internal_format()),
_ => None,
};
let depth = match self.attachment(constants::DEPTH_ATTACHMENT) {
Some(WebGLFramebufferAttachmentRoot::Renderbuffer(rb)) => Some(rb.internal_format()),
_ => None,
};
let stencil = match self.attachment(constants::STENCIL_ATTACHMENT) {
Some(WebGLFramebufferAttachmentRoot::Renderbuffer(rb)) => Some(rb.internal_format()),
_ => None,
};
Ok((color, depth, stencil))
}
fn check_attachment_constraints<'a>(
&self,
attachment: &Option<WebGLFramebufferAttachment>,