Implement custom poking for vertices--speed regression?

This commit is contained in:
2021-07-29 18:46:01 +02:00
parent 02a9f4badf
commit 192e2c9c57
8 changed files with 184 additions and 139 deletions
+15 -27
View File
@@ -15,7 +15,7 @@ import Geometry.Data
--import Control.Lens
import Control.Monad
import qualified Control.Foldl as F
--import qualified Control.Foldl as F
import Foreign hiding (rotate)
import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygon,Color,T)
--import Data.Foldable
@@ -140,28 +140,16 @@ drawTextureOnFramebuffer fs fbo to = do
textureBinding Texture2D $= Just to
drawShader fs 4
renderShader
:: Foldable f
=> FullShader
-> f RenderType
-> IO Word32
renderShader shad dat = do
sticks <- SDL.ticks
i <- F.foldM (pokeShader shad) dat
bindShaderBuffers [shad] [i]
drawShader shad i
eticks <- SDL.ticks
return $ eticks - sticks
pokeBindFoldable
:: Foldable f
=> RenderData
-> f Verx
-- :: Foldable f
:: RenderData
-> [Verx]
-> IO (PicShads Int)
pokeBindFoldable pdata m = do
let shads = _pictureShaders pdata
counts = zeroCounts
elist <- foldM (pokeVX' shads) counts m
--counts = zeroCounts
--elist <- foldM (pokeVX' shads) counts m
elist <- pokeVerxs (fmap (_vaoVBO . _vshaderVAO) shads) m
bindShader shads elist
return elist
@@ -169,23 +157,23 @@ zeroCounts :: PicShads Int
zeroCounts = PicShads 0 0 0 0 0 0
pokeBindFoldableLayer
:: Foldable f
=> RenderData
-> f Verx
-- :: Foldable f
:: RenderData
-> [Verx]
-> IO (IM.IntMap (PicShads Int))
pokeBindFoldableLayer pdata m = do
let shads = _pictureShaders pdata
slist' = (IM.fromList ((,) <$> [0..6] <*> [zeroCounts])) :: IM.IntMap (PicShads Int)
--slist' = (IM.fromList ((,) <$> [0..6] <*> [zeroCounts])) :: IM.IntMap (PicShads Int)
slist'' <- foldM (pokeVX shads) slist' m
--slist'' <- foldM (pokeVX shads) slist' m
slist'' <- pokeLayVerxs (fmap (_vaoVBO . _vshaderVAO) shads) m
bindShaderLay shads slist''
return slist''
renderFoldable
:: Foldable f
=> RenderData
-> f Verx
:: RenderData
-> [Verx]
-> IO Word32
renderFoldable pdata struct = do
pokeStartTicks <- SDL.ticks