grab the first available queue, not the last

This commit is contained in:
nek0 2022-07-12 16:59:39 +02:00
parent 8fef9a4830
commit 857c87f370

View file

@ -7,7 +7,7 @@ import Control.Monad
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Resource
import qualified Data.Vector as V
import Data.Maybe (fromMaybe)
import Data.Maybe (fromMaybe, isNothing)
import Data.Bits
import Foreign.C.Types (CInt)
import Linear
@ -68,7 +68,7 @@ createLogicalDevice physDevice surface = do
let graphicsQueueFamilies = V.foldl
(\acc (index, queueFamily) ->
if Vk.queueFlags queueFamily .&. Vk.QUEUE_GRAPHICS_BIT /= zeroBits
if Vk.queueFlags queueFamily .&. Vk.QUEUE_GRAPHICS_BIT /= zeroBits && isNothing acc
then Just index
else acc
)