From 07bcb2a2e4c52b0a0f3c34bc1a70772e4ab2dbb5 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Mon, 3 Jun 2019 22:18:44 -0400 Subject: Specify stream name for GPU-ringbuffers. --- GPURing.hs | 6 +++--- MeshSketch.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPURing.hs b/GPURing.hs index d5f46af..3002c9e 100644 --- a/GPURing.hs +++ b/GPURing.hs @@ -25,8 +25,8 @@ import LambdaCube.GL.Input hiding (createObjectCommands) -- > ringBuffer <- newRing capacity (VectorRing.new capacity) type Update keys = (keys -> Writer [DSum AttributeKey GLUniformValue] ()) -new :: Data keys => GLStorage -> (String -> String) -> Int -> IO (TargetBuffer (Update keys)) -new storage toAttr sz = fix $ \retProxy -> do +new :: Data keys => String -> GLStorage -> (String -> String) -> Int -> IO (TargetBuffer (Update keys)) +new streamName storage toAttr sz = fix $ \retProxy -> do let paramProxy = paramProxy' retProxy where paramProxy' :: io (targetbuffer (keys -> writer)) -> Proxy keys paramProxy' _ = Proxy @@ -35,7 +35,7 @@ new storage toAttr sz = fix $ \retProxy -> do gd0 <- uploadDynamicBuffer sz ps let gd = gd0 { dPrimitive = LineStrip } Just keys <- return $ lookupAttrKeys (lookupAttributeKey gd . toAttr) - obj <- addToObjectArray storage "Points" [] gd + obj <- addToObjectArray storage streamName [] gd -- readIORef (objCommands obj) >>= mapM_ print return TargetBuffer { syncBuffer = \mask -> do updateCommands storage obj mask diff --git a/MeshSketch.hs b/MeshSketch.hs index 15af94f..dc0adf1 100644 --- a/MeshSketch.hs +++ b/MeshSketch.hs @@ -172,7 +172,7 @@ uploadState obj glarea storage = do let bufsize = 1000 v <- MV.unsafeNew bufsize pts <- newRing bufsize (Vector.new v) - ring <- newRing bufsize (GPU.new storage ringPointAttr bufsize) + ring <- newRing bufsize (GPU.new "Points" storage ringPointAttr bufsize) -- setup FrameClock w <- toWidget glarea -- cgit v1.2.3