[Bf-blender-cvs] [ed7dbaa5a72] master: GPUState: Fix missing writemask encapsulation

Clément Foucault noreply at git.blender.org
Sun Aug 30 13:36:06 CEST 2020


Commit: ed7dbaa5a7246d72cc9bc2b59667d9a784c4c28d
Author: Clément Foucault
Date:   Tue Aug 25 23:00:14 2020 +0200
Branches: master
https://developer.blender.org/rBed7dbaa5a7246d72cc9bc2b59667d9a784c4c28d

GPUState: Fix missing writemask encapsulation

This was the last remaining.

===================================================================

M	source/blender/gpu/intern/gpu_framebuffer.cc

===================================================================

diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index 88013640bfc..67320ed61b6 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -660,7 +660,9 @@ void GPU_framebuffer_multi_clear(GPUFrameBuffer *fb, const float (*clear_cols)[4
 {
   CHECK_FRAMEBUFFER_IS_BOUND(fb);
 
-  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+  /* Save and restore the state. */
+  eGPUWriteMask write_mask = GPU_write_mask_get();
+  GPU_color_mask(true, true, true, true);
 
   int i_type = GPU_FB_COLOR_ATTACHMENT0;
   for (int i = 0; i_type < GPU_FB_MAX_ATTACHEMENT; i++, i_type++) {
@@ -669,6 +671,8 @@ void GPU_framebuffer_multi_clear(GPUFrameBuffer *fb, const float (*clear_cols)[4
       glClearBufferfv(GL_COLOR, i, clear_cols[i]);
     }
   }
+
+  GPU_write_mask(write_mask);
 }
 
 void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int w, int h, float *data)



More information about the Bf-blender-cvs mailing list