Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about server features on every startup #99850

Closed
clayjohn opened this issue Nov 29, 2024 · 2 comments · Fixed by #99864
Closed

Warning about server features on every startup #99850

clayjohn opened this issue Nov 29, 2024 · 2 comments · Fixed by #99864

Comments

@clayjohn
Copy link
Member

clayjohn commented Nov 29, 2024

Tested versions

Current master 56a7dba

System information

Godot v4.4.dev (5ea9e8b26) - Pop!_OS 22.04 LTS on X11 - X11 display driver, Multi-window, 1 monitor - OpenGL 3 (Compatibility) - Mesa Intel(R) Xe Graphics (TGL GT2) - 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (8 threads)

Issue description

The following warning is printed whenever you run Godot in a debug build with --verbose:

WARNING: Server features cannot be checked before RenderingServer has been created. If you are checking a server feature, consider moving your OS::has_feature call after INITIALIZATION_LEVEL_SERVERS.
     at: has_feature (core/os/os.cpp:544)

Introduced by #98862

Here is the relevant code:

before

if (has_server_feature_callback && has_server_feature_callback(p_feature)) {
	return true;
}

after

if (has_server_feature_callback) {
	return has_server_feature_callback(p_feature);
}
#ifdef DEBUG_ENABLED
else if (is_stdout_verbose()) {
	WARN_PRINT_ONCE("Server features cannot be checked before RenderingServer has been created. If you are checking a server feature, consider moving your OS::has_feature call after INITIALIZATION_LEVEL_SERVERS.");
}
#endif

Before if either has_server_feature_callback or has_server_feature_callback(p_feature) was false, the function would continue and check if (ProjectSettings::get_singleton()->has_custom_feature(p_feature)). With the new logic the warning is printed any time that has_server_feature_callback is false and the code returns early whenever has_server_feature_callback is true. I suspect that neither of those things are intended

CC @HuntJSparra

Steps to reproduce

Run Godot from the command line with --verbose and observe

Minimal reproduction project (MRP)

N/A

@clayjohn clayjohn added this to the 4.4 milestone Nov 29, 2024
@clayjohn clayjohn moved this from Unassessed to Not Critical in 4.x Release Blockers Nov 29, 2024
@clayjohn
Copy link
Member Author

Also CCing @RandomShaper as he made the suggestion that led to this code #98862 (comment)

@HuntJSparra
Copy link
Contributor

Sorry for the issue. I’ll write up a PR later today that fixes the early return and moves the warning until after all other checks.

If the check still fails to find the feature, it’ll print the warning, regardless of if the call was originally intended to check a server feature or not. That could be annoy for people who really want 0 warnings in their console. So, another “fix” for this issue could be to remove the warning entirely. I don’t have a preference either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Not Critical
Development

Successfully merging a pull request may close this issue.

2 participants