@@ -158,6 +158,23 @@ bool initialize(android_app* app) {
158158 LOGI (" \t allowed transforms: %x\n " , surfaceCapabilities.supportedTransforms );
159159 LOGI (" \t composite alpha flags: %u\n " , surfaceCapabilities.currentTransform );
160160
161+ // Find a GFX queue family
162+ uint32_t queueFamilyCount;
163+ vkGetPhysicalDeviceQueueFamilyProperties (tutorialGpu, &queueFamilyCount, nullptr );
164+ assert (queueFamilyCount);
165+ std::vector<VkQueueFamilyProperties> queueFamilyProperties (queueFamilyCount);
166+ vkGetPhysicalDeviceQueueFamilyProperties (tutorialGpu, &queueFamilyCount,
167+ queueFamilyProperties.data ());
168+
169+ uint32_t queueFamilyIndex;
170+ for (queueFamilyIndex=0 ; queueFamilyIndex < queueFamilyCount;
171+ queueFamilyIndex++) {
172+ if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
173+ break ;
174+ }
175+ }
176+ assert (queueFamilyIndex < queueFamilyCount);
177+
161178 // Create a logical device from GPU we picked
162179 float priorities[] = {
163180 1 .0f ,
@@ -167,7 +184,7 @@ bool initialize(android_app* app) {
167184 .pNext = nullptr ,
168185 .flags = 0 ,
169186 .queueCount = 1 ,
170- .queueFamilyIndex = 0 ,
187+ .queueFamilyIndex = queueFamilyIndex ,
171188 // Send nullptr for queue priority so debug extension could
172189 // catch the bug and call back app's debug function
173190 .pQueuePriorities = nullptr , // priorities,
0 commit comments