예제 #1
0
void RF_BeginFrame( float cameraSeparation, bool forceClear, bool forceVsync )
{
	RF_CheckCvars();

	// run cinematic passes on shaders
	R_RunAllCinematics();

	rrf.adapter.maxfps = r_maxfps->integer;

	// take the frame the backend is not busy processing
	if( glConfig.multithreading ) {
		ri.Mutex_Lock( rrf.adapter.frameLock );
		if( rrf.lastFrameNum == rrf.adapter.frameNum )
			rrf.frameNum = (rrf.adapter.frameNum + 1) % 3;
		else
			rrf.frameNum = 3 - (rrf.adapter.frameNum + rrf.lastFrameNum);
		if( rrf.frameNum == 3 ) {
			rrf.frameNum = 1;
		}
		rrf.frame = rrf.frames[rrf.frameNum];
		ri.Mutex_Unlock( rrf.adapter.frameLock );
	}

	rrf.frame->Clear( rrf.frame );
	rrf.cameraSeparation = cameraSeparation;

	R_DataSync();

	rrf.frame->BeginFrame( rrf.frame, cameraSeparation, forceClear, forceVsync );
}
예제 #2
0
파일: r_frontend.c 프로젝트: DenMSC/qfusion
void RF_BeginFrame( float cameraSeparation, bool forceClear, bool forceVsync, bool uncappedFPS )
{
	int swapInterval;

	RF_CheckCvars();

	// run cinematic passes on shaders
	R_RunAllCinematics();

	if( uncappedFPS ) {
		rrf.adapter.maxfps = 0;
	}
	else {
		rrf.adapter.maxfps = r_maxfps->integer;
	}

	// take the frame the backend is not busy processing
	if( glConfig.multithreading ) {
		ri.Mutex_Lock( rrf.adapter.frameLock );
		if( rrf.lastFrameNum == rrf.adapter.frameNum )
			rrf.frameNum = (rrf.adapter.frameNum + 1) % 3;
		else
			rrf.frameNum = 3 - (rrf.adapter.frameNum + rrf.lastFrameNum);
		if( rrf.frameNum == 3 ) {
			rrf.frameNum = 1;
		}
		rrf.frame = rrf.frames[rrf.frameNum];
		ri.Mutex_Unlock( rrf.adapter.frameLock );
	}

	rrf.frame->Clear( rrf.frame );
	rrf.cameraSeparation = cameraSeparation;

	R_DataSync();

	swapInterval = r_swapinterval->integer || forceVsync ? 1 : 0;
	clamp_low( swapInterval, r_swapinterval_min->integer );

	rrf.frame->BeginFrame( rrf.frame, cameraSeparation, forceClear, swapInterval );
}