[Editor,Servers]: Minor optimizations

This commit is contained in:
Stuart Carnie 2024-09-12 06:19:24 +10:00
parent 14a7e0abb3
commit 5cfacc8767
No known key found for this signature in database
GPG Key ID: 848D9C9718D78B4F
5 changed files with 18 additions and 19 deletions

View File

@ -2246,7 +2246,7 @@ void EditorInspectorArray::_setup() {
}
move_vbox->add_child(ae.move_texture_rect);
if (element_position < _get_array_count() - 1) {
if (element_position < count - 1) {
ae.move_down = memnew(Button);
ae.move_down->set_icon(get_editor_theme_icon(SNAME("MoveDown")));
ae.move_down->connect(SceneStringName(pressed), callable_mp(this, &EditorInspectorArray::_move_element).bind(element_position, element_position + 2));

View File

@ -1487,7 +1487,7 @@ void AudioServer::init() {
void AudioServer::update() {
#ifdef DEBUG_ENABLED
if (EngineDebugger::is_profiling("servers")) {
if (EngineDebugger::is_profiling(SNAME("servers"))) {
// Driver time includes server time + effects times
// Server time includes effects times
uint64_t driver_time = AudioDriver::get_singleton()->get_profiling_time();

View File

@ -818,8 +818,9 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
blit.dst_rect.size = vp->size;
}
if (!blit_to_screen_list.has(vp->viewport_to_screen)) {
blit_to_screen_list[vp->viewport_to_screen] = Vector<BlitToScreen>();
Vector<BlitToScreen> *blits = blit_to_screen_list.getptr(vp->viewport_to_screen);
if (blits == nullptr) {
blits = &blit_to_screen_list.insert(vp->viewport_to_screen, Vector<BlitToScreen>())->value;
}
if (OS::get_singleton()->get_current_rendering_driver_name().begins_with("opengl3")) {
@ -828,7 +829,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
RSG::rasterizer->blit_render_targets_to_screen(vp->viewport_to_screen, blit_to_screen_vec.ptr(), 1);
RSG::rasterizer->gl_end_frame(p_swap_buffers);
} else {
blit_to_screen_list[vp->viewport_to_screen].push_back(blit);
blits->push_back(blit);
}
}
}

View File

@ -138,17 +138,17 @@ RenderingDevice::ShaderSPIRVGetCacheKeyFunction RenderingDevice::get_spirv_cache
/***************************/
void RenderingDevice::_add_dependency(RID p_id, RID p_depends_on) {
if (!dependency_map.has(p_depends_on)) {
dependency_map[p_depends_on] = HashSet<RID>();
HashSet<RID> *set = dependency_map.getptr(p_depends_on);
if (set == nullptr) {
set = &dependency_map.insert(p_depends_on, HashSet<RID>())->value;
}
set->insert(p_id);
dependency_map[p_depends_on].insert(p_id);
if (!reverse_dependency_map.has(p_id)) {
reverse_dependency_map[p_id] = HashSet<RID>();
set = reverse_dependency_map.getptr(p_id);
if (set == nullptr) {
set = &reverse_dependency_map.insert(p_id, HashSet<RID>())->value;
}
reverse_dependency_map[p_id].insert(p_depends_on);
set->insert(p_depends_on);
}
void RenderingDevice::_free_dependencies(RID p_id) {

View File

@ -150,12 +150,10 @@ void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
double time = frame_profile[i + 1].gpu_msec - frame_profile[i].gpu_msec;
if (name[0] != '<' && name[0] != '>') {
if (print_gpu_profile_task_time.has(name)) {
print_gpu_profile_task_time[name] += time;
} else {
print_gpu_profile_task_time[name] = time;
}
if (print_gpu_profile_task_time.has(name)) {
print_gpu_profile_task_time[name] += time;
} else {
print_gpu_profile_task_time[name] = time;
}
}