[Bf-blender-cvs] [11ac276caaa] master: Cleanup: clang tidy

Jacques Lucke noreply at git.blender.org
Mon Dec 27 18:18:49 CET 2021


Commit: 11ac276caaa6e6d42176452526af97cf972abb5f
Author: Jacques Lucke
Date:   Mon Dec 27 18:18:37 2021 +0100
Branches: master
https://developer.blender.org/rB11ac276caaa6e6d42176452526af97cf972abb5f

Cleanup: clang tidy

Use c++ headers; use nullptr; redundant `void` in parameter list;
inconsistent parameter name.

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

M	source/blender/draw/intern/draw_cache_impl_subdivision.cc
M	source/blender/draw/intern/draw_subdivision.h
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
M	source/blender/editors/render/render_internal.cc
M	source/blender/editors/render/render_opengl.cc
M	source/blender/editors/render/render_preview.cc
M	source/blender/editors/render/render_shading.cc
M	source/blender/editors/render/render_update.cc
M	source/blender/editors/render/render_view.cc
M	source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp

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

diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 5533130212e..f8d8674f2a7 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -276,7 +276,7 @@ static GPUShader *get_subdiv_shader(int shader_type, const char *defines)
 /** Vertex formats used for data transfer from OpenSubdiv, and for data processing on our side.
  * \{ */
 
-static GPUVertFormat *get_uvs_format(void)
+static GPUVertFormat *get_uvs_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -286,7 +286,7 @@ static GPUVertFormat *get_uvs_format(void)
 }
 
 /* Vertex format for `OpenSubdiv::Osd::PatchArray`. */
-static GPUVertFormat *get_patch_array_format(void)
+static GPUVertFormat *get_patch_array_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -301,7 +301,7 @@ static GPUVertFormat *get_patch_array_format(void)
 }
 
 /* Vertex format used for the `PatchTable::PatchHandle`. */
-static GPUVertFormat *get_patch_handle_format(void)
+static GPUVertFormat *get_patch_handle_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -313,7 +313,7 @@ static GPUVertFormat *get_patch_handle_format(void)
 }
 
 /* Vertex format used for the quad-tree nodes of the PatchMap. */
-static GPUVertFormat *get_quadtree_format(void)
+static GPUVertFormat *get_quadtree_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -324,7 +324,7 @@ static GPUVertFormat *get_quadtree_format(void)
 
 /* Vertex format for `OpenSubdiv::Osd::PatchParam`, not really used, it is only for making sure
  * that the #GPUVertBuf used to wrap the OpenSubdiv patch param buffer is valid. */
-static GPUVertFormat *get_patch_param_format(void)
+static GPUVertFormat *get_patch_param_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -334,7 +334,7 @@ static GPUVertFormat *get_patch_param_format(void)
 }
 
 /* Vertex format for the patches' vertices index buffer. */
-static GPUVertFormat *get_patch_index_format(void)
+static GPUVertFormat *get_patch_index_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -344,7 +344,7 @@ static GPUVertFormat *get_patch_index_format(void)
 }
 
 /* Vertex format for the OpenSubdiv vertex buffer. */
-static GPUVertFormat *get_subdiv_vertex_format(void)
+static GPUVertFormat *get_subdiv_vertex_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -355,11 +355,11 @@ static GPUVertFormat *get_subdiv_vertex_format(void)
   return &format;
 }
 
-typedef struct CompressedPatchCoord {
+struct CompressedPatchCoord {
   int ptex_face_index;
   /* UV coordinate encoded as u << 16 | v, where u and v are quantized on 16-bits. */
   unsigned int encoded_uv;
-} CompressedPatchCoord;
+};
 
 MINLINE CompressedPatchCoord make_patch_coord(int ptex_face_index, float u, float v)
 {
@@ -371,7 +371,7 @@ MINLINE CompressedPatchCoord make_patch_coord(int ptex_face_index, float u, floa
 }
 
 /* Vertex format used for the #CompressedPatchCoord. */
-static GPUVertFormat *get_blender_patch_coords_format(void)
+static GPUVertFormat *get_blender_patch_coords_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
@@ -382,7 +382,7 @@ static GPUVertFormat *get_blender_patch_coords_format(void)
   return &format;
 }
 
-static GPUVertFormat *get_origindex_format(void)
+static GPUVertFormat *get_origindex_format()
 {
   static GPUVertFormat format;
   if (format.attr_len == 0) {
@@ -677,7 +677,7 @@ static DRWSubdivCache *mesh_batch_cache_ensure_subdiv_cache(MeshBatchCache *mbc)
  * reevaluations, as long as the topology does not change.
  * \{ */
 
-typedef struct DRWCacheBuildingContext {
+struct DRWCacheBuildingContext {
   const Mesh *coarse_mesh;
   const SubdivToMeshSettings *settings;
 
@@ -700,7 +700,7 @@ typedef struct DRWCacheBuildingContext {
    * the shaders. */
   int *v_origindex;
   int *e_origindex;
-} DRWCacheBuildingContext;
+};
 
 static bool draw_subdiv_topology_info_cb(const SubdivForeachContext *foreach_context,
                                          const int num_vertices,
@@ -1037,7 +1037,7 @@ static bool draw_subdiv_build_cache(DRWSubdivCache *cache,
  * Common uniforms for the various shaders.
  * \{ */
 
-typedef struct DRWSubdivUboStorage {
+struct DRWSubdivUboStorage {
   /* Offsets in the buffers data where the source and destination data start. */
   int src_offset;
   int dst_offset;
@@ -1073,7 +1073,7 @@ typedef struct DRWSubdivUboStorage {
    * final vertex count, depending on which compute pass we do). This is used to early out in case
    * of out of bond accesses as compute dispatch are of fixed size. */
   uint total_dispatch_size;
-} DRWSubdivUboStorage;
+};
 
 static_assert((sizeof(DRWSubdivUboStorage) % 16) == 0,
               "DRWSubdivUboStorage is not padded to a multiple of the size of vec4");
diff --git a/source/blender/draw/intern/draw_subdivision.h b/source/blender/draw/intern/draw_subdivision.h
index f60ec7afc77..d36bfe87689 100644
--- a/source/blender/draw/intern/draw_subdivision.h
+++ b/source/blender/draw/intern/draw_subdivision.h
@@ -182,7 +182,7 @@ void draw_subdiv_extract_pos_nor(const DRWSubdivCache *cache,
 
 void draw_subdiv_interp_custom_data(const DRWSubdivCache *cache,
                                     struct GPUVertBuf *src_data,
-                                    struct GPUVertBuf *dst_buffer,
+                                    struct GPUVertBuf *dst_data,
                                     int dimensions,
                                     int dst_offset);
 
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
index eef64085c95..0b4172dfb28 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
@@ -109,7 +109,7 @@ static void mesh_render_data_vert_flag(const MeshRenderData *mr,
   }
 }
 
-static GPUVertFormat *get_edit_data_format(void)
+static GPUVertFormat *get_edit_data_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
index ea7810bcf6b..a0307b9b2cd 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
@@ -71,7 +71,7 @@ static void init_vcol_format(GPUVertFormat *format,
 
 /* Vertex format for vertex colors, only used during the coarse data upload for the subdivision
  * case. */
-static GPUVertFormat *get_coarse_vcol_format(void)
+static GPUVertFormat *get_coarse_vcol_format()
 {
   static GPUVertFormat format = {0};
   if (format.attr_len == 0) {
diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc
index 97218ac02bf..441be3a6ce3 100644
--- a/source/blender/editors/render/render_internal.cc
+++ b/source/blender/editors/render/render_internal.cc
@@ -21,9 +21,9 @@
  * \ingroup edrend
  */
 
-#include <math.h>
-#include <stddef.h>
-#include <string.h>
+#include <cmath>
+#include <cstddef>
+#include <cstring>
 
 #include "MEM_guardedalloc.h"
 
@@ -83,7 +83,7 @@
 /* Render Callbacks */
 static int render_break(void *rjv);
 
-typedef struct RenderJob {
+struct RenderJob {
   Main *main;
   Scene *scene;
   ViewLayer *single_layer;
@@ -110,7 +110,7 @@ typedef struct RenderJob {
   ColorManagedDisplaySettings display_settings;
   bool supports_glsl_draw;
   bool interface_locked;
-} RenderJob;
+};
 
 /* called inside thread! */
 static bool image_buffer_calc_tile_rect(const RenderResult *rr,
@@ -122,11 +122,11 @@ static bool image_buffer_calc_tile_rect(const RenderResult *rr,
 {
   int tile_y, tile_height, tile_x, tile_width;
 
-  /* When `renrect` argument is not NULL, we only refresh scan-lines. */
+  /* When `renrect` argument is not nullptr, we only refresh scan-lines. */
   if (renrect) {
     /* if (tile_height == recty), rendering of layer is ready,
      * we should not draw, other things happen... */
-    if (rr->renlay == NULL || renrect->ymax >= rr->recty) {
+    if (rr->renlay == nullptr || renrect->ymax >= rr->recty) {
       return false;
     }
 
@@ -190,7 +190,7 @@ static void image_buffer_rect_update(RenderJob *rj,
                                      const char *viewname)
 {
   Scene *scene = rj->scene;
-  const float *rectf = NULL;
+  const float *rectf = nullptr;
   int linear_stride, linear_offset_x, linear_offset_y;
   ColorManagedViewSettings *view_settings;
   ColorManagedDisplaySettings *display_settings;
@@ -231,12 +231,12 @@ static void image_buffer_rect_update(RenderJob *rj,
         ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
         return;
       }
-      if (rr->renlay == NULL) {
+      if (rr->renlay == nullptr) {
         return;
       }
       rectf = RE_RenderLayerGetPass(rr->renlay, RE_PASSNAME_COMBINED, viewname);
     }
-    if (rectf == NULL) {
+    if (rectf == nullptr) {
       return;
     }
 
@@ -257,7 +257,7 @@ static void image_buffer_rect_update(RenderJob *rj,
 
   IMB_partial_display_buffer_update(ibuf,
                                     rectf,
-                                    NULL,
+                                    nullptr,
                                     linear_stride,
                                     linear_offset_x,
                                     linear_offset_y,
@@ -316,17 +316,17 @@ static int screen_render_exec(bContext *C, wmOperator *op)
   Scene *scene = CTX_data_scene(C);
   RenderEngineType *re_type = RE_engines_find(scene->r.engine);
   ViewLayer *active_layer = CTX_data_view_layer(C);
-  ViewLayer *single_layer = NULL;
+  ViewLayer *single_layer = nullptr;
   Render *re;
   Image *ima;
   View3D *v3d = CTX_wm_view3d(C);
   Main *mainp = CTX_data_main(C);
   const bool is_animation = RNA_boolean_get(op->ptr, "animati

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list