Commit before attempting to make storage of shaders mutable

This commit is contained in:
jgk
2021-08-12 06:11:08 +02:00
parent 4c9a3c8b3c
commit 0138f7b940
3 changed files with 10 additions and 18 deletions
+1 -2
View File
@@ -77,12 +77,11 @@ doDrawing pdata w = do
then renderTextureWalls pdata nWalls
else renderBlankWalls pdata nWalls
let shads = _pictureShaders pdata
shadV <- picShadToMV $ _pictureShaders pdata
renderFoldable shadV $ polysToPic $ foregroundPics w
layerCounts <- UMV.replicate (6*6) 0
vnums <- pokeBindFoldableLayer shadV layerCounts $ worldPictures w
pokeBindFoldableLayer shadV layerCounts $ worldPictures w
renderLayer' 0 shadV layerCounts
nTextArrayVs <- pokePoint33s (shadVBOptr $ _textureArrayShader pdata) (_floorTiles w)
+2 -3
View File
@@ -161,11 +161,10 @@ pokeBindFoldableLayer
:: MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
-> Picture
-> IO (IM.IntMap (PicShads Int))
-> IO ()
pokeBindFoldableLayer shadV counts m = do
slist'' <- pokeLayVerxs shadV counts m
pokeLayVerxs shadV counts m
bindShaderLayers shadV counts
return slist''
renderFoldable
:: MV.MVector (PrimState IO) VShader
+7 -13
View File
@@ -22,9 +22,9 @@ import Geometry.Data
--import Data.Maybe
--import Data.List
import Foreign
import Control.Monad
--import Control.Monad
--import qualified Control.Foldl as F
import qualified Data.IntMap.Strict as IM
--import qualified Data.IntMap.Strict as IM
--import Control.Lens
import qualified Data.Vector.Unboxed.Mutable as UMV
import qualified Data.Vector.Mutable as MV
@@ -124,12 +124,12 @@ pokePoint3s ptr vals0 = go vals0 0
where
off i = n*3 + i
pokeLayVerxs :: MV.MVector (PrimState IO) VShader
pokeLayVerxs
:: MV.MVector (PrimState IO) VShader
-> UMV.MVector (PrimState IO) Int
-> [Verx] -> IO (IM.IntMap (PicShads Int))
pokeLayVerxs vbos counts vxs = do
VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
vToLayPicShad counts
-> [Verx]
-> IO ()
pokeLayVerxs vbos counts vxs = VS.mapM_ (pokeLayVerx vbos counts) $ VS.fromList vxs
pokeLayVerx :: MV.MVector (PrimState IO) VShader -> UMV.MVector (PrimState IO) Int -> Verx -> IO ()
--{-# INLINE pokeLayVerx #-}
@@ -150,12 +150,6 @@ pokeLayVerx vbos counts vx = do
layOff = theLayer * numSubElements
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
{-# INLINE pokeStride #-}
pokeStride 0 = 7