diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-15 20:04:07 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-15 20:33:37 +0300 |
commit | 024f3ddf617f19b467b3948464fb2f9ba7e84951 (patch) | |
tree | f356f1c34e3ae4ba9ed927af0ed4d9e6d8002441 | |
parent | ee0c05e886d32f4bb9680cff41dc86eb2f464671 (diff) |
Cleanup: Clang tidy
9 files changed, 35 insertions, 39 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_material.cc b/source/blender/draw/engines/eevee_next/eevee_material.cc index 7452e5c26a4..5d4e2d7752d 100644 --- a/source/blender/draw/engines/eevee_next/eevee_material.cc +++ b/source/blender/draw/engines/eevee_next/eevee_material.cc @@ -281,9 +281,7 @@ Material &MaterialModule::material_sync(::Material *blender_mat, eMaterialGeomet if (ob->type == OB_VOLUME) { return BKE_material_default_volume(); } - else { - return BKE_material_default_surface(); - } + return BKE_material_default_surface(); } return ma; } diff --git a/source/blender/draw/engines/eevee_next/eevee_shader.cc b/source/blender/draw/engines/eevee_next/eevee_shader.cc index 39c5cf6a536..9efb7a70c7e 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shader.cc +++ b/source/blender/draw/engines/eevee_next/eevee_shader.cc @@ -190,7 +190,7 @@ void ShaderModule::material_create_info_ammend(GPUMaterial *gpumat, GPUCodegenOu const StageInterfaceInfo &iface = *info.vertex_out_interfaces_.first(); /* Globals the attrib_load() can write to when it is in the fragment shader. */ global_vars << "struct " << iface.name << " {\n"; - for (auto &inout : iface.inouts) { + for (const auto &inout : iface.inouts) { global_vars << " " << inout.type << " " << inout.name << ";\n"; } global_vars << "};\n"; diff --git a/source/blender/draw/engines/eevee_next/eevee_world.cc b/source/blender/draw/engines/eevee_next/eevee_world.cc index 939f6087137..b9cb24fe30a 100644 --- a/source/blender/draw/engines/eevee_next/eevee_world.cc +++ b/source/blender/draw/engines/eevee_next/eevee_world.cc @@ -64,19 +64,17 @@ void World::sync() // } ::World *bl_world = inst_.scene->world; - if (bl_world == nullptr) { // bl_world = BKE_world_default(); return; } - else { - WorldHandle &wo_handle = inst_.sync.sync_world(bl_world); - if (wo_handle.recalc != 0) { - // inst_.lightprobes.set_world_dirty(); - } - wo_handle.reset_recalc_flag(); + WorldHandle &wo_handle = inst_.sync.sync_world(bl_world); + + if (wo_handle.recalc != 0) { + // inst_.lightprobes.set_world_dirty(); } + wo_handle.reset_recalc_flag(); /* TODO(fclem) This should be detected to scene level. */ ::World *orig_world = (::World *)DEG_get_original_id(&bl_world->id); diff --git a/source/blender/draw/intern/draw_hair.cc b/source/blender/draw/intern/draw_hair.cc index 578c36e3245..0a3c16e0d71 100644 --- a/source/blender/draw/intern/draw_hair.cc +++ b/source/blender/draw/intern/draw_hair.cc @@ -35,7 +35,7 @@ # define USE_COMPUTE_SHADERS #endif -BLI_INLINE eParticleRefineShaderType drw_hair_shader_type_get(void) +BLI_INLINE eParticleRefineShaderType drw_hair_shader_type_get() { #ifdef USE_COMPUTE_SHADERS if (GPU_compute_shader_support() && GPU_shader_storage_buffer_objects_support()) { @@ -49,21 +49,21 @@ BLI_INLINE eParticleRefineShaderType drw_hair_shader_type_get(void) } #ifndef USE_TRANSFORM_FEEDBACK -typedef struct ParticleRefineCall { +struct ParticleRefineCall { struct ParticleRefineCall *next; GPUVertBuf *vbo; DRWShadingGroup *shgrp; uint vert_len; -} ParticleRefineCall; +}; -static ParticleRefineCall *g_tf_calls = NULL; +static ParticleRefineCall *g_tf_calls = nullptr; static int g_tf_id_offset; static int g_tf_target_width; static int g_tf_target_height; #endif -static GPUVertBuf *g_dummy_vbo = NULL; -static GPUTexture *g_dummy_texture = NULL; +static GPUVertBuf *g_dummy_vbo = nullptr; +static GPUTexture *g_dummy_texture = nullptr; static DRWPass *g_tf_pass; /* XXX can be a problem with multiple DRWManager in the future */ static GPUShader *hair_refine_shader_get(ParticleRefineShader refinement) @@ -79,7 +79,7 @@ void DRW_hair_init(void) g_tf_pass = DRW_pass_create("Update Hair Pass", DRW_STATE_WRITE_COLOR); #endif - if (g_dummy_vbo == NULL) { + if (g_dummy_vbo == nullptr) { /* initialize vertex format */ GPUVertFormat format = {0}; uint dummy_id = GPU_vertformat_attr_add(&format, "dummy", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); @@ -153,7 +153,7 @@ static void drw_hair_particle_cache_update_transform_feedback(ParticleHairCache #endif drw_hair_particle_cache_shgrp_attach_resources(tf_shgrp, cache, subdiv); - DRW_shgroup_call_procedural_points(tf_shgrp, NULL, final_points_len); + DRW_shgroup_call_procedural_points(tf_shgrp, nullptr, final_points_len); } } @@ -188,7 +188,7 @@ GPUVertBuf *DRW_hair_pos_buffer_get(Object *object, ParticleSystem *psys, Modifi int thickness_res = (scene->r.hair_type == SCE_HAIR_SHAPE_STRAND) ? 1 : 2; ParticleHairCache *cache = drw_hair_particle_cache_get( - object, psys, md, NULL, subdiv, thickness_res); + object, psys, md, nullptr, subdiv, thickness_res); return cache->final[subdiv].proc_buf; } @@ -201,11 +201,11 @@ void DRW_hair_duplimat_get(Object *object, Object *dupli_parent = DRW_object_get_dupli_parent(object); DupliObject *dupli_object = DRW_object_get_dupli(object); - if ((dupli_parent != NULL) && (dupli_object != NULL)) { + if ((dupli_parent != nullptr) && (dupli_object != nullptr)) { if (dupli_object->type & OB_DUPLICOLLECTION) { unit_m4(dupli_mat); Collection *collection = dupli_parent->instance_collection; - if (collection != NULL) { + if (collection != nullptr) { sub_v3_v3(dupli_mat[3], collection->instance_offset); } mul_m4_m4m4(dupli_mat, dupli_parent->obmat, dupli_mat); @@ -291,7 +291,7 @@ DRWShadingGroup *DRW_shgroup_hair_create_sub(Object *object, return shgrp; } -void DRW_hair_update(void) +void DRW_hair_update() { #ifndef USE_TRANSFORM_FEEDBACK /** @@ -304,7 +304,7 @@ void DRW_hair_update(void) * and the most local workaround that still uses the power of the GPU. */ - if (g_tf_calls == NULL) { + if (g_tf_calls == nullptr) { return; } @@ -324,7 +324,7 @@ void DRW_hair_update(void) g_tf_target_height = height; g_tf_target_width = width; - GPUFrameBuffer *fb = NULL; + GPUFrameBuffer *fb = nullptr; GPU_framebuffer_ensure_config(&fb, { GPU_ATTACHMENT_NONE, @@ -334,7 +334,7 @@ void DRW_hair_update(void) float *data = (float *)MEM_mallocN(sizeof(float[4]) * width * height, "tf fallback buffer"); GPU_framebuffer_bind(fb); - while (g_tf_calls != NULL) { + while (g_tf_calls != nullptr) { ParticleRefineCall *pr_call = g_tf_calls; g_tf_calls = g_tf_calls->next; diff --git a/source/blender/draw/intern/draw_shader.cc b/source/blender/draw/intern/draw_shader.cc index bdfd1a4fbc2..001ceb0ae8d 100644 --- a/source/blender/draw/intern/draw_shader.cc +++ b/source/blender/draw/intern/draw_shader.cc @@ -24,7 +24,7 @@ extern "C" char datatoc_gpu_shader_3D_smooth_color_frag_glsl[]; static struct { struct GPUShader *hair_refine_sh[PART_REFINE_MAX_SHADER]; -} e_data = {{NULL}}; +} e_data = {{nullptr}}; /* -------------------------------------------------------------------- */ /** \name Hair refinement @@ -38,14 +38,14 @@ static GPUShader *hair_refine_shader_compute_create(ParticleRefineShader UNUSED( static GPUShader *hair_refine_shader_transform_feedback_create( ParticleRefineShader UNUSED(refinement)) { - GPUShader *sh = NULL; + GPUShader *sh = nullptr; std::string shader_src = std::string(datatoc_common_hair_lib_glsl) + std::string(datatoc_common_hair_refine_vert_glsl); const char *var_names[1] = {"finalColor"}; sh = DRW_shader_create_with_transform_feedback(shader_src.c_str(), - NULL, + nullptr, "#define HAIR_PHASE_SUBDIV\n" "#define USE_TF\n", GPU_SHADER_TFB_POINTS, @@ -64,8 +64,8 @@ static GPUShader *hair_refine_shader_transform_feedback_workaround_create( GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement, eParticleRefineShaderType sh_type) { - if (e_data.hair_refine_sh[refinement] == NULL) { - GPUShader *sh = NULL; + if (e_data.hair_refine_sh[refinement] == nullptr) { + GPUShader *sh = nullptr; switch (sh_type) { case PART_REFINE_SHADER_COMPUTE: sh = hair_refine_shader_compute_create(refinement); @@ -88,8 +88,8 @@ GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement, GPUShader *DRW_shader_curves_refine_get(CurvesEvalShader type, eParticleRefineShaderType sh_type) { /* TODO: Implement curves evaluation types (Bezier and Catmull Rom). */ - if (e_data.hair_refine_sh[type] == NULL) { - GPUShader *sh = NULL; + if (e_data.hair_refine_sh[type] == nullptr) { + GPUShader *sh = nullptr; switch (sh_type) { case PART_REFINE_SHADER_COMPUTE: sh = hair_refine_shader_compute_create(PART_REFINE_CATMULL_ROM); @@ -111,7 +111,7 @@ GPUShader *DRW_shader_curves_refine_get(CurvesEvalShader type, eParticleRefineSh /** \} */ -void DRW_shaders_free(void) +void DRW_shaders_free() { for (int i = 0; i < PART_REFINE_MAX_SHADER; i++) { DRW_SHADER_FREE_SAFE(e_data.hair_refine_sh[i]); diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc index db523651534..c56f59259a2 100644 --- a/source/blender/editors/space_node/node_select.cc +++ b/source/blender/editors/space_node/node_select.cc @@ -709,7 +709,7 @@ void NODE_OT_select(wmOperatorType *ot) prop = RNA_def_int_vector(ot->srna, "location", 2, - NULL, + nullptr, INT_MIN, INT_MAX, "Location", diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index 57b0e2022ff..d165e98d7d4 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -1818,7 +1818,7 @@ static void outliner_draw_overrides_rna_buts(uiBlock *block, te->ys + pad_y, item_max_width, item_height, - NULL, + nullptr, 0.0f, 0.0f, 0.0f, diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index e23bb1f7a4f..1230515a180 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -312,7 +312,7 @@ float ED_view3d_calc_depth_for_comparison(const RegionView3D *rv3d, const float return -dot_v3v3(rv3d->viewinv[2], co); } -static void view3d_win_to_ray_segment(struct Depsgraph *depsgraph, +static void view3d_win_to_ray_segment(const struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], diff --git a/source/blender/modifiers/intern/MOD_particlesystem.cc b/source/blender/modifiers/intern/MOD_particlesystem.cc index 0f75038189a..c6a606360e3 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.cc +++ b/source/blender/modifiers/intern/MOD_particlesystem.cc @@ -5,8 +5,8 @@ * \ingroup modifiers */ -#include <stddef.h> -#include <string.h> +#include <cstddef> +#include <cstring> #include "BLI_utildefines.h" |