Revert "Continue transfer to mutable vectors"

This reverts commit 1f2f5431c0.
This commit is contained in:
2021-08-12 00:57:57 +02:00
parent 1f2f5431c0
commit 724f9a86f8
5 changed files with 44 additions and 50 deletions
+19 -14
View File
@@ -31,22 +31,14 @@ import qualified Data.Vector.Mutable as MV
import qualified Data.Vector.Fusion.Stream.Monadic as VS
import Control.Monad.Primitive
--pokeVerxs
-- :: PicShads VBO
-- -> UMV.MVector (PrimState IO) Int
-- -> [Verx]
-- -> IO ()
--pokeVerxs vbos count vxs = do
-- s <- picShadToMV vbos
-- VS.mapM_ (pokeVerx s count) $ VS.fromList vxs
pokeVerxs
:: MV.MVector (PrimState IO) VShader
pokeVerxs
:: PicShads VBO
-> UMV.MVector (PrimState IO) Int
-> [Verx]
-> IO ()
pokeVerxs vbos count vxs = do
VS.mapM_ (pokeVerx vbos count) $ VS.fromList vxs
s <- picShadToMV vbos
VS.mapM_ (pokeVerx' s count) $ VS.fromList vxs
vToPicShad :: UMV.MVector (PrimState IO) Int -> IO (PicShads Int)
{-# INLINE vToPicShad #-}
@@ -79,10 +71,23 @@ picShadToMV (PicShads a b c d e f) = do
MV.write theVec 5 f
return theVec
pokeVerx :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
pokeVerx :: PicShads VBO -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
--{-# INLINE pokeVerx #-}
pokeVerx vbos offsets Verx{_vxPos=thePos,_vxCol=theCol,_vxExt=ext,_vxShadNum=theShadNum} = do
typeOff <- UMV.unsafeRead offsets sn
theShad <- fmap (_vaoVBO . _vshaderVAO) $ MV.read vbos sn
let thePtr = plusPtr (_vboPtr $ vboFromType vbos sn) (typeOff * pokeStride sn * floatSize)
poke34 thePtr thePos theCol
pokeArrayOff thePtr 7 ext
UMV.unsafeModify offsets (+1) sn
where
sn = _unShadNum theShadNum
pokeVerx' :: MV.MVector (PrimState IO) VBO -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
pokeVerx' vbos offsets Verx{_vxPos=thePos,_vxCol=theCol,_vxExt=ext,_vxShadNum=theShadNum} = do
typeOff <- UMV.unsafeRead offsets sn
theShad <- MV.read vbos sn
let thePtr = plusPtr (_vboPtr theShad) (typeOff * pokeStride sn * floatSize)
poke34 thePtr thePos theCol
pokeArrayOff thePtr 7 ext