Hello Guest

[BUG] Exception in native code when creating a display with latest AMD driver

  • 4 Replies
  • 6706 Views
This may also be a bug in the AMD driver, but since the call stack doesn't mention the driver  I thought I would post here first.

Using the AMD driver version number 15.300.1025.0 and LWJGL 2.9.3 I get an exception when trying to create  a display.

I've managed to recreate the problem with only the very basic setup of a display (listed below). I have also added the minidump of the crash here: http://pastebin.com/kHhRZzcr.

It could be that this is not a lwjgl bug at all, but I would really appreciate some feedback!

Thanks!

Code: [Select]
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.PixelFormat;
 
public class OpenGLTest {
public static void main(String[] args) {

System.out.println("Creating dipslay");
try {
Display.setDisplayMode(new DisplayMode(1280, 720));
Display.setTitle("A fresh display!");
Display.create(new PixelFormat(32, 32, 32));
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
System.exit(1);
}
while(!Display.isCloseRequested()) {
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
}

*

Kai

You are using a PixelFormat(32, 32, 32).
No current graphics card supports 32 bit alpha, 32 bit depth or 32 bit stencil.
The very common PixelFormat(8, 24, 8 ) should work.
Though, LWJGL should of course not crash in that case. It should throw a proper exception indicating that this PixelFormat is unsupported.
« Last Edit: December 18, 2015, 11:43:02 by Kai »

*

Offline Cornix

  • *****
  • 488
Are you sure that the selected display mode is available? It may be that the bitdepth or frequency is illegal.
It is recommended to fetch available display modes first and then create a DisplayMode with bitdepth and frequency based on the available modes.

Thanks for the replies, and sorry about the strange pixel format, I was just trying out all sorts of formats. Using

I have changed the code to use
Code: [Select]
PixelFormat(8, 24, 8 ) but I still get the same error.

@Cornix, In the normal code of our game we do this, but I wanted to create the most simple demo that recreated the problem. But I'll change the demo to get the available modes first and will post what happens.

Code: [Select]
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.PixelFormat;
 
public class OpenGLTest {
public static void main(String[] args) {

System.out.println("Creating dipslay");
try {
Display.setDisplayMode(new DisplayMode(1280, 720));
Display.setTitle("A fresh display!");
Display.create(new PixelFormat(8, 24, 8));
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
System.exit(1);
}
while(!Display.isCloseRequested()) {
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
}

OK, now I've added code to get the displaymodes, and use the first available mode to try and create a display. It doesn't help though.

Also please note that I'm getting a crash in the native code, and the jvm pretty much just dies at the spot. The catch clause doesn't even get executed.

Code: [Select]
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.PixelFormat;
 
public class OpenGLTest {
public static void main(String[] args) {

try
{
DisplayMode[] displayModes = Display.getAvailableDisplayModes();
DisplayMode mode = displayModes[0];
Display.setDisplayMode(mode);
Display.setTitle("A fresh display!");
Display.create(new PixelFormat(mode.getBitsPerPixel(), 24, 8));
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
System.exit(1);
}
while(!Display.isCloseRequested()) {
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
}