Diff
Modified: trunk/LayoutTests/ChangeLog (267710 => 267711)
--- trunk/LayoutTests/ChangeLog 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/LayoutTests/ChangeLog 2020-09-28 20:04:47 UTC (rev 267711)
@@ -1,3 +1,13 @@
+2020-09-28 Fujii Hironori <[email protected]>
+
+ [TextureMapper] Enable a depth buffer for preserve-3d
+ https://bugs.webkit.org/show_bug.cgi?id=90078
+
+ Reviewed by Don Olmstead.
+
+ * transforms/3d/general/preserve-3d-expected.html: Added.
+ * transforms/3d/general/preserve-3d.html: Added.
+
2020-09-28 Zalan Bujtas <[email protected]>
Unreviewed, test gardening.
Added: trunk/LayoutTests/transforms/3d/general/preserve-3d-expected.html (0 => 267711)
--- trunk/LayoutTests/transforms/3d/general/preserve-3d-expected.html (rev 0)
+++ trunk/LayoutTests/transforms/3d/general/preserve-3d-expected.html 2020-09-28 20:04:47 UTC (rev 267711)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+<div style="background: green;">
+</div>
Added: trunk/LayoutTests/transforms/3d/general/preserve-3d.html (0 => 267711)
--- trunk/LayoutTests/transforms/3d/general/preserve-3d.html (rev 0)
+++ trunk/LayoutTests/transforms/3d/general/preserve-3d.html 2020-09-28 20:04:47 UTC (rev 267711)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+<div style="background: green; transform-style: preserve-3d;">
+ <div style="background: red; transform: translateZ(-10px);"></div>
+</div>
Modified: trunk/Source/WebCore/ChangeLog (267710 => 267711)
--- trunk/Source/WebCore/ChangeLog 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/Source/WebCore/ChangeLog 2020-09-28 20:04:47 UTC (rev 267711)
@@ -1,3 +1,28 @@
+2020-09-28 Fujii Hironori <[email protected]>
+
+ [TextureMapper] Enable a depth buffer for preserve-3d
+ https://bugs.webkit.org/show_bug.cgi?id=90078
+
+ Reviewed by Don Olmstead.
+
+ Test: transforms/3d/general/preserve-3d.html
+
+ * platform/graphics/egl/GLContextEGL.cpp:
+ (WebCore::GLContextEGL::getEGLConfig):
+ * platform/graphics/texmap/TextureMapper.h:
+ (WebCore::TextureMapper::beginPreserves3D): Added a new virtual method.
+ (WebCore::TextureMapper::endPreserves3D): Ditto.
+ * platform/graphics/texmap/TextureMapperGL.cpp:
+ (WebCore::TextureMapperGL::beginPainting):
+ (WebCore::createProjectionMatrix): Swapped nearValue and farValue
+ so that the depth buffer works as expected.
+ (WebCore::TextureMapperGL::beginPreserves3D): Added.
+ (WebCore::TextureMapperGL::endPreserves3D): Ditto.
+ * platform/graphics/texmap/TextureMapperGL.h:
+ * platform/graphics/texmap/TextureMapperLayer.cpp:
+ (WebCore::TextureMapperLayer::paintSelfAndChildren): Call
+ beginPreserves3D() and endPreserves3D() if m_state.preserves3D.
+
2020-09-28 Devin Rousso <[email protected]>
[iOS] unable to airplay directly loaded fullscreen video
Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (267710 => 267711)
--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp 2020-09-28 20:04:47 UTC (rev 267711)
@@ -118,6 +118,7 @@
EGL_ALPHA_SIZE, rgbaSize[3],
EGL_STENCIL_SIZE, 8,
EGL_SURFACE_TYPE, EGL_NONE,
+ EGL_DEPTH_SIZE, 8,
EGL_NONE
};
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h (267710 => 267711)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h 2020-09-28 20:04:47 UTC (rev 267711)
@@ -78,6 +78,8 @@
virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0;
virtual void endClip() = 0;
virtual IntRect clipBounds() = 0;
+ virtual void beginPreserves3D() { };
+ virtual void endPreserves3D() { };
virtual Ref<BitmapTexture> createTexture() = 0;
virtual Ref<BitmapTexture> createTexture(int internalFormat) = 0;
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (267710 => 267711)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2020-09-28 20:04:47 UTC (rev 267711)
@@ -201,9 +201,9 @@
data().previousScissorState = glIsEnabled(GL_SCISSOR_TEST);
data().previousDepthState = glIsEnabled(GL_DEPTH_TEST);
glDisable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LEQUAL);
glEnable(GL_SCISSOR_TEST);
data().didModifyStencil = false;
- glDepthMask(0);
glGetIntegerv(GL_VIEWPORT, data().viewport);
glGetIntegerv(GL_SCISSOR_BOX, data().previousScissor);
m_clipStack.reset(IntRect(0, 0, data().viewport[2], data().viewport[3]), flags & PaintingMirrored ? ClipStack::YAxisMode::Default : ClipStack::YAxisMode::Inverted);
@@ -824,8 +824,8 @@
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored)
{
- const float nearValue = 9999999;
- const float farValue = -99999;
+ const float nearValue = -99999;
+ const float farValue = 9999999;
return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0,
0, (mirrored ? 2.0 : -2.0) / float(size.height()), 0, 0,
@@ -949,6 +949,17 @@
return clipStack().current().scissorBox;
}
+void TextureMapperGL::beginPreserves3D()
+{
+ glEnable(GL_DEPTH_TEST);
+ glClear(GL_DEPTH_BUFFER_BIT);
+}
+
+void TextureMapperGL::endPreserves3D()
+{
+ glDisable(GL_DEPTH_TEST);
+}
+
Ref<BitmapTexture> TextureMapperGL::createTexture(GLint internalFormat)
{
return BitmapTextureGL::create(m_contextAttributes, internalFormat);
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (267710 => 267711)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h 2020-09-28 20:04:47 UTC (rev 267711)
@@ -79,6 +79,8 @@
void beginPainting(PaintFlags = 0) override;
void endPainting() override;
void endClip() override;
+ void beginPreserves3D() override;
+ void endPreserves3D() override;
IntRect clipBounds() override;
IntSize maxTextureSize() const override { return IntSize(2000, 2000); }
Ref<BitmapTexture> createTexture() override { return createTexture(GL_DONT_CARE); }
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (267710 => 267711)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2020-09-28 19:54:12 UTC (rev 267710)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2020-09-28 20:04:47 UTC (rev 267711)
@@ -222,6 +222,9 @@
if (m_state.backdropLayer && m_state.backdropLayer == options.backdropLayer)
return;
+ if (m_state.preserves3D)
+ options.textureMapper.beginPreserves3D();
+
if (m_state.backdropLayer && !options.backdropLayer) {
TransformationMatrix clipTransform;
clipTransform.translate(options.offset.width(), options.offset.height());
@@ -234,8 +237,11 @@
paintSelf(options);
- if (m_children.isEmpty())
+ if (m_children.isEmpty()) {
+ if (m_state.preserves3D)
+ options.textureMapper.endPreserves3D();
return;
+ }
bool shouldClip = m_state.masksToBounds && !m_state.preserves3D;
if (shouldClip) {
@@ -259,6 +265,8 @@
if (shouldClip)
options.textureMapper.endClip();
+ if (m_state.preserves3D)
+ options.textureMapper.endPreserves3D();
}
bool TextureMapperLayer::shouldBlend() const