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
+17 -23
View File
@@ -26,7 +26,6 @@ import qualified Data.IntMap.Strict as IM
import qualified SDL
import qualified Data.Vector.Unboxed.Mutable as UMV
import qualified Data.Vector.Mutable as MV
import Control.Monad.Primitive
divideSize :: Int -> Size -> Size
divideSize i (Size x y) = Size (div x $ fromIntegral i) (div y $ fromIntegral i)
@@ -146,13 +145,16 @@ drawTextureOnFramebuffer fs fbo to = do
drawShader fs 4
pokeBindFoldable
:: MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
:: PicShads VShader
-> [Verx]
-> IO ()
pokeBindFoldable shads counts m = do
pokeVerxs shads counts m
bindShader shads counts
-> IO (PicShads Int)
pokeBindFoldable shads m = do
counts <- UMV.replicate 6 0
pokeVerxs (fmap (_vaoVBO . _vshaderVAO) shads) counts m
shads' <- picShadToMV shads
bindShader shads' counts
elist <- vToPicShad counts
return elist
zeroCounts :: PicShads Int
zeroCounts = PicShads 0 0 0 0 0 0
@@ -168,14 +170,17 @@ pokeBindFoldableLayer pdata m = do
return slist''
renderFoldable
:: MV.MVector (PrimState IO) VShader
:: RenderData
-> [Verx]
-> IO Word32
renderFoldable shads struct = do
renderFoldable pdata struct = do
pokeStartTicks <- SDL.ticks
counts <- UMV.replicate 6 0
pokeBindFoldable shads counts struct
MV.imapM_ (drawShaderLay' 0 counts) shads
let shads = _pictureShaders pdata
count <- pokeBindFoldable shads struct
s <- picShadToMV shads
c <- picShadToUMV count
MV.imapM_ (drawShaderLay' 0 c) s
--sequence_ (drawShaderLay 0 <$> shads <*> count)
pokeEndTicks <- SDL.ticks
return $ pokeEndTicks - pokeStartTicks
------------------------------end renderFoldable
@@ -183,17 +188,6 @@ renderFoldable shads struct = do
renderLayer :: Int -> PicShads VShader -> IM.IntMap (PicShads Int) -> IO ()
renderLayer i shads counts = sequence_ $ drawShaderLay i <$> shads <*> counts IM.! i
renderLayer'
:: Int
-> MV.MVector (PrimState IO) VShader
-> IM.IntMap (UMV.MVector (PrimState IO) Int)
-> IO ()
renderLayer' theLayer shads counts = MV.imapM_ f shads
where
layCounts = counts IM.! theLayer
f shadIndex theShader = UMV.read layCounts shadIndex >>= drawShaderLay theLayer theShader
--undefined -- sequence_ $ drawShaderLay i <$> shads <*> counts IM.! i
pokeTwoOff
:: Ptr Float
-> Int