Control - Run guard
This commit is contained in:
parent
d5d463fd2c
commit
8a0afc345f
1 changed files with 22 additions and 0 deletions
22
ops.cc
22
ops.cc
|
@ -242,6 +242,26 @@ T_OpContext::T_OpContext(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct T_RunGuard
|
||||||
|
{
|
||||||
|
T_OpContext& context;
|
||||||
|
T_RunGuard( T_OpContext& ctx ) noexcept : context( ctx ) {}
|
||||||
|
|
||||||
|
~T_RunGuard( )
|
||||||
|
{
|
||||||
|
while ( !context.profiling.empty( ) ) {
|
||||||
|
Globals::Profiler( ).end( context.profiling.last( ) );
|
||||||
|
context.profiling.removeLast( );
|
||||||
|
}
|
||||||
|
glUseProgram( 0 );
|
||||||
|
glBindProgramPipeline( 0 );
|
||||||
|
glBindFramebuffer( GL_FRAMEBUFFER , 0 );
|
||||||
|
Globals::Textures( ).reset( );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void T_OpContext::run(
|
void T_OpContext::run(
|
||||||
const E_RunTarget target ,
|
const E_RunTarget target ,
|
||||||
const float time ,
|
const float time ,
|
||||||
|
@ -249,6 +269,8 @@ void T_OpContext::run(
|
||||||
const float height )
|
const float height )
|
||||||
{
|
{
|
||||||
assert( !aborted );
|
assert( !aborted );
|
||||||
|
|
||||||
|
T_RunGuard rg( *this );
|
||||||
x87sp = 0;
|
x87sp = 0;
|
||||||
instrPtr = program.ops.firstOf( target == R_INIT ? program.init : program.frame );
|
instrPtr = program.ops.firstOf( target == R_INIT ? program.init : program.frame );
|
||||||
values[ 0 ] = time;
|
values[ 0 ] = time;
|
||||||
|
|
Loading…
Reference in a new issue