Пример #1
0
    Archive *Find(String &filename) {
        ResourceGroup* grp = getResourceGroup("General");
        if (!grp)
            OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Cannot locate a resource group called 'General'", "ResourceGroupManager::openResource");

        OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
        ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(filename);
        if (rit != grp->resourceIndexCaseSensitive.end()) {
            // Found in the index
            Archive *fileArchive = rit->second;
            filename = fileArchive->getName() + "/" + filename;
            return fileArchive;
        }
        return NULL;
    }
 HardwareVertexBufferSharedPtr
     GLESHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize,
                                                   size_t numVerts,
                                                   HardwareBuffer::Usage usage,
                                                   bool useShadowBuffer)
 {
     // always use shadowBuffer
     GLESHardwareVertexBuffer* buf =
         OGRE_NEW GLESHardwareVertexBuffer(this, vertexSize, numVerts, usage, true);
     {
         OGRE_LOCK_MUTEX(mVertexBuffersMutex);
         mVertexBuffers.insert(buf);
     }
     return HardwareVertexBufferSharedPtr(buf);
 }
Пример #3
0
//---------------------------------------------------------------------
void DefaultWorkQueueBase::abortPendingRequestsByChannel(uint16 channel)
{
    {
        OGRE_LOCK_MUTEX(mRequestMutex);
        for (RequestQueue::iterator i = mRequestQueue.begin(); i != mRequestQueue.end(); ++i)
        {
            if ((*i)->getChannel() == channel)
            {
                (*i)->abortRequest();
            }
        }
    }
    {
        OGRE_LOCK_MUTEX(mIdleMutex);

        for (RequestQueue::iterator i = mIdleRequestQueue.begin(); i != mIdleRequestQueue.end(); ++i)
        {
            if ((*i)->getChannel() == channel)
            {
                (*i)->abortRequest();
            }
        }
    }
}
Пример #4
0
	//-----------------------------------------------------------------------
	void Resource::_firePreparingComplete(bool wasBackgroundLoaded)
	{
		// Lock the listener list
            OGRE_LOCK_MUTEX(mListenerListMutex);
		for (ListenerList::iterator i = mListenerList.begin();
			i != mListenerList.end(); ++i)
		{
			// deprecated call
			if (wasBackgroundLoaded)
				(*i)->backgroundPreparingComplete(this);

			(*i)->preparingComplete(this);

		}
	}
	//-----------------------------------------------------------------------
	HardwareIndexBufferSharedPtr
		D3D11HardwareBufferManagerBase::
		createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
		HardwareBuffer::Usage usage, bool useShadowBuffer)
	{
		assert(numIndexes > 0);
		D3D11HardwareIndexBuffer* idx = new D3D11HardwareIndexBuffer(
			this, itype, numIndexes, usage, mlpD3DDevice, false, useShadowBuffer);
		{
			OGRE_LOCK_MUTEX(mIndexBuffersMutex);
			mIndexBuffers.insert(idx);
		}
		return HardwareIndexBufferSharedPtr(idx);

	}
    void* GL3PlusHardwareBufferManagerBase::allocateScratch(uint32 size)
    {
        // simple forward link search based on alloc sizes
        // not that fast but the list should never get that long since not many
        // locks at once (hopefully)
        OGRE_LOCK_MUTEX(mScratchMutex);

        // Alignment - round up the size to 32 bits
        // control blocks are 32 bits too so this packs nicely
        if (size % 4 != 0)
        {
            size += 4 - (size % 4);
        }

        uint32 bufferPos = 0;
        while (bufferPos < SCRATCH_POOL_SIZE)
        {
            GL3PlusScratchBufferAlloc* pNext = (GL3PlusScratchBufferAlloc*)(mScratchBufferPool + bufferPos);
            // Big enough?
            if (pNext->free && pNext->size >= size)
            {
                // split? And enough space for control block
                if(pNext->size > size + sizeof(GL3PlusScratchBufferAlloc))
                {
                    uint32 offset = (uint32)sizeof(GL3PlusScratchBufferAlloc) + size;

                    GL3PlusScratchBufferAlloc* pSplitAlloc = (GL3PlusScratchBufferAlloc*)
                        (mScratchBufferPool + bufferPos + offset);
                    pSplitAlloc->free = 1;
                    // split size is remainder minus new control block
                    pSplitAlloc->size = pNext->size - size - sizeof(GL3PlusScratchBufferAlloc);

                    // New size of current
                    pNext->size = size;
                }
                // allocate and return
                pNext->free = 0;

                // return pointer just after this control block (++ will do that for us)
                return ++pNext;
            }

            bufferPos += (uint32)sizeof(GL3PlusScratchBufferAlloc) + pNext->size;
        }

        // no available alloc
        return 0;
    }
Пример #7
0
/**
 * @author Blakharaz
 * @date 03-14-2005
 */
SoundResourcePtr& SoundResourcePtr::operator =(const ResourcePtr& res)
{
    if (pRep == static_cast<SoundResource*>(res.getPointer()))
        return *this;
    release();

    // lock & copy other mutex pointer
    OGRE_LOCK_MUTEX(*res.OGRE_AUTO_MUTEX_NAME)
        OGRE_COPY_AUTO_SHARED_MUTEX(res.OGRE_AUTO_MUTEX_NAME)
        pRep = static_cast<SoundResource*>(res.getPointer());
    pUseCount = res.useCountPointer();
    if (pUseCount != 0)
        ++(*pUseCount);

    return *this;
}
	//----------------------------------------------------------------------------
	bool ZenStringInterface::createParamDictionary(const String& _className)
	{
		OGRE_LOCK_MUTEX( msDictionaryMutex )
		ZenDictionaryMap::iterator it = msDictionaryMap.find(_className);
		if(it == msDictionaryMap.end())
		{
			it = msDictionaryMap.insert( std::make_pair( _className, new ZenParamDictionary ) ).first;
			mParamDictionary = it->second;
			mParamDictionary->mIterator = it;
		}
		else
		{
			mParamDictionary = it->second;
		}
		return (++mParamDictionary->mUseCount) == 1;
	}
    //---------------------------------------------------------------------
    Ogre::HardwareUniformBufferSharedPtr GLES2HardwareBufferManagerBase::createUniformBuffer( size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name )
    {
#if OGRE_NO_GLES3_SUPPORT == 0
        GLES2HardwareUniformBuffer* buf =
        new GLES2HardwareUniformBuffer(this, sizeBytes, usage, useShadowBuffer, name);
        {
            OGRE_LOCK_MUTEX(mUniformBuffersMutex);
            mUniformBuffers.insert(buf);
        }
        return HardwareUniformBufferSharedPtr(buf);
#else
        OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
            "GLES2 does not support uniform buffer objects", 
            "GLES2HardwareBufferManagerBase::createUniformBuffer");
#endif
    }
	//-----------------------------------------------------------------------
	void D3D9ResourceManager::_notifyResourceDestroyed(D3D9Resource* pResource)
	{		
		OGRE_LOCK_MUTEX(mResourcesMutex)

		ResourceContainerIterator it = mResources.begin();

		while (it != mResources.end())
		{
			if ((*it) == pResource)
			{
				mResources.erase(it);
				break;
			}			
			++it;
		}	
	}
    //-----------------------------------------------------------------------
    void HardwareBufferManagerBase::releaseVertexBufferCopy(
        const HardwareVertexBufferSharedPtr& bufferCopy)
    {
        OGRE_LOCK_MUTEX(mTempBuffersMutex);

		TemporaryVertexBufferLicenseMap::iterator i =
            mTempVertexBufferLicenses.find(bufferCopy.get());
        if (i != mTempVertexBufferLicenses.end())
        {
            const VertexBufferLicense& vbl = i->second;

            vbl.licensee->licenseExpired(vbl.buffer.get());

            mFreeTempVertexBufferMap.insert(
                FreeTemporaryVertexBufferMap::value_type(vbl.originalBufferPtr, vbl.buffer));
            mTempVertexBufferLicenses.erase(i);
        }
    }
    HardwareIndexBufferSharedPtr GLES2HardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype,
                                                                              size_t numIndexes,
                                                                              HardwareBuffer::Usage usage,
                                                                              bool useShadowBuffer)
    {
        GLES2HardwareIndexBuffer* buf = 0;
        if(getGLES2SupportRef()->checkExtension("GL_EXT_map_buffer_range") || gleswIsSupported(3, 0))
            buf = OGRE_NEW GLES2HardwareIndexBuffer(this, itype, numIndexes, usage, useShadowBuffer);
        else
            // always use shadowBuffer
            buf = OGRE_NEW GLES2HardwareIndexBuffer(this, itype, numIndexes, usage, true);

        {
            OGRE_LOCK_MUTEX(mIndexBuffersMutex);
            mIndexBuffers.insert(buf);
        }
        return HardwareIndexBufferSharedPtr(buf);
    }
	//---------------------------------------------------------------------
	//---------------------------------------------------------------------
	void* GLHardwareBufferManagerBase::allocateScratch(uint32 size)
	{
		// simple forward link search based on alloc sizes
		// not that fast but the list should never get that long since not many
		// locks at once (hopefully)
            OGRE_LOCK_MUTEX(mScratchMutex);


        // Alignment - round up the size to OGRE_SIMD_ALIGNMENT bits
        // control blocks are 32 bits which should give enough space.
        size += 2*OGRE_SIMD_ALIGNMENT - (size % OGRE_SIMD_ALIGNMENT);

        uint32 bufferPos = 0;
        while (bufferPos < SCRATCH_POOL_SIZE)
        {
            GLScratchBufferAlloc* pNext = (GLScratchBufferAlloc*)(mScratchBufferPool + bufferPos);
            // Big enough?
            if (pNext->free && pNext->size >= size)
            {
                uint32 offset = size;

                GLScratchBufferAlloc* pSplitAlloc = (GLScratchBufferAlloc*)
                    (mScratchBufferPool + bufferPos + offset);
                pSplitAlloc->free = 1;
                // split size is remainder minus new control block
                pSplitAlloc->size = pNext->size - size;

                // New size of current
                pNext->size = size;
                // allocate and return
                pNext->free = 0;

                // return pointer just after this control block that is also multiple of alignment
                return (char*)(pNext) + OGRE_SIMD_ALIGNMENT;
            }

            bufferPos += pNext->size;

		}

		// no available alloc
		return 0;

	}
Пример #14
0
    //-----------------------------------------------------------------------
    Polygon* ConvexBody::allocatePolygon()
    {
            OGRE_LOCK_MUTEX(msFreePolygonsMutex);

        if (msFreePolygons.empty())
        {
            // if we ran out of polys to use, create a new one
            // hopefully this one will return to the pool in due course
            return OGRE_NEW_T(Polygon, MEMCATEGORY_SCENE_CONTROL)();
        }
        else
        {
            Polygon* ret = msFreePolygons.back();
            ret->reset();

            msFreePolygons.pop_back();

            return ret;

        }
    }
Пример #15
0
	//-----------------------------------------------------------------------
	void Resource::unload(void) 
	{ 
		// Early-out without lock (mitigate perf cost of ensuring unloaded)
		if (mLoadingState != LOADSTATE_LOADED)
			return;

		// Scope lock for loading status
		{
			OGRE_LOCK_MUTEX(mLoadingStatusMutex)
			if (mLoadingState == LOADSTATE_LOADING)
			{
				OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
					"Cannot unload resource " + mName + " whilst loading is in progress!", 
					"Resource::unload");
			}
			if (mLoadingState != LOADSTATE_LOADED)
				return; // nothing to do

			mLoadingState = LOADSTATE_UNLOADING;
		}

		// Scope lock for actual unload
		{
			OGRE_LOCK_AUTO_MUTEX
			preUnloadImpl();
			unloadImpl();
			postUnloadImpl();
		}

		// Scope lock for loading status
		{
			OGRE_LOCK_MUTEX(mLoadingStatusMutex)
			mLoadingState = LOADSTATE_UNLOADED;
		}

		// Notify manager
		if(mCreator)
			mCreator->_notifyResourceUnloaded(this);

	}
Пример #16
0
    void PCZSceneManager::_calcZonesAffectedByLights(Camera * cam)
    {
        MovableObjectCollection* lights =
            getMovableObjectCollection(PCZLightFactory::FACTORY_TYPE_NAME);
	    {
		    OGRE_LOCK_MUTEX(lights->mutex)

		    MovableObjectIterator it(lights->map.begin(), lights->map.end());

		    while(it.hasMoreElements())
		    {
			    PCZLight* l = static_cast<PCZLight*>(it.getNext());
				if(l->getNeedsUpdate()) 
				{
					// only update if necessary 
					l->updateZones(((PCZSceneNode*)(cam->getParentSceneNode()))->getHomeZone(), mFrameCount);   
				}
				// clear update flag 
				l->clearNeedsUpdate();   
            }
        }
    }
    //---------------------------------------------------------------------
    AnimationStateSet::AnimationStateSet(const AnimationStateSet& rhs)
        : mDirtyFrameNumber(std::numeric_limits<unsigned long>::max())
    {
        // lock rhs
            OGRE_LOCK_MUTEX(rhs.OGRE_AUTO_MUTEX_NAME);

        for (AnimationStateMap::const_iterator i = rhs.mAnimationStates.begin();
            i != rhs.mAnimationStates.end(); ++i)
        {
            AnimationState* src = i->second;
            mAnimationStates[src->getAnimationName()] = 
                OGRE_NEW AnimationState(this, *src);
        }

        // Clone enabled animation state list
        for (EnabledAnimationStateList::const_iterator it = rhs.mEnabledAnimationStates.begin();
            it != rhs.mEnabledAnimationStates.end(); ++it)
        {
            const AnimationState* src = *it;
            mEnabledAnimationStates.push_back(getAnimationState(src->getAnimationName()));
        }
    }
Пример #18
0
//---------------------------------------------------------------------
void DefaultWorkQueueBase::processResponses()
{
    unsigned long msStart = Root::getSingleton().getTimer()->getMilliseconds();
    unsigned long msCurrent = 0;

    // keep going until we run out of responses or out of time
    while(true)
    {
        Response* response = 0;
        {
            OGRE_LOCK_MUTEX(mResponseMutex);

            if (mResponseQueue.empty())
                break; // exit loop
            else
            {
                response = mResponseQueue.front();
                mResponseQueue.pop_front();
            }
        }

        if (response)
        {
            processResponse(response);

            OGRE_DELETE response;

        }

        // time limit
        if (mResposeTimeLimitMS)
        {
            msCurrent = Root::getSingleton().getTimer()->getMilliseconds();
            if (msCurrent - msStart > mResposeTimeLimitMS)
                break;
        }
    }
}
    //---------------------------------------------------------------------
    void AnimationStateSet::copyMatchingState(AnimationStateSet* target) const
    {
        // lock target
            OGRE_LOCK_MUTEX(target->OGRE_AUTO_MUTEX_NAME);
        // lock source
            OGRE_LOCK_AUTO_MUTEX;

        AnimationStateMap::iterator i, iend;
        iend = target->mAnimationStates.end();
        for (i = target->mAnimationStates.begin(); i != iend; ++i) {
            AnimationStateMap::const_iterator iother = mAnimationStates.find(i->first);
            if (iother == mAnimationStates.end()) {
                OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "No animation entry found named " + i->first, 
                    "AnimationStateSet::copyMatchingState");
            } else {
                i->second->copyStateFrom(*(iother->second));
            }
        }

        // Copy matching enabled animation state list
        target->mEnabledAnimationStates.clear();

        EnabledAnimationStateList::const_iterator it, itend;
        itend = mEnabledAnimationStates.end();
        for (it = mEnabledAnimationStates.begin(); it != itend; ++it)
        {
            const AnimationState* src = *it;
            AnimationStateMap::const_iterator itarget = target->mAnimationStates.find(src->getAnimationName());
            if (itarget != target->mAnimationStates.end())
            {
                target->mEnabledAnimationStates.push_back(itarget->second);
            }
        }

        target->mDirtyFrameNumber = mDirtyFrameNumber;
    }
	//-----------------------------------------------------------------------
	HardwareUniformBufferSharedPtr
		D3D11HardwareBufferManagerBase::createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name)
	{
		assert(sizeBytes > 0);
		D3D11HardwareUniformBuffer* uni = 0;
		/*
		if (name != "")
		{
			SharedUniformBufferMap::iterator it = mSharedUniformBuffers.find(name);
			if (it != mSharedUniformBuffers.end())
			{
				uni = static_cast<D3D11HardwareUniformBuffer*>(it->second);
				assert (uni->getSizeInBytes() == sizeBytes);
				assert (uni->getUsage() == usage);
			}
			else
			{
				uni = new D3D11HardwareUniformBuffer(this, sizeBytes, usage, useShadowBuffer, name, mlpD3DDevice);
				{
					OGRE_LOCK_MUTEX(mUniformBuffersMutex)
					mUniformBuffers.insert(uni);
					//mSharedUniformBuffers.insert(std::make_pair(name, uni));
				}
			}
		}
		else
		{*/
			uni = new D3D11HardwareUniformBuffer(this, sizeBytes, usage, useShadowBuffer, name, mlpD3DDevice);
			{
				OGRE_LOCK_MUTEX(mUniformBuffersMutex);
				mUniformBuffers.insert(uni);
			}
		//}

		return HardwareUniformBufferSharedPtr(uni);
	}
    //-----------------------------------------------------------------------
    void HardwareBufferManagerBase::destroyVertexDeclaration(VertexDeclaration* decl)
    {
		OGRE_LOCK_MUTEX(mVertexDeclarationsMutex)
        mVertexDeclarations.erase(decl);
        destroyVertexDeclarationImpl(decl);
    }
    //-----------------------------------------------------------------------
	void HardwareBufferManagerBase::destroyVertexBufferBinding(VertexBufferBinding* binding)
	{
		OGRE_LOCK_MUTEX(mVertexBufferBindingsMutex)
		mVertexBufferBindings.erase(binding);
		destroyVertexBufferBindingImpl(binding);
	}
Пример #23
0
	//-----------------------------------------------------------------------
	void Resource::removeListener(Resource::Listener* lis)
	{
		// O(n) but not called very often
            OGRE_LOCK_MUTEX(mListenerListMutex);
		mListenerList.erase(lis);
	}
Пример #24
0
	//-----------------------------------------------------------------------
	void Resource::addListener(Resource::Listener* lis)
	{
            OGRE_LOCK_MUTEX(mListenerListMutex);
		mListenerList.insert(lis);
	}
Пример #25
0
	//---------------------------------------------------------------------
	void CgProgram::recurseParams(CGparameter parameter, size_t contextArraySize)
	{
		while (parameter != 0)
		{
			// Look for uniform parameters only
			// Don't bother enumerating unused parameters, especially since they will
			// be optimised out and therefore not in the indexed versions
			CGtype paramType = cgGetParameterType(parameter);

			if (cgGetParameterVariability(parameter) == CG_UNIFORM &&
				paramType != CG_SAMPLER1D &&
				paramType != CG_SAMPLER2D &&
				paramType != CG_SAMPLER3D &&
				paramType != CG_SAMPLERCUBE &&
				paramType != CG_SAMPLERRECT &&
				cgGetParameterDirection(parameter) != CG_OUT && 
				cgIsParameterReferenced(parameter))
			{
				int arraySize;

				switch(paramType)
				{
				case CG_STRUCT:
					recurseParams(cgGetFirstStructParameter(parameter));
					break;
				case CG_ARRAY:
					// Support only 1-dimensional arrays
					arraySize = cgGetArraySize(parameter, 0);
					recurseParams(cgGetArrayParameter(parameter, 0), (size_t)arraySize);
					break;
				default:
					// Normal path (leaf)
					String paramName = cgGetParameterName(parameter);
					size_t logicalIndex = cgGetParameterResourceIndex(parameter);

					// Get the parameter resource, to calculate the physical index
					CGresource res = cgGetParameterResource(parameter);
					bool isRegisterCombiner = false;
					size_t regCombinerPhysicalIndex = 0;
					switch (res)
					{
					case CG_COMBINER_STAGE_CONST0:
						// register combiner, const 0
						// the index relates to the texture stage; store this as (stage * 2) + 0
						regCombinerPhysicalIndex = logicalIndex * 2;
						isRegisterCombiner = true;
						break;
					case CG_COMBINER_STAGE_CONST1:
						// register combiner, const 1
						// the index relates to the texture stage; store this as (stage * 2) + 1
						regCombinerPhysicalIndex = (logicalIndex * 2) + 1;
						isRegisterCombiner = true;
						break;
					default:
						// normal constant
						break;
					}

					// Trim the '[0]' suffix if it exists, we will add our own indexing later
					if (StringUtil::endsWith(paramName, "[0]", false))
					{
						paramName.erase(paramName.size() - 3);
					}


					GpuConstantDefinition def;
					def.arraySize = contextArraySize;
					mapTypeAndElementSize(paramType, isRegisterCombiner, def);

					if (def.constType == GCT_UNKNOWN)
					{
						LogManager::getSingleton().logMessage(
							"Problem parsing the following Cg Uniform: '"
							+ paramName + "' in file " + mName);
						// next uniform
						parameter = cgGetNextParameter(parameter);
						continue;
					}
					if (isRegisterCombiner)
					{
						def.physicalIndex = regCombinerPhysicalIndex;
					}
					else
					{
						// base position on existing buffer contents
						if (def.isFloat())
						{
							def.physicalIndex = mFloatLogicalToPhysical->bufferSize;
						}
						else
						{
							def.physicalIndex = mIntLogicalToPhysical->bufferSize;
						}
					}

					def.logicalIndex = logicalIndex;
					if( mParametersMap.find(paramName) == mParametersMap.end())
					{
						mParametersMap.insert(GpuConstantDefinitionMap::value_type(paramName, def));
						mParametersMapSizeAsBuffer += sizeof(size_t);
						mParametersMapSizeAsBuffer += paramName.size();
						mParametersMapSizeAsBuffer += sizeof(GpuConstantDefinition);
					}

					// Record logical / physical mapping
					if (def.isFloat())
					{
											OGRE_LOCK_MUTEX(mFloatLogicalToPhysical->mutex);
						mFloatLogicalToPhysical->map.insert(
							GpuLogicalIndexUseMap::value_type(def.logicalIndex, 
								GpuLogicalIndexUse(def.physicalIndex, def.arraySize * def.elementSize, GPV_GLOBAL)));
						mFloatLogicalToPhysical->bufferSize += def.arraySize * def.elementSize;
					}
					else
					{
											OGRE_LOCK_MUTEX(mIntLogicalToPhysical->mutex);
						mIntLogicalToPhysical->map.insert(
							GpuLogicalIndexUseMap::value_type(def.logicalIndex, 
								GpuLogicalIndexUse(def.physicalIndex, def.arraySize * def.elementSize, GPV_GLOBAL)));
						mIntLogicalToPhysical->bufferSize += def.arraySize * def.elementSize;
					}

					break;
				}                   
			}

			// now handle uniform samplers. This is needed to fix their register positions
			// if delegating to a GLSL shader.
			if (mDelegate && cgGetParameterVariability(parameter) == CG_UNIFORM && (
				paramType == CG_SAMPLER1D ||
				paramType == CG_SAMPLER2D ||
				paramType == CG_SAMPLER3D ||
				paramType == CG_SAMPLERCUBE ||
				paramType == CG_SAMPLERRECT) &&
				cgGetParameterDirection(parameter) != CG_OUT && 
				cgIsParameterReferenced(parameter))
			{
				String paramName = cgGetParameterName(parameter);
				CGresource res = cgGetParameterResource(parameter);
				int pos = -1;
				switch (res)
				{
				case CG_TEXUNIT0: pos = 0; break;
				case CG_TEXUNIT1: pos = 1; break;
				case CG_TEXUNIT2: pos = 2; break;
				case CG_TEXUNIT3: pos = 3; break;
				case CG_TEXUNIT4: pos = 4; break;
				case CG_TEXUNIT5: pos = 5; break;
				case CG_TEXUNIT6: pos = 6; break;
				case CG_TEXUNIT7: pos = 7; break;
				case CG_TEXUNIT8: pos = 8; break;
				case CG_TEXUNIT9: pos = 9; break;
				case CG_TEXUNIT10: pos = 10; break;
				case CG_TEXUNIT11: pos = 11; break;
				case CG_TEXUNIT12: pos = 12; break;
				case CG_TEXUNIT13: pos = 13; break;
				case CG_TEXUNIT14: pos = 14; break;
				case CG_TEXUNIT15: pos = 15; break;
#if(CG_VERSION_NUM >= 3000)
				case CG_TEXUNIT16: pos = 16; break;
				case CG_TEXUNIT17: pos = 17; break;
				case CG_TEXUNIT18: pos = 18; break;
				case CG_TEXUNIT19: pos = 19; break;
				case CG_TEXUNIT20: pos = 20; break;
				case CG_TEXUNIT21: pos = 21; break;
				case CG_TEXUNIT22: pos = 22; break;
				case CG_TEXUNIT23: pos = 23; break;
				case CG_TEXUNIT24: pos = 24; break;
				case CG_TEXUNIT25: pos = 25; break;
				case CG_TEXUNIT26: pos = 26; break;
				case CG_TEXUNIT27: pos = 27; break;
				case CG_TEXUNIT28: pos = 28; break;
				case CG_TEXUNIT29: pos = 29; break;
				case CG_TEXUNIT30: pos = 30; break;
				case CG_TEXUNIT31: pos = 31; break;
#endif
				default:
					break;
				}
				if (pos != -1)
				{
					mSamplerRegisterMap.insert(std::make_pair(paramName, pos));
				}
			}

			// Get next
			parameter = cgGetNextParameter(parameter);
		}

		
	}
Пример #26
0
//---------------------------------------------------------------------
void DefaultWorkQueueBase::processRequestResponse(Request* r, bool synchronous)
{
    Response* response = processRequest(r);

    OGRE_LOCK_MUTEX(mProcessMutex);

    RequestQueue::iterator it;
    for( it = mProcessQueue.begin(); it != mProcessQueue.end(); ++it )
    {
        if( (*it) == r )
        {
            mProcessQueue.erase( it );
            break;
        }
    }
    if( mIdleProcessed == r )
    {
        mIdleProcessed = 0;
    }
    if (response)
    {
        if (!response->succeeded())
        {
            // Failed, should we retry?
            const Request* req = response->getRequest();
            if (req->getRetryCount())
            {
                addRequestWithRID(req->getID(), req->getChannel(), req->getType(), req->getData(),
                                  req->getRetryCount() - 1);
                // discard response (this also deletes request)
                OGRE_DELETE response;
                return;
            }
        }
        if (synchronous)
        {
            processResponse(response);
            OGRE_DELETE response;
        }
        else
        {
            if( response->getRequest()->getAborted() )
            {
                // destroy response user data
                response->abortRequest();
            }
            // Queue response
            OGRE_LOCK_MUTEX(mResponseMutex);
            mResponseQueue.push_back(response);
            // no need to wake thread, this is processed by the main thread
        }

    }
    else
    {
        // no response, delete request
        LogManager::getSingleton().stream() <<
                                            "DefaultWorkQueueBase('" << mName << "') warning: no handler processed request "
                                            << r->getID() << ", channel " << r->getChannel()
                                            << ", type " << r->getType();
        OGRE_DELETE r;
    }

}
Пример #27
0
//---------------------------------------------------------------------
void DefaultWorkQueueBase::setRequestsAccepted(bool accept)
{
    OGRE_LOCK_MUTEX(mRequestMutex);

    mAcceptRequests = accept;
}
Пример #28
0
//---------------------------------------------------------------------
void DefaultWorkQueueBase::setPaused(bool pause)
{
    OGRE_LOCK_MUTEX(mRequestMutex);

    mPaused = pause;
}
	//-----------------------------------------------------------------------
	void D3D9ResourceManager::_notifyResourceCreated(D3D9Resource* pResource)
	{		
		OGRE_LOCK_MUTEX(mResourcesMutex)		
		mResources.push_back(pResource);
	}
    //-----------------------------------------------------------------------
    void StringInterface::cleanupDictionary ()
    {
            OGRE_LOCK_MUTEX( msDictionaryMutex );

        msDictionary.clear();
    }