prepare synchronisation objects for drawing
This commit is contained in:
parent
a9715e1767
commit
bfb3b1a814
1 changed files with 22 additions and 7 deletions
|
@ -4,23 +4,16 @@
|
|||
module CommandBuffer where
|
||||
|
||||
import Control.Monad
|
||||
import Control.Monad.Loops
|
||||
import Control.Monad.IO.Class
|
||||
import Control.Monad.Trans.Resource
|
||||
import Data.Bits
|
||||
import qualified Data.Vector as V
|
||||
import Data.Word
|
||||
import Foreign.C.Types (CInt)
|
||||
import Linear
|
||||
import qualified SDL hiding (V2)
|
||||
import qualified Control.Concurrent.STM as STM
|
||||
import qualified Vulkan as Vk
|
||||
import qualified Vulkan.Zero as Vk
|
||||
|
||||
-- internal imports
|
||||
|
||||
import Devices
|
||||
import qualified Vulkan.Dynamic as Vk
|
||||
|
||||
createCommandPool
|
||||
:: (MonadResource m)
|
||||
|
@ -120,3 +113,25 @@ recordCommandBuffer commandBuffer renderPass frameBuffer (V2 width height) graph
|
|||
Vk.cmdDraw commandBuffer 3 1 0 0
|
||||
|
||||
Vk.cmdEndRenderPass commandBuffer
|
||||
|
||||
|
||||
createSyncObjects
|
||||
:: (MonadResource m, MonadFail m)
|
||||
=> Vk.Device
|
||||
-> m (Vk.Semaphore, Vk.Semaphore, Vk.Fence)
|
||||
createSyncObjects logicalDevice = do
|
||||
|
||||
let semaphoreCreateInfo = Vk.zero
|
||||
fenceCreateInfo = Vk.zero
|
||||
|
||||
[imageAvailableSemaphore, renderFinishedSemaphore] <- replicateM 2
|
||||
(snd <$> allocate
|
||||
(Vk.createSemaphore logicalDevice semaphoreCreateInfo Nothing)
|
||||
(\semaphore -> do
|
||||
putStrLn "destroying semaphore"
|
||||
Vk.destroySemaphore logicalDevice semaphore Nothing
|
||||
)
|
||||
)
|
||||
inFlightFence <- Vk.createFence logicalDevice fenceCreateInfo Nothing
|
||||
|
||||
return (imageAvailableSemaphore, renderFinishedSemaphore,inFlightFence)
|
||||
|
|
Loading…
Reference in a new issue