void OctreeBrickPoolManagerDisk::BrickEntry::decreaseAllInUse() {
    tgtAssert(isInUse(0,0), "Underflow. No thread is using the brick in 1.channel!");
    tgtAssert(isInUse(1,0), "Underflow. No thread is using the brick in 2.channel!");
    tgtAssert(isInUse(2,0), "Underflow. No thread is using the brick in 3.channel!");
    tgtAssert(isInUse(3,0), "Underflow. No thread is using the brick in 4.channel!");
    entry_ -= 9360; //0010010010010000
}
void OctreeBrickPoolManagerDisk::BrickEntry::increaseAllInUse() {
    tgtAssert(!isInUse(0,6), "Overflow. More than 7 threads are using the brick in 1.channel!");
    tgtAssert(!isInUse(1,6), "Overflow. More than 7 threads are using the brick in 2.channel!");
    tgtAssert(!isInUse(2,6), "Overflow. More than 7 threads are using the brick in 3.channel!");
    tgtAssert(!isInUse(3,6), "Overflow. More than 7 threads are using the brick in 4.channel!");
    entry_ += 9360; //0010010010010000
}
Пример #3
0
	void ShaderProgram::setUniform(const GLchar *name, float x, float y, float z, float w)
	{
		if (!isInUse())
			use();

		glUniform4f(getUniformLocation(name), x, y, z, w);
	}
Пример #4
0
void EventableResource::eventableSetInUseOff()
{
    if (!isInUse())
        return;
    clearOwner();
    Resource::setInUse(false);
}
Пример #5
0
const std::vector< GLSLProgram::UniformInformations > GLSLProgram::getActiveUniforms() const
{
	if ( isInUse() )
	{
		// number of active uniforms
		GLint numUniforms;
		glGetProgramiv( getProgramObject(), GL_ACTIVE_UNIFORMS, &numUniforms );

		GLint maxLength;
		glGetProgramiv( getProgramObject(), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength );

		std::vector< UniformInformations > uniforms(numUniforms, UniformInformations(maxLength) );

		// for each uniform, do
		for( GLint index = 0; index< numUniforms; ++index )
		{
			UniformInformations& uniform = uniforms[index];
			glGetActiveUniform(	getProgramObject(), index,
								uniform.name.size(), 0,
								&uniform.size, &uniform.type, &uniform.name[0] );
		}
		return uniforms;
	}
	else
	{
		std::vector< UniformInformations > uniforms;
		return uniforms;
	}
}
Пример #6
0
	void ShaderProgram::setUniform(const GLchar *name, bool x)
	{
		if (!isInUse())
			use();

		glUniform1i(getUniformLocation(name), x);
	}
Пример #7
0
	void ShaderProgram::setUniform(const GLchar *name, unsigned int x)
	{
		if (!isInUse())
			use();

		glUniform1ui(getUniformLocation(name), x);
	}
Пример #8
0
void EventableResource::eventableSetInUseOn(Thread &t)
{
    if (isInUse())
        clearOwner();
    vector = 0;
    EV = getID();
    eventsEnabled = false;
    interruptMode = false;
    owner = &t;
    Resource::setInUse(true);
}
Пример #9
0
// add a next setpoint for the stepper to go to, will wait if queue is full
void setpointAdd (const Setpoint& s) {
    // TODO: silly approach, should use first/last indices into circular buffer
    for (int i = 0; i <= SETPOINT_QUEUE_SIZE; ++i)
        if (!isInUse(i)) {
            setInUse(i);
            setpoint.setpoints[i] = s;
            chMBPost(&setpoint.mailbox, i, TIME_INFINITE);
            return;
        }
    // never reached
}
Пример #10
0
// Spins until frame becomes available or decoding
// gets canceled.
// If the requested frame is available the method returns true.
// If decoding was interupted before the requested frame becomes
// available, the method returns false.
bool
FrameQueue::waitUntilFrameAvailable(int nPictureIndex)
{
    while (isInUse(nPictureIndex))
    {
        sleep(1);   // Decoder is getting too far ahead from display
        if (isEndOfDecode())
            return false;
    }

    return true;
}
Пример #11
0
static ScheduledLightEvent * findUnusedEvent(void)
{
    int i;
    ScheduledLightEvent * event = eventList;

    for (i = 0; i < MAX_EVENTS; i++, event++)
    {
        if (!isInUse(event))
            return event;
    }
    return NULL;
}
Пример #12
0
bool FrameQueue::waitUntilFrameAvailable(int nPictureIndex)
{
    while (isInUse(nPictureIndex))
    {
        sleep(1);   

        if (bEndOfDecode_){
            return false;
        }
    }

    return true;
}
Пример #13
0
void ALAuxiliaryEffectSlot::release()
{
    CheckContext(mContext);
    if(isInUse())
        throw std::runtime_error("AuxiliaryEffectSlot is in use");

    alGetError();
    mContext->alDeleteAuxiliaryEffectSlots(1, &mId);
    if(alGetError() != AL_NO_ERROR)
        throw std::runtime_error("AuxiliaryEffectSlot failed to delete");
    mId = 0;

    delete this;
}
Пример #14
0
static ScheduledLightEvent * findUnusedEvent(void)
{
    int i;
    ScheduledLightEvent * event = 0;

    for (i = 0; i < MAX_EVENTS; i++)
    {
        if (!isInUse(&eventList[i]))
        {
            event = &eventList[i];
            return event;
        }
    }
    return NULL;
}
Пример #15
0
void AnimSkeleton::onGameLoop() {
	Anim::onGameLoop();

	if (isInUse() && _totalTime) {
		uint32 newTime = _currentTime + StarkGlobal->getMillisecondsPerGameloop();

		if (!_loop && newTime > _totalTime) {
			if (_actionItem) {
				_actionItem->resetActionAnim();
				_actionItem = nullptr;
			}
		} else {
			_currentTime = newTime % _totalTime;
			_visual->setTime(_currentTime);
		}
	}
}
Пример #16
0
void AnimVideo::onGameLoop() {
	if (!_smacker || !isInUse()) {
		return; // Animation not in use, no need to update the movie
	}

	if (_smacker->isDone()) {
		// The last frame has been reached
		if (!_loop && _actionItem) {
			// Reset our item if needed
			_actionItem->resetActionAnim();
			_actionItem = nullptr;
		}

		if (_loop) {
			_smacker->rewind();
		}
	}

	if (!_smacker->isDone()) {
		_smacker->update();
		updateSmackerPosition();
	}
}
Пример #17
0
bool  TankEngine::findNextSlot(  TankSectionRackSlot & tsrs )
{

// Is there a currently selected tank to use

	if( sli.rackSlots == BRUNKNOWN_INT ){return false; }

	TankSectionRackSlot t1=tsrs;
//
	if( t1.slot >= sli.rackSlots )
	{
// Move on to the first slot in the next Rack
		t1.slot = 1;
		int lastRack,firstRack;
		lastRack= BRUNKNOWN_INT;
		for( Range< LCDbSectionDef > r = LCDbSectionDefs::records(); r.isValid(); ++ r )
		{
			if( r->getTankLayoutCID() == sli.rackLayoutID  && tsrs.fillOrder == r->getFillOrder() )
			{
				lastRack= r->getLastRack();
				firstRack= r->getFirstRack();
			}
		}

		if( t1.rack >= lastRack )
		{
// All the racks in the section are full move on to the next section.
			t1.rack = firstRack;
			bool isNextSection;		isNextSection = false;
			std::string nextSection;		nextSection = "";
			int nextFillOrder;		nextFillOrder= BRUNKNOWN_INT;

//			isNextSection=incSection(t1.section,nextSection,sli.tankCID);
			isNextSection=incSection(t1.fillOrder,sli.tankCID, nextFillOrder,nextSection,t1.rack);

			if( ! isNextSection )
			{
// All the sections in the tank have been used up. Ask for a new tank.
				return false;
			}
			t1.fillOrder= nextFillOrder;
//			t1.section=nextSection;
		}
		else t1.rack++;		// moved: NG, 19/5/09

	}else
	{
		t1.slot ++;
	}

// The next slot in the storage system has already been taken up.
	if(isInUse(t1))
	{
		return false;
	}else
	{
		tsrs.tank    = t1.tank;
		tsrs.fillOrder = t1.fillOrder;
//		tsrs.section = t1.section;
		tsrs.rack    = t1.rack;
		tsrs.slot	 = t1.slot;
		return true;
	}
}
Пример #18
0
	void ShaderProgram::use() const
	{
		if (!isInUse())
			glUseProgram(m_program);
	}
Пример #19
0
void ShaderProgram::checkInUse() const
{
	if (!isInUse())
		panic("ShaderProgram not is use.");
}
Пример #20
0
void ShaderProgram::stopUsing() const
{
	if (isInUse())
		glUseProgram(0);
}
Пример #21
0
void ShaderProgram::use() const
{
	if (!isInUse())
		glUseProgram(handle);
}
bool OctreeBrickPoolManagerDisk::BrickEntry::isInUse(uint16_t threshold) {
    return (isInUse(0,threshold) || isInUse(1,threshold) || isInUse(2,threshold) || isInUse(3,threshold));

}
void OctreeBrickPoolManagerDisk::BrickEntry::decreaseInUse(size_t channel) {
    tgtAssert(channel < 4, "channel not between 0 and 3!");
    tgtAssert(isInUse(channel,0), "Underflow. No thread is using the brick!");
    entry_ -= (uint16_t)(1) << (4+3*channel);
}
Пример #24
0
void ShaderProgram::stopUsing()const{
    assert(isInUse());
    glUseProgram(0);
}
Пример #25
0
void ShaderProgram::setUniform(const GLchar* name, const glm::mat4& m, GLboolean transpose) {
    assert(isInUse());
    glUniformMatrix4fv(uniform(name), 1, transpose, glm::value_ptr(m));
}
Пример #26
0
void ShaderProgram::setUniformMatrix4(const GLchar* name, const GLfloat* v, GLsizei count, GLboolean transpose) {
    assert(isInUse());
    glUniformMatrix4fv(uniform(name), count, transpose, v);
}
Пример #27
0
 // test if an index position is valid in this table.
 inline bool isIndexValid(ItemLink i)
 {
     return i < totalSize && isInUse(i);
 }