Cleanup: Various clang-tidy warnings in compositor

Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
Brecht Van Lommel
2025-01-26 20:08:03 +01:00
parent 3725fad82f
commit 1eb1755e1f
48 changed files with 34 additions and 112 deletions

View File

@@ -4,7 +4,6 @@
#pragma once
#include "DNA_color_types.h"
#include "DNA_node_types.h"
namespace blender::compositor {

View File

@@ -12,7 +12,6 @@
#include "DNA_vec_types.h"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "COM_domain.hh"
#include "COM_meta_data.hh"

View File

@@ -143,7 +143,6 @@ class Domain {
* RealizationOptions struct for more information. */
RealizationOptions realization_options;
public:
/* A size only constructor that sets the transformation to identity. */
Domain(const int2 &size);

View File

@@ -8,15 +8,12 @@
#include "BLI_vector.hh"
#include "DNA_node_types.h"
#include "NOD_derived_node_tree.hh"
#include "COM_compile_state.hh"
#include "COM_context.hh"
#include "COM_node_operation.hh"
#include "COM_operation.hh"
#include "COM_shader_operation.hh"
namespace blender::compositor {

View File

@@ -7,9 +7,7 @@
#include <memory>
#include "BLI_map.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "BLI_vector_set.hh"
#include "FN_multi_function_procedure.hh"
#include "FN_multi_function_procedure_builder.hh"
@@ -19,7 +17,6 @@
#include "NOD_multi_function.hh"
#include "COM_context.hh"
#include "COM_operation.hh"
#include "COM_pixel_operation.hh"
#include "COM_scheduler.hh"

View File

@@ -9,8 +9,6 @@
#include "DNA_node_types.h"
#include "NOD_derived_node_tree.hh"
namespace blender::compositor {
class Context;

View File

@@ -4,8 +4,6 @@
#pragma once
#include "GPU_shader.hh"
#include "COM_context.hh"
#include "COM_domain.hh"
#include "COM_input_descriptor.hh"

View File

@@ -8,7 +8,6 @@
#include <utility>
#include "BLI_assert.h"
#include "BLI_math_base.hh"
#include "BLI_math_interp.hh"
#include "BLI_math_matrix_types.hh"
#include "BLI_math_vector.h"
@@ -178,7 +177,6 @@ class Result {
* written to file. */
MetaData meta_data;
public:
/* Construct a result within the given context. */
Result(Context &context);

View File

@@ -7,8 +7,6 @@
#include <memory>
#include "BLI_map.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector_set.hh"
#include "GPU_material.hh"
#include "GPU_shader.hh"
@@ -18,7 +16,6 @@
#include "NOD_derived_node_tree.hh"
#include "COM_context.hh"
#include "COM_operation.hh"
#include "COM_pixel_operation.hh"
#include "COM_scheduler.hh"
@@ -73,7 +70,7 @@ class ShaderOperation : public PixelOperation {
ShaderOperation(Context &context, PixelCompileUnit &compile_unit, const Schedule &schedule);
/* Free the GPU material. */
~ShaderOperation();
~ShaderOperation() override;
/* Allocate the output results, bind the shader and all its needed resources, then dispatch the
* shader. */

View File

@@ -4,7 +4,6 @@
#include "BLI_index_range.hh"
#include "BLI_math_color.h"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_task.hh"
@@ -14,6 +13,7 @@
#include "IMB_imbuf.hh"
#include "GPU_shader.hh"
#include "GPU_state.hh"
#include "GPU_texture.hh"
#include "BKE_node.hh"
@@ -116,9 +116,7 @@ static int2 compute_preview_size(int2 size)
if (size.x > size.y) {
return int2(greater_dimension_size, int(greater_dimension_size * (float(size.y) / size.x)));
}
else {
return int2(int(greater_dimension_size * (float(size.x) / size.y)), greater_dimension_size);
}
return int2(int(greater_dimension_size * (float(size.x) / size.y)), greater_dimension_size);
}
void compute_preview(Context &context, const DNode &node, const Result &input_result)

View File

@@ -3,7 +3,6 @@
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_assert.h"
#include "BLI_math_base.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_types.hh"

View File

@@ -2,9 +2,6 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_index_range.hh"
#include "BLI_task.hh"
#include "GPU_shader.hh"
#include "COM_context.hh"

View File

@@ -2,8 +2,6 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_math_base.hh"
#include "GPU_shader.hh"
#include "COM_context.hh"

View File

@@ -8,7 +8,6 @@
#include "BLI_math_vector_types.hh"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "COM_context.hh"
#include "COM_result.hh"

View File

@@ -6,7 +6,6 @@
#include "BLI_math_vector_types.hh"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "COM_algorithm_morphological_distance_feather.hh"
#include "COM_context.hh"

View File

@@ -15,6 +15,7 @@
#include "GPU_compute.hh"
#include "GPU_shader.hh"
#include "GPU_state.hh"
#include "GPU_texture.hh"
#include "COM_context.hh"

View File

@@ -2,7 +2,6 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_math_base.hh"
#include "BLI_math_vector.hh"
#include "COM_context.hh"

View File

@@ -9,7 +9,6 @@
#include "BLI_assert.h"
#include "BLI_math_vector.hh"
#include "BLI_smaa_textures.h"
#include "IMB_colormanagement.hh"
@@ -1283,8 +1282,9 @@ static float4 SMAABlendingWeightCalculationPS(float2 texcoord,
#if !defined(SMAA_DISABLE_DIAG_DETECTION)
}
else
else {
e.x = 0.0f; /* Skip vertical processing. */
}
#endif
}
@@ -1377,36 +1377,35 @@ static float4 SMAANeighborhoodBlendingPS(float2 texcoord,
return color;
}
else {
bool h = math::max(a.x, a.z) > math::max(a.y, a.w); /* `max(horizontal) > max(vertical)`. */
/* Calculate the blending offsets: */
float4 blendingOffset = float4(0.0f, a.y, 0.0f, a.w);
float2 blendingWeight = float2(a.y, a.w);
SMAAMovc(float4(h), blendingOffset, float4(a.x, 0.0f, a.z, 0.0f));
SMAAMovc(float2(h), blendingWeight, float2(a.x, a.z));
blendingWeight /= math::dot(blendingWeight, float2(1.0f, 1.0f));
bool h = math::max(a.x, a.z) > math::max(a.y, a.w); /* `max(horizontal) > max(vertical)`. */
/* Calculate the texture coordinates: */
float4 blendingCoord = float4(texcoord, texcoord) + blendingOffset / float4(size, -size);
/* Calculate the blending offsets: */
float4 blendingOffset = float4(0.0f, a.y, 0.0f, a.w);
float2 blendingWeight = float2(a.y, a.w);
SMAAMovc(float4(h), blendingOffset, float4(a.x, 0.0f, a.z, 0.0f));
SMAAMovc(float2(h), blendingWeight, float2(a.x, a.z));
blendingWeight /= math::dot(blendingWeight, float2(1.0f, 1.0f));
/* We exploit bilinear filtering to mix current pixel with the chosen neighbor: */
float4 color = blendingWeight.x * SMAASampleLevelZero(colorTex, blendingCoord.xy());
color += blendingWeight.y * SMAASampleLevelZero(colorTex, blendingCoord.zw());
/* Calculate the texture coordinates: */
float4 blendingCoord = float4(texcoord, texcoord) + blendingOffset / float4(size, -size);
/* We exploit bilinear filtering to mix current pixel with the chosen neighbor: */
float4 color = blendingWeight.x * SMAASampleLevelZero(colorTex, blendingCoord.xy());
color += blendingWeight.y * SMAASampleLevelZero(colorTex, blendingCoord.zw());
#if SMAA_REPROJECTION
/* Anti-alias velocity for proper reprojection in a later stage: */
float2 velocity = blendingWeight.x *
SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, blendingCoord.xy()));
velocity += blendingWeight.y *
SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, blendingCoord.zw()));
/* Anti-alias velocity for proper reprojection in a later stage: */
float2 velocity = blendingWeight.x *
SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, blendingCoord.xy()));
velocity += blendingWeight.y *
SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, blendingCoord.zw()));
/* Pack velocity into the alpha channel: */
color.a = math::sqrt(5.0f * math::length(velocity));
/* Pack velocity into the alpha channel: */
color.a = math::sqrt(5.0f * math::length(velocity));
#endif
return color;
}
return color;
}
static float3 get_luminance_coefficients(ResultType type)

View File

@@ -4,18 +4,15 @@
#include "BLI_assert.h"
#include "BLI_index_range.hh"
#include "BLI_math_base.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_task.hh"
#include "GPU_compute.hh"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "COM_context.hh"
#include "COM_result.hh"
#include "COM_utilities.hh"
#include "COM_algorithm_summed_area_table.hh"

View File

@@ -8,7 +8,6 @@
#include "BLI_math_vector_types.hh"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "COM_context.hh"
#include "COM_result.hh"

View File

@@ -3,8 +3,6 @@
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_assert.h"
#include "BLI_math_base.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_types.hh"
#include "GPU_shader.hh"

View File

@@ -3,7 +3,6 @@
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_assert.h"
#include "BLI_math_base.hh"
#include "BLI_math_vector.hh"
#include "GPU_shader.hh"

View File

@@ -46,7 +46,6 @@ class BokehKernel : public CachedResource {
public:
Result result;
public:
BokehKernel(Context &context,
int2 size,
int sides,

View File

@@ -12,7 +12,6 @@
#include "BLI_math_vector_types.hh"
#include "DNA_mask_types.h"
#include "DNA_scene_types.h"
#include "COM_cached_resource.hh"
#include "COM_result.hh"
@@ -55,7 +54,6 @@ class CachedMask : public CachedResource {
public:
Result result;
public:
CachedMask(Context &context,
Mask *mask,
int2 size,

View File

@@ -50,7 +50,6 @@ class CachedTexture : public CachedResource {
Result color_result;
Result value_result;
public:
CachedTexture(Context &context,
Tex *texture,
bool use_color_management,

View File

@@ -58,7 +58,6 @@ class DistortionGrid : public CachedResource {
public:
Result result;
public:
/* The calibration size is the size of the image where the tracking camera was calibrated, this
* is the size of the movie clip in most cases. */
DistortionGrid(Context &context,

View File

@@ -45,7 +45,6 @@ class KeyingScreen : public CachedResource {
public:
Result result;
public:
KeyingScreen(Context &context,
MovieClip *movie_clip,
MovieTrackingObject *movie_tracking_object,

View File

@@ -50,7 +50,6 @@ class MorphologicalDistanceFeatherWeights : public CachedResource {
Result weights_result;
Result falloffs_result;
public:
MorphologicalDistanceFeatherWeights(Context &context, int type, int radius);
~MorphologicalDistanceFeatherWeights();

View File

@@ -47,7 +47,6 @@ class SymmetricBlurWeights : public CachedResource {
public:
Result result;
public:
SymmetricBlurWeights(Context &context, int type, float2 radius);
~SymmetricBlurWeights();

View File

@@ -9,7 +9,6 @@
#include "BLI_array.hh"
#include "BLI_map.hh"
#include "BLI_math_vector_types.hh"
#include "COM_cached_resource.hh"
#include "COM_result.hh"
@@ -53,7 +52,6 @@ class SymmetricSeparableBlurWeights : public CachedResource {
public:
Result result;
public:
SymmetricSeparableBlurWeights(Context &context, int type, float radius);
~SymmetricSeparableBlurWeights();

View File

@@ -6,8 +6,6 @@
#include <memory>
#include <string>
#include "BLI_array.hh"
#include "BLI_assert.h"
#include "BLI_hash.hh"
#include "BLI_listbase.h"
#include "BLI_string_ref.hh"

View File

@@ -7,9 +7,7 @@
#include "BLI_array.hh"
#include "BLI_hash.hh"
#include "BLI_index_range.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_task.hh"
#include "GPU_texture.hh"

View File

@@ -9,7 +9,6 @@
#include "BLI_hash.hh"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "COM_cached_shader.hh"
#include "COM_result.hh"

View File

@@ -18,7 +18,6 @@
#include "BKE_texture.h"
#include "DNA_ID.h"
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "RE_texture.h"
@@ -26,7 +25,6 @@
#include "COM_cached_texture.hh"
#include "COM_context.hh"
#include "COM_result.hh"
#include "COM_utilities.hh"
namespace blender::compositor {

View File

@@ -7,9 +7,7 @@
#include "BLI_array.hh"
#include "BLI_hash.hh"
#include "BLI_index_range.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_task.hh"
#include "DNA_defaults.h"
#include "DNA_movieclip_types.h"

View File

@@ -22,7 +22,6 @@
#include "GPU_shader.hh"
#include "GPU_storage_buffer.hh"
#include "GPU_texture.hh"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"

View File

@@ -12,6 +12,7 @@
# include "MEM_guardedalloc.h"
# include "GPU_state.hh"
# include "GPU_texture.hh"
# include "COM_context.hh"

View File

@@ -8,7 +8,6 @@
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_scene.hh"
#include "COM_compositor.hh"

View File

@@ -32,12 +32,12 @@ const Schedule &CompileState::get_schedule()
void CompileState::map_node_to_node_operation(DNode node, NodeOperation *operations)
{
return node_operations_.add_new(node, operations);
node_operations_.add_new(node, operations);
}
void CompileState::map_node_to_pixel_operation(DNode node, PixelOperation *operations)
{
return pixel_operations_.add_new(node, operations);
pixel_operations_.add_new(node, operations);
}
Result &CompileState::get_result_from_output_socket(DOutputSocket output)

View File

@@ -2,8 +2,6 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include <string>
#include "DNA_node_types.h"
#include "NOD_derived_node_tree.hh"

View File

@@ -28,7 +28,6 @@
#include "NOD_derived_node_tree.hh"
#include "NOD_multi_function.hh"
#include "NOD_node_declaration.hh"
#include "COM_context.hh"
#include "COM_domain.hh"

View File

@@ -2,24 +2,13 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include <memory>
#include "BLI_assert.h"
#include "BLI_map.hh"
#include "BLI_math_base.h"
#include "BLI_math_base.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_string_ref.hh"
#include "BLI_timeit.hh"
#include "BLI_vector.hh"
#include "GPU_shader.hh"
#include "GPU_texture.hh"
#include "DNA_node_types.h"
#include "NOD_derived_node_tree.hh"
#include "NOD_node_declaration.hh"
#include "BKE_node.hh"

View File

@@ -7,7 +7,6 @@
#include "BLI_map.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "COM_context.hh"
#include "COM_conversion_operation.hh"

View File

@@ -10,7 +10,6 @@
#include "NOD_derived_node_tree.hh"
#include "COM_context.hh"
#include "COM_profiler.hh"
namespace blender::compositor {

View File

@@ -6,7 +6,6 @@
#include "BLI_assert.h"
#include "BLI_math_matrix_types.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "GPU_shader.hh"

View File

@@ -2,16 +2,16 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include <algorithm>
#include "BLI_map.hh"
#include "BLI_set.hh"
#include "BLI_stack.hh"
#include "BLI_vector.hh"
#include "BLI_vector_set.hh"
#include "NOD_derived_node_tree.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "COM_context.hh"
#include "COM_scheduler.hh"
@@ -255,9 +255,8 @@ static NeededBuffers compute_number_of_needed_buffers(Stack<DNode> &output_nodes
* buffers needed by the dependencies, then update the latter to be the former. This is
* computing the "d" in the aforementioned equation "max(n + m, d)". */
const int buffers_needed_by_dependency = needed_buffers.lookup(doutput.node());
if (buffers_needed_by_dependency > buffers_needed_by_dependencies) {
buffers_needed_by_dependencies = buffers_needed_by_dependency;
}
buffers_needed_by_dependencies = std::max(buffers_needed_by_dependency,
buffers_needed_by_dependencies);
}
/* Compute the number of buffers that will be computed/output by this node. */

View File

@@ -9,7 +9,6 @@
#include "BLI_listbase.h"
#include "BLI_map.hh"
#include "BLI_string_ref.hh"
#include "BLI_utildefines.h"
#include "DNA_customdata_types.h"
@@ -22,7 +21,6 @@
#include "gpu_shader_create_info.hh"
#include "NOD_derived_node_tree.hh"
#include "NOD_node_declaration.hh"
#include "COM_context.hh"
#include "COM_pixel_operation.hh"

View File

@@ -5,7 +5,6 @@
#include "BLI_assert.h"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_utildefines.h"
#include "DNA_node_types.h"
@@ -15,7 +14,6 @@
#include "GPU_compute.hh"
#include "GPU_shader.hh"
#include "COM_operation.hh"
#include "COM_result.hh"
#include "COM_utilities.hh"