summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp35
-rw-r--r--main/performance.cpp56
-rw-r--r--main/performance.h12
3 files changed, 29 insertions, 74 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 9e3b5c9ba2..0651f4b93f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -151,9 +151,9 @@ static bool auto_build_solutions = false;
static DisplayServer::WindowMode window_mode = DisplayServer::WINDOW_MODE_WINDOWED;
static DisplayServer::ScreenOrientation window_orientation = DisplayServer::SCREEN_LANDSCAPE;
+static DisplayServer::VSyncMode window_vsync_mode = DisplayServer::VSYNC_ENABLED;
static uint32_t window_flags = 0;
static Size2i window_size = Size2i(1024, 600);
-static bool window_vsync_via_compositor = false;
static int init_screen = -1;
static bool init_fullscreen = false;
@@ -338,8 +338,6 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS and Windows only).\n");
OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
- OS::get_singleton()->print(" --enable-vsync-via-compositor When vsync is enabled, vsync via the OS' window compositor (Windows only).\n");
- OS::get_singleton()->print(" --disable-vsync-via-compositor Disable vsync via the OS' window compositor (Windows only).\n");
OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n");
OS::get_singleton()->print(" --tablet-driver Pen tablet input driver.\n");
OS::get_singleton()->print("\n");
@@ -551,7 +549,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
translation_server = memnew(TranslationServer);
performance = memnew(Performance);
- ClassDB::register_class<Performance>();
+ GDREGISTER_CLASS(Performance);
engine->add_singleton(Engine::Singleton("Performance", performance));
// Only flush stdout in debug builds by default, as spamming `print()` will
@@ -599,11 +597,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
- bool saw_vsync_via_compositor_override = false;
#ifdef TOOLS_ENABLED
bool found_project = false;
#endif
- bool use_vsync = false;
packed_data = PackedData::get_singleton();
if (!packed_data) {
@@ -825,12 +821,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--no-window") { // disable window creation (Windows only)
OS::get_singleton()->set_no_window_mode(true);
- } else if (I->get() == "--enable-vsync-via-compositor") {
- window_vsync_via_compositor = true;
- saw_vsync_via_compositor_override = true;
- } else if (I->get() == "--disable-vsync-via-compositor") {
- window_vsync_via_compositor = false;
- saw_vsync_via_compositor_override = true;
#endif
} else if (I->get() == "--profiling") { // enable profiling
@@ -1287,19 +1277,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_allow_hidpi = GLOBAL_DEF("display/window/dpi/allow_hidpi", false);
}
- use_vsync = GLOBAL_DEF_RST("display/window/vsync/use_vsync", true);
- OS::get_singleton()->_use_vsync = use_vsync;
-
- if (!saw_vsync_via_compositor_override) {
- // If one of the command line options to enable/disable vsync via the
- // window compositor ("--enable-vsync-via-compositor" or
- // "--disable-vsync-via-compositor") was present then it overrides the
- // project setting.
- window_vsync_via_compositor = GLOBAL_DEF("display/window/vsync/vsync_via_compositor", false);
- }
-
- OS::get_singleton()->_vsync_via_compositor = window_vsync_via_compositor;
-
/* todo restore
OS::get_singleton()->_allow_layered = GLOBAL_DEF("display/window/per_pixel_transparency/allowed", false);
video_mode.layered = GLOBAL_DEF("display/window/per_pixel_transparency/enabled", false);
@@ -1357,7 +1334,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
{
window_orientation = DisplayServer::ScreenOrientation(int(GLOBAL_DEF_BASIC("display/window/handheld/orientation", DisplayServer::ScreenOrientation::SCREEN_LANDSCAPE)));
}
-
+ {
+ window_vsync_mode = DisplayServer::VSyncMode(int(GLOBAL_DEF("display/window/vsync/vsync_mode", DisplayServer::VSyncMode::VSYNC_ENABLED)));
+ }
Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF_BASIC("physics/common/physics_fps", 60));
ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_fps",
PropertyInfo(Variant::INT, "physics/common/physics_fps",
@@ -1550,14 +1529,14 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
String rendering_driver; // temp broken
Error err;
- display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_flags, window_size, err);
+ display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_vsync_mode, window_flags, window_size, err);
if (err != OK || display_server == nullptr) {
//ok i guess we can't use this display server, try other ones
for (int i = 0; i < DisplayServer::get_create_function_count(); i++) {
if (i == display_driver_idx) {
continue; //don't try the same twice
}
- display_server = DisplayServer::create(i, rendering_driver, window_mode, window_flags, window_size, err);
+ display_server = DisplayServer::create(i, rendering_driver, window_mode, window_vsync_mode, window_flags, window_size, err);
if (err == OK && display_server != nullptr) {
break;
}
diff --git a/main/performance.cpp b/main/performance.cpp
index a2e53f2ee2..9f5be7b8c4 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -60,16 +60,12 @@ void Performance::_bind_methods() {
BIND_ENUM_CONSTANT(OBJECT_RESOURCE_COUNT);
BIND_ENUM_CONSTANT(OBJECT_NODE_COUNT);
BIND_ENUM_CONSTANT(OBJECT_ORPHAN_NODE_COUNT);
- BIND_ENUM_CONSTANT(RENDER_OBJECTS_IN_FRAME);
- BIND_ENUM_CONSTANT(RENDER_VERTICES_IN_FRAME);
- BIND_ENUM_CONSTANT(RENDER_MATERIAL_CHANGES_IN_FRAME);
- BIND_ENUM_CONSTANT(RENDER_SHADER_CHANGES_IN_FRAME);
- BIND_ENUM_CONSTANT(RENDER_SURFACE_CHANGES_IN_FRAME);
- BIND_ENUM_CONSTANT(RENDER_DRAW_CALLS_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_TOTAL_OBJECTS_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_TOTAL_PRIMITIVES_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_TOTAL_DRAW_CALLS_IN_FRAME);
BIND_ENUM_CONSTANT(RENDER_VIDEO_MEM_USED);
BIND_ENUM_CONSTANT(RENDER_TEXTURE_MEM_USED);
- BIND_ENUM_CONSTANT(RENDER_VERTEX_MEM_USED);
- BIND_ENUM_CONSTANT(RENDER_USAGE_VIDEO_MEM_TOTAL);
+ BIND_ENUM_CONSTANT(RENDER_BUFFER_MEM_USED);
BIND_ENUM_CONSTANT(PHYSICS_2D_ACTIVE_OBJECTS);
BIND_ENUM_CONSTANT(PHYSICS_2D_COLLISION_PAIRS);
BIND_ENUM_CONSTANT(PHYSICS_2D_ISLAND_COUNT);
@@ -103,16 +99,12 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
"object/resources",
"object/nodes",
"object/orphan_nodes",
- "raster/objects_drawn",
- "raster/vertices_drawn",
- "raster/mat_changes",
- "raster/shader_changes",
- "raster/surface_changes",
- "raster/draw_calls",
+ "raster/total_objects_drawn",
+ "raster/total_primitives_drawn",
+ "raster/total_draw_calls",
"video/video_mem",
"video/texture_mem",
- "video/vertex_mem",
- "video/video_mem_max",
+ "video/buffer_mem",
"physics_2d/active_objects",
"physics_2d/collision_pairs",
"physics_2d/islands",
@@ -148,26 +140,18 @@ float Performance::get_monitor(Monitor p_monitor) const {
return _get_node_count();
case OBJECT_ORPHAN_NODE_COUNT:
return Node::orphan_node_count;
- case RENDER_OBJECTS_IN_FRAME:
- return RS::get_singleton()->get_render_info(RS::INFO_OBJECTS_IN_FRAME);
- case RENDER_VERTICES_IN_FRAME:
- return RS::get_singleton()->get_render_info(RS::INFO_VERTICES_IN_FRAME);
- case RENDER_MATERIAL_CHANGES_IN_FRAME:
- return RS::get_singleton()->get_render_info(RS::INFO_MATERIAL_CHANGES_IN_FRAME);
- case RENDER_SHADER_CHANGES_IN_FRAME:
- return RS::get_singleton()->get_render_info(RS::INFO_SHADER_CHANGES_IN_FRAME);
- case RENDER_SURFACE_CHANGES_IN_FRAME:
- return RS::get_singleton()->get_render_info(RS::INFO_SURFACE_CHANGES_IN_FRAME);
- case RENDER_DRAW_CALLS_IN_FRAME:
- return RS::get_singleton()->get_render_info(RS::INFO_DRAW_CALLS_IN_FRAME);
+ case RENDER_TOTAL_OBJECTS_IN_FRAME:
+ return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME);
+ case RENDER_TOTAL_PRIMITIVES_IN_FRAME:
+ return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME);
+ case RENDER_TOTAL_DRAW_CALLS_IN_FRAME:
+ return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME);
case RENDER_VIDEO_MEM_USED:
- return RS::get_singleton()->get_render_info(RS::INFO_VIDEO_MEM_USED);
+ return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_VIDEO_MEM_USED);
case RENDER_TEXTURE_MEM_USED:
- return RS::get_singleton()->get_render_info(RS::INFO_TEXTURE_MEM_USED);
- case RENDER_VERTEX_MEM_USED:
- return RS::get_singleton()->get_render_info(RS::INFO_VERTEX_MEM_USED);
- case RENDER_USAGE_VIDEO_MEM_TOTAL:
- return RS::get_singleton()->get_render_info(RS::INFO_USAGE_VIDEO_MEM_TOTAL);
+ return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_TEXTURE_MEM_USED);
+ case RENDER_BUFFER_MEM_USED:
+ return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_BUFFER_MEM_USED);
case PHYSICS_2D_ACTIVE_OBJECTS:
return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ACTIVE_OBJECTS);
case PHYSICS_2D_COLLISION_PAIRS:
@@ -207,10 +191,6 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
- MONITOR_TYPE_QUANTITY,
- MONITOR_TYPE_QUANTITY,
- MONITOR_TYPE_QUANTITY,
- MONITOR_TYPE_MEMORY,
MONITOR_TYPE_MEMORY,
MONITOR_TYPE_MEMORY,
MONITOR_TYPE_MEMORY,
diff --git a/main/performance.h b/main/performance.h
index 122e5a4f9a..174b3500d1 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -73,16 +73,12 @@ public:
OBJECT_RESOURCE_COUNT,
OBJECT_NODE_COUNT,
OBJECT_ORPHAN_NODE_COUNT,
- RENDER_OBJECTS_IN_FRAME,
- RENDER_VERTICES_IN_FRAME,
- RENDER_MATERIAL_CHANGES_IN_FRAME,
- RENDER_SHADER_CHANGES_IN_FRAME,
- RENDER_SURFACE_CHANGES_IN_FRAME,
- RENDER_DRAW_CALLS_IN_FRAME,
+ RENDER_TOTAL_OBJECTS_IN_FRAME,
+ RENDER_TOTAL_PRIMITIVES_IN_FRAME,
+ RENDER_TOTAL_DRAW_CALLS_IN_FRAME,
RENDER_VIDEO_MEM_USED,
RENDER_TEXTURE_MEM_USED,
- RENDER_VERTEX_MEM_USED,
- RENDER_USAGE_VIDEO_MEM_TOTAL,
+ RENDER_BUFFER_MEM_USED,
PHYSICS_2D_ACTIVE_OBJECTS,
PHYSICS_2D_COLLISION_PAIRS,
PHYSICS_2D_ISLAND_COUNT,