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

Deprecate the pointless unsafe threading model for rendering #98383

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

RandomShaper
Copy link
Member

The "single-unsafe" thread model for rendering wasn't actually honored in Godot 4, as there's no way it can work despite user's best efforts. Therefore, this PR finally removes the option, or rather deprecates it.

The project setting is remodeled so it looks like the counterpart settings for physics. The takeaway is that projects that were using separate-thread rendering need to change the setting again. It's still considered experimental, so I don't think that's a big issue as long as the fact is documented in the release notes.

platform/macos/os_macos.mm Outdated Show resolved Hide resolved
@RandomShaper RandomShaper force-pushed the deprecate_unsafe_th_rend branch from 153049a to 7605989 Compare October 22, 2024 07:36
@RandomShaper RandomShaper force-pushed the deprecate_unsafe_th_rend branch from 7605989 to dbea0eb Compare November 4, 2024 08:54
@clayjohn
Copy link
Member

clayjohn commented Nov 6, 2024

Couldn't we do this without breaking compatibility? Just change the project setting to only the two choices, and then if we run into a project file set to use single unsafe, just automatically promote it to single safe internally?

I'm not sure if this is worth breaking compatibility over.

@RandomShaper
Copy link
Member Author

My point is that separate-thread rendering was experimental anyway, so the compat breakage doesn't even deserve such a name. Moreover, CLI args remain compatible. This will only affect the (expectedly tiny) set of users which have opted-in for the experimental feature. I guess those can just change the setting when upgrading to 4.4 if they still want to use it.

That said, it's not that I'm super strongly leaning towards that, so if you think the risk is not worth it, I can make this fully backwards compatible.

@Mickeon
Copy link
Contributor

Mickeon commented Nov 6, 2024

The experimental hint is fairly obvious even for Project Settings, so long as the user actually reads before changing advanced settings like these. I think breaking compatibility should be... okay, although it's really weird to me that the experimental note has been referring to the whole setting, instead of the one specific value that is experimental.

@clayjohn
Copy link
Member

clayjohn commented Nov 9, 2024

My point is that separate-thread rendering was experimental anyway, so the compat breakage doesn't even deserve such a name. Moreover, CLI args remain compatible. This will only affect the (expectedly tiny) set of users which have opted-in for the experimental feature. I guess those can just change the setting when upgrading to 4.4 if they still want to use it.

That said, it's not that I'm super strongly leaning towards that, so if you think the risk is not worth it, I can make this fully backwards compatible.

To me it's not about taking a risk. It's about annoying users with a compatibility breakage that doesn't benefit them or us.

Personally, I would prefer removing this option without breaking compatibility, and I'm fairly sure that is possible.

@Mickeon
Copy link
Contributor

Mickeon commented Nov 10, 2024

It is indeed possible, and much easier to do so than transferring both options into a boolean.

@RandomShaper
Copy link
Member Author

I'm not sure how I could tweak the enumerated setting.

If only I could do something like this (note the made up =1 syntax):

#ifdef DISABLE_DEPRECATED
custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Single-Safe=1,Multi-Threaded");
#else
custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe (deprecated),Single-Safe,Multi-Threaded");
#endif

How would you recommend me approaching this?

@Mickeon
Copy link
Contributor

Mickeon commented Nov 11, 2024

PROPERTY_HINT_ENUM's hint string supports suffixing : followed by an integer to denote a specific value. If not specified it increments the value by 1 for the next option.

"Single-Safe:1,Multi-Threaded"

@RandomShaper RandomShaper force-pushed the deprecate_unsafe_th_rend branch 2 times, most recently from d614094 to 4e5e0d5 Compare November 12, 2024 13:02
@RandomShaper
Copy link
Member Author

OK. Please tell me what you think now. The approach is keeping it compatible to the outside (project setting, CLI args) with the internals refactored to account for the actual functionality.

@RandomShaper RandomShaper force-pushed the deprecate_unsafe_th_rend branch from 4e5e0d5 to a46ea9d Compare November 14, 2024 09:43
@Mickeon
Copy link
Contributor

Mickeon commented Nov 14, 2024

Is the experimental note in the class reference still relevant, then?

"This setting has several known bugs which can lead to crashing, especially when using particles or resizing the window. Not recommended for use in production at this stage."

@RandomShaper
Copy link
Member Author

Separate thread model is still not considered stable, so I think so.

@Mickeon Mickeon removed the request for review from a team November 14, 2024 13:56
@RandomShaper
Copy link
Member Author

Is this OK now?

@Repiteo Repiteo merged commit a135a64 into godotengine:master Dec 3, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 3, 2024

Thanks!

@RandomShaper RandomShaper deleted the deprecate_unsafe_th_rend branch December 3, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants