diff options
Diffstat (limited to 'src/jogl/classes/com')
5 files changed, 42 insertions, 21 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index 922a91531..878d7da37 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -177,7 +177,7 @@ public class GLConfiguration extends ProcAddressConfiguration { public List<String> javaPrologueForMethod(final MethodBinding binding, final boolean forImplementingMethodCall, final boolean eraseBufferAndArrayTypes) { List<String> res = super.javaPrologueForMethod(binding, forImplementingMethodCall, eraseBufferAndArrayTypes); - final GLEmitter.BufferObjectKind kind = getBufferObjectKind(binding.getName()); + final GLEmitter.BufferObjectKind kind = getBufferObjectKind(binding.getCSymbol()); if (kind != null) { // Need to generate appropriate prologue based on both buffer // object kind and whether this variant of the MethodBinding @@ -382,12 +382,18 @@ public class GLConfiguration extends ProcAddressConfiguration { /** Returns the kind of buffer object this function deals with, or null if none. */ - GLEmitter.BufferObjectKind getBufferObjectKind(final String name) { - return bufferObjectKinds.get(name); + GLEmitter.BufferObjectKind getBufferObjectKind(final AliasedSymbol symbol) { + final String name = symbol.getName(); + final Set<String> aliases = symbol.getAliasedNames(); + GLEmitter.BufferObjectKind res = bufferObjectKinds.get( name ); + if( null == res ) { + res = oneInMap(bufferObjectKinds, aliases); + } + return res; } - public boolean isBufferObjectFunction(final String name) { - return (getBufferObjectKind(name) != null); + public boolean isBufferObjectFunction(final AliasedSymbol symbol) { + return null != getBufferObjectKind(symbol); } public boolean isBufferObjectOnly(final String name) { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index 388f06150..c0a527ad7 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -257,6 +257,20 @@ public class GLEmitter extends ProcAddressEmitter { return new GLConfiguration(this); } + /** + * {@inheritDoc} + * <p> + * Implementation sets the binding's native name to it's interface name, + * which is the final aliased shortest name. + * The latter is used for the proc-address-table etc .. + * </p> + */ + @Override + protected void mangleBinding(final MethodBinding binding) { + binding.setNativeName(binding.getInterfaceName()); + super.mangleBinding(binding); + } + /** In order to implement Buffer Object variants of certain functions we generate another MethodBinding which maps the void* argument to a Java long. The generation of emitters then takes @@ -272,7 +286,7 @@ public class GLEmitter extends ProcAddressEmitter { final GLConfiguration glConfig = getGLConfig(); final List<MethodBinding> bindings = super.expandMethodBinding(binding); - if ( !glConfig.isBufferObjectFunction(binding.getName()) ) { + if ( !glConfig.isBufferObjectFunction(binding.getCSymbol()) ) { return bindings; } final boolean bufferObjectOnly = glConfig.isBufferObjectOnly(binding.getName()); @@ -466,7 +480,7 @@ public class GLEmitter extends ProcAddressEmitter { } protected boolean needsBufferObjectVariant(final FunctionSymbol sym) { - return getGLConfig().isBufferObjectFunction(sym.getName()); + return getGLConfig().isBufferObjectFunction(sym); } protected GLConfiguration getGLConfig() { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java index afd9163ee..3b74b935e 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -40,6 +40,7 @@ package com.jogamp.gluegen.opengl; import com.jogamp.gluegen.CommentEmitter; +import com.jogamp.gluegen.GlueGenException; import com.jogamp.gluegen.JavaEmitter; import com.jogamp.gluegen.JavaMethodBindingEmitter; import com.jogamp.gluegen.MethodBinding; @@ -117,9 +118,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit newComment.append("CORE FUNC"); } else { if( !((GLConfiguration)cfg).dropDocInfo ) { - final StringBuilder sb = new StringBuilder(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); - final RuntimeException ex = new RuntimeException("Couldn't find extension to: " + binding + " ; " + sb.toString()); + final GlueGenException ex = new GlueGenException("Couldn't find extension to: " + funcSym.getAliasedString(), funcSym.getASTLocusTag()); System.err.println(ex.getMessage()); glEmitter.getGLConfig().getGLDocInfo().dump(); // glEmitter.getGLConfig().dumpRenames(); diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java index de9e3ed25..44e52e2fa 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java @@ -145,7 +145,7 @@ public class NativeSignatureEmitter extends GLEmitter { final NativeSignatureJavaMethodBindingEmitter emitter = new NativeSignatureJavaMethodBindingEmitter(javaEmitter); emitter.removeModifier(JavaMethodBindingEmitter.PUBLIC); emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); - emitter.setForImplementingMethodCall(true); + emitter.setPrivateNativeMethod(true); // Note: this is chosen so we don't have to change the logic in // emitReturnVariableSetupAndCall which decides which variant // (direct / indirect) to call diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java index 86080d84f..3478538d6 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java @@ -40,6 +40,7 @@ package com.jogamp.gluegen.opengl.nativesig; +import com.jogamp.gluegen.GlueGenException; import com.jogamp.gluegen.JavaMethodBindingEmitter; import com.jogamp.gluegen.JavaType; import com.jogamp.gluegen.MethodBinding; @@ -133,7 +134,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding @Override protected String getReturnTypeString(final boolean skipArray) { - if (isForImplementingMethodCall()) { + if (isPrivateNativeMethod()) { final JavaType returnType = getBinding().getJavaReturnType(); if (returnType.isString() || returnType.isNIOByteBuffer()) { // Treat these as addresses @@ -178,7 +179,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - if (forImplementingMethodCall && binding.hasContainingType()) { + if (isPrivateNativeMethod() && binding.hasContainingType()) { if (needComma) { writer.print(", "); } @@ -212,8 +213,8 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding writer.print(", "); } - if (forImplementingMethodCall && - (forDirectBufferImplementation && type.isNIOBuffer() || + if (isPrivateNativeMethod() && + (isForDirectBufferImplementation() && type.isNIOBuffer() || type.isString())) { // Direct Buffers and Strings go out as longs writer.print("long"); @@ -228,7 +229,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding needComma = true; // Add Buffer and array index offset arguments after each associated argument - if (forIndirectBufferAndArrayImplementation) { + if (isForIndirectBufferAndArrayImplementation()) { if (type.isNIOBuffer()) { writer.print(", int " + byteOffsetArgName(i)); } else if (type.isNIOBufferArray()) { @@ -438,9 +439,10 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } else if(type.isIntArray()) { writer.print("Buffers.SIZEOF_INT * "); } else { - throw new RuntimeException("Unsupported type for calculating array offset argument for " + + throw new GlueGenException("Unsupported type for calculating array offset argument for " + getArgumentName(i) + - "-- error occurred while processing Java glue code for " + getName()); + "-- error occurred while processing Java glue code for " + binding.getCSymbol().getAliasedString(), + binding.getCSymbol().getASTLocusTag()); } writer.print(offsetArgName(i)); } @@ -474,9 +476,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - public String getName() { - final String res = super.getName(); - if (forImplementingMethodCall && bufferObjectVariant) { + public String getNativeName() { + final String res = super.getNativeName(); + if (isPrivateNativeMethod() && bufferObjectVariant) { return res + "BufObj"; } return res; |