From 4fc7e1a8800473eb67c5234ab9ec4f20713fe7c3 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 7 Jun 2022 11:55:52 +0200 Subject: Cleanup: Correct comments --- .../blender/draw/intern/draw_cache_impl_curves.cc | 9 +++++--- source/blender/draw/intern/draw_curves_private.h | 26 +++++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'source/blender/draw') diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc b/source/blender/draw/intern/draw_cache_impl_curves.cc index 22b843650ca..2c07b651c7c 100644 --- a/source/blender/draw/intern/draw_cache_impl_curves.cc +++ b/source/blender/draw/intern/draw_cache_impl_curves.cc @@ -52,11 +52,14 @@ struct CurvesBatchCache { GPUBatch *edit_points; - /* To determine if cache is invalid. */ + /* Whether the cache is invalid. */ bool is_dirty; - /** Needed when updating material data (e.g. attributes) as the same curves might be used for - * multiple objects with different materials. */ + /** + * The draw cache extraction is currently not multi-threaded for multiple objects, but if it was, + * some locking would be necessary because multiple objects can use the same curves data with + * different materials, etc. This is a placeholder to make multi-threading easier in the future. + */ ThreadMutex render_mutex; }; diff --git a/source/blender/draw/intern/draw_curves_private.h b/source/blender/draw/intern/draw_curves_private.h index ed4dd50dfbe..26ecc4d9d12 100644 --- a/source/blender/draw/intern/draw_curves_private.h +++ b/source/blender/draw/intern/draw_curves_private.h @@ -35,22 +35,26 @@ typedef struct CurvesEvalFinalCache { GPUVertBuf *proc_buf; GPUTexture *proc_tex; - /* Just contains a huge index buffer used to draw the final curves. */ + /**Just contains a huge index buffer used to draw the final curves. */ GPUBatch *proc_hairs[MAX_THICKRES]; - /* Points per curve, at least 2. */ + /** Points per curve, at least 2. */ int strands_res; - /* Attributes currently being or about to be drawn. */ + /** Attributes currently being drawn or about to be drawn. */ DRW_Attributes attr_used; - /* Attributes which were used at some point. This is used for garbage collection, to remove - * attributes which are not used in shaders anymore due to user edits. */ + /** + * Attributes that were used at some point. This is used for garbage collection, to remove + * attributes that are not used in shaders anymore due to user edits. + */ DRW_Attributes attr_used_over_time; - /* Last time, in seconds, the `attr_used` and `attr_used_over_time` were exactly the same. + /** + * The last time in seconds that the `attr_used` and `attr_used_over_time` were exactly the same. * If the delta between this time and the current scene time is greater than the timeout set in - * user preferences (`U.vbotimeout`) then garbage collection is performed. */ + * user preferences (`U.vbotimeout`) then garbage collection is performed. + */ int last_attr_matching_time; /* Output of the subdivision stage: vertex buffers sized to subdiv level. This is only attributes @@ -61,7 +65,7 @@ typedef struct CurvesEvalFinalCache { /* Curves procedural display: Evaluation is done on the GPU. */ typedef struct CurvesEvalCache { - /* Input control points */ + /* Input control point positions combined with parameter data. */ GPUVertBuf *proc_point_buf; GPUTexture *point_tex; @@ -78,8 +82,8 @@ typedef struct CurvesEvalCache { CurvesEvalFinalCache final[MAX_HAIR_SUBDIV]; - /* For point attributes, which need subdivision, these are the input data. - * For spline attributes, which need not subdivision, these are the final data. */ + /* For point attributes, which need subdivision, these buffers contain the input data. + * For curve domain attributes, which do not need subdivision, these are the final data. */ GPUVertBuf *proc_attributes_buf[GPU_MAX_ATTR]; GPUTexture *proc_attributes_tex[GPU_MAX_ATTR]; @@ -89,7 +93,7 @@ typedef struct CurvesEvalCache { } CurvesEvalCache; /** - * Ensure all textures and buffers needed for GPU accelerated drawing. + * Ensure all necessary textures and buffers exist for GPU accelerated drawing. */ bool curves_ensure_procedural_data(struct Object *object, struct CurvesEvalCache **r_hair_cache, -- cgit v1.2.3