mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-04 14:07:52 +00:00
Force forward compatible mode when we have GL3.1+ but miss ARB_compatibility.
Added support for ARB_framebuffer_object. Added support for GLX_ARB_create_context. (WIP) Improved postfix stripping in the generator.
This commit is contained in:
parent
03c799e87f
commit
1e4499f527
9 changed files with 298 additions and 8 deletions
|
|
@ -187,4 +187,16 @@ public final class ContextAttribs {
|
|||
return attribs;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer(32);
|
||||
|
||||
sb.append("ContextAttribs:");
|
||||
sb.append(" Version=").append(majorVersion).append('.').append(minorVersion);
|
||||
sb.append(" - Layer=").append(layerPlane);
|
||||
sb.append(" - Debug=").append(debug);
|
||||
sb.append(" - ForwardCompatible=").append(forwardCompatible);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,7 +37,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import com.sun.mirror.declaration.InterfaceDeclaration;
|
||||
import com.sun.mirror.declaration.MethodDeclaration;
|
||||
|
|
@ -117,6 +116,23 @@ public class ContextCapabilitiesGenerator {
|
|||
|
||||
public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) {
|
||||
writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {");
|
||||
|
||||
// Load the basic pointers we need to detect OpenGL version and supported extensions.
|
||||
writer.println("\t\tGL11_glGetString_pointer = GLContext.getFunctionAddress(\"glGetString\");");
|
||||
|
||||
// Initialize GL11.glGetIntegerv and GL30.glGetStringi here, in case we have created an OpenGL 3.0 context.
|
||||
// (they will be used in GLContext.getSupportedExtensions)
|
||||
writer.println("\t\tGL11_glGetIntegerv_pointer = GLContext.getFunctionAddress(\"glGetIntegerv\");");
|
||||
writer.println("\t\tGL30_glGetStringi_pointer = GLContext.getFunctionAddress(\"glGetStringi\");");
|
||||
|
||||
// Get the supported extensions set.
|
||||
writer.println("\t\tGLContext.setCapabilities(this);");
|
||||
writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = GLContext.getSupportedExtensions();");
|
||||
|
||||
// Force forward compatible mode when OpenGL version is 3.1 or higher and ARB_compatibility is not available.
|
||||
writer.println("\t\tif ( supported_extensions.contains(\"OpenGL31\") && !supported_extensions.contains(\"GL_ARB_compatibility\") )");
|
||||
writer.println("\t\t\tforwardCompatible = true;");
|
||||
|
||||
if ( !context_specific ) {
|
||||
writer.println("\t\tif (" + STUBS_LOADED_NAME + ")");
|
||||
writer.println("\t\t\treturn GLContext.getSupportedExtensions();");
|
||||
|
|
@ -125,11 +141,6 @@ public class ContextCapabilitiesGenerator {
|
|||
writer.println("\t\tif (!" + getAddressesInitializerName("GL11") + "(forwardCompatible))");
|
||||
writer.println("\t\t\tthrow new LWJGLException(\"GL11 not supported\");");
|
||||
}
|
||||
// Try to initialize GL30.glGetStringi here, in case we have created an OpenGL 3.0 context
|
||||
// (it will be used in GLContext.getSupportedExtensions)
|
||||
writer.println("\t\tGL30_glGetStringi_pointer = GLContext.getFunctionAddress(\"glGetStringi\");");
|
||||
writer.println("\t\tGLContext.setCapabilities(this);");
|
||||
writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = GLContext.getSupportedExtensions();");
|
||||
}
|
||||
|
||||
public static void generateInitStubsEpilogue(PrintWriter writer, boolean context_specific) {
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ public class JavaMethodsGenerator {
|
|||
postfix_parameter.getType().accept(translator);
|
||||
String postfix = translator.getSignature();
|
||||
String method_name = method.getSimpleName();
|
||||
String extension_postfix = getExtensionPostfix(interface_decl);
|
||||
String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension();
|
||||
String result;
|
||||
if (method_name.endsWith(postfix + "v" + extension_postfix))
|
||||
result = method_name.substring(0, method_name.length() - (postfix.length() + 1 + extension_postfix.length()));
|
||||
|
|
|
|||
|
|
@ -47,4 +47,5 @@ import java.lang.annotation.ElementType;
|
|||
@Target(ElementType.METHOD)
|
||||
public @interface StripPostfix {
|
||||
String value(); // The parameter to deduce the postfix from
|
||||
String extension() default "NULL";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue