webgl: Support DEPTH_STENCIL_ATTACHMENT on osmesa.

This commit is contained in:
Josh Matthews 2018-08-15 14:38:28 -04:00
parent d179435eab
commit 15e2af0fea

View file

@ -693,12 +693,31 @@ impl WebGLImpl {
ctx.gl().disable(cap), ctx.gl().disable(cap),
WebGLCommand::Enable(cap) => WebGLCommand::Enable(cap) =>
ctx.gl().enable(cap), ctx.gl().enable(cap),
WebGLCommand::FramebufferRenderbuffer(target, attachment, renderbuffertarget, rb) => WebGLCommand::FramebufferRenderbuffer(target, attachment, renderbuffertarget, rb) => {
ctx.gl().framebuffer_renderbuffer(target, attachment, renderbuffertarget, let attach = |attachment| {
rb.map_or(0, WebGLRenderbufferId::get)), ctx.gl().framebuffer_renderbuffer(target, attachment,
WebGLCommand::FramebufferTexture2D(target, attachment, textarget, texture, level) => renderbuffertarget,
ctx.gl().framebuffer_texture_2d(target, attachment, textarget, rb.map_or(0, WebGLRenderbufferId::get))
texture.map_or(0, WebGLTextureId::get), level), };
if attachment == gl::DEPTH_STENCIL_ATTACHMENT {
attach(gl::DEPTH_ATTACHMENT);
attach(gl::STENCIL_ATTACHMENT);
} else {
attach(attachment);
}
}
WebGLCommand::FramebufferTexture2D(target, attachment, textarget, texture, level) => {
let attach = |attachment| {
ctx.gl().framebuffer_texture_2d(target, attachment, textarget,
texture.map_or(0, WebGLTextureId::get), level)
};
if attachment == gl::DEPTH_STENCIL_ATTACHMENT {
attach(gl::DEPTH_ATTACHMENT);
attach(gl::STENCIL_ATTACHMENT);
} else {
attach(attachment)
}
}
WebGLCommand::FrontFace(mode) => WebGLCommand::FrontFace(mode) =>
ctx.gl().front_face(mode), ctx.gl().front_face(mode),
WebGLCommand::DisableVertexAttribArray(attrib_id) => WebGLCommand::DisableVertexAttribArray(attrib_id) =>