0
\$\begingroup\$

I just got a new computer (Acer Aspire ES1-311) which has an integrated Intel HD Graphics card, and I noticed that this fisheye shader crashes my game (LibGDX game, VM Crash):

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 pos;
uniform float radius = 100;
uniform float scale = 1;
void main()
{
    vec2 textureCoordinateToUse = v_texCoords;
    float dist = distance(pos, v_texCoords);
    textureCoordinateToUse -= pos;
    if (dist < radius)
    {
        float percent = 1.0 + ((0.5 - dist) / 0.5) * scale;
        textureCoordinateToUse = textureCoordinateToUse * percent;
    }
    textureCoordinateToUse += pos;
    gl_FragColor = texture2D(u_texture, textureCoordinateToUse);
}

I've tried to update the drivers from the official site, but the driver application says that they might be incompatible with my computer!

However, does anyone spot anything "wrong" in the shader that might cause the crash?

Thanks.

\$\endgroup\$
  • \$\begingroup\$ When you get the crash, there is no debug info telling you what went wrong? \$\endgroup\$ – user39686 Jan 29 '15 at 18:04
  • \$\begingroup\$ Well, here's the crash log: pastebin.com/CYW5Znza \$\endgroup\$ – user2499946 Jan 29 '15 at 18:14
  • \$\begingroup\$ It also seems that I have the latest possible driver installed. \$\endgroup\$ – user2499946 Jan 29 '15 at 18:22
2
\$\begingroup\$

Try running the java VM with the option -Xss8M to set it to 8 Megabytes. You only have 9 Threads so you should be fine with 9x 8M stacks. Then reduce the amount until it crashes again, bring it back up a bit, then document in your FAQ that this option is needed for some video drivers.

java -Xss8M -jar myjarfile.jar

The crash logs points to the Intel driver needing a larger stack:

From the pastebin we can see that the stack allocated for the main thread is only 320KiB (327,680 Bytes, that's the default value)

=>0x15997000 JavaThread "LWJGL Application" [_thread_in_native, id=5440, stack(0x161c0000,0x16210000)]

And the stack pointer (ESP) is very near the bottom of the stack with only 73,364 bytes left (0x161d1e94 - 0x161c0000)

ESP=0x161d1e94 is pointing into the stack for thread: 0x15997000

And EAX is at the bottom:

EAX=0x161c0000 is an unknown value

We can also see some recursion inside the Intel driver with these code addresses appearing a few times in the call stack:

C  [ig7icd32.dll+0x36349f]

C  [ig7icd32.dll+0x119d42]

C  [ig7icd32.dll+0x119d31]

All these are strong hints that it is not a ""bug crash"" but simply that the stack is too small.

The main thread of a native applications usually have much larger stacks (8MB is not uncommon) so it's quite possible the driver needs a stack larger than 320KB.

\$\endgroup\$
  • \$\begingroup\$ Spot on! Thank you very much for the detailed answer, this was indeed the problem. \$\endgroup\$ – user2499946 Jan 30 '15 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.