From edbf35a6e713661a60a9518eeaa818c15aab089d Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 29 Jul 2009 05:18:57 -0700 Subject: Add GL2GL3 synthetic methods for OpenGL Composable Pipeline --- src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java index 89176f557..1698b187d 100644 --- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java +++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -619,6 +619,7 @@ public class BuildComposablePipeline emitGLIsMethod(output, "GLES2"); emitGLIsMethod(output, "GL2ES1"); emitGLIsMethod(output, "GL2ES2"); + emitGLIsMethod(output, "GL2GL3"); output.println(" public boolean isGLES() {"); output.println(" return isGLES2() || isGLES1();"); output.println(" }"); @@ -648,6 +649,7 @@ public class BuildComposablePipeline emitGLGetMethod(output, "GLES2"); emitGLGetMethod(output, "GL2ES1"); emitGLGetMethod(output, "GL2ES2"); + emitGLGetMethod(output, "GL2GL3"); output.println(" public GLProfile getGLProfile() {"); output.println(" return "+getDownstreamObjectName()+".getGLProfile();"); output.println(" }"); -- cgit v1.2.3 From 22c78ff7b99a0ba42cbd019a3517fbeb4c6890a1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 1 Aug 2009 01:46:36 -0700 Subject: refine Trace/Debug output --- .../com/sun/gluegen/opengl/BuildComposablePipeline.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java index 1698b187d..d62a68573 100644 --- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java +++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -746,9 +746,9 @@ public class BuildComposablePipeline output.println(" * "); output.println("
");
       if(null!=prologNameOpt) {
-          output.println("     drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2(), new "+prologNameOpt+"( drawable.getGL().getGL2ES2() ) ) );");
+          output.println("     GL gl = drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2(), new "+prologNameOpt+"( drawable.getGL().getGL2ES2() ) ) );");
       } else {
-          output.println("     drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2() ) );");
+          output.println("     GL gl = drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2() ) );");
       }
       output.println("
"); output.println("*/"); @@ -898,7 +898,7 @@ public class BuildComposablePipeline output.println(" Sample code which installs this pipeline:

"); output.println(); output.println("
");
-      output.println("     drawable.setGL(new DebugGL(drawable.getGL()));");
+      output.println("     GL gl = drawable.setGL(new DebugGL(drawable.getGL()));");
       output.println("
"); output.println("*/"); } @@ -1036,7 +1036,7 @@ public class BuildComposablePipeline output.println(" before and after each OpenGL method call. Sample code which installs this pipeline:

"); output.println(); output.println("
");
-      output.println("     drawable.setGL(new TraceGL(drawable.getGL(), System.err));");
+      output.println("     GL gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));");
       output.println("
"); output.println("*/"); } @@ -1057,7 +1057,7 @@ public class BuildComposablePipeline output.println("printIndent();"); } - output.print(" println("); + output.print(" print("); printFunctionCallString(output, m); output.println(");"); } @@ -1095,10 +1095,10 @@ public class BuildComposablePipeline } else if(params[i].equals(int.class)) { output.print("+\"<"+params[i].getName()+"> 0x\"+Integer.toHexString(arg"+i+").toUpperCase()"); } else { - output.print("+\"<"+params[i].getName()+">\"+arg"+i); + output.print("+\"<"+params[i].getName()+"> \"+arg"+i); } if ( i < params.length-1) { - output.print("+\",\""); + output.print("+\", \""); } } output.print("+\")\""); -- cgit v1.2.3 From c83fc5cdcc615b4ee88ac2e0eb8737970fb2b8c3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 1 Aug 2009 02:31:15 -0700 Subject: Retain interface order in Custom Pipeline --- .../gluegen/opengl/BuildComposablePipeline.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java index d62a68573..b52047bbf 100644 --- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java +++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -330,15 +330,29 @@ public class BuildComposablePipeline PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); + List baseInterfaces = Arrays.asList(baseInterfaceClass.getInterfaces()); HashSet clazzList = new HashSet(); clazzList.add(baseInterfaceClass); - clazzList.addAll(Arrays.asList(baseInterfaceClass.getInterfaces())); + clazzList.addAll(baseInterfaces); + int ifNamesNumber = clazzList.size(); - String[] ifNames = new String[clazzList.size()]; + // keep original order .. + clazzList.clear(); + String[] ifNames = new String[ifNamesNumber]; { int i=0; - for (Iterator iter=clazzList.iterator(); iter.hasNext(); ) { - ifNames[i++] = new String(((Class)iter.next()).getName()); + + for (Iterator iter=baseInterfaces.iterator(); iter.hasNext(); ) { + Class ifClass = (Class)iter.next(); + if(!clazzList.contains(ifClass)) { + ifNames[i++] = new String(ifClass.getName()); + clazzList.add(ifClass); + } + } + + if(null!=baseInterfaceClass && !clazzList.contains(baseInterfaceClass)) { + ifNames[i++] = new String(baseInterfaceClass.getName()); + clazzList.add(baseInterfaceClass); } } -- cgit v1.2.3 From 48465d43cf58d98758639f4064cc5eb3ee86bee8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Aug 2009 17:25:30 -0700 Subject: OpenGL: Add comment: Part of --- src/java/com/sun/gluegen/opengl/GLConfiguration.java | 7 +++++++ src/java/com/sun/gluegen/opengl/GLEmitter.java | 20 +++++++++++++++++--- .../gluegen/opengl/GLJavaMethodBindingEmitter.java | 17 +++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 3013848dc..923dcf52d 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -202,6 +202,13 @@ public class GLConfiguration extends ProcAddressConfiguration { super.dumpIgnores(); } + protected String getExtension(String symbol) { + if (glInfo != null) { + return glInfo.getExtension(symbol); + } + return null; + } + protected boolean shouldIgnoreExtension(String symbol, boolean criteria) { if (criteria && glInfo != null) { String extension = glInfo.getExtension(symbol); diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index fff9d7e94..83e688eec 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -305,6 +305,21 @@ public class GLEmitter extends ProcAddressEmitter return bufferObjectMethodBindings.containsKey(binding); } + public void emitDefine(String name, String value, String optionalComment) throws Exception { + String extensionName = getGLConfig().getExtension(name); + StringBuffer newComment = new StringBuffer(); + if(null!=extensionName) { + newComment.append("Part of "+extensionName+""); + } else { + newComment.append("Part of unknown extension"); + } + if(null!=optionalComment) { + newComment.append(" "); + newComment.append(optionalComment); + } + super.emitDefine(name, value, newComment.toString()); + } + //---------------------------------------------------------------------- // Internals only below this point // @@ -319,10 +334,9 @@ public class GLEmitter extends ProcAddressEmitter for (Iterator iter = superEmitters.iterator(); iter.hasNext(); ) { JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) iter.next(); if (emitter instanceof ProcAddressJavaMethodBindingEmitter) { - emitters.add(new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, this, bufferObjectVariant)); - } else { - emitters.add(emitter); + emitter = new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, this, bufferObjectVariant); } + emitters.add(emitter); } } diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index c6a030935..b952272f3 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -52,6 +52,7 @@ import com.sun.gluegen.procaddress.*; public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmitter { protected boolean bufferObjectVariant; protected GLEmitter glEmitter; + protected CommentEmitter glCommentEmitter = new GLCommentEmitter(); public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, boolean callThroughProcAddress, @@ -66,6 +67,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit emitter); this.bufferObjectVariant = bufferObjectVariant; this.glEmitter=emitter; + setCommentEmitter(glCommentEmitter); } public GLJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, @@ -74,6 +76,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit super(methodToWrap); this.bufferObjectVariant = bufferObjectVariant; this.glEmitter=emitter; + setCommentEmitter(glCommentEmitter); } public GLJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { @@ -100,4 +103,18 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit return name; } + + protected class GLCommentEmitter + extends JavaMethodBindingEmitter.DefaultCommentEmitter + { + protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + super.emitBindingCSignature(binding, writer); + String extensionName = glEmitter.getGLConfig().getExtension(binding.getCSymbol().getName()); + if(null!=extensionName) { + writer.print("
Part of "+extensionName+""); + } else { + writer.print("
Part of unknown extension"); + } + } + } } -- cgit v1.2.3 From ae26bd0aac4a98c26aceb95584988defae970dde Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 07:31:49 -0700 Subject: Cleanup for a better OpenGL 3.2 integration, for subsuming extensions: - Allow RenameExtensionIntoCore generate duplicate names, ie those will not be generated. - Add proper comment showing the extension of the symbol. - Fail if no 'GLHeader' is specified, but we are processing a GL/ProcAddress config - Fail if a GL function is not part of an extension MethodBinding, ConstantDefinition cleanup: - getName() returns the renamed name - getOrigName() returns the original - getAliasedNames() returns the aliased ones MethodBinding: - Change: equals() operates on renamed name - Add: hashCode() function - same criteria as equals() Impact: - All config options etc shall trigger with the renamed name, but ignore, rename etc. - Generated Java impl. uses the renamed base name as well Change: emitDefine() uses the ConstantDefinition Add: JavaConfiguration: dumpRenames() Change JavaConfiguration.shouldIgnoreInInterface/Impl(): - respect the renamed symbol name as well Change JavaEmitter.emitFunctions(): - only emit a generated MethodBinding once, therefor store emitted method bindings in a HashSet Fix BuildStaticGLInfo: - Allow white space at the end of #ifndef and #define - Trim strings - Allow 'const' qualifier in function pattern Fix GLEmitter: - Fail if no 'GLHeader' is specified, but a RenameIntoCore option .. - Don't emit marker defines, marking an extension (ie not part of an extension) Fix GLJavaMethodBindingEmitter: - Fail if a GL function is not part of an extension Fix PCPP: - Pass constant type qualifiers for hex-constants: 'l' 'L' ... Fix ProcAddressEmitter: - Operate on the aliased/renamed name for querying ProcAddress usage and generating code. --- .../com/sun/gluegen/opengl/BuildStaticGLInfo.java | 40 +++++++--- .../com/sun/gluegen/opengl/GLConfiguration.java | 11 +-- src/java/com/sun/gluegen/opengl/GLEmitter.java | 92 +++++++++++++++------- .../gluegen/opengl/GLJavaMethodBindingEmitter.java | 19 +++-- 4 files changed, 110 insertions(+), 52 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java index 4226f4612..f5193dcdf 100644 --- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -91,17 +91,23 @@ import java.util.regex.*; public class BuildStaticGLInfo { // Handles function pointer + protected static int funcIdentifierGroup = 9; protected static Pattern funcPattern = - Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)(\\w+)(\\*)?(\\s+)(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); + Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)(const\\s+)?(\\w+)(\\s*\\*)?(\\s+)(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); + protected static Pattern associationPattern = - Pattern.compile("\\#ifndef ([EW]?GL[X]?_[A-Za-z0-9_]+)"); + Pattern.compile("\\#ifndef ([EW]?GL[X]?_[A-Za-z0-9_]+)\\s*"); + + protected static int defineIdentifierGroup = 1; protected static Pattern definePattern = - Pattern.compile("\\#define ([EW]?GL[X]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)"); + Pattern.compile("\\#define ([EW]?GL[X]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); + // Maps function / #define names to the names of the extensions they're declared in protected Map declarationToExtensionMap = new HashMap(); // Maps extension names to Set of identifiers (both #defines and // function names) this extension declares protected Map/**/ extensionToDeclarationMap = new HashMap(); + protected boolean debug = false; /** * The first argument is the package to which the StaticGLInfo class @@ -113,6 +119,7 @@ public class BuildStaticGLInfo { if (args.length > 0 && args[0].equals("-test")) { BuildStaticGLInfo builder = new BuildStaticGLInfo(); + builder.setDebug(true); String[] newArgs = new String[args.length - 1]; System.arraycopy(args, 1, newArgs, 0, args.length - 1); builder.parse(newArgs); @@ -157,6 +164,9 @@ public class BuildStaticGLInfo } } + public void setDebug(boolean v) { + debug = v; + } /** Parses the supplied C header files and adds the function associations contained therein to the internal map. */ @@ -173,14 +183,20 @@ public class BuildStaticGLInfo String line, activeAssociation = null; Matcher m = null; while ((line = reader.readLine()) != null) { + int type = 0; // 1-define, 2-function // see if we're inside a #ifndef GL_XXX block and matching a function if (activeAssociation != null) { String identifier = null; if ((m = funcPattern.matcher(line)).matches()) { - identifier = m.group(8); + identifier = m.group(funcIdentifierGroup).trim(); + type =2; } else if ((m = definePattern.matcher(line)).matches()) { - identifier = m.group(1); + identifier = m.group(defineIdentifierGroup).trim(); + type =1; } else if (line.startsWith("#endif")) { + if(debug) { + System.err.println("END ASSOCIATION BLOCK: <" + activeAssociation + ">"); + } activeAssociation = null; } if ((identifier != null) && @@ -188,13 +204,17 @@ public class BuildStaticGLInfo // Handles #ifndef GL_... #define GL_... !identifier.equals(activeAssociation)) { addAssociation(identifier, activeAssociation); - // System.err.println(" ADDING ASSOCIATION: " + identifier + " " + activeAssociation); + if(debug) { + System.err.println(" ADDING ASSOCIATION: <" + identifier + "> <" + activeAssociation + "> ; type "+type); + } } } else if ((m = associationPattern.matcher(line)).matches()) { // found a new #ifndef GL_XXX block - activeAssociation = m.group(1); + activeAssociation = m.group(1).trim(); - // System.err.println("FOUND NEW ASSOCIATION BLOCK: " + activeAssociation); + if(debug) { + System.err.println("BEGIN ASSOCIATION BLOCK: <" + activeAssociation + ">"); + } } } reader.close(); @@ -204,12 +224,12 @@ public class BuildStaticGLInfo for (Iterator i1 = extensionToDeclarationMap.keySet().iterator(); i1.hasNext(); ) { String name = (String) i1.next(); Set decls = (Set) extensionToDeclarationMap.get(name); - System.out.println(name + ":"); + System.out.println("<"+name+"> :"); List l = new ArrayList(); l.addAll(decls); Collections.sort(l); for (Iterator i2 = l.iterator(); i2.hasNext(); ) { - System.out.println(" " + (String) i2.next()); + System.out.println(" <" + (String) i2.next() + ">"); } } } diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 923dcf52d..4e8c0c369 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -202,13 +202,6 @@ public class GLConfiguration extends ProcAddressConfiguration { super.dumpIgnores(); } - protected String getExtension(String symbol) { - if (glInfo != null) { - return glInfo.getExtension(symbol); - } - return null; - } - protected boolean shouldIgnoreExtension(String symbol, boolean criteria) { if (criteria && glInfo != null) { String extension = glInfo.getExtension(symbol); @@ -216,14 +209,14 @@ public class GLConfiguration extends ProcAddressConfiguration { ignoredExtensions.contains(extension)) { return true; } - boolean isGLFunc = GLExtensionNames.isGLFunction(symbol); boolean isGLEnum = GLExtensionNames.isGLEnumeration(symbol); + boolean isGLFunc = GLExtensionNames.isGLFunction(symbol); if(isGLFunc || isGLEnum) { if(GLExtensionNames.isExtensionVEN(symbol, isGLFunc)) { String extSuffix = GLExtensionNames.getExtensionSuffix(symbol, isGLFunc); if( getDropUniqVendorExtensions(extSuffix) ) { if(DEBUG_IGNORES) { - System.err.println("Ignore UniqVendorEXT: "+symbol); + System.err.println("Ignore UniqVendorEXT: "+symbol+", vendor "+extSuffix); } return true; } diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 83e688eec..9e3202658 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -85,9 +85,15 @@ public class GLEmitter extends ProcAddressEmitter // renaming mechanisms that are built elsewhere. GLConfiguration config = getGLConfig(); + Set extensionsRenamedIntoCore = config.getExtensionsRenamedIntoCore(); BuildStaticGLInfo glInfo = config.getGLInfo(); - for (Iterator iter = config.getExtensionsRenamedIntoCore().iterator(); - iter.hasNext(); ) { + if(null==glInfo) { + if(extensionsRenamedIntoCore.size()>0) { + throw new RuntimeException("ExtensionRenamedIntoCore (num: "+extensionsRenamedIntoCore.size()+"), but no GLHeader"); + } + return; + } + for (Iterator iter = extensionsRenamedIntoCore.iterator(); iter.hasNext(); ) { String extension = (String) iter.next(); Set/**/ declarations = glInfo.getDeclarations(extension); if (declarations != null) { @@ -305,19 +311,68 @@ public class GLEmitter extends ProcAddressEmitter return bufferObjectMethodBindings.containsKey(binding); } - public void emitDefine(String name, String value, String optionalComment) throws Exception { - String extensionName = getGLConfig().getExtension(name); + public void emitDefine(ConstantDefinition def, String optionalComment) throws Exception { + BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); + if(null==glInfo) { + throw new Exception("No GLInfo for: "+def); + } + String symbolRenamed = def.getName(); StringBuffer newComment = new StringBuffer(); - if(null!=extensionName) { - newComment.append("Part of "+extensionName+""); - } else { - newComment.append("Part of unknown extension"); + newComment.append("Part of "); + if(0==addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, def.getAliasedNames())) { + // Note: All GL enums must be contained within an extension marker ! + // #ifndef GL_EXT_lala + // #define GL_EXT_lala 1 + // ... + // #endif + if(JavaConfiguration.DEBUG_IGNORES) { + StringBuffer sb = new StringBuffer(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); + System.err.println("Dropping marker: "+sb.toString()); + } + return; } + newComment.append(""); + if(null!=optionalComment) { newComment.append(" "); newComment.append(optionalComment); } - super.emitDefine(name, value, newComment.toString()); + + super.emitDefine(def, newComment.toString()); + } + + public int addExtensionsOfSymbols2Buffer(StringBuffer buf, String sep, String first, Collection col) { + BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); + if(null==glInfo) { + throw new RuntimeException("No GLInfo for: "+first); + } + int num = 0; + if(null==buf) buf=new StringBuffer(); + String extensionName; + + Iterator iter=col.iterator(); + if(null!=first) { + extensionName = glInfo.getExtension(first); + if(null!=extensionName) { + buf.append(extensionName); + if( iter.hasNext() ) { + buf.append(sep); + } + num++; + } + } + while( iter.hasNext() ) { + extensionName = glInfo.getExtension((String)iter.next()); + if(null!=extensionName) { + buf.append(extensionName); + if( iter.hasNext() ) { + buf.append(sep); + } + num++; + } + } + return num; } //---------------------------------------------------------------------- @@ -399,23 +454,4 @@ public class GLEmitter extends ProcAddressEmitter w.flush(); w.close(); } - - protected void emitProcAddressTableEntryForSymbol(FunctionSymbol cFunc) - { - emitProcAddressTableEntryForString(cFunc.getName()); - } - - protected void emitProcAddressTableEntryForString(String str) - { - // Deal gracefully with forced proc address generation in the face - // of having the function pointer typedef in the header file too - if (emittedTableEntries.contains(str)) - return; - emittedTableEntries.add(str); - tableWriter.print(" public long "); - tableWriter.print(PROCADDRESS_VAR_PREFIX); - tableWriter.print(str); - tableWriter.println(";"); - } - } diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index b952272f3..5e8bada0d 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -109,12 +109,21 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit { protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { super.emitBindingCSignature(binding, writer); - String extensionName = glEmitter.getGLConfig().getExtension(binding.getCSymbol().getName()); - if(null!=extensionName) { - writer.print("
Part of "+extensionName+""); - } else { - writer.print("
Part of unknown extension"); + + String symbolRenamed = binding.getName(); + StringBuffer newComment = new StringBuffer(); + newComment.append("Part of "); + if(0==glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, binding.getAliasedNames())) { + StringBuffer sb = new StringBuffer(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); + RuntimeException ex = new RuntimeException("Couldn't find extension to: "+binding+" ; "+sb.toString()); + ex.printStackTrace(); + glEmitter.getGLConfig().getGLInfo().dump(); + // glEmitter.getGLConfig().dumpRenames(); + throw ex; } + newComment.append(""); + writer.print(newComment.toString()); } } } -- cgit v1.2.3 From 3efa8c6f680a873f126b82a74538d883fb9438cc Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 08:42:25 -0700 Subject: Fix: Add unsigned qualifier, CGL and GLU --- src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java index f5193dcdf..0ede95e88 100644 --- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -91,16 +91,16 @@ import java.util.regex.*; public class BuildStaticGLInfo { // Handles function pointer - protected static int funcIdentifierGroup = 9; + protected static int funcIdentifierGroup = 10; protected static Pattern funcPattern = - Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)(const\\s+)?(\\w+)(\\s*\\*)?(\\s+)(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); + Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s*\\*)?(\\s+)(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); protected static Pattern associationPattern = - Pattern.compile("\\#ifndef ([EW]?GL[X]?_[A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#ifndef ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*"); protected static int defineIdentifierGroup = 1; protected static Pattern definePattern = - Pattern.compile("\\#define ([EW]?GL[X]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); // Maps function / #define names to the names of the extensions they're declared in protected Map declarationToExtensionMap = new HashMap(); -- cgit v1.2.3 From 47319dab5b769a5a685bc329c8e5a37a710e1687 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 09:57:37 -0700 Subject: Fix: Allow all constanst defined by enums; Add PFD_ defines. --- src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java | 2 +- src/java/com/sun/gluegen/opengl/GLEmitter.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java index 0ede95e88..a31a98760 100644 --- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -100,7 +100,7 @@ public class BuildStaticGLInfo protected static int defineIdentifierGroup = 1; protected static Pattern definePattern = - Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#define (([CEW]?GL[XU]?|PFD)_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); // Maps function / #define names to the names of the extensions they're declared in protected Map declarationToExtensionMap = new HashMap(); diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 9e3202658..935706bd2 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -320,7 +320,15 @@ public class GLEmitter extends ProcAddressEmitter StringBuffer newComment = new StringBuffer(); newComment.append("Part of "); if(0==addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, def.getAliasedNames())) { - // Note: All GL enums must be contained within an extension marker ! + if(def.isEnum()) { + String enumName = def.getEnumName(); + if(null!=enumName) { + newComment.append(enumName); + } else { + newComment.append("ENUM"); + } + } else { + // Note: All GL defines must be contained within an extension marker ! // #ifndef GL_EXT_lala // #define GL_EXT_lala 1 // ... @@ -331,6 +339,7 @@ public class GLEmitter extends ProcAddressEmitter System.err.println("Dropping marker: "+sb.toString()); } return; + } } newComment.append(""); -- cgit v1.2.3 From a3ce5e8e3bfae850a638c0b40679ed885bceea82 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 10:29:26 -0700 Subject: Fix: Remove PFD_ defines. Add GL Option: AllowNonGLExtensions to allow non GL extensions to be passed. Allow ifndef/define pattern to have any characters at the end --- .../com/sun/gluegen/opengl/BuildStaticGLInfo.java | 4 ++-- .../com/sun/gluegen/opengl/GLConfiguration.java | 14 +++++++++++- src/java/com/sun/gluegen/opengl/GLEmitter.java | 26 +++++++++++++--------- .../gluegen/opengl/GLJavaMethodBindingEmitter.java | 18 +++++++++------ 4 files changed, 41 insertions(+), 21 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java index a31a98760..a6c0cfc97 100644 --- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -96,11 +96,11 @@ public class BuildStaticGLInfo Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s*\\*)?(\\s+)(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); protected static Pattern associationPattern = - Pattern.compile("\\#ifndef ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#ifndef ([CEW]?GL[XU]?_[A-Za-z0-9_]+)(.*)"); protected static int defineIdentifierGroup = 1; protected static Pattern definePattern = - Pattern.compile("\\#define (([CEW]?GL[XU]?|PFD)_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)(.*)"); // Maps function / #define names to the names of the extensions they're declared in protected Map declarationToExtensionMap = new HashMap(); diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 4e8c0c369..9352bcba2 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -59,7 +59,8 @@ public class GLConfiguration extends ProcAddressConfiguration { // This directive is off by default but can help automatically // indicate which extensions have been folded into the core OpenGL // namespace, and if not, then why not - private boolean autoUnifyExtensions; + private boolean autoUnifyExtensions=false; + private boolean allowNonGLExtensions=false; public GLConfiguration(GLEmitter emitter) { super(); @@ -82,6 +83,10 @@ public class GLConfiguration extends ProcAddressConfiguration { String sym = readString("RenameExtensionIntoCore", tok, filename, lineNo); extensionsRenamedIntoCore.add(sym); } + else if (cmd.equalsIgnoreCase("AllowNonGLExtensions")) + { + allowNonGLExtensions = readBoolean("AllowNonGLExtensions", tok, filename, lineNo).booleanValue(); + } else if (cmd.equalsIgnoreCase("AutoUnifyExtensions")) { autoUnifyExtensions = readBoolean("AutoUnifyExtensions", tok, filename, lineNo).booleanValue(); @@ -249,6 +254,13 @@ public class GLConfiguration extends ProcAddressConfiguration { return autoUnifyExtensions; } + /** If true, accept all non encapsulated defines and functions, + * as it is mandatory for GL declarations. */ + public boolean getAllowNonGLExtensions() { + return allowNonGLExtensions; + } + + /** shall the non unified (uniq) vendor extensions be dropped ? */ public boolean getDropUniqVendorExtensions(String extName) { return dropUniqVendorExtensions.contains(extName); diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 935706bd2..ffe1ed61c 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -325,20 +325,24 @@ public class GLEmitter extends ProcAddressEmitter if(null!=enumName) { newComment.append(enumName); } else { - newComment.append("ENUM"); + newComment.append("CORE ENUM"); } } else { - // Note: All GL defines must be contained within an extension marker ! - // #ifndef GL_EXT_lala - // #define GL_EXT_lala 1 - // ... - // #endif - if(JavaConfiguration.DEBUG_IGNORES) { - StringBuffer sb = new StringBuffer(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); - System.err.println("Dropping marker: "+sb.toString()); + if(getGLConfig().getAllowNonGLExtensions()) { + newComment.append("CORE DEF"); + } else { + // Note: All GL defines must be contained within an extension marker ! + // #ifndef GL_EXT_lala + // #define GL_EXT_lala 1 + // ... + // #endif + if(JavaConfiguration.DEBUG_IGNORES) { + StringBuffer sb = new StringBuffer(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); + System.err.println("Dropping marker: "+sb.toString()); + } + return; } - return; } } newComment.append(""); diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index 5e8bada0d..8f5258e0b 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -114,13 +114,17 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit StringBuffer newComment = new StringBuffer(); newComment.append("Part of "); if(0==glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, binding.getAliasedNames())) { - StringBuffer sb = new StringBuffer(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); - RuntimeException ex = new RuntimeException("Couldn't find extension to: "+binding+" ; "+sb.toString()); - ex.printStackTrace(); - glEmitter.getGLConfig().getGLInfo().dump(); - // glEmitter.getGLConfig().dumpRenames(); - throw ex; + if(glEmitter.getGLConfig().getAllowNonGLExtensions()) { + newComment.append("CORE FUNC"); + } else { + StringBuffer sb = new StringBuffer(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); + RuntimeException ex = new RuntimeException("Couldn't find extension to: "+binding+" ; "+sb.toString()); + ex.printStackTrace(); + glEmitter.getGLConfig().getGLInfo().dump(); + // glEmitter.getGLConfig().dumpRenames(); + throw ex; + } } newComment.append(""); writer.print(newComment.toString()); -- cgit v1.2.3 From be85daf04cab1484cca214648a8c12aca0bd1fb2 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 14:32:38 -0700 Subject: Add
in comment --- src/java/com/sun/gluegen/opengl/GLEmitter.java | 2 +- src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl') diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index ffe1ed61c..4ca2e698b 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -348,7 +348,7 @@ public class GLEmitter extends ProcAddressEmitter newComment.append(""); if(null!=optionalComment) { - newComment.append(" "); + newComment.append("
"); newComment.append(optionalComment); } diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index 8f5258e0b..662e75b51 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -112,7 +112,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit String symbolRenamed = binding.getName(); StringBuffer newComment = new StringBuffer(); - newComment.append("Part of "); + newComment.append("
Part of "); if(0==glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, binding.getAliasedNames())) { if(glEmitter.getGLConfig().getAllowNonGLExtensions()) { newComment.append("CORE FUNC"); -- cgit v1.2.3