#include <dali/internal/graphics/gles-impl/egl-graphics-controller.h>
// INTERNAL INCLUDES
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
}
void EglGraphicsController::Initialize(Integration::GlSyncAbstraction& glSyncAbstraction,
- Integration::GlContextHelperAbstraction& glContextHelperAbstraction)
+ Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
+ Internal::Adaptor::GraphicsInterface& graphicsInterface)
{
DALI_LOG_RELEASE_INFO("Initializing New Graphics Controller #2\n");
mGlSyncAbstraction = &glSyncAbstraction;
mGlContextHelperAbstraction = &glContextHelperAbstraction;
+ mGraphics = &graphicsInterface;
}
void EglGraphicsController::SubmitCommandBuffers(const SubmitInfo& submitInfo)
}
}
+void EglGraphicsController::PresentRenderTarget(RenderTarget* renderTarget)
+{
+ // Use command buffer to execute presentation (we should pool it)
+ CommandBufferCreateInfo info;
+ info.SetLevel(CommandBufferLevel::PRIMARY);
+ info.fixedCapacity = 1; // only one command
+ auto presentCommandBuffer = new GLES::CommandBuffer(info, *this);
+ presentCommandBuffer->PresentRenderTarget(static_cast<GLES::RenderTarget*>(renderTarget));
+ SubmitInfo submitInfo;
+ submitInfo.cmdBuffer = {presentCommandBuffer};
+ submitInfo.flags = 0 | SubmitFlagBits::FLUSH;
+ SubmitCommandBuffers(submitInfo);
+}
+
+void EglGraphicsController::ResolvePresentRenderTarget(GLES::RenderTarget* renderTarget)
+{
+ auto* rt = static_cast<GLES::RenderTarget*>(renderTarget);
+ if(rt->GetCreateInfo().surface)
+ {
+ auto* surfaceInterface = reinterpret_cast<Dali::RenderSurfaceInterface*>(rt->GetCreateInfo().surface);
+ surfaceInterface->MakeContextCurrent();
+ surfaceInterface->PostRender();
+ }
+}
+
Integration::GlAbstraction& EglGraphicsController::GetGlAbstraction()
{
DALI_ASSERT_DEBUG(mGlAbstraction && "Graphics controller not initialized");
ProcessCreateQueue(mCreateFramebufferQueue);
}
-void EglGraphicsController::ProcessCommandBuffer(GLES::CommandBuffer& commandBuffer)
+void EglGraphicsController::ProcessCommandBuffer(const GLES::CommandBuffer& commandBuffer)
{
for(auto& cmd : commandBuffer.GetCommands())
{
mContext->BeginRenderPass(cmd.beginRenderPass);
break;
}
+ case GLES::CommandType::END_RENDERPASS:
+ {
+ mContext->EndRenderPass();
+ break;
+ }
+ case GLES::CommandType::PRESENT_RENDER_TARGET:
+ {
+ ResolvePresentRenderTarget(cmd.presentRenderTarget.targetToPresent);
+
+ // push this command buffer to the discard queue
+ mDiscardCommandBufferQueue.push(const_cast<GLES::CommandBuffer*>(&commandBuffer));
+ break;
+ }
case GLES::CommandType::EXECUTE_COMMAND_BUFFERS:
{
// Process secondary command buffers
// within secondaries.
for(auto& buf : cmd.executeCommandBuffers.buffers)
{
- ProcessCommandBuffer(*static_cast<GLES::CommandBuffer*>(buf));
+ ProcessCommandBuffer(*static_cast<const GLES::CommandBuffer*>(buf));
}
break;
}
Graphics::UniquePtr<Memory> EglGraphicsController::MapBufferRange(const MapBufferInfo& mapInfo)
{
+ mGraphics->ActivateResourceContext();
+
// Mapping buffer requires the object to be created NOW
// Workaround - flush now, otherwise there will be given a staging buffer
// in case when the buffer is not there yet