mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-06-01 17:22:34 +00:00
Optimized perf by fixing several issues with the GPU<->CPU syncing
This commit is contained in:
parent
d4f1d99bd7
commit
62429d8f46
12 changed files with 144 additions and 138 deletions
|
@ -38,11 +38,7 @@ extern DeviceManager* deviceManager;
|
||||||
|
|
||||||
static void R_ListFramebuffers_f( const idCmdArgs& args )
|
static void R_ListFramebuffers_f( const idCmdArgs& args )
|
||||||
{
|
{
|
||||||
if( !glConfig.framebufferObjectAvailable )
|
// TODO
|
||||||
{
|
|
||||||
common->Printf( "GL_EXT_framebuffer_object is not available.\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Framebuffer::Framebuffer( const char* name, int w, int h )
|
Framebuffer::Framebuffer( const char* name, int w, int h )
|
||||||
|
|
|
@ -357,6 +357,7 @@ void idImage::AllocImage()
|
||||||
uint scaledWidth = originalWidth;
|
uint scaledWidth = originalWidth;
|
||||||
uint scaledHeight = originalHeight;
|
uint scaledHeight = originalHeight;
|
||||||
|
|
||||||
|
#if 0
|
||||||
uint maxTextureSize = 0;
|
uint maxTextureSize = 0;
|
||||||
|
|
||||||
if( maxTextureSize > 0 &&
|
if( maxTextureSize > 0 &&
|
||||||
|
@ -375,6 +376,7 @@ void idImage::AllocImage()
|
||||||
scaledHeight = maxTextureSize;
|
scaledHeight = maxTextureSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
auto textureDesc = nvrhi::TextureDesc()
|
auto textureDesc = nvrhi::TextureDesc()
|
||||||
.setDebugName( GetName() )
|
.setDebugName( GetName() )
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
|
|
||||||
int currentImageParm = 0;
|
int currentImageParm = 0;
|
||||||
idArray< idImage*, MAX_IMAGE_PARMS > imageParms;
|
idArray< idImage*, MAX_IMAGE_PARMS > imageParms;
|
||||||
|
idScreenRect scissor; // set by GL_Scissor
|
||||||
//nvrhi::GraphicsPipelineHandle pipeline;
|
//nvrhi::GraphicsPipelineHandle pipeline;
|
||||||
//bool fullscreen = false;
|
//bool fullscreen = false;
|
||||||
};
|
};
|
||||||
|
@ -172,9 +173,6 @@ idRenderBackend::DrawElementsWithCounters
|
||||||
*/
|
*/
|
||||||
void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
||||||
{
|
{
|
||||||
// Only update the constant buffer if it was updated at all.
|
|
||||||
renderProgManager.CommitConstantBuffer( commandList );
|
|
||||||
|
|
||||||
// Get vertex buffer
|
// Get vertex buffer
|
||||||
const vertCacheHandle_t vbHandle = surf->ambientCache;
|
const vertCacheHandle_t vbHandle = surf->ambientCache;
|
||||||
idVertexBuffer* vertexBuffer;
|
idVertexBuffer* vertexBuffer;
|
||||||
|
@ -265,6 +263,9 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
||||||
changeState = true;
|
changeState = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Only update the constant buffer if it was updated at all.
|
||||||
|
renderProgManager.CommitConstantBuffer( commandList );
|
||||||
|
|
||||||
if( changeState )
|
if( changeState )
|
||||||
{
|
{
|
||||||
nvrhi::GraphicsState state;
|
nvrhi::GraphicsState state;
|
||||||
|
@ -285,11 +286,17 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
||||||
( float )currentViewport.y2,
|
( float )currentViewport.y2,
|
||||||
currentViewport.zmin,
|
currentViewport.zmin,
|
||||||
currentViewport.zmax };
|
currentViewport.zmax };
|
||||||
state.viewport.addViewportAndScissorRect( viewport );
|
state.viewport.addViewport( viewport );
|
||||||
|
|
||||||
if( !currentScissor.IsEmpty() )
|
#if 0
|
||||||
|
if( !context.scissor.IsEmpty() )
|
||||||
{
|
{
|
||||||
state.viewport.addScissorRect( nvrhi::Rect( currentScissor.x1, currentScissor.x2, currentScissor.y1, currentScissor.y2 ) );
|
state.viewport.addScissorRect( nvrhi::Rect( context.scissor.x1, context.scissor.x2, context.scissor.y1, context.scissor.y2 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
state.viewport.addScissorRect( nvrhi::Rect( viewport ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
commandList->setGraphicsState( state );
|
commandList->setGraphicsState( state );
|
||||||
|
@ -677,28 +684,6 @@ void idRenderBackend::GL_EndFrame()
|
||||||
commandList->close();
|
commandList->close();
|
||||||
|
|
||||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||||
|
|
||||||
// Make sure that all frames have finished rendering
|
|
||||||
deviceManager->GetDevice()->waitForIdle();
|
|
||||||
|
|
||||||
// Release all in-flight references to the render targets
|
|
||||||
deviceManager->GetDevice()->runGarbageCollection();
|
|
||||||
|
|
||||||
// Present to the swap chain.
|
|
||||||
deviceManager->Present();
|
|
||||||
}
|
|
||||||
|
|
||||||
void idRenderBackend::GL_EndRenderPass()
|
|
||||||
{
|
|
||||||
#if defined( USE_NVRHI )
|
|
||||||
commandList->close();
|
|
||||||
|
|
||||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
|
||||||
|
|
||||||
deviceManager->GetDevice()->runGarbageCollection();
|
|
||||||
|
|
||||||
commandList->open();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -712,6 +697,27 @@ void idRenderBackend::GL_BlockingSwapBuffers()
|
||||||
{
|
{
|
||||||
// Make sure that all frames have finished rendering
|
// Make sure that all frames have finished rendering
|
||||||
deviceManager->GetDevice()->waitForIdle();
|
deviceManager->GetDevice()->waitForIdle();
|
||||||
|
|
||||||
|
// Release all in-flight references to the render targets
|
||||||
|
deviceManager->GetDevice()->runGarbageCollection();
|
||||||
|
|
||||||
|
// Present to the swap chain.
|
||||||
|
deviceManager->Present();
|
||||||
|
|
||||||
|
renderLog.EndFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void idRenderBackend::GL_EndRenderPass()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
commandList->close();
|
||||||
|
|
||||||
|
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||||
|
|
||||||
|
deviceManager->GetDevice()->runGarbageCollection();
|
||||||
|
|
||||||
|
commandList->open();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -773,9 +779,9 @@ idRenderBackend::GL_Scissor
|
||||||
void idRenderBackend::GL_Scissor( int x /* left*/, int y /* bottom */, int w, int h )
|
void idRenderBackend::GL_Scissor( int x /* left*/, int y /* bottom */, int w, int h )
|
||||||
{
|
{
|
||||||
// TODO Check if this is right.
|
// TODO Check if this is right.
|
||||||
//currentScissor.Clear();
|
context.scissor.Clear();
|
||||||
//currentScissor.AddPoint( x, y );
|
context.scissor.AddPoint( x, y );
|
||||||
//currentScissor.AddPoint( x + w, y + h );
|
context.scissor.AddPoint( x + w, y + h );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -921,23 +927,6 @@ void idRenderBackend::CheckCVars()
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if( r_useSeamlessCubeMap.IsModified() )
|
|
||||||
{
|
|
||||||
r_useSeamlessCubeMap.ClearModified();
|
|
||||||
if( glConfig.seamlessCubeMapAvailable )
|
|
||||||
{
|
|
||||||
if( r_useSeamlessCubeMap.GetBool() )
|
|
||||||
{
|
|
||||||
//glEnable( GL_TEXTURE_CUBE_MAP_SEAMLESS );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//glDisable( GL_TEXTURE_CUBE_MAP_SEAMLESS );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// SRS - Enable SDL-driven vync changes without restart for UNIX-like OSs
|
// SRS - Enable SDL-driven vync changes without restart for UNIX-like OSs
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
||||||
extern idCVar r_swapInterval;
|
extern idCVar r_swapInterval;
|
||||||
|
@ -958,6 +947,7 @@ void idRenderBackend::CheckCVars()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// SRS end
|
// SRS end
|
||||||
|
|
||||||
if( r_antiAliasing.IsModified() )
|
if( r_antiAliasing.IsModified() )
|
||||||
{
|
{
|
||||||
switch( r_antiAliasing.GetInteger() )
|
switch( r_antiAliasing.GetInteger() )
|
||||||
|
@ -977,6 +967,7 @@ void idRenderBackend::CheckCVars()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if( r_usePBR.IsModified() ||
|
if( r_usePBR.IsModified() ||
|
||||||
r_useHDR.IsModified() ||
|
r_useHDR.IsModified() ||
|
||||||
r_useHalfLambertLighting.IsModified() ||
|
r_useHalfLambertLighting.IsModified() ||
|
||||||
|
@ -1002,20 +993,7 @@ void idRenderBackend::CheckCVars()
|
||||||
renderProgManager.KillAllShaders();
|
renderProgManager.KillAllShaders();
|
||||||
renderProgManager.LoadAllShaders();
|
renderProgManager.LoadAllShaders();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// RB: turn off shadow mapping for OpenGL drivers that are too slow
|
|
||||||
switch( glConfig.driverType )
|
|
||||||
{
|
|
||||||
case GLDRV_OPENGL_ES2:
|
|
||||||
case GLDRV_OPENGL_ES3:
|
|
||||||
//case GLDRV_OPENGL_MESA:
|
|
||||||
r_useShadowMapping.SetInteger( 0 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// RB end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1324,6 +1302,7 @@ idRenderBackend::idRenderBackend()
|
||||||
memset( &glConfig, 0, sizeof( glConfig ) );
|
memset( &glConfig, 0, sizeof( glConfig ) );
|
||||||
|
|
||||||
//glConfig.gpuSkinningAvailable = true;
|
//glConfig.gpuSkinningAvailable = true;
|
||||||
|
glConfig.timerQueryAvailable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -314,4 +314,6 @@ idRenderProgManager::CommitConstantBuffer
|
||||||
void idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList )
|
void idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList )
|
||||||
{
|
{
|
||||||
commandList->writeBuffer( constantBuffer, uniforms.Ptr(), uniforms.Allocated() );
|
commandList->writeBuffer( constantBuffer, uniforms.Ptr(), uniforms.Allocated() );
|
||||||
|
|
||||||
|
//commandList->setPushConstants( uniforms.Ptr(), uniforms.Allocated() );
|
||||||
}
|
}
|
|
@ -5910,12 +5910,12 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
|
||||||
if( renderSystem->GetStereo3DMode() != STEREO3D_OFF )
|
if( renderSystem->GetStereo3DMode() != STEREO3D_OFF )
|
||||||
{
|
{
|
||||||
StereoRenderExecuteBackEndCommands( cmds );
|
StereoRenderExecuteBackEndCommands( cmds );
|
||||||
renderLog.EndFrame();
|
//renderLog.EndFrame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLog.StartFrame();
|
|
||||||
GL_StartFrame();
|
GL_StartFrame();
|
||||||
|
renderLog.StartFrame( commandList );
|
||||||
|
|
||||||
void* textureId = globalImages->hierarchicalZbufferImage->GetTextureID();
|
void* textureId = globalImages->hierarchicalZbufferImage->GetTextureID();
|
||||||
globalImages->LoadDeferredImages( commandList );
|
globalImages->LoadDeferredImages( commandList );
|
||||||
|
@ -6030,7 +6030,7 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
|
||||||
pc.c_copyFrameBuffer = 0;
|
pc.c_copyFrameBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLog.EndFrame();
|
//renderLog.EndFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -497,6 +497,7 @@ private:
|
||||||
idRenderMatrix shadowV[6]; // shadow depth view matrix
|
idRenderMatrix shadowV[6]; // shadow depth view matrix
|
||||||
idRenderMatrix shadowP[6]; // shadow depth projection matrix
|
idRenderMatrix shadowP[6]; // shadow depth projection matrix
|
||||||
|
|
||||||
|
// TODO remove
|
||||||
float hdrAverageLuminance;
|
float hdrAverageLuminance;
|
||||||
float hdrMaxLuminance;
|
float hdrMaxLuminance;
|
||||||
float hdrTime;
|
float hdrTime;
|
||||||
|
|
|
@ -106,14 +106,20 @@ PC_BeginNamedEvent
|
||||||
FIXME: this is not thread safe on the PC
|
FIXME: this is not thread safe on the PC
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
void PC_BeginNamedEvent( const char* szName, const idVec4& color )
|
void PC_BeginNamedEvent( const char* szName, const idVec4& color, nvrhi::ICommandList* commandList )
|
||||||
{
|
{
|
||||||
if( r_logLevel.GetInteger() <= 0 )
|
if( r_logLevel.GetInteger() <= 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( USE_VULKAN )
|
#if defined( USE_NVRHI )
|
||||||
|
if( commandList )
|
||||||
|
{
|
||||||
|
commandList->beginMarker( szName );
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined( USE_VULKAN )
|
||||||
|
|
||||||
// start an annotated group of calls under the this name
|
// start an annotated group of calls under the this name
|
||||||
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
|
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
|
||||||
|
@ -141,8 +147,6 @@ void PC_BeginNamedEvent( const char* szName, const idVec4& color )
|
||||||
|
|
||||||
qvkCmdDebugMarkerBeginEXT( vkcontext.commandBuffer[ vkcontext.frameParity ], &label );
|
qvkCmdDebugMarkerBeginEXT( vkcontext.commandBuffer[ vkcontext.frameParity ], &label );
|
||||||
}
|
}
|
||||||
#elif defined(USE_NVRHI)
|
|
||||||
// SP: TODO
|
|
||||||
#else
|
#else
|
||||||
// RB: colors are not supported in OpenGL
|
// RB: colors are not supported in OpenGL
|
||||||
|
|
||||||
|
@ -196,14 +200,20 @@ void PC_BeginNamedEvent( const char* szName, const idVec4& color )
|
||||||
PC_EndNamedEvent
|
PC_EndNamedEvent
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
void PC_EndNamedEvent()
|
void PC_EndNamedEvent( nvrhi::ICommandList* commandList )
|
||||||
{
|
{
|
||||||
if( r_logLevel.GetInteger() <= 0 )
|
if( r_logLevel.GetInteger() <= 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( USE_VULKAN )
|
#if defined( USE_NVRHI )
|
||||||
|
if( commandList )
|
||||||
|
{
|
||||||
|
commandList->endMarker();
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined( USE_VULKAN )
|
||||||
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
|
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
|
||||||
if( vkcontext.debugUtilsSupportAvailable )
|
if( vkcontext.debugUtilsSupportAvailable )
|
||||||
{
|
{
|
||||||
|
@ -300,8 +310,6 @@ idRenderLog
|
||||||
idRenderLog renderLog;
|
idRenderLog renderLog;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// RB begin
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
idRenderLog::idRenderLog
|
idRenderLog::idRenderLog
|
||||||
|
@ -309,9 +317,22 @@ idRenderLog::idRenderLog
|
||||||
*/
|
*/
|
||||||
idRenderLog::idRenderLog()
|
idRenderLog::idRenderLog()
|
||||||
{
|
{
|
||||||
|
frameCounter = 0;
|
||||||
|
frameParity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
void idRenderLog::StartFrame( nvrhi::ICommandList* _commandList )
|
||||||
|
{
|
||||||
|
commandList = _commandList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void idRenderLog::EndFrame()
|
||||||
|
{
|
||||||
|
frameCounter++;
|
||||||
|
frameParity = frameCounter % NUM_FRAME_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
|
@ -329,7 +350,11 @@ void idRenderLog::OpenMainBlock( renderLogMainBlock_t block, nvrhi::ICommandList
|
||||||
{
|
{
|
||||||
mainBlock = block;
|
mainBlock = block;
|
||||||
|
|
||||||
#if defined( USE_VULKAN )
|
#if defined( USE_NVRHI )
|
||||||
|
|
||||||
|
// SP: use nvrhi timer queries
|
||||||
|
|
||||||
|
#elif defined( USE_VULKAN )
|
||||||
if( vkcontext.queryIndex[ vkcontext.frameParity ] >= ( NUM_TIMESTAMP_QUERIES - 1 ) )
|
if( vkcontext.queryIndex[ vkcontext.frameParity ] >= ( NUM_TIMESTAMP_QUERIES - 1 ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -341,10 +366,6 @@ void idRenderLog::OpenMainBlock( renderLogMainBlock_t block, nvrhi::ICommandList
|
||||||
uint32 queryIndex = vkcontext.queryAssignedIndex[ vkcontext.frameParity ][ mainBlock * 2 + 0 ] = vkcontext.queryIndex[ vkcontext.frameParity ]++;
|
uint32 queryIndex = vkcontext.queryAssignedIndex[ vkcontext.frameParity ][ mainBlock * 2 + 0 ] = vkcontext.queryIndex[ vkcontext.frameParity ]++;
|
||||||
vkCmdWriteTimestamp( commandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, queryPool, queryIndex );
|
vkCmdWriteTimestamp( commandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, queryPool, queryIndex );
|
||||||
|
|
||||||
#elif defined(USE_NVRHI)
|
|
||||||
|
|
||||||
// SP: use nvrhi timer queries
|
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
// SRS - For OSX use elapsed time query for Apple OpenGL 4.1 using GL_TIME_ELAPSED vs GL_TIMESTAMP (which is not implemented on OSX)
|
// SRS - For OSX use elapsed time query for Apple OpenGL 4.1 using GL_TIME_ELAPSED vs GL_TIMESTAMP (which is not implemented on OSX)
|
||||||
// SRS - OSX AMD drivers have a rendering bug (flashing colours) with an elasped time query when Shadow Mapping is on - turn off query for that case unless r_skipAMDWorkarounds is set
|
// SRS - OSX AMD drivers have a rendering bug (flashing colours) with an elasped time query when Shadow Mapping is on - turn off query for that case unless r_skipAMDWorkarounds is set
|
||||||
|
@ -413,7 +434,6 @@ void idRenderLog::CloseMainBlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
|
@ -422,14 +442,7 @@ idRenderLog::OpenBlock
|
||||||
*/
|
*/
|
||||||
void idRenderLog::OpenBlock( const char* label, const idVec4& color )
|
void idRenderLog::OpenBlock( const char* label, const idVec4& color )
|
||||||
{
|
{
|
||||||
#if defined( USE_NVRHI )
|
PC_BeginNamedEvent( label, color, commandList );
|
||||||
if( commandList && r_logLevel.GetInteger() > 0 )
|
|
||||||
{
|
|
||||||
commandList->beginMarker( label );
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
PC_BeginNamedEvent( label, color );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -439,13 +452,6 @@ idRenderLog::CloseBlock
|
||||||
*/
|
*/
|
||||||
void idRenderLog::CloseBlock()
|
void idRenderLog::CloseBlock()
|
||||||
{
|
{
|
||||||
#if defined( USE_NVRHI )
|
PC_EndNamedEvent( commandList );
|
||||||
if( commandList && r_logLevel.GetInteger() > 0 )
|
|
||||||
{
|
|
||||||
commandList->endMarker();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
PC_EndNamedEvent();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
// RB end
|
// RB end
|
|
@ -89,13 +89,16 @@ private:
|
||||||
|
|
||||||
#if defined( USE_NVRHI )
|
#if defined( USE_NVRHI )
|
||||||
nvrhi::CommandListHandle commandList;
|
nvrhi::CommandListHandle commandList;
|
||||||
|
|
||||||
|
uint64 frameCounter;
|
||||||
|
uint32 frameParity;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
idRenderLog();
|
idRenderLog();
|
||||||
|
|
||||||
void StartFrame() {}
|
void StartFrame( nvrhi::ICommandList* _commandList );
|
||||||
void EndFrame() {}
|
void EndFrame();
|
||||||
void Close() {}
|
void Close() {}
|
||||||
int Active()
|
int Active()
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,13 +31,14 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
|
|
||||||
|
#if !defined( USE_NVRHI )
|
||||||
|
|
||||||
#include "RenderCommon.h"
|
#include "RenderCommon.h"
|
||||||
#include "RenderProgs_embedded.h"
|
#include "RenderProgs_embedded.h"
|
||||||
|
|
||||||
|
|
||||||
idCVar r_skipStripDeadCode( "r_skipStripDeadCode", "0", CVAR_BOOL, "Skip stripping dead code" );
|
idCVar r_skipStripDeadCode( "r_skipStripDeadCode", "0", CVAR_BOOL, "Skip stripping dead code" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct idCGBlock
|
struct idCGBlock
|
||||||
{
|
{
|
||||||
idStr prefix; // tokens that comes before the name
|
idStr prefix; // tokens that comes before the name
|
||||||
|
@ -1680,7 +1681,7 @@ const char* idRenderProgManager::GetGLSLMacroName( shaderFeature_t sf ) const
|
||||||
return GLSLMacroNames[ sf ];
|
return GLSLMacroNames[ sf ];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( USE_NVRHI )
|
|
||||||
/*
|
/*
|
||||||
================================================================================================
|
================================================================================================
|
||||||
idRenderProgManager::FindGLSLProgram
|
idRenderProgManager::FindGLSLProgram
|
||||||
|
|
|
@ -173,16 +173,11 @@ struct backEndCounters_t
|
||||||
struct glconfig_t
|
struct glconfig_t
|
||||||
{
|
{
|
||||||
graphicsVendor_t vendor;
|
graphicsVendor_t vendor;
|
||||||
graphicsDriverType_t driverType;
|
|
||||||
|
|
||||||
const char* renderer_string;
|
const char* renderer_string;
|
||||||
const char* vendor_string;
|
const char* vendor_string;
|
||||||
const char* version_string;
|
const char* version_string;
|
||||||
const char* extensions_string;
|
const char* extensions_string;
|
||||||
const char* wgl_extensions_string;
|
|
||||||
const char* shading_language_string;
|
|
||||||
|
|
||||||
float glVersion; // atof( version_string )
|
|
||||||
|
|
||||||
int maxTextureSize; // queried from GL
|
int maxTextureSize; // queried from GL
|
||||||
int maxTextureCoords;
|
int maxTextureCoords;
|
||||||
|
@ -190,6 +185,36 @@ struct glconfig_t
|
||||||
int uniformBufferOffsetAlignment;
|
int uniformBufferOffsetAlignment;
|
||||||
float maxTextureAnisotropy;
|
float maxTextureAnisotropy;
|
||||||
|
|
||||||
|
bool timerQueryAvailable;
|
||||||
|
bool gpuSkinningAvailable;
|
||||||
|
|
||||||
|
stereo3DMode_t stereo3Dmode;
|
||||||
|
int nativeScreenWidth; // this is the native screen width resolution of the renderer
|
||||||
|
int nativeScreenHeight; // this is the native screen height resolution of the renderer
|
||||||
|
|
||||||
|
int displayFrequency;
|
||||||
|
|
||||||
|
int isFullscreen; // monitor number
|
||||||
|
bool isStereoPixelFormat;
|
||||||
|
bool stereoPixelFormatAvailable;
|
||||||
|
int multisamples;
|
||||||
|
|
||||||
|
// Screen separation for stereoscopic rendering is set based on this.
|
||||||
|
// PC vid code sets this, converting from diagonals / inches / whatever as needed.
|
||||||
|
// If the value can't be determined, set something reasonable, like 50cm.
|
||||||
|
float physicalScreenWidthInCentimeters;
|
||||||
|
|
||||||
|
float pixelAspect;
|
||||||
|
|
||||||
|
#if !defined(USE_NVRHI)
|
||||||
|
|
||||||
|
graphicsDriverType_t driverType;
|
||||||
|
|
||||||
|
const char* wgl_extensions_string;
|
||||||
|
const char* shading_language_string;
|
||||||
|
|
||||||
|
float glVersion; // atof( version_string )
|
||||||
|
|
||||||
int colorBits;
|
int colorBits;
|
||||||
int depthBits;
|
int depthBits;
|
||||||
int stencilBits;
|
int stencilBits;
|
||||||
|
@ -210,12 +235,11 @@ struct glconfig_t
|
||||||
bool twoSidedStencilAvailable;
|
bool twoSidedStencilAvailable;
|
||||||
bool depthBoundsTestAvailable;
|
bool depthBoundsTestAvailable;
|
||||||
bool syncAvailable;
|
bool syncAvailable;
|
||||||
bool timerQueryAvailable;
|
|
||||||
bool occlusionQueryAvailable;
|
bool occlusionQueryAvailable;
|
||||||
bool debugOutputAvailable;
|
bool debugOutputAvailable;
|
||||||
bool swapControlTearAvailable;
|
bool swapControlTearAvailable;
|
||||||
|
|
||||||
// RB begin
|
|
||||||
bool gremedyStringMarkerAvailable;
|
bool gremedyStringMarkerAvailable;
|
||||||
bool khronosDebugAvailable;
|
bool khronosDebugAvailable;
|
||||||
bool vertexHalfFloatAvailable;
|
bool vertexHalfFloatAvailable;
|
||||||
|
@ -226,31 +250,11 @@ struct glconfig_t
|
||||||
// bool framebufferPackedDepthStencilAvailable;
|
// bool framebufferPackedDepthStencilAvailable;
|
||||||
bool framebufferBlitAvailable;
|
bool framebufferBlitAvailable;
|
||||||
|
|
||||||
// only true with uniform buffer support and an OpenGL driver that supports GLSL >= 1.50
|
#if !defined(USE_VULKAN)
|
||||||
bool gpuSkinningAvailable;
|
|
||||||
// RB end
|
|
||||||
|
|
||||||
stereo3DMode_t stereo3Dmode;
|
|
||||||
int nativeScreenWidth; // this is the native screen width resolution of the renderer
|
|
||||||
int nativeScreenHeight; // this is the native screen height resolution of the renderer
|
|
||||||
|
|
||||||
int displayFrequency;
|
|
||||||
|
|
||||||
int isFullscreen; // monitor number
|
|
||||||
bool isStereoPixelFormat;
|
|
||||||
bool stereoPixelFormatAvailable;
|
|
||||||
int multisamples;
|
|
||||||
|
|
||||||
// Screen separation for stereoscopic rendering is set based on this.
|
|
||||||
// PC vid code sets this, converting from diagonals / inches / whatever as needed.
|
|
||||||
// If the value can't be determined, set something reasonable, like 50cm.
|
|
||||||
float physicalScreenWidthInCentimeters;
|
|
||||||
|
|
||||||
float pixelAspect;
|
|
||||||
|
|
||||||
#if !defined(USE_NVRHI) && !defined(USE_VULKAN)
|
|
||||||
GLuint global_vao;
|
GLuint global_vao;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1510,6 +1510,7 @@ void GfxInfo_f( const idCmdArgs& args )
|
||||||
common->Printf( "GL_RENDERER: %s\n", glConfig.renderer_string );
|
common->Printf( "GL_RENDERER: %s\n", glConfig.renderer_string );
|
||||||
common->Printf( "GL_VERSION: %s\n", glConfig.version_string );
|
common->Printf( "GL_VERSION: %s\n", glConfig.version_string );
|
||||||
common->Printf( "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
common->Printf( "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
||||||
|
#if !defined( USE_NVRHI )
|
||||||
if( glConfig.wgl_extensions_string )
|
if( glConfig.wgl_extensions_string )
|
||||||
{
|
{
|
||||||
common->Printf( "WGL_EXTENSIONS: %s\n", glConfig.wgl_extensions_string );
|
common->Printf( "WGL_EXTENSIONS: %s\n", glConfig.wgl_extensions_string );
|
||||||
|
@ -1517,12 +1518,13 @@ void GfxInfo_f( const idCmdArgs& args )
|
||||||
common->Printf( "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
|
common->Printf( "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
|
||||||
common->Printf( "GL_MAX_TEXTURE_COORDS_ARB: %d\n", glConfig.maxTextureCoords );
|
common->Printf( "GL_MAX_TEXTURE_COORDS_ARB: %d\n", glConfig.maxTextureCoords );
|
||||||
common->Printf( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB: %d\n", glConfig.maxTextureImageUnits );
|
common->Printf( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB: %d\n", glConfig.maxTextureImageUnits );
|
||||||
|
#endif
|
||||||
|
|
||||||
// print all the display adapters, monitors, and video modes
|
// print all the display adapters, monitors, and video modes
|
||||||
//void DumpAllDisplayDevices();
|
//void DumpAllDisplayDevices();
|
||||||
//DumpAllDisplayDevices();
|
//DumpAllDisplayDevices();
|
||||||
|
|
||||||
common->Printf( "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );
|
//common->Printf( "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );
|
||||||
common->Printf( "MODE: %d, %d x %d %s hz:", r_vidMode.GetInteger(), renderSystem->GetWidth(), renderSystem->GetHeight(), fsstrings[r_fullscreen.GetBool()] );
|
common->Printf( "MODE: %d, %d x %d %s hz:", r_vidMode.GetInteger(), renderSystem->GetWidth(), renderSystem->GetHeight(), fsstrings[r_fullscreen.GetBool()] );
|
||||||
if( glConfig.displayFrequency )
|
if( glConfig.displayFrequency )
|
||||||
{
|
{
|
||||||
|
|
|
@ -600,7 +600,17 @@ void DeviceManager_DX12::Present()
|
||||||
auto bufferIndex = m_SwapChain->GetCurrentBackBufferIndex();
|
auto bufferIndex = m_SwapChain->GetCurrentBackBufferIndex();
|
||||||
|
|
||||||
UINT presentFlags = 0;
|
UINT presentFlags = 0;
|
||||||
if( !deviceParms.vsyncEnabled && !glConfig.isFullscreen && glConfig.swapControlTearAvailable )
|
|
||||||
|
if( r_swapInterval.GetInteger() == 1 )
|
||||||
|
{
|
||||||
|
SetVsyncEnabled( false );
|
||||||
|
}
|
||||||
|
else if( r_swapInterval.GetInteger() == 2 )
|
||||||
|
{
|
||||||
|
SetVsyncEnabled( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !deviceParms.vsyncEnabled && !glConfig.isFullscreen && m_TearingSupported && r_swapInterval.GetInteger() == 0 )
|
||||||
{
|
{
|
||||||
presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
|
presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue