In bug 205483 WebKit's WebGL implementation was switched to use ANGLE on all Cocoa platforms except for the iOS simulator, because while IOSurfaces are now supported on that platform, [EAGLContext texImageIOSurface:...] is not. It looks like this can be emulated inside ANGLE's eglBindTexImage / eglReleaseTexImage entry points and thereby add support for the iOS simulator platform.
Created attachment 386546 [details] Work-in-progress
Note that there are important steps to take when updating ANGLE. See http://trac.webkit.org/wiki/UpdatingANGLE
This work-in-progress crashes the content process while running in the iOS Simulator. I'm still trying to figure out how to attach an lldb to the process in the simulator - dino@ pointed out that I should try attaching to com.apple.WebKit.WebContent.Development .
Inserted a 20 second pause during GraphicsContext3D creation and got Xcode to attach to the com.apple.WebKit.WebContent.Development process when the simulator was launched from the command line. Stack trace follows. Still debugging. #0 0x0000000235e1c411 in gl::LogMessage::~LogMessage() at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/common/debug.cpp:183 #1 0x0000000235e1c1d5 in gl::LogMessage::~LogMessage() at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/common/debug.cpp:159 #2 0x0000000236287d43 in gl::Texture::getSamples(gl::TextureTarget, unsigned long) const at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp:958 #3 0x000000023628d6d4 in gl::Texture::getAttachmentSamples(gl::ImageIndex const&) const at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp:1628 #4 0x0000000235d46058 in gl::FramebufferAttachment::getResourceSamples() const at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h:256 #5 0x0000000235d40450 in gl::FramebufferAttachment::getSamples() const at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h:250 #6 0x0000000235ffd73f in gl::(anonymous namespace)::CheckAttachmentSampleCompleteness(gl::Context const*, gl::FramebufferAttachment const&, bool, Optional<int>*, Optional<bool>*, Optional<int>*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp:189 #7 0x0000000235ffc0ee in gl::Framebuffer::checkStatusWithGLFrontEnd(gl::Context const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp:1117 #8 0x0000000235ffbcf7 in gl::Framebuffer::checkStatusImpl(gl::Context const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp:1061 #9 0x0000000235dc90bf in gl::Framebuffer::checkStatus(gl::Context const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.h:283 #10 0x0000000235dc8ee2 in gl::Context::checkFramebufferStatus(unsigned int) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp:6168 #11 0x0000000235eaea0f in gl::CheckFramebufferStatus(unsigned int) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_autogen.cpp:338 #12 0x00000002208af400 in WebCore::GraphicsContext3D::attachDepthAndStencilBufferIfNeeded(unsigned int, int, int) at /Users/kbr/src/iOSWebKit/Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp:251 #13 0x00000002208af207 in WebCore::GraphicsContext3D::reshapeFBOs(WebCore::IntSize const&) at /Users/kbr/src/iOSWebKit/Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp:216 #14 0x00000002208b0b70 in WebCore::GraphicsContext3D::reshape(int, int) at /Users/kbr/src/iOSWebKit/Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp:578 #15 0x000000022320a03f in WebCore::WebGLRenderingContextBase::initializeNewContext() at /Users/kbr/src/iOSWebKit/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:783 #16 0x00000002231fd51d in WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase(WebCore::CanvasBase&, WTF::Ref<WebCore::GraphicsContext3D, WTF::DumbPtrTraits<WebCore::GraphicsContext3D> >&&, WebCore::GraphicsContext3DAttributes) at /Users/kbr/src/iOSWebKit/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:653
Created attachment 386547 [details] Work-in-progress
Fixed the crash, which was caused by a mismatch between the use of the TEXTURE_2D and TEXTURE_RECTANGLE_ANGLE texture targets. (The same problem probably exists in the on-device iOS port.) Still doesn't render anything yet.
Created attachment 386570 [details] Patch
The current patch
Thanks to more hints from dino@, the current patch seems to be working! At least, it did in a debug build just before rebasing on ToT. Will test more locally. dino@, could you please help testing this on-device and making sure it doesn't break that code path? I believe it should only make that code path more correct, rather than regressing anything. Thanks!
Created attachment 386713 [details] Patch
Fixed the compile failure on iOS and changed the newly-allocated enum for the usage hint.
Committed r254036: <https://trac.webkit.org/changeset/254036>
<rdar://problem/58325954>