clean the states out
This commit is contained in:
parent
f7952bf6f5
commit
5601e6fcab
3 changed files with 6 additions and 22 deletions
14
src/Draw.hs
14
src/Draw.hs
|
@ -2,7 +2,6 @@
|
|||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
module Draw where
|
||||
|
||||
import qualified Control.Concurrent.STM as STM
|
||||
import Control.Monad
|
||||
import Control.Monad.Trans.Resource
|
||||
import qualified Data.Vector as V
|
||||
|
@ -15,15 +14,13 @@ import qualified Vulkan.Zero as Vk
|
|||
|
||||
import CommandBuffer
|
||||
import Types
|
||||
import Control.Monad.IO.Class (MonadIO(liftIO))
|
||||
|
||||
drawFrame
|
||||
:: (MonadResource m, MonadFail m)
|
||||
=> EngineData
|
||||
-> STM.TMVar Pipelines
|
||||
-> Int
|
||||
-> m ()
|
||||
drawFrame engineData switch frameNumber = do
|
||||
drawFrame engineData frameNumber = do
|
||||
|
||||
unless (all (V.length (engineCommandBuffers engineData) ==)
|
||||
[ V.length (engineCommandBuffers engineData)
|
||||
|
@ -54,8 +51,6 @@ drawFrame engineData switch frameNumber = do
|
|||
Vk.resetCommandBuffer
|
||||
(engineCommandBuffers engineData V.! fromIntegral index) (Vk.CommandBufferResetFlagBits 0)
|
||||
|
||||
switchState <- liftIO $ STM.atomically $ STM.readTMVar switch
|
||||
|
||||
-- liftIO $ putStrLn "recording command buffer"
|
||||
recordCommandBuffer
|
||||
(engineCommandBuffers engineData V.! fromIntegral index)
|
||||
|
@ -64,12 +59,7 @@ drawFrame engineData switch frameNumber = do
|
|||
(engineWindowDimensions engineData)
|
||||
(meshPipeline engineData V.! fromIntegral index)
|
||||
(meshPipelineLayout engineData)
|
||||
(case switchState of
|
||||
Green ->
|
||||
Just $ engineMesh engineData
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
(Just $ engineMesh engineData)
|
||||
frameNumber
|
||||
|
||||
let submitInfo = Vk.zero
|
||||
|
|
|
@ -47,12 +47,12 @@ uploadMesh vertices allocator = do
|
|||
} :: VMA.AllocationCreateInfo
|
||||
(_, mesh) <- allocate
|
||||
(do
|
||||
(buffer, allocation, _) <- VMA.createBuffer allocator bufferCreateInfo allocationCreateInfo
|
||||
return (Mesh vertices (AllocatedBuffer buffer allocation))
|
||||
(buffer, bAllocation, _) <- VMA.createBuffer allocator bufferCreateInfo allocationCreateInfo
|
||||
return (Mesh vertices (AllocatedBuffer buffer bAllocation))
|
||||
)
|
||||
(\(Mesh _ (AllocatedBuffer buffer allocation)) -> do
|
||||
(\(Mesh _ (AllocatedBuffer buffer bAllocation)) -> do
|
||||
putStrLn "destroying mesh"
|
||||
VMA.destroyBuffer allocator buffer allocation
|
||||
VMA.destroyBuffer allocator buffer bAllocation
|
||||
)
|
||||
|
||||
(dataReleaseKey, dataPtr) <- allocate
|
||||
|
|
|
@ -10,12 +10,6 @@ import qualified Vulkan as Vk
|
|||
import qualified Vulkan.Zero as Vk
|
||||
import qualified VulkanMemoryAllocator as VMA
|
||||
|
||||
data Pipelines
|
||||
= Rainbow
|
||||
| Red
|
||||
| Green
|
||||
deriving (Eq, Ord, Enum, Bounded)
|
||||
|
||||
data ShaderContainer = ShaderContainer
|
||||
{ containedVertexShader :: Maybe Vk.ShaderModule
|
||||
, containedFragmentShader :: Maybe Vk.ShaderModule
|
||||
|
|
Loading…
Reference in a new issue