some polish

This commit is contained in:
nek0 2022-07-10 20:08:12 +02:00
parent a95928ee9b
commit 87cbc2a254

View file

@ -56,7 +56,12 @@ initEngine
=> m (SDL.Window, Vk.Instance, Vk.SurfaceKHR, Vk.SwapchainKHR, V.Vector Vk.Image) => m (SDL.Window, Vk.Instance, Vk.SurfaceKHR, Vk.SwapchainKHR, V.Vector Vk.Image)
initEngine = do initEngine = do
-- initialize SDL2 with all subsystems -- initialize SDL2 with all subsystems
void $ allocate_ SDL.initializeAll SDL.quit void $ allocate_
SDL.initializeAll
(do
print ("This is the end!" :: String)
SDL.quit
)
-- create a window configuration -- create a window configuration
let windowConfig = SDL.defaultWindow let windowConfig = SDL.defaultWindow
@ -110,7 +115,7 @@ createInstance window = do
windowExtensions <- liftIO $ fmap (Vk.EXT_DEBUG_UTILS_EXTENSION_NAME :) $ windowExtensions <- liftIO $ fmap (Vk.EXT_DEBUG_UTILS_EXTENSION_NAME :) $
traverse BS.packCString =<< SDL.vkGetInstanceExtensions window traverse BS.packCString =<< SDL.vkGetInstanceExtensions window
liftIO $ do liftIO $ do
print ("activating followinfg rxtensions:" :: String) print ("activating followinfg extensions:" :: String)
print windowExtensions print windowExtensions
let createInfo = Vk.zero let createInfo = Vk.zero
{ Vk.applicationInfo = Just Vk.zero { Vk.applicationInfo = Just Vk.zero
@ -127,7 +132,10 @@ createInstance window = do
(_, inst) <- allocate (_, inst) <- allocate
(Vk.createInstance createInfo Nothing) (Vk.createInstance createInfo Nothing)
(`Vk.destroyInstance` Nothing) (\inst -> do
print ("destroying instance" :: String)
Vk.destroyInstance inst Nothing
)
return inst return inst
@ -209,7 +217,10 @@ createSwapchain surface windowDimension logicalDevice = do
snd <$> allocate snd <$> allocate
(Vk.createSwapchainKHR logicalDevice createInfo Nothing) (Vk.createSwapchainKHR logicalDevice createInfo Nothing)
(\swapchain -> Vk.destroySwapchainKHR logicalDevice swapchain Nothing) (\swapchain -> do
print ("destroying Swapchain" :: String)
Vk.destroySwapchainKHR logicalDevice swapchain Nothing
)
getImageHandles getImageHandles
:: (MonadResource m) :: (MonadResource m)