summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/audio/audio_filter_sw.cpp9
-rw-r--r--servers/audio/audio_filter_sw.h34
-rw-r--r--servers/audio/audio_stream.cpp5
-rw-r--r--servers/audio/audio_stream.h10
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.cpp8
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.h18
-rw-r--r--servers/audio/effects/reverb.cpp2
-rw-r--r--servers/audio/effects/reverb.h7
-rw-r--r--servers/audio_server.cpp20
-rw-r--r--servers/audio_server.h90
-rw-r--r--servers/display_server.cpp7
-rw-r--r--servers/display_server.h7
-rw-r--r--servers/physics_2d/godot_collision_solver_2d.cpp2
-rw-r--r--servers/physics_2d/godot_collision_solver_2d_sat.cpp2
-rw-r--r--servers/physics_3d/gjk_epa.cpp18
-rw-r--r--servers/physics_3d/godot_collision_solver_3d.cpp28
-rw-r--r--servers/physics_3d/godot_collision_solver_3d_sat.cpp2
-rw-r--r--servers/physics_3d/godot_shape_3d.cpp8
-rw-r--r--servers/physics_server_2d.cpp4
-rw-r--r--servers/physics_server_2d.h6
-rw-r--r--servers/physics_server_3d.cpp4
-rw-r--r--servers/physics_server_3d.h6
-rw-r--r--servers/rendering/renderer_rd/effects/tone_mapper.cpp26
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp2
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h50
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp2
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h46
-rw-r--r--servers/rendering/renderer_rd/pipeline_cache_rd.h2
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.h6
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp1
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.h14
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.h59
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.h17
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.cpp70
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.h7
-rw-r--r--servers/rendering/renderer_scene_cull.h2
-rw-r--r--servers/rendering/renderer_viewport.cpp20
-rw-r--r--servers/rendering/shader_compiler.h4
-rw-r--r--servers/rendering/shader_language.cpp42
-rw-r--r--servers/rendering/shader_language.h18
-rw-r--r--servers/rendering_server.h2
45 files changed, 346 insertions, 359 deletions
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp
index 082931647a..003275f302 100644
--- a/servers/audio/audio_filter_sw.cpp
+++ b/servers/audio/audio_filter_sw.cpp
@@ -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);
}
diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h
index 1ec1abd4d5..e3f8188997 100644
--- a/servers/audio/audio_filter_sw.h
+++ b/servers/audio/audio_filter_sw.h
@@ -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 */
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 1ebd57fa7f..9a9b9815ae 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -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;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 55031dec2c..9800707849 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -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();
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp
index c81efc55e2..7bb62bcbed 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.cpp
+++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp
@@ -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() {}
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.h b/servers/audio/effects/audio_effect_stereo_enhance.h
index 1f93d1cf9f..30ea11f625 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.h
+++ b/servers/audio/effects/audio_effect_stereo_enhance.h
@@ -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
diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp
index 4b5b9ab79f..adfd648514 100644
--- a/servers/audio/effects/reverb.cpp
+++ b/servers/audio/effects/reverb.cpp
@@ -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"
diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h
index de25e8c52b..c9602c5b5a 100644
--- a/servers/audio/effects/reverb.h
+++ b/servers/audio/effects/reverb.h
@@ -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;
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 777bebcf60..c8f48207e4 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -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() {
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 5563d60e4a..3d8755071a 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -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;
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index 8d97cd2543..59f88844e9 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -421,7 +421,7 @@ DisplayServer::CursorShape DisplayServer::cursor_get_shape() const {
return CURSOR_ARROW;
}
-void DisplayServer::cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
+void DisplayServer::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
WARN_PRINT("Custom cursor shape not supported by this display server.");
}
@@ -579,6 +579,9 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("clipboard_set_primary", "clipboard_primary"), &DisplayServer::clipboard_set_primary);
ClassDB::bind_method(D_METHOD("clipboard_get_primary"), &DisplayServer::clipboard_get_primary);
+ ClassDB::bind_method(D_METHOD("get_display_cutouts"), &DisplayServer::get_display_cutouts);
+ ClassDB::bind_method(D_METHOD("get_display_safe_area"), &DisplayServer::get_display_safe_area);
+
ClassDB::bind_method(D_METHOD("get_screen_count"), &DisplayServer::get_screen_count);
ClassDB::bind_method(D_METHOD("screen_get_position", "screen"), &DisplayServer::screen_get_position, DEFVAL(SCREEN_OF_MAIN_WINDOW));
ClassDB::bind_method(D_METHOD("screen_get_size", "screen"), &DisplayServer::screen_get_size, DEFVAL(SCREEN_OF_MAIN_WINDOW));
@@ -830,7 +833,7 @@ Input::CursorShape DisplayServer::_input_get_current_cursor_shape() {
return (Input::CursorShape)singleton->cursor_get_shape();
}
-void DisplayServer::_input_set_custom_mouse_cursor_func(const RES &p_image, Input::CursorShape p_shape, const Vector2 &p_hostspot) {
+void DisplayServer::_input_set_custom_mouse_cursor_func(const Ref<Resource> &p_image, Input::CursorShape p_shape, const Vector2 &p_hostspot) {
singleton->cursor_set_custom_image(p_image, (CursorShape)p_shape, p_hostspot);
}
diff --git a/servers/display_server.h b/servers/display_server.h
index 19efcbd3dd..7a15df2f92 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -80,7 +80,7 @@ private:
static Input::MouseMode _input_get_mouse_mode();
static void _input_warp(const Vector2 &p_to_pos);
static Input::CursorShape _input_get_current_cursor_shape();
- static void _input_set_custom_mouse_cursor_func(const RES &, Input::CursorShape, const Vector2 &p_hostspot);
+ static void _input_set_custom_mouse_cursor_func(const Ref<Resource> &, Input::CursorShape, const Vector2 &p_hostspot);
protected:
static void _bind_methods();
@@ -228,6 +228,9 @@ public:
virtual void clipboard_set_primary(const String &p_text);
virtual String clipboard_get_primary() const;
+ virtual Array get_display_cutouts() const { return Array(); }
+ virtual Rect2i get_display_safe_area() const { return screen_get_usable_rect(); }
+
enum {
SCREEN_OF_MAIN_WINDOW = -1
};
@@ -407,7 +410,7 @@ public:
};
virtual void cursor_set_shape(CursorShape p_shape);
virtual CursorShape cursor_get_shape() const;
- virtual void cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
+ virtual void cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
virtual bool get_swap_cancel_ok();
diff --git a/servers/physics_2d/godot_collision_solver_2d.cpp b/servers/physics_2d/godot_collision_solver_2d.cpp
index 9f83cea858..0d7b42b80d 100644
--- a/servers/physics_2d/godot_collision_solver_2d.cpp
+++ b/servers/physics_2d/godot_collision_solver_2d.cpp
@@ -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;
diff --git a/servers/physics_2d/godot_collision_solver_2d_sat.cpp b/servers/physics_2d/godot_collision_solver_2d_sat.cpp
index 414967a052..77186d3810 100644
--- a/servers/physics_2d/godot_collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/godot_collision_solver_2d_sat.cpp
@@ -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;
diff --git a/servers/physics_3d/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp
index 23c8079538..ba362740b2 100644
--- a/servers/physics_3d/gjk_epa.cpp
+++ b/servers/physics_3d/gjk_epa.cpp
@@ -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 */
diff --git a/servers/physics_3d/godot_collision_solver_3d.cpp b/servers/physics_3d/godot_collision_solver_3d.cpp
index 0adfabef78..afc74df166 100644
--- a/servers/physics_3d/godot_collision_solver_3d.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d.cpp
@@ -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) {
diff --git a/servers/physics_3d/godot_collision_solver_3d_sat.cpp b/servers/physics_3d/godot_collision_solver_3d_sat.cpp
index ca429040f5..7b7a09f31d 100644
--- a/servers/physics_3d/godot_collision_solver_3d_sat.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d_sat.cpp
@@ -68,7 +68,7 @@
*************************************************************************/
struct _CollectorCallback {
- GodotCollisionSolver3D::CallbackResult callback;
+ GodotCollisionSolver3D::CallbackResult callback = nullptr;
void *userdata = nullptr;
bool swap = false;
bool collided = false;
diff --git a/servers/physics_3d/godot_shape_3d.cpp b/servers/physics_3d/godot_shape_3d.cpp
index 21595c9612..63ba28258f 100644
--- a/servers/physics_3d/godot_shape_3d.cpp
+++ b/servers/physics_3d/godot_shape_3d.cpp
@@ -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) {
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index 45816e3244..d6d23f8310 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -243,7 +243,7 @@ void PhysicsPointQueryParameters2D::_bind_methods() {
///////////////////////////////////////////////////////
-void PhysicsShapeQueryParameters2D::set_shape(const RES &p_shape_ref) {
+void PhysicsShapeQueryParameters2D::set_shape(const Ref<Resource> &p_shape_ref) {
ERR_FAIL_COND(p_shape_ref.is_null());
shape_ref = p_shape_ref;
parameters.shape_rid = p_shape_ref->get_rid();
@@ -251,7 +251,7 @@ void PhysicsShapeQueryParameters2D::set_shape(const RES &p_shape_ref) {
void PhysicsShapeQueryParameters2D::set_shape_rid(const RID &p_shape) {
if (parameters.shape_rid != p_shape) {
- shape_ref = RES();
+ shape_ref = Ref<Resource>();
parameters.shape_rid = p_shape;
}
}
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index e9faf0a3bf..2f70b88e30 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -663,7 +663,7 @@ class PhysicsShapeQueryParameters2D : public RefCounted {
PhysicsDirectSpaceState2D::ShapeParameters parameters;
- RES shape_ref;
+ Ref<Resource> shape_ref;
protected:
static void _bind_methods();
@@ -671,8 +671,8 @@ protected:
public:
const PhysicsDirectSpaceState2D::ShapeParameters &get_parameters() const { return parameters; }
- void set_shape(const RES &p_shape_ref);
- RES get_shape() const { return shape_ref; }
+ void set_shape(const Ref<Resource> &p_shape_ref);
+ Ref<Resource> get_shape() const { return shape_ref; }
void set_shape_rid(const RID &p_shape);
RID get_shape_rid() const { return parameters.shape_rid; }
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index 17c94978d1..bfe93f0dfb 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -262,7 +262,7 @@ void PhysicsPointQueryParameters3D::_bind_methods() {
///////////////////////////////////////////////////////
-void PhysicsShapeQueryParameters3D::set_shape(const RES &p_shape_ref) {
+void PhysicsShapeQueryParameters3D::set_shape(const Ref<Resource> &p_shape_ref) {
ERR_FAIL_COND(p_shape_ref.is_null());
shape_ref = p_shape_ref;
parameters.shape_rid = p_shape_ref->get_rid();
@@ -270,7 +270,7 @@ void PhysicsShapeQueryParameters3D::set_shape(const RES &p_shape_ref) {
void PhysicsShapeQueryParameters3D::set_shape_rid(const RID &p_shape) {
if (parameters.shape_rid != p_shape) {
- shape_ref = RES();
+ shape_ref = Ref<Resource>();
parameters.shape_rid = p_shape;
}
}
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index 4811f7a039..47f3fc2027 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -874,7 +874,7 @@ class PhysicsShapeQueryParameters3D : public RefCounted {
PhysicsDirectSpaceState3D::ShapeParameters parameters;
- RES shape_ref;
+ Ref<Resource> shape_ref;
protected:
static void _bind_methods();
@@ -882,8 +882,8 @@ protected:
public:
const PhysicsDirectSpaceState3D::ShapeParameters &get_parameters() const { return parameters; }
- void set_shape(const RES &p_shape_ref);
- RES get_shape() const { return shape_ref; }
+ void set_shape(const Ref<Resource> &p_shape_ref);
+ Ref<Resource> get_shape() const { return shape_ref; }
void set_shape_rid(const RID &p_shape);
RID get_shape_rid() const { return parameters.shape_rid; }
diff --git a/servers/rendering/renderer_rd/effects/tone_mapper.cpp b/servers/rendering/renderer_rd/effects/tone_mapper.cpp
index 7eb15f418b..e5642116bb 100644
--- a/servers/rendering/renderer_rd/effects/tone_mapper.cpp
+++ b/servers/rendering/renderer_rd/effects/tone_mapper.cpp
@@ -151,37 +151,37 @@ void ToneMapper::tonemapper(RID p_source_color, RID p_dst_framebuffer, const Ton
mode += 6;
}
- RID default_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- RID default_mipmap_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_mipmap_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
RD::Uniform u_source_color;
u_source_color.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_source_color.binding = 0;
- u_source_color.append_id(default_shader);
+ u_source_color.append_id(default_sampler);
u_source_color.append_id(p_source_color);
RD::Uniform u_exposure_texture;
u_exposure_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_exposure_texture.binding = 0;
- u_exposure_texture.append_id(default_shader);
+ u_exposure_texture.append_id(default_sampler);
u_exposure_texture.append_id(p_settings.exposure_texture);
RD::Uniform u_glow_texture;
u_glow_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_texture.binding = 0;
- u_glow_texture.append_id(default_mipmap_shader);
+ u_glow_texture.append_id(default_mipmap_sampler);
u_glow_texture.append_id(p_settings.glow_texture);
RD::Uniform u_glow_map;
u_glow_map.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_map.binding = 1;
- u_glow_map.append_id(default_mipmap_shader);
+ u_glow_map.append_id(default_mipmap_sampler);
u_glow_map.append_id(p_settings.glow_map);
RD::Uniform u_color_correction_texture;
u_color_correction_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_color_correction_texture.binding = 0;
- u_color_correction_texture.append_id(default_shader);
+ u_color_correction_texture.append_id(default_sampler);
u_color_correction_texture.append_id(p_settings.color_correction_texture);
RID shader = tonemap.shader.version_get_shader(tonemap.shader_version, mode);
@@ -233,8 +233,8 @@ void ToneMapper::tonemapper(RD::DrawListID p_subpass_draw_list, RID p_source_col
tonemap.push_constant.use_debanding = p_settings.use_debanding;
tonemap.push_constant.luminance_multiplier = p_settings.luminance_multiplier;
- RID default_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- RID default_mipmap_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_mipmap_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
RD::Uniform u_source_color;
u_source_color.uniform_type = RD::UNIFORM_TYPE_INPUT_ATTACHMENT;
@@ -244,25 +244,25 @@ void ToneMapper::tonemapper(RD::DrawListID p_subpass_draw_list, RID p_source_col
RD::Uniform u_exposure_texture;
u_exposure_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_exposure_texture.binding = 0;
- u_exposure_texture.append_id(default_shader);
+ u_exposure_texture.append_id(default_sampler);
u_exposure_texture.append_id(p_settings.exposure_texture);
RD::Uniform u_glow_texture;
u_glow_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_texture.binding = 0;
- u_glow_texture.append_id(default_mipmap_shader);
+ u_glow_texture.append_id(default_mipmap_sampler);
u_glow_texture.append_id(p_settings.glow_texture);
RD::Uniform u_glow_map;
u_glow_map.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_map.binding = 1;
- u_glow_map.append_id(default_mipmap_shader);
+ u_glow_map.append_id(default_mipmap_sampler);
u_glow_map.append_id(p_settings.glow_map);
RD::Uniform u_color_correction_texture;
u_color_correction_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_color_correction_texture.binding = 0;
- u_color_correction_texture.append_id(default_shader);
+ u_color_correction_texture.append_id(default_sampler);
u_color_correction_texture.append_id(p_settings.color_correction_texture);
RID shader = tonemap.shader.version_get_shader(tonemap.shader_version, mode);
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index 3c115c942b..e60651f092 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -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() {
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
index 6185fa7413..0b2df983ff 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
@@ -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 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 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 = 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;
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
index 60badbdfee..cdddc35579 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
@@ -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() {
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
index b89fe908d3..50b5fb26ec 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
@@ -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 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 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 = 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;
diff --git a/servers/rendering/renderer_rd/pipeline_cache_rd.h b/servers/rendering/renderer_rd/pipeline_cache_rd.h
index 1e80381d88..ad83fc76b7 100644
--- a/servers/rendering/renderer_rd/pipeline_cache_rd.h
+++ b/servers/rendering/renderer_rd/pipeline_cache_rd.h
@@ -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 {
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 38eb8b8c41..386bc18fcd 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -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);
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.h b/servers/rendering/renderer_rd/renderer_canvas_render_rd.h
index 6448e1a664..06970acca6 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.h
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.h
@@ -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();
};
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index fd56de845f..759b8690eb 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -286,7 +286,6 @@ RendererCompositorRD::RendererCompositorRD() {
}
singleton = this;
- time = 0;
texture_storage = memnew(RendererRD::TextureStorage);
material_storage = memnew(RendererRD::MaterialStorage);
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.h b/servers/rendering/renderer_rd/renderer_compositor_rd.h
index 768e9e0947..26bd28286b 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.h
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.h
@@ -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;
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 26365aafc4..3bfcf18f12 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -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);
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
index 2b79d8997f..6bf3a95dd0 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
@@ -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;
-
- Shadow() {
- version = 0;
- fog_version = 0;
- alloc_tick = 0;
- }
+ uint64_t version = 0;
+ uint64_t fog_version = 0; // used for fog
+ uint64_t 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();
};
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
index 74bba0d4da..51cf0e952b 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
@@ -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);
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.h b/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
index 010e2178a9..497d27ec26 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
@@ -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();
};
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
index 28ac42457a..9ca2973fd4 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
@@ -388,26 +388,60 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
- const PackedVector3Array &a = value;
- int s = a.size();
+ if (value.get_type() == Variant::PACKED_COLOR_ARRAY) {
+ const PackedColorArray &a = value;
+ int s = a.size();
- for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
- if (i < s) {
- gui[j] = a[i].x;
- gui[j + 1] = a[i].y;
- gui[j + 2] = a[i].z;
- } else {
- gui[j] = 0;
- gui[j + 1] = 0;
- gui[j + 2] = 0;
+ for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
+ if (i < s) {
+ Color color = a[i];
+ if (p_linear_color) {
+ color = color.srgb_to_linear();
+ }
+ gui[j] = color.r;
+ gui[j + 1] = color.g;
+ gui[j + 2] = color.b;
+ } else {
+ gui[j] = 0;
+ gui[j + 1] = 0;
+ gui[j + 2] = 0;
+ }
+ gui[j + 3] = 0; // ignored
+ }
+ } else {
+ const PackedVector3Array &a = value;
+ int s = a.size();
+
+ for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
+ if (i < s) {
+ gui[j] = a[i].x;
+ gui[j + 1] = a[i].y;
+ gui[j + 2] = a[i].z;
+ } else {
+ gui[j] = 0;
+ gui[j + 1] = 0;
+ gui[j + 2] = 0;
+ }
+ gui[j + 3] = 0; // ignored
}
- gui[j + 3] = 0; // ignored
}
} else {
- Vector3 v = value;
- gui[0] = v.x;
- gui[1] = v.y;
- gui[2] = v.z;
+ if (value.get_type() == Variant::COLOR) {
+ Color v = value;
+
+ if (p_linear_color) {
+ v = v.srgb_to_linear();
+ }
+
+ gui[0] = v.r;
+ gui[1] = v.g;
+ gui[2] = v.b;
+ } else {
+ Vector3 v = value;
+ gui[0] = v.x;
+ gui[1] = v.y;
+ gui[2] = v.z;
+ }
}
} break;
case ShaderLanguage::TYPE_VEC4: {
@@ -921,7 +955,7 @@ void MaterialData::update_uniform_buffer(const Map<StringName, ShaderLanguage::S
//value=E.value.default_value;
} else {
//zero because it was not provided
- if (E.value.type == ShaderLanguage::TYPE_VEC4 && E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ if ((E.value.type == ShaderLanguage::TYPE_VEC3 || E.value.type == ShaderLanguage::TYPE_VEC4) && E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
//colors must be set as black, with alpha as 1.0
_fill_std140_variant_ubo_value(E.value.type, E.value.array_size, Color(0, 0, 0, 1), data, p_use_linear_color);
} else {
@@ -2057,7 +2091,7 @@ void MaterialStorage::global_variables_load_settings(bool p_load_textures) {
}
String path = value;
- RES resource = ResourceLoader::load(path);
+ Ref<Resource> resource = ResourceLoader::load(path);
ERR_CONTINUE(resource.is_null());
value = resource;
}
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 78d7c1e979..094120f908 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -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()) {
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.h b/servers/rendering/renderer_rd/storage_rd/particles_storage.h
index 7764af08f2..c6480794c1 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.h
@@ -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();
};
diff --git a/servers/rendering/renderer_scene_cull.h b/servers/rendering/renderer_scene_cull.h
index 5f71250ced..b5e8cf702f 100644
--- a/servers/rendering/renderer_scene_cull.h
+++ b/servers/rendering/renderer_scene_cull.h
@@ -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);
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index 4da50d8822..7e18eac6ae 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -195,8 +195,6 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
}
}
- Color bgcolor = RSG::storage->get_default_clear_color();
-
if (!p_viewport->disable_2d && !p_viewport->disable_environment && RSG::scene->is_scenario(p_viewport->scenario)) {
RID environment = RSG::scene->scenario_get_environment(p_viewport->scenario);
if (RSG::scene->is_environment(environment)) {
@@ -207,15 +205,6 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
bool can_draw_3d = RSG::scene->is_camera(p_viewport->camera) && !p_viewport->disable_3d;
- if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) {
- if (p_viewport->transparent_bg) {
- bgcolor = Color(0, 0, 0, 0);
- }
- if (p_viewport->clear_mode == RS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
- p_viewport->clear_mode = RS::VIEWPORT_CLEAR_NEVER;
- }
- }
-
if ((scenario_draw_canvas_bg || can_draw_3d) && !p_viewport->render_buffers.is_valid()) {
//wants to draw 3D but there is no render buffer, create
p_viewport->render_buffers = RSG::scene->render_buffers_create();
@@ -223,7 +212,14 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
_configure_3d_render_buffers(p_viewport);
}
- RSG::texture_storage->render_target_request_clear(p_viewport->render_target, bgcolor);
+ Color bgcolor = p_viewport->transparent_bg ? Color(0, 0, 0, 0) : RSG::storage->get_default_clear_color();
+
+ if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) {
+ RSG::texture_storage->render_target_request_clear(p_viewport->render_target, bgcolor);
+ if (p_viewport->clear_mode == RS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
+ p_viewport->clear_mode = RS::VIEWPORT_CLEAR_NEVER;
+ }
+ }
if (!scenario_draw_canvas_bg && can_draw_3d) {
_draw_3d(p_viewport);
diff --git a/servers/rendering/shader_compiler.h b/servers/rendering/shader_compiler.h
index 8f0ee664ac..347ecf2988 100644
--- a/servers/rendering/shader_compiler.h
+++ b/servers/rendering/shader_compiler.h
@@ -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;
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 54d1a6fd8d..1fd7062d6e 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -3548,13 +3548,25 @@ Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::C
if (array_size > 0) {
array_size *= 3;
- PackedVector3Array array = PackedVector3Array();
- for (int i = 0; i < array_size; i += 3) {
- array.push_back(Vector3(p_value[i].real, p_value[i + 1].real, p_value[i + 2].real));
+ if (p_hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ PackedColorArray array = PackedColorArray();
+ for (int i = 0; i < array_size; i += 3) {
+ array.push_back(Color(p_value[i].real, p_value[i + 1].real, p_value[i + 2].real));
+ }
+ value = Variant(array);
+ } else {
+ PackedVector3Array array = PackedVector3Array();
+ for (int i = 0; i < array_size; i += 3) {
+ array.push_back(Vector3(p_value[i].real, p_value[i + 1].real, p_value[i + 2].real));
+ }
+ value = Variant(array);
}
- value = Variant(array);
} else {
- value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real));
+ if (p_hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ value = Variant(Color(p_value[0].real, p_value[1].real, p_value[2].real));
+ } else {
+ value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real));
+ }
}
break;
case ShaderLanguage::TYPE_VEC4:
@@ -3760,9 +3772,19 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform
break;
case ShaderLanguage::TYPE_VEC3:
if (p_uniform.array_size > 0) {
- pi.type = Variant::PACKED_VECTOR3_ARRAY;
+ if (p_uniform.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ pi.hint = PROPERTY_HINT_COLOR_NO_ALPHA;
+ pi.type = Variant::PACKED_COLOR_ARRAY;
+ } else {
+ pi.type = Variant::PACKED_VECTOR3_ARRAY;
+ }
} else {
- pi.type = Variant::VECTOR3;
+ if (p_uniform.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ pi.hint = PROPERTY_HINT_COLOR_NO_ALPHA;
+ pi.type = Variant::COLOR;
+ } else {
+ pi.type = Variant::VECTOR3;
+ }
}
break;
case ShaderLanguage::TYPE_VEC4: {
@@ -8001,8 +8023,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
} else if (tk.type == TK_HINT_BLACK_ALBEDO_TEXTURE) {
uniform2.hint = ShaderNode::Uniform::HINT_BLACK_ALBEDO;
} else if (tk.type == TK_HINT_COLOR) {
- if (type != TYPE_VEC4) {
- _set_error(vformat(RTR("Color hint is for '%s' only."), "vec4"));
+ if (type != TYPE_VEC3 && type != TYPE_VEC4) {
+ _set_error(vformat(RTR("Color hint is for '%s' or '%s' only."), "vec3", "vec4"));
return ERR_PARSE_ERROR;
}
uniform2.hint = ShaderNode::Uniform::HINT_COLOR;
@@ -9514,7 +9536,7 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_
} break;
case COMPLETION_HINT: {
- if (completion_base == DataType::TYPE_VEC4) {
+ if (completion_base == DataType::TYPE_VEC3 || completion_base == DataType::TYPE_VEC4) {
ScriptLanguage::CodeCompletionOption option("hint_color", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
r_options->push_back(option);
} else if ((completion_base == DataType::TYPE_INT || completion_base == DataType::TYPE_FLOAT) && !completion_base_array) {
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h
index de6d912a4f..c707d09f29 100644
--- a/servers/rendering/shader_language.h
+++ b/servers/rendering/shader_language.h
@@ -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;
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 71896e9d11..2db384f7df 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -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;