From aeb22fc9d7a8d14eea75b6edc01009879d468552 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 22 Aug 2022 12:02:42 +0100 Subject: [PATCH] Hopefully fully excise streaming --- package.yaml | 2 +- src/Polyhedra.hs | 4 ---- src/Render.hs | 4 ++-- src/Shader/Bind.hs | 6 +++--- src/Shape.hs | 1 - src/Shape/Data.hs | 2 -- src/ShapePicture.hs | 2 -- src/Sound.hs | 1 - src/StreamingHelp.hs | 33 --------------------------------- src/StreamingHelp/Data.hs | 5 ----- 10 files changed, 6 insertions(+), 54 deletions(-) delete mode 100644 src/StreamingHelp.hs delete mode 100644 src/StreamingHelp/Data.hs diff --git a/package.yaml b/package.yaml index c737b1fbd..d0c96290a 100644 --- a/package.yaml +++ b/package.yaml @@ -58,7 +58,7 @@ dependencies: - directory - extra - primitive -- streaming + #- streaming #- repa - monad-parallel - parallel diff --git a/src/Polyhedra.hs b/src/Polyhedra.hs index d7c9a69bf..0e655c4ab 100644 --- a/src/Polyhedra.hs +++ b/src/Polyhedra.hs @@ -18,10 +18,6 @@ import Data.Maybe import Data.List import Data.Bifunctor import Control.Lens ---import qualified Streaming.Prelude as S - ---picMap :: (Verx -> Verx) -> Picture -> Picture ---picMap = map picFormat :: [Verx] -> Picture picFormat = id diff --git a/src/Render.hs b/src/Render.hs index c09b0b2d1..ecc342f5c 100644 --- a/src/Render.hs +++ b/src/Render.hs @@ -21,7 +21,7 @@ import qualified Data.Vector.Mutable as MV import Control.Monad.Primitive import Graphics.GL.Core43 import Control.Monad -import qualified Streaming.Prelude as S +import qualified Data.Vector.Fusion.Stream.Monadic as VFSM divideSize :: Int -> Size -> Size divideSize i (Size x y) = Size (div x $ fromIntegral i) (div y $ fromIntegral i) @@ -53,7 +53,7 @@ createLightMap pdata lightPoints nWalls nSils nCaps drawObjShads toPos = do -- to consider: adding normals/a "material" for each fragment blendFunc $= (Zero, OneMinusSrcColor) stencilTest $= Enabled - flip S.mapM_ (S.each lightPoints) $ \(V3 x y z,rad,V3 r g b) -> do + flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z,rad,V3 r g b) -> do depthFunc $= Just Less -- setup stencil colorMask $= Color4 Disabled Disabled Disabled Disabled diff --git a/src/Shader/Bind.hs b/src/Shader/Bind.hs index a80597f13..bcabaab85 100644 --- a/src/Shader/Bind.hs +++ b/src/Shader/Bind.hs @@ -10,9 +10,9 @@ import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygo import Foreign hiding (rotate) import qualified Data.Vector.Unboxed.Mutable as UMV import qualified Data.Vector.Mutable as MV +import qualified Data.Vector.Fusion.Stream.Monadic as VFSM import Control.Monad.Primitive import Control.Monad -import qualified Streaming.Prelude as S bindArrayBuffers :: Int -> VBO -> IO () {-# INLINABLE bindArrayBuffers #-} @@ -32,8 +32,8 @@ bindShaderLayers shads counts = MV.imapM_ f shads let theVBO = _vaoVBO $ _shadVAO shad stride = sum $ _vboAttribSizes theVBO bindBuffer ArrayBuffer $= (Just . _vbo $ theVBO) - --VS.mapM_ (g stride theVBO) $ VS.enumFromStepN 0 1 6 -- [0..5] - S.mapM_ (g stride theVBO) $ S.each [0..5] + VFSM.mapM_ (g stride theVBO) $ VFSM.enumFromStepN 0 1 6 -- [0..5] + --S.mapM_ (g stride theVBO) $ S.each [0..5] where g stride theVBO lay = do diff --git a/src/Shape.hs b/src/Shape.hs index 1bc0619cb..ab25707c9 100644 --- a/src/Shape.hs +++ b/src/Shape.hs @@ -21,7 +21,6 @@ module Shape import Geometry import Shape.Data import Color ---import qualified Streaming.Prelude as S singleShape :: ShapeObj -> Shape {-# INLINE singleShape #-} diff --git a/src/Shape/Data.hs b/src/Shape/Data.hs index f36b10be9..90afd6f32 100644 --- a/src/Shape/Data.hs +++ b/src/Shape/Data.hs @@ -12,8 +12,6 @@ import Control.Lens import Data.Aeson import Data.Aeson.TH import Geometry.Data ---import Streaming - {-# INLINE shVfromList #-} shVfromList = id diff --git a/src/ShapePicture.hs b/src/ShapePicture.hs index 901f5f79e..c4fcd26b8 100644 --- a/src/ShapePicture.hs +++ b/src/ShapePicture.hs @@ -20,8 +20,6 @@ import Geometry import Data.Bifunctor import Control.Lens ---import qualified Streaming.Prelude as S - shMap :: (ShapeObj -> ShapeObj) -> Shape -> Shape shMap = map diff --git a/src/Sound.hs b/src/Sound.hs index 1a97faebe..f45839390 100644 --- a/src/Sound.hs +++ b/src/Sound.hs @@ -26,7 +26,6 @@ import qualified SDL.Mixer as Mix import Data.Maybe import qualified IntMapHelp as IM import qualified Data.Map as M ---import qualified Streaming.Prelude as S import Control.Monad import Control.Monad.Trans import Control.Monad.Trans.Maybe diff --git a/src/StreamingHelp.hs b/src/StreamingHelp.hs deleted file mode 100644 index 1becc385d..000000000 --- a/src/StreamingHelp.hs +++ /dev/null @@ -1,33 +0,0 @@ -module StreamingHelp - ( minStreamOn - , sortStreamOn - , module Streaming - , module StreamingHelp.Data - ) where -import Streaming -import StreamingHelp.Data -import qualified Streaming.Prelude as S -import qualified Control.Foldl as L -import Data.Function (on) - - -minStreamOn :: Ord a => (b -> a) -> StreamOf b -> Maybe b -{-# INLINE minStreamOn #-} -minStreamOn f = runIdentity - . L.purely S.fold_ (L.minimumBy (compare `on` f)) - --- this hopefully also nub the stream in most cases ---orderStreamOn :: Ord b => (a -> b) -> Stream (Of a) Identity () -> Identity (Of (M.Map b a) ()) -sortStreamOn :: Ord a => (b -> a) -> StreamOf b -> Stream (Of b) Identity () -{-# INLINE sortStreamOn #-} -sortStreamOn f = S.each . runIdentity . L.purely S.fold_ L.map . S.map g - where - g x = (f x,x) - ---applyUnzip --- :: (Stream (Of a) IO () -> IO r) --- -> (Stream (Of b) IO () -> IO ()) --- -> Stream (Of a) (Stream g IO) () --- -> IO r ---applyUnzip f g s = h s - diff --git a/src/StreamingHelp/Data.hs b/src/StreamingHelp/Data.hs deleted file mode 100644 index 77a8ff797..000000000 --- a/src/StreamingHelp/Data.hs +++ /dev/null @@ -1,5 +0,0 @@ -module StreamingHelp.Data where -import Streaming -type StreamOf a = Stream (Of a) Identity () - -newtype StreamOf' a = StreamOf' (Stream (Of a) Identity ())