Work towards using mutable vectors for storing parameters
This commit is contained in:
+16
-2
@@ -11,9 +11,13 @@ module Shader
|
||||
import Shader.Data
|
||||
import Shader.Parameters
|
||||
import Shader.ExtraPrimitive
|
||||
import Shader.Poke
|
||||
--import Layers
|
||||
--import MatrixHelper
|
||||
|
||||
import qualified Data.Vector.Unboxed.Mutable as UMV
|
||||
import qualified Data.Vector.Mutable as MV
|
||||
import Control.Monad.Primitive
|
||||
import Foreign
|
||||
import Control.Monad
|
||||
import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight)
|
||||
@@ -53,8 +57,18 @@ bindShaderLay shads = mapM_ (uncurry f) . IM.toList
|
||||
where
|
||||
f lay counts = sequence_ $ bindArrayBuffersLayer lay <$> counts <*> (_vaoVBO . _vshaderVAO <$> shads)
|
||||
|
||||
bindShader :: PicShads VShader -> PicShads Int -> IO ()
|
||||
bindShader shads counts = sequence_ $ bindArrayBuffers <$> counts <*> (_vaoVBO . _vshaderVAO <$> shads)
|
||||
--bindShader :: PicShads VShader -> PicShads Int -> IO ()
|
||||
----bindShader shads counts = sequence_ $ bindArrayBuffers <$> counts <*> (_vaoVBO . _vshaderVAO <$> shads)
|
||||
--bindShader shads count = do
|
||||
-- s <- picShadToMV shads
|
||||
-- c <- picShadToUMV count
|
||||
-- bindShader' s c
|
||||
|
||||
bindShader :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> IO ()
|
||||
bindShader shads counts = MV.imapM_ f shads
|
||||
where
|
||||
f i shad = UMV.read counts i >>= flip bindArrayBuffers (_vaoVBO . _vshaderVAO $ shad)
|
||||
|
||||
|
||||
bindShaderBuffers :: [FullShader] -> [Int] -> IO ()
|
||||
bindShaderBuffers = zipWithM_ f
|
||||
|
||||
Reference in New Issue
Block a user