Skip to content
Snippets Groups Projects
Commit 602900c2 authored by Ali Can Demiralp's avatar Ali Can Demiralp
Browse files

Merge branch 'develop'

parents b8a3bf28 c0648e13
No related branches found
No related tags found
No related merge requests found
......@@ -12,8 +12,8 @@ namespace DisplayClusterConstants
{
static constexpr int32 ClientConnectTriesAmount = 100; // times
static constexpr float ClientConnectRetryDelay = 1.0f; // sec
static constexpr uint32 BarrierGameStartWaitTimeout = 80000; // ms
static constexpr uint32 BarrierWaitTimeout = 10000; // ms
static constexpr uint32 BarrierGameStartWaitTimeout = 90000; // ms
static constexpr uint32 BarrierWaitTimeout = 30000; // ms
static constexpr int32 SocketBufferSize = INT16_MAX; // bytes
static constexpr int32 MessageBufferSize = INT16_MAX; // bytes
};
......
......@@ -51,9 +51,8 @@ bool FDisplayClusterDeviceMonoscopicOpenGL::Present(int32& InOutSyncInterval)
{
UE_LOG(LogDisplayClusterRender, Verbose, TEXT("FDisplayClusterDeviceQuadBufferStereoOpenGL::Present"));
const int halfSizeX = BackBuffSize.X / 2;
const int dstX1 = 0;
const int dstX2 = halfSizeX;
const int dstX2 = BackBuffSize.X;
// Convert to left bottom origin and flip Y
const int dstY1 = ViewportSize.Y;
......@@ -76,7 +75,7 @@ bool FDisplayClusterDeviceMonoscopicOpenGL::Present(int32& InOutSyncInterval)
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBlitFramebuffer(
0, 0, halfSizeX, BackBuffSize.Y,
0, 0, BackBuffSize.X, BackBuffSize.Y,
dstX1, dstY1, dstX2, dstY2,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
......
......@@ -23,6 +23,11 @@ FDisplayClusterDeviceQuadBufferStereoOpenGL::~FDisplayClusterDeviceQuadBufferSte
{
}
bool FDisplayClusterDeviceQuadBufferStereoOpenGL::ShouldUseSeparateRenderTarget() const
{
return true;
}
void FDisplayClusterDeviceQuadBufferStereoOpenGL::SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy)
{
FScopeLock lock(&InternalsSyncScope);
......@@ -99,11 +104,52 @@ bool FDisplayClusterDeviceQuadBufferStereoOpenGL::Present(int32& InOutSyncInterv
// Linux implementation
//////////////////////////////////////////////////////////////////////////////////////////////
#if PLATFORM_LINUX
//@todo: Implementation for Linux
bool FDisplayClusterDeviceQuadBufferStereoOpenGL::Present(int32& InOutSyncInterval)
{
// Forward to default implementation (should be a black screen)
return FDisplayClusterDeviceBase::Present(InOutSyncInterval);
UE_LOG(LogDisplayClusterRender, Verbose, TEXT("FDisplayClusterDeviceQuadBufferStereoOpenGL::Present"));
const int halfSizeX = BackBuffSize.X / 2;
const int dstX1 = 0;
const int dstX2 = halfSizeX;
// Convert to left bottom origin and flip Y
const int dstY1 = ViewportSize.Y;
const int dstY2 = 0;
FOpenGLViewport* pOglViewport = static_cast<FOpenGLViewport*>(CurrentViewport->GetViewportRHI().GetReference());
check(pOglViewport);
FPlatformOpenGLContext* const pContext = pOglViewport->GetGLContext();
check(pContext);
const FTexture2DRHIRef& renderTargetTexture = CurrentViewport->GetRenderTargetTexture();
check(IsValidRef(renderTargetTexture));
GLuint nativeRenderTargetTexture = *reinterpret_cast<GLuint*>(renderTargetTexture->GetNativeResource());
glFramebufferTexture(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, nativeRenderTargetTexture, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, pContext->ViewportFramebuffer);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glDrawBuffer(GL_BACK_LEFT);
glBlitFramebuffer(
0, 0, halfSizeX, BackBuffSize.Y,
dstX1, dstY1, dstX2, dstY2,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
glDrawBuffer(GL_BACK_RIGHT);
glBlitFramebuffer(
halfSizeX, 0, BackBuffSize.X, BackBuffSize.Y,
dstX1, dstY1, dstX2, dstY2,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
// Perform buffers swap logic
SwapBuffers(pOglViewport, InOutSyncInterval);
REPORT_GL_END_BUFFER_EVENT_FOR_FRAME_DUMP();
return false;
}
#endif
......
......@@ -16,6 +16,7 @@ public:
virtual ~FDisplayClusterDeviceQuadBufferStereoOpenGL();
protected:
virtual bool ShouldUseSeparateRenderTarget() const override;
virtual void SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy);
virtual bool Present(int32& InOutSyncInterval) override;
void SwapBuffers(FOpenGLViewport* pOglViewport, int32& InOutSyncInterval);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment