QueueFamilyIndices struct: fn definitions in .cpp

Instead of defining struct functions in header file, only declare them
in the header file and define them in the source file.
This commit is contained in:
Stephen Seo 2024-03-22 17:03:56 +09:00
parent 16f0e0e865
commit ea66a44238
2 changed files with 8 additions and 2 deletions

View file

@ -33,6 +33,12 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL fn_VULKAN_DEBUG_CALLBACK(
} }
#endif // VULKAN_VALIDATION == 1 #endif // VULKAN_VALIDATION == 1
dither::internal::QueueFamilyIndices::QueueFamilyIndices() : computeFamily() {}
bool dither::internal::QueueFamilyIndices::isComplete() {
return computeFamily.has_value();
}
dither::internal::QueueFamilyIndices dither::internal::QueueFamilyIndices
dither::internal::vulkan_find_queue_families(VkPhysicalDevice device) { dither::internal::vulkan_find_queue_families(VkPhysicalDevice device) {
QueueFamilyIndices indices; QueueFamilyIndices indices;

View file

@ -39,11 +39,11 @@ std::vector<unsigned int> blue_noise_impl(int width, int height,
#if DITHERING_VULKAN_ENABLED == 1 #if DITHERING_VULKAN_ENABLED == 1
struct QueueFamilyIndices { struct QueueFamilyIndices {
QueueFamilyIndices() : computeFamily() {} QueueFamilyIndices();
std::optional<uint32_t> computeFamily; std::optional<uint32_t> computeFamily;
bool isComplete() { return computeFamily.has_value(); } bool isComplete();
}; };
QueueFamilyIndices vulkan_find_queue_families(VkPhysicalDevice device); QueueFamilyIndices vulkan_find_queue_families(VkPhysicalDevice device);