Modified: trunk/Source/WebCore/ChangeLog (271571 => 271572)
--- trunk/Source/WebCore/ChangeLog 2021-01-18 07:16:06 UTC (rev 271571)
+++ trunk/Source/WebCore/ChangeLog 2021-01-18 07:41:42 UTC (rev 271572)
@@ -1,3 +1,31 @@
+2021-01-17 Kimmo Kinnunen <[email protected]>
+
+ GraphicsContextGLOpenGL::reshapeFBOs() ANGLE variant calls into makeContextCurrent()
+ https://bugs.webkit.org/show_bug.cgi?id=220460
+
+ Reviewed by Dean Jackson.
+
+ The call is problematic if it is taken, since in some cases makeContextCurrent() fails
+ due to reshapeFBOs being in middle of a reshape. The problematic case is taken if
+ the reshape call happens before first getExtensions().
+
+ Fix by
+ 1) Resolving the needed depth-stencil buffer format during validateDepthStencil.
+ 2) Always enable the packed depth-stencil extension if it is present. Otherwise
+ depth-stencil bindings will not work for the context that does not have
+ default stencil buffer, since the enable call was not taken before
+ WebGLRenderingContextBase uses the "isEnabled" to enable DEPTH_STENCIL
+ features.
+
+ Tested by WebGL 1/2 conformance tests, but only reveals the bug after
+ applying the patch in the depending bug.
+
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLOpenGL::validateAttributes):
+ (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
+ (WebCore::GraphicsContextGLOpenGL::validateDepthStencil):
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+
2021-01-17 Zalan Bujtas <[email protected]>
[LFC][IFC] Extend simplified vertical alignment for cases when the line has only "empty" runs
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (271571 => 271572)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-01-18 07:16:06 UTC (rev 271571)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-01-18 07:41:42 UTC (rev 271572)
@@ -103,6 +103,8 @@
void GraphicsContextGLOpenGL::validateAttributes()
{
+ m_internalColorFormat = contextAttributes().alpha ? GL_RGBA8 : GL_RGB8;
+
validateDepthStencil(packedDepthStencilExtensionName);
}
@@ -111,26 +113,8 @@
auto attrs = contextAttributes();
const int width = size.width();
const int height = size.height();
- GLuint colorFormat, internalDepthStencilFormat = 0;
- if (attrs.alpha) {
- m_internalColorFormat = GL_RGBA8;
- colorFormat = GL_RGBA;
- } else {
- m_internalColorFormat = GL_RGB8;
- colorFormat = GL_RGB;
- }
- if (attrs.stencil || attrs.depth) {
- // We don't allow the logic where stencil is required and depth is not.
- // See GraphicsContextGLOpenGL::validateAttributes.
+ GLuint colorFormat = attrs.alpha ? GL_RGBA : GL_RGB;
- ExtensionsGL& extensions = getExtensions();
- // Use a 24 bit depth buffer where we know we have it.
- if (extensions.supports(packedDepthStencilExtensionName))
- internalDepthStencilFormat = GL_DEPTH24_STENCIL8_OES;
- else
- internalDepthStencilFormat = GL_DEPTH_COMPONENT16;
- }
-
// Resize multisample FBO.
if (attrs.antialias) {
GLint maxSampleCount;
@@ -144,10 +128,10 @@
gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
if (attrs.stencil || attrs.depth) {
gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
- gl::RenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height);
+ gl::RenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, m_internalDepthStencilFormat, width, height);
// WebGL 1.0's rules state that combined depth/stencil renderbuffers
// have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT point.
- if (!isGLES2Compliant() && internalDepthStencilFormat == GL_DEPTH24_STENCIL8_OES)
+ if (!isGLES2Compliant() && m_internalDepthStencilFormat == GL_DEPTH24_STENCIL8_OES)
gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
else {
if (attrs.stencil)
@@ -208,7 +192,7 @@
#endif
#endif // PLATFORM(COCOA)
- attachDepthAndStencilBufferIfNeeded(internalDepthStencilFormat, width, height);
+ attachDepthAndStencilBufferIfNeeded(m_internalDepthStencilFormat, width, height);
bool mustRestoreFBO = true;
if (attrs.antialias) {
@@ -435,11 +419,18 @@
void GraphicsContextGLOpenGL::validateDepthStencil(const char* packedDepthStencilExtension)
{
ExtensionsGL& extensions = getExtensions();
+ // FIXME: Since the constructors of various platforms are not shared, we initialize this here.
+ // Upon constructing the context, always initialize the extensions that the WebGLRenderingContext* will
+ // use to turn on feature flags.
+ if (extensions.supports(packedDepthStencilExtension)) {
+ extensions.ensureEnabled(packedDepthStencilExtension);
+ m_internalDepthStencilFormat = GL_DEPTH24_STENCIL8_OES;
+ } else
+ m_internalDepthStencilFormat = GL_DEPTH_COMPONENT16;
+
auto attrs = contextAttributes();
-
if (attrs.stencil) {
- if (extensions.supports(packedDepthStencilExtension)) {
- extensions.ensureEnabled(packedDepthStencilExtension);
+ if (m_internalDepthStencilFormat == GL_DEPTH24_STENCIL8_OES) {
// Force depth if stencil is true.
attrs.depth = true;
} else
@@ -446,6 +437,7 @@
attrs.stencil = false;
setContextAttributes(attrs);
}
+
if (attrs.antialias) {
// FIXME: must adjust this when upgrading to WebGL 2.0 / OpenGL ES 3.0 support.
if (!extensions.supports("GL_ANGLE_framebuffer_multisample") || !extensions.supports("GL_ANGLE_framebuffer_blit") || !extensions.supports("GL_OES_rgb8_rgba8")) {
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (271571 => 271572)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2021-01-18 07:16:06 UTC (rev 271571)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2021-01-18 07:41:42 UTC (rev 271572)
@@ -664,7 +664,9 @@
bool m_layerComposited { false };
GCGLuint m_internalColorFormat { 0 };
-
+#if USE(ANGLE)
+ GCGLuint m_internalDepthStencilFormat { 0 };
+#endif
struct GraphicsContextGLState {
GCGLuint boundReadFBO { 0 };
GCGLuint boundDrawFBO { 0 };