diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-17 14:58:39 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-17 18:41:18 -0400 |
commit | d8bcacc5effefb161f0c6b51a34ad82e3f8d3b4e (patch) | |
tree | 7ec544d415038e9d921a7090850d4223ac06456f /LambdaCubeWidget.hs | |
parent | 395f3b525090097c88434b03c88fe2fb8b8d7aba (diff) |
Deallocate GPU resources when done with them.
Diffstat (limited to 'LambdaCubeWidget.hs')
-rw-r--r-- | LambdaCubeWidget.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/LambdaCubeWidget.hs b/LambdaCubeWidget.hs index 17bb361..0adb70c 100644 --- a/LambdaCubeWidget.hs +++ b/LambdaCubeWidget.hs | |||
@@ -70,11 +70,14 @@ lcrender lc gl = do | |||
70 | lcunrealize :: LCMethods x -> IO () | 70 | lcunrealize :: LCMethods x -> IO () |
71 | lcunrealize lc = do | 71 | lcunrealize lc = do |
72 | m <- tryTakeMVar $ lcRealized lc | 72 | m <- tryTakeMVar $ lcRealized lc |
73 | mapM_ (\(LCRealized _ _ x) -> lcDestroyState lc x) m | 73 | forM_ m $ \(LCRealized storage renderer x) -> do |
74 | LC.disposeStorage storage | ||
75 | LC.disposeRenderer renderer | ||
76 | lcDestroyState lc x | ||
74 | 77 | ||
75 | lcrealize :: LCMethods x -> IO () | 78 | lcrealize :: LCMethods x -> IO () |
76 | lcrealize lc = do | 79 | lcrealize lc = do |
77 | _ <- tryTakeMVar (lcRealized lc) | 80 | lcunrealize lc |
78 | storage <- LC.allocStorage (dynamicSchema $ lcPipeline lc) | 81 | storage <- LC.allocStorage (dynamicSchema $ lcPipeline lc) |
79 | x <- lcUploadState lc storage | 82 | x <- lcUploadState lc storage |
80 | renderer <- LC.allocRenderer (dynamicPipeline $ lcPipeline lc) | 83 | renderer <- LC.allocRenderer (dynamicPipeline $ lcPipeline lc) |