Full Frontal Nudity
Full Frontal Nudity

Reputation: 383

OpenGL artifacts: where do they come from?

Crap

STORY

I've been coding in OpenGL for about a year now (on the same hardware), and I've only recently been getting artifacts like the ones in the image above. They show up after running my program consecutively in a short period of time (couple of mins), and appear anywhere: from WordPad (see picture) to my desktop and taskbar or even other games (league of legends launcher, it's a software renderer i think).

They can take any form similar to what you see in the image: black/white blocks or pieces of texture from my application. The artifacts dissapear after the affected application refreshes it's screen.

INFO

My Application looks just Fine itself, no artifacts

I am using an ATI m5800 card with the latest driver (I have an hp elitebook 8540w), windows 7 64bit and Opengl 3.3 or lower.

Why am I not posting a code sample? Because (as obnoxious as it sounds) it does not directly seem to be a specific part of my code that is causing the artifacts, I can easily run the program for 15 minutes without a problem. My Graphics card will heat up to 68 degrees celcius and no artifacts will occur. The artifacts start to happen after multiple consecutive runs, though my video card will never heat up past 68 degrees even when the artifacts occur.

Why am I posting this here? Because I am still not sure whether this is caused by my code or my hardware/drivers, and I think this question is difficult enough from a technical standpoint in a way that I will only get the "buy a new GC" answer in any other place.

I use alot of OpenGL, anything from framebuffers and shaders to 3d textures and buffertextures and texturearrays and what not.

My hardware has not suffered any damage as far as I'm aware, though it is an elitebook so it is prone to overheating.

MY GUESS

(When I mention RAM, I mean video RAM, on my graphics card)

I don't know a whole lot about OpenGL and I know even less about Graphics cards and their drivers, but I'll try to approach this and you can shoot my down at any point. The following is a disorganized train of thought, feel free to only read the bold parts.

All internet sources I can find on graphics artifacts tell me I have bad RAM caused by overheating.

However, if this is the case, then why is this "bad RAM" only accessed after consecutive runs, and never after a fresh start? Shouldn't my OS clean up all graphics memory when my application stops, resetting the state of my GC? If I have bad RAM, it seems that my graphics card cannot keep up with disposing my data and eventually accesses this piece of ram when everything else is "taken". And if the malfunctioning of the RAM is based on temperature, then why can I run my application once for 15 minutes, but not 4 times in the same period if the temperature stays the same?

Also, it it is truly bad ram, then why am I seeing part of my texture? Wouldn't this imply that the RAM worked fine at one part? (The blue blocks in the picture are part of a texture I use)

And more importantly: Why do I only seem to get artifacts with my application and nowhere else? Not one other application I have installed produces these artifacts anywhere!

This would suggest that it is not my hardware but me, I am doing something wrong! (Or OpenGL is doing something wrong on my laptop, since most games likely run on DirectX).

And now the last part, which makes the entire thing a miracle: My hardware is funded partly by my university, this means a friend of mine has identical hardware (truly identical 100%), and he does not get any artifacts running my code.

So... is it a driver bug then? My friend is running the same driver as me... I am totally lost here.

All I can conclude is that my RAM is broken, and somehow everybody manages to avoid the bad parts except for me and my application.

What I am trying to ask is this: How did I get these artifacts? and how are some applications able to avoid them? What is going on in the hardware/software?

PS: I understand this is quite unstructured and chaotic as a question, this is because I've been at this for a while and I've tried to include any piece of information I have found. I will appreciate ANY piece of information anyone might think is related to this subject, today or a year from now, and I will gladly restructure this post if any suggestions come up. I've searched alot about artifacts but a great deal of search results describe anomalies due to code, restricted to the application in question, which is of little help to me. This means I could have missed important sources, if you think I did, please link them.

Contrary to what this might look like, I am only asking for information and discussion, not for a direct solution, the best solution is obviously to buy a new graphics card.

Important source : Diagnosing video card problems

Upvotes: 1

Views: 1783

Answers (1)

datenwolf
datenwolf

Reputation: 162164

All internet sources I can find on graphics artifacts tell me I have bad RAM caused by overheating.

And they're most likely right. This is the typical kind of error seen with defective graphics RAM.

However, if this is the case, then why is this "bad RAM" only accessed after consecutive runs, and never after a fresh start?

Because after a fresh start only a smaller portion of the graphics RAM are actually used. Something like only the first 64MiB or so. That's a rather miniscule amount of memory, compared to the huge quantities of RAM present on modern graphics card (several 100MiB).

After your program did run for a little while it consumes some RAM, even more so, if it's creating and freeing a lot RAM. For performance reasons all allocations of graphics RAM must be contiguous. And to keep things simple and fast the driver will merely increment the base pointer for further allocations to the beginning of unused, contiguous RAM.

Shouldn't my OS clean up all graphics memory when my application stops, resetting the state of my GC?

Well, say the OS did reserve some new graphics memory while your program was running, even if the program terminates, the other allocations will stay. Or after your program terminates the internal state of the driver will make it hand out different portions of memory than before.

So not all of your graphics RAM is defective. Only later parts which will be accessed only with the first part of (nondefective) RAM being pre-allocated.

Technically it was possible to identify the defective parts of RAM and no longer use it. But there's no support (I know about) for it in the drivers.

Upvotes: 2

Related Questions