<blockquote>
<p>Do laptop GPUs these days have built-in throttling that will slow them down when they get hot enough to risk damage ?</p>
</blockquote>
<p>Yes. Every portable computing device these days has “thermal throttling” — reducing the clock rate in order to keep temperature within safe limits. If one runaway program could destroy the hardware, that would be noticed — many games are not programmed especially carefully.</p>
<p>These mechanisms are not perfect — there have been incidents where a very particular workload produced localized heat that was not detected adequately and damaged the hardware. But those are rare exceptions.</p>
<blockquote>
<p>If so, then by programming in C using OpenGL, have I accidentally defeated this mechanism ?</p>
</blockquote>
<p>No, not at all. The mechanism is usually built into the hardware and firmware — because it's important that it keep operating regardless of what the parts of the system that run user-supplied code are doing. You're far above the layer of the system that would need to be disturbed to stop that.</p>
<p>The fact that your laptop is warm on the outside and running fans vigorously may be unpleasant to your hands and ears, but <em>does not</em> mean it is damaging itself. If the fans are running then that's a sign that the thermal protection <em>is working.</em></p>
<blockquote>
<p>Ought I to add a Sleep command to my animation loop, to avoid this ?</p>
</blockquote>
<p>No, you should notice when the window system tells you your window is minimized or otherwise fully obscured (I don't know how this works on Microsoft Windows but this is a feature offered by most platforms), and <em>stop rendering entirely.</em> Or maybe only render every second or so, for the sake of an updated preview image.</p>

CC BY-SA 4.0
2022-11-24T15:57:22.610Z
2022-11-24T15:57:22.610Z
Kevin Reid
<p>I have written a relatively simple interactive C program using OpenGL 4.4 with a vertex shader and a fragment shader, running in the CodeBlocks IDE on Windows. I included an FPS counter basically as in Anton Gerdelan's tutorial here:</p>
<p><a href="https://antongerdelan.net/opengl/glcontext2.html" rel="nofollow noreferrer">Gerdelan</a></p>
<p>However, instead of GLFW I just use the Windows API myself. When the graphics window is in focus, the reported fps stays around 60. I noticed recently when the program was still running, but was not the active window, that the fan started running very loudly and the laptop became very warm. Using ALT-TAB a preview of the various windows I had open appeared above the taskbar (I think), as is normal in that version of windows. In the little scaled-down preview of the graphics window, visible <em>before</em> choosing that as the active window, I could see that the fps was reported as 8000 fps or something like that. As soon as I selected that as the active window, the fps dropped down to 60 and the fan began to calm down.</p>
<p>Now I am worried - by tabbing away, have I accidentally defeated the mechanism that allows the operating system to tell my C program to wait until it is ready to swap the buffers, and if so, do I thereby risk allowing my program to run the GPU so hot that I will damage it ?</p>
<p>Do laptop GPUs these days have built-in throttling that will slow them down when they get hot enough to risk damage ? If so, then by programming in C using OpenGL, have I accidentally defeated this mechanism ?</p>
<p>Ought I to add a Sleep command to my animation loop, to avoid this ? Would that work ?</p>

CC BY-SA 4.0
2022-12-20T16:47:49.390Z
The swapBuffers call is likely unsynchronized (not waiting the the DWM's refresh to composite) when the window is occluded, and therefore you start consuming 100% CPU in a tight loop, rendering and swapping with no graphical result, but your framerate will climb into the thousands - taxing the CPU's render loop.  (Why render at all in this case?)
Wyck
CC BY-SA 4.0
2022-12-22T14:33:14.377Z
Thank you Wyck ! Do you know how I could synchronise the swapBuffers call and thereby avoid this ?
Simon
<opengl><gpu><frame-buffer>
Am I risking damaging my GPU?
Simon
# Am I risking damaging my GPU?

(Asked by: username_0 on 2022-11-24)

I have written a relatively simple interactive C program using OpenGL 4.4 with a vertex shader and a fragment shader, running in the CodeBlocks IDE on Windows. I included an FPS counter basically as in Anton Gerdelan's tutorial here:

[Gerdelan](https://antongerdelan.net/opengl/glcontext2.html)

However, instead of GLFW I just use the Windows API myself. When the graphics window is in focus, the reported fps stays around 60. I noticed recently when the program was still running, but was not the active window, that the fan started running very loudly and the laptop became very warm. Using ALT-TAB a preview of the various windows I had open appeared above the taskbar (I think), as is normal in that version of windows. In the little scaled-down preview of the graphics window, visible *before* choosing that as the active window, I could see that the fps was reported as 8000 fps or something like that. As soon as I selected that as the active window, the fps dropped down to 60 and the fan began to calm down.

Now I am worried - by tabbing away, have I accidentally defeated the mechanism that allows the operating system to tell my C program to wait until it is ready to swap the buffers, and if so, do I thereby risk allowing my program to run the GPU so hot that I will damage it ?

Do laptop GPUs these days have built-in throttling that will slow them down when they get hot enough to risk damage ? If so, then by programming in C using OpenGL, have I accidentally defeated this mechanism ?

Ought I to add a Sleep command to my animation loop, to avoid this ? Would that work ?

**Tags:** opengl, gpu, frame-buffer

> **Comments:**
> **username_1**: The swapBuffers call is likely unsynchronized (not waiting the the DWM's refresh to composite) when the window is occluded, and therefore you start consuming 100% CPU in a tight loop, rendering and swapping with no graphical result, but your framerate will climb into the thousands - taxing the CPU's render loop.  (Why render at all in this case?)  
> **username_0**: Thank you username_1 ! Do you know how I could synchronise the swapBuffers call and thereby avoid this ?  

---

## 1 answers

### Answer by username_2 on 2022-11-24. Score: 3 | Accepted answer

> Do laptop GPUs these days have built-in throttling that will slow them down when they get hot enough to risk damage ?

Yes. Every portable computing device these days has “thermal throttling” — reducing the clock rate in order to keep temperature within safe limits. If one runaway program could destroy the hardware, that would be noticed — many games are not programmed especially carefully.

These mechanisms are not perfect — there have been incidents where a very particular workload produced localized heat that was not detected adequately and damaged the hardware. But those are rare exceptions.

> If so, then by programming in C using OpenGL, have I accidentally defeated this mechanism ?

No, not at all. The mechanism is usually built into the hardware and firmware — because it's important that it keep operating regardless of what the parts of the system that run user-supplied code are doing. You're far above the layer of the system that would need to be disturbed to stop that.

The fact that your laptop is warm on the outside and running fans vigorously may be unpleasant to your hands and ears, but *does not* mean it is damaging itself. If the fans are running then that's a sign that the thermal protection *is working.*

> Ought I to add a Sleep command to my animation loop, to avoid this ?

No, you should notice when the window system tells you your window is minimized or otherwise fully obscured (I don't know how this works on Microsoft Windows but this is a feature offered by most platforms), and *stop rendering entirely.* Or maybe only render every second or so, for the sake of an updated preview image.


---

