Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init

Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
This commit is contained in:
Rémi Verschelde 2022-05-02 16:28:25 +02:00
parent dd06cb90c5
commit c273ddc3ee
156 changed files with 749 additions and 951 deletions

View file

@ -211,15 +211,6 @@ float AudioFilterSW::get_response(float p_freq, Coeffs *p_coeffs) {
return H;
}
AudioFilterSW::AudioFilterSW() {
sampling_rate = 44100;
resonance = 0.5;
cutoff = 5000;
gain = 1.0;
mode = LOWPASS;
stages = 1;
}
AudioFilterSW::Processor::Processor() {
set_filter(nullptr);
}

View file

@ -36,11 +36,11 @@
class AudioFilterSW {
public:
struct Coeffs {
float a1, a2;
float b0, b1, b2;
//bool operator==(const Coeffs &p_rv) { return (FLOATS_EQ(a1,p_rv.a1) && FLOATS_EQ(a2,p_rv.a2) && FLOATS_EQ(b1,p_rv.b1) && FLOATS_EQ(b2,p_rv.b2) && FLOATS_EQ(b0,p_rv.b0) ); }
Coeffs() { a1 = a2 = b0 = b1 = b2 = 0.0; }
float a1 = 0.0f;
float a2 = 0.0f;
float b0 = 0.0f;
float b1 = 0.0f;
float b2 = 0.0f;
};
enum Mode {
@ -52,14 +52,16 @@ public:
BANDLIMIT,
LOWSHELF,
HIGHSHELF
};
class Processor { // simple filter processor
class Processor { // Simple filter processor.
AudioFilterSW *filter = nullptr;
Coeffs coeffs;
float ha1, ha2, hb1, hb2; //history
// History.
float ha1 = 0.0f;
float ha2 = 0.0f;
float hb1 = 0.0f;
float hb2 = 0.0f;
Coeffs incr_coeffs;
public:
@ -73,12 +75,12 @@ public:
};
private:
float cutoff;
float resonance;
float gain;
float sampling_rate;
int stages;
Mode mode;
float cutoff = 5000.0f;
float resonance = 0.5f;
float gain = 1.0f;
float sampling_rate = 44100.0f;
int stages = 1;
Mode mode = LOWPASS;
public:
float get_response(float p_freq, Coeffs *p_coeffs);
@ -92,7 +94,7 @@ public:
void prepare_coefficients(Coeffs *p_coeffs);
AudioFilterSW();
AudioFilterSW() {}
};
/* inline methods */

View file

@ -709,10 +709,7 @@ void AudioStreamRandomizer::_bind_methods() {
BIND_ENUM_CONSTANT(PLAYBACK_SEQUENTIAL);
}
AudioStreamRandomizer::AudioStreamRandomizer() {
random_pitch_scale = 1.1;
random_volume_offset_db = 5;
}
AudioStreamRandomizer::AudioStreamRandomizer() {}
void AudioStreamPlaybackRandomizer::start(float p_from_pos) {
playing = playback;

View file

@ -78,7 +78,7 @@ class AudioStreamPlaybackResampled : public AudioStreamPlayback {
AudioFrame internal_buffer[INTERNAL_BUFFER_LEN + CUBIC_INTERP_HISTORY];
unsigned int internal_buffer_end = -1;
uint64_t mix_offset;
uint64_t mix_offset = 0;
protected:
void begin_resample();
@ -145,8 +145,8 @@ class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlaybackResampled);
friend class AudioStreamMicrophone;
bool active;
unsigned int input_ofs;
bool active = false;
unsigned int input_ofs = 0;
Ref<AudioStreamMicrophone> microphone;
@ -194,8 +194,8 @@ private:
Set<AudioStreamPlaybackRandomizer *> playbacks;
Vector<PoolEntry> audio_stream_pool;
float random_pitch_scale;
float random_volume_offset_db;
float random_pitch_scale = 1.1f;
float random_volume_offset_db = 5.0f;
Ref<AudioStreamPlayback> instance_playback_random();
Ref<AudioStreamPlayback> instance_playback_no_repeats();

View file

@ -29,7 +29,9 @@
/*************************************************************************/
#include "audio_effect_stereo_enhance.h"
#include "servers/audio_server.h"
void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
float intensity = base->pan_pullout;
bool surround_mode = base->surround > 0;
@ -140,8 +142,4 @@ void AudioEffectStereoEnhance::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "surround", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_surround", "get_surround");
}
AudioEffectStereoEnhance::AudioEffectStereoEnhance() {
pan_pullout = 1;
time_pullout = 0;
surround = 0;
}
AudioEffectStereoEnhance::AudioEffectStereoEnhance() {}

View file

@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef AUDIOEFFECTSTEREOENHANCE_H
#define AUDIOEFFECTSTEREOENHANCE_H
#ifndef AUDIO_EFFECT_STEREO_ENHANCE_H
#define AUDIO_EFFECT_STEREO_ENHANCE_H
#include "servers/audio/audio_effect.h"
@ -45,8 +45,8 @@ class AudioEffectStereoEnhanceInstance : public AudioEffectInstance {
};
float *delay_ringbuff = nullptr;
unsigned int ringbuff_pos;
unsigned int ringbuff_mask;
unsigned int ringbuff_pos = 0;
unsigned int ringbuff_mask = 0;
public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) override;
@ -58,11 +58,11 @@ class AudioEffectStereoEnhance : public AudioEffect {
GDCLASS(AudioEffectStereoEnhance, AudioEffect);
friend class AudioEffectStereoEnhanceInstance;
float volume_db;
float volume_db = 0.0f;
float pan_pullout;
float time_pullout;
float surround;
float pan_pullout = 1.0f;
float time_pullout = 0.0f;
float surround = 0.0f;
protected:
static void _bind_methods();
@ -82,4 +82,4 @@ public:
AudioEffectStereoEnhance();
};
#endif // AUDIOEFFECTSTEREOENHANCE_H
#endif // AUDIO_EFFECT_STEREO_ENHANCE_H

View file

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
// Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006
#include "reverb.h"
#include "core/math/math_funcs.h"

View file

@ -77,10 +77,11 @@ private:
AllPass allpass[MAX_ALLPASS];
float *input_buffer = nullptr;
float *echo_buffer = nullptr;
int echo_buffer_size;
int echo_buffer_pos;
int echo_buffer_size = 0;
int echo_buffer_pos = 0;
float hpf_h1, hpf_h2 = 0;
float hpf_h1 = 0.0f;
float hpf_h2 = 0.0f;
struct Parameters {
float room_size;

View file

@ -164,17 +164,6 @@ Array AudioDriver::capture_get_device_list() {
return list;
}
AudioDriver::AudioDriver() {
_last_mix_time = 0;
_last_mix_frames = 0;
input_position = 0;
input_size = 0;
#ifdef DEBUG_ENABLED
prof_time = 0;
#endif
}
AudioDriverDummy AudioDriverManager::dummy_driver;
AudioDriver *AudioDriverManager::drivers[MAX_DRIVERS] = {
&AudioDriverManager::dummy_driver,
@ -1748,15 +1737,6 @@ void AudioServer::_bind_methods() {
AudioServer::AudioServer() {
singleton = this;
mix_frames = 0;
channel_count = 0;
to_mix = 0;
#ifdef DEBUG_ENABLED
prof_time = 0;
#endif
mix_time = 0;
mix_size = 0;
playback_speed_scale = 1;
}
AudioServer::~AudioServer() {

View file

@ -48,18 +48,18 @@ class AudioStreamPlayback;
class AudioDriver {
static AudioDriver *singleton;
uint64_t _last_mix_time;
uint64_t _last_mix_frames;
uint64_t _last_mix_time = 0;
uint64_t _last_mix_frames = 0;
#ifdef DEBUG_ENABLED
uint64_t prof_ticks;
uint64_t prof_time;
uint64_t prof_ticks = 0;
uint64_t prof_time = 0;
#endif
protected:
Vector<int32_t> input_buffer;
unsigned int input_position;
unsigned int input_size;
unsigned int input_position = 0;
unsigned int input_size = 0;
void audio_server_process(int p_frames, int32_t *p_buffer, bool p_update_mix_time = true);
void update_mix_time(int p_frames);
@ -121,7 +121,7 @@ public:
void reset_profiling_time() { prof_time = 0; }
#endif
AudioDriver();
AudioDriver() {}
virtual ~AudioDriver() {}
};
@ -169,66 +169,61 @@ public:
typedef void (*AudioCallback)(void *p_userdata);
private:
uint64_t mix_time;
int mix_size;
uint64_t mix_time = 0;
int mix_size = 0;
uint32_t buffer_size;
uint64_t mix_count;
uint64_t mix_frames;
uint32_t buffer_size = 0;
uint64_t mix_count = 0;
uint64_t mix_frames = 0;
#ifdef DEBUG_ENABLED
uint64_t prof_time;
uint64_t prof_time = 0;
#endif
float channel_disable_threshold_db;
uint32_t channel_disable_frames;
float channel_disable_threshold_db = 0.0f;
uint32_t channel_disable_frames = 0;
int channel_count;
int to_mix;
int channel_count = 0;
int to_mix = 0;
float playback_speed_scale;
float playback_speed_scale = 1.0f;
struct Bus {
StringName name;
bool solo;
bool mute;
bool bypass;
bool solo = false;
bool mute = false;
bool bypass = false;
bool soloed;
bool soloed = false;
//Each channel is a stereo pair.
// Each channel is a stereo pair.
struct Channel {
bool used;
bool active;
AudioFrame peak_volume;
bool used = false;
bool active = false;
AudioFrame peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
Vector<AudioFrame> buffer;
Vector<Ref<AudioEffectInstance>> effect_instances;
uint64_t last_mix_with_audio;
Channel() {
last_mix_with_audio = 0;
used = false;
active = false;
peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
}
uint64_t last_mix_with_audio = 0;
Channel() {}
};
Vector<Channel> channels;
struct Effect {
Ref<AudioEffect> effect;
bool enabled;
bool enabled = false;
#ifdef DEBUG_ENABLED
uint64_t prof_time;
uint64_t prof_time = 0;
#endif
};
Vector<Effect> effects;
float volume_db;
float volume_db = 0.0f;
StringName send;
int index_cache;
int index_cache = 0;
};
struct AudioStreamPlaybackBusDetails {
bool bus_active[MAX_BUSES_PER_PLAYBACK] = { false, false, false, false, false, false };
bool bus_active[MAX_BUSES_PER_PLAYBACK] = {};
StringName bus[MAX_BUSES_PER_PLAYBACK];
AudioFrame volume[MAX_BUSES_PER_PLAYBACK][MAX_CHANNELS_PER_BUS];
};
@ -312,7 +307,7 @@ public:
ERR_FAIL_V(1);
}
//do not use from outside audio thread
// Do not use from outside audio thread.
bool thread_has_channel_mix_buffer(int p_bus, int p_buffer) const;
AudioFrame *thread_get_channel_mix_buffer(int p_bus, int p_buffer);
int thread_get_mix_buffer_size() const;
@ -442,26 +437,21 @@ class AudioBusLayout : public Resource {
struct Bus {
StringName name;
bool solo;
bool mute;
bool bypass;
bool solo = false;
bool mute = false;
bool bypass = false;
struct Effect {
Ref<AudioEffect> effect;
bool enabled;
bool enabled = false;
};
Vector<Effect> effects;
float volume_db;
float volume_db = 0.0f;
StringName send;
Bus() {
solo = false;
mute = false;
bypass = false;
volume_db = 0;
}
Bus() {}
};
Vector<Bus> buses;

View file

@ -140,7 +140,7 @@ struct _ConcaveCollisionInfo2D {
Vector2 motion_B;
real_t margin_A = 0.0;
real_t margin_B = 0.0;
GodotCollisionSolver2D::CallbackResult result_callback;
GodotCollisionSolver2D::CallbackResult result_callback = nullptr;
void *userdata = nullptr;
bool swap_result = false;
bool collided = false;

View file

@ -33,7 +33,7 @@
#include "core/math/geometry_2d.h"
struct _CollectorCallback2D {
GodotCollisionSolver2D::CallbackResult callback;
GodotCollisionSolver2D::CallbackResult callback = nullptr;
void *userdata = nullptr;
bool swap = false;
bool collided = false;

View file

@ -113,7 +113,7 @@ struct MinkowskiDiff {
real_t margin_A = 0.0;
real_t margin_B = 0.0;
Vector3 (*get_support)(const GodotShape3D*, const Vector3&, real_t);
Vector3 (*get_support)(const GodotShape3D*, const Vector3&, real_t) = nullptr;
void Initialize(const GodotShape3D* shape0, const Transform3D& wtrs0, const real_t margin0,
const GodotShape3D* shape1, const Transform3D& wtrs1, const real_t margin1) {
@ -191,13 +191,13 @@ struct GJK
/* Fields */
tShape m_shape;
Vector3 m_ray;
real_t m_distance;
real_t m_distance = 0.0f;
sSimplex m_simplices[2];
sSV m_store[4];
sSV* m_free[4];
U m_nfree;
U m_current;
sSimplex* m_simplex;
U m_nfree = 0;
U m_current = 0;
sSimplex* m_simplex = nullptr;
eStatus::_ m_status;
/* Methods */
GJK()
@ -548,12 +548,12 @@ struct GJK
struct sFace
{
Vector3 n;
real_t d;
real_t d = 0.0f;
sSV* c[3];
sFace* f[3];
sFace* l[2];
U1 e[3];
U1 pass;
U1 pass = 0;
};
struct sList
{
@ -583,10 +583,10 @@ struct GJK
eStatus::_ m_status;
GJK::sSimplex m_result;
Vector3 m_normal;
real_t m_depth;
real_t m_depth = 0.0f;
sSV m_sv_store[EPA_MAX_VERTICES];
sFace m_fc_store[EPA_MAX_FACES];
U m_nextsv;
U m_nextsv = 0;
sList m_hull;
sList m_stock;
/* Methods */

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "godot_collision_solver_3d.h"
#include "godot_collision_solver_3d_sat.h"
#include "godot_soft_body_3d.h"
@ -276,19 +277,20 @@ bool GodotCollisionSolver3D::solve_soft_body(const GodotShape3D *p_shape_A, cons
}
struct _ConcaveCollisionInfo {
const Transform3D *transform_A;
const GodotShape3D *shape_A;
const Transform3D *transform_B;
GodotCollisionSolver3D::CallbackResult result_callback;
void *userdata;
bool swap_result;
bool collided;
int aabb_tests;
int collisions;
bool tested;
real_t margin_A;
real_t margin_B;
Vector3 close_A, close_B;
const Transform3D *transform_A = nullptr;
const GodotShape3D *shape_A = nullptr;
const Transform3D *transform_B = nullptr;
GodotCollisionSolver3D::CallbackResult result_callback = nullptr;
void *userdata = nullptr;
bool swap_result = false;
bool collided = false;
int aabb_tests = 0;
int collisions = 0;
bool tested = false;
real_t margin_A = 0.0f;
real_t margin_B = 0.0f;
Vector3 close_A;
Vector3 close_B;
};
bool GodotCollisionSolver3D::concave_callback(void *p_userdata, GodotShape3D *p_convex) {

View file

@ -68,7 +68,7 @@
*************************************************************************/
struct _CollectorCallback {
GodotCollisionSolver3D::CallbackResult callback;
GodotCollisionSolver3D::CallbackResult callback = nullptr;
void *userdata = nullptr;
bool swap = false;
bool collided = false;

View file

@ -1438,7 +1438,7 @@ Vector3 GodotConcavePolygonShape3D::get_moment_of_inertia(real_t p_mass) const {
struct _Volume_BVH_Element {
AABB aabb;
Vector3 center;
int face_index;
int face_index = 0;
};
struct _Volume_BVH_CompareX {
@ -1461,10 +1461,10 @@ struct _Volume_BVH_CompareZ {
struct _Volume_BVH {
AABB aabb;
_Volume_BVH *left;
_Volume_BVH *right;
_Volume_BVH *left = nullptr;
_Volume_BVH *right = nullptr;
int face_index;
int face_index = 0;
};
_Volume_BVH *_volume_build_bvh(_Volume_BVH_Element *p_elements, int p_size, int &count) {

View file

@ -452,8 +452,6 @@ RS::ShaderNativeSourceCode SceneShaderForwardClustered::ShaderData::get_native_s
SceneShaderForwardClustered::ShaderData::ShaderData() :
shader_list_element(this) {
valid = false;
uses_screen_texture = false;
}
SceneShaderForwardClustered::ShaderData::~ShaderData() {

View file

@ -130,9 +130,9 @@ public:
ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE
};
bool valid;
bool valid = false;
RID version;
uint32_t vertex_input_mask;
uint32_t vertex_input_mask = 0;
PipelineCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][PIPELINE_VERSION_MAX];
PipelineCacheRD color_pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][PIPELINE_COLOR_PASS_FLAG_COUNT];
@ -142,7 +142,7 @@ public:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
uint32_t ubo_size;
uint32_t ubo_size = 0;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
@ -150,28 +150,28 @@ public:
DepthDraw depth_draw;
DepthTest depth_test;
bool uses_point_size;
bool uses_alpha;
bool uses_blend_alpha;
bool uses_alpha_clip;
bool uses_depth_pre_pass;
bool uses_discard;
bool uses_roughness;
bool uses_normal;
bool uses_particle_trails;
bool uses_point_size = false;
bool uses_alpha = false;
bool uses_blend_alpha = false;
bool uses_alpha_clip = false;
bool uses_depth_pre_pass = false;
bool uses_discard = false;
bool uses_roughness = false;
bool uses_normal = false;
bool uses_particle_trails = false;
bool unshaded;
bool uses_vertex;
bool uses_position;
bool uses_sss;
bool uses_transmittance;
bool uses_screen_texture;
bool uses_depth_texture;
bool uses_normal_texture;
bool uses_time;
bool writes_modelview_or_projection;
bool uses_world_coordinates;
Cull cull_mode;
bool unshaded = false;
bool uses_vertex = false;
bool uses_position = false;
bool uses_sss = false;
bool uses_transmittance = false;
bool uses_screen_texture = false;
bool uses_depth_texture = false;
bool uses_normal_texture = false;
bool uses_time = false;
bool writes_modelview_or_projection = false;
bool uses_world_coordinates = false;
Cull cull_mode = CULL_DISABLED;
uint64_t last_pass = 0;
uint32_t index = 0;

View file

@ -415,8 +415,6 @@ RS::ShaderNativeSourceCode SceneShaderForwardMobile::ShaderData::get_native_sour
SceneShaderForwardMobile::ShaderData::ShaderData() :
shader_list_element(this) {
valid = false;
uses_screen_texture = false;
}
SceneShaderForwardMobile::ShaderData::~ShaderData() {

View file

@ -97,9 +97,9 @@ public:
ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE
};
bool valid;
bool valid = false;
RID version;
uint32_t vertex_input_mask;
uint32_t vertex_input_mask = 0;
PipelineCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][SHADER_VERSION_MAX];
String path;
@ -108,7 +108,7 @@ public:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
uint32_t ubo_size;
uint32_t ubo_size = 0;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
@ -116,26 +116,26 @@ public:
DepthDraw depth_draw;
DepthTest depth_test;
bool uses_point_size;
bool uses_alpha;
bool uses_blend_alpha;
bool uses_alpha_clip;
bool uses_depth_pre_pass;
bool uses_discard;
bool uses_roughness;
bool uses_normal;
bool uses_particle_trails;
bool uses_point_size = false;
bool uses_alpha = false;
bool uses_blend_alpha = false;
bool uses_alpha_clip = false;
bool uses_depth_pre_pass = false;
bool uses_discard = false;
bool uses_roughness = false;
bool uses_normal = false;
bool uses_particle_trails = false;
bool unshaded;
bool uses_vertex;
bool uses_sss;
bool uses_transmittance;
bool uses_screen_texture;
bool uses_depth_texture;
bool uses_normal_texture;
bool uses_time;
bool writes_modelview_or_projection;
bool uses_world_coordinates;
bool unshaded = false;
bool uses_vertex = false;
bool uses_sss = false;
bool uses_transmittance = false;
bool uses_screen_texture = false;
bool uses_depth_texture = false;
bool uses_normal_texture = false;
bool uses_time = false;
bool writes_modelview_or_projection = false;
bool uses_world_coordinates = false;
uint64_t last_pass = 0;
uint32_t index = 0;

View file

@ -45,7 +45,7 @@ class PipelineCacheRD {
RD::PipelineMultisampleState multisample_state;
RD::PipelineDepthStencilState depth_stencil_state;
RD::PipelineColorBlendState blend_state;
int dynamic_state_flags;
int dynamic_state_flags = 0;
Vector<RD::PipelineSpecializationConstant> base_specialization_constants;
struct Version {

View file

@ -2232,12 +2232,6 @@ RS::ShaderNativeSourceCode RendererCanvasRenderRD::CanvasShaderData::get_native_
return canvas_singleton->shader.canvas_shader.version_get_native_source_code(version);
}
RendererCanvasRenderRD::CanvasShaderData::CanvasShaderData() {
valid = false;
uses_screen_texture = false;
uses_sdf = false;
}
RendererCanvasRenderRD::CanvasShaderData::~CanvasShaderData() {
RendererCanvasRenderRD *canvas_singleton = static_cast<RendererCanvasRenderRD *>(RendererCanvasRender::singleton);
ERR_FAIL_COND(!canvas_singleton);

View file

@ -161,7 +161,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
BLEND_MODE_DISABLED,
};
bool valid;
bool valid = false;
RID version;
PipelineVariants pipeline_variants;
String path;
@ -170,7 +170,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
uint32_t ubo_size;
uint32_t ubo_size = 0;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
@ -190,7 +190,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
CanvasShaderData();
CanvasShaderData() {}
virtual ~CanvasShaderData();
};

View file

@ -286,7 +286,6 @@ RendererCompositorRD::RendererCompositorRD() {
}
singleton = this;
time = 0;
texture_storage = memnew(RendererRD::TextureStorage);
material_storage = memnew(RendererRD::MaterialStorage);

View file

@ -50,11 +50,11 @@ class RendererCompositorRD : public RendererCompositor {
protected:
UniformSetCacheRD *uniform_set_cache = nullptr;
RendererCanvasRenderRD *canvas = nullptr;
RendererRD::LightStorage *light_storage;
RendererRD::MaterialStorage *material_storage;
RendererRD::MeshStorage *mesh_storage;
RendererRD::ParticlesStorage *particles_storage;
RendererRD::TextureStorage *texture_storage;
RendererRD::LightStorage *light_storage = nullptr;
RendererRD::MaterialStorage *material_storage = nullptr;
RendererRD::MeshStorage *mesh_storage = nullptr;
RendererRD::ParticlesStorage *particles_storage = nullptr;
RendererRD::TextureStorage *texture_storage = nullptr;
RendererStorageRD *storage = nullptr;
RendererSceneRenderRD *scene = nullptr;
@ -92,8 +92,8 @@ protected:
Map<RID, RID> render_target_descriptors;
double time;
double delta;
double time = 0.0;
double delta = 0.0;
static uint64_t frame;

View file

@ -3976,10 +3976,6 @@ RS::ShaderNativeSourceCode RendererSceneRenderRD::FogShaderData::get_native_sour
return scene_singleton->volumetric_fog.shader.version_get_native_source_code(version);
}
RendererSceneRenderRD::FogShaderData::FogShaderData() {
valid = false;
}
RendererSceneRenderRD::FogShaderData::~FogShaderData() {
RendererSceneRenderRD *scene_singleton = static_cast<RendererSceneRenderRD *>(RendererSceneRenderRD::singleton);
ERR_FAIL_COND(!scene_singleton);

View file

@ -47,10 +47,10 @@
#include "servers/rendering/rendering_device.h"
struct RenderDataRD {
RID render_buffers = RID();
RID render_buffers;
Transform3D cam_transform = Transform3D();
CameraMatrix cam_projection = CameraMatrix();
Transform3D cam_transform;
CameraMatrix cam_projection;
bool cam_orthogonal = false;
// For stereo rendering
@ -67,18 +67,18 @@ struct RenderDataRD {
const PagedArray<RID> *decals = nullptr;
const PagedArray<RID> *lightmaps = nullptr;
const PagedArray<RID> *fog_volumes = nullptr;
RID environment = RID();
RID camera_effects = RID();
RID shadow_atlas = RID();
RID reflection_atlas = RID();
RID reflection_probe = RID();
RID environment;
RID camera_effects;
RID shadow_atlas;
RID reflection_atlas;
RID reflection_probe;
int reflection_probe_pass = 0;
float lod_distance_multiplier = 0.0;
Plane lod_camera_plane = Plane();
Plane lod_camera_plane;
float screen_mesh_lod_threshold = 0.0;
RID cluster_buffer = RID();
RID cluster_buffer;
uint32_t cluster_size = 0;
uint32_t cluster_max_elements = 0;
@ -95,8 +95,8 @@ class RendererSceneRenderRD : public RendererSceneRender {
protected:
RendererStorageRD *storage = nullptr;
RendererRD::ToneMapper *tone_mapper = nullptr;
double time;
double time_step = 0;
double time = 0.0;
double time_step = 0.0;
struct RenderBufferData {
virtual void configure(RID p_color_buffer, RID p_depth_buffer, RID p_target_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count) = 0;
@ -236,7 +236,7 @@ private:
struct DecalInstance {
RID decal;
Transform3D transform;
uint32_t cull_mask;
uint32_t cull_mask = 0;
ForwardID forward_id = -1;
};
@ -256,7 +256,7 @@ private:
struct ShadowShrinkStage {
RID texture;
RID filter_texture;
uint32_t size;
uint32_t size = 0;
};
struct ShadowAtlas {
@ -268,27 +268,20 @@ private:
};
struct Quadrant {
uint32_t subdivision;
uint32_t subdivision = 0;
struct Shadow {
RID owner;
uint64_t version;
uint64_t fog_version; // used for fog
uint64_t alloc_tick;
uint64_t version = 0;
uint64_t fog_version = 0; // used for fog
uint64_t alloc_tick = 0;
Shadow() {
version = 0;
fog_version = 0;
alloc_tick = 0;
}
Shadow() {}
};
Vector<Shadow> shadows;
Quadrant() {
subdivision = 0; //not in use
}
Quadrant() {}
} quadrants[4];
int size_order[4] = { 0, 1, 2, 3 };
@ -337,7 +330,6 @@ private:
int size = 0;
bool use_16_bits = true;
int current_light = 0;
} directional_shadow;
void _update_directional_shadow_atlas();
@ -910,7 +902,7 @@ private:
void _update_volumetric_fog(RID p_render_buffers, RID p_environment, const CameraMatrix &p_cam_projection, const Transform3D &p_cam_transform, RID p_shadow_atlas, int p_directional_light_count, bool p_use_directional_shadows, int p_positional_light_count, int p_voxel_gi_count, const PagedArray<RID> &p_fog_volumes);
struct FogShaderData : public RendererRD::ShaderData {
bool valid;
bool valid = false;
RID version;
RID pipeline;
@ -918,13 +910,13 @@ private:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
uint32_t ubo_size;
uint32_t ubo_size = 0;
String path;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
bool uses_time;
bool uses_time = false;
virtual void set_code(const String &p_Code);
virtual void set_default_texture_param(const StringName &p_name, RID p_texture, int p_index);
@ -935,7 +927,8 @@ private:
virtual bool casts_shadows() const;
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
FogShaderData();
FogShaderData() {}
virtual ~FogShaderData();
};

View file

@ -224,10 +224,6 @@ RS::ShaderNativeSourceCode RendererSceneSkyRD::SkyShaderData::get_native_source_
return scene_singleton->sky.sky_shader.shader.version_get_native_source_code(version);
}
RendererSceneSkyRD::SkyShaderData::SkyShaderData() {
valid = false;
}
RendererSceneSkyRD::SkyShaderData::~SkyShaderData() {
RendererSceneRenderRD *scene_singleton = static_cast<RendererSceneRenderRD *>(RendererSceneRenderRD::singleton);
ERR_FAIL_COND(!scene_singleton);

View file

@ -106,7 +106,7 @@ private:
};
struct SkyShaderData : public RendererRD::ShaderData {
bool valid;
bool valid = false;
RID version;
PipelineCacheRD pipelines[SKY_VERSION_MAX];
@ -114,17 +114,17 @@ private:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
uint32_t ubo_size;
uint32_t ubo_size = 0;
String path;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
bool uses_time;
bool uses_position;
bool uses_half_res;
bool uses_quarter_res;
bool uses_light;
bool uses_time = false;
bool uses_position = false;
bool uses_half_res = false;
bool uses_quarter_res = false;
bool uses_light = false;
virtual void set_code(const String &p_Code);
virtual void set_default_texture_param(const StringName &p_name, RID p_texture, int p_index);
@ -135,7 +135,8 @@ private:
virtual bool casts_shadows() const;
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
SkyShaderData();
SkyShaderData() {}
virtual ~SkyShaderData();
};

View file

@ -1664,10 +1664,6 @@ RS::ShaderNativeSourceCode ParticlesStorage::ParticlesShaderData::get_native_sou
return ParticlesStorage::get_singleton()->particles_shader.shader.version_get_native_source_code(version);
}
ParticlesStorage::ParticlesShaderData::ParticlesShaderData() {
valid = false;
}
ParticlesStorage::ParticlesShaderData::~ParticlesShaderData() {
//pipeline variants will clear themselves if shader is gone
if (version.is_valid()) {

View file

@ -341,16 +341,15 @@ private:
/* Particle Shader */
struct ParticlesShaderData : public ShaderData {
bool valid;
bool valid = false;
RID version;
bool uses_collision = false;
//PipelineCacheRD pipelines[SKY_VERSION_MAX];
Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
uint32_t ubo_size;
uint32_t ubo_size = 0;
String path;
String code;
@ -373,7 +372,7 @@ private:
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
ParticlesShaderData();
ParticlesShaderData() {}
virtual ~ParticlesShaderData();
};

View file

@ -921,7 +921,7 @@ public:
RID_Owner<Instance, true> instance_owner;
uint32_t geometry_instance_pair_mask; // used in traditional forward, unnecessary on clustered
uint32_t geometry_instance_pair_mask = 0; // used in traditional forward, unnecessary on clustered
virtual RID instance_allocate();
virtual void instance_initialize(RID p_rid);

View file

@ -106,8 +106,8 @@ private:
void _dump_function_deps(const ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, String &r_to_add, Set<StringName> &added);
String _dump_node_code(const ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_scope = true);
const ShaderLanguage::ShaderNode *shader;
const ShaderLanguage::FunctionNode *function;
const ShaderLanguage::ShaderNode *shader = nullptr;
const ShaderLanguage::FunctionNode *function = nullptr;
StringName current_func_name;
StringName time_name;
Set<StringName> texture_functions;

View file

@ -874,11 +874,11 @@ private:
static const KeyWord keyword_list[];
GlobalVariableGetTypeFunc global_var_get_type_func;
GlobalVariableGetTypeFunc global_var_get_type_func = nullptr;
bool error_set;
bool error_set = false;
String error_str;
int error_line;
int error_line = 0;
#ifdef DEBUG_ENABLED
struct Usage {
@ -902,7 +902,7 @@ private:
List<ShaderWarning> warnings;
bool check_warnings = false;
uint32_t warning_flags;
uint32_t warning_flags = 0;
void _add_line_warning(ShaderWarning::Code p_code, const StringName &p_subject = "", const Vector<Variant> &p_extra_args = Vector<Variant>()) {
warnings.push_back(ShaderWarning(p_code, tk_line, p_subject, p_extra_args));
@ -917,8 +917,8 @@ private:
#endif // DEBUG_ENABLED
String code;
int char_idx;
int tk_line;
int char_idx = 0;
int tk_line = 0;
StringName current_function;
bool last_const = false;
@ -1020,14 +1020,14 @@ private:
};
CompletionType completion_type;
int completion_line;
int completion_line = 0;
BlockNode *completion_block = nullptr;
DataType completion_base;
bool completion_base_array;
bool completion_base_array = false;
SubClassTag completion_class;
StringName completion_function;
StringName completion_struct;
int completion_argument;
int completion_argument = 0;
const Map<StringName, FunctionInfo> *stages = nullptr;

View file

@ -47,7 +47,7 @@ class RenderingServer : public Object {
static RenderingServer *singleton;
int mm_policy;
int mm_policy = 0;
bool render_loop_enabled = true;
Array _get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, Vector<uint8_t> p_attrib_data, Vector<uint8_t> p_skin_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const;