Support output to HDR monitors

Co-authored-by: Alvin Wong <alvinhochun@gmail.com>
Co-authored-by: Allen Pestaluky <allenpestaluky@gmail.com>
This commit is contained in:
Josh Jones 2025-02-02 18:12:45 -05:00
parent 40448082ab
commit b8389cc76b
65 changed files with 1579 additions and 233 deletions

View file

@ -2085,8 +2085,16 @@ SceneTree::SceneTree() {
const bool transparent_background = GLOBAL_DEF("rendering/viewport/transparent_background", false);
root->set_transparent_background(transparent_background);
// Enable HDR if requested.
const bool hdr_requested = GLOBAL_GET("display/window/hdr/request_hdr_output");
DisplayServer::get_singleton()->window_request_hdr_output(hdr_requested);
const bool use_hdr_2d = GLOBAL_GET("rendering/viewport/hdr_2d");
root->set_use_hdr_2d(use_hdr_2d);
root->set_use_hdr_2d(use_hdr_2d || hdr_requested);
if (hdr_requested && !use_hdr_2d) {
WARN_PRINT_ED("HDR 2D was automatically enabled because HDR output was requested in project settings. To avoid this warning, enable rendering/viewport/hdr_2d in the Project Settings.");
}
const int ssaa_mode = GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/anti_aliasing/quality/screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast),SMAA (Average)"), 0);
root->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode));