return texture;
}
+bool TestGraphicsController::HasClipMatrix() const
+{
+ return true;
+}
+
+const Matrix& TestGraphicsController::GetClipMatrix() const
+{
+ // This matrix transforms from GL -> Vulkan clip space
+ constexpr float VULKAN_CLIP_MATRIX_DATA[] = {
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 1.0f};
+ static const Matrix VULKAN_CLIP_MATRIX(VULKAN_CLIP_MATRIX_DATA);
+ static const Matrix IDENTITY = Matrix::IDENTITY;
+
+ // For now, return IDENTITY to stay in GL clip space.
+ // @todo Add test toggle
+ return IDENTITY;
+}
+
} // namespace Dali
*/
Graphics::UniquePtr<Graphics::Texture> ReleaseTextureFromResourceId(uint32_t resourceId) override;
+ bool HasClipMatrix() const override;
+ const Matrix& GetClipMatrix() const override;
+
public: // Test Functions
void SetAutoAttrCreation(bool v)
{
uint32_t elementStrideInBytes)
{
TestGraphicsReflection::TestUniformInfo info;
- info.name = std::move(name);
- info.type = type;
- info.uniformClass = Graphics::UniformClass::UNIFORM;
- info.numElements = elementCount;
- info.locations = {0};
- info.bufferIndex = 0; // this will update when AddCustomUniformBlock called
-
- auto retval= GetUniformBufferArrayStrideAndTypeSize(info, elementStrideInBytes);
+ info.name = std::move(name);
+ info.type = type;
+ info.uniformClass = Graphics::UniformClass::UNIFORM;
+ info.numElements = elementCount;
+ info.locations = {0};
+ info.bufferIndex = 0; // this will update when AddCustomUniformBlock called
+
+ auto retval = GetUniformBufferArrayStrideAndTypeSize(info, elementStrideInBytes);
info.elementStride = std::max(retval.first, retval.second);
info.offsets = {blockInfo.size};
blockInfo.size += (elementCount == 0 ? 1 : elementCount) * std::max(retval.first, retval.second);
} // namespace Dali
-#endif //TEST_GRAPHICS_CONTROLLER_H
+#endif // TEST_GRAPHICS_CONTROLLER_H
void EglGraphicsController::DeleteSurfaceContext(Dali::Integration::RenderSurfaceInterface* surface)
{
mSurfaceContexts.erase(std::remove_if(
- mSurfaceContexts.begin(), mSurfaceContexts.end(), [surface](SurfaceContextPair& iter) { return surface == iter.first; }),
+ mSurfaceContexts.begin(), mSurfaceContexts.end(), [surface](SurfaceContextPair& iter)
+ { return surface == iter.first; }),
mSurfaceContexts.end());
}
{
if(surface && mGraphics->IsResourceContextSupported())
{
- auto iter = std::find_if(mSurfaceContexts.begin(), mSurfaceContexts.end(), [surface](SurfaceContextPair& iter) { return (iter.first == surface); });
+ auto iter = std::find_if(mSurfaceContexts.begin(), mSurfaceContexts.end(), [surface](SurfaceContextPair& iter)
+ { return (iter.first == surface); });
if(iter != mSurfaceContexts.end())
{
auto count = 0u;
const auto commands = commandBuffer.GetCommands(count);
- DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_EGL_CONTROLLER_PROCESS", [&](std::ostringstream& oss) { oss << "[commandCount:" << count << "]"; });
+ DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_EGL_CONTROLLER_PROCESS", [&](std::ostringstream& oss)
+ { oss << "[commandCount:" << count << "]"; });
for(auto i = 0u; i < count; ++i)
{
return texture;
}
+bool EglGraphicsController::HasClipMatrix() const
+{
+ return false;
+}
+
+const Matrix& EglGraphicsController::GetClipMatrix() const
+{
+ return Matrix::IDENTITY;
+}
+
} // namespace Dali::Graphics
return mCapacity;
}
+ bool HasClipMatrix() const override;
+ const Matrix& GetClipMatrix() const override;
+
private:
Integration::GlAbstraction* mGlAbstraction{nullptr};
Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
auto renderTarget = ConstGraphicsCast<Vulkan::RenderTarget, Graphics::RenderTarget>(info.renderTarget);
inheritanceInfo.renderPass = renderTarget->GetRenderPass(info.renderPass)->GetVkHandle();
inheritanceInfo.subpass = 0;
+ inheritanceInfo.framebuffer = renderTarget->GetCurrentFramebufferImpl()->GetVkHandle();
inheritanceInfo.queryFlags = static_cast<vk::QueryControlFlags>(0);
inheritanceInfo.pipelineStatistics = static_cast<vk::QueryPipelineStatisticFlags>(0);
}
if(!mTextureStagingBuffer ||
mTextureStagingBuffer->GetImpl()->GetSize() < size)
{
- auto workerFunc = [&, size](auto workerIndex) {
+ auto workerFunc = [&, size](auto workerIndex)
+ {
Graphics::BufferCreateInfo createInfo{};
createInfo.SetSize(size)
.SetUsage(0u | Dali::Graphics::BufferUsage::TRANSFER_SRC);
}
assert(image);
- auto predicate = [&](auto& item) -> bool {
+ auto predicate = [&](auto& item) -> bool
+ {
return image->GetVkHandle() == item.image.GetVkHandle();
};
auto it = std::find_if(requestMap.begin(), requestMap.end(), predicate);
if(destTexture->GetProperties().directWriteAccessEnabled)
{
- auto taskLambda = [pInfo, sourcePtr, sourceInfoPtr, texture](auto workerIndex) {
+ auto taskLambda = [pInfo, sourcePtr, sourceInfoPtr, texture](auto workerIndex)
+ {
const auto& properties = texture->GetProperties();
if(properties.emulated)
// The staging buffer is not allocated yet. The task knows pointer to the pointer which will point
// at staging buffer right before executing tasks. The function will either perform direct copy
// or will do suitable conversion if source format isn't supported and emulation is available.
- auto taskLambda = [ppStagingMemory, currentOffset, pInfo, sourcePtr, texture](auto workerThread) {
+ auto taskLambda = [ppStagingMemory, currentOffset, pInfo, sourcePtr, texture](auto workerThread)
+ {
char* pStagingMemory = reinterpret_cast<char*>(*ppStagingMemory);
// Try to initialise` texture resources explicitly if they are not yet initialised
for(auto& item : updateMap)
{
auto pUpdates = &item.second;
- auto task = [pUpdates](auto workerIndex) {
+ auto task = [pUpdates](auto workerIndex)
+ {
for(auto& update : *pUpdates)
{
update.copyTask(workerIndex);
return mImpl->mCapacity;
}
+bool VulkanGraphicsController::HasClipMatrix() const
+{
+ return true;
+}
+
+const Matrix& VulkanGraphicsController::GetClipMatrix() const
+{
+ constexpr float CLIP_MATRIX_DATA[] = {
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 1.0f};
+ static const Matrix CLIP_MATRIX(CLIP_MATRIX_DATA);
+ return CLIP_MATRIX;
+}
+
} // namespace Dali::Graphics::Vulkan
*/
UniquePtr<Graphics::Texture> ReleaseTextureFromResourceId(uint32_t resourceId) override;
+ /**
+ * @return true if there is a clip space transform matrix
+ */
+ bool HasClipMatrix() const override;
+
+ /**
+ * @return the clip space transform matrix
+ */
+ const Matrix& GetClipMatrix() const override;
+
public: // For debug
void FrameStart();
att.setAlphaBlendOp(ConvBlendOp(in->alphaBlendOp));
att.setBlendEnable(in->blendEnable);
+ //att.setColorWriteMask()
att.setColorBlendOp(ConvBlendOp(in->colorBlendOp));
att.setColorWriteMask(vk::ColorComponentFlags(in->colorComponentWriteBits));
+ att.setColorWriteMask(vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG |
+ vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA);
att.setDstAlphaBlendFactor(ConvBlendFactor(in->dstAlphaBlendFactor));
att.setDstColorBlendFactor(ConvBlendFactor(in->dstColorBlendFactor));
att.setSrcAlphaBlendFactor(ConvBlendFactor(in->srcAlphaBlendFactor));
namespace Dali::Graphics::Vulkan
{
-
RenderPassImpl* RenderPassImpl::New(
Vulkan::Device& device,
const std::vector<FramebufferAttachment*>& colorAttachments,
.setDstAccessMask(vk::AccessFlagBits::eMemoryRead)
.setDependencyFlags(vk::DependencyFlagBits::eByRegion)};
- mCreateInfo.createInfo.setAttachmentCount(U32(mCreateInfo.attachmentDescriptions.size()))
+ mCreateInfo.createInfo
+ .setAttachmentCount(U32(mCreateInfo.attachmentDescriptions.size()))
.setPAttachments(mCreateInfo.attachmentDescriptions.data())
.setPSubpasses(&mCreateInfo.subpassDesc)
.setSubpassCount(1)
+ .setDependencyCount(2)
.setPDependencies(mCreateInfo.subpassDependencies.data());
}
return mCreateInfo.surface;
}
-Vulkan::RenderPassImpl* RenderTarget::GetRenderPass(const Graphics::RenderPass* gfxRenderPass) const
+Vulkan::FramebufferImpl* RenderTarget::GetCurrentFramebufferImpl() const
{
- auto renderPass = const_cast<Vulkan::RenderPass*>(static_cast<const Vulkan::RenderPass*>(gfxRenderPass));
-
auto framebuffer = GetFramebuffer();
auto surface = GetSurface();
{
fbImpl = framebuffer->GetImpl();
}
+ return fbImpl;
+}
- return fbImpl->GetImplFromRenderPass(renderPass);
+Vulkan::RenderPassImpl* RenderTarget::GetRenderPass(const Graphics::RenderPass* gfxRenderPass) const
+{
+ auto renderPass = const_cast<Vulkan::RenderPass*>(static_cast<const Vulkan::RenderPass*>(gfxRenderPass));
+ auto framebufferImpl = GetCurrentFramebufferImpl();
+ return framebufferImpl->GetImplFromRenderPass(renderPass);
}
} // namespace Dali::Graphics::Vulkan
*/
[[nodiscard]] Integration::RenderSurfaceInterface* GetSurface() const;
+ /**
+ * @brief Returns the current framebuffer impl for this frame.
+ * (May be either the swapchain's current fb, or the offscreen's fb).
+ * @return the current framebuffer
+ */
+ [[nodiscard]] Vulkan::FramebufferImpl* GetCurrentFramebufferImpl() const;
+
/**
* Find a matching render pass for this render target
* @param[in] renderPass A render pass to search for