Continue adding mutability

This commit is contained in:
2021-08-12 05:10:06 +02:00
parent 27cf763805
commit c84bafb267
3 changed files with 10 additions and 34 deletions
+9 -8
View File
@@ -26,6 +26,7 @@ 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,15 +147,15 @@ drawTextureOnFramebuffer fs fbo to = do
pokeBindFoldable
:: PicShads VShader
-> UMV.MVector (PrimState IO) Int
-> [Verx]
-> IO (PicShads Int)
pokeBindFoldable shads m = do
counts <- UMV.replicate 6 0
-> IO ()
pokeBindFoldable shads counts m = do
shadV <- picShadToMV shads
pokeVerxs shadV counts m
bindShader shadV counts
elist <- vToPicShad counts
return elist
--elist <- vToPicShad counts
--return elist
zeroCounts :: PicShads Int
zeroCounts = PicShads 0 0 0 0 0 0
@@ -178,10 +179,10 @@ renderFoldable
renderFoldable pdata struct = do
pokeStartTicks <- SDL.ticks
let shads = _pictureShaders pdata
count <- pokeBindFoldable shads struct
counts <- UMV.replicate 6 0
pokeBindFoldable shads counts struct
s <- picShadToMV shads
c <- picShadToUMV count
MV.imapM_ (drawShaderLay' 0 c) s
MV.imapM_ (drawShaderLay' 0 counts) s
--sequence_ (drawShaderLay 0 <$> shads <*> count)
pokeEndTicks <- SDL.ticks
return $ pokeEndTicks - pokeStartTicks