Page MenuHome
Paste P1104

Not working glClearBuffer
ActivePublic

Authored by Jeroen Bakker (jbakker) on Sep 18 2019, 3:47 PM.
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 1b68e4c85f7..bc62dbfebae 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -608,6 +608,16 @@ void GPU_framebuffer_clear(GPUFrameBuffer *fb,
GLbitfield mask = convert_buffer_bits_to_gl(buffers);
glClear(mask);
+
+ if ((buffers & GPU_COLOR_BIT) && GPU_clear_multiple_buffers_workaround()) {
+ for (int slot = 1; slot < GPU_FB_MAX_COLOR_ATTACHMENT; slot ++)
+ {
+ if (framebuffer_get_color_tex(fb, slot) != NULL) {
+ /* This is OK as the parameter should be the index buffer, not the GL_ATTACHMENT_ */
+ glClearBufferfv(GL_COLOR, GPU_FB_COLOR_ATTACHMENT0 + slot, clear_col);
+ }
+ }
+ }
}
void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int w, int h, float *data)

Event Timeline