nphollon / into-the-heavens

GNU General Public License v3.0
12 stars 0 forks source link

webgl resource leak??? #1

Open roovo opened 8 years ago

roovo commented 8 years ago

Hi Nick

[thanks for comment on elm-discuss btw] - been having a look at and play with your game....

This isn't an issue with into-the-heavens as such, but I can see the same issues when I run it as I am getting with my elm-web-gl based project so am putting this here to ask if you also experience it - is it an issue with my setup or is it an elm or elm-webgl issue?

I'm basically managing to kill my browser (and bring my whole machine to it's knees) when running into-the-heavens if I just point up at the start of a game and then leave it running for (quite) a while. I am running it inside Vagrant on a MacBook Pro and using Chrome on the Macbook to run the game - see screenshot below:

screen shot 2016-09-03 at 17 37 28

CPU usage for Chrome creeps up and the GPU graph (using XRG for this) just keeps going up. Eventually my mac becomes somewhat unresponsive and I have to wait a while for it to recover!?$#! ..assuming I kill the window in chrome in time...

Do you see this also?? In my project I think this is happening due to elm-webgl sending many more buffers to the graphics card than it needs to due to the fact that if the "Drawable attributes" passed into WebGL.render is a function that takes any arguments at all then it seems to always rerun the function (even if the arguments are the same) and uses the new version as a fresh mesh to upload to WebGL (which means it never re-uses buffers cached inside elm-webgl).

Hope you don't mind me asking this here as an issue, when I know it isn't an issue with your elm code at all!

All the best

roovo

nphollon commented 8 years ago

Hi roovo,

I don't mind at all, and I appreciate you taking interest in the project!

I have not noticed this personally -- running Firefox on Linux Mint. How long did you leave the game running before seeing this problem? (I notice it says 2 days, 20 hours, 47 minutes in the screenshot!) I haven't been worrying too much about performance yet, as I've been focused on other issues (namely, getting the bugs out of the !$#@ collision detection code).

if the "Drawable attributes" passed into WebGL.render is a function that

takes any arguments at all then it seems to always rerun the function

I don't think this is related to the performance problem you are seeing with my code, but I did run into this problem. My solution: don't make your Drawables functions! I keep the Drawables stored in the model, and I don't change them during the gameplay. So when WebGL.render gets called, it always uses the cached version of the model. The only data I am updating on each frame is the uniforms.

On Sat, Sep 3, 2016 at 10:23 AM, roovo notifications@github.com wrote:

Hi Nick

[thanks for comment on elm-discuss btw] - been having a look at and play with your game....

This isn't an issue with into-the-heavens as such, but I can see the same issues when I run it as I am getting with my elm-web-gl based project so am putting this here to ask if you also experience it - is it an issue with my setup or is it an elm or elm-webgl issue?

I'm basically managing to kill my browser (and bring my whole machine to it's knees) when running into-the-heavens if I just point up at the start of a game and then leave it running for (quite) a while. I am running it inside Vagrant on a MacBook Pro and using Chrome on the Macbook to run the game - see screenshot below:

[image: screen shot 2016-09-03 at 17 37 28] https://cloud.githubusercontent.com/assets/5251/18226395/70926be6-7200-11e6-8e46-92a602b31924.png

CPU usage for Chrome creeps up and the GPU graph (using XRG for this) just keeps going up. Eventually my mac becomes somewhat unresponsive and I have to wait a while for it to recover!?$#! ..assuming I kill the window in chrome in time...

Do you see this also?? In my project I think this is happening due to elm-webgl sending many more buffers to the graphics card than it needs to due to the fact that if the "Drawable attributes" passed into WebGL.render is a function that takes any arguments at all then it seems to always rerun the function (even if the arguments are the same) and uses the new version as a fresh mesh to upload to WebGL (which means it never re-uses buffers cached inside elm-webgl).

Hope you don't mind me asking this here as an issue, when I know it isn't an issue with your elm code at all!

All the best

roovo

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nphollon/into-the-heavens/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABybz7rp5w8Ti2LOxhqaOE67EUm-a5NAks5qmaz5gaJpZM4J0WRI .