fix presenter bug

caused by forget to update frame index
add some comments on submission and presentation loop
disable GPCS4_NO_GRAPHICS again
This commit is contained in:
Asuka 2022-04-05 07:54:28 +08:00
parent d23511aad2
commit 863326b5cd
7 changed files with 34 additions and 7 deletions

View file

@ -4,6 +4,6 @@
#include "GPCS4Types.h"
#include "GPCS4Log.h"
#include "GPCS4Decoration.h"
#include "IntelliSenseClang.h"
#include "IntellisenseClang.h"
#include "UtilMath.h"

View file

@ -24,5 +24,5 @@
// Graphics switch
// Define this will turn off graphics output,
// useful when developing non-graphics parts of GPCS4
#define GPCS4_NO_GRAPHICS
// #define GPCS4_NO_GRAPHICS

View file

@ -625,7 +625,7 @@ bool DataFormat::getRenderTargetChannelOrder(RenderTargetChannelOrder* outOrder)
}
goto LABEL_42;
}
v11 = 288231505728184512LL;
v11 = 0x4000107000120C0LL;
v12 = v5 == 4 && v6 == 5;
v13 = v12 && v8 == 6;
if (_bittest64(&v11, v3))

View file

@ -173,6 +173,9 @@ namespace sce
LOG_ASSERT(count == 1, "Currently only support 1 cmdbuff at one call.");
// track currently display buffer
// so that we can find it during command buffer recording
// and use it as render target.
trackSwapImage(displayBufferIndex);
SceGpuCommand cmd = {};
@ -182,6 +185,7 @@ namespace sce
submitPresent(cmdList, displayBufferIndex);
// clear resource tracker every frame
resetResourceTracker();
return SCE_OK;
@ -222,6 +226,10 @@ namespace sce
// Currently I didn't find a very good place, so I place it here.
glfwPollEvents();
// TODO:
// Execute the Gnm::DrawCommandBuffer::InitializeDefaultHardwareState command.
return SCE_OK;
}

View file

@ -64,7 +64,13 @@ namespace sce
info.pSwapchains = &m_swapchain;
info.pImageIndices = &m_imageIndex;
info.pResults = nullptr;
return vkQueuePresentKHR(m_device.queue, &info);
VkResult status = vkQueuePresentKHR(m_device.queue, &info);
m_frameIndex += 1;
m_frameIndex %= m_semaphores.size();
return status;
}
VkResult ScePresenter::recreateSwapChain(const PresenterDesc& desc)

View file

@ -18,6 +18,8 @@ namespace sce::vlt
{
auto& cmdList = submission.cmdList;
cmdList->submit(submission.waitSync, submission.wakeSync);
// simulate async
m_submitQueue.push(std::move(cmdList));
}
@ -28,10 +30,21 @@ namespace sce::vlt
auto& presenter = presentInfo.presenter;
presenter->presentImage();
// simulate async
auto cmdList = m_submitQueue.front();
m_submitQueue.pop();
// TODO:
// Calling synchronize will block the CPU waiting for the submission done on GPU,
// thus will block the submit thread, slow down the submit speed and drop FPS.
// DXVK's solution is to use another thread dedicated for cmdlist submission
// thus overcome the performance problem,
// see https://github.com/doitsujin/dxvk/blob/master/src/dxvk/dxvk_queue.cpp
//
// This can be easily implemented, but for now, our bottleneck is not here obviously.
// So I keep it single threaded to make debugging easier.
// Wait for command buffer submit finish.
cmdList->synchronize();

View file

@ -47,9 +47,9 @@ namespace sce
/**
* \brief Global GPU mode.
*
* Any calls from HLE or emulator to
* Equalrant/implementation of
* Gnm::GpuMode getGpuMode(void);
* should be replaced by this mode.
*
*/
Gnm::GpuMode mode();