]> git.seodisparate.com - blue_noise_generation/commitdiff
WIP vulkan compute: create command pool
authorStephen Seo <seo.disparate@gmail.com>
Wed, 20 Mar 2024 05:29:48 +0000 (14:29 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 20 Mar 2024 05:29:48 +0000 (14:29 +0900)
src/blue_noise.cpp

index b90dcc1364fe09b1f0f332e2928bdf599d2114c2..3bb236195a8c0e25abdf9a8289f32f27e48a11ef 100644 (file)
@@ -425,6 +425,25 @@ image::Bl dither::blue_noise(int width, int height, int threads,
           },
           &compute_pipeline);
     }
+
+    VkCommandPool command_pool;
+    {
+      VkCommandPoolCreateInfo pool_info{};
+      pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
+      pool_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
+      pool_info.queueFamilyIndex = indices.computeFamily.value();
+
+      if (vkCreateCommandPool(device, &pool_info, nullptr, &command_pool) !=
+          VK_SUCCESS) {
+        std::clog << "WARNING: Failed to create vulkan command pool!\n";
+        goto ENDOF_VULKAN;
+      }
+    }
+    utility::Cleanup cleanup_command_pool(
+        [device](void *ptr) {
+          vkDestroyCommandPool(device, *((VkCommandPool *)ptr), nullptr);
+        },
+        &command_pool);
   }
 ENDOF_VULKAN:
   std::clog << "TODO: Remove this once Vulkan support is implemented.\n";