File tree Expand file tree Collapse file tree
Source/WebCore/platform/graphics/texmap Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,7 +187,18 @@ bool TextureMapperPlatformLayerBuffer::isHolePunchBuffer()
187187
188188void TextureMapperPlatformLayerBuffer::addFenceSyncIfAvailable ()
189189{
190- unsigned version = GLContext::current ()->version ();
190+ static unsigned version = 0 ;
191+ static std::once_flag onceFlag;
192+
193+ std::call_once (onceFlag, []() {
194+ GLContext* context = GLContext::current ();
195+ if (!context) {
196+ context = PlatformDisplay::sharedDisplayForCompositing ().sharingGLContext ();
197+ context->makeContextCurrent ();
198+ }
199+ version = context->version ();
200+ });
201+
191202 if (version >= 300 && glFenceSync) {
192203 // GLES 3, so fences are available and we can use them.
193204 m_sync = static_cast <void *>(glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0 ));
You can’t perform that action at this time.
0 commit comments