I hate my alarm. A story about an Intel graphics bug

August 23, 2016

It’s another day. I hate my alarm, I know I should change it but I will forget about it before I’m fully awake. I spend about 20 minutes lying in bed. Gimli, my pug, makes sure that I’m in a good mood by licking my face with enthusiasm. He turns around and lies postrate. Not forgetting to return the favor, I rub his belly. I envy how he is able to lie there, legs open and balls to the wind.

I decide that I would rather do something other than lie in bed all day. I stand up and go downstairs to make breakfast. I open the door to the yard so that Gimli can pee. I make the same breakfast I have made every day for more than two months. A poached egg on a full-wheat slice of bread. I’m not tired of it. I eat while reading. Then I make myself some black tea and read some more.

Twenty minutes in the elliptical machine and then I will take Gimli for a walk. We are outside for a short while when I feel pain in my spine, which radiates to the right side of my back. Part of the reason that I use the elliptical machine is to prevent this from happening. I should do more exercises to strengthen my back muscles.

It’s morning again. I hate my alarm. I wake up; play with Gimli; make breakfast; read; and work out, this time with a weird-looking exercise that I hope will make my back stronger. I told myself that I’m doing something right, since yesterday’s episode only lasted a couple hours.

I go to my machine. Only one monitor is turned on and I remember that Milton, my program, has a very weird bug that I can replicate on machines with relatively recent Intel integrated graphics. It takes me two hours to find it. My vertex shader is not setting the w coordinate. On Nvidia this is fine, but it seems to be a problem on Intel. The thing that made me say “aha!” and find the bug was a weird effect in which paintings looked three-dimensional.

3d effect

Looks pretty cool, but the three-dimensional effect was a clue that the w coordinate for the points of each brush stroke was set to the same value as its z-coordinate. OpenGL divides x,y and z by w. It’s a projection from projective geometry to the euclidean 3D space.

That’s not the only bug, though. The screen is flickering. This bug will take me another three hours to find, and I will feel dumb when I finally find it. The bug goes away when I force Milton to redraw everything every frame. When it only redraws the portions of the screen that need updating, the driver seems to release the data that I expect to still be there. I spend a lot of time on that hypothesis until I realize that it’s actually two bugs, not one. I fix the first bug. I am doing super-sampling manually and I forgot to divide by the super-sampling factor. Or did I forget to multiply? Whatever. It’s the second or third time that this problem has bitten me in the ass so I know it’s time to change the way I am doing anti-aliasing.

But not before fixing the second bug. The flickering effect is still there but after fixing the first bug I can finally see that the problem is caused by double-buffering. I finally understand. It’s a familiar feeling, to go from having no clue why the Intel driver is not working and seriously thinking it might be the driver’s fault, to fixing it and wondering how it worked on Nvidia at all.

It’s morning again. I hate my alarm. I stand up; make breakfast; have tea. This time I walk Gimli with my mom and our other dog. Today I have to fix the super-sampling bug. It’s not the only issue on Intel – it’s giving me a very weird bug where colors don’t look right. I’m seriously thinking it might be the driver’s fault.

I like my routine, but it is not going to last long. Now that I finally have my degree I am looking for a job. Today I am excited because I’m applying to a company that I had not considered yet. I might not get in, but I think I can get an interview. I know that these kinds of interviews are as much about luck as they are about skill at the whiteboard. It’s going to be fine.