Skip to content

Commit 2aae0f7

Browse files
committed
[TextureMapper] Hidden surface removal issue for nested transform-style:perserve-3d in Snow Stack demo
https://bugs.webkit.org/show_bug.cgi?id=218969 Reviewed by Carlos Garcia Campos. Source/WebCore: r267711 enabled a depth buffer for a perserve-3d layer, but it didn't work nicely for nested perserve-3d, for example Snow Stack demo. It needs a intermediate surface to properly render interchangeably nested perserve-3d and non perserve-3d layers, for example transforms/3d/point-mapping/3d-point-mapping-deep.html. This change supports only simply nested perserve-3d layers such like Snow Stack demo. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelfAndChildren): Added Preserves3DScope to call beginPreserves3D and endPreserves3D. LayoutTests: * platform/gtk/transforms/3d/point-mapping/3d-point-mapping-deep-expected.png: Rebaselined. Canonical link: https://commits.webkit.org/231816@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent a7ae944 commit 2aae0f7

4 files changed

Lines changed: 50 additions & 8 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2020-11-20 Fujii Hironori <Hironori.Fujii@sony.com>
2+
3+
[TextureMapper] Hidden surface removal issue for nested transform-style:perserve-3d in Snow Stack demo
4+
https://bugs.webkit.org/show_bug.cgi?id=218969
5+
6+
Reviewed by Carlos Garcia Campos.
7+
8+
* platform/gtk/transforms/3d/point-mapping/3d-point-mapping-deep-expected.png: Rebaselined.
9+
110
2020-11-20 Chris Lord <clord@igalia.com>
211

312
Enable font functions on OffscreenCanvas for main-thread
-2.74 KB
Loading

Source/WebCore/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2020-11-20 Fujii Hironori <Hironori.Fujii@sony.com>
2+
3+
[TextureMapper] Hidden surface removal issue for nested transform-style:perserve-3d in Snow Stack demo
4+
https://bugs.webkit.org/show_bug.cgi?id=218969
5+
6+
Reviewed by Carlos Garcia Campos.
7+
8+
r267711 enabled a depth buffer for a perserve-3d layer, but it
9+
didn't work nicely for nested perserve-3d, for example Snow Stack
10+
demo. It needs a intermediate surface to properly render
11+
interchangeably nested perserve-3d and non perserve-3d layers, for
12+
example transforms/3d/point-mapping/3d-point-mapping-deep.html.
13+
This change supports only simply nested perserve-3d layers such
14+
like Snow Stack demo.
15+
16+
* platform/graphics/texmap/TextureMapperLayer.cpp:
17+
(WebCore::TextureMapperLayer::paintSelfAndChildren): Added
18+
Preserves3DScope to call beginPreserves3D and endPreserves3D.
19+
120
2020-11-20 Chris Lord <clord@igalia.com>
221

322
Enable font functions on OffscreenCanvas for main-thread

Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class TextureMapperPaintOptions {
4040
float opacity { 1 };
4141
IntSize offset;
4242
TextureMapperLayer* backdropLayer { nullptr };
43+
bool preserves3D { false };
4344
};
4445

4546
TextureMapperLayer::TextureMapperLayer() = default;
@@ -223,8 +224,26 @@ void TextureMapperLayer::paintSelfAndChildren(TextureMapperPaintOptions& options
223224
if (m_state.backdropLayer && m_state.backdropLayer == options.backdropLayer)
224225
return;
225226

226-
if (m_state.preserves3D)
227-
options.textureMapper.beginPreserves3D();
227+
struct Preserves3DScope {
228+
Preserves3DScope(TextureMapperPaintOptions& passedOptions, bool passedEnable)
229+
: options(passedOptions)
230+
, enable(passedEnable)
231+
{
232+
if (enable) {
233+
options.preserves3D = true;
234+
options.textureMapper.beginPreserves3D();
235+
}
236+
}
237+
~Preserves3DScope()
238+
{
239+
if (enable) {
240+
options.preserves3D = false;
241+
options.textureMapper.endPreserves3D();
242+
}
243+
}
244+
TextureMapperPaintOptions& options;
245+
bool enable;
246+
} scopedPreserves3D(options, m_state.preserves3D && !options.preserves3D);
228247

229248
if (m_state.backdropLayer && !options.backdropLayer) {
230249
TransformationMatrix clipTransform;
@@ -238,11 +257,8 @@ void TextureMapperLayer::paintSelfAndChildren(TextureMapperPaintOptions& options
238257

239258
paintSelf(options);
240259

241-
if (m_children.isEmpty()) {
242-
if (m_state.preserves3D)
243-
options.textureMapper.endPreserves3D();
260+
if (m_children.isEmpty())
244261
return;
245-
}
246262

247263
bool shouldClip = m_state.masksToBounds && !m_state.preserves3D;
248264
if (shouldClip) {
@@ -266,8 +282,6 @@ void TextureMapperLayer::paintSelfAndChildren(TextureMapperPaintOptions& options
266282

267283
if (shouldClip)
268284
options.textureMapper.endClip();
269-
if (m_state.preserves3D)
270-
options.textureMapper.endPreserves3D();
271285
}
272286

273287
bool TextureMapperLayer::shouldBlend() const

0 commit comments

Comments
 (0)