Continue adding mutability

This commit is contained in:
2021-08-12 05:49:25 +02:00
parent c84bafb267
commit 4c9a3c8b3c
4 changed files with 47 additions and 30 deletions
+29 -18
View File
@@ -146,50 +146,61 @@ drawTextureOnFramebuffer fs fbo to = do
drawShader fs 4
pokeBindFoldable
:: PicShads VShader
:: MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
-> [Verx]
-> IO ()
pokeBindFoldable shads counts m = do
shadV <- picShadToMV shads
pokeBindFoldable shadV counts m = do
pokeVerxs shadV counts m
bindShader shadV counts
--elist <- vToPicShad counts
--return elist
zeroCounts :: PicShads Int
zeroCounts = PicShads 0 0 0 0 0 0
pokeBindFoldableLayer
:: RenderData
:: MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
-> Picture
-> IO (IM.IntMap (PicShads Int))
pokeBindFoldableLayer pdata m = do
let shads = _pictureShaders pdata
shadV <- picShadToMV shads
counts <- UMV.replicate (6*6) 0
pokeBindFoldableLayer shadV counts m = do
slist'' <- pokeLayVerxs shadV counts m
bindShaderLayers shadV counts
return slist''
renderFoldable
:: RenderData
:: MV.MVector (PrimState IO) VShader
-> [Verx]
-> IO ()
renderFoldable shadV struct = do
counts <- UMV.replicate 6 0
pokeBindFoldable shadV counts struct
MV.imapM_ (drawShaderLay' 0 counts) shadV
renderFoldableTimed
:: MV.MVector (PrimState IO) VShader
-> [Verx]
-> IO Word32
renderFoldable pdata struct = do
renderFoldableTimed shadV struct = do
pokeStartTicks <- SDL.ticks
let shads = _pictureShaders pdata
counts <- UMV.replicate 6 0
pokeBindFoldable shads counts struct
s <- picShadToMV shads
MV.imapM_ (drawShaderLay' 0 counts) s
--sequence_ (drawShaderLay 0 <$> shads <*> count)
pokeBindFoldable shadV counts struct
MV.imapM_ (drawShaderLay' 0 counts) shadV
pokeEndTicks <- SDL.ticks
return $ pokeEndTicks - pokeStartTicks
------------------------------end renderFoldable
renderLayer :: Int -> PicShads VShader -> IM.IntMap (PicShads Int) -> IO ()
renderLayer i shads counts = sequence_ $ drawShaderLay i <$> shads <*> counts IM.! i
renderLayer layer shads counts = sequence_ $ drawShaderLay layer <$> shads <*> counts IM.! layer
renderLayer'
:: Int
-> MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
-> IO ()
renderLayer' layer shads counts = do
let layerCounts = UMV.slice (layer * 6) 6 counts
MV.imapM_ (drawShaderLay' layer layerCounts) shads
-- sequence_ $ drawShaderLay layer <$> shads <*> counts IM.! layer
pokeTwoOff
:: Ptr Float