const bool scissorEnabled = (mScissorStack.size() > 0u) || mHasLayerScissor;
// Enable the scissor test based on the above calculation
- context.SetScissorTest(scissorEnabled);
+ if(scissorEnabled)
+ {
+ mGraphicsCommandBuffer->SetScissorTestEnable( scissorEnabled );
+ }
// If scissor is enabled, we use the calculated screen-space coordinates (now in the stack).
if(scissorEnabled)
{
useScissorBox.y = (instruction.mFrameBuffer->GetHeight() - useScissorBox.height) - useScissorBox.y;
}
- context.Scissor(useScissorBox.x, useScissorBox.y, useScissorBox.width, useScissorBox.height);
+ Graphics::Rect2D scissorBox = {
+ useScissorBox.x, useScissorBox.y,
+ uint32_t(useScissorBox.width), uint32_t(useScissorBox.height)
+ };
+ mGraphicsCommandBuffer->SetScissor( scissorBox );
}
}
}
mHasLayerScissor = true;
}
- // Submit scissor/viewport
- //Graphics::SubmitInfo submitInfo{{}, 0 | Graphics::SubmitFlagBits::FLUSH};
- //submitInfo.cmdBuffer.push_back(mGraphicsCommandBuffer.get());
- //mGraphicsController.SubmitCommandBuffers(submitInfo);
-
mGraphicsRenderItemCommandBuffers.clear();
// Loop through all RenderList in the RenderList, set up any prerequisites to render them, then perform the render.
for(uint32_t index = 0u; index < count; ++index)
// The Renderer API will be used if specified. If AUTO, the Actors automatic clipping feature will be used.
SetupClipping(item, context, usedStencilBuffer, lastClippingDepth, lastClippingId, stencilBufferAvailable, instruction);
-
-
if(DALI_LIKELY(item.mRenderer))
{
// Set up the depth buffer based on per-renderer flags if depth buffer is available
uniformBufferManager.reset(new Render::UniformBufferManager(&graphicsController));
- // initialize main command buffer
- auto info = Graphics::CommandBufferCreateInfo().SetLevel(Graphics::CommandBufferLevel::PRIMARY);
- mainCommandBuffer = graphicsController.CreateCommandBuffer(info, nullptr);
}
~Impl()
std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
Vector<Graphics::Texture*> boundTextures; ///< The textures bound for rendering
- Vector<Graphics::Texture*> textureDependencyList; ///< The dependency list of binded textures
-
- Graphics::UniquePtr<Graphics::CommandBuffer> mainCommandBuffer; ///< Main command buffer
-
- Graphics::UniquePtr<Graphics::RenderPass> mainRenderPass; ///< Main renderpass
+ Vector<Graphics::Texture*> textureDependencyList; ///< The dependency list of bound textures
};
RenderManager* RenderManager::New(Graphics::Controller& graphicsController,
const bool haveInstructions = count > 0u;
- // Reset main command buffer
- mImpl->mainCommandBuffer->Reset();
-
DALI_LOG_INFO(gLogFilter, Debug::General, "Render: haveInstructions(%s) || mImpl->lastFrameWasRendered(%s) || forceClear(%s)\n", haveInstructions ? "true" : "false", mImpl->lastFrameWasRendered ? "true" : "false", forceClear ? "true" : "false");
// Only render if we have instructions to render, or the last frame was rendered (and therefore a clear is required).
{
mImpl->currentContext = &mImpl->context;
- // Context switch now happens when the uploading happens in graphics side
- // if(mImpl->currentContext->IsSurfacelessContextSupported())
- // {
- // mImpl->graphicsController.GetGlContextHelperAbstraction().MakeSurfacelessContextCurrent();
- // }
-
// Clear the current cached program when the context is switched
mImpl->programController.ClearCurrentProgram();
}
// Switch to shared context for off-screen buffer
mImpl->currentContext = &mImpl->context;
- // Context switch now happens when render pass starts
- // if(mImpl->currentContext->IsSurfacelessContextSupported())
- // {
- // mImpl->graphicsController.GetGlContextHelperAbstraction().MakeSurfacelessContextCurrent();
- // }
-
// Clear the current cached program when the context is switched
mImpl->programController.ClearCurrentProgram();
}
mImpl->textureDependencyList.PushBack(instruction.mFrameBuffer->GetTexture(i0));
}
}
- else
- {
- //mImpl->currentContext->BindFramebuffer(GL_FRAMEBUFFER, 0u);
- }
-
- // @todo Should this be a command in it's own right?
- // @todo yes
- if(!instruction.mFrameBuffer)
- {
- /*
- mImpl->currentContext->Viewport(surfaceRect.x,
- surfaceRect.y,
- surfaceRect.width,
- surfaceRect.height);
- */
-
- /*
- mainCommandBuffer->SetViewport( {surfaceRect.x,
- surfaceRect.y,
- surfaceRect.width,
- surfaceRect.height} );
- */
- }
-
- // Clear the entire color, depth and stencil buffers for the default framebuffer, if required.
- // It is important to clear all 3 buffers when they are being used, for performance on deferred renderers
- // e.g. previously when the depth & stencil buffers were NOT cleared, it caused the DDK to exceed a "vertex count limit",
- // and then stall. That problem is only noticeable when rendering a large number of vertices per frame.
-
- /*
- GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
- mImpl->currentContext->ColorMask(true);
-
- if(depthBufferAvailable == Integration::DepthBufferAvailable::TRUE)
- {
- mImpl->currentContext->DepthMask(true);
- clearMask |= GL_DEPTH_BUFFER_BIT;
- }
-
- if(stencilBufferAvailable == Integration::StencilBufferAvailable::TRUE)
- {
- mImpl->currentContext->ClearStencil(0);
- mImpl->currentContext->StencilMask(0xFF); // 8 bit stencil mask, all 1's
- clearMask |= GL_STENCIL_BUFFER_BIT;
- }
- */
if(!instruction.mIgnoreRenderToFbo && (instruction.mFrameBuffer != nullptr))
{
// Offscreen buffer rendering
clearFullFrameRect = false;
}
- // Begin render pass
- mainCommandBuffer->BeginRenderPass(
- currentRenderPass,
- currentRenderTarget,
- {
- viewportRect.x, viewportRect.y,
- uint32_t(viewportRect.width), uint32_t(viewportRect.height)
- },
- currentClearValues);
-
- // @todo The following block should be a command in it's own right.
- // Currently takes account of surface orientation in Context.
- // Or move entirely to RenderPass implementation
- mainCommandBuffer->SetViewport({float(viewportRect.x),
- float(viewportRect.y),
- float(viewportRect.width),
- float(viewportRect.height)});
-
- //mImpl->currentContext->Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height);
+ Graphics::Rect2D scissorArea{ viewportRect.x, viewportRect.y, uint32_t(viewportRect.width), uint32_t(viewportRect.height) };
if(instruction.mIsClearColorSet)
{
if(!clearFullFrameRect)
{
if(!clippingRect.IsEmpty())
{
- Graphics::Rect2D scissorArea = {clippingRect.x, clippingRect.y, uint32_t(clippingRect.width), uint32_t(clippingRect.height)};
- mainCommandBuffer->SetScissor( scissorArea );
- mainCommandBuffer->SetScissorTestEnable( true );
- //mImpl->currentContext->SetScissorTest(true);
- //mImpl->currentContext->Scissor(clippingRect.x, clippingRect.y, clippingRect.width, clippingRect.height);
- //mImpl->currentContext->Clear(clearMask, Context::FORCE_CLEAR);
- //mImpl->currentContext->SetScissorTest(false);
- }
- else
- {
- //mImpl->currentContext->SetScissorTest(true);
- //mImpl->currentContext->Scissor(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height);
- //mImpl->currentContext->Clear(clearMask, Context::FORCE_CLEAR);
- //mImpl->currentContext->SetScissorTest(false);
+ scissorArea = {clippingRect.x, clippingRect.y, uint32_t(clippingRect.width), uint32_t(clippingRect.height)};
}
}
- else
- {
- //mImpl->currentContext->SetScissorTest(false);
- //mImpl->currentContext->Clear(clearMask, Context::FORCE_CLEAR);
- }
}
+ // Begin render pass
+ mainCommandBuffer->BeginRenderPass(
+ currentRenderPass,
+ currentRenderTarget,
+ scissorArea,
+ currentClearValues);
+
+ mainCommandBuffer->SetViewport({float(viewportRect.x),
+ float(viewportRect.y),
+ float(viewportRect.width),
+ float(viewportRect.height)});
+
// Clear the list of bound textures
mImpl->boundTextures.Clear();
{
// For off-screen buffer
- // Wait until all rendering calls for the currently context are executed
- // mImpl->graphicsController.GetGlContextHelperAbstraction().WaitClient();
-
// Clear the dependency list
mImpl->textureDependencyList.Clear();
}
instruction.mRenderTracker = nullptr; // Only create once.
}
- // This now happens when the render pass for frame buffer finishes
- // if(renderToFbo)
- // {
- // mImpl->currentContext->Flush();
- // }
-
// End render pass
mainCommandBuffer->EndRenderPass();
}
rt = target;
}
}
-
- GLenum attachments[] = {GL_DEPTH, GL_STENCIL};
- mImpl->currentContext->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
}
void RenderManager::PostRender(bool uploadOnly)
{
- // Submit main command buffer
- //mImpl->renderAlgorithms.SubmitCommandBuffer();
-
- if(!uploadOnly)
- {
- // Context switch now happens outside the render manager
- // if(mImpl->currentContext->IsSurfacelessContextSupported())
- // {
- // mImpl->graphicsController.GetGlContextHelperAbstraction().MakeSurfacelessContextCurrent();
- // }
-
- GLenum attachments[] = {GL_DEPTH, GL_STENCIL};
- mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
- }
-
- //Notify RenderGeometries that rendering has finished
+ // Notify RenderGeometries that rendering has finished
for(auto&& iter : mImpl->geometryContainer)
{
iter->OnRenderFinished();