Support texture array as framebuffer depth & stencil

This commit is contained in:
Nikita Lisitsa 2020-12-12 23:30:40 +03:00
parent 0cf44f532a
commit 9606c0feb7
2 changed files with 14 additions and 0 deletions

View file

@ -38,10 +38,12 @@ namespace psemek::gfx
void color(texture_cubemap const & tex, int face, int attachment = 0);
void color(renderbuffer const & rb, int attachment = 0);
void depth(texture_2d const & tex);
void depth(texture_2d_array const & tex, int layer);
void depth(texture_cubemap const & tex);
void depth(texture_cubemap const & tex, int face);
void depth(renderbuffer const & rb);
void depth_stencil(texture_2d const & tex);
void depth_stencil(texture_2d_array const & tex, int layer);
void depth_stencil(texture_cubemap const & tex);
void depth_stencil(texture_cubemap const & tex, int face);
void depth_stencil(renderbuffer const & rb);

View file

@ -113,6 +113,12 @@ namespace psemek::gfx
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0);
}
void framebuffer::depth(texture_2d_array const & tex, int layer)
{
bind();
gl::FramebufferTextureLayer(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, tex.id(), 0, layer);
}
void framebuffer::depth(texture_cubemap const & tex)
{
bind();
@ -137,6 +143,12 @@ namespace psemek::gfx
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0);
}
void framebuffer::depth_stencil(texture_2d_array const & tex, int layer)
{
bind();
gl::FramebufferTextureLayer(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, tex.id(), 0, layer);
}
void framebuffer::depth_stencil(texture_cubemap const & tex)
{
bind();