Commit before attempting to make storage of shaders mutable
This commit is contained in:
+1
-2
@@ -77,12 +77,11 @@ doDrawing pdata w = do
|
|||||||
then renderTextureWalls pdata nWalls
|
then renderTextureWalls pdata nWalls
|
||||||
else renderBlankWalls pdata nWalls
|
else renderBlankWalls pdata nWalls
|
||||||
|
|
||||||
let shads = _pictureShaders pdata
|
|
||||||
shadV <- picShadToMV $ _pictureShaders pdata
|
shadV <- picShadToMV $ _pictureShaders pdata
|
||||||
renderFoldable shadV $ polysToPic $ foregroundPics w
|
renderFoldable shadV $ polysToPic $ foregroundPics w
|
||||||
|
|
||||||
layerCounts <- UMV.replicate (6*6) 0
|
layerCounts <- UMV.replicate (6*6) 0
|
||||||
vnums <- pokeBindFoldableLayer shadV layerCounts $ worldPictures w
|
pokeBindFoldableLayer shadV layerCounts $ worldPictures w
|
||||||
renderLayer' 0 shadV layerCounts
|
renderLayer' 0 shadV layerCounts
|
||||||
|
|
||||||
nTextArrayVs <- pokePoint33s (shadVBOptr $ _textureArrayShader pdata) (_floorTiles w)
|
nTextArrayVs <- pokePoint33s (shadVBOptr $ _textureArrayShader pdata) (_floorTiles w)
|
||||||
|
|||||||
+2
-3
@@ -161,11 +161,10 @@ pokeBindFoldableLayer
|
|||||||
:: MV.MVector (PrimState IO) VShader
|
:: MV.MVector (PrimState IO) VShader
|
||||||
-> UMV.MVector (PrimState IO) Int
|
-> UMV.MVector (PrimState IO) Int
|
||||||
-> Picture
|
-> Picture
|
||||||
-> IO (IM.IntMap (PicShads Int))
|
-> IO ()
|
||||||
pokeBindFoldableLayer shadV counts m = do
|
pokeBindFoldableLayer shadV counts m = do
|
||||||
slist'' <- pokeLayVerxs shadV counts m
|
pokeLayVerxs shadV counts m
|
||||||
bindShaderLayers shadV counts
|
bindShaderLayers shadV counts
|
||||||
return slist''
|
|
||||||
|
|
||||||
renderFoldable
|
renderFoldable
|
||||||
:: MV.MVector (PrimState IO) VShader
|
:: MV.MVector (PrimState IO) VShader
|
||||||
|
|||||||
+7
-13
@@ -22,9 +22,9 @@ import Geometry.Data
|
|||||||
--import Data.Maybe
|
--import Data.Maybe
|
||||||
--import Data.List
|
--import Data.List
|
||||||
import Foreign
|
import Foreign
|
||||||
import Control.Monad
|
--import Control.Monad
|
||||||
--import qualified Control.Foldl as F
|
--import qualified Control.Foldl as F
|
||||||
import qualified Data.IntMap.Strict as IM
|
--import qualified Data.IntMap.Strict as IM
|
||||||
--import Control.Lens
|
--import Control.Lens
|
||||||
import qualified Data.Vector.Unboxed.Mutable as UMV
|
import qualified Data.Vector.Unboxed.Mutable as UMV
|
||||||
import qualified Data.Vector.Mutable as MV
|
import qualified Data.Vector.Mutable as MV
|
||||||
@@ -124,12 +124,12 @@ pokePoint3s ptr vals0 = go vals0 0
|
|||||||
where
|
where
|
||||||
off i = n*3 + i
|
off i = n*3 + i
|
||||||
|
|
||||||
pokeLayVerxs :: MV.MVector (PrimState IO) VShader
|
pokeLayVerxs
|
||||||
|
:: MV.MVector (PrimState IO) VShader
|
||||||
-> UMV.MVector (PrimState IO) Int
|
-> UMV.MVector (PrimState IO) Int
|
||||||
-> [Verx] -> IO (IM.IntMap (PicShads Int))
|
-> [Verx]
|
||||||
pokeLayVerxs vbos counts vxs = do
|
-> IO ()
|
||||||
VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
|
pokeLayVerxs vbos counts vxs = VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
|
||||||
vToLayPicShad counts
|
|
||||||
|
|
||||||
pokeLayVerx :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
|
pokeLayVerx :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
|
||||||
--{-# INLINE pokeLayVerx #-}
|
--{-# INLINE pokeLayVerx #-}
|
||||||
@@ -150,12 +150,6 @@ pokeLayVerx vbos counts vx = do
|
|||||||
layOff = theLayer * numSubElements
|
layOff = theLayer * numSubElements
|
||||||
theStride = pokeStride sn
|
theStride = pokeStride sn
|
||||||
|
|
||||||
vToLayPicShad :: UMV.MVector RealWorld Int -> IO (IM.IntMap (PicShads Int))
|
|
||||||
{-# INLINE vToLayPicShad #-}
|
|
||||||
vToLayPicShad mv = foldM f IM.empty [0..5]
|
|
||||||
where
|
|
||||||
f m i = fmap (\ps -> IM.insert i ps m) (vToPicShad $ UMV.unsafeSlice (i * 6) 6 mv)
|
|
||||||
|
|
||||||
pokeStride :: Int -> Int
|
pokeStride :: Int -> Int
|
||||||
{-# INLINE pokeStride #-}
|
{-# INLINE pokeStride #-}
|
||||||
pokeStride 0 = 7
|
pokeStride 0 = 7
|
||||||
|
|||||||
Reference in New Issue
Block a user