summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-25 12:52:58 +0200
committerGitHub <noreply@github.com>2021-07-25 12:52:58 +0200
commitff0b5f8fa1be4ccd5b8de1d9d49f8a4b71439f63 (patch)
tree42543cc85d27d2c8692a2ced4bac5c537e402004 /servers/rendering
parent2f221e5fd507b176590bda52d08e499629ce7761 (diff)
parentac3322b0af8f23e8e2dac8111200bc69b5604c9f (diff)
Merge pull request #50809 from akien-mga/iterators-const-references
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/shader_compiler_rd.cpp4
-rw-r--r--servers/rendering/renderer_scene_cull.cpp6
-rw-r--r--servers/rendering/rendering_device_binds.h2
-rw-r--r--servers/rendering/shader_language.cpp2
5 files changed, 10 insertions, 10 deletions
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 178fb60885..d5c7db6fd2 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -8410,7 +8410,7 @@ void RendererStorageRD::global_variables_load_settings(bool p_load_textures) {
List<PropertyInfo> settings;
ProjectSettings::get_singleton()->get_property_list(&settings);
- for (PropertyInfo &E : settings) {
+ for (const PropertyInfo &E : settings) {
if (E.name.begins_with("shader_globals/")) {
StringName name = E.name.get_slice("/", 1);
Dictionary d = ProjectSettings::get_singleton()->get(E.name);
@@ -8581,7 +8581,7 @@ void RendererStorageRD::_update_global_variables() {
if (global_variables.must_update_buffer_materials) {
// only happens in the case of a buffer variable added or removed,
// so not often.
- for (RID E : global_variables.materials_using_buffer) {
+ for (const RID &E : global_variables.materials_using_buffer) {
Material *material = material_owner.getornull(E);
ERR_CONTINUE(!material); //wtf
@@ -8594,7 +8594,7 @@ void RendererStorageRD::_update_global_variables() {
if (global_variables.must_update_texture_materials) {
// only happens in the case of a buffer variable added or removed,
// so not often.
- for (RID E : global_variables.materials_using_texture) {
+ for (const RID &E : global_variables.materials_using_texture) {
Material *material = material_owner.getornull(E);
ERR_CONTINUE(!material); //wtf
diff --git a/servers/rendering/renderer_rd/shader_compiler_rd.cpp b/servers/rendering/renderer_rd/shader_compiler_rd.cpp
index 66cd0ea15a..9c1068ea2e 100644
--- a/servers/rendering/renderer_rd/shader_compiler_rd.cpp
+++ b/servers/rendering/renderer_rd/shader_compiler_rd.cpp
@@ -760,7 +760,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
if (var_frag_to_light.size() > 0) {
String gcode = "\n\nstruct {\n";
- for (Pair<StringName, SL::ShaderNode::Varying> &E : var_frag_to_light) {
+ for (const Pair<StringName, SL::ShaderNode::Varying> &E : var_frag_to_light) {
gcode += "\t" + _prestr(E.second.precision) + _typestr(E.second.type) + " " + _mkid(E.first);
if (E.second.array_size > 0) {
gcode += "[";
@@ -1394,7 +1394,7 @@ void ShaderCompilerRD::initialize(DefaultIdentifierActions p_actions) {
ShaderLanguage::get_builtin_funcs(&func_list);
- for (String &E : func_list) {
+ for (const String &E : func_list) {
internal_functions.insert(E);
}
texture_functions.insert("texture");
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 53983d0bfd..83d1b33bf2 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -3391,7 +3391,7 @@ void RendererSceneCull::render_probes() {
idx++;
}
- for (Instance *instance : probe->owner->scenario->directional_lights) {
+ for (const Instance *instance : probe->owner->scenario->directional_lights) {
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3464,7 +3464,7 @@ void RendererSceneCull::render_probes() {
idx++;
}
- for (Instance *instance : probe->owner->scenario->directional_lights) {
+ for (const Instance *instance : probe->owner->scenario->directional_lights) {
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3571,7 +3571,7 @@ void RendererSceneCull::render_particle_colliders() {
void RendererSceneCull::_update_instance_shader_parameters_from_material(Map<StringName, Instance::InstanceShaderParameter> &isparams, const Map<StringName, Instance::InstanceShaderParameter> &existing_isparams, RID p_material) {
List<RendererStorage::InstanceShaderParam> plist;
RSG::storage->material_get_instance_shader_parameters(p_material, &plist);
- for (RendererStorage::InstanceShaderParam &E : plist) {
+ for (const RendererStorage::InstanceShaderParam &E : plist) {
StringName name = E.info.name;
if (isparams.has(name)) {
if (isparams[name].info.type != E.info.type) {
diff --git a/servers/rendering/rendering_device_binds.h b/servers/rendering/rendering_device_binds.h
index df1b40974f..75a91d8419 100644
--- a/servers/rendering/rendering_device_binds.h
+++ b/servers/rendering/rendering_device_binds.h
@@ -388,7 +388,7 @@ protected:
versions.clear();
List<Variant> keys;
p_versions.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
StringName name = E;
Ref<RDShaderBytecode> bc = p_versions[E];
ERR_CONTINUE(bc.is_null());
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 2db246c31f..7cfdb832e4 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -4448,7 +4448,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
String member_name = String(ident.ptr());
if (shader->structs.has(st)) {
StructNode *n = shader->structs[st].shader_struct;
- for (MemberNode *E : n->members) {
+ for (const MemberNode *E : n->members) {
if (String(E->name) == member_name) {
member_type = E->datatype;
array_size = E->array_size;