[Tizen] Reset To 2.3.42 41/318941/1
authorSeungho Baek <sbsh.baek@samsung.com>
Fri, 11 Oct 2024 02:55:01 +0000 (11:55 +0900)
committerSeungho Baek <sbsh.baek@samsung.com>
Fri, 11 Oct 2024 02:55:01 +0000 (11:55 +0900)
Change-Id: I2238e637352723ab88894e5e38f3c3afc7e2ab56
Signed-off-by: Seungho Baek <sbsh.baek@samsung.com>
38 files changed:
build/tizen/deps-check.cmake
dali/devel-api/adaptor-framework/window-blur-info.cpp
dali/devel-api/adaptor-framework/window-blur-info.h
dali/internal/graphics/common/shader-parser.cpp
dali/internal/graphics/vulkan-impl/vulkan-buffer-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-command-buffer-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-command-buffer-impl.h
dali/internal/graphics/vulkan-impl/vulkan-command-buffer.cpp
dali/internal/graphics/vulkan-impl/vulkan-image-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-memory-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-memory-impl.h
dali/internal/graphics/vulkan-impl/vulkan-pipeline-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-pipeline-impl.h
dali/internal/graphics/vulkan-impl/vulkan-program-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-program-impl.h
dali/internal/graphics/vulkan-impl/vulkan-reflection.cpp
dali/internal/graphics/vulkan-impl/vulkan-reflection.h
dali/internal/graphics/vulkan-impl/vulkan-render-target.cpp
dali/internal/graphics/vulkan-impl/vulkan-render-target.h
dali/internal/graphics/vulkan-impl/vulkan-sampler.cpp
dali/internal/graphics/vulkan-impl/vulkan-sampler.h
dali/internal/window-system/android/window-base-android.cpp
dali/internal/window-system/android/window-base-android.h
dali/internal/window-system/common/window-base.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/macos/window-base-mac.h
dali/internal/window-system/macos/window-base-mac.mm
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h
dali/internal/window-system/windows/window-base-win.cpp
dali/internal/window-system/windows/window-base-win.h
dali/internal/window-system/x11/window-base-x.cpp
dali/internal/window-system/x11/window-base-x.h
dali/public-api/adaptor-framework/window-enumerations.h
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec

index e350c04fb8d53b6ea6bfd2a68b67a116d9a3e347..3de7eba8312bcbd02d4c8502dbfced09b2d8dfc0 100644 (file)
@@ -541,7 +541,7 @@ IF(enable_glslang)
     # all needed deps and SPIRV-Tools package is needed
     SET(DALI_LDFLAGS ${DALI_LDFLAGS} ${GLSLANG_LDFLAGS} -lSPIRV ${SPIRVTOOLS_LDFLAGS} -lglslang-default-resource-limits)
   ENDIF()
-
+  LIST(APPEND DALI_CFLAGS ${GLSLANG_CFLAGS})
 ENDIF()
 
 IF(LIBUV_X11_PROFILE)
index 7ae13b0dbb71e8056323c2e1097e7f29c3aa76da..3db2c845d16858ce2ea011c3cf6409f053686a39 100644 (file)
@@ -31,7 +31,7 @@ bool WindowBlurInfo::operator==(const WindowBlurInfo& blurInfo) const
   {
     return false;
   }
-  if(backgroundBlurRadius != blurInfo.backgroundBlurRadius)
+  if(backgroundCornerRadius != blurInfo.backgroundCornerRadius)
   {
     return false;
   }
@@ -61,12 +61,12 @@ int WindowBlurInfo::GetBlurRadius() const
 
 void WindowBlurInfo::SetCornerRadiusForBackground(int cornerRadius)
 {
-  backgroundBlurRadius = cornerRadius;
+  backgroundCornerRadius = cornerRadius;
 }
 
 int WindowBlurInfo::GetCornerRadiusForBackground() const
 {
-  return backgroundBlurRadius;
+  return backgroundCornerRadius;
 }
 
 } // namespace Dali
index 8a8f9147959d3ada2671dddaec2ca7bf21d64eb5..0e3685e16e3d78a05544b61f29d3904b9bd44f54 100644 (file)
@@ -46,7 +46,7 @@ public:
   WindowBlurInfo()
   : windowBlurType(WindowBlurType::NONE),
     windowBlurRadius(0),
-    backgroundBlurRadius(0)
+    backgroundCornerRadius(0)
   {
   }
 
@@ -61,7 +61,7 @@ public:
   explicit constexpr WindowBlurInfo(WindowBlurType type, int blurRadius, int cornerRadius)
   : windowBlurType(type),
     windowBlurRadius(blurRadius),
-    backgroundBlurRadius(cornerRadius)
+    backgroundCornerRadius(cornerRadius)
   {
   }
 
@@ -76,7 +76,7 @@ public:
   explicit constexpr WindowBlurInfo(WindowBlurType type, int blurRadius)
   : windowBlurType(type),
     windowBlurRadius(blurRadius),
-    backgroundBlurRadius(0)
+    backgroundCornerRadius(0)
   {
   }
 
@@ -149,7 +149,7 @@ public:
 public:
   WindowBlurType windowBlurType;
   int windowBlurRadius;
-  int backgroundBlurRadius;
+  int backgroundCornerRadius;
 };
 
 } // namespace Dali
index 1cb10c07e2182c04575011a848bcb911166be9d8..8bc27399fb7b83331d1cc93fb45ffc8400ed2f0c 100644 (file)
@@ -1,19 +1,19 @@
 /*
-* Copyright (c) 2024 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 #include <dali/integration-api/debug.h>
 #include <dali/internal/graphics/common/shader-parser.h>
@@ -575,4 +575,4 @@ void Parse(const ShaderParserInfo& parseInfo, std::vector<std::string>& output)
   }
 }
 
-} // namespace Dali::Internal::ShaderParser
\ No newline at end of file
+} // namespace Dali::Internal::ShaderParser
index 9e70eb6be806413de4bcf8c7b299efb86f31e852..48a952d4d0756712a81769de4420c1514bd3593e 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali::Graphics::Vulkan
 {
 BufferImpl* BufferImpl::New(Device& device, size_t size, vk::BufferUsageFlags usageFlags)
 {
-  return New(device, size, vk::SharingMode(vk::SharingMode::eExclusive), usageFlags, vk::MemoryPropertyFlags(vk::MemoryPropertyFlagBits::eHostVisible));
+  return New(device, size, vk::SharingMode(vk::SharingMode::eExclusive), usageFlags, vk::MemoryPropertyFlags(vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent));
 }
 
 BufferImpl* BufferImpl::New(Device& device, size_t size, vk::SharingMode sharingMode, vk::BufferUsageFlags usageFlags, vk::MemoryPropertyFlags memoryProperties)
@@ -62,7 +62,7 @@ void BufferImpl::Initialize(vk::MemoryPropertyFlags memoryProperties)
                                                 requirements.memoryTypeBits,
                                                 memoryProperties);
 
-  mMemory = std::make_unique<MemoryImpl>(mDevice, size_t(requirements.size), size_t(requirements.alignment), ((memoryProperties & vk::MemoryPropertyFlagBits::eHostVisible) == vk::MemoryPropertyFlagBits::eHostVisible));
+  mMemory = std::make_unique<MemoryImpl>(mDevice, size_t(requirements.size), size_t(requirements.alignment), memoryProperties);
 
   auto allocateInfo = vk::MemoryAllocateInfo{}
                         .setMemoryTypeIndex(memoryTypeIndex)
index c1b931aff1bdf4fa4deb37ba17e8a897fc08e522..ffff13272e360e36ae0f46eedd2d33afb4197377 100644 (file)
 #include <dali/internal/graphics/vulkan-impl/vulkan-command-pool-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-framebuffer-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-image-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-image-view-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-pipeline-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-sampler-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-sampler.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-swapchain-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-texture.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-types.h>
 #include <dali/internal/graphics/vulkan/vulkan-device.h>
 
@@ -109,12 +113,92 @@ void CommandBufferImpl::BindPipeline(const Graphics::Pipeline* pipeline)
 
   // Bind if pipeline is ready (if nullptr, pipeline isn't ready).
   // If pipeline is valid, bind it early
+
   if(pipelineImpl.GetVkPipeline())
   {
     mCommandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipelineImpl.GetVkPipeline());
+
+    mCurrentProgram = pipelineImpl.GetProgram()->GetImplementation();
+  }
+  else
+  {
+    mCurrentProgram = nullptr;
+  }
+}
+
+void CommandBufferImpl::BindVertexBuffers(
+  uint32_t                        firstBinding,
+  const std::vector<BufferImpl*>& buffers,
+  const std::vector<uint32_t>&    offsets)
+{
+  // update list of used resources and create an array of VkBuffers
+  std::vector<vk::Buffer> vkBuffers;
+  vkBuffers.reserve(buffers.size());
+  for(auto&& buffer : buffers)
+  {
+    vkBuffers.emplace_back(buffer->GetVkHandle());
+  }
+  std::vector<vk::DeviceSize> vkOffsets;
+  vkOffsets.reserve(offsets.size());
+  for(auto&& offset : offsets)
+  {
+    vkOffsets.emplace_back(static_cast<vk::DeviceSize>(offset));
+  }
+  mCommandBuffer.bindVertexBuffers(firstBinding, vkBuffers.size(), vkBuffers.data(), vkOffsets.data());
+}
+
+void CommandBufferImpl::BindIndexBuffer(
+  BufferImpl& buffer,
+  uint32_t    offset,
+  Format      format)
+{
+  if(format == Graphics::Format::R16_UINT)
+  {
+    mCommandBuffer.bindIndexBuffer(buffer.GetVkHandle(), offset, vk::IndexType::eUint16);
+  }
+  else if(format == Graphics::Format::R32_UINT)
+  {
+    mCommandBuffer.bindIndexBuffer(buffer.GetVkHandle(), offset, vk::IndexType::eUint32);
+  }
+}
+
+void CommandBufferImpl::BindUniformBuffers(const std::vector<UniformBufferBinding>& bindings)
+{
+  // Needs descriptor set pools.
+}
+
+void CommandBufferImpl::BindTextures(const std::vector<TextureBinding>& textureBindings)
+{
+  for(const auto& textureBinding : textureBindings)
+  {
+    auto texture   = static_cast<const Vulkan::Texture*>(textureBinding.texture);
+    auto sampler   = const_cast<Vulkan::Sampler*>(static_cast<const Vulkan::Sampler*>(textureBinding.sampler));
+    auto vkSampler = sampler ? sampler->GetImpl()->GetVkHandle() : nullptr;
+
+    auto image     = texture->GetImage();
+    auto imageView = texture->GetImageView();
+
+    // test if image is valid, skip invalid image
+    if(!image || !image->GetVkHandle())
+    {
+      continue;
+    }
+
+    // Store: imageView, sampler & texture.binding for later use
+    // We don't know at this point what pipeline is bound (As dali-core
+    // binds the pipeline after calling this API)
+    mDeferredTextureBindings.emplace_back();
+    mDeferredTextureBindings.back().imageView = imageView->GetVkHandle();
+    mDeferredTextureBindings.back().sampler   = vkSampler;
+    mDeferredTextureBindings.back().binding   = textureBinding.binding;
   }
 }
 
+void CommandBufferImpl::BindSamplers(const std::vector<SamplerBinding>& samplerBindings)
+{
+  // Unused in core
+}
+
 vk::CommandBuffer CommandBufferImpl::GetVkHandle() const
 {
   return mCommandBuffer;
@@ -182,6 +266,16 @@ void CommandBufferImpl::Draw(uint32_t vertexCount,
                              uint32_t firstVertex,
                              uint32_t firstInstance)
 {
+  // Example of deferred binding descriptors
+  if(mCurrentProgram)
+  {
+    auto set = mCurrentProgram->AllocateDescriptorSet(-1); // allocate from recent pool
+    if(set)
+    {
+      // bind resources here
+    }
+  }
+  mCommandBuffer.draw(vertexCount, instanceCount, firstVertex, firstInstance);
 }
 
 void CommandBufferImpl::DrawIndexed(uint32_t indexCount,
@@ -190,17 +284,44 @@ void CommandBufferImpl::DrawIndexed(uint32_t indexCount,
                                     int32_t  vertexOffset,
                                     uint32_t firstInstance)
 {
+  // Example of deferred binding descriptors
+  if(mCurrentProgram)
+  {
+    auto set = mCurrentProgram->AllocateDescriptorSet(-1); // allocate from recent pool
+    if(set)
+    {
+      // bind resources here
+    }
+  }
+  // draw here
+  mCommandBuffer.drawIndexed(indexCount,
+                             instanceCount,
+                             firstIndex,
+                             static_cast<int32_t>(vertexOffset),
+                             firstInstance);
+}
+
+void CommandBufferImpl::DrawIndexedIndirect(BufferImpl& buffer,
+                                            uint32_t    offset,
+                                            uint32_t    drawCount,
+                                            uint32_t    stride)
+{
+  mCommandBuffer.drawIndexedIndirect(buffer.GetVkHandle(), static_cast<vk::DeviceSize>(offset), drawCount, stride);
+}
+
+void CommandBufferImpl::ExecuteCommandBuffers(std::vector<vk::CommandBuffer>& commandBuffers)
+{
+  mCommandBuffer.executeCommands(commandBuffers);
 }
 
-void CommandBufferImpl::DrawIndexedIndirect(Graphics::Buffer& buffer,
-                                            uint32_t          offset,
-                                            uint32_t          drawCount,
-                                            uint32_t          stride)
+void CommandBufferImpl::SetScissor(Rect2D value)
 {
+  mCommandBuffer.setScissor(0, 1, reinterpret_cast<vk::Rect2D*>(&value));
 }
 
-void CommandBufferImpl::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& commandBuffers)
+void CommandBufferImpl::SetViewport(Viewport value)
 {
+  mCommandBuffer.setViewport(0, 1, reinterpret_cast<vk::Viewport*>(&value));
 }
 
 } // namespace Vulkan
index 6f9cda2f873113eb56daf4b7e9a7c7ea994aaac4..2e7c8c9fd1e61b38ba711ef8612b8ed549766a71 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/graphics-api/graphics-types.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-buffer-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-image-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-program-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-types.h>
 
 namespace Dali::Graphics::Vulkan
@@ -60,6 +61,15 @@ public:
   /** Final validation of the pipeline */
   void ValidatePipeline();
 
+  void BindVertexBuffers(
+    uint32_t                                firstBinding,
+    const std::vector<Vulkan::BufferImpl*>& buffers,
+    const std::vector<uint32_t>&            offsets);
+  void BindIndexBuffer(Vulkan::BufferImpl& buffer, uint32_t offset, Format format);
+  void BindUniformBuffers(const std::vector<UniformBufferBinding>& bindings);
+  void BindTextures(const std::vector<TextureBinding>& textureBindings);
+  void BindSamplers(const std::vector<SamplerBinding>& samplerBindings);
+
   /** Returns Vulkan object associated with the buffer */
   [[nodiscard]] vk::CommandBuffer GetVkHandle() const;
 
@@ -68,7 +78,6 @@ public:
    * @return Returns true if the command buffer is primary
    */
   [[nodiscard]] bool IsPrimary() const;
-
   /**
    * Allows to issue custom VkRenderPassBeginInfo structure
    * @param renderPassBeginInfo
@@ -98,6 +107,9 @@ public:
    */
   bool OnDestroy() override;
 
+  void SetScissor(Rect2D value);
+  void SetViewport(Viewport value);
+
   void Draw(
     uint32_t vertexCount,
     uint32_t instanceCount,
@@ -112,12 +124,12 @@ public:
     uint32_t firstInstance);
 
   void DrawIndexedIndirect(
-    Graphics::Buffer& buffer,
-    uint32_t          offset,
-    uint32_t          drawCount,
-    uint32_t          stride);
+    BufferImpl& buffer,
+    uint32_t    offset,
+    uint32_t    drawCount,
+    uint32_t    stride);
 
-  void ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& commandBuffers);
+  void ExecuteCommandBuffers(std::vector<vk::CommandBuffer>& commandBuffers);
 
 private:
   /**
@@ -134,14 +146,25 @@ private:
     const vk::CommandBufferAllocateInfo& allocateInfo,
     vk::CommandBuffer                    vulkanHandle);
 
+private: // Struct for deferring texture binding
+  struct DeferredTextureBinding
+  {
+    vk::ImageView imageView;
+    vk::Sampler   sampler;
+    uint32_t      binding;
+  };
+
 private:
-  CommandPool*                  mOwnerCommandPool;
-  Device*                       mGraphicsDevice;
-  uint32_t                      mPoolAllocationIndex;
-  vk::CommandBufferAllocateInfo mAllocateInfo{};
+  CommandPool*                        mOwnerCommandPool;
+  Device*                             mGraphicsDevice;
+  uint32_t                            mPoolAllocationIndex;
+  vk::CommandBufferAllocateInfo       mAllocateInfo{};
+  std::vector<DeferredTextureBinding> mDeferredTextureBindings;
 
   vk::CommandBuffer mCommandBuffer{};
 
+  Vulkan::ProgramImpl* mCurrentProgram{nullptr}; /// To test descriptor sets, will collide with other work
+
   bool mRecording{false};
 };
 
index 89043db2afb1745a68dd3f08261aa6214fbcfaff..a59eab518a40806d86e0805cd2a071fd339b3b56 100644 (file)
  * limitations under the License.
  */
 
+#include <dali/internal/graphics/vulkan-impl/vulkan-buffer-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-buffer.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-command-buffer.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-command-pool-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-framebuffer-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-graphics-controller.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-program-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-render-pass-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-render-pass.h>
 #include <dali/internal/graphics/vulkan/vulkan-device.h>
 
 namespace Dali::Graphics::Vulkan
 {
+template<typename VT, typename GT>
+VT* ConstGraphicsCast(const GT* object)
+{
+  return const_cast<VT*>(static_cast<const VT*>(object));
+}
+
 CommandBuffer::CommandBuffer(const Graphics::CommandBufferCreateInfo& createInfo, VulkanGraphicsController& controller)
 : CommandBufferResource(createInfo, controller),
   mCommandBufferImpl(nullptr)
@@ -60,7 +69,33 @@ void CommandBuffer::Begin(const Graphics::CommandBufferBeginInfo& info)
 {
   if(mCommandBufferImpl)
   {
-    mCommandBufferImpl->Begin(static_cast<vk::CommandBufferUsageFlags>(info.usage), nullptr);
+    // Check if there is some extra information about used resources
+    // if so then apply optimizations
+    if(info.resourceBindings)
+    {
+      // update programs with descriptor pools
+      for(auto& binding : *info.resourceBindings)
+      {
+        if(binding.type == ResourceType::PROGRAM)
+        {
+          auto programImpl = static_cast<Vulkan::Program*>(binding.programBinding->program)->GetImplementation();
+
+          // Pool index is returned and we may do something with it later (storing it per cmdbuf?)
+          [[maybe_unused]] auto poolIndex = programImpl->AddDescriptorPool(binding.programBinding->count, 3); // add new pool, limit pools to 3 per program
+        }
+      }
+    }
+
+    vk::CommandBufferInheritanceInfo inheritanceInfo{};
+    if(info.renderPass)
+    {
+      auto renderTarget                  = ConstGraphicsCast<Vulkan::RenderTarget, Graphics::RenderTarget>(info.renderTarget);
+      inheritanceInfo.renderPass         = renderTarget->GetRenderPass(info.renderPass)->GetVkHandle();
+      inheritanceInfo.subpass            = 0;
+      inheritanceInfo.queryFlags         = static_cast<vk::QueryControlFlags>(0);
+      inheritanceInfo.pipelineStatistics = static_cast<vk::QueryPipelineStatisticFlags>(0);
+    }
+    mCommandBufferImpl->Begin(static_cast<vk::CommandBufferUsageFlags>(info.usage), &inheritanceInfo);
   }
 }
 
@@ -82,13 +117,30 @@ void CommandBuffer::Reset()
 }
 
 void CommandBuffer::BindVertexBuffers(uint32_t                                    firstBinding,
-                                      const std::vector<const Graphics::Buffer*>& buffers,
+                                      const std::vector<const Graphics::Buffer*>& gfxBuffers,
                                       const std::vector<uint32_t>&                offsets)
 {
+  std::vector<BufferImpl*> buffers;
+  buffers.reserve(gfxBuffers.size());
+  for(auto& gfxBuffer : gfxBuffers)
+  {
+    buffers.push_back(ConstGraphicsCast<Buffer, Graphics::Buffer>(gfxBuffer)->GetImpl());
+  }
+  mCommandBufferImpl->BindVertexBuffers(firstBinding, buffers, offsets);
+}
+
+void CommandBuffer::BindIndexBuffer(const Graphics::Buffer& gfxBuffer,
+                                    uint32_t                offset,
+                                    Format                  format)
+{
+  auto indexBuffer = ConstGraphicsCast<Buffer, Graphics::Buffer>(&gfxBuffer);
+  DALI_ASSERT_DEBUG(indexBuffer && indexBuffer->GetImpl());
+  mCommandBufferImpl->BindIndexBuffer(*indexBuffer->GetImpl(), offset, format);
 }
 
 void CommandBuffer::BindUniformBuffers(const std::vector<UniformBufferBinding>& bindings)
 {
+  mCommandBufferImpl->BindUniformBuffers(bindings);
 }
 
 void CommandBuffer::BindPipeline(const Graphics::Pipeline& pipeline)
@@ -98,10 +150,12 @@ void CommandBuffer::BindPipeline(const Graphics::Pipeline& pipeline)
 
 void CommandBuffer::BindTextures(const std::vector<TextureBinding>& textureBindings)
 {
+  mCommandBufferImpl->BindTextures(textureBindings);
 }
 
 void CommandBuffer::BindSamplers(const std::vector<SamplerBinding>& samplerBindings)
 {
+  mCommandBufferImpl->BindSamplers(samplerBindings);
 }
 
 void CommandBuffer::BindPushConstants(void*    data,
@@ -110,12 +164,6 @@ void CommandBuffer::BindPushConstants(void*    data,
 {
 }
 
-void CommandBuffer::BindIndexBuffer(const Graphics::Buffer& buffer,
-                                    uint32_t                offset,
-                                    Format                  format)
-{
-}
-
 void CommandBuffer::BeginRenderPass(Graphics::RenderPass*          gfxRenderPass,
                                     Graphics::RenderTarget*        gfxRenderTarget,
                                     Rect2D                         renderArea,
@@ -175,8 +223,15 @@ void CommandBuffer::EndRenderPass(Graphics::SyncObject* syncObject)
   mCommandBufferImpl->EndRenderPass();
 }
 
-void CommandBuffer::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& commandBuffers)
+void CommandBuffer::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& gfxCommandBuffers)
 {
+  std::vector<vk::CommandBuffer> vkCommandBuffers;
+  vkCommandBuffers.reserve(gfxCommandBuffers.size());
+  for(auto& gfxCmdBuf : gfxCommandBuffers)
+  {
+    vkCommandBuffers.push_back(ConstGraphicsCast<CommandBuffer, Graphics::CommandBuffer>(gfxCmdBuf)->GetImpl()->GetVkHandle());
+  }
+  mCommandBufferImpl->ExecuteCommandBuffers(vkCommandBuffers);
 }
 
 void CommandBuffer::Draw(uint32_t vertexCount,
@@ -196,12 +251,14 @@ void CommandBuffer::DrawIndexed(uint32_t indexCount,
   mCommandBufferImpl->DrawIndexed(indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
 }
 
-void CommandBuffer::DrawIndexedIndirect(Graphics::Buffer& buffer,
+void CommandBuffer::DrawIndexedIndirect(Graphics::Buffer& gfxBuffer,
                                         uint32_t          offset,
                                         uint32_t          drawCount,
                                         uint32_t          stride)
 {
-  mCommandBufferImpl->DrawIndexedIndirect(buffer, offset, drawCount, stride);
+  auto buffer = ConstGraphicsCast<Buffer, Graphics::Buffer>(&gfxBuffer)->GetImpl();
+
+  mCommandBufferImpl->DrawIndexedIndirect(*buffer, offset, drawCount, stride);
 }
 
 void CommandBuffer::DrawNative(const DrawNativeInfo* drawInfo)
@@ -210,18 +267,25 @@ void CommandBuffer::DrawNative(const DrawNativeInfo* drawInfo)
 
 void CommandBuffer::SetScissor(Rect2D value)
 {
+  // @todo Vulkan accepts array of scissors... add to API
+  mCommandBufferImpl->SetScissor(value);
 }
 
 void CommandBuffer::SetScissorTestEnable(bool value)
 {
+  // Enabled by default. What does disabling test do?!
+  // Probably should force pipeline to not use dynamic scissor state
 }
 
 void CommandBuffer::SetViewport(Viewport value)
 {
+  mCommandBufferImpl->SetViewport(value);
 }
 
 void CommandBuffer::SetViewportEnable(bool value)
 {
+  // Enabled by default. What does disabling test do?!
+  // Probably should force pipeline to not use dynamic viewport state
 }
 
 void CommandBuffer::SetColorMask(bool enabled)
index 9d0dbe6626c76dd131c852a7b5006417e0039c2e..20b95d12d90e46f02169399fe6e90ac8db9c782b 100644 (file)
@@ -30,7 +30,6 @@ namespace Graphics
 {
 namespace Vulkan
 {
-
 Image* Image::New(Device& graphicsDevice, const vk::ImageCreateInfo& createInfo)
 {
   auto image = new Image(graphicsDevice, createInfo, nullptr);
@@ -94,7 +93,7 @@ void Image::AllocateAndBind(vk::MemoryPropertyFlags memoryProperties)
   mMemory = std::make_unique<MemoryImpl>(mDevice,
                                          size_t(requirements.size),
                                          size_t(requirements.alignment),
-                                         (memoryProperties & vk::MemoryPropertyFlagBits::eHostVisible) == vk::MemoryPropertyFlagBits::eHostVisible);
+                                         memoryProperties);
 
   auto allocateInfo = vk::MemoryAllocateInfo{}
                         .setMemoryTypeIndex(memoryTypeIndex)
@@ -274,8 +273,7 @@ bool Image::OnDestroy()
       auto allocator = &mDevice.GetAllocator();
       auto memory    = mMemory->ReleaseVkObject();
 
-      mDevice.DiscardResource([device, image, memory, allocator]()
-                              { DestroyVulkanResources(device, image, memory, allocator); });
+      mDevice.DiscardResource([device, image, memory, allocator]() { DestroyVulkanResources(device, image, memory, allocator); });
     }
   }
 
index fc1b3dfd500fb7cdfafae1e2d4778db7d713640e..83bcf5d7200d107584c4b7e55e6869cc46c56e2e 100644 (file)
 
 namespace Dali::Graphics::Vulkan
 {
-
-MemoryImpl::MemoryImpl(Device& device, size_t memSize, size_t memAlign, bool isHostVisible)
+MemoryImpl::MemoryImpl(Device& device, size_t memSize, size_t memAlign, vk::MemoryPropertyFlags memoryProperties)
 : mDevice(device),
   deviceMemory(nullptr),
   size(memSize),
   alignment(memAlign),
   mappedPtr(nullptr),
   mappedSize(0u),
-  hostVisible(isHostVisible)
+  mMemoryProperties(memoryProperties)
 {
 }
 
@@ -87,11 +86,16 @@ vk::DeviceMemory MemoryImpl::ReleaseVkObject()
 
 void MemoryImpl::Flush()
 {
-  vk::Result result = mDevice.GetLogicalDevice().flushMappedMemoryRanges({vk::MappedMemoryRange{}
-                                                                            .setSize(mappedSize)
-                                                                            .setMemory(deviceMemory)
-                                                                            .setOffset(0u)});
-  DALI_ASSERT_ALWAYS(result == vk::Result::eSuccess); // If it's out of memory, may as well crash.
+  // Don't flush if we are using host coherent memory - it's un-necessary
+  if((mMemoryProperties & vk::MemoryPropertyFlagBits::eHostCoherent) != vk::MemoryPropertyFlagBits::eHostCoherent)
+  {
+    vk::Result result = mDevice.GetLogicalDevice().flushMappedMemoryRanges({vk::MappedMemoryRange{}
+                                                                              .setSize(mappedSize ? mappedSize : VK_WHOLE_SIZE)
+                                                                              .setMemory(deviceMemory)
+                                                                              .setOffset(0u)});
+
+    DALI_ASSERT_ALWAYS(result == vk::Result::eSuccess); // If it's out of memory, may as well crash.
+  }
 }
 
 vk::DeviceMemory MemoryImpl::GetVkHandle() const
index 73e5f52bdc1c767cbe368f8a09c3110966816038..c9a2e47f1e7dd2fbe054f852e1ca80b16ecd9be8 100644 (file)
 
 namespace Dali::Graphics::Vulkan
 {
-
 class MemoryImpl
 {
 public:
-  MemoryImpl(Device& device, size_t memSize, size_t memAlign, bool hostVisible);
+  MemoryImpl(Device& device, size_t memSize, size_t memAlign, vk::MemoryPropertyFlags memoryProperties);
 
   ~MemoryImpl();
 
@@ -39,7 +38,7 @@ public:
   }
 
   // No copy constructor or assignment operator
-  MemoryImpl(MemoryImpl&)            = delete;
+  MemoryImpl(MemoryImpl&) = delete;
   MemoryImpl& operator=(MemoryImpl&) = delete;
 
   void* Map();
@@ -60,13 +59,13 @@ public:
   [[nodiscard]] vk::DeviceMemory GetVkHandle() const;
 
 private:
-  Device&          mDevice;
-  vk::DeviceMemory deviceMemory;
-  size_t           size;
-  size_t           alignment;
-  void*            mappedPtr;
-  size_t           mappedSize;
-  bool             hostVisible;
+  Device&                 mDevice;
+  vk::DeviceMemory        deviceMemory;
+  size_t                  size;
+  size_t                  alignment;
+  void*                   mappedPtr;
+  size_t                  mappedSize;
+  vk::MemoryPropertyFlags mMemoryProperties;
 };
 
 } // namespace Dali::Graphics::Vulkan
index 8bb63caadd6a36d547bbf6a62ec03c193fd76385..14be67635f3b430fa696f8885174fc173f8088c5 100644 (file)
@@ -261,10 +261,12 @@ void PipelineImpl::InitializePipeline()
   dynInfo.setDynamicStates(mDynamicStates);
   gfxPipelineInfo.setPDynamicState(&dynInfo);
 
-  auto& allocator   = mController.GetGraphicsDevice().GetAllocator();
-  auto  rtImpl      = static_cast<Vulkan::RenderTarget*>(mCreateInfo.renderTarget);
-  auto  framebuffer = rtImpl->GetFramebuffer();
-  auto  surface     = rtImpl->GetSurface();
+  auto& allocator = mController.GetGraphicsDevice().GetAllocator();
+
+  auto rtImpl = static_cast<Vulkan::RenderTarget*>(mCreateInfo.renderTarget);
+
+  auto framebuffer = rtImpl->GetFramebuffer();
+  auto surface     = rtImpl->GetSurface();
 
   FramebufferImpl* fbImpl = nullptr;
   if(surface)
@@ -319,6 +321,11 @@ void PipelineImpl::InitializePipeline()
   }
 }
 
+const Vulkan::Program* PipelineImpl::GetProgram() const
+{
+  return static_cast<const Vulkan::Program*>(mCreateInfo.programState->program);
+}
+
 void PipelineImpl::InitializeVertexInputState(vk::PipelineVertexInputStateCreateInfo& out)
 {
   std::vector<vk::VertexInputBindingDescription> bindings;
index 61d9731312b4961149f1ea20b2902b8224e0542b..1a978ade127814fe997813f96971b6f33e796066 100644 (file)
@@ -96,6 +96,8 @@ public:
 
   void InitializePipeline();
 
+  const Vulkan::Program* GetProgram() const;
+
 private:
   void InitializeVertexInputState(vk::PipelineVertexInputStateCreateInfo& out);
   void InitializeInputAssemblyState(vk::PipelineInputAssemblyStateCreateInfo& out) const;
index 0a6d8a67dfd903c6693573763f1bea481f7bf793..8679042348283879abe408e90ae45143b25a6730 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/internal/graphics/vulkan-impl/vulkan-reflection.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-shader-impl.h>
 #include <dali/internal/graphics/vulkan-impl/vulkan-shader.h>
+#include <dali/internal/graphics/vulkan/vulkan-device.h>
 
 // EXTERNAL HEADERS
 #include <iostream>
@@ -63,6 +64,15 @@ struct ProgramImpl::Impl
   std::unique_ptr<Vulkan::Reflection> reflection{nullptr};
 
   std::vector<vk::PipelineShaderStageCreateInfo> mPipelineShaderStageCreateInfoList;
+
+  struct DescriptorPool
+  {
+    vk::DescriptorPoolCreateInfo createInfo;
+    vk::DescriptorPool           vkPool;
+  };
+
+  std::vector<DescriptorPool> poolList;
+  int32_t                     currentPoolIndex{-1};
 };
 
 ProgramImpl::ProgramImpl(const Graphics::ProgramCreateInfo& createInfo, VulkanGraphicsController& controller)
@@ -249,4 +259,94 @@ const ProgramCreateInfo& ProgramImpl::GetCreateInfo() const
   return mImpl->mPipelineShaderStageCreateInfoList;
 }
 
+[[nodiscard]] int ProgramImpl::AddDescriptorPool(uint32_t poolCapacity, uint32_t maxPoolCounts)
+{
+  auto& poolList  = mImpl->poolList;
+  auto& poolIndex = mImpl->currentPoolIndex;
+  poolIndex %= maxPoolCounts;
+
+  auto& gfxDevice = mImpl->controller.GetGraphicsDevice();
+  auto& allocator = gfxDevice.GetAllocator();
+  auto  vkDevice  = gfxDevice.GetLogicalDevice();
+
+  if(poolCapacity != poolList.size())
+  {
+    poolList.resize(poolCapacity);
+    // should error if pool index exceeds pool capacity
+  }
+
+  // round-robin the pool index
+  Impl::DescriptorPool& descriptorPool = mImpl->poolList[poolIndex];
+
+  // if pool exists at index...
+  if(descriptorPool.vkPool)
+  {
+    // ...try to reuse the pool
+    if(descriptorPool.createInfo.maxSets >= poolCapacity)
+    {
+      vkDevice.resetDescriptorPool(descriptorPool.vkPool, vk::DescriptorPoolResetFlags{});
+      return poolIndex;
+    }
+
+    // ... else, destroy vulkan object
+    vkDevice.destroyDescriptorPool(descriptorPool.vkPool, &allocator);
+  }
+
+  descriptorPool.createInfo.setMaxSets(poolCapacity);
+  std::vector<vk::DescriptorPoolSize> poolSizes;
+
+  auto uniformBlockCount = GetReflection().GetUniformBlockCount();
+  auto samplersCount     = GetReflection().GetSamplers().size();
+
+  if(uniformBlockCount)
+  {
+    vk::DescriptorPoolSize item;
+    item.setType(vk::DescriptorType::eUniformBuffer);
+    item.setDescriptorCount(uniformBlockCount * poolCapacity);
+    poolSizes.emplace_back(item);
+  }
+  if(samplersCount) // For now, we use only combined image sampler type as 'sampler'
+  {
+    vk::DescriptorPoolSize item;
+    item.setType(vk::DescriptorType::eCombinedImageSampler);
+    item.setDescriptorCount(samplersCount * poolCapacity);
+    poolSizes.emplace_back(item);
+  }
+
+  // set sizes
+  descriptorPool.createInfo.setPoolSizes(poolSizes);
+
+  // create pool
+  VkAssert(vkDevice.createDescriptorPool(&descriptorPool.createInfo, &allocator, &descriptorPool.vkPool));
+
+  return poolIndex;
+}
+
+[[nodiscard]] vk::DescriptorSet ProgramImpl::AllocateDescriptorSet(int poolIndex)
+{
+  // if pool index isn't specified, last added pool will be used
+  if(poolIndex < 0)
+  {
+    poolIndex = mImpl->currentPoolIndex;
+  }
+
+  auto& poolList  = mImpl->poolList;
+  auto& gfxDevice = mImpl->controller.GetGraphicsDevice();
+  auto  vkDevice  = gfxDevice.GetLogicalDevice();
+
+  vk::DescriptorSetAllocateInfo allocateInfo;
+  allocateInfo.setDescriptorPool(poolList[poolIndex].vkPool);
+
+  auto& layouts = GetReflection().GetVkDescriptorSetLayouts();
+  allocateInfo.setSetLayouts(layouts);
+  // TODO: making sure only first layout will be use.
+  // Reflection supports multiple sets but current architecture of Vulkan backend
+  // uses single set only per pipeline/program
+  allocateInfo.setDescriptorSetCount(1);
+
+  vk::DescriptorSet set;
+  VkAssert(vkDevice.allocateDescriptorSets(&allocateInfo, &set));
+  return set;
+}
+
 }; // namespace Dali::Graphics::Vulkan
index cf59bf2828d70f33c32d285c2a28c178be0c8e7e..be7b09c8d5d2fa301688f09ffbc988d8b5ec8b1b 100644 (file)
@@ -142,6 +142,16 @@ public:
    */
   bool GetParameter(uint32_t parameterId, void* out);
 
+  /**
+   *
+   * @param[in] poolCapacity the capacity of pool
+   * @param maxPoolCounts number of pools, last added pool will be removed
+   * @return index of descriptor pool or -1 if unable to create pool
+   */
+  [[nodiscard]] int AddDescriptorPool(uint32_t poolCapacity, uint32_t maxPoolCounts);
+
+  [[nodiscard]] vk::DescriptorSet AllocateDescriptorSet(int poolIndex);
+
 private:
   friend class Program;
 
index 799d7dc44a65ff15de3bfdec3a1a176b32ab0455..0996f065b1cd879af9a8d388199e5995e0c1ab16 100644 (file)
@@ -309,6 +309,11 @@ vk::PipelineLayout Reflection::GetVkPipelineLayout() const
   return mVkPipelineLayout;
 }
 
+const std::vector<vk::DescriptorSetLayout>& Reflection::GetVkDescriptorSetLayouts() const
+{
+  return mVkDescriptorSetLayoutList;
+}
+
 void Reflection::BuildVertexAttributeReflection(SpvReflectShaderModule* spvModule)
 {
   std::vector<SpvReflectInterfaceVariable*> attrs;
index 4a45aff8e6f09defc22a298231f4a2f6859215b8..d761a155a033f349aa0ba8c17d59f8c43c3f59de 100644 (file)
@@ -206,6 +206,8 @@ public:
 
   vk::PipelineLayout GetVkPipelineLayout() const;
 
+  const std::vector<vk::DescriptorSetLayout>& GetVkDescriptorSetLayouts() const;
+
 protected:
   Reflection(Reflection&&) = default;
   Reflection& operator=(Reflection&&) = default;
@@ -229,7 +231,8 @@ private:
   std::vector<vk::DescriptorSetLayoutCreateInfo>           mVkDescriptorSetLayoutCreateInfoList; ///< List of DSlayout create structures
   std::vector<std::vector<vk::DescriptorSetLayoutBinding>> mVkDescriptorSetLayoutBindingList;
   std::vector<vk::DescriptorSetLayout>                     mVkDescriptorSetLayoutList;
-  vk::PipelineLayout                                       mVkPipelineLayout;
+
+  vk::PipelineLayout mVkPipelineLayout;
 };
 
 } // namespace Vulkan
index 822c44dbf9787d64e48fb29ea67728e196c7cf1a..0ea7a733ef8303c62e3c279f65839aae09730c5c 100644 (file)
  */
 
 // CLASS HEADER
-#include "vulkan-render-target.h"
+#include <dali/internal/graphics/vulkan-impl/vulkan-render-target.h>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
-#include "vulkan-framebuffer.h"
-#include "vulkan-graphics-controller.h"
+#include <dali/internal/graphics/vulkan-impl/vulkan-framebuffer-impl.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-framebuffer.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-graphics-controller.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-render-pass.h>
+#include <dali/internal/graphics/vulkan/vulkan-device.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
 
 namespace Dali::Graphics::Vulkan
 {
@@ -63,4 +67,27 @@ Integration::RenderSurfaceInterface* RenderTarget::GetSurface() const
   return mCreateInfo.surface;
 }
 
+Vulkan::RenderPassImpl* RenderTarget::GetRenderPass(const Graphics::RenderPass* gfxRenderPass) const
+{
+  auto renderPass = const_cast<Vulkan::RenderPass*>(static_cast<const Vulkan::RenderPass*>(gfxRenderPass));
+
+  auto framebuffer = GetFramebuffer();
+  auto surface     = GetSurface();
+
+  FramebufferImpl* fbImpl = nullptr;
+  if(surface)
+  {
+    auto& gfxDevice = mController.GetGraphicsDevice();
+    auto  surfaceId = static_cast<Internal::Adaptor::WindowRenderSurface*>(surface)->GetSurfaceId();
+    auto  swapchain = gfxDevice.GetSwapchainForSurfaceId(surfaceId);
+    fbImpl          = swapchain->GetCurrentFramebuffer();
+  }
+  else if(framebuffer)
+  {
+    fbImpl = framebuffer->GetImpl();
+  }
+
+  return fbImpl->GetRenderPass(renderPass);
+}
+
 } // namespace Dali::Graphics::Vulkan
index 72392b7d8ce0f5a5895c13607687f72c928235a9..3002a3abf14d71c385b0c969493e9552f9b2ab4e 100644 (file)
@@ -28,6 +28,7 @@ namespace Dali::Graphics::Vulkan
 {
 class Framebuffer;
 class Surface;
+class RenderPassImpl;
 
 using RenderTargetResource = Resource<Graphics::RenderTarget, Graphics::RenderTargetCreateInfo>;
 
@@ -69,6 +70,12 @@ public:
    */
   [[nodiscard]] Integration::RenderSurfaceInterface* GetSurface() const;
 
+  /**
+   * Find a matching render pass for this render target
+   * @param[in] renderPass A render pass to search for
+   * @return a matching render pass implementation from the current framebuffer
+   */
+  [[nodiscard]] Vulkan::RenderPassImpl* GetRenderPass(const Graphics::RenderPass* renderPass) const;
   // Get Swapchain?
 
 private:
index bf881da610c263b1b77986960de3482971d5bb31..ffc2b5b8da220339c8ce9fa7435c98eed04b0547 100644 (file)
 
 // INTERNAL INCLUDES
 #include <dali/internal/graphics/vulkan-impl/vulkan-graphics-controller.h>
+#include <dali/internal/graphics/vulkan-impl/vulkan-sampler-impl.h>
 
 namespace Dali::Graphics::Vulkan
 {
+
+namespace
+{
+constexpr vk::Filter ConvertFilter(Dali::Graphics::SamplerFilter filter)
+{
+  switch(filter)
+  {
+    case Dali::Graphics::SamplerFilter::LINEAR:
+      return vk::Filter::eLinear;
+    case Dali::Graphics::SamplerFilter::NEAREST:
+      return vk::Filter::eNearest;
+  }
+  return vk::Filter{};
+}
+
+constexpr vk::SamplerAddressMode ConvertAddressMode(Dali::Graphics::SamplerAddressMode mode)
+{
+  switch(mode)
+  {
+    case Dali::Graphics::SamplerAddressMode::CLAMP_TO_EDGE:
+      return vk::SamplerAddressMode::eClampToEdge;
+    case Dali::Graphics::SamplerAddressMode::CLAMP_TO_BORDER:
+      return vk::SamplerAddressMode::eClampToBorder;
+    case Dali::Graphics::SamplerAddressMode::MIRROR_CLAMP_TO_EDGE:
+      return vk::SamplerAddressMode::eMirrorClampToEdge;
+    case Dali::Graphics::SamplerAddressMode::MIRRORED_REPEAT:
+      return vk::SamplerAddressMode::eMirroredRepeat;
+    case Dali::Graphics::SamplerAddressMode::REPEAT:
+      return vk::SamplerAddressMode::eRepeat;
+  }
+  return vk::SamplerAddressMode{};
+}
+
+constexpr vk::SamplerMipmapMode ConvertMipmapMode(Dali::Graphics::SamplerMipmapMode mode)
+{
+  switch(mode)
+  {
+    case Dali::Graphics::SamplerMipmapMode::NONE:
+      return vk::SamplerMipmapMode::eNearest;
+    case Dali::Graphics::SamplerMipmapMode::LINEAR:
+      return vk::SamplerMipmapMode::eLinear;
+    case Dali::Graphics::SamplerMipmapMode::NEAREST:
+      return vk::SamplerMipmapMode::eNearest;
+  }
+  return vk::SamplerMipmapMode{};
+}
+
+} // namespace
+
 Sampler::Sampler(const Graphics::SamplerCreateInfo& createInfo, VulkanGraphicsController& controller)
 : SamplerResource(createInfo, controller)
 {
@@ -37,6 +87,23 @@ void Sampler::DestroyResource()
 
 bool Sampler::InitializeResource()
 {
+  vk::SamplerCreateInfo createInfo{};
+  createInfo.setMinFilter(ConvertFilter(mCreateInfo.minFilter))
+    .setMagFilter(ConvertFilter(mCreateInfo.magFilter))
+    .setAddressModeU(ConvertAddressMode(mCreateInfo.addressModeU))
+    .setAddressModeV(ConvertAddressMode(mCreateInfo.addressModeV))
+    .setAddressModeW(ConvertAddressMode(mCreateInfo.addressModeW))
+    .setMipmapMode(ConvertMipmapMode(mCreateInfo.mipMapMode))
+    .setCompareEnable(vk::Bool32(mCreateInfo.compareEnable))
+    .setUnnormalizedCoordinates(vk::Bool32(mCreateInfo.unnormalizeCoordinates))
+    .setBorderColor(vk::BorderColor::eFloatOpaqueBlack)
+    .setAnisotropyEnable(vk::Bool32(mCreateInfo.anisotropyEnable))
+    .setMaxAnisotropy(mCreateInfo.maxAnisotropy)
+    .setMinLod(mCreateInfo.minLod)
+    .setMaxLod(mCreateInfo.maxLod);
+
+  mSamplerImpl = SamplerImpl::New(mController.GetGraphicsDevice(), createInfo);
+
   return true;
 }
 
index d575b050379e9e800e8162e9a07c29662d335fb7..ac42ac0d9044b4c6469eaa19857aa8c7e94aac83 100644 (file)
@@ -28,6 +28,7 @@
 namespace Dali::Graphics::Vulkan
 {
 using SamplerResource = Resource<Graphics::Sampler, Graphics::SamplerCreateInfo>;
+class SamplerImpl;
 
 class Sampler : public SamplerResource
 {
@@ -60,6 +61,14 @@ public:
    * @brief Called when UniquePtr<> on client-side dies
    */
   void DiscardResource() override;
+
+  SamplerImpl* GetImpl()
+  {
+    return mSamplerImpl;
+  }
+
+private:
+  SamplerImpl* mSamplerImpl;
 };
 
 } // namespace Dali::Graphics::Vulkan
index 82df35f5657ba0033250244d73d161bd37dc8463..4c13e7053d2c795f0d31fb9c8998f3bc1135813d 100644 (file)
@@ -540,6 +540,15 @@ int WindowBaseAndroid::GetBackgroundBlur()
   return 0;
 }
 
+void WindowBaseAndroid::SetBehindBlur(int blurRadius)
+{
+}
+
+int WindowBaseAndroid::GetBehindBlur()
+{
+  return 0;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 83ce26b0cf21a2e284ca96f1a82bc7b69c267a91..f9c4e4d5504d7271b2e343ac2f82ddf133b95b44 100644 (file)
@@ -554,17 +554,26 @@ public:
    */
   bool RelativeMotionUnGrab() override;
 
-/**
+  /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBackgroundBlur()
    */
   void SetBackgroundBlur(int blurRadius, int cornerRadius) override;
 
-
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBackgroundBlur()
    */
   int GetBackgroundBlur() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBehindBlur()
+   */
+  void SetBehindBlur(int blurRadius) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBehindBlur()
+   */
+  int GetBehindBlur() override;
+
 private:
   /**
    * Second stage initialization
index 2a6eff8e084847c86157a548e9bca019fa36f618..7a7ff25dfb1aee7d11812215e52b8fcffc7e1cfc 100644 (file)
@@ -617,8 +617,8 @@ public:
    * @brief Set the window's background blur.
    * If this value is 0, the background blur is disabled.
    *
-   * @param[in] blurRadius the background blur.
-   * @param[in] cornerRadius the background blur.
+   * @param[in] blurRadius The radius of the blur effect.
+   * @param[in] cornerRadius The radius of the corner radius.
    */
   virtual void SetBackgroundBlur(int blurRadius, int cornerRadius) = 0;
 
@@ -630,6 +630,22 @@ public:
    */
   virtual int GetBackgroundBlur() = 0;
 
+  /**
+   * @brief Set the window's behind blur.
+   * If this value is 0, the behind blur is disabled.
+   *
+   * @param[in] blurRadius The radius of the blur effect.
+   */
+  virtual void SetBehindBlur(int blurRadius) = 0;
+
+  /**
+   * @brief Returns current behind blur.
+   * If this value is 0, behind blur is disabled.
+   *
+   * @return current behind blur.
+   */
+  virtual int GetBehindBlur() = 0;
+
   // Signals
 
   /**
index 3fce651f90527d6e96b92dde1ca08be3b8c00126..2ff068ec7de17fdd4a56e63a4129b4b69d9eb5b1 100644 (file)
@@ -1329,7 +1329,8 @@ bool Window::OnAccessibilityInterceptKeyEvent(const Dali::KeyEvent& keyEvent)
     return false;
   }
 
-  auto callback = [handle = Dali::Window(this)](Dali::KeyEvent keyEvent, bool consumed) {
+  auto callback = [handle = Dali::Window(this)](Dali::KeyEvent keyEvent, bool consumed)
+  {
     if(!consumed)
     {
       Dali::DevelKeyEvent::SetNoInterceptModifier(keyEvent, true);
@@ -1675,13 +1676,16 @@ void Window::SetBlur(const WindowBlurInfo& blurInfo)
 
   if(mBlurInfo.windowBlurType == WindowBlurType::BACKGROUND)
   {
-    mWindowBase->SetBackgroundBlur(mBlurInfo.windowBlurRadius, mBlurInfo.backgroundBlurRadius);
+    mWindowBase->SetBackgroundBlur(mBlurInfo.windowBlurRadius, mBlurInfo.backgroundCornerRadius);
+  }
+  else if(mBlurInfo.windowBlurType == WindowBlurType::BEHIND)
+  {
+    mWindowBase->SetBehindBlur(mBlurInfo.windowBlurRadius);
   }
   else
   {
     mWindowBase->SetBackgroundBlur(0, 0);
   }
-  // TODO : When new Blur type is append, it will be added
 }
 
 WindowBlurInfo Window::GetBlur() const
index df3bb5266598812bcfc270cf68ae8e73fe4333c9..190286fd4284e96db69ddd4161710fc48b91e1cf 100644 (file)
@@ -58,7 +58,7 @@ public:
   std::string GetNativeWindowResourceId() override;
 
   /**
-  * @copydoc Dali::Internal::Adaptor::WindowBase::CreateWindow()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::CreateWindow()
    */
   Dali::Any CreateWindow(int width, int height) override;
 
@@ -498,6 +498,16 @@ public:
    */
   int GetBackgroundBlur() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBehindBlur()
+   */
+  void SetBehindBlur(int blurRadius) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBehindBlur()
+   */
+  int GetBehindBlur() override;
+
 private:
   // Undefined
   WindowBaseCocoa(const WindowBaseCocoa&) = delete;
index ecae8fee73d2aa9107a9f68ce640a13252bce757..303ddf2ad8f40f66adacff5d9d079dd0d1353023 100644 (file)
@@ -848,6 +848,15 @@ int WindowBaseCocoa::GetBackgroundBlur()
   return 0;
 }
 
+void WindowBaseCocoa::SetBehindBlur(int blurRadius)
+{
+}
+
+int WindowBaseCocoa::GetBehindBlur()
+{
+  return 0;
+}
+
 } // namespace Dali::Internal::Adaptor
 
 @implementation CocoaView
index ae99a46e6b25aef92e14b0c7ad8945207e24237a..343347c92d09b4665d02e6ad69b222f645b826b3 100644 (file)
@@ -3736,6 +3736,21 @@ int WindowBaseEcoreWl2::GetBackgroundBlur()
   return radius;
 }
 
+void WindowBaseEcoreWl2::SetBehindBlur(int blurRadius)
+{
+  DALI_LOG_RELEASE_INFO("ecore_wl2_window_behind_blur_set, window: [%p], blur radius [%d]\n", mEcoreWindow, blurRadius);
+  START_DURATION_CHECK();
+  ecore_wl2_window_behind_blur_set(mEcoreWindow, blurRadius);
+  FINISH_DURATION_CHECK("ecore_wl2_window_behind_blur_set");
+}
+
+int WindowBaseEcoreWl2::GetBehindBlur()
+{
+  int radius = ecore_wl2_window_behind_blur_get(mEcoreWindow);
+  DALI_LOG_RELEASE_INFO("ecore_wl2_window_behind_blur_get, window: [%p], radius [%d]\n", mEcoreWindow, radius);
+  return radius;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 413801203f0627d6d08582c5cf70070cc180bf53..dd0d137aef639ec9c9814b8419b35d59fa5b1ee8 100644 (file)
@@ -707,6 +707,16 @@ public:
    */
   int GetBackgroundBlur() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBehindBlur()
+   */
+  void SetBehindBlur(int blurRadius) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBehindBlur()
+   */
+  int GetBehindBlur() override;
+
 private:
   /**
    * Second stage initialization
index 15ce844a7b0d9c69a72c171042572230cb578c5b..a1a434587fbfd52afa0674c22c2614217468c84d 100644 (file)
@@ -1139,6 +1139,15 @@ int WindowBaseEcoreX::GetBackgroundBlur()
   return 0;
 }
 
+void WindowBaseEcoreX::SetBehindBlur(int blurRadius)
+{
+}
+
+int WindowBaseEcoreX::GetBehindBlur()
+{
+  return 0;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index f701e4069be85414c50f538b96c4bdf95310ea73..fb68356a3359cb0aad2e4332a08306e117bfc673 100644 (file)
@@ -569,6 +569,15 @@ public:
    */
   int GetBackgroundBlur() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBehindBlur()
+   */
+  void SetBehindBlur(int blurRadius) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBehindBlur()
+   */
+  int GetBehindBlur() override;
 private:
   /**
    * Second stage initialization
index 14f606661ea14dd1b439d2a526d658d9ab6797ce..f42bd1e6dd581e611816eb95e98e5119d5431159 100644 (file)
@@ -768,6 +768,15 @@ int WindowBaseWin::GetBackgroundBlur()
   return 0;
 }
 
+void WindowBaseWin::SetBehindBlur(int blurRadius)
+{
+}
+
+int WindowBaseWin::GetBehindBlur()
+{
+  return 0;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 60d0097a0de7706813bc027e5d59a5981f34c255..dff49ac5bd91cc7abdfda839decbeee4517677cd 100644 (file)
@@ -551,6 +551,15 @@ public:
    */
   int GetBackgroundBlur() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBehindBlur()
+   */
+  void SetBehindBlur(int blurRadius) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBehindBlur()
+   */
+  int GetBehindBlur() override;
 private:
   /**
    * Second stage initialization
index a10fbd27fd39f83dd904199446239bf39db8f785..7ff6b7fec4944b3e66bb5a61c3099496291a20f6 100644 (file)
@@ -1073,6 +1073,15 @@ int WindowBaseX::GetBackgroundBlur()
   return 0;
 }
 
+void WindowBaseX::SetBehindBlur(int blurRadius)
+{
+}
+
+int WindowBaseX::GetBehindBlur()
+{
+  return 0;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 9b4792a6ef71d284f9c9797650bd7f2ca03e4b28..004bc3d233dbb2eed687dc377b1d0978dcaf3a10 100644 (file)
@@ -574,6 +574,15 @@ public:
    */
   int GetBackgroundBlur() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBehindBlur()
+   */
+  void SetBehindBlur(int blurRadius) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBehindBlur()
+   */
+  int GetBehindBlur() override;
 private:
   /**
    * Second stage initialization
index 7ee8ba0931872d2195e1de548463835297e9a9c7..dfdae00857547918a16ea488bf7f370388232c77 100644 (file)
@@ -155,8 +155,7 @@ enum class WindowBlurType
 {
   NONE = 0,   ///< default value for blur disable
   BACKGROUND, ///< the window's background
-  // BEHIND,  ///< the window's behind except background
-  // BOTH,    ///< both window's background and behind
+  BEHIND,     ///< the window's behind except background
 };
 
 } // namespace Dali
index 17a3257d7cbe27a07b11bce6573625cdaa3dc96b..8746f8224f269c1a5afaa8c21bbdb41ce0f26456 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 {
 const unsigned int ADAPTOR_MAJOR_VERSION = 2;
 const unsigned int ADAPTOR_MINOR_VERSION = 3;
-const unsigned int ADAPTOR_MICRO_VERSION = 41;
+const unsigned int ADAPTOR_MICRO_VERSION = 42;
 const char* const  ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 8ab66d1c637a055bdea9ad69a86fba047ee14dd5..e251dffc379640d954b2ff4e35dc9c7ae5faa613 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali2-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    2.3.41
+Version:    2.3.42
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT