* @brief This function calls the implementation specific attachOpenGLContext() **/
| 4119 | * @brief This function calls the implementation specific attachOpenGLContext() |
| 4120 | **/ |
| 4121 | StatusEnum |
| 4122 | EffectInstance::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 | |
| 4158 | void |
| 4159 | EffectInstance::dettachAllOpenGLContexts() |
no test coverage detected