-Fix disable_3d flag
-Add extra flag optimize=[size,speed] to be able to prioritize size
This commit is contained in:
parent
cfcb6e11f2
commit
2b9902db06
|
@ -145,6 +145,7 @@ opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32
|
|||
opts.Add('p', "Platform (alias for 'platform')", '')
|
||||
opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
|
||||
opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release')))
|
||||
opts.Add(EnumVariable('optimize', "Optimization type", 'speed', ('speed', 'size')))
|
||||
opts.Add(BoolVariable('tools', "Build the tools (a.k.a. the Godot editor)", True))
|
||||
opts.Add(BoolVariable('use_lto', 'Use link-time optimization', False))
|
||||
|
||||
|
|
|
@ -37,14 +37,17 @@
|
|||
@author AndreaCatania
|
||||
*/
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
PhysicsServer *_createBulletPhysicsCallback() {
|
||||
return memnew(BulletPhysicsServer);
|
||||
}
|
||||
#endif
|
||||
|
||||
void register_bullet_types() {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
PhysicsServerManager::register_server("Bullet", &_createBulletPhysicsCallback);
|
||||
PhysicsServerManager::set_default_server("Bullet", 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void unregister_bullet_types() {
|
||||
|
|
|
@ -139,8 +139,13 @@ def configure(env):
|
|||
## Build type
|
||||
|
||||
if (env["target"].startswith("release")):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(LINKFLAGS=['-O2'])
|
||||
env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer'])
|
||||
else: #optimize for size
|
||||
env.Append(CPPFLAGS=['-Os', '-DNDEBUG'])
|
||||
env.Append(LINKFLAGS=['-Os'])
|
||||
|
||||
if (can_vectorize):
|
||||
env.Append(CPPFLAGS=['-ftree-vectorize'])
|
||||
if (env["target"] == "release_debug"):
|
||||
|
|
|
@ -47,8 +47,12 @@ def configure(env):
|
|||
|
||||
if (env["target"].startswith("release")):
|
||||
env.Append(CPPFLAGS=['-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1'])
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations'])
|
||||
env.Append(LINKFLAGS=['-O2'])
|
||||
else: #optimize for size
|
||||
env.Append(CPPFLAGS=['-Os', '-ftree-vectorize'])
|
||||
env.Append(LINKFLAGS=['-Os'])
|
||||
|
||||
if env["target"] == "release_debug":
|
||||
env.Append(CPPFLAGS=['-DDEBUG_ENABLED'])
|
||||
|
|
|
@ -39,14 +39,21 @@ def configure(env):
|
|||
## Build type
|
||||
|
||||
if (env["target"] == "release"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O3', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os','-ftree-vectorize', '-msse2'])
|
||||
|
||||
if (env["debug_symbols"] == "yes"):
|
||||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
env.Prepend(CCFLAGS=['-g2'])
|
||||
|
||||
elif (env["target"] == "release_debug"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os', '-DDEBUG_ENABLED'])
|
||||
if (env["debug_symbols"] == "yes"):
|
||||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
|
|
|
@ -166,12 +166,18 @@ def configure_msvc(env, manual_msvc_config):
|
|||
# Build type
|
||||
|
||||
if (env["target"] == "release"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(CCFLAGS=['/O2'])
|
||||
else: # optimize for size
|
||||
env.Append(CCFLAGS=['/O1'])
|
||||
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
|
||||
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
|
||||
|
||||
elif (env["target"] == "release_debug"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(CCFLAGS=['/O2'])
|
||||
else: # optimize for size
|
||||
env.Append(CCFLAGS=['/O1'])
|
||||
env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED'])
|
||||
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
|
||||
|
||||
|
@ -247,10 +253,14 @@ def configure_mingw(env):
|
|||
if (env["target"] == "release"):
|
||||
env.Append(CCFLAGS=['-msse2'])
|
||||
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
if (env["bits"] == "64"):
|
||||
env.Append(CCFLAGS=['-O3'])
|
||||
else:
|
||||
env.Append(CCFLAGS=['-O2'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os'])
|
||||
|
||||
|
||||
env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
|
||||
|
||||
|
@ -265,6 +275,10 @@ def configure_mingw(env):
|
|||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
env.Prepend(CCFLAGS=['-g2'])
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(CCFLAGS=['-O2'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os'])
|
||||
|
||||
elif (env["target"] == "debug"):
|
||||
env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
|
||||
|
|
|
@ -81,14 +81,22 @@ def configure(env):
|
|||
if (env["target"] == "release"):
|
||||
# -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
|
||||
# -ffast-math in code for which it generates wrong results.
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os'])
|
||||
|
||||
if (env["debug_symbols"] == "yes"):
|
||||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
env.Prepend(CCFLAGS=['-g2'])
|
||||
|
||||
elif (env["target"] == "release_debug"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os', '-DDEBUG_ENABLED'])
|
||||
|
||||
if (env["debug_symbols"] == "yes"):
|
||||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
|
|
|
@ -312,21 +312,19 @@ void register_scene_types() {
|
|||
ClassDB::register_class<CenterContainer>();
|
||||
ClassDB::register_class<ScrollContainer>();
|
||||
ClassDB::register_class<PanelContainer>();
|
||||
ClassDB::register_virtual_class<SplitContainer>();
|
||||
ClassDB::register_class<HSplitContainer>();
|
||||
ClassDB::register_class<VSplitContainer>();
|
||||
ClassDB::register_class<GraphNode>();
|
||||
ClassDB::register_class<GraphEdit>();
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
ClassDB::register_class<TextureProgress>();
|
||||
ClassDB::register_class<ItemList>();
|
||||
|
||||
ClassDB::register_class<LineEdit>();
|
||||
ClassDB::register_class<VideoPlayer>();
|
||||
|
||||
#ifndef ADVANCED_GUI_DISABLED
|
||||
|
||||
ClassDB::register_class<FileDialog>();
|
||||
ClassDB::register_class<LineEdit>();
|
||||
|
||||
ClassDB::register_class<PopupMenu>();
|
||||
ClassDB::register_class<Tree>();
|
||||
|
||||
|
@ -343,9 +341,13 @@ void register_scene_types() {
|
|||
ClassDB::register_class<WindowDialog>();
|
||||
ClassDB::register_class<AcceptDialog>();
|
||||
ClassDB::register_class<ConfirmationDialog>();
|
||||
ClassDB::register_class<VideoPlayer>();
|
||||
ClassDB::register_class<MarginContainer>();
|
||||
ClassDB::register_class<ViewportContainer>();
|
||||
ClassDB::register_virtual_class<SplitContainer>();
|
||||
ClassDB::register_class<HSplitContainer>();
|
||||
ClassDB::register_class<VSplitContainer>();
|
||||
ClassDB::register_class<GraphNode>();
|
||||
ClassDB::register_class<GraphEdit>();
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
|
|
|
@ -1367,6 +1367,8 @@ void PhysicsServerSW::init() {
|
|||
|
||||
void PhysicsServerSW::step(real_t p_step) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
if (!active)
|
||||
return;
|
||||
|
||||
|
@ -1387,6 +1389,7 @@ void PhysicsServerSW::step(real_t p_step) {
|
|||
active_objects += E->get()->get_active_objects();
|
||||
collision_pairs += E->get()->get_collision_pairs();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void PhysicsServerSW::sync(){
|
||||
|
@ -1395,6 +1398,8 @@ void PhysicsServerSW::sync(){
|
|||
|
||||
void PhysicsServerSW::flush_queries() {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
if (!active)
|
||||
return;
|
||||
|
||||
|
@ -1441,6 +1446,7 @@ void PhysicsServerSW::flush_queries() {
|
|||
|
||||
ScriptDebugger::get_singleton()->add_profiling_frame_data("physics", values);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
void PhysicsServerSW::finish() {
|
||||
|
|
|
@ -400,6 +400,8 @@ void PhysicsShapeQueryResult::_bind_methods() {
|
|||
|
||||
void PhysicsServer::_bind_methods() {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
ClassDB::bind_method(D_METHOD("shape_create", "type"), &PhysicsServer::shape_create);
|
||||
ClassDB::bind_method(D_METHOD("shape_set_data", "shape", "data"), &PhysicsServer::shape_set_data);
|
||||
|
||||
|
@ -737,6 +739,8 @@ void PhysicsServer::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(BODY_AXIS_ANGULAR_X);
|
||||
BIND_ENUM_CONSTANT(BODY_AXIS_ANGULAR_Y);
|
||||
BIND_ENUM_CONSTANT(BODY_AXIS_ANGULAR_Z);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
PhysicsServer::PhysicsServer() {
|
||||
|
|
|
@ -1645,6 +1645,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
|
|||
|
||||
void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
|
||||
// render to mono camera
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
Camera *camera = camera_owner.getornull(p_camera);
|
||||
ERR_FAIL_COND(!camera);
|
||||
|
@ -1679,6 +1680,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_view
|
|||
|
||||
_prepare_scene(camera->transform, camera_matrix, ortho, camera->env, camera->visible_layers, p_scenario, p_shadow_atlas, RID());
|
||||
_render_scene(camera->transform, camera_matrix, ortho, camera->env, p_scenario, p_shadow_atlas, RID(), -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VisualServerScene::render_camera(Ref<ARVRInterface> &p_interface, ARVRInterface::Eyes p_eye, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
|
||||
|
@ -2102,6 +2104,8 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
|
|||
|
||||
void VisualServerScene::render_empty_scene(RID p_scenario, RID p_shadow_atlas) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
Scenario *scenario = scenario_owner.getornull(p_scenario);
|
||||
|
||||
RID environment;
|
||||
|
@ -2110,6 +2114,7 @@ void VisualServerScene::render_empty_scene(RID p_scenario, RID p_shadow_atlas) {
|
|||
else
|
||||
environment = scenario->fallback_environment;
|
||||
VSG::scene_render->render_scene(Transform(), CameraMatrix(), true, NULL, 0, NULL, 0, NULL, 0, environment, p_shadow_atlas, scenario->reflection_atlas, RID(), 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int p_step) {
|
||||
|
|
|
@ -1543,10 +1543,10 @@ void VisualServer::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("texture_debug_usage"), &VisualServer::_texture_debug_usage_bind);
|
||||
ClassDB::bind_method(D_METHOD("textures_keep_original", "enable"), &VisualServer::textures_keep_original);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("sky_create"), &VisualServer::sky_create);
|
||||
ClassDB::bind_method(D_METHOD("sky_set_texture", "sky", "cube_map", "radiance_size"), &VisualServer::sky_set_texture);
|
||||
|
||||
#endif
|
||||
ClassDB::bind_method(D_METHOD("shader_create"), &VisualServer::shader_create);
|
||||
ClassDB::bind_method(D_METHOD("shader_set_code", "shader", "code"), &VisualServer::shader_set_code);
|
||||
ClassDB::bind_method(D_METHOD("shader_get_code", "shader"), &VisualServer::shader_get_code);
|
||||
|
@ -1603,7 +1603,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("multimesh_set_visible_instances", "multimesh", "visible"), &VisualServer::multimesh_set_visible_instances);
|
||||
ClassDB::bind_method(D_METHOD("multimesh_get_visible_instances", "multimesh"), &VisualServer::multimesh_get_visible_instances);
|
||||
ClassDB::bind_method(D_METHOD("multimesh_set_as_bulk_array", "multimesh", "array"), &VisualServer::multimesh_set_as_bulk_array);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("immediate_create"), &VisualServer::immediate_create);
|
||||
ClassDB::bind_method(D_METHOD("immediate_begin", "immediate", "primitive", "texture"), &VisualServer::immediate_begin, DEFVAL(RID()));
|
||||
ClassDB::bind_method(D_METHOD("immediate_vertex", "immediate", "vertex"), &VisualServer::immediate_vertex);
|
||||
|
@ -1617,6 +1617,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("immediate_clear", "immediate"), &VisualServer::immediate_clear);
|
||||
ClassDB::bind_method(D_METHOD("immediate_set_material", "immediate", "material"), &VisualServer::immediate_set_material);
|
||||
ClassDB::bind_method(D_METHOD("immediate_get_material", "immediate"), &VisualServer::immediate_get_material);
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("skeleton_create"), &VisualServer::skeleton_create);
|
||||
ClassDB::bind_method(D_METHOD("skeleton_allocate", "skeleton", "bones", "is_2d_skeleton"), &VisualServer::skeleton_allocate, DEFVAL(false));
|
||||
|
@ -1626,6 +1627,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform_2d", "skeleton", "bone", "transform"), &VisualServer::skeleton_bone_set_transform_2d);
|
||||
ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform_2d", "skeleton", "bone"), &VisualServer::skeleton_bone_get_transform_2d);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("directional_light_create"), &VisualServer::directional_light_create);
|
||||
ClassDB::bind_method(D_METHOD("omni_light_create"), &VisualServer::omni_light_create);
|
||||
ClassDB::bind_method(D_METHOD("spot_light_create"), &VisualServer::spot_light_create);
|
||||
|
@ -1695,7 +1697,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree", "capture"), &VisualServer::lightmap_capture_get_octree);
|
||||
ClassDB::bind_method(D_METHOD("lightmap_capture_set_energy", "capture", "energy"), &VisualServer::lightmap_capture_set_energy);
|
||||
ClassDB::bind_method(D_METHOD("lightmap_capture_get_energy", "capture"), &VisualServer::lightmap_capture_get_energy);
|
||||
|
||||
#endif
|
||||
ClassDB::bind_method(D_METHOD("particles_create"), &VisualServer::particles_create);
|
||||
ClassDB::bind_method(D_METHOD("particles_set_emitting", "particles", "emitting"), &VisualServer::particles_set_emitting);
|
||||
ClassDB::bind_method(D_METHOD("particles_get_emitting", "particles"), &VisualServer::particles_get_emitting);
|
||||
|
@ -1782,6 +1784,8 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("scenario_set_reflection_atlas_size", "scenario", "p_size", "subdiv"), &VisualServer::scenario_set_reflection_atlas_size);
|
||||
ClassDB::bind_method(D_METHOD("scenario_set_fallback_environment", "scenario", "environment"), &VisualServer::scenario_set_fallback_environment);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
ClassDB::bind_method(D_METHOD("instance_create2", "base", "scenario"), &VisualServer::instance_create2);
|
||||
ClassDB::bind_method(D_METHOD("instance_create"), &VisualServer::instance_create);
|
||||
ClassDB::bind_method(D_METHOD("instance_set_base", "instance", "base"), &VisualServer::instance_set_base);
|
||||
|
@ -1806,7 +1810,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("instances_cull_aabb", "aabb", "scenario"), &VisualServer::_instances_cull_aabb_bind, DEFVAL(RID()));
|
||||
ClassDB::bind_method(D_METHOD("instances_cull_ray", "from", "to", "scenario"), &VisualServer::_instances_cull_ray_bind, DEFVAL(RID()));
|
||||
ClassDB::bind_method(D_METHOD("instances_cull_convex", "convex", "scenario"), &VisualServer::_instances_cull_convex_bind, DEFVAL(RID()));
|
||||
|
||||
#endif
|
||||
ClassDB::bind_method(D_METHOD("canvas_create"), &VisualServer::canvas_create);
|
||||
ClassDB::bind_method(D_METHOD("canvas_set_item_mirroring", "canvas", "item", "mirroring"), &VisualServer::canvas_set_item_mirroring);
|
||||
ClassDB::bind_method(D_METHOD("canvas_set_modulate", "canvas", "color"), &VisualServer::canvas_set_modulate);
|
||||
|
@ -1889,12 +1893,13 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("init"), &VisualServer::init);
|
||||
ClassDB::bind_method(D_METHOD("finish"), &VisualServer::finish);
|
||||
ClassDB::bind_method(D_METHOD("get_render_info", "info"), &VisualServer::get_render_info);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_test_cube"), &VisualServer::get_test_cube);
|
||||
ClassDB::bind_method(D_METHOD("get_test_texture"), &VisualServer::get_test_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_white_texture"), &VisualServer::get_white_texture);
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
ClassDB::bind_method(D_METHOD("make_sphere_mesh", "latitudes", "longitudes", "radius"), &VisualServer::make_sphere_mesh);
|
||||
ClassDB::bind_method(D_METHOD("get_test_cube"), &VisualServer::get_test_cube);
|
||||
#endif
|
||||
ClassDB::bind_method(D_METHOD("get_test_texture"), &VisualServer::get_test_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_white_texture"), &VisualServer::get_white_texture);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_boot_image", "image", "color", "scale"), &VisualServer::set_boot_image);
|
||||
ClassDB::bind_method(D_METHOD("set_default_clear_color", "color"), &VisualServer::set_default_clear_color);
|
||||
|
|
Loading…
Reference in New Issue