Attempt to stream SPics, not sure if this improves speed

This commit is contained in:
2022-07-04 20:34:47 +01:00
parent 1e32b05406
commit 6972256751
5 changed files with 64 additions and 22 deletions
+24 -5
View File
@@ -27,6 +27,7 @@ import Graphics.Rendering.OpenGL hiding (color,scale,translate,rotate)
import qualified SDL
import qualified Data.Vector.Unboxed.Mutable as UMV
import Graphics.GL.Core43
import qualified Streaming.Prelude as S
doDrawing :: RenderData -> Universe -> IO Word32
doDrawing pdata u = do
@@ -48,10 +49,9 @@ doDrawing pdata u = do
-- count mutable vectors setup
layerCounts <- UMV.replicate (numLayers*6) 0
-- attempt to poke in parallel
let (ws,wp) = wallSPics <> worldSPic cfig w
-- let (ws,wp) = wallSPics <> worldSPic cfig w
( (nWalls, nWins , nFls),(nShapeVs, nIndices, nSilIndices) )
<- MP.bindM3 (\ _ wlwifl counts -> return (wlwifl,counts))
( pokeBindFoldableLayer shadV layerCounts wp)
<- MP.bindM2 (\ wlwifl counts -> return (wlwifl,counts))
( pokeWallsWindowsFloor
(shadVBOptr $ _wallTextureShader pdata)
(shadVBOptr $ _windowShader pdata)
@@ -60,13 +60,32 @@ doDrawing pdata u = do
windowPoints
(_floorTiles w)
)
( pokeShape
( pokeSPics
shadV
layerCounts
(_vboPtr $ _vaoVBO $ _shadVAO $ _shapeShader pdata)
(_eboPtr $ _shapeEBO pdata)
(_eboPtr $ _silhouetteEBO pdata)
ws
(S.cons wallSPics $ worldSPic cfig w)
)
-- <- MP.bindM3 (\ _ wlwifl counts -> return (wlwifl,counts))
-- ( pokeBindFoldableLayer shadV layerCounts wp)
-- ( pokeWallsWindowsFloor
-- (shadVBOptr $ _wallTextureShader pdata)
-- (shadVBOptr $ _windowShader pdata)
-- (shadVBOptr $ _textureArrayShader pdata)
-- wallPointsCol
-- windowPoints
-- (_floorTiles w)
-- )
-- ( pokeShape
-- (_vboPtr $ _vaoVBO $ _shadVAO $ _shapeShader pdata)
-- (_eboPtr $ _shapeEBO pdata)
-- (_eboPtr $ _silhouetteEBO pdata)
-- ws
-- )
-- bind wall points, silhouette data, surface geometry
bindShaderLayers shadV layerCounts
uncurry bindShaderBuffers $ unzip
[ ( _wallTextureShader pdata, nWalls)
, (_shapeShader pdata, nShapeVs)