mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Support combined depth/stencil buffers when using vendor extensions.
This commit is contained in:
@@ -555,12 +555,16 @@ bool Canvas::checkCreateStencil()
|
|||||||
GLenum attachment = GL_STENCIL_ATTACHMENT;
|
GLenum attachment = GL_STENCIL_ATTACHMENT;
|
||||||
|
|
||||||
// Prefer a combined depth/stencil buffer.
|
// Prefer a combined depth/stencil buffer.
|
||||||
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object
|
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object)
|
||||||
|| GLAD_EXT_packed_depth_stencil || GLAD_OES_packed_depth_stencil)
|
|
||||||
{
|
{
|
||||||
format = GL_DEPTH24_STENCIL8;
|
format = GL_DEPTH24_STENCIL8;
|
||||||
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
|
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
|
||||||
}
|
}
|
||||||
|
else if (GLAD_EXT_packed_depth_stencil || GLAD_OES_packed_depth_stencil)
|
||||||
|
{
|
||||||
|
format = GL_DEPTH24_STENCIL8_OES;
|
||||||
|
attachment = GL_DEPTH_ATTACHMENT;
|
||||||
|
}
|
||||||
|
|
||||||
glGenRenderbuffers(1, &depth_stencil);
|
glGenRenderbuffers(1, &depth_stencil);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, depth_stencil);
|
glBindRenderbuffer(GL_RENDERBUFFER, depth_stencil);
|
||||||
@@ -572,6 +576,8 @@ bool Canvas::checkCreateStencil()
|
|||||||
|
|
||||||
// Attach the stencil buffer to the framebuffer object.
|
// Attach the stencil buffer to the framebuffer object.
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, depth_stencil);
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, depth_stencil);
|
||||||
|
if (format == GL_DEPTH24_STENCIL8_OES)
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depth_stencil);
|
||||||
|
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user