[Bf-blender-cvs] [3198fec1fed] master: Fix T80160: Workbench shadows are broken

Jeroen Bakker noreply at git.blender.org
Fri Aug 28 14:39:15 CEST 2020


Commit: 3198fec1fed525ee705e6945605723615958b292
Author: Jeroen Bakker
Date:   Fri Aug 28 14:33:51 2020 +0200
Branches: master
https://developer.blender.org/rB3198fec1fed525ee705e6945605723615958b292

Fix T80160: Workbench shadows are broken

In recent refactoring {a9f2ebb21508} an issue was introduced that the
opengl rasterizer would be disabled when only writing to a stencil
buffer.

This fix adds stencil writing to the write mask and set it. This makes
the write map not evaluate to GPU_WRITE_NONE and the rasterizer will be
enabled in `GLStateManager::set_write_mask`.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8743

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

M	source/blender/draw/intern/draw_manager_exec.c
M	source/blender/gpu/GPU_state.h

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

diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index b3e1258ff7f..8a81b3db7d8 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -99,6 +99,9 @@ void drw_state_set(DRWState state)
   if (state & DRW_STATE_WRITE_COLOR) {
     write_mask |= GPU_WRITE_COLOR;
   }
+  if (state & DRW_STATE_WRITE_STENCIL_ENABLED) {
+    write_mask |= GPU_WRITE_STENCIL;
+  }
 
   switch (state & (DRW_STATE_CULL_BACK | DRW_STATE_CULL_FRONT)) {
     case DRW_STATE_CULL_BACK:
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
index e56df6d77a7..253877bcca0 100644
--- a/source/blender/gpu/GPU_state.h
+++ b/source/blender/gpu/GPU_state.h
@@ -29,6 +29,7 @@ typedef enum eGPUWriteMask {
   GPU_WRITE_BLUE = (1 << 2),
   GPU_WRITE_ALPHA = (1 << 3),
   GPU_WRITE_DEPTH = (1 << 4),
+  GPU_WRITE_STENCIL = (1 << 5),
   GPU_WRITE_COLOR = (GPU_WRITE_RED | GPU_WRITE_GREEN | GPU_WRITE_BLUE | GPU_WRITE_ALPHA),
 } eGPUWriteMask;



More information about the Bf-blender-cvs mailing list