# 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})
+
+ SET(DALI_CFLAGS ${DALI_CFLAGS} ${GLSLANG_CFLAGS} )
ENDIF()
IF(LIBUV_X11_PROFILE)
-DFONT_CONFIGURATION_FILE="${fontConfigurationFile}"
-DTIZEN_PLATFORM_CONFIG_SUPPORTED=${tizenPlatformConfigSupported}
)
+
+
+MESSAGE(STATUS "DALI_CFLAGS: ${DALI_CFLAGS}")
auto swapchain = device.GetSwapchainForSurfaceId(surfaceId);
mLastSwapchain = swapchain;
framebuffer = swapchain->GetCurrentFramebuffer();
- renderPassImpl = framebuffer->GetRenderPass(renderPass);
+ renderPassImpl = framebuffer->GetImplFromRenderPass(renderPass);
}
else
{
auto coreFramebuffer = renderTarget->GetFramebuffer();
framebuffer = coreFramebuffer->GetImpl();
- renderPassImpl = framebuffer->GetRenderPass(renderPass);
+ renderPassImpl = framebuffer->GetImplFromRenderPass(renderPass);
}
std::vector<vk::ClearValue> vkClearValues;
// Flag that indicates if the render pass is externally provided
if(renderPass == nullptr)
{
- // Create compatible render pass
+ // Create compatible vulkan render pass
renderPass = RenderPassImpl::New(device, colorAttachments, depthAttachment);
}
attachments.reserve(colorAttachments.size());
return nullptr;
}
-RenderPassImpl* FramebufferImpl::GetRenderPass(RenderPass* renderPass)
+RenderPassImpl* FramebufferImpl::GetImplFromRenderPass(RenderPass* renderPass)
{
auto attachments = renderPass->GetCreateInfo().attachments;
auto matchLoadOp = attachments->front().loadOp;
}
// @todo create new render pass from existing + load/store op, add it to mRenderPasses, and return it.
-
+ // @todo Need to reconsider swapchain/fbo/renderpass creation model.
+ // This framebuffer may belong to a swapchain, in which case, there are multiple framebuffers
+ // that could share render passes.
+ // A) Need to detect this situation - keep owner info?
+ // B) Sharing render passes means we
+ // 1) need to ref-count to ensure safe ownership, or
+ // 2) move ownership of renderpass to swapchain.
+ // Onus is on client to determine which interface to use, if it's a surface, use swapchain;
+ // if it's an offscreen, use framebuffer. (Kinda need a core interface to wrap surface/offscreen)
return mRenderPasses[0].renderPassImpl;
}
[[nodiscard]] uint32_t GetAttachmentCount(AttachmentType type) const;
- [[nodiscard]] RenderPassImpl* GetRenderPass(RenderPass* renderPass); // May mutate mRenderPasses
+ [[nodiscard]] RenderPassImpl* GetImplFromRenderPass(RenderPass* renderPass); // May mutate mRenderPasses
[[nodiscard]] RenderPassImpl* GetRenderPass(uint32_t index) const;
fbImpl = framebuffer->GetImpl();
}
- return fbImpl->GetRenderPass(renderPass);
+ return fbImpl->GetImplFromRenderPass(renderPass);
}
} // namespace Dali::Graphics::Vulkan
auto presentModes = surface->GetSurfacePresentModes();
auto found = std::find_if(presentModes.begin(),
presentModes.end(),
- [&](vk::PresentModeKHR mode)
- {
+ [&](vk::PresentModeKHR mode) {
return presentMode == mode;
});
//
// CREATE FRAMEBUFFERS
//
+ RenderPassImpl* compatibleRenderPass = nullptr;
for(auto&& image : images)
{
auto colorImage = mGraphicsDevice.CreateImageFromExternal(image,
true); // presentable
mFramebuffers.push_back(FramebufferImpl::New(mGraphicsDevice,
- nullptr,
+ compatibleRenderPass,
{colorAttachment},
nullptr,
mSwapchainCreateInfoKHR.imageExtent.width,
mSwapchainCreateInfoKHR.imageExtent.height));
+
+ if(compatibleRenderPass == nullptr)
+ {
+ // use common renderpass for all framebuffers.
+ // @todo Swapchain should own _these_ renderpasses, not framebuffer.
+ // @todo fix renderpass ownership model
+ compatibleRenderPass = mFramebuffers.back()->GetRenderPass(0);
+ }
}
mIsValid = true;
}
auto swapchain = mSwapchainKHR;
auto allocator = &mGraphicsDevice.GetAllocator();
- mGraphicsDevice.DiscardResource([device, swapchain, allocator]()
- {
+ mGraphicsDevice.DiscardResource([device, swapchain, allocator]() {
DALI_LOG_INFO(gVulkanFilter, Debug::General, "Invoking deleter function: swap chain->%p\n", static_cast<VkSwapchainKHR>(swapchain))
device.destroySwapchainKHR(swapchain, allocator); });
// Create methods -----------------------------------------------------------------------------------------------
void Device::Create()
{
- auto extensions = PrepareDefaultInstanceExtensions();
- auto layers = vk::enumerateInstanceLayerProperties();
+ auto extensions = PrepareDefaultInstanceExtensions();
+ auto instanceLayers = vk::enumerateInstanceLayerProperties();
std::vector<const char*> validationLayers;
- for(auto&& reqLayer : reqLayers)
+ if(!instanceLayers.value.empty())
{
- for(auto&& prop : layers.value)
+ for(auto&& prop : instanceLayers.value)
{
DALI_LOG_STREAM(gVulkanFilter, Debug::General, prop.layerName);
- if(std::string(prop.layerName) == reqLayer)
+ for(auto&& reqLayer : reqLayers)
{
- validationLayers.push_back(reqLayer);
+ if(std::string(prop.layerName) == reqLayer)
+ {
+ validationLayers.push_back(reqLayer);
+ }
}
}
}