find required queues
This commit is contained in:
parent
f48c8cd2cc
commit
928ed19586
1 changed files with 20 additions and 0 deletions
20
main.cpp
20
main.cpp
|
|
@ -36,6 +36,7 @@ private:
|
|||
void initVulkan() {
|
||||
createInstance();
|
||||
pickPhysicalDevice();
|
||||
findPhysicalDeviceQueueFamilies();
|
||||
}
|
||||
|
||||
void mainLoop() {
|
||||
|
|
@ -138,11 +139,30 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
void findPhysicalDeviceQueueFamilies() {
|
||||
uint32_t queuesCount = 0;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queuesCount, nullptr);
|
||||
|
||||
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queuesCount);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queuesCount, queueFamilyProperties.data());
|
||||
|
||||
int index = 0;
|
||||
for (const auto& familyProperty : queueFamilyProperties) {
|
||||
if (familyProperty.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
graphicsQueueFamilyIndex = index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == -1) throw std::runtime_error("nu require queue families found");
|
||||
}
|
||||
|
||||
private:
|
||||
GLFWwindow* window = nullptr;
|
||||
|
||||
VkInstance instance = VK_NULL_HANDLE;
|
||||
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
|
||||
uint32_t graphicsQueueFamilyIndex = -1;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue