From 0ba75c195efffcb098ac74440ffb0fa9c85d0d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 27 Feb 2019 08:57:37 +0100 Subject: [PATCH] Fix GCC 5 build after #26331 and cleanup style Also cleanup after 01a3dd3. --- core/io/resource_importer.cpp | 12 ++++++------ core/io/resource_importer.h | 10 ++++++---- core/script_debugger_remote.cpp | 1 - drivers/gles2/rasterizer_scene_gles2.cpp | 4 +--- drivers/gles2/rasterizer_storage_gles2.cpp | 2 -- drivers/gles2/shaders/canvas.glsl | 2 +- drivers/gles2/shaders/cubemap_filter.glsl | 2 +- drivers/gles2/shaders/scene.glsl | 4 ---- scene/resources/resource_format_text.cpp | 2 +- scene/resources/texture.cpp | 4 ++-- 10 files changed, 18 insertions(+), 25 deletions(-) diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index ef834921b6c..427ce2c2cdc 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -32,7 +32,8 @@ #include "core/os/os.h" #include "core/variant_parser.h" -bool ResourceFormatImporter::SortImporterByName::operator() ( const Ref& p_a,const Ref& p_b) const { + +bool ResourceFormatImporter::SortImporterByName::operator()(const Ref &p_a, const Ref &p_b) const { return p_a->get_importer_name() < p_b->get_importer_name(); } @@ -321,7 +322,6 @@ Variant ResourceFormatImporter::get_resource_metadata(const String &p_path) cons return pat.metadata; } - void ResourceFormatImporter::get_dependencies(const String &p_path, List *p_dependencies, bool p_add_types) { PathAndType pat; @@ -394,7 +394,7 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con return false; } - for(int i=0;iget_importer_name() == pat.importer) { if (!importers[i]->are_import_settings_valid(p_path)) { //importer thinks this is not valid return false; @@ -405,10 +405,10 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con return true; } - String ResourceFormatImporter::get_import_settings_hash() const { +String ResourceFormatImporter::get_import_settings_hash() const { String hash; - for(int i=0;iget_importer_name()+":"+importers[i]->get_import_settings_string(); + for (int i = 0; i < importers.size(); i++) { + hash += ":" + importers[i]->get_importer_name() + ":" + importers[i]->get_import_settings_string(); } return hash.md5_text(); } diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index 0ae6bf90907..db1befb51eb 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -52,7 +52,7 @@ class ResourceFormatImporter : public ResourceFormatLoader { //need them to stay in order to compute the settings hash struct SortImporterByName { - bool operator() ( const Ref& p_a,const Ref& p_b) const; + bool operator()(const Ref &p_a, const Ref &p_b) const; }; Vector > importers; @@ -75,7 +75,10 @@ public: String get_internal_resource_path(const String &p_path) const; void get_internal_resource_path_list(const String &p_path, List *r_paths); - void add_importer(const Ref &p_importer) { importers.push_back(p_importer); importers.sort_custom();} + void add_importer(const Ref &p_importer) { + importers.push_back(p_importer); + importers.sort_custom(); + } void remove_importer(const Ref &p_importer) { importers.erase(p_importer); } Ref get_importer_by_name(const String &p_name) const; Ref get_importer_by_extension(const String &p_extension) const; @@ -117,10 +120,9 @@ public: virtual void get_import_options(List *r_options, int p_preset = 0) const = 0; virtual bool get_option_visibility(const String &p_option, const Map &p_options) const = 0; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files = NULL, Variant *r_metadata=NULL) = 0; + virtual Error import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files = NULL, Variant *r_metadata = NULL) = 0; virtual bool are_import_settings_valid(const String &p_path) const { return true; } virtual String get_import_settings_string() const { return String(); } - }; #endif // RESOURCE_IMPORTER_H diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 9780cc48ea7..3ed25f118d7 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -1054,7 +1054,6 @@ void ScriptDebuggerRemote::profiling_set_frame_times(float p_frame_time, float p physics_frame_time = p_physics_frame_time; } - ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL; ScriptDebuggerRemote::ScriptDebuggerRemote() : diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index de77c2c63e9..32133632bd3 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -42,8 +42,6 @@ #define glClearDepth glClearDepthf #endif -#define _DEPTH_COMPONENT24_OES 0x81A6 - static const GLenum _cube_side_enum[6] = { GL_TEXTURE_CUBE_MAP_NEGATIVE_X, @@ -569,7 +567,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], rpi->cubemap, 0); glBindRenderbuffer(GL_RENDERBUFFER, rpi->depth); - glRenderbufferStorage(GL_RENDERBUFFER, _DEPTH_COMPONENT24_OES, size, size); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, size, size); // Note: used to be _DEPTH_COMPONENT24_OES. GL_DEPTH_COMPONENT untested. glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rpi->depth); #ifdef DEBUG_ENABLED diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index a877c1d03f2..9d2e609e5e1 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -54,8 +54,6 @@ GLuint RasterizerStorageGLES2::system_fbo = 0; #define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#define _DEPTH_COMPONENT24_OES 0x81A6 - #define _RED_OES 0x1903 void RasterizerStorageGLES2::bind_quad_array() const { diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index c292897ad01..b13801946f1 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -349,7 +349,7 @@ void main() { vec2 uv = uv_interp; #ifdef USE_FORCE_REPEAT //needs to use this to workaround GLES2/WebGL1 forcing tiling that textures that dont support it - uv = mod(uv,vec2(1.0,1.0)); + uv = mod(uv, vec2(1.0, 1.0)); #endif #if !defined(COLOR_USED) diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl index c32aabc4bf2..a6902836ed9 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -194,7 +194,7 @@ void main() { gl_FragColor = vec4(texturePanorama(source_panorama, N).rgb, 1.0); #else - gl_FragColor = vec4(textureCube(source_cube,N).rgb, 1.0); + gl_FragColor = vec4(textureCube(source_cube, N).rgb, 1.0); #endif //USE_SOURCE_PANORAMA #else diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index fa359125b2e..371ea8498a1 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -660,7 +660,6 @@ VERTEX_SHADER_CODE #if defined(RENDER_DEPTH) && defined(USE_RGBA_SHADOWS) position_interp = gl_Position; #endif - } /* clang-format off */ @@ -1358,12 +1357,9 @@ LIGHT_SHADER_CODE #endif - #define SAMPLE_SHADOW_TEXEL(p_shadow, p_pos, p_depth) step(p_depth, SHADOW_DEPTH(texture2D(p_shadow, p_pos))) #define SAMPLE_SHADOW_TEXEL_PROJ(p_shadow, p_pos) step(p_pos.z, SHADOW_DEPTH(texture2DProj(p_shadow, p_pos))) - - float sample_shadow(highp sampler2D shadow, highp vec4 spos) { #ifdef SHADOW_MODE_PCF_13 diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 44899bf9fc0..210fbe9f206 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1389,7 +1389,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant, if (!p_main && (!bundle_resources) && res->get_path().length() && res->get_path().find("::") == -1) { if (res->get_path() == local_path) { - ERR_PRINTS("Circular reference to resource being saved found: '"+local_path+"' will be null next time it's loaded."); + ERR_PRINTS("Circular reference to resource being saved found: '" + local_path + "' will be null next time it's loaded."); return; } int index = external_resources.size(); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 1ce31374d98..08b2a05d435 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -427,7 +427,7 @@ ImageTexture::ImageTexture() { storage = STORAGE_RAW; lossy_storage_quality = 0.7; image_stored = false; - format = Image::Format::FORMAT_L8; + format = Image::FORMAT_L8; } ImageTexture::~ImageTexture() { @@ -1516,7 +1516,7 @@ CubeMap::CubeMap() { cubemap = VisualServer::get_singleton()->texture_create(); storage = STORAGE_RAW; lossy_storage_quality = 0.7; - format = Image::Format::FORMAT_BPTC_RGBA; + format = Image::FORMAT_BPTC_RGBA; } CubeMap::~CubeMap() {