#include <dali/integration-api/gl-defines.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-pipeline.h>
+#include <dali/internal/graphics/gles-impl/gles-graphics-render-pass.h>
+#include <dali/internal/graphics/gles-impl/gles-graphics-render-target.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-shader.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-texture.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-types.h>
return NewObject<GLES::CommandBuffer>(commandBufferCreateInfo, *this, std::move(oldCommandBuffer));
}
-Graphics::UniquePtr<Texture> EglGraphicsController::CreateTexture(
- const TextureCreateInfo& textureCreateInfo, Graphics::UniquePtr<Texture>&& oldTexture)
+Graphics::UniquePtr<RenderPass> EglGraphicsController::CreateRenderPass(const RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<RenderPass>&& oldRenderPass)
+{
+ return NewObject<GLES::RenderPass>(renderPassCreateInfo, *this, std::move(oldRenderPass));
+}
+
+Graphics::UniquePtr<Texture>
+EglGraphicsController::CreateTexture(const TextureCreateInfo& textureCreateInfo, Graphics::UniquePtr<Texture>&& oldTexture)
{
return NewObject<GLES::Texture>(textureCreateInfo, *this, std::move(oldTexture));
}
return NewObject<GLES::Sampler>(samplerCreateInfo, *this, std::move(oldSampler));
}
+Graphics::UniquePtr<RenderTarget> EglGraphicsController::CreateRenderTarget(const RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<RenderTarget>&& oldRenderTarget)
+{
+ return NewObject<GLES::RenderTarget>(renderTargetCreateInfo, *this, std::move(oldRenderTarget));
+}
+
const Graphics::Reflection& EglGraphicsController::GetProgramReflection(const Graphics::Program& program)
{
return static_cast<const Graphics::GLES::Program*>(&program)->GetReflection();
ProcessCreateQueue(mCreateFramebufferQueue);
}
-void EglGraphicsController::ProcessCommandQueues()
+void EglGraphicsController::ProcessCommandBuffer(GLES::CommandBuffer& commandBuffer)
{
- // TODO: command queue per context, sync between queues should be
- // done externally
- const Graphics::Framebuffer* currentFramebuffer{nullptr};
-
- while(!mCommandQueue.empty())
+ for(auto& cmd : commandBuffer.GetCommands())
{
- auto cmdBuf = mCommandQueue.front();
- mCommandQueue.pop();
-
- for(auto& cmd : cmdBuf->GetCommands())
+ // process command
+ switch(cmd.type)
{
- // process command
- switch(cmd.type)
+ case GLES::CommandType::FLUSH:
{
- case GLES::CommandType::FLUSH:
- {
- // Nothing to do here
- break;
- }
- case GLES::CommandType::BIND_TEXTURES:
- {
- mContext->BindTextures(cmd.bindTextures.textureBindings);
- break;
- }
- case GLES::CommandType::BIND_VERTEX_BUFFERS:
- {
- auto& bindings = cmd.bindVertexBuffers.vertexBufferBindings;
- mContext->BindVertexBuffers(bindings);
- break;
- }
- case GLES::CommandType::BIND_UNIFORM_BUFFER:
- {
- auto& bindings = cmd.bindUniformBuffers;
- mContext->BindUniformBuffers(bindings.uniformBufferBindings, bindings.standaloneUniformsBufferBinding);
- break;
- }
- case GLES::CommandType::BIND_INDEX_BUFFER:
- {
- mContext->BindIndexBuffer(cmd.bindIndexBuffer);
- break;
- }
- case GLES::CommandType::BIND_SAMPLERS:
- {
- break;
- }
- case GLES::CommandType::BIND_PIPELINE:
- {
- auto pipeline = static_cast<const GLES::Pipeline*>(cmd.bindPipeline.pipeline);
-
- // Bind framebuffer if different. @todo Move to RenderPass
- auto fbState = pipeline->GetCreateInfo().framebufferState;
- if(fbState && fbState->framebuffer != currentFramebuffer)
- {
- currentFramebuffer = fbState->framebuffer;
- static_cast<const GLES::Framebuffer*>(currentFramebuffer)->Bind();
- }
-
- mContext->BindPipeline(pipeline);
- break;
- }
- case GLES::CommandType::DRAW:
- {
- mContext->Flush(false, cmd.draw);
- break;
- }
- case GLES::CommandType::DRAW_INDEXED:
- {
- mContext->Flush(false, cmd.draw);
- break;
- }
- case GLES::CommandType::DRAW_INDEXED_INDIRECT:
- {
- mContext->Flush(false, cmd.draw);
- break;
- }
- case GLES::CommandType::SET_SCISSOR: // @todo Consider correcting for orientation here?
+ // Nothing to do here
+ break;
+ }
+ case GLES::CommandType::BIND_TEXTURES:
+ {
+ mContext->BindTextures(cmd.bindTextures.textureBindings);
+ break;
+ }
+ case GLES::CommandType::BIND_VERTEX_BUFFERS:
+ {
+ auto& bindings = cmd.bindVertexBuffers.vertexBufferBindings;
+ mContext->BindVertexBuffers(bindings);
+ break;
+ }
+ case GLES::CommandType::BIND_UNIFORM_BUFFER:
+ {
+ auto& bindings = cmd.bindUniformBuffers;
+ mContext->BindUniformBuffers(bindings.uniformBufferBindings, bindings.standaloneUniformsBufferBinding);
+ break;
+ }
+ case GLES::CommandType::BIND_INDEX_BUFFER:
+ {
+ mContext->BindIndexBuffer(cmd.bindIndexBuffer);
+ break;
+ }
+ case GLES::CommandType::BIND_SAMPLERS:
+ {
+ break;
+ }
+ case GLES::CommandType::BIND_PIPELINE:
+ {
+ auto pipeline = static_cast<const GLES::Pipeline*>(cmd.bindPipeline.pipeline);
+ mContext->BindPipeline(pipeline);
+ break;
+ }
+ case GLES::CommandType::DRAW:
+ {
+ mContext->Flush(false, cmd.draw);
+ break;
+ }
+ case GLES::CommandType::DRAW_INDEXED:
+ {
+ mContext->Flush(false, cmd.draw);
+ break;
+ }
+ case GLES::CommandType::DRAW_INDEXED_INDIRECT:
+ {
+ mContext->Flush(false, cmd.draw);
+ break;
+ }
+ case GLES::CommandType::SET_SCISSOR: // @todo Consider correcting for orientation here?
+ {
+ mGlAbstraction->Scissor(cmd.scissor.region.x, cmd.scissor.region.y, cmd.scissor.region.width, cmd.scissor.region.height);
+ break;
+ }
+ case GLES::CommandType::SET_SCISSOR_TEST:
+ {
+ if(cmd.scissorTest.enable)
{
- mGlAbstraction->Scissor(cmd.scissor.region.x, cmd.scissor.region.y, cmd.scissor.region.width, cmd.scissor.region.height);
- break;
+ mGlAbstraction->Enable(GL_SCISSOR_TEST);
}
- case GLES::CommandType::SET_SCISSOR_TEST:
+ else
{
- if(cmd.scissorTest.enable)
- {
- mGlAbstraction->Enable(GL_SCISSOR_TEST);
- }
- else
- {
- mGlAbstraction->Disable(GL_SCISSOR_TEST);
- }
- break;
+ mGlAbstraction->Disable(GL_SCISSOR_TEST);
}
- case GLES::CommandType::SET_VIEWPORT: // @todo Consider correcting for orientation here?
+ break;
+ }
+ case GLES::CommandType::SET_VIEWPORT: // @todo Consider correcting for orientation here?
+ {
+ mGlAbstraction->Viewport(cmd.viewport.region.x, cmd.viewport.region.y, cmd.viewport.region.width, cmd.viewport.region.height);
+ break;
+ }
+ case GLES::CommandType::BEGIN_RENDERPASS:
+ {
+ mContext->BeginRenderPass(cmd.beginRenderPass);
+ break;
+ }
+ case GLES::CommandType::EXECUTE_COMMAND_BUFFERS:
+ {
+ // Process secondary command buffers
+ // todo: check validity of the secondaries
+ // there are operations which are illigal to be done
+ // within secondaries.
+ for(auto& buf : cmd.executeCommandBuffers.buffers)
{
- mGlAbstraction->Viewport(cmd.viewport.region.x, cmd.viewport.region.y, cmd.viewport.region.width, cmd.viewport.region.height);
- break;
+ ProcessCommandBuffer(*static_cast<GLES::CommandBuffer*>(buf));
}
+ break;
}
}
}
}
+void EglGraphicsController::ProcessCommandQueues()
+{
+ // TODO: command queue per context, sync between queues should be
+ // done externally
+ currentFramebuffer = nullptr;
+
+ while(!mCommandQueue.empty())
+ {
+ auto cmdBuf = mCommandQueue.front();
+ mCommandQueue.pop();
+ ProcessCommandBuffer(*cmdBuf);
+ }
+}
+
void EglGraphicsController::ProcessTextureUpdateQueue()
{
while(!mTextureUpdateRequests.empty())
/**
* @copydoc Dali::Graphics::CreateRenderPass()
*/
- Graphics::UniquePtr<RenderPass> CreateRenderPass(const RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<RenderPass>&& oldRenderPass) override
- {
- return nullptr;
- }
+ Graphics::UniquePtr<RenderPass> CreateRenderPass(const RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<RenderPass>&& oldRenderPass) override;
/**
* @copydoc Dali::Graphics::CreateTexture()
/**
* @copydoc Dali::Graphics::CreateRenderTarget()
*/
- Graphics::UniquePtr<RenderTarget> CreateRenderTarget(const RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<RenderTarget>&& oldRenderTarget) override
- {
- return nullptr;
- }
+ Graphics::UniquePtr<RenderTarget> CreateRenderTarget(const RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<RenderTarget>&& oldRenderTarget) override;
/**
* @copydoc Dali::Graphics::MapBufferRange()
return mIsShuttingDown;
}
+ void ProcessCommandBuffer(GLES::CommandBuffer& commandBuffer);
+
private:
Integration::GlAbstraction* mGlAbstraction{nullptr};
Integration::GlSyncAbstraction* mGlSyncAbstraction{nullptr};
std::unique_ptr<GLES::PipelineCache> mPipelineCache{nullptr}; ///< Internal pipeline cache
bool mIsShuttingDown{false}; ///< Indicates whether the controller is shutting down
+
+ // todo: to be removed after renderpass
+ const Graphics::Framebuffer* currentFramebuffer{nullptr};
};
} // namespace Graphics
#include "gles-graphics-buffer.h"
#include "gles-graphics-pipeline.h"
#include "gles-graphics-program.h"
+#include "gles-graphics-render-pass.h"
+#include "gles-graphics-render-target.h"
namespace Dali::Graphics::GLES
{
// Currently bound UBOs (check if it's needed per program!)
std::vector<UniformBufferBindingDescriptor> mCurrentUBOBindings{};
UniformBufferBindingDescriptor mCurrentStandaloneUBOBinding{};
+
+ // Current render pass and render target
+ const GLES::RenderTarget* mCurrentRenderTarget{nullptr};
+ const GLES::RenderPass* mCurrentRenderPass{nullptr};
};
Context::Context(EglGraphicsController& controller)
}
}
+void Context::BeginRenderPass(const BeginRenderPassDescriptor& renderPassBegin)
+{
+ auto& renderPass = *renderPassBegin.renderPass;
+ auto& renderTarget = *renderPassBegin.renderTarget;
+
+ if(mImpl->mCurrentRenderPass == &renderPass &&
+ mImpl->mCurrentRenderTarget == &renderTarget)
+ {
+ return;
+ }
+ const auto& passInfo = renderPass.GetCreateInfo();
+ const auto& targetInfo = renderTarget.GetCreateInfo();
+
+ auto& gl = *mImpl->mController.GetGL();
+
+ if(targetInfo.surface)
+ {
+ // switch context to surface bound
+
+ // Bind surface FB
+ gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
+ }
+
+ if(targetInfo.framebuffer)
+ {
+ // bind framebuffer and swap (if needed to shared context)
+ renderTarget.GetFramebuffer()->Bind();
+ }
+
+ // clear (ideally cache the setup)
+
+ // In GL we assume that the last attachment is depth/stencil (we may need
+ // to cache extra information inside GLES RenderTarget if we want to be
+ // more specific in case of MRT)
+
+ // For GLES2.0 we clear only a single color attachment
+ if(mImpl->mController.GetGLESVersion() == GLESVersion::GLES_20)
+ {
+ const auto& attachments = *renderPass.GetCreateInfo().attachments;
+ const auto& color0 = attachments[0];
+ GLuint mask = 0;
+ if(color0.loadOp == AttachmentLoadOp::CLEAR)
+ {
+ mask |= GL_COLOR_BUFFER_BIT;
+
+ // Set clear color (todo: cache it!)
+ // Something goes wrong here if Alpha mask is GL_TRUE
+ gl.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
+ gl.ClearColor(renderPassBegin.clearValues[0].color.r,
+ renderPassBegin.clearValues[0].color.g,
+ renderPassBegin.clearValues[0].color.b,
+ renderPassBegin.clearValues[0].color.a);
+ }
+
+ // check for depth stencil
+ if(attachments.size() > 1)
+ {
+ const auto& depthStencil = attachments.back();
+ if(depthStencil.loadOp == AttachmentLoadOp::CLEAR)
+ {
+ mask |= GL_DEPTH_BUFFER_BIT;
+ }
+ if(depthStencil.stencilLoadOp == AttachmentLoadOp::CLEAR)
+ {
+ mask |= GL_STENCIL_BUFFER_BIT;
+ }
+ }
+
+ gl.Clear(mask);
+ }
+
+ mImpl->mCurrentRenderPass = &renderPass;
+ mImpl->mCurrentRenderTarget = &renderTarget;
+}
+
+void Context::EndRenderPass()
+{
+}
+
void Context::ClearState()
{
mImpl->mCurrentTextureBindings.clear();
namespace GLES
{
class Pipeline;
-class Texture;
-
+class RenderPass;
+class RenderTarget;
/**
* @brief Context represents single GLES context
*/
*/
void ResolveStandaloneUniforms();
+ /**
+ * @brief Begins render pass for sepcified render target
+ *
+ * @param[in] renderPass render pass object to begin
+ * @param[in] renderTarget render target to be drawn onto
+ */
+ void BeginRenderPass(const BeginRenderPassDescriptor& renderPassBegin);
+
+ /**
+ * @brief Ends render pass
+ *
+ * Ending render pass is necessary in order to ensure
+ * proper implicit synchronization is in place
+ */
+ void EndRenderPass();
+
private:
/**
* @brief Clear current state
// INTERNAL INCLUDES
#include "egl-graphics-controller.h"
#include "gles-graphics-buffer.h"
+#include "gles-graphics-framebuffer.h"
#include "gles-graphics-pipeline.h"
+#include "gles-graphics-render-pass.h"
+#include "gles-graphics-render-target.h"
#include "gles-graphics-texture.h"
namespace Dali::Graphics::GLES
}
void CommandBuffer::BeginRenderPass(
- Graphics::RenderPass& renderPass,
- Graphics::RenderTarget& renderTarget,
+ Graphics::RenderPass* renderPass,
+ Graphics::RenderTarget* renderTarget,
Extent2D renderArea,
std::vector<ClearValue> clearValues)
{
+ mCommands.emplace_back(CommandType::BEGIN_RENDERPASS);
+ auto& cmd = mCommands.back();
+ cmd.beginRenderPass.renderPass = static_cast<GLES::RenderPass*>(renderPass);
+ cmd.beginRenderPass.renderTarget = static_cast<GLES::RenderTarget*>(renderTarget);
+ cmd.beginRenderPass.renderArea = renderArea;
+ cmd.beginRenderPass.clearValues = clearValues;
}
-/**
- * @brief Ends current render pass
- *
- * This command must be issued in order to finalize the render pass.
- * It's up to the implementation whether anything has to be done but
- * the Controller may use end RP marker in order to resolve resource
- * dependencies (for example, to know when target texture is ready
- * before passing it to another render pass).
- */
void CommandBuffer::EndRenderPass()
{
+ mCommands.emplace_back(CommandType::END_RENDERPASS);
+}
+
+void CommandBuffer::ExecuteCommandBuffers(std::vector<Graphics::CommandBuffer*>&& commandBuffers)
+{
+ mCommands.emplace_back(CommandType::EXECUTE_COMMAND_BUFFERS);
+ auto& cmd = mCommands.back();
+ cmd.executeCommandBuffers.buffers.reserve(commandBuffers.size());
+ for(auto&& item : commandBuffers)
+ {
+ cmd.executeCommandBuffers.buffers.emplace_back(static_cast<GLES::CommandBuffer*>(item));
+ }
}
void CommandBuffer::Draw(
namespace Dali::Graphics::GLES
{
-class Texture;
class Pipeline;
-
+class RenderPass;
+class Framebuffer;
+class CommandBuffer;
enum class CommandType
{
FLUSH,
DRAW_INDEXED_INDIRECT,
SET_SCISSOR,
SET_SCISSOR_TEST,
- SET_VIEWPORT
+ SET_VIEWPORT,
+ BEGIN_RENDERPASS,
+ END_RENDERPASS,
+ EXECUTE_COMMAND_BUFFERS,
};
/**
new(&bindTextures) decltype(bindTextures);
break;
}
+ case CommandType::BEGIN_RENDERPASS:
+ {
+ // run destructor
+ new(&beginRenderPass) decltype(beginRenderPass);
+ break;
+ }
default:
{
}
InvokeDestructor(bindTextures);
break;
}
+ case CommandType::BEGIN_RENDERPASS:
+ {
+ // run destructor
+ InvokeDestructor(beginRenderPass);
+ break;
+ }
default:
{
}
draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
break;
}
+ case CommandType::BEGIN_RENDERPASS:
+ {
+ new(&beginRenderPass) BeginRenderPassDescriptor(rhs.beginRenderPass);
+ break;
+ }
+ case CommandType::END_RENDERPASS:
+ {
+ break;
+ }
+ case CommandType::EXECUTE_COMMAND_BUFFERS:
+ {
+ executeCommandBuffers = rhs.executeCommandBuffers;
+ break;
+ }
case CommandType::FLUSH:
{
// Nothing to do
draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
break;
}
+ case CommandType::BEGIN_RENDERPASS:
+ {
+ new(&beginRenderPass) BeginRenderPassDescriptor(std::move(rhs.beginRenderPass));
+ break;
+ }
+ case CommandType::END_RENDERPASS:
+ {
+ break;
+ }
+ case CommandType::EXECUTE_COMMAND_BUFFERS:
+ {
+ executeCommandBuffers = std::move(rhs.executeCommandBuffers);
+ break;
+ }
case CommandType::FLUSH:
{
// Nothing to do
{
Graphics::Viewport region;
} viewport;
+
+ struct BeginRenderPassDescriptor
+ beginRenderPass;
+
+ struct
+ {
+ } endRenderPass;
+
+ struct
+ {
+ std::vector<GLES::CommandBuffer*> buffers;
+ } executeCommandBuffers;
};
};
Format format) override;
void BeginRenderPass(
- Graphics::RenderPass& renderPass,
- Graphics::RenderTarget& renderTarget,
+ Graphics::RenderPass* renderPass,
+ Graphics::RenderTarget* renderTarget,
Extent2D renderArea,
std::vector<ClearValue> clearValues) override;
*/
void EndRenderPass() override;
+ void ExecuteCommandBuffers(std::vector<Graphics::CommandBuffer*>&& commandBuffers) override;
+
void Draw(
uint32_t vertexCount,
uint32_t instanceCount,
mController.AddFramebuffer(*this);
}
+Framebuffer::~Framebuffer() = default;
+
bool Framebuffer::InitializeResource()
{
if(!mInitialized)
}
}
+uint32_t Framebuffer::GetGlFramebufferId() const
+{
+ return mFramebufferId;
+}
+
+uint32_t Framebuffer::GetGlDepthBufferId() const
+{
+ return mDepthBufferId;
+}
+
+uint32_t Framebuffer::GetGlStencilBufferId() const
+{
+ return mStencilBufferId;
+}
+
} //namespace Dali::Graphics::GLES
/**
* @brief Destructor
*/
- ~Framebuffer() override = default;
+ ~Framebuffer() override;
/**
* @brief Called when GL resources are destroyed
*/
void Bind() const;
+ [[nodiscard]] uint32_t GetGlFramebufferId() const;
+
+ [[nodiscard]] uint32_t GetGlDepthBufferId() const;
+
+ [[nodiscard]] uint32_t GetGlStencilBufferId() const;
+
private:
/**
* Attach a texture to the specified attachment point
{
COLOR_BLEND_STATE_BIT = 0,
VIEWPORT_STATE_BIT = 1,
- FRAMEBUFFER_STATE_BIT = 2,
- BASE_PIPELINE_STATE_BIT = 3,
- DEPTH_STENCIL_STATE_BIT = 4,
- RASTERIZATION_STATE_BIT = 5,
- VERTEX_INPUT_STATE_BIT = 6,
- INPUT_ASSEMBLY_STATE_BIT = 7,
- MAX_STATE = 8
+ BASE_PIPELINE_STATE_BIT = 2,
+ DEPTH_STENCIL_STATE_BIT = 3,
+ RASTERIZATION_STATE_BIT = 4,
+ VERTEX_INPUT_STATE_BIT = 5,
+ INPUT_ASSEMBLY_STATE_BIT = 6,
+ MAX_STATE = 7
};
/**
lvp.scissor == rvp.scissor &&
lvp.scissorTestEnable == rvp.scissorTestEnable;
},
- [](const auto* lhs, const auto* rhs) -> bool // framebufferState
- {
- const auto& lfb = *lhs->framebufferState;
- const auto& rfb = *rhs->framebufferState;
- return lfb.framebuffer == rfb.framebuffer;
- },
[](const auto* lhs, const auto* rhs) -> bool // basePipeline
{
return lhs->basePipeline == rhs->basePipeline;
uint32_t mask{0u};
mask |= bool(info.colorBlendState) << int(StateLookupIndex::COLOR_BLEND_STATE_BIT);
mask |= bool(info.viewportState) << int(StateLookupIndex::VIEWPORT_STATE_BIT);
- mask |= bool(info.framebufferState) << int(StateLookupIndex::FRAMEBUFFER_STATE_BIT);
mask |= bool(info.basePipeline) << int(StateLookupIndex::BASE_PIPELINE_STATE_BIT);
mask |= bool(info.depthStencilState) << int(StateLookupIndex::DEPTH_STENCIL_STATE_BIT);
mask |= bool(info.rasterizationState) << int(StateLookupIndex::RASTERIZATION_STATE_BIT);
DepthStencilState depthStencilState;
ProgramState programState;
ViewportState viewportState;
- FramebufferState framebufferState;
RasterizationState rasterizationState;
VertexInputState vertexInputState;
InputAssemblyState inputAssemblyState;
CopyStateIfSet(createInfo.vertexInputState, mPipelineState->vertexInputState, &mCreateInfo.vertexInputState);
CopyStateIfSet(createInfo.rasterizationState, mPipelineState->rasterizationState, &mCreateInfo.rasterizationState);
CopyStateIfSet(createInfo.programState, mPipelineState->programState, &mCreateInfo.programState);
- CopyStateIfSet(createInfo.framebufferState, mPipelineState->framebufferState, &mCreateInfo.framebufferState);
CopyStateIfSet(createInfo.colorBlendState, mPipelineState->colorBlendState, &mCreateInfo.colorBlendState);
CopyStateIfSet(createInfo.depthStencilState, mPipelineState->depthStencilState, &mCreateInfo.depthStencilState);
CopyStateIfSet(createInfo.programState, mPipelineState->programState, &mCreateInfo.programState);
// CLASS HEADER
#include "gles-graphics-render-pass.h"
+
+namespace Dali::Graphics::GLES
+{
+struct RenderPass::Impl
+{
+ Impl() = default;
+ ~Impl() = default;
+
+ std::vector<AttachmentDescription> attachments;
+};
+
+RenderPass::RenderPass(const Graphics::RenderPassCreateInfo& createInfo, Graphics::EglGraphicsController& controller)
+: RenderPassResource(createInfo, controller)
+{
+ mImpl = std::make_unique<Impl>();
+
+ // copy attachment description
+ if(createInfo.attachments)
+ {
+ mCreateInfo.attachments = &mImpl->attachments;
+ mImpl->attachments.insert(mImpl->attachments.end(), createInfo.attachments->begin(), createInfo.attachments->end());
+ }
+}
+
+} // namespace Dali::Graphics::GLES
\ No newline at end of file
* @param[in] createInfo Valid createInfo structure
* @param[in] controller Reference to the controller
*/
- RenderPass(const Graphics::RenderPassCreateInfo& createInfo, Graphics::EglGraphicsController& controller)
- : RenderPassResource(createInfo, controller)
- {
- }
+ RenderPass(const Graphics::RenderPassCreateInfo& createInfo, Graphics::EglGraphicsController& controller);
/**
* @brief Destructor
{
// TODO: Implement moving to the discard queue
}
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> mImpl{nullptr};
};
} // namespace Dali::Graphics::GLES
// CLASS HEADER
#include "gles-graphics-render-target.h"
+#include "gles-graphics-framebuffer.h"
+
+namespace Dali::Graphics::GLES
+{
+RenderTarget::RenderTarget(const Graphics::RenderTargetCreateInfo& createInfo, Graphics::EglGraphicsController& controller)
+: RenderTargetResource(createInfo, controller)
+{
+}
+
+GLES::Framebuffer* RenderTarget::GetFramebuffer() const
+{
+ return static_cast<GLES::Framebuffer*>(mCreateInfo.framebuffer);
+}
+
+Surface* RenderTarget::GetSurface() const
+{
+ return mCreateInfo.surface;
+}
+
+} // namespace Dali::Graphics::GLES
\ No newline at end of file
namespace Dali::Graphics::GLES
{
+class Framebuffer;
using RenderTargetResource = Resource<Graphics::RenderTarget, Graphics::RenderTargetCreateInfo>;
class RenderTarget : public RenderTargetResource
* @param[in] createInfo Valid createInfo structure
* @param[in] controller Reference to the controller
*/
- RenderTarget(const Graphics::RenderTargetCreateInfo& createInfo, Graphics::EglGraphicsController& controller)
- : RenderTargetResource(createInfo, controller)
- {
- }
+ RenderTarget(const Graphics::RenderTargetCreateInfo& createInfo, Graphics::EglGraphicsController& controller);
/**
* @brief Destructor
{
// TODO: Implement moving to the discard queue
}
+
+ /**
+ * @brief Returns framebuffer associated with the render target
+ */
+ GLES::Framebuffer* GetFramebuffer() const;
+
+ /**
+ * @brief Returns surface associated with the render target
+ */
+ Surface* GetSurface() const;
};
} // namespace Dali::Graphics::GLES
namespace Dali::Graphics::GLES
{
class Buffer;
+class RenderPass;
+class RenderTarget;
+class Framebuffer;
+
+using Surface = void*;
+
// Conversion functions
/**
* Stucture delivers format and type that can be used
GLES_32 = 32
};
+/**
+ * The descriptor of BeginRenderPass command
+ */
+struct BeginRenderPassDescriptor
+{
+ const GLES::RenderPass* renderPass;
+ const GLES::Framebuffer* framebuffer;
+ const GLES::RenderTarget* renderTarget;
+ Extent2D renderArea;
+ std::vector<ClearValue> clearValues;
+};
+
} // namespace Dali::Graphics::GLES
#endif //DALI_GRAPHICS_API_TYPES_H