de-parallelize

This commit is contained in:
nek0 2017-11-04 20:37:49 +01:00
parent 2a9f7ffebc
commit 2c731bea97
2 changed files with 4 additions and 6 deletions

View file

@ -23,7 +23,6 @@ import Data.IORef
import System.Clock
import Control.Monad.Loops
import qualified Control.Monad.Parallel as MP
import Control.Monad.State
import Foreign.C.Types (CInt(..))
@ -129,7 +128,7 @@ withAffection AffectionConfig{..} = do
now <- liftIO $ getTime Monotonic
let lastTime = sysTime ad
-- clean draw requests from last run
MP.mapM_ (invalidateDrawRequest (drawStride ad) (drawCPP ad)) (drawStack ad)
mapM_ (invalidateDrawRequest (drawStride ad) (drawCPP ad)) (drawStack ad)
-- clean the renderer form last time
-- SDL.clear renderer
-- compute dt and update elapsedTime
@ -150,7 +149,7 @@ withAffection AffectionConfig{..} = do
-- handle all new draw requests
ad2 <- get
clear <- catMaybes <$>
MP.mapM (handleDrawRequest (drawStride ad) (drawCPP ad)) (drawStack ad2)
mapM (handleDrawRequest (drawStride ad) (drawCPP ad)) (drawStack ad2)
-- save all draw requests to clear in next run
put $ ad2
{ drawStack = clear }

View file

@ -13,7 +13,6 @@ import Affection.Types
import Control.Monad
import Control.Monad.State (get)
import qualified Control.Monad.Parallel as MP
import Data.Maybe
@ -34,7 +33,7 @@ updateParticle
-> Affection us [Particle]
-- ^ processed 'Particle's
updateParticle time func l =
catMaybes <$> MP.mapM (\p -> do
catMaybes <$> mapM (\p -> do
now <- elapsedTime <$> get
if particleCreation p + particleTimeToLive p < now
then do
@ -124,7 +123,7 @@ drawParticleSystem sys draw =
if not (null parts)
then do
liftIO $ G.gegl_node_link (particleStackCont $ head parts) (partSysNode sys)
MP.mapM_ (draw (partSysBuffer sys) (partSysNode sys)) parts
mapM_ (draw (partSysBuffer sys) (partSysNode sys)) parts
else do
_ <- liftIO $ G.gegl_node_disconnect (partSysNode sys) "input"
return ()