|
@@ -91,7 +91,7 @@ import java.util.logging.Logger;
|
|
*/
|
|
*/
|
|
public abstract class LwjglContext implements JmeContext {
|
|
public abstract class LwjglContext implements JmeContext {
|
|
|
|
|
|
- private static final Logger LOGGER = Logger.getLogger(LwjglContext.class.getName());
|
|
|
|
|
|
+ private static final Logger logger = Logger.getLogger(LwjglContext.class.getName());
|
|
|
|
|
|
static {
|
|
static {
|
|
System.setProperty(BufferAllocatorFactory.PROPERTY_BUFFER_ALLOCATOR_IMPLEMENTATION, LWJGLBufferAllocator.class.getName());
|
|
System.setProperty(BufferAllocatorFactory.PROPERTY_BUFFER_ALLOCATOR_IMPLEMENTATION, LWJGLBufferAllocator.class.getName());
|
|
@@ -120,7 +120,7 @@ public abstract class LwjglContext implements JmeContext {
|
|
}
|
|
}
|
|
|
|
|
|
protected void printContextInitInfo() {
|
|
protected void printContextInitInfo() {
|
|
- LOGGER.log(Level.INFO, "LWJGL {0} context running on thread {1}\n"
|
|
|
|
|
|
+ logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n"
|
|
+ " * Graphics Adapter: GLFW {2}",
|
|
+ " * Graphics Adapter: GLFW {2}",
|
|
new Object[]{org.lwjgl.Version.getVersion(), Thread.currentThread().getName(), GLFW.glfwGetVersionString()});
|
|
new Object[]{org.lwjgl.Version.getVersion(), Thread.currentThread().getName(), GLFW.glfwGetVersionString()});
|
|
}
|
|
}
|
|
@@ -142,7 +142,7 @@ public abstract class LwjglContext implements JmeContext {
|
|
samples = settings.getSamples();
|
|
samples = settings.getSamples();
|
|
final int supportedSamples = determineMaxSamples();
|
|
final int supportedSamples = determineMaxSamples();
|
|
if (supportedSamples < samples) {
|
|
if (supportedSamples < samples) {
|
|
- LOGGER.log(Level.WARNING,
|
|
|
|
|
|
+ logger.log(Level.WARNING,
|
|
"Couldn't satisfy antialiasing samples requirement: x{0}. "
|
|
"Couldn't satisfy antialiasing samples requirement: x{0}. "
|
|
+ "Video hardware only supports: x{1}",
|
|
+ "Video hardware only supports: x{1}",
|
|
new Object[]{samples, supportedSamples});
|
|
new Object[]{samples, supportedSamples});
|
|
@@ -252,12 +252,12 @@ public abstract class LwjglContext implements JmeContext {
|
|
}
|
|
}
|
|
|
|
|
|
protected void initOpenCL(long window) {
|
|
protected void initOpenCL(long window) {
|
|
- LOGGER.info("Initialize OpenCL with LWJGL3");
|
|
|
|
|
|
+ logger.info("Initialize OpenCL with LWJGL3");
|
|
|
|
|
|
// try {
|
|
// try {
|
|
// CL.create();
|
|
// CL.create();
|
|
// } catch (Exception ex) {
|
|
// } catch (Exception ex) {
|
|
-// LOGGER.log(Level.SEVERE, "Unable to initialize OpenCL", ex);
|
|
|
|
|
|
+// logger.log(Level.SEVERE, "Unable to initialize OpenCL", ex);
|
|
// return;
|
|
// return;
|
|
// }
|
|
// }
|
|
|
|
|
|
@@ -298,7 +298,7 @@ public abstract class LwjglContext implements JmeContext {
|
|
platformInfos.append("\n * * Supports interop: ").append(device.hasOpenGLInterop());
|
|
platformInfos.append("\n * * Supports interop: ").append(device.hasOpenGLInterop());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- LOGGER.info(platformInfos.toString());
|
|
|
|
|
|
+ logger.info(platformInfos.toString());
|
|
|
|
|
|
//choose devices
|
|
//choose devices
|
|
PlatformChooser chooser = null;
|
|
PlatformChooser chooser = null;
|
|
@@ -306,7 +306,7 @@ public abstract class LwjglContext implements JmeContext {
|
|
try {
|
|
try {
|
|
chooser = (PlatformChooser) Class.forName(settings.getOpenCLPlatformChooser()).newInstance();
|
|
chooser = (PlatformChooser) Class.forName(settings.getOpenCLPlatformChooser()).newInstance();
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
- LOGGER.log(Level.WARNING, "unable to instantiate custom PlatformChooser", ex);
|
|
|
|
|
|
+ logger.log(Level.WARNING, "unable to instantiate custom PlatformChooser", ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (chooser == null) {
|
|
if (chooser == null) {
|
|
@@ -317,35 +317,35 @@ public abstract class LwjglContext implements JmeContext {
|
|
LwjglPlatform platform = null;
|
|
LwjglPlatform platform = null;
|
|
for (Device d : choosenDevices) {
|
|
for (Device d : choosenDevices) {
|
|
if (!(d instanceof LwjglDevice)) {
|
|
if (!(d instanceof LwjglDevice)) {
|
|
- LOGGER.log(Level.SEVERE, "attempt to return a custom Device implementation from PlatformChooser: {0}", d);
|
|
|
|
|
|
+ logger.log(Level.SEVERE, "attempt to return a custom Device implementation from PlatformChooser: {0}", d);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
LwjglDevice ld = (LwjglDevice) d;
|
|
LwjglDevice ld = (LwjglDevice) d;
|
|
if (platform == null) {
|
|
if (platform == null) {
|
|
platform = ld.getPlatform();
|
|
platform = ld.getPlatform();
|
|
} else if (platform != ld.getPlatform()) {
|
|
} else if (platform != ld.getPlatform()) {
|
|
- LOGGER.severe("attempt to use devices from different platforms");
|
|
|
|
|
|
+ logger.severe("attempt to use devices from different platforms");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
devices.add(ld.getDevice());
|
|
devices.add(ld.getDevice());
|
|
}
|
|
}
|
|
if (devices.isEmpty()) {
|
|
if (devices.isEmpty()) {
|
|
- LOGGER.warning("no devices specified, no OpenCL context created");
|
|
|
|
|
|
+ logger.warning("no devices specified, no OpenCL context created");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- LOGGER.log(Level.INFO, "chosen platform: {0}", platform.getName());
|
|
|
|
- LOGGER.log(Level.INFO, "chosen devices: {0}", choosenDevices);
|
|
|
|
|
|
+ logger.log(Level.INFO, "chosen platform: {0}", platform.getName());
|
|
|
|
+ logger.log(Level.INFO, "chosen devices: {0}", choosenDevices);
|
|
|
|
|
|
//create context
|
|
//create context
|
|
try {
|
|
try {
|
|
long c = createContext(platform.getPlatform(), devices, window);
|
|
long c = createContext(platform.getPlatform(), devices, window);
|
|
clContext = new com.jme3.opencl.lwjgl.LwjglContext(c, (List<LwjglDevice>) choosenDevices);
|
|
clContext = new com.jme3.opencl.lwjgl.LwjglContext(c, (List<LwjglDevice>) choosenDevices);
|
|
} catch (final Exception ex) {
|
|
} catch (final Exception ex) {
|
|
- LOGGER.log(Level.SEVERE, "Unable to create OpenCL context", ex);
|
|
|
|
|
|
+ logger.log(Level.SEVERE, "Unable to create OpenCL context", ex);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- LOGGER.info("OpenCL context created");
|
|
|
|
|
|
+ logger.info("OpenCL context created");
|
|
}
|
|
}
|
|
private long createContext(final long platform, final List<Long> devices, long window) throws Exception {
|
|
private long createContext(final long platform, final List<Long> devices, long window) throws Exception {
|
|
|
|
|