1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

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/os/os.h"
#include "core/variant_parser.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(); 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; return pat.metadata;
} }
void ResourceFormatImporter::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) { void ResourceFormatImporter::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {
PathAndType pat; PathAndType pat;
@@ -394,7 +394,7 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con
return false; 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]->get_importer_name() == pat.importer) {
if (!importers[i]->are_import_settings_valid(p_path)) { //importer thinks this is not valid if (!importers[i]->are_import_settings_valid(p_path)) { //importer thinks this is not valid
return false; return false;
@@ -405,10 +405,10 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con
return true; return true;
} }
String ResourceFormatImporter::get_import_settings_hash() const { String ResourceFormatImporter::get_import_settings_hash() const {
String hash; String hash;
for(int i=0;i<importers.size();i++) { for (int i = 0; i < importers.size(); i++) {
hash+=":"+importers[i]->get_importer_name()+":"+importers[i]->get_import_settings_string(); hash += ":" + importers[i]->get_importer_name() + ":" + importers[i]->get_import_settings_string();
} }
return hash.md5_text(); 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 //need them to stay in order to compute the settings hash
struct SortImporterByName { 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; Vector<Ref<ResourceImporter> > importers;
@@ -75,7 +75,10 @@ public:
String get_internal_resource_path(const String &p_path) const; 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 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); } 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_name(const String &p_name) const;
Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) 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 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 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 bool are_import_settings_valid(const String &p_path) const { return true; }
virtual String get_import_settings_string() const { return String(); } virtual String get_import_settings_string() const { return String(); }
}; };
#endif // RESOURCE_IMPORTER_H #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; physics_frame_time = p_physics_frame_time;
} }
ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL; ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL;
ScriptDebuggerRemote::ScriptDebuggerRemote() : ScriptDebuggerRemote::ScriptDebuggerRemote() :

View File

@@ -42,8 +42,6 @@
#define glClearDepth glClearDepthf #define glClearDepth glClearDepthf
#endif #endif
#define _DEPTH_COMPONENT24_OES 0x81A6
static const GLenum _cube_side_enum[6] = { static const GLenum _cube_side_enum[6] = {
GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 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]); glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], rpi->cubemap, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], rpi->cubemap, 0);
glBindRenderbuffer(GL_RENDERBUFFER, rpi->depth); 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); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rpi->depth);
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED

View File

@@ -54,8 +54,6 @@ GLuint RasterizerStorageGLES2::system_fbo = 0;
#define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
#define _DEPTH_COMPONENT24_OES 0x81A6
#define _RED_OES 0x1903 #define _RED_OES 0x1903
void RasterizerStorageGLES2::bind_quad_array() const { void RasterizerStorageGLES2::bind_quad_array() const {

View File

@@ -349,7 +349,7 @@ void main() {
vec2 uv = uv_interp; vec2 uv = uv_interp;
#ifdef USE_FORCE_REPEAT #ifdef USE_FORCE_REPEAT
//needs to use this to workaround GLES2/WebGL1 forcing tiling that textures that dont support it //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 #endif
#if !defined(COLOR_USED) #if !defined(COLOR_USED)

View File

@@ -194,7 +194,7 @@ void main() {
gl_FragColor = vec4(texturePanorama(source_panorama, N).rgb, 1.0); gl_FragColor = vec4(texturePanorama(source_panorama, N).rgb, 1.0);
#else #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 #endif //USE_SOURCE_PANORAMA
#else #else

View File

@@ -660,7 +660,6 @@ VERTEX_SHADER_CODE
#if defined(RENDER_DEPTH) && defined(USE_RGBA_SHADOWS) #if defined(RENDER_DEPTH) && defined(USE_RGBA_SHADOWS)
position_interp = gl_Position; position_interp = gl_Position;
#endif #endif
} }
/* clang-format off */ /* clang-format off */
@@ -1358,12 +1357,9 @@ LIGHT_SHADER_CODE
#endif #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(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))) #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) { float sample_shadow(highp sampler2D shadow, highp vec4 spos) {
#ifdef SHADOW_MODE_PCF_13 #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 (!p_main && (!bundle_resources) && res->get_path().length() && res->get_path().find("::") == -1) {
if (res->get_path() == local_path) { 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; return;
} }
int index = external_resources.size(); int index = external_resources.size();

View File

@@ -427,7 +427,7 @@ ImageTexture::ImageTexture() {
storage = STORAGE_RAW; storage = STORAGE_RAW;
lossy_storage_quality = 0.7; lossy_storage_quality = 0.7;
image_stored = false; image_stored = false;
format = Image::Format::FORMAT_L8; format = Image::FORMAT_L8;
} }
ImageTexture::~ImageTexture() { ImageTexture::~ImageTexture() {
@@ -1516,7 +1516,7 @@ CubeMap::CubeMap() {
cubemap = VisualServer::get_singleton()->texture_create(); cubemap = VisualServer::get_singleton()->texture_create();
storage = STORAGE_RAW; storage = STORAGE_RAW;
lossy_storage_quality = 0.7; lossy_storage_quality = 0.7;
format = Image::Format::FORMAT_BPTC_RGBA; format = Image::FORMAT_BPTC_RGBA;
} }
CubeMap::~CubeMap() { CubeMap::~CubeMap() {