Source/WebCore/ChangeLog

 12019-10-03 James Darpinian <jdarpinian@chromium.org>
 2
 3 Fix WebGL 1 conformance regressions when USE_ANGLE=1
 4 https://bugs.webkit.org/show_bug.cgi?id=202545
 5
 6 Prevent ANGLE from automatically using ES3 when ES2 is requested.
 7
 8 WEBGL_debug_shaders extension should not accept or return null.
 9
 10 Enable ANGLE's new support for emulating RGB on RGBA IOSurfaces.
 11
 12 Reviewed by NOBODY (OOPS!).
 13
 14 * html/canvas/WebGLDebugShaders.cpp:
 15 (WebCore::WebGLDebugShaders::getTranslatedShaderSource):
 16 * html/canvas/WebGLDebugShaders.h:
 17 * html/canvas/WebGLDebugShaders.idl:
 18 * html/canvas/WebGLRenderingContextBase.cpp:
 19 (WebCore::WebGLRenderingContextBase::validateVertexAttributes):
 20 * platform/graphics/angle/Extensions3DANGLE.cpp:
 21 (WebCore::Extensions3DANGLE::getTranslatedShaderSourceANGLE):
 22 * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
 23 (WebCore::GraphicsContext3D::GraphicsContext3D):
 24 * platform/graphics/cocoa/WebGLLayer.mm:
 25 (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
 26
1272019-10-03 Chris Dumez <cdumez@apple.com>
228
329 XMLHttpRequest sometimes prevents pages from entering the back/forward cache

Source/WebCore/html/canvas/WebGLDebugShaders.cpp

@@WebGLExtension::ExtensionName WebGLDebugShaders::getName() const
4848 return WebGLDebugShadersName;
4949}
5050
51 String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader* shader)
 51String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader& shader)
5252{
5353 if (m_context.isContextLost())
5454 return String();
55  if (!m_context.validateWebGLObject("getTranslatedShaderSource", shader))
 55 if (!m_context.validateWebGLObject("getTranslatedShaderSource", &shader))
5656 return emptyString();
57  return m_context.graphicsContext3D()->getExtensions().getTranslatedShaderSourceANGLE(shader->object());
 57 return m_context.graphicsContext3D()->getExtensions().getTranslatedShaderSourceANGLE(shader.object());
5858}
5959
6060} // namespace WebCore

Source/WebCore/html/canvas/WebGLDebugShaders.h

@@public:
4040
4141 ExtensionName getName() const override;
4242
43  String getTranslatedShaderSource(WebGLShader*);
 43 String getTranslatedShaderSource(WebGLShader&);
4444};
4545
4646} // namespace WebCore

Source/WebCore/html/canvas/WebGLDebugShaders.idl

2828 GenerateIsReachable=ImplWebGLRenderingContext,
2929 NoInterfaceObject,
3030] interface WebGLDebugShaders {
31  DOMString? getTranslatedShaderSource(WebGLShader? shader); // FIXME: The return value and the parameter should not be nullable.
 31 DOMString getTranslatedShaderSource(WebGLShader shader);
3232};

Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

@@bool WebGLRenderingContextBase::validateVertexAttributes(unsigned elementCount,
21202120 return false;
21212121 }
21222122 }
 2123#else
 2124 UNUSED_PARAM(elementCount);
 2125 UNUSED_PARAM(primitiveCount);
21232126#endif
21242127
21252128 return true;

Source/WebCore/platform/graphics/angle/Extensions3DANGLE.cpp

@@String Extensions3DANGLE::getTranslatedShaderSourceANGLE(Platform3DObject shader
111111 gl::GetTranslatedShaderSourceANGLE(shader, sourceLength, &returnedLength, name.data());
112112 if (!returnedLength)
113113 return emptyString();
114  ASSERT(returnedLength == sourceLength);
 114 // returnedLength does not include the null terminator.
 115 ASSERT(returnedLength == sourceLength - 1);
115116 return String(name.data(), returnedLength);
116117}
117118

Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

@@GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
327327 std::vector<EGLint> contextAttributes;
328328 contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
329329 contextAttributes.push_back(2);
 330 // ANGLE will upgrade the context to ES3 automatically unless this is specified.
 331 contextAttributes.push_back(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE);
 332 contextAttributes.push_back(EGL_FALSE);
330333 contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
331334 contextAttributes.push_back(EGL_TRUE);
332335 if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) {

Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm

@@- (void)allocateIOSurfaceBackingStoreWithSize:(WebCore::IntSize)size usingAlpha:
220220 EGL_HEIGHT, size.height(),
221221 EGL_IOSURFACE_PLANE_ANGLE, 0,
222222 EGL_TEXTURE_TARGET, EGL_TEXTURE_RECTANGLE_ANGLE,
223  EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, GL_BGRA_EXT,
 223 EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, usingAlpha ? GL_BGRA_EXT : GL_RGB,
224224 EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
225225 EGL_TEXTURE_TYPE_ANGLE, GL_UNSIGNED_BYTE,
226226 EGL_NONE, EGL_NONE