Add support for WebGL2 FramebufferTextureLayer

Adds support for `FramebufferTextureLayer` WebGL2 call.

See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.4
This commit is contained in:
Mátyás Mustoha 2020-02-14 13:14:07 +01:00
parent 61cf25c98a
commit 8389189d94
9 changed files with 145 additions and 39 deletions

View file

@ -1974,6 +1974,19 @@ impl WebGLImpl {
WebGLCommand::InvalidateSubFramebuffer(target, ref attachments, x, y, w, h) => {
gl.invalidate_sub_framebuffer(target, attachments, x, y, w, h)
},
WebGLCommand::FramebufferTextureLayer(target, attachment, tex_id, level, layer) => {
let tex_id = tex_id.map_or(0, WebGLTextureId::get);
let attach = |attachment| {
gl.framebuffer_texture_layer(target, attachment, tex_id, level, layer)
};
if attachment == gl::DEPTH_STENCIL_ATTACHMENT {
attach(gl::DEPTH_ATTACHMENT);
attach(gl::STENCIL_ATTACHMENT);
} else {
attach(attachment)
}
},
}
// If debug asertions are enabled, then check the error state.