Parallelize poking
This commit is contained in:
@@ -157,6 +157,7 @@ ddaStreamY :: Float -> Point2 -> Point2 -> Stream (Of (V2 Int)) Identity ()
|
|||||||
ddaStreamY s sp ep = S.map (sizeZoneOfPoint' s) $ yIntercepts s sp ep
|
ddaStreamY s sp ep = S.map (sizeZoneOfPoint' s) $ yIntercepts s sp ep
|
||||||
|
|
||||||
xIntercepts :: Float -> Point2 -> Point2 -> Stream (Of Point2) Identity ()
|
xIntercepts :: Float -> Point2 -> Point2 -> Stream (Of Point2) Identity ()
|
||||||
|
{-# INLINE xIntercepts #-}
|
||||||
xIntercepts s (V2 sx sy) (V2 ex ey)
|
xIntercepts s (V2 sx sy) (V2 ex ey)
|
||||||
| xdx == 0 = mempty
|
| xdx == 0 = mempty
|
||||||
| xdx > 0 = S.each $ zipWith V2 [sx',sx'+xdx*50..ex] [sy',sy'+ydx*50..ey]
|
| xdx > 0 = S.each $ zipWith V2 [sx',sx'+xdx*50..ex] [sy',sy'+ydx*50..ey]
|
||||||
|
|||||||
+5
-4
@@ -20,6 +20,7 @@ import qualified Data.Vector.Unboxed.Mutable as UMV
|
|||||||
import qualified Data.Vector.Mutable as MV
|
import qualified Data.Vector.Mutable as MV
|
||||||
import qualified Data.Vector.Fusion.Stream.Monadic as VS
|
import qualified Data.Vector.Fusion.Stream.Monadic as VS
|
||||||
import Control.Monad.Primitive
|
import Control.Monad.Primitive
|
||||||
|
import qualified Control.Monad.Parallel as MP
|
||||||
|
|
||||||
pokeVerxs
|
pokeVerxs
|
||||||
:: MV.MVector (PrimState IO) FullShader
|
:: MV.MVector (PrimState IO) FullShader
|
||||||
@@ -105,10 +106,10 @@ pokeTopPrism :: Int -> Ptr Float -> Ptr GLushort
|
|||||||
-> IO ()
|
-> IO ()
|
||||||
pokeTopPrism size ptr iptr ieptr counts svs = do
|
pokeTopPrism size ptr iptr ieptr counts svs = do
|
||||||
nv <- UMV.unsafeRead counts 0
|
nv <- UMV.unsafeRead counts 0
|
||||||
-- MP.bindM3 (\_ _ _ -> return ())
|
MP.bindM3 (\_ _ _ -> return ())
|
||||||
UV.mapM_ (pokeTopPrismIndex nv iptr counts) (memoTopPrismIndices V.! size)
|
(UV.mapM_ (pokeTopPrismIndex nv iptr counts) (memoTopPrismIndices V.! size))
|
||||||
UV.mapM_ (pokeTopPrismEdgeIndex nv ieptr counts) (memoTopPrismEdgeIndices V.! size)
|
(UV.mapM_ (pokeTopPrismEdgeIndex nv ieptr counts) (memoTopPrismEdgeIndices V.! size))
|
||||||
VS.mapM_ (pokeJustV ptr counts) (VS.fromList svs)
|
(VS.mapM_ (pokeJustV ptr counts) (VS.fromList svs) )
|
||||||
|
|
||||||
pokeTopPrismEdgeIndex :: Int -> Ptr GLushort
|
pokeTopPrismEdgeIndex :: Int -> Ptr GLushort
|
||||||
-> UMV.MVector (PrimState IO) Int
|
-> UMV.MVector (PrimState IO) Int
|
||||||
|
|||||||
Reference in New Issue
Block a user