Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-10-17 16:27:53 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-11-27 18:08:13 +0300
commit83d3a7c12d80d360268f36878e8ffc2832544b3c (patch)
treee5ea13e5193448680b7107ece1f142f87dbea0ac /source/blender/draw/engines/workbench/workbench_private.h
parent2e6159a4948cd0f4e0b636734bfe506796bd87f2 (diff)
Workbench: Performance
Small performance improvements by caching the world_ubo in the World. It was detected that NVIDIA driver created threads to update the world_ubo (304 bytes). This patch will reuse the previous created ubo when not changed. Reviewed By: fclem Differential Revision: https://developer.blender.org/D6087
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_private.h')
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 595b92d19d0..9fcd9651f94 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -217,6 +217,11 @@ typedef struct WORKBENCH_PrivateData {
View3DShading shading;
StudioLight *studio_light;
const UserDef *preferences;
+ /* Does this instance owns the `world_ubo` field.
+ * Normally the field is borrowed from `WORKBENCH_WorldData`. In case that
+ * there is no World attached to the scene the UBO cannot be cached and should
+ * be freed after using. */
+ bool is_world_ubo_owner;
struct GPUUniformBuffer *world_ubo;
struct DRWShadingGroup *shadow_shgrp;
struct DRWShadingGroup *depth_shgrp;
@@ -307,6 +312,12 @@ typedef struct WORKBENCH_ObjectData {
bool shadow_bbox_dirty;
} WORKBENCH_ObjectData;
+typedef struct WORKBENCH_WorldData {
+ DrawData dd;
+ /* The cached `GPUUniformBuffer`, that is reused between draw calls. */
+ struct GPUUniformBuffer *world_ubo;
+} WORKBENCH_WorldData;
+
/* inline helper functions */
BLI_INLINE bool workbench_is_specular_highlight_enabled(WORKBENCH_PrivateData *wpd)
{
@@ -526,8 +537,7 @@ bool studiolight_camera_in_object_shadow(WORKBENCH_PrivateData *wpd,
void workbench_effect_info_init(WORKBENCH_EffectInfo *effect_info);
void workbench_private_data_init(WORKBENCH_PrivateData *wpd);
void workbench_private_data_free(WORKBENCH_PrivateData *wpd);
-void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd,
- float r_light_direction[3]);
+void workbench_private_data_get_light_direction(float r_light_direction[3]);
/* workbench_volume.c */
void workbench_volume_engine_init(void);