This commit is contained in:
nek0 2023-01-07 00:14:39 +01:00
parent 206b331d19
commit 341260b2cd
3 changed files with 7 additions and 3 deletions

View file

@ -36,6 +36,7 @@
]) ++ (with pkgs; [ ]) ++ (with pkgs; [
shaderc shaderc
]); ]);
SDL_VULKAN_LIBRARY = "${pkgs.vulkan-loader}/lib/libvulkan.so";
}; };
#devShell = pkgs.mkShell { #devShell = pkgs.mkShell {
# buildInputs = with haskellPackages; [ # buildInputs = with haskellPackages; [

View file

@ -37,7 +37,7 @@ initEngine
initEngine = do initEngine = do
-- initialize SDL2 with all subsystems -- initialize SDL2 with all subsystems
void $ allocate_ void $ allocate_
SDL.initializeAll (SDL.initialize [ SDL.InitVideo ])
(do (do
putStrLn "This is the end!" putStrLn "This is the end!"
SDL.quit SDL.quit

View file

@ -14,8 +14,9 @@ import qualified Vulkan.Zero as Vk
createInstance :: MonadResource m => SDL.Window -> m Vk.Instance createInstance :: MonadResource m => SDL.Window -> m Vk.Instance
createInstance window = do createInstance window = do
windowExtensions <- liftIO $ fmap (Vk.EXT_DEBUG_UTILS_EXTENSION_NAME :) $ windowExtensions <-
traverse BS.packCString =<< SDL.vkGetInstanceExtensions window (++) [Vk.KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, Vk.EXT_DEBUG_UTILS_EXTENSION_NAME] <$>
((liftIO . mapM BS.packCString) =<< SDL.vkGetInstanceExtensions window)
liftIO $ do liftIO $ do
putStrLn "activating followinfg extensions:" putStrLn "activating followinfg extensions:"
print windowExtensions print windowExtensions
@ -30,6 +31,8 @@ createInstance window = do
, Vk.enabledLayerNames = V.singleton "VK_LAYER_KHRONOS_validation" , Vk.enabledLayerNames = V.singleton "VK_LAYER_KHRONOS_validation"
} }
SDL.vkLoadLibrary Nothing
(_, inst) <- allocate (_, inst) <- allocate
(Vk.createInstance createInfo Nothing) (Vk.createInstance createInfo Nothing)
(\inst -> do (\inst -> do