Skip to content

Align model appearance#65310

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
mwyrzykowski:eng/Align-model-appearance
May 22, 2026
Merged

Align model appearance#65310
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
mwyrzykowski:eng/Align-model-appearance

Conversation

@mwyrzykowski
Copy link
Copy Markdown
Contributor

@mwyrzykowski mwyrzykowski commented May 20, 2026

3191f12

Align model appearance
https://bugs.webkit.org/show_bug.cgi?id=315210
rdar://177195829

Reviewed by Cameron McCormack.

More closely align to visionOS appearance via the following:

* Limit high range to 2.0 which matches EDR headroom on visionPro
* Restore background color by disabling RE's tonemapping but limiting excessive EDR values
* Fix flash on model reload
* generate mip levels in all environment maps if they are not otherwise present in the USD
* correctly observe display headroom change events in WebModelPlayer.mm
* update headroom from the display upon IOSurface creation

* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::~HTMLModelElement):
(WebCore::HTMLModelElement::setSourceURL):
(WebCore::HTMLModelElement::didFinishLoading):
(WebCore::HTMLModelElement::didFailLoading):
(WebCore::HTMLModelElement::didConvertModelData):
(WebCore::HTMLModelElement::didUpdate):
(WebCore::HTMLModelElement::logWarning):
(WebCore::HTMLModelElement::createModelPlayer):
(WebCore::HTMLModelElement::deletePendingModelPlayer):
(WebCore::HTMLModelElement::virtualHasPendingActivity const):
(WebCore::HTMLModelElement::stop):
(WebCore::HTMLModelElement::removingSteps):
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/css/html.css:
(#if defined(ENABLE_GPU_PROCESS_MODEL) && ENABLE_GPU_PROCESS_MODEL): Deleted.
* Source/WebCore/dom/Document.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
* Source/WebKit/GPUProcess/graphics/Model/ModelRenderer.swift:
(Renderer.createMaterialCompiler(_:rasterSampleCount:colorSpace:)):
(Renderer.setBackgroundColor(_:)):
* Source/WebKit/GPUProcess/graphics/Model/USDModel.swift:
(setEnvironmentMap(_:)):
* Source/WebKit/WebProcess/Model/WebModelPlayer.h:
* Source/WebKit/WebProcess/Model/WebModelPlayer.mm:
(WebKit::m_screenPropertiesChangedObserver):
(WebKit::WebModelPlayer::load):
(WebKit::disableReloading):
(WebKit::WebModelPlayer::visibilityStateDidChange):
(WebKit::WebModelPlayer::reload):
(WebKit::WebModelPlayer::updateContentsHeadroom):
(WebKit::WebModelPlayer::updateScreenHeadroom):
(WebKit::m_page): Deleted.

Canonical link: https://commits.webkit.org/313703@main

90e3ef3

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win ⏳ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim ✅ 🧪 mac-site-isolation
✅ 🛠 watch
✅ 🛠 watch-sim

@mwyrzykowski mwyrzykowski self-assigned this May 20, 2026
@mwyrzykowski mwyrzykowski added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label May 20, 2026
@mwyrzykowski mwyrzykowski requested a review from heycam May 22, 2026 00:18
Comment on lines +143 to +145
#if HAVE(SUPPORT_HDR_DISPLAY) && ENABLE(PIXEL_FORMAT_RGBA16F)
, m_screenPropertiesChangedObserver(ScreenPropertiesChangedObserver::create([weakThis = ThreadSafeWeakPtr { *this }](WebCore::PlatformDisplayID displayID) {
RefPtr protectedThis = weakThis.get();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: having the observer creation inside the initializer list is a little messy, and since the type is a RefPtr we could just assign it in the body of the constructor. Also would be better than creating it and then destroying it again if document is null.

Copy link
Copy Markdown
Contributor Author

@mwyrzykowski mwyrzykowski May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model always requires a document so deleting it is not needed, I will move into the constructor body and add an assertion

@mwyrzykowski mwyrzykowski force-pushed the eng/Align-model-appearance branch from c798a61 to 295f6e3 Compare May 22, 2026 01:39
@mwyrzykowski mwyrzykowski force-pushed the eng/Align-model-appearance branch from 295f6e3 to 90e3ef3 Compare May 22, 2026 02:32

func setBackgroundColor(_ color: simd_float3) {
clearColor = MTLClearColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)
clearColor = MTLClearColor(red: Double(color.x), green: Double(color.y), blue: Double(color.z), alpha: 1.0)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi @etiennesegonzac I restored the opaque background colors since it seems to more closely match visionOS to restrict image headroom but otherwise skip RCR's tone mapping pipeline

@mwyrzykowski mwyrzykowski added the merge-queue Applied to send a pull request to merge-queue label May 22, 2026
https://bugs.webkit.org/show_bug.cgi?id=315210
rdar://177195829

Reviewed by Cameron McCormack.

More closely align to visionOS appearance via the following:

* Limit high range to 2.0 which matches EDR headroom on visionPro
* Restore background color by disabling RE's tonemapping but limiting excessive EDR values
* Fix flash on model reload
* generate mip levels in all environment maps if they are not otherwise present in the USD
* correctly observe display headroom change events in WebModelPlayer.mm
* update headroom from the display upon IOSurface creation

* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::~HTMLModelElement):
(WebCore::HTMLModelElement::setSourceURL):
(WebCore::HTMLModelElement::didFinishLoading):
(WebCore::HTMLModelElement::didFailLoading):
(WebCore::HTMLModelElement::didConvertModelData):
(WebCore::HTMLModelElement::didUpdate):
(WebCore::HTMLModelElement::logWarning):
(WebCore::HTMLModelElement::createModelPlayer):
(WebCore::HTMLModelElement::deletePendingModelPlayer):
(WebCore::HTMLModelElement::virtualHasPendingActivity const):
(WebCore::HTMLModelElement::stop):
(WebCore::HTMLModelElement::removingSteps):
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/css/html.css:
(#if defined(ENABLE_GPU_PROCESS_MODEL) && ENABLE_GPU_PROCESS_MODEL): Deleted.
* Source/WebCore/dom/Document.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
* Source/WebKit/GPUProcess/graphics/Model/ModelRenderer.swift:
(Renderer.createMaterialCompiler(_:rasterSampleCount:colorSpace:)):
(Renderer.setBackgroundColor(_:)):
* Source/WebKit/GPUProcess/graphics/Model/USDModel.swift:
(setEnvironmentMap(_:)):
* Source/WebKit/WebProcess/Model/WebModelPlayer.h:
* Source/WebKit/WebProcess/Model/WebModelPlayer.mm:
(WebKit::m_screenPropertiesChangedObserver):
(WebKit::WebModelPlayer::load):
(WebKit::disableReloading):
(WebKit::WebModelPlayer::visibilityStateDidChange):
(WebKit::WebModelPlayer::reload):
(WebKit::WebModelPlayer::updateContentsHeadroom):
(WebKit::WebModelPlayer::updateScreenHeadroom):
(WebKit::m_page): Deleted.

Canonical link: https://commits.webkit.org/313703@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Align-model-appearance branch from 90e3ef3 to 3191f12 Compare May 22, 2026 04:26
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 313703@main (3191f12): https://commits.webkit.org/313703@main

Reviewed commits have been landed. Closing PR #65310 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 3191f12 into WebKit:main May 22, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants