From da98357e6eddfbf5bcd226c4bf6c3beb4e2c3990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 20 Oct 2021 16:37:19 +0200 Subject: [PATCH] doctool: Fix differences between headless and Vulkan rendering backends Fixes #53913. --- drivers/vulkan/rendering_device_vulkan.cpp | 2 ++ main/main.cpp | 5 +++-- scene/2d/gpu_particles_2d.cpp | 1 + scene/3d/gpu_particles_3d.cpp | 1 + servers/rendering_server.cpp | 6 ++++++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 8743135f893..e7ac4474265 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -8913,6 +8913,8 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context, bool p_local_de } } + // Note: If adding new project settings here, also duplicate their definition in + // rendering_server.cpp for headless doctool. staging_buffer_block_size = GLOBAL_DEF("rendering/vulkan/staging_buffer/block_size_kb", 256); staging_buffer_block_size = MAX(4, staging_buffer_block_size); staging_buffer_block_size *= 1024; //kb -> bytes diff --git a/main/main.cpp b/main/main.cpp index 79957005caf..e78dec9bb37 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1343,8 +1343,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph display_driver_idx = 0; } - if (audio_driver == "") { // specified in project.godot - audio_driver = GLOBAL_DEF_RST_NOVAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name()); + GLOBAL_DEF_RST_NOVAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name()); + if (audio_driver == "") { // Specified in project.godot. + audio_driver = GLOBAL_GET("audio/driver/driver"); } for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index 3637594e1b0..6950fefdbe6 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -532,6 +532,7 @@ void GPUParticles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_trail_section_subdivisions"), &GPUParticles2D::get_trail_section_subdivisions); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting"); + ADD_PROPERTY_DEFAULT("emitting", true); // Workaround for doctool in headless mode, as dummy rasterizer always returns false. ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,1000000,1,exp"), "set_amount", "get_amount"); ADD_GROUP("Time", ""); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime"); diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 32a62d8c7ea..ea6242b6692 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -562,6 +562,7 @@ void GPUParticles3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_transform_align"), &GPUParticles3D::get_transform_align); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting"); + ADD_PROPERTY_DEFAULT("emitting", true); // Workaround for doctool in headless mode, as dummy rasterizer always returns false. ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,1000000,1,exp"), "set_amount", "get_amount"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "sub_emitter", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "GPUParticles3D"), "set_sub_emitter", "get_sub_emitter"); ADD_GROUP("Time", ""); diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index b3efe840b6f..348d46545b9 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -2810,6 +2810,12 @@ RenderingServer::RenderingServer() { PropertyInfo(Variant::INT, "rendering/vulkan/rendering/back_end", PROPERTY_HINT_ENUM, "Forward Clustered (Supports Desktop Only),Forward Mobile (Supports Desktop and Mobile)")); + // Already defined in RenderingDeviceVulkan::initialize which runs before this code. + // We re-define them here just for doctool's sake. Make sure to keep default values in sync. + GLOBAL_DEF("rendering/vulkan/staging_buffer/block_size_kb", 256); + GLOBAL_DEF("rendering/vulkan/staging_buffer/max_size_mb", 128); + GLOBAL_DEF("rendering/vulkan/staging_buffer/texture_upload_region_size_px", 64); + GLOBAL_DEF("rendering/vulkan/descriptor_pools/max_descriptors_per_pool", 64); GLOBAL_DEF("rendering/3d/viewport/scale", 1.0); ProjectSettings::get_singleton()->set_custom_property_info("rendering/3d/viewport/scale",