Fix GCC 5 build after #26331 and cleanup style

Also cleanup after 01a3dd3.
This commit is contained in:
Rémi Verschelde 2019-02-27 08:57:37 +01:00
parent caa42667e8
commit 0ba75c195e
10 changed files with 18 additions and 25 deletions

View file

@ -32,7 +32,8 @@
#include "core/os/os.h"
#include "core/variant_parser.h"
bool ResourceFormatImporter::SortImporterByName::operator() ( const Ref<ResourceImporter>& p_a,const Ref<ResourceImporter>& p_b) const {
bool ResourceFormatImporter::SortImporterByName::operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &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<String> *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;i<importers.size();i++) {
for (int i = 0; i < importers.size(); i++) {
if (importers[i]->get_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;i<importers.size();i++) {
hash+=":"+importers[i]->get_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();
}

View file

@ -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<ResourceImporter>& p_a,const Ref<ResourceImporter>& p_b) const;
bool operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const;
};
Vector<Ref<ResourceImporter> > 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<String> *r_paths);
void add_importer(const Ref<ResourceImporter> &p_importer) { importers.push_back(p_importer); importers.sort_custom<SortImporterByName>();}
void add_importer(const Ref<ResourceImporter> &p_importer) {
importers.push_back(p_importer);
importers.sort_custom<SortImporterByName>();
}
void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); }
Ref<ResourceImporter> get_importer_by_name(const String &p_name) const;
Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const;
@ -117,10 +120,9 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const = 0;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata=NULL) = 0;
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *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

View file

@ -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() :

View file

@ -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

View file

@ -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 {

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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() {