work on android port
This commit is contained in:
@@ -46,9 +46,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
VkSurfaceKHR m_hSurface;
|
||||
SDL_Window *m_pWindow;
|
||||
IImage *m_pOutputImage;
|
||||
VkSurfaceKHR m_hSurface = NULL;
|
||||
SDL_Window *m_pWindow = NULL;
|
||||
IImage *m_pOutputImage = NULL;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,24 @@ void CVkShader::DisablePixelShader( bool bDisable )
|
||||
{
|
||||
|
||||
}
|
||||
void CVkShader::SetBlendingMode( int iImageIndex,
|
||||
EBlendingFactor eSrcColor,
|
||||
EBlendingFactor eDstColor,
|
||||
EBlendingOp eColorOp,
|
||||
EBlendingFactor eSrcAlpha,
|
||||
EBlendingFactor eDstAlpha,
|
||||
EBlendingOp eAlphaOp
|
||||
)
|
||||
{
|
||||
m_formats[iImageIndex].eSrcColor = eSrcColor;
|
||||
m_formats[iImageIndex].eDstColor = eDstColor;
|
||||
m_formats[iImageIndex].eColorOp = eColorOp;
|
||||
|
||||
m_formats[iImageIndex].eSrcAlpha = eSrcAlpha;
|
||||
m_formats[iImageIndex].eDstAlpha = eDstAlpha;
|
||||
m_formats[iImageIndex].eAlphaOp = eAlphaOp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CVkShader::Build()
|
||||
|
||||
@@ -276,6 +276,12 @@ struct VkOutputImageConfig_t
|
||||
{
|
||||
VkFormat m_eFormat;
|
||||
bool m_bIsBlendingEnabled;
|
||||
EBlendingFactor eSrcColor;
|
||||
EBlendingFactor eDstColor;
|
||||
EBlendingOp eColorOp;
|
||||
EBlendingFactor eSrcAlpha;
|
||||
EBlendingFactor eDstAlpha;
|
||||
EBlendingOp eAlphaOp;
|
||||
};
|
||||
|
||||
class CVkShader : public IShader
|
||||
@@ -289,6 +295,15 @@ public:
|
||||
virtual void SetDepthImage( EImageFormat eFormat ) override;
|
||||
virtual void SetMultisampling( EMultisampleType eFormat ) override;
|
||||
virtual void DisablePixelShader( bool bDisable ) override;
|
||||
virtual void SetBlendingMode( int iImageIndex,
|
||||
EBlendingFactor eSrcColor,
|
||||
EBlendingFactor eDstColor,
|
||||
EBlendingOp eColorOp,
|
||||
EBlendingFactor eSrcAlpha,
|
||||
EBlendingFactor eDstAlpha,
|
||||
EBlendingOp eAlphaOp
|
||||
) override;
|
||||
|
||||
virtual void Build() override;
|
||||
|
||||
VkPipeline m_hPipeline = NULL;
|
||||
|
||||
Reference in New Issue
Block a user