[Bf-blender-cvs] [fb940758a91] tmp-drw-callbatching: DRW: Replace DRW_CALL_OBINFOS by a boolean in DRWManager

Clément Foucault noreply at git.blender.org
Sat Aug 17 14:49:22 CEST 2019


Commit: fb940758a9187761accf4b209588ceb6b851084e
Author: Clément Foucault
Date:   Sat Jun 1 18:20:26 2019 +0200
Branches: tmp-drw-callbatching
https://developer.blender.org/rBfb940758a9187761accf4b209588ceb6b851084e

DRW: Replace DRW_CALL_OBINFOS by a boolean in DRWManager

This is to remove the use of keeping a shared flag per drawcall.

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

M	source/blender/draw/intern/draw_manager.h
M	source/blender/draw/intern/draw_manager_data.c

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

diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index 334369cb7f3..c75fbb33e7c 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -94,7 +94,6 @@
 /* Used by DRWCallState.flag */
 enum {
   DRW_CALL_NEGSCALE = (1 << 0),
-  DRW_CALL_OBINFOS = (1 << 1),
 };
 
 typedef struct DRWCullingState {
@@ -312,6 +311,8 @@ typedef struct DRWManager {
   DRWCallState *unit_state;
   /* State of the object being evaluated if already allocated. */
   DRWCallState *ob_state;
+  /** True if current DST.ob_state has its matching DRWObjectInfos init. */
+  bool ob_state_obinfo_init;
   /** Handle of current object resource in object resource arrays (DRWObjectMatrices/Infos). */
   DRWResourceHandle resource_handle;
 
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 9dfe4d623ab..9a08b050047 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -479,11 +479,12 @@ static DRWCallState *drw_call_state_object(DRWShadingGroup *shgroup, float (*obm
   else {
     if (DST.ob_state == NULL) {
       DST.ob_state = drw_call_state_create(obmat, ob);
+      DST.ob_state_obinfo_init = false;
     }
 
     if (shgroup->objectinfo != -1 || shgroup->orcotexfac != -1) {
-      if ((DST.ob_state->flag & DRW_CALL_OBINFOS) == 0) {
-        DST.ob_state->flag |= DRW_CALL_OBINFOS;
+      if (!DST.ob_state_obinfo_init) {
+        DST.ob_state_obinfo_init = true;
 
         DRWObjectInfos *ob_infos = BLI_memblock_elem_get(
             DST.vmempool->obinfos, DST.ob_state->handle.chunk, DST.ob_state->handle.id);



More information about the Bf-blender-cvs mailing list