void ipAddrToAsciiEnginePrivate::run ()
{
    epicsGuard < epicsMutex > guard ( this->mutex );
    while ( ! this->exitFlag ) {
        {
            epicsGuardRelease < epicsMutex > unguard ( guard );
            this->laborEvent.wait ();
        }
        while ( true ) {
            ipAddrToAsciiTransactionPrivate * pItem = this->labor.get ();
            if ( ! pItem ) {
                break;
            }
            osiSockAddr addr = pItem->addr;
            this->pCurrent = pItem;
    
            if ( this->exitFlag )
            {
                sockAddrToDottedIP ( & addr.sa, this->nameTmp, 
                    sizeof ( this->nameTmp ) );
            }
            else {
                epicsGuardRelease < epicsMutex > unguard ( guard );
                // depending on DNS configuration, this could take a very long time
                // so we release the lock
                sockAddrToA ( &addr.sa, this->nameTmp, sizeof ( this->nameTmp ) );
            }

            // the ipAddrToAsciiTransactionPrivate destructor is allowed to
            // set pCurrent to nill and avoid blocking on a slow DNS 
            // operation
            if ( ! this->pCurrent ) {
                continue;
            }

            this->callbackInProgress = true;

            {
                epicsGuardRelease < epicsMutex > unguard ( guard );
                // dont call callback with lock applied
                this->pCurrent->pCB->transactionComplete ( this->nameTmp );
            }

            this->callbackInProgress = false;

            if ( this->pCurrent ) {
                this->pCurrent->pending = false;
                this->pCurrent = 0;
            }
            if ( this->cancelPendingCount  ) {
                this->destructorBlockEvent.signal ();
            }
        }
    }
}
void LGLAPI LGLTracer_glProgramParameteri( GLuint program, GLenum pname, GLint value )
{
	guard();
	APIHook.glProgramParameteri( program, pname, value );
	CheckRendererError( "" );
	unguard();
}
Exemple #3
0
void clASELoader::ASE_ReadTVertexList( iIStream* FStream, clVAMender* Mender )
{
	guard();

#ifdef ASE_HEAVY_DEBUG
	Env->Logger->Log( L_DEBUG, "Reading Tvertex list..." );
#endif

	char Keyword[32];

	while ( !FStream->Eof() )
	{
		LString Line = FStream->ReadLineTrimLeadSpaces();

		if ( LStr::ContainsSubStr( Line, "}" ) )
		{
			break;
		}
		else if ( LStr::StartsWith( Line, ASE_MeshTVertex ) )
		{
			int Index;
			float U, V, W;

			sscanf( Line.c_str(), "%s %d %f %f %f", Keyword, &Index, &U, &V, &W );

			Mender->EmitTextureVertex( Index, LVector3( U, 1.0f - V, W ) );
		}
		else
		{
			FATAL_MSG( "Unexpected token in " + ASE_MeshTVertexList + " : " + Line );
		}
	}

	unguard();
}
Exemple #4
0
void clASELoader::AddNode( int ParentIdx,
                           clVertexAttribs* VA,
                           const sASEMaterial& Material,
                           const LString& ObjName,
                           const LMatrix4& GlobalTransform )
{
	guard();

	sMaterialDesc Mat = CreateMaterialFromASE( Material );

	int MaterialIdx = FMesh->AddMaterial( Mat );

	FMesh->AddVertexAttribs( ObjName, VA, GlobalTransform, ParentIdx, MaterialIdx );

	// multiply all vertices by inverse GlobalTransform
	LVector3* Vertices = VA->FVertices.GetPtr();

	LMatrix4 InvGlobalTM = GlobalTransform.GetInversed();

	for ( size_t i = 0; i != VA->FVertices.size(); i++ )
	{
		Vertices[i] = InvGlobalTM * Vertices[i];
	}

	//

	unguard();
}
Exemple #5
0
void clASELoader::ASE_ReadTMAnimation( iIStream* FStream )
{
	guard();

	while ( !FStream->Eof() )
	{
		LString Line = FStream->ReadLineTrimLeadSpaces();

		if ( LStr::ContainsSubStr( Line, "}" ) )
		{
			break;
		}
		else if ( LStr::StartsWith( Line, ASE_ControlPosTrack ) )
		{
			ASE_ReadControlPosTrack( FStream );
		}
		else if ( LStr::StartsWith( Line, ASE_ControlRotTrack ) )
		{
			ASE_ReadControlRotTrack( FStream );
		}
		else if ( LStr::StartsWith( Line, ASE_ControlScaleTrack ) )
		{
			ASE_ReadControlScaleTrack( FStream );
		}
		else
		{
			ASE_SkipBlock( FStream, Line );
		}
	}

	unguard();
}
void getCallback::exception (
    epicsGuard < epicsMutex > & guard,
    int status, const char * /* pContext */, 
    unsigned type, arrayElementCount count )
{
    if ( status != ECA_CHANDESTROY ) {
        struct event_handler_args args;
        args.usr = this->pPrivate;
        args.chid = & this->chan;
        args.type = type;
        args.count = count;
        args.status = status;
        args.dbr = 0;
        caEventCallBackFunc * pFuncTmp = this->pFunc;
        // fetch client context and destroy prior to releasing
        // the lock and calling cb in case they destroy channel there
        this->chan.getClientCtx().destroyGetCallback ( guard, *this );
        {
            epicsGuardRelease < epicsMutex > unguard ( guard );
            ( *pFuncTmp ) ( args );
        }
    }
    else {
        this->chan.getClientCtx().destroyGetCallback ( guard, *this );
    }
}
void LGLAPI LGLTracer_glBindVertexArray( GLuint array )
{
	guard();
	APIHook.glBindVertexArray( array );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glVertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer )
{
	guard();
	APIHook.glVertexAttribPointer( index, size, type, normalized, stride, pointer );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glTexParameteri( GLenum target, GLenum pname, GLint param )
{
	guard( "0x%X, 0x%X, %i", target, pname, param );
	APIHook.glTexParameteri( target, pname, param );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glTexParameterf( GLenum target, GLenum pname, GLfloat param )
{
	guard();
	APIHook.glTexParameterf( target, pname, param );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glTexImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels )
{
	guard();
	APIHook.glTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels )
{
	guard();
	APIHook.glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glShaderSource( GLuint shader, GLsizei count, const GLchar* *string, const GLint* length )
{
	guard();
	APIHook.glShaderSource( shader, count, string, length );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels )
{
	guard();
	APIHook.glReadPixels( x, y, width, height, format, type, pixels );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glReadBuffer( GLenum mode )
{
	guard();
	APIHook.glReadBuffer( mode );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glValidateProgram( GLuint program )
{
	guard();
	APIHook.glValidateProgram( program );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glBindTexture( GLenum target, GLuint texture )
{
	guard( "0x%X, %u", target, texture );
	APIHook.glBindTexture( target, texture );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glUniform1f( GLint location, GLfloat v0 )
{
	guard( "%i, %f", location, v0 );
	APIHook.glUniform1f( location, v0 );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
	guard();
	APIHook.glViewport( x, y, width, height );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glBindFramebuffer( GLenum target, GLuint framebuffer )
{
	guard();
	APIHook.glBindFramebuffer( target, framebuffer );
	CheckRendererError( "" );
	unguard();
}
ipAddrToAsciiTransactionPrivate::~ipAddrToAsciiTransactionPrivate ()
{
    epicsGuard < epicsMutex > guard ( this->engine.mutex );
    while ( this->pending ) {
        if ( this->engine.pCurrent == this && 
                this->engine.callbackInProgress && 
                ! this->engine.thread.isCurrentThread() ) {
            assert ( this->engine.cancelPendingCount < UINT_MAX );
            this->engine.cancelPendingCount++;
            {
                epicsGuardRelease < epicsMutex > unguard ( guard );
                this->engine.destructorBlockEvent.wait ();
            }
            assert ( this->engine.cancelPendingCount > 0u );
            this->engine.cancelPendingCount--;
            if ( ! this->pending ) {
                if ( this->engine.cancelPendingCount ) {
                    this->engine.destructorBlockEvent.signal ();
                }
                break;
            }
        }
        else {
            if ( this->engine.pCurrent == this ) {
                this->engine.pCurrent = 0;
            }
            else {
                this->engine.labor.remove ( *this );
            }
            this->pending = false;
        }
    }
}
void LGLAPI LGLTracer_glUniform1i( GLint location, GLint v0 )
{
	guard();
	APIHook.glUniform1i( location, v0 );
	CheckRendererError( "" );
	unguard();
}
Exemple #23
0
void clASELoader::ASE_ReadMaterialList( iIStream* FStream )
{
	guard();

	while ( !FStream->Eof() )
	{
		LString Line = FStream->ReadLineTrimLeadSpaces();

		if ( LStr::ContainsSubStr( Line, "}" ) )
		{
			break;
		}
		else if ( LStr::StartsWith( Line, ASE_MaterialCount ) )
		{
			int MaterialCount = LStr::ToInt( LStr::GetToken( Line, 2 ) );

			FMaterialList.resize( MaterialCount );
		}
		else if ( LStr::StartsWith( Line, ASE_Material ) )
		{
			int MaterialIndex = LStr::ToInt( LStr::GetToken( Line, 2 ) );

			//ASE_ReadMaterial( MaterialIndex, -1, 0 );
			FMaterialList[ MaterialIndex ] = ASE_ReadMaterial( FStream, 0 );
		}
		else
		{
			FATAL_MSG( "Unexpected token in " + ASE_MaterialList + " : " + Line );
		}
	}

	unguard();
}
void LGLAPI LGLTracer_glUniform1iv( GLint location, GLsizei count, const GLint* v0 )
{
	guard();
	APIHook.glUniform1iv( location, count, v0 );
	CheckRendererError( "" );
	unguard();
}
Exemple #25
0
void clASELoader::ASE_ReadShapeObject( iIStream* FStream )
{
	guard();

	LMatrix4 NodeTM;

	NodeTM.IdentityMatrix();

	while ( !FStream->Eof() )
	{
		LString Line = FStream->ReadLineTrimLeadSpaces();

		if ( LStr::ContainsSubStr( Line, "}" ) )
		{
			break;
		}
		else if ( LStr::StartsWith( Line, ASE_NodeTM ) )
		{
			NodeTM = ASE_ReadNodeTM( FStream );
		}
		else if ( LStr::StartsWith( Line, ASE_TMAnimation ) )
		{
			ASE_ReadTMAnimation( FStream );
		}
		else
		{
			ASE_SkipBlock( FStream, Line );
		}
	}

	unguard();
}
void LGLAPI LGLTracer_glUniform4fv( GLint location, GLsizei count, const GLfloat* value )
{
	guard();
	APIHook.glUniform4fv( location, count, value );
	CheckRendererError( "" );
	unguard();
}
Exemple #27
0
void clASELoader::ASE_ReadVertexList( iIStream* FStream, clVAMender* Mender )
{
	guard();

#ifdef ASE_HEAVY_DEBUG
	Env->Logger->Log( L_DEBUG, "Reading vertex list..." );
#endif

	char Keyword[32];

	int Index;
	float X, Y, Z;

	while ( !FStream->Eof() )
	{
		LString Line( FStream->ReadLineTrimLeadSpaces() );

		if ( LStr::StartsWith( Line, ASE_MeshVertex ) )
		{
			sscanf( Line.c_str(), "%s %d %f %f %f", Keyword, &Index, &X, &Y, &Z );

			Mender->EmitVertex( Index, LVector3( X, Y, Z ), -1, -1 );
		}
		else if ( LStr::ContainsSubStr( Line, "}" ) )
		{
			break;
		}
		else
		{
			FATAL_MSG( "Unexpected token in " + ASE_MeshVertexList + " : " + Line );
		}
	}

	unguard();
}
void LGLAPI LGLTracer_glUniformBlockBinding( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding )
{
	guard();
	APIHook.glUniformBlockBinding( program, uniformBlockIndex, uniformBlockBinding );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glUniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
{
	guard();
	APIHook.glUniformMatrix4fv( location, count, transpose, value );
	CheckRendererError( "" );
	unguard();
}
void LGLAPI LGLTracer_glBindFragDataLocation( GLuint program, GLuint color, const GLchar* name )
{
	guard();
	APIHook.glBindFragDataLocation( program, color, name );
	CheckRendererError( "" );
	unguard();
}