Continue mutability changes
This commit is contained in:
+3
-2
@@ -166,8 +166,9 @@ pokeBindFoldableLayer
|
|||||||
pokeBindFoldableLayer pdata m = do
|
pokeBindFoldableLayer pdata m = do
|
||||||
let shads = _pictureShaders pdata
|
let shads = _pictureShaders pdata
|
||||||
shadV <- picShadToMV shads
|
shadV <- picShadToMV shads
|
||||||
slist'' <- pokeLayVerxs shadV m
|
counts <- UMV.replicate (6*6) 0
|
||||||
bindShaderLay shads slist''
|
slist'' <- pokeLayVerxs shadV counts m
|
||||||
|
bindShaderLayers shadV counts
|
||||||
return slist''
|
return slist''
|
||||||
|
|
||||||
renderFoldable
|
renderFoldable
|
||||||
|
|||||||
+20
-4
@@ -1,5 +1,5 @@
|
|||||||
module Shader
|
module Shader
|
||||||
( bindShaderLay
|
( bindShaderLayers
|
||||||
, bindShaderBuffers
|
, bindShaderBuffers
|
||||||
, bindShader
|
, bindShader
|
||||||
, drawShader
|
, drawShader
|
||||||
@@ -53,10 +53,26 @@ bindArrayBuffersLayer lay numVs theVBO = do
|
|||||||
where
|
where
|
||||||
stride = sum $ _vboAttribSizes theVBO
|
stride = sum $ _vboAttribSizes theVBO
|
||||||
|
|
||||||
bindShaderLay :: PicShads VShader -> IM.IntMap (PicShads Int) -> IO ()
|
bindShaderLayers :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> IO ()
|
||||||
bindShaderLay shads = mapM_ (uncurry f) . IM.toList
|
bindShaderLayers shads counts = MV.imapM_ f shads
|
||||||
where
|
where
|
||||||
f lay counts = sequence_ $ bindArrayBuffersLayer lay <$> counts <*> (_vaoVBO . _vshaderVAO <$> shads)
|
f i shad = do
|
||||||
|
let theVBO = _vaoVBO $ _vshaderVAO shad
|
||||||
|
stride = sum $ _vboAttribSizes theVBO
|
||||||
|
bindBuffer ArrayBuffer $= (Just . _vbo $ theVBO)
|
||||||
|
mapM_ (g stride theVBO) [0..5]
|
||||||
|
where
|
||||||
|
g stride theVBO lay = do
|
||||||
|
numVs <- UMV.unsafeRead counts $ lay * 6 + i
|
||||||
|
bufferSubData
|
||||||
|
ArrayBuffer
|
||||||
|
WriteToBuffer
|
||||||
|
(fromIntegral $ floatSize * stride * numSubElements * lay)
|
||||||
|
(fromIntegral $ floatSize * numVs * stride)
|
||||||
|
(_vboPtr theVBO `plusPtr` (floatSize * stride * numSubElements * lay))
|
||||||
|
|
||||||
|
|
||||||
|
--lay counts = sequence_ $ bindArrayBuffersLayer lay <$> counts <*> (_vaoVBO . _vshaderVAO <$> shads)
|
||||||
|
|
||||||
bindShader :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> IO ()
|
bindShader :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> IO ()
|
||||||
bindShader shads counts = MV.imapM_ f shads
|
bindShader shads counts = MV.imapM_ f shads
|
||||||
|
|||||||
+4
-3
@@ -137,9 +137,10 @@ vboFromType ps sn = case sn of
|
|||||||
_ -> undefined
|
_ -> undefined
|
||||||
|
|
||||||
|
|
||||||
pokeLayVerxs :: MV.MVector (PrimState IO) VShader -> [Verx] -> IO (IM.IntMap (PicShads Int))
|
pokeLayVerxs :: MV.MVector (PrimState IO) VShader
|
||||||
pokeLayVerxs vbos vxs = do
|
-> UMV.MVector (PrimState IO) Int
|
||||||
counts <- UMV.replicate (6*6) 0
|
-> [Verx] -> IO (IM.IntMap (PicShads Int))
|
||||||
|
pokeLayVerxs vbos counts vxs = do
|
||||||
VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
|
VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
|
||||||
vToLayPicShad counts
|
vToLayPicShad counts
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user