mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Generate vkGLSL if Vulkan is running otherwise GLSL 4.50
This commit is contained in:
parent
4edf8b1c3b
commit
98a13a2424
4 changed files with 388 additions and 551 deletions
|
@ -845,10 +845,10 @@ idCommonLocal::RenderSplash
|
|||
*/
|
||||
void idCommonLocal::RenderSplash()
|
||||
{
|
||||
const emptyCommand_t* renderCommands = NULL;
|
||||
//const emptyCommand_t* renderCommands = NULL;
|
||||
|
||||
// RB: this is the same as Doom 3 renderSystem->BeginFrame()
|
||||
renderCommands = renderSystem->SwapCommandBuffers_FinishCommandBuffers();
|
||||
//renderCommands = renderSystem->SwapCommandBuffers_FinishCommandBuffers();
|
||||
|
||||
const float sysWidth = renderSystem->GetWidth() * renderSystem->GetPixelAspect();
|
||||
const float sysHeight = renderSystem->GetHeight();
|
||||
|
@ -872,11 +872,11 @@ void idCommonLocal::RenderSplash()
|
|||
renderSystem->SetColor4( 1, 1, 1, 1 );
|
||||
renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, splashScreen );
|
||||
|
||||
//const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
renderSystem->RenderCommandBuffers( renderCommands );
|
||||
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
renderSystem->RenderCommandBuffers( cmd );
|
||||
|
||||
// RB: this is the same as Doom 3 renderSystem->EndFrame()
|
||||
renderSystem->SwapCommandBuffers_FinishRendering( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
//renderSystem->SwapCommandBuffers_FinishRendering( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -95,7 +95,9 @@ enum graphicsDriverType_t
|
|||
GLDRV_OPENGL_ES2,
|
||||
GLDRV_OPENGL_ES3,
|
||||
GLDRV_OPENGL_MESA, // fear this, it is probably the best to disable GPU skinning and run shaders in GLSL ES 1.0
|
||||
GLDRV_OPENGL_MESA_CORE_PROFILE
|
||||
GLDRV_OPENGL_MESA_CORE_PROFILE,
|
||||
|
||||
GLDRV_VULKAN
|
||||
};
|
||||
|
||||
enum antiAliasingMode_t
|
||||
|
|
|
@ -1501,6 +1501,8 @@ void idRenderBackend::GL_StartFrame()
|
|||
stagingManager.Flush();
|
||||
|
||||
//TODO renderProgManager.StartFrame();
|
||||
//vkResetDescriptorPool( vkcontext.device, descriptorPools[ currentData ], 0 );
|
||||
|
||||
|
||||
VkCommandBufferBeginInfo commandBufferBeginInfo = {};
|
||||
commandBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||
|
@ -1571,6 +1573,46 @@ void idRenderBackend::GL_EndFrame()
|
|||
ID_VK_CHECK( vkQueueSubmit( vkcontext.graphicsQueue, 1, &submitInfo, vkcontext.commandBufferFences[ vkcontext.currentFrameData ] ) );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
GL_BlockingSwapBuffers
|
||||
|
||||
We want to exit this with the GPU idle, right at vsync
|
||||
=============
|
||||
*/
|
||||
void idRenderBackend::GL_BlockingSwapBuffers()
|
||||
{
|
||||
RENDERLOG_PRINTF( "***************** BlockingSwapBuffers *****************\n\n\n" );
|
||||
|
||||
if( vkcontext.commandBufferRecorded[ vkcontext.currentFrameData ] == false )
|
||||
{
|
||||
// RB: no need to present anything if no command buffers where recorded in this frame
|
||||
return;
|
||||
}
|
||||
|
||||
ID_VK_CHECK( vkWaitForFences( vkcontext.device, 1, &vkcontext.commandBufferFences[ vkcontext.currentFrameData ], VK_TRUE, UINT64_MAX ) );
|
||||
|
||||
ID_VK_CHECK( vkResetFences( vkcontext.device, 1, &vkcontext.commandBufferFences[ vkcontext.currentFrameData ] ) );
|
||||
vkcontext.commandBufferRecorded[ vkcontext.currentFrameData ] = false;
|
||||
|
||||
VkSemaphore* finished = &vkcontext.renderCompleteSemaphores[ vkcontext.currentFrameData ];
|
||||
|
||||
VkPresentInfoKHR presentInfo = {};
|
||||
presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
|
||||
presentInfo.waitSemaphoreCount = 1;
|
||||
presentInfo.pWaitSemaphores = finished;
|
||||
presentInfo.swapchainCount = 1;
|
||||
presentInfo.pSwapchains = &vkcontext.swapchain;
|
||||
presentInfo.pImageIndices = &vkcontext.currentSwapIndex;
|
||||
|
||||
ID_VK_CHECK( vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo ) );
|
||||
|
||||
// RB: at this time the image is presented on the screen
|
||||
|
||||
vkcontext.counter++;
|
||||
vkcontext.currentFrameData = vkcontext.counter % NUM_FRAME_DATA;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
GL_SetDefaultState
|
||||
|
@ -2012,45 +2054,7 @@ void idRenderBackend::SetBuffer( const void* data )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
GL_BlockingSwapBuffers
|
||||
|
||||
We want to exit this with the GPU idle, right at vsync
|
||||
=============
|
||||
*/
|
||||
void idRenderBackend::GL_BlockingSwapBuffers()
|
||||
{
|
||||
RENDERLOG_PRINTF( "***************** BlockingSwapBuffers *****************\n\n\n" );
|
||||
|
||||
if( vkcontext.commandBufferRecorded[ vkcontext.currentFrameData ] == false )
|
||||
{
|
||||
// RB: no need to present anything if no command buffers where recorded in this frame
|
||||
return;
|
||||
}
|
||||
|
||||
ID_VK_CHECK( vkWaitForFences( vkcontext.device, 1, &vkcontext.commandBufferFences[ vkcontext.currentFrameData ], VK_TRUE, UINT64_MAX ) );
|
||||
|
||||
ID_VK_CHECK( vkResetFences( vkcontext.device, 1, &vkcontext.commandBufferFences[ vkcontext.currentFrameData ] ) );
|
||||
vkcontext.commandBufferRecorded[ vkcontext.currentFrameData ] = false;
|
||||
|
||||
VkSemaphore* finished = &vkcontext.renderCompleteSemaphores[ vkcontext.currentFrameData ];
|
||||
|
||||
VkPresentInfoKHR presentInfo = {};
|
||||
presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
|
||||
presentInfo.waitSemaphoreCount = 1;
|
||||
presentInfo.pWaitSemaphores = finished;
|
||||
presentInfo.swapchainCount = 1;
|
||||
presentInfo.pSwapchains = &vkcontext.swapchain;
|
||||
presentInfo.pImageIndices = &vkcontext.currentSwapIndex;
|
||||
|
||||
ID_VK_CHECK( vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo ) );
|
||||
|
||||
// RB: at this time the image is presented on the screen
|
||||
|
||||
vkcontext.counter++;
|
||||
vkcontext.currentFrameData = vkcontext.counter % NUM_FRAME_DATA;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue