MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / attachOpenGLContext_public

Method attachOpenGLContext_public

Engine/EffectInstance.cpp:4121–4156  ·  view source on GitHub ↗

* @brief This function calls the implementation specific attachOpenGLContext() **/

Source from the content-addressed store, hash-verified

4119 * @brief This function calls the implementation specific attachOpenGLContext()
4120 **/
4121StatusEnum
4122EffectInstance::attachOpenGLContext_public(const OSGLContextPtr& glContext,
4123 EffectInstance::OpenGLContextEffectDataPtr* data)
4124{
4125 NON_RECURSIVE_ACTION();
4126 bool concurrentGLRender = supportsConcurrentOpenGLRenders();
4127 std::unique_ptr<QMutexLocker> locker;
4128 if (concurrentGLRender) {
4129 locker.reset( new QMutexLocker(&_imp->attachedContextsMutex) );
4130 } else {
4131 _imp->attachedContextsMutex.lock();
4132 }
4133
4134 OpenGLContextEffectsMap::iterator found = _imp->attachedContexts.find(glContext);
4135 if ( found != _imp->attachedContexts.end() ) {
4136 // The context is already attached
4137 *data = found->second;
4138
4139 return eStatusOK;
4140 }
4141
4142
4143 StatusEnum ret = attachOpenGLContext(data);
4144
4145 if ( (ret == eStatusOK) || (ret == eStatusReplyDefault) ) {
4146 if (!concurrentGLRender) {
4147 (*data)->setHasTakenLock(true);
4148 }
4149 _imp->attachedContexts.insert( std::make_pair(glContext, *data) );
4150 } else {
4151 _imp->attachedContextsMutex.unlock();
4152 }
4153
4154 // Take the lock until dettach is called for plug-ins that do not support concurrent GL renders
4155 return ret;
4156}
4157
4158void
4159EffectInstance::dettachAllOpenGLContexts()

Callers 1

renderRoIMethod · 0.80

Calls 9

attachOpenGLContextFunction · 0.85
setHasTakenLockMethod · 0.80
resetMethod · 0.45
lockMethod · 0.45
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected