summaryrefslogtreecommitdiff
path: root/render/fx_renderer/fx_stencilbuffer.c
diff options
context:
space:
mode:
authorErik Reider <[email protected]>2024-01-06 02:31:14 +0100
committerGitHub <[email protected]>2024-01-06 02:31:14 +0100
commit6759e8da7ab53a46b0eb04e5045b8c67262c3a11 (patch)
treec65ed83ca04b61bdbae7e1b8a7f2c16f29b89730 /render/fx_renderer/fx_stencilbuffer.c
parentb929a2bbadf467864796ad4ec90882ce86cfebff (diff)
parentace97585b2b4d8cbb5ead6cd0f72fa8e8889c9d7 (diff)
Merge pull request #24 from wlrfx/wlroots-0.17-rebase
Rebase to wlroots 0.17
Diffstat (limited to 'render/fx_renderer/fx_stencilbuffer.c')
-rw-r--r--render/fx_renderer/fx_stencilbuffer.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/render/fx_renderer/fx_stencilbuffer.c b/render/fx_renderer/fx_stencilbuffer.c
deleted file mode 100644
index 4f57216..0000000
--- a/render/fx_renderer/fx_stencilbuffer.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <assert.h>
-#include <wlr/render/gles2.h>
-#include <wlr/util/log.h>
-
-#include "include/render/fx_renderer/fx_stencilbuffer.h"
-
-struct fx_stencilbuffer fx_stencilbuffer_create(void) {
- return (struct fx_stencilbuffer) {
- .rb = -1,
- .width = -1,
- .height = -1,
- };
-}
-
-void fx_stencilbuffer_init(struct fx_stencilbuffer *stencil_buffer, int width, int height) {
- bool first_alloc = false;
-
- if (stencil_buffer->rb == (uint32_t) -1) {
- glGenRenderbuffers(1, &stencil_buffer->rb);
- first_alloc = true;
- }
-
- if (first_alloc || stencil_buffer->width != width || stencil_buffer->height != height) {
- glBindRenderbuffer(GL_RENDERBUFFER, stencil_buffer->rb);
- glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, width, height);
- stencil_buffer->width = width;
- stencil_buffer->height = height;
-
- GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE) {
- wlr_log(WLR_ERROR,
- "Stencil buffer incomplete, couldn't create! (FB status: %i)",
- status);
- return;
- }
- }
-
- // Reattach the RenderBuffer to the FrameBuffer
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
- GL_RENDERBUFFER, stencil_buffer->rb);
-}
-
-void fx_stencilbuffer_release(struct fx_stencilbuffer *stencil_buffer) {
- if (stencil_buffer->rb != (uint32_t) -1 && stencil_buffer->rb) {
- glDeleteRenderbuffers(1, &stencil_buffer->rb);
- }
- stencil_buffer->rb = -1;
- stencil_buffer->width = -1;
- stencil_buffer->height = -1;
-}