Exemplo n.º 1
0
/*
 * RB_ExecuteRenderCommands
 *
 * This function will be called synchronously if running without
 * smp extensions, or asynchronously by another thread.
 */
void
RB_ExecuteRenderCommands(const void *data)
{
	int t1, t2;

	t1 = ri.Milliseconds ();

	if(!r_smp->integer || data == backEndData[0]->commands.cmds){
		backEnd.smpFrame = 0;
	}else{
		backEnd.smpFrame = 1;
	}

	while(1){
		data = PADP(data, sizeof(void *));

		switch(*(const int*)data){
		case RC_SET_COLOR:
			data = RB_SetColor(data);
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic(data);
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs(data);
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer(data);
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers(data);
			break;
		case RC_SCREENSHOT:
			data = RB_TakeScreenshotCmd(data);
			break;
		case RC_VIDEOFRAME:
			data = RB_TakeVideoFrameCmd(data);
			break;
		case RC_COLORMASK:
			data = RB_ColorMask(data);
			break;
		case RC_CLEARDEPTH:
			data = RB_ClearDepth(data);
			break;
		case RC_CAPSHADOWMAP:
			data = RB_CapShadowMap(data);
			break;
		case RC_POSTPROCESS:
			data = RB_PostProcess(data);
			break;
		case RC_END_OF_LIST:
		default:
			/* stop rendering on this thread */
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}
Exemplo n.º 2
0
void RB_ExecuteBackEndCommands( const emptyCommand_t *cmds ) {
	// r_debugRenderToTexture
	int	c_draw3d = 0, c_draw2d = 0, c_setBuffers = 0, c_swapBuffers = 0, c_copyRenders = 0;

	if ( cmds->commandId == RC_NOP && !cmds->next ) {
		return;
	}

	backEndStartTime = Sys_Milliseconds();

	// needed for editor rendering
	RB_SetDefaultGLState();

	// upload any image loads that have completed
	globalImages->CompleteBackgroundImageLoads();

	for ( ; cmds ; cmds = (const emptyCommand_t *)cmds->next ) {
		switch ( cmds->commandId ) {
		case RC_NOP:
			break;
		case RC_DRAW_VIEW:
			RB_DrawView( cmds );
			if ( ((const drawSurfsCommand_t *)cmds)->viewDef->viewEntitys ) {
				c_draw3d++;
			}
			else {
				c_draw2d++;
			}
			break;
		case RC_SET_BUFFER:
			RB_SetBuffer( cmds );
			c_setBuffers++;
			break;
		case RC_SWAP_BUFFERS:
			RB_SwapBuffers( cmds );
			c_swapBuffers++;
			break;
		case RC_COPY_RENDER:
			RB_CopyRender( cmds );
			c_copyRenders++;
			break;
		default:
			common->Error( "RB_ExecuteBackEndCommands: bad commandId" );
			break;
		}
	}

	// go back to the default texture so the editor doesn't mess up a bound image
	qglBindTexture( GL_TEXTURE_2D, 0 );
	backEnd.glState.tmu[0].current2DMap = -1;

	// stop rendering on this thread
	backEndFinishTime = Sys_Milliseconds();
	backEnd.pc.msec = backEndFinishTime - backEndStartTime;

	if ( r_debugRenderToTexture.GetInteger() == 1 ) {
		common->Printf( "3d: %i, 2d: %i, SetBuf: %i, SwpBuf: %i, CpyRenders: %i, CpyFrameBuf: %i\n", c_draw3d, c_draw2d, c_setBuffers, c_swapBuffers, c_copyRenders, backEnd.c_copyFrameBuffer );
		backEnd.c_copyFrameBuffer = 0;
	}
}
Exemplo n.º 3
0
/*
====================
RB_ExecuteRenderCommands

This function will be called synchronously if running without
smp extensions, or asynchronously by another thread.
====================
*/
void RB_ExecuteRenderCommands( const void *oldData ) {
	int		t1, t2;
	commandHeader_t *header;
	const void* data;

	t1 = ri.Milliseconds ();

	if ( !r_smp->integer || oldData == backEndData[0]->data ) {
		backEnd.smpFrame = 0;
	} else {
		backEnd.smpFrame = 1;
	}
again:
	data = oldData;
	header = (commandHeader_t *)data;
	backEnd.doneBloom = qfalse;
	while ( 1 ) {
		int cmd = header->commandId;
		data = header + 1;
		header = (commandHeader_t *)(((char *)header) + header->size);
		switch ( cmd ) {
		case RC_SET_COLOR:
			RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
			R_BloomScreen();
			RB_StretchPic( data );
			break;
		case RC_DRAW_SURFS:
			backEnd.doneSurfaces = qtrue;
			RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
			RB_DrawBuffer( data );
			break;
		case RC_SWAP_BUFFERS:
			R_BloomScreen();
			if ( RB_SwapBuffers( data ) )
				goto again;
			break;
		case RC_SCREENSHOT:
			RB_ScreenShotCmd( data );
			break;
		case RC_CAPTURE:
			R_MME_CaptureShotCmd( data );
			break;
		case RC_CAPTURE_STEREO:
			R_MME_CaptureShotCmdStereo( data );
			break;
		case RC_ALLOC:
			break;
		case RC_END_OF_LIST:
		default:
			// stop rendering on this thread
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}
}
Exemplo n.º 4
0
/*
====================
RB_ExecuteRenderCommands
====================
*/
void RB_ExecuteRenderCommands( const void *data ) {
	int		t1, t2;

	t1 = ri.Milliseconds ();

	while ( 1 ) {
		data = PADP(data, sizeof(void *));

		switch ( *(const int *)data ) {
		case RC_SET_COLOR:
			data = RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic( data );
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer( data );
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers( data );
			break;
		case RC_SCREENSHOT:
			data = RB_TakeScreenshotCmd( data );
			break;
		case RC_VIDEOFRAME:
			data = RB_TakeVideoFrameCmd( data );
			break;
		case RC_COLORMASK:
			data = RB_ColorMask(data);
			break;
		case RC_CLEARDEPTH:
			data = RB_ClearDepth(data);
			break;
		case RC_CAPSHADOWMAP:
			data = RB_CapShadowMap(data);
			break;
		case RC_POSTPROCESS:
			data = RB_PostProcess(data);
			break;
		case RC_EXPORT_CUBEMAPS:
			data = RB_ExportCubemaps(data);
			break;
		case RC_END_OF_LIST:
		default:
			// finish any 2D drawing if needed
			if(tess.numIndexes)
				RB_EndSurface();

			// stop rendering
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}
Exemplo n.º 5
0
	/*
	====================
	RB_ExecuteRenderCommands

	This function will be called synchronously if running without
	smp extensions, or asynchronously by another thread.
	====================
	*/
	void RB_ExecuteRenderCommands( const void *data )
	{
		int t1, t2;

		GLimp_LogComment( "--- RB_ExecuteRenderCommands ---\n" );

		t1 = ri.Milliseconds();

		if ( !r_smp->integer || data == backEndData[ 0 ]->commands.cmds )
		{
			backEnd.smpFrame = 0;
		}
		else
		{
			backEnd.smpFrame = 1;
		}

		while ( 1 )
		{
			switch ( * ( const int * ) data )
			{
				case RC_SET_COLOR:
					data = RB_SetColor( data );
					break;

				case RC_STRETCH_PIC:
					data = RB_StretchPic( data );
					break;

				case RC_DRAW_VIEW:
					data = RB_DrawView( data );
					break;

				case RC_DRAW_BUFFER:
					data = RB_DrawBuffer( data );
					break;

				case RC_SWAP_BUFFERS:
					data = RB_SwapBuffers( data );
					break;

				case RC_SCREENSHOT:
					data = RB_TakeScreenshotCmd( data );
					break;

				case RC_VIDEOFRAME:
					data = RB_TakeVideoFrameCmd( data );
					break;

				case RC_END_OF_LIST:
				default:
					// stop rendering on this thread
					t2 = ri.Milliseconds();
					backEnd.pc.msec = t2 - t1;
					return;
			}
		}
	}
Exemplo n.º 6
0
/**
 * @brief RB_ExecuteRenderCommands
 * @param[in] data
 */
void RB_ExecuteRenderCommands(const void *data)
{
	int t1, t2;

	t1 = ri.Milliseconds();

	while (1)
	{
		switch (*( const int * ) data)
		{
		case RC_SET_COLOR:
			data = RB_SetColor(data);
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic(data);
			break;
		case RC_2DPOLYS:
			data = RB_Draw2dPolys(data);
			break;
		case RC_ROTATED_PIC:
			data = RB_RotatedPic(data);
			break;
		case RC_STRETCH_PIC_GRADIENT:
			data = RB_StretchPicGradient(data);
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs(data);
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer(data);
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers(data);
			break;
		case RC_SCREENSHOT:
			data = RB_TakeScreenshotCmd(data);
			break;
		case RC_VIDEOFRAME:
			data = RB_TakeVideoFrameCmd(data);
			break;
		case RC_RENDERTOTEXTURE:
			data = RB_RenderToTexture(data);
			break;
		case RC_FINISH:
			data = RB_Finish(data);
			break;
		case RC_END_OF_LIST:
		default:
			// stop rendering on this thread
			t2              = ri.Milliseconds();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}
}
Exemplo n.º 7
0
/*
====================
RB_ExecuteRenderCommands

This function will be called syncronously if running without
smp extensions, or asyncronously by another thread.
====================
*/
void RB_ExecuteRenderCommands( const void *data ) {
	int		t1, t2;

	t1 = ri.Milliseconds ();

	if ( !r_smp->integer || data == backEndData[0]->commands.cmds ) {
		backEnd.smpFrame = 0;
	} else {
		backEnd.smpFrame = 1;
	}

	while ( 1 ) {
		switch ( *(const int *)data ) {
		case RC_SET_COLOR:
			data = RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic( data );
			break;
		case RC_ROTATE_PIC:
			data = RB_RotatePic( data );
			break;
		case RC_ROTATE_PIC2:
			data = RB_RotatePic2( data );
			break;
		case RC_SCISSOR:
			data = RB_Scissor( data );
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer( data );
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers( data );
			break;
		case RC_WORLD_EFFECTS:
			data = RB_WorldEffects( data );
			break;
		case RC_END_OF_LIST:
		default:
			// stop rendering on this thread
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}
Exemplo n.º 8
0
/*
====================
RB_ExecuteRenderCommands
====================
*/
void RB_ExecuteRenderCommands( const void *data ) {
	int		t1, t2;

	t1 = ri.Milliseconds ();

	while ( 1 ) {
		data = PADP(data, sizeof(void *));

		switch ( *(const int *)data ) {
		case RC_SET_COLOR:
			data = RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic( data );
			break;
		case RC_ROTATED_PIC:
			data = RB_RotatedPic( data );
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer( data );
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers( data );
			break;
		case RC_SCREENSHOT:
			data = RB_TakeScreenshotCmd( data );
			break;
		case RC_VIDEOFRAME:
			data = RB_TakeVideoFrameCmd( data );
			break;
		case RC_COLORMASK:
			data = RB_ColorMask(data);
			break;
		case RC_CLEARDEPTH:
			data = RB_ClearDepth(data);
			break;
		case RC_END_OF_LIST:
		default:
			// stop rendering
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}
Exemplo n.º 9
0
/*
====================
RB_ExecuteRenderCommands

This function will be called synchronously if running without
smp extensions, or asynchronously by another thread.
====================
*/
void RB_ExecuteRenderCommands( const void *data ) {
	int		t1, t2;

	t1 = ri.Milliseconds ();

	if ( !r_smp->integer || data == backEndData[0]->commands.cmds ) {
		backEnd.smpFrame = 0;
	} else {
		backEnd.smpFrame = 1;
	}

    assert(0 == backEnd.stencil_level);

	while ( 1 ) {
		switch ( *(const int *)data ) {
		case RC_SET_COLOR:
			data = RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic( data );
			break;
        case RC_STENCIL_SURF:
            data = RB_StencilSurf(data);
            break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer( data );
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers( data );
			break;
		case RC_SCREENSHOT:
			data = RB_TakeScreenshotCmd( data );
			break;

		case RC_END_OF_LIST:
		default:
			// stop rendering on this thread
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}
Exemplo n.º 10
0
static void I_AVDrawVideoStream(void)
{
    SDL_Surface *screen;
    int ws, hs;
    
    dglClearColor(0, 0, 0, 1);
    RB_ClearBuffer(GLCB_COLOR);

    I_AVProcessNextVideoFrame();

    ws = screen_width;
    hs = screen_height;

    RB_SetMaxOrtho(ws, hs);
    RB_DrawScreenTexture(&texture, reqWidth, reqHeight);
    RB_SwapBuffers();
}
Exemplo n.º 11
0
/*
====================
RB_ExecuteRenderCommands

This function will be called syncronously if running without
smp extensions, or asyncronously by another thread.
====================
*/
void RB_ExecuteRenderCommands( const void *data ) {
	int t1, t2;

	t1 = ri.Milliseconds();

	if ( !r_smp->integer || data == backEndData[0]->commands.cmds ) {
		backEnd.smpFrame = 0;
	} else {
		backEnd.smpFrame = 1;
	}

	while ( 1 ) {
		switch ( *(const int *)data ) {
		case RC_SET_COLOR:
			data = RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
			data = RB_StretchPic( data );
			break;
		case RC_STRETCH_PIC_GRADIENT:
			data = RB_StretchPicGradient( data );
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
			data = RB_DrawBuffer( data );
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers( data );
			break;
		case RC_STRETCH_RAW:
			data = RB_StretchRaw( data );
			break;
		case RC_UPLOAD_CINE:
			data = RB_UploadCine( data );
			break;
		case RC_CREATE_IMAGE:
			data = RB_Create_Image( data );
			break;
		case RC_LOAD_TEX:
			data = RB_LoadTex( data );
			break;
		case RC_CLEAN0:
			data = RB_Clean( data, qtrue );
			break;
		case RC_CLEAN1:
			data = RB_Clean( data, qfalse );
			break;
		case RC_INIT:
			SMP_InitGL();
			return;
		case RC_END_OF_LIST:
		default:
			// stop rendering on this thread
			t2 = ri.Milliseconds();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}
Exemplo n.º 12
0
/*
====================
RB_ExecuteRenderCommands

This function will be called synchronously if running without
smp extensions, or asynchronously by another thread.
====================
*/
void RB_ExecuteRenderCommands( const void *data )
{
	int t1, t2;

	t1 = ri.Milliseconds();

	if ( !r_smp->integer || data == backEndData[ 0 ]->commands.cmds )
	{
		backEnd.smpFrame = 0;
	}
	else
	{
		backEnd.smpFrame = 1;
	}

	while ( 1 )
	{
		switch ( * ( const int * ) data )
		{
			case RC_SET_COLOR:
				data = RB_SetColor( data );
				break;

			case RC_STRETCH_PIC:
				data = RB_StretchPic( data );
				break;

			case RC_2DPOLYS:
				data = RB_Draw2dPolys( data );
				break;

			case RC_ROTATED_PIC:
				data = RB_RotatedPic( data );
				break;

			case RC_STRETCH_PIC_GRADIENT:
				data = RB_StretchPicGradient( data );
				break;

			case RC_DRAW_SURFS:
				data = RB_DrawSurfs( data );
				break;

			case RC_RUN_VISTESTS:
				data = RB_RunVisTests( data );
				break;

			case RC_DRAW_BUFFER:
				data = RB_DrawBuffer( data );
				break;

			case RC_SWAP_BUFFERS:
				data = RB_SwapBuffers( data );
				break;

			case RC_VIDEOFRAME:
				data = RB_TakeVideoFrameCmd( data );
				break;

				//bani
			case RC_RENDERTOTEXTURE:
				data = RB_RenderToTexture( data );
				break;

				//bani
			case RC_FINISH:
				data = RB_Finish( data );
				break;

			case RC_END_OF_LIST:
			default:
				// stop rendering on this thread
				t2 = ri.Milliseconds();
				backEnd.pc.msec = t2 - t1;
				return;
		}
	}
}
Exemplo n.º 13
0
/*
====================
RB_ExecuteRenderCommands

This function will be called synchronously if running without
smp extensions, or asynchronously by another thread.
====================
*/
void RB_ExecuteRenderCommands( const void *data ) {
	int		t1, t2;

	t1 = ri.Milliseconds ();

	if ( !r_smp->integer || data == backEndData[0]->commands.cmds ) {
		backEnd.smpFrame = 0;
	} else {
		backEnd.smpFrame = 1;
	}

	while ( 1 ) {
		data = PADP(data, sizeof(void *));

		switch ( *(const int *)data ) {
		case RC_SET_COLOR:
			data = RB_SetColor( data );
			break;
		case RC_STRETCH_PIC:
#ifdef FRAMEBUFFER_AND_GLSL_SUPPORT
			R_FrameBuffer_EndFrame();
#endif
			data = RB_StretchPic( data );
			break;
		case RC_DRAW_SURFS:
			data = RB_DrawSurfs( data );
			break;
		case RC_DRAW_BUFFER:
#ifdef FRAMEBUFFER_AND_GLSL_SUPPORT
			data = useFrameBuffer ? RB_DrawFrameBuffer( data ) : RB_DrawBuffer( data );
#else
			data = RB_DrawBuffer( data );
#endif
			break;
		case RC_SWAP_BUFFERS:
			data = RB_SwapBuffers( data );
			break;
		//these two use a hack to let them copy the framebuffer effects too
		case RC_SCREENSHOT:
#ifdef FRAMEBUFFER_AND_GLSL_SUPPORT
			R_FrameBufferUnBind();
#endif
			data = RB_TakeScreenshotCmd( data );
#ifdef FRAMEBUFFER_AND_GLSL_SUPPORT
			R_FrameBufferBind();
#endif
			break;
		case RC_VIDEOFRAME:
#ifdef FRAMEBUFFER_AND_GLSL_SUPPORT
			R_FrameBufferUnBind();
#endif
			data = RB_TakeVideoFrameCmd( data );
#ifdef FRAMEBUFFER_AND_GLSL_SUPPORT
			R_FrameBufferBind();
#endif
			break;
		case RC_COLORMASK:
			data = RB_ColorMask(data);
			break;
		case RC_CLEARDEPTH:
			data = RB_ClearDepth(data);
			break;
		case RC_END_OF_LIST:
		default:
			// stop rendering on this thread
			t2 = ri.Milliseconds ();
			backEnd.pc.msec = t2 - t1;
			return;
		}
	}

}