Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Optimize `ResourceLoaderBinary`

Ryan90917b227473
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index ea17f39e1e5..d26301066a5 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -40,9 +40,6 @@
#include "scene/property_utils.h"
#include "scene/resources/packed_scene.h"
-//#define print_bl(m_what) print_line(m_what)
-#define print_bl(m_what) (void)(m_what)
-
enum {
//numbering must be different from variant, in case new variant types are added (variant must be always contiguous for jumptable optimization)
VARIANT_NIL = 1,
@@ -157,7 +154,6 @@ StringName ResourceLoaderBinary::_get_string() {
Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
uint32_t prop_type = f->get_32();
- print_bl("find property of type: " + itos(prop_type));
switch (prop_type) {
case VARIANT_NIL: {
@@ -944,7 +940,7 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, boo
}
bool big_endian = f->get_32();
- bool use_real64 = f->get_32();
+ f->get_32(); // use_real64
f->set_big_endian(big_endian != 0); //read big endian if saved as big endian
@@ -952,13 +948,6 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, boo
uint32_t ver_minor = f->get_32();
ver_format = f->get_32();
- print_bl("big endian: " + itos(big_endian));
- print_bl("endian swap: " + itos(big_endian));
- print_bl("real64: " + itos(use_real64));
- print_bl("major: " + itos(ver_major));
- print_bl("minor: " + itos(ver_minor));
- print_bl("format: " + itos(ver_format));
-
if (ver_format > FORMAT_VERSION || ver_major > GODOT_VERSION_MAJOR) {
f.unref();
ERR_FAIL_MSG(vformat("File '%s' can't be loaded, as it uses a format version (%d) or engine version (%d.%d) which are not supported by your engine version (%s).",
@@ -967,8 +956,6 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, boo
type = get_unicode_string();
- print_bl("type: " + type);
-
importmd_ofs = f->get_64();
uint32_t flags = f->get_32();
if (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_NAMED_SCENE_IDS) {
@@ -1005,8 +992,6 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, boo
string_map.write[i] = s;
}
- print_bl("strings: " + itos(string_table_size));
-
uint32_t ext_resources_size = f->get_32();
for (uint32_t i = 0; i < ext_resources_size; i++) {
ExtResource er;
@@ -1034,7 +1019,6 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, boo
external_resources.push_back(er);
}
- print_bl("ext resources: " + itos(ext_resources_size));
uint32_t int_resources_size = f->get_32();
for (uint32_t i = 0; i < int_resources_size; i++) {
@@ -1044,8 +1028,6 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, boo
internal_resources.push_back(ir);
}
- print_bl("int resources: " + itos(int_resources_size));
-
if (f->eof_reached()) {
error = ERR_FILE_CORRUPT;
f.unref();