-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix[renderer]: move GL4ES initialization code (#6447)
- Loading branch information
Showing
3 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
jre_lwjgl3glfw/src/main/java/org/lwjgl/opengl/PojavRendererInit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.lwjgl.opengl; | ||
|
||
import org.lwjgl.system.FunctionProvider; | ||
import org.lwjgl.system.SharedLibrary; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Class for initializing renderer-specific callbacks. Allows to reliably initialize | ||
* any callbacks needed for renderers by using the same FunctionProvider as used for loading | ||
* GL symbols. | ||
* */ | ||
public class PojavRendererInit { | ||
|
||
public static void onCreateCapabilities(FunctionProvider functionProvider) { | ||
String rendererName = null; | ||
if(functionProvider instanceof SharedLibrary) { | ||
SharedLibrary rendererLibrary = (SharedLibrary) functionProvider; | ||
rendererName = rendererLibrary.getName(); | ||
} | ||
if(!isValidString(rendererName)) { | ||
rendererName = System.getProperty("org.lwjgl.opengl.libname"); | ||
} | ||
if(!isValidString(rendererName)) { | ||
System.out.println("PojavRendererInit: Failed to find Pojav renderer name! " + | ||
"Renderer-specific initialization may not work properly"); | ||
} | ||
// NOTE: hardcoded gl4es libname | ||
if(rendererName.endsWith("libgl4es_114.so")) { | ||
nativeInitGl4esInternals(functionProvider); | ||
} | ||
} | ||
|
||
private static boolean isValidString(@Nullable String s) { | ||
return s != null && !s.isEmpty(); | ||
} | ||
|
||
public static native void nativeInitGl4esInternals(FunctionProvider functionProvider); | ||
} |