UnderwaterApps / overlap2d

Overlap2D Game development toolkit for UI and Level design
Other
780 stars 224 forks source link

My GPU on my Mac overheats when running Overlap2D #413

Open KevinNorth opened 8 years ago

KevinNorth commented 8 years ago

When I run Overlap2D on my Mac, my GPU quickly reaches nearly 100ºC and stays at that temperature until I close the editor. This happens even when I leave Overlap2D running in the background without opening a project.

Here's a screenshot showing the temperature of my GPU when I'm running Overlap2D:

Notice my fan speeds and the "TCGC PECI GPU" temperature. The CPU is doing fine.

Here are my computer's specs:

General information:

GPU:

Molitor:

My computer is running Java 1.8.0_74 as its JRE.

KevinNorth commented 8 years ago

(I also posted this issue on the Overlap2D community forums.)

reegankens commented 7 years ago

Yes I have the problem too, i test in my imac and my macbook pro retina display. i think u must fix this problem. thanks KevinNorth I check in my ram, cpu process but no problems, apparently the problem is in the GPU

bruceloco commented 7 years ago

I'm still new at this, I have not see the graphical calls, but it could be a java issue. How do other java apps behave? play some sort of graphics intensive java game and see if it has anything to do with your java version

meonlineonmess commented 7 years ago

I am also experiencing high CPU usage with Overlap2D and also VisEditor when these 2 and minimized on OS X. Please fix the issue on Overlap2D.

bruceloco commented 7 years ago

CPU or GPU? VisEditor is also based on Java. What is your graphics card? Sounds like it could be java trying to us hardware acceleration via OpenCL and doing it wrongly.

meonlineonmess commented 7 years ago

I have a mac retina early 2015 which has intel iris graphics 6100. I am 100% the issue is only on macOS because I just tried 5 minutes ago Overlap2D in a Windows 7 virtual machine and I get no issue in Windows, just on OS X. I use AppPolice(in macOS) to limit the cpu usage of the Overlap2D process which I keep it at 20%. Therefor I do not permit it to go higher than that, but it is using resources for no reason and I read on this forum that it has something to do with the FPS which tries to go over 60 fps. The thing is that in OS X Mavericks and macOS Sierra all apps are limited to 60fps and they can not go higher, whereas in older OS X versions this limitation was not imposed. I used an app to see how many FPS I get when running Overlap and it always shows me 60fps and sometimes 61.5 and it looks like something is struggling to keep the FPS below 60. In other apps when running them I get around 10 fps when moving the mouse.

It is definetly something with the rendering, unfortunately I have no idea how to fix it. I read here that it was fixed in some early release but it doesn't seem to the case and I am not the only one experiencing this issue.

I hope my information will help fix this issue somehow, because Overlap2D is awesome :)

bruceloco commented 7 years ago

Can you build from source? I think I might have found the place to fix this

meonlineonmess commented 7 years ago

Well I just downloaded the sources and I imported the gradle projects in my eclipse workspace(common-api,master,runtime-libgdx, extension and spine-runtime-libgdx). The master project and the spine-runtime-libgdx both are marked as having issues because of some missing imports. If you'll tell me where to change the code to make it work I'll give it a try to see if it'll fix the problem and I will let you know :).

bruceloco commented 7 years ago

I am not even sure it is this file, I was just looking a bit on how this is done and trying to find bugs on the underlying libs: this led me to package com.badlogic.gdx.backends.lwjgl, function LwjglApplicationConfiguration:

public boolean vSyncEnabled = true;

and / Target framerate when the window is in the foreground. The CPU sleeps as needed. Use 0 to never sleep. / public int foregroundFPS = 60; / Target framerate when the window is not in the foreground. The CPU sleeps as needed. Use 0 to never sleep, -1 to not render. / public int backgroundFPS = 60;

based on these threads: https://github.com/libgdx/libgdx/issues/3629 I could be totally off track but give it a go

bruceloco commented 7 years ago

Ah yeah, there were some instructions on the forum on how to build from source: http://overlap2d.com/forums/topic/how-to-compile-and-run-overlap2d-editor-from-source-code/ Otherwise you can't build it

meonlineonmess commented 7 years ago

I get too many errors(100) after running ./gradlew assemble

meonlineonmess commented 7 years ago

I downloaded the source files and after importing the repo in eclipse it can not find the main class to run. In Run Configurations I can't select it. I guess I am supposed to run ./gradlew assemble first and after that it'll generate some other files. I don't know.

bruceloco commented 7 years ago

use git and follow the advice on the forum to set the branch

meonlineonmess commented 7 years ago

I get this error when compiling:

"IdeaProjects/overlap2d/spine-runtimes/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java:770: error: cannot find symbol float[] vertices = verticesArray.setSize(vertexCount); ^ symbol: method setSize(int) location: variable verticesArray of type FloatArray

"

Also it can not run the project because it can not find setSize()

bruceloco commented 7 years ago

git clone https://github.com/UnderwaterApps/overlap2d.git cd overlap2d ./gradlew assemble cd spine-runtimes git checkout 419982695f3e41e36e7582ccf26c85db897c0416 cd .. ./gradlew build ./gradlew run

for me the error went away then you only need the last 2 commands to build and run after changes

meonlineonmess commented 7 years ago

well I got my clone using git from IntelliJ this time and at "./gradlew assemble" I get the failed message cause of some methods like setSize() which could not be found

I ran "./gradlew assemble" manually. Run -> main gives me the same issue.

bruceloco commented 7 years ago

yeah, I don't use intelij to build anymore, just command line

meonlineonmess commented 7 years ago

this time I used the terminal to clone the repo and I got the same error :|

bruceloco commented 7 years ago

did you just run the commands as pasted? or did you use intelij to build? the above commands worked for me. I have jdk 8, java runtime 1.8, gradle 3.3 Running a 2009 27" imac with Sierra on it

The first gradlew assemble will fail, but the build will work after that branch is checked out

meonlineonmess commented 7 years ago

I recorded my terminal actions. You can watch the video clip here, it is a dropbox share link->. https://www.dropbox.com/s/3iuf47bt7rlmimm/Issue.mov?dl=0.

bruceloco commented 7 years ago

./gradlew assemble is expected to fail.

Go ahead and do this after it fails: cd spine-runtimes git checkout 419982695f3e41e36e7582ccf26c85db897c0416 cd .. ./gradlew build ./gradlew run

meonlineonmess commented 7 years ago

ok it opens Overlap after building and ./gradlew run.

bruceloco commented 7 years ago

now you can play with the settings above:

public boolean vSyncEnabled = true; <- possibly try with false and / Target framerate when the window is in the foreground. The CPU sleeps as needed. Use 0 to never sleep. / public int foregroundFPS = 60; / Target framerate when the window is not in the foreground. The CPU sleeps as needed. Use 0 to never sleep, -1 to not render. / public int backgroundFPS = 60; <- possibly -1, not sure why this would actually be enabled for background work

meonlineonmess commented 7 years ago

ok I'll try at 12 o'clock cause I have to go to sleep. It is 3:30am where I live. I guess I have to replace the .jar dependency with the modified one(new jar compilation from https://github.com/libgdx/libgdx/tree/master/backends/gdx-backend-jglfw/src/com/badlogic/gdx/backends/jglfw ), right? cause the .class can not be changed.

meonlineonmess commented 7 years ago

I can't change the vSync variable because it is in a .class file and it is a Gradle dependency which I guess it means that it always downloads the requested .jar and it overwrites it.

bruceloco commented 7 years ago

I'm trying to decompile the file gdx-backend-lwjgl-1.7.1.jar(stored in the gradle cache) to edit it to change the settings and see if this is the issue. Then you can edit build.gradle and comment out: compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"

However, I have never done java before or intelij or whatever so it is a bit of a hard effort for me.

meonlineonmess commented 7 years ago

I tried to integrate a Scene into my project but the tutorials are beyond outdated

azakhary commented 7 years ago

Hi guys! can I help in any way? what has to be changed to fix this? I am not sure why you try to decompile things, if the source is already here to change things in it?

meonlineonmess commented 7 years ago

@azakhary you could try to play with the vSync feature to turn it off just to see if makes a difference on macOS.

public boolean vSyncEnabled = true; <- possibly try with false and / Target framerate when the window is in the foreground. The CPU sleeps as needed. Use 0 to never sleep. / public int foregroundFPS = 60; / Target framerate when the window is not in the foreground. The CPU sleeps as needed. Use 0 to never sleep, -1 to not render. / public int backgroundFPS = 60; <- possibly -1, not sure why this would actually be enabled for background work

azakhary commented 7 years ago

I do remember that it is related, and I tried something like that but it broke something else, while fixed the CPU load. I'll try from osx machine when I get to office. But if you guys can just run it from sources, then take a look at Main.java ( https://github.com/UnderwaterApps/overlap2d/blob/master/overlap2d/src/com/uwsoft/editor/Main.java#L69) maybe you can configure vSync for JglfwApplication or config (one of them has to have that)

bruceloco commented 7 years ago

@meonlineonmess did you manage to decompile/change settings/recompile? I read that there are lots of issues with libdgx on osx with intel iris chips.

azakhary commented 7 years ago

I think vsync can be set in JglfwApplicationConfiguration config in Main.java that's the easiest way to test it.

bruceloco commented 7 years ago

@azakhary ah, that way is way easier I will give it a go

meonlineonmess commented 7 years ago

@azakhary should it be like a vm args thing? like -vsync=false ?

azakhary commented 7 years ago

Thanks! Let us know if it helps. to my knowledge, it should help, but will break something else, that is probably easy or hard to fix. Anyway, I am curious too.

azakhary commented 7 years ago

@meonlineonmess all you need to do is to add this line in Main.java after: JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); ... config. setVSync(false);

meonlineonmess commented 7 years ago

ok I'll give it a try

azakhary commented 7 years ago

And this will only be for osx, as it is in OSX if block.

meonlineonmess commented 7 years ago

Ok I compiled it and this is where I changed the code:

config.vSync=false;--> with this option off when Overlap2D is opened the CPU usage stays around 50% but does not go further and the FPS counter shows me 252 fps. The good thing is that when the app is minimized the cpu usage goes to sleep whereas before it kept on running.

" if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Overlap2D"); JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); config.width = (int) (width); config.height = (int) (height - height * .04); config.backgroundFPS = 0; config.vSync=false; < --- config.title = "Overlap2D - v" + AppConfig.getInstance().version; new JglfwApplication(overlap2D, config); } else {

"

bruceloco commented 7 years ago

so as far as your machine is concerned it is fixed with the vsync right?

meonlineonmess commented 7 years ago

@bruceloco no it is not fixed because when Overlap2D is in focus the CPU still gets hot over 80 Degrees. With config.vSync=false; I can turn the CPU usage off by minimizing the program whereas before it kept running even when it was minimized.

bruceloco commented 7 years ago

how about reducing foregroundFPS? by default it is set to 60

meonlineonmess commented 7 years ago

Why does it use unnecessary fps? 250 or 60 is way to high for this application

meonlineonmess commented 7 years ago

for example when using the mail program I get around 15 fps and when scrolling through the messages using the touchpad with innertia it goes as far as ~30 fps. However in Overlap2D it needs more than 252 fps with an empty scene.

azakhary commented 7 years ago

adding config.setForegroundFPS(60) ; should fix the issue, I suppose.

bruceloco commented 7 years ago

this is more likely a jglfw problem, the opengl java framework. I have not really done anything with the program yet, just fixed the weird button alignment issue so I have not see any performance impact or config.foregroundFPS = 60;

bruceloco commented 7 years ago

Ah, in the libray, this is not set by default to anything... that is why it must be trying to max out on jglfw there is nothing on the defaults and this one is used on OSX, only on Lwjgl which is used on the windows build

azakhary commented 7 years ago

yep. sounds reasonable. so setting it from code in config, should be required then.

meonlineonmess commented 7 years ago

I tried config.foregroundFPS=60 but it does not fix the issue

azakhary commented 7 years ago

they also have some kind of hiddenFPS param. I have no idea what it does though.