work on android port

This commit is contained in:
2026-06-16 04:21:59 +03:00
parent 900b12a6a6
commit 52aa5803af
29 changed files with 499 additions and 272 deletions

View File

@@ -750,7 +750,6 @@ IImage *CVkRenderContext::CreateImageFromVkImage( void *pVkImage, uint32_t x, ui
}
VkPipelineLayout g_pLibraryEmptyLayout;
static IVkCommandBuffer *s_pPresentCommandBuffer;
void CVkRenderContext::Init()
{
@@ -984,13 +983,12 @@ void CVkRenderContext::Frame( float fDeltaTime )
if (m_pXRManager)
m_pXRManager->PreRender();
IRenderCommandList *pList = CreateCommandList();
pList->StartRecording();
s_pPresentCommandBuffer = m_pCommandBufferManager->CreateCommandBuffer();
s_pPresentCommandBuffer->Reset();
double a = Plat_GetTime();
i = 0;
CVkEmptyCommand *pEmptyCommand = CREATE_COMMAND(m_pCommandBufferManager, Empty);
for ( auto &s: m_renderWindows )
{
@@ -998,30 +996,24 @@ void CVkRenderContext::Frame( float fDeltaTime )
CVkBlitCommand *pBlitCommand = NULL;
if (s.m_pWindow->GetOutputImage())
{
pBlitCommand = CREATE_COMMAND(m_pCommandBufferManager, Blit);
pBlitCommand->AddDependency(s.m_pWindow->GetOutputImage(), DEPENDENCY_MODE_BLIT_IMAGE_SOURCE);
pBlitCommand->AddDependency((IRenderingObject*)s.m_images[uSwapchainImageIndexes[i]], DEPENDENCY_MODE_BLIT_IMAGE_DESTINATION);
pBlitCommand->stInputImage.m_eObjectType = FRAME_OBJECT_TYPE_SINGLE;
pBlitCommand->stInputImage.m_pSingle = s.m_pWindow->GetOutputImage();
pBlitCommand->stOutputImage.m_eObjectType = FRAME_OBJECT_TYPE_SINGLE;
pBlitCommand->stOutputImage.m_pSingle = (IRenderingObject*)s.m_images[uSwapchainImageIndexes[i]];
pBlitCommand->iSrcMax[0] = s.m_pWindow->GetOutputImage()->GetImageWidth();
pBlitCommand->iSrcMax[1] = s.m_pWindow->GetOutputImage()->GetImageHeight();
pBlitCommand->iSrcMax[2] = 1;
pBlitCommand->iDstMax[0] = s.m_pWindow->GetRenderWidth();
pBlitCommand->iDstMax[1] = s.m_pWindow->GetRenderHeight();
pBlitCommand->iDstMax[2] = 1;
pEmptyCommand->AddDependency((IRenderingObject*)s.m_images[uSwapchainImageIndexes[i]], DEPENDENCY_MODE_IMAGE_PRESENT);
ImageSector_t src = {};
src.m_iWidth = s.m_pWindow->GetOutputImage()->GetImageWidth();
src.m_iHeight = s.m_pWindow->GetOutputImage()->GetImageHeight();
src.m_iX = 0;
src.m_iY = 0;
ImageSector_t dst = {};
dst.m_iWidth = s.m_pWindow->GetRenderWidth();
dst.m_iHeight = s.m_pWindow->GetRenderHeight();
dst.m_iX = 0;
dst.m_iY = 0;
pList->BlitImageToImage(s.m_pWindow->GetOutputImage(), src, s.m_images[uSwapchainImageIndexes[i]], dst);
}
if (pBlitCommand != NULL)
s_pPresentCommandBuffer->AddCommand(pBlitCommand);
i++;
}
s_pPresentCommandBuffer->AddCommand(pEmptyCommand);
s_pPresentCommandBuffer->Render();
s_pPresentCommandBuffer->Submit(0);
pList->EndRecording();
SubmitCommandList(pList);
DestroyCommandList(pList);
if (m_pXRManager)
m_pXRManager->CopySwapchain();
@@ -1066,13 +1058,22 @@ void CVkRenderContext::Frame( float fDeltaTime )
{
delete a;
}
for (auto &a: m_scheduledRemovalImages)
{
delete a;
}
for (auto &a: m_scheduledRemovalTextureArrays)
{
delete a;
}
for (auto &a: m_scheduledRemovalLists)
{
delete a;
}
m_scheduledRemovalLists = {};
m_scheduledRemovalImages = {};
m_scheduledRemovalTextureArrays = {};
m_scheduledRemovalBuffers = {};
m_pCommandBufferManager->FreeCommandBufferWithCommands(s_pPresentCommandBuffer);
}