Fixed remote security camera rendering causing a crash

This commit is contained in:
Simon 2020-12-16 23:03:00 +00:00
parent 7fead4caeb
commit 01dfd9d6dc
3 changed files with 30 additions and 12 deletions

View file

@ -1190,15 +1190,11 @@ bool idRenderSystemLocal::UploadImage( const char *imageName, const byte *data,
void idRenderSystemLocal::DirectFrameBufferStart()
{
emptyCommand_t *cmd;
cmd = (emptyCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
cmd->commandId = RC_DIRECT_BUFFER_START;
R_DirectFrameBufferStart();
}
void idRenderSystemLocal::DirectFrameBufferEnd()
{
emptyCommand_t *cmd;
cmd = (emptyCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
cmd->commandId = RC_DIRECT_BUFFER_END;
R_DirectFrameBufferEnd();
}

View file

@ -1478,6 +1478,9 @@ void *R_FrameAlloc( int bytes );
void *R_ClearedFrameAlloc( int bytes );
void R_FrameFree( void *data );
void R_DirectFrameBufferStart();
void R_DirectFrameBufferEnd();
void *R_StaticAlloc( int bytes ); // just malloc with error checking
void *R_ClearedStaticAlloc( int bytes ); // with memset
void R_StaticFree( void *data );

View file

@ -278,6 +278,21 @@ static viewDef_t *R_XrayViewBySurface( drawSurf_t *drawSurf ) {
return parms;
}
void R_DirectFrameBufferStart()
{
emptyCommand_t *cmd;
cmd = (emptyCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
cmd->commandId = RC_DIRECT_BUFFER_START;
}
void R_DirectFrameBufferEnd()
{
emptyCommand_t *cmd;
cmd = (emptyCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
cmd->commandId = RC_DIRECT_BUFFER_END;
}
/*
===============
R_RemoteRender
@ -324,7 +339,9 @@ static void R_RemoteRender( drawSurf_t *surf, textureStage_t *stage ) {
parms->superView = tr.viewDef;
parms->subviewSurface = surf;
R_FrameBufferStart();
parms->renderView.forceMono = true;
R_DirectFrameBufferStart();
// generate render commands for it
R_RenderView(parms);
@ -338,7 +355,7 @@ static void R_RemoteRender( drawSurf_t *surf, textureStage_t *stage ) {
tr.CaptureRenderToImage( stage->image->imgName );
tr.UnCrop();
R_FrameBufferEnd();
R_DirectFrameBufferEnd();
}
/*
@ -380,7 +397,7 @@ void R_MirrorRender( drawSurf_t *surf, textureStage_t *stage, idScreenRect sciss
// triangle culling order changes with mirroring
parms->isMirror = ( ( (int)parms->isMirror ^ (int)tr.viewDef->isMirror ) != 0 );
R_FrameBufferStart();
R_DirectFrameBufferStart();
// generate render commands for it
R_RenderView( parms );
@ -392,7 +409,7 @@ void R_MirrorRender( drawSurf_t *surf, textureStage_t *stage, idScreenRect sciss
tr.CaptureRenderToImage( stage->image->imgName );
tr.UnCrop();
R_FrameBufferEnd();
R_DirectFrameBufferEnd();
}
/*
@ -434,7 +451,9 @@ void R_XrayRender( drawSurf_t *surf, textureStage_t *stage, idScreenRect scissor
// triangle culling order changes with mirroring
parms->isMirror = ( ( (int)parms->isMirror ^ (int)tr.viewDef->isMirror ) != 0 );
R_FrameBufferStart();
parms->renderView.forceMono = true;
R_DirectFrameBufferStart();
// generate render commands for it
R_RenderView( parms );
@ -446,7 +465,7 @@ void R_XrayRender( drawSurf_t *surf, textureStage_t *stage, idScreenRect scissor
tr.CaptureRenderToImage( stage->image->imgName );
tr.UnCrop();
R_FrameBufferEnd();
R_DirectFrameBufferEnd();
}
/*