Commit: 15b2caab21abfb3556d1f57b28d571519c707f89 Author: Miguel Pozo Date: Mon Jan 16 19:23:39 2023 +0100 Branches: tmp-workbench-rewrite2 https://developer.blender.org/rB15b2caab21abfb3556d1f57b28d571519c707f89
Don't create an extra handle for shadows =================================================================== M source/blender/draw/engines/workbench/workbench_engine.cc M source/blender/draw/engines/workbench/workbench_private.hh M source/blender/draw/engines/workbench/workbench_shadow.cc =================================================================== diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc b/source/blender/draw/engines/workbench/workbench_engine.cc index b63f63f7109..afa8281d1e0 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.cc +++ b/source/blender/draw/engines/workbench/workbench_engine.cc @@ -165,6 +165,7 @@ class Instance { void mesh_sync(Manager &manager, ObjectRef &ob_ref, const ObjectState &object_state) { + ResourceHandle handle = manager.resource_handle(ob_ref); bool has_transparent_material = false; if (object_state.sculpt_pbvh) { @@ -193,8 +194,8 @@ class Instance { /* TODO(fclem): This create a cull-able instance for each sub-object. This is done * for simplicity to reduce complexity. But this increase the overhead per object. * Instead, we should use an indirection buffer to the material buffer. */ + ResourceHandle handle = i == 0 ? handle : manager.resource_handle(ob_ref); - ResourceHandle handle = manager.resource_handle(ob_ref); Material &mat = resources.material_buf.get_or_resize(handle.resource_index()); if (::Material *_mat = BKE_object_material_get_eval(ob_ref.object, i + 1)) { @@ -235,7 +236,6 @@ class Instance { } if (batch) { - ResourceHandle handle = manager.resource_handle(ob_ref); Material &mat = resources.material_buf.get_or_resize(handle.resource_index()); if (object_state.color_type == V3D_SHADING_OBJECT_COLOR) { @@ -267,7 +267,7 @@ class Instance { } if (object_state.draw_shadow) { - shadow_ps.object_sync(manager, ob_ref, scene_state, has_transparent_material); + shadow_ps.object_sync(manager, scene_state, ob_ref, handle, has_transparent_material); } } diff --git a/source/blender/draw/engines/workbench/workbench_private.hh b/source/blender/draw/engines/workbench/workbench_private.hh index ee63f2c2010..086553ca5c1 100644 --- a/source/blender/draw/engines/workbench/workbench_private.hh +++ b/source/blender/draw/engines/workbench/workbench_private.hh @@ -300,8 +300,9 @@ class ShadowPass { void update(); void sync(); void object_sync(Manager &manager, - ObjectRef &ob_ref, SceneState &scene_state, + ObjectRef &ob_ref, + ResourceHandle handle, const bool has_transp_mat); void draw(Manager &manager, View &view, diff --git a/source/blender/draw/engines/workbench/workbench_shadow.cc b/source/blender/draw/engines/workbench/workbench_shadow.cc index 10a7ca19277..22c7b663220 100644 --- a/source/blender/draw/engines/workbench/workbench_shadow.cc +++ b/source/blender/draw/engines/workbench/workbench_shadow.cc @@ -391,8 +391,9 @@ void ShadowPass::sync() } void ShadowPass::object_sync(Manager &manager, - ObjectRef &ob_ref, SceneState &scene_state, + ObjectRef &ob_ref, + ResourceHandle handle, const bool has_transp_mat) { if (!enabled_) { @@ -423,8 +424,6 @@ void ShadowPass::object_sync(Manager &manager, /* Unless we force the FAIL Method we add draw commands to both methods, * then the visibility compute shader selects the one needed */ - ResourceHandle handle = manager.resource_handle(ob_ref); - if (!force_fail_pass) { PassMain::Sub &ps = *get_pass_ptr(PASS, is_manifold); ps.draw(geom_shadow, handle); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs