summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-05-18 17:42:05 -0400
committerJoe Crayne <joe@jerkface.net>2019-05-18 17:42:05 -0400
commite67f54cb87bdb3bbed2d0196b75a40e8209e7756 (patch)
treed71e49b74ceff3b9011397b649064c9ccd444b0d
parent7b366a9d7e80ff7d9847eafb7a47fba06faac40e (diff)
Fixed gpu upload of PointPrimitive ring buffer.
-rw-r--r--PointPrimitiveRing.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/PointPrimitiveRing.hs b/PointPrimitiveRing.hs
index bd9a15b..ff55df5 100644
--- a/PointPrimitiveRing.hs
+++ b/PointPrimitiveRing.hs
@@ -30,9 +30,9 @@ data Ring = Ring
30 { rBufferObject :: Word32 30 { rBufferObject :: Word32
31 , rStorage :: GLStorage 31 , rStorage :: GLStorage
32 , rObject :: Object 32 , rObject :: Object
33 , rSize :: IORef CPtrdiff 33 , rSize :: IORef CPtrdiff -- Current count of Floats in the ring buffer.
34 , rStart :: IORef CPtrdiff 34 , rStart :: IORef CPtrdiff -- Float-index where next vector will be added. TODO: rename this.
35 , ringCapacity :: CPtrdiff 35 , ringCapacity :: CPtrdiff -- Maximum number of floats in buffer.
36 } 36 }
37 37
38addToObjectArray :: GLStorage 38addToObjectArray :: GLStorage
@@ -210,9 +210,9 @@ updateRingCommands r = do
210 start <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rStart r 210 start <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rStart r
211 size <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rSize r 211 size <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rSize r
212 let mask 0 = [] 212 let mask 0 = []
213 mask cnt = if start + size < cnt 213 mask cnt = case cnt + start - size of
214 then [(start,size)] 214 st | st > cnt -> [(st - cnt,size)]
215 else [(0,start + size - cnt), (start,cnt-start)] 215 | otherwise -> [(0,start), (st,cnt - st)]
216 updateCommands (rStorage r) (rObject r) mask 216 updateCommands (rStorage r) (rObject r) mask
217 readIORef (objCommands $ rObject r) >>= mapM_ print 217 readIORef (objCommands $ rObject r) >>= mapM_ print
218 return () 218 return ()