Commit before attempting to make storage of shaders mutable

This commit is contained in:
2021-08-12 06:11:08 +02:00
parent 4c9a3c8b3c
commit 0138f7b940
3 changed files with 10 additions and 18 deletions
+7 -13
View File
@@ -22,9 +22,9 @@ import Geometry.Data
--import Data.Maybe
--import Data.List
import Foreign
import Control.Monad
--import Control.Monad
--import qualified Control.Foldl as F
import qualified Data.IntMap.Strict as IM
--import qualified Data.IntMap.Strict as IM
--import Control.Lens
import qualified Data.Vector.Unboxed.Mutable as UMV
import qualified Data.Vector.Mutable as MV
@@ -124,12 +124,12 @@ pokePoint3s ptr vals0 = go vals0 0
where
off i = n*3 + i
pokeLayVerxs :: MV.MVector (PrimState IO) VShader
pokeLayVerxs
:: MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
-> [Verx] -> IO (IM.IntMap (PicShads Int))
pokeLayVerxs vbos counts vxs = do
VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
vToLayPicShad counts
-> [Verx]
-> IO ()
pokeLayVerxs vbos counts vxs = VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
pokeLayVerx :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
--{-# INLINE pokeLayVerx #-}
@@ -150,12 +150,6 @@ pokeLayVerx vbos counts vx = do
layOff = theLayer * numSubElements
theStride = pokeStride sn
vToLayPicShad :: UMV.MVector RealWorld Int -> IO (IM.IntMap (PicShads Int))
{-# INLINE vToLayPicShad #-}
vToLayPicShad mv = foldM f IM.empty [0..5]
where
f m i = fmap (\ps -> IM.insert i ps m) (vToPicShad $ UMV.unsafeSlice (i * 6) 6 mv)
pokeStride :: Int -> Int
{-# INLINE pokeStride #-}
pokeStride 0 = 7