Skip to content

Commit

Permalink
Implement command buffer pool
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan committed Jul 18, 2024
1 parent 7ccd858 commit ee475d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions flutter/shell/platform/tizen/tizen_renderer_vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ bool TizenRendererVulkan::CreateLogicalDevice() {
return true;
}

bool TizenRendererVulkan::CreateCommandPool() {
// --------------------------------------------------------------------------
// Create sync primitives and command pool to use in the render loop
// callbacks.
// --------------------------------------------------------------------------

VkFenceCreateInfo f_info{};
f_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
vkCreateFence(logical_device_, &f_info, nullptr, &image_ready_fence_);

VkSemaphoreCreateInfo s_info{};
s_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
vkCreateSemaphore(logical_device_, &s_info, nullptr,
&present_transition_semaphore_);

VkCommandPoolCreateInfo pool_info{};
pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
pool_info.queueFamilyIndex = graphics_queue_family_index_;
vkCreateCommandPool(logical_device_, &pool_info, nullptr,
&swapchain_command_pool_);
return false;
}

bool TizenRendererVulkan::InitializeSwapchain() {
// --------------------------------------------------------------------------
// Choose an image format that can be presented to the surface, preferring
Expand Down
3 changes: 3 additions & 0 deletions flutter/shell/platform/tizen/tizen_renderer_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class TizenRendererVulkan : public TizenRenderer {
VK_PRESENT_MODE_FIFO_KHR;
bool CreateInstance();
bool CreateLogicalDevice();
bool CreateCommandPool();
void Cleanup();
bool CheckValidationLayerSupport();
bool GetRequiredExtensions(std::vector<const char*>& extensions);
Expand All @@ -65,6 +66,8 @@ class TizenRendererVulkan : public TizenRenderer {
VkQueue graphics_queue_;
VkSurfaceKHR surface_;
VkSurfaceFormatKHR surface_format_;
VkSemaphore present_transition_semaphore_;
VkFence image_ready_fence_;
VkSwapchainKHR swapchain_;
VkCommandPool swapchain_command_pool_;
std::vector<VkImage> swapchain_images_;
Expand Down

0 comments on commit ee475d8

Please sign in to comment.