diff options
Diffstat (limited to 'src/jogl/classes')
27 files changed, 484 insertions, 365 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java index 3b08b5386..8644f1696 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java @@ -206,7 +206,7 @@ public class BuildStaticGLInfo { int type = 0; // 1-define, 2-function if ( 0 < block ) { // inside a #ifndef GL_XXX block and matching a function, if block > 0 String identifier = null; - if( 2 >= block ) { // not within sub-blocks > 2, i.e. further typedefs + if( 3 >= block ) { // not within sub-blocks > 3, i.e. further typedefs if ((m = funcPattern.matcher(line)).matches()) { identifier = m.group(funcIdentifierGroup).trim(); type = 2; @@ -264,14 +264,15 @@ public class BuildStaticGLInfo { } public void dump() { + System.err.println("BuildStaticGLInfo.dump():"); for (final String name : extensionToDeclarationMap.keySet()) { final Set<String> decls = extensionToDeclarationMap.get(name); - System.out.println("<" + name + "> :"); + System.err.println("<" + name + "> :"); final List<String> l = new ArrayList<String>(); l.addAll(decls); Collections.sort(l); for (final String str : l) { - System.out.println(" <" + str + ">"); + System.err.println(" <" + str + ">"); } } } diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index 5da45abfe..f8655feea 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -39,11 +39,15 @@ */ package com.jogamp.gluegen.opengl; +import static java.util.logging.Level.INFO; + import com.jogamp.gluegen.GlueEmitterControls; import com.jogamp.gluegen.GlueGen; import com.jogamp.gluegen.MethodBinding; +import com.jogamp.gluegen.cgram.types.AliasedSymbol; import com.jogamp.gluegen.procaddress.ProcAddressConfiguration; import com.jogamp.gluegen.runtime.opengl.GLNameResolver; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -59,11 +63,19 @@ import java.util.StringTokenizer; public class GLConfiguration extends ProcAddressConfiguration { // The following data members support ignoring an entire extension at a time - private final List<String> glHeaders = new ArrayList<String>(); + private final List<String> glSemHeaders = new ArrayList<String>(); private final Set<String> ignoredExtensions = new HashSet<String>(); private final Set<String> forcedExtensions = new HashSet<String>(); - private final Set<String> extensionsRenamedIntoCore = new HashSet<String>(); - private BuildStaticGLInfo glInfo; + private final Set<String> renameExtensionsIntoCore = new HashSet<String>(); + private BuildStaticGLInfo glSemInfo; + + // GLDocHeaders include GLSemHeaders! + boolean dropDocInfo = false; + private final List<String> glDocHeaders = new ArrayList<String>(); + // GLDocInfo include GLSemInfo! + private BuildStaticGLInfo glDocInfo; + private final Map<String, String> javaDocSymbolRenames = new HashMap<String, String>(); + private final Map<String, Set<String>> javaDocRenamedSymbols = new HashMap<String, Set<String>>(); // Maps function names to the kind of buffer object it deals with private final Map<String, GLEmitter.BufferObjectKind> bufferObjectKinds = new HashMap<String, GLEmitter.BufferObjectKind>(); @@ -97,14 +109,26 @@ public class GLConfiguration extends ProcAddressConfiguration { forcedExtensions.add(sym); } else if (cmd.equalsIgnoreCase("RenameExtensionIntoCore")) { final String sym = readString("RenameExtensionIntoCore", tok, filename, lineNo); - extensionsRenamedIntoCore.add(sym); + renameExtensionsIntoCore.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(); - } else if (cmd.equalsIgnoreCase("GLHeader")) { - final String sym = readString("GLHeader", tok, filename, lineNo); - glHeaders.add(sym); + } else if (cmd.equalsIgnoreCase("GLSemHeader")) { + final String sym = readString("GLSemHeader", tok, filename, lineNo); + if( !glSemHeaders.contains(sym) ) { + glSemHeaders.add(sym); + } + if( !dropDocInfo && !glDocHeaders.contains(sym) ) { + glDocHeaders.add(sym); + } + } else if (cmd.equalsIgnoreCase("GLDocHeader")) { + final String sym = readString("GLDocHeader", tok, filename, lineNo); + if( !dropDocInfo && !glDocHeaders.contains(sym) ) { + glDocHeaders.add(sym); + } + } else if (cmd.equalsIgnoreCase("DropAllGLDocHeader")) { + dropDocInfo = readBoolean("DropAllGLDocHeader", tok, filename, lineNo).booleanValue(); } else if (cmd.equalsIgnoreCase("BufferObjectKind")) { readBufferObjectKind(tok, filename, lineNo); } else if (cmd.equalsIgnoreCase("BufferObjectOnly")) { @@ -209,111 +233,133 @@ public class GLConfiguration extends ProcAddressConfiguration { } @Override - public void dumpIgnores() { - System.err.println("GL Ignored extensions: "); + public void logIgnores() { + LOG.log(INFO, "GL Ignored extensions: {0}", ignoredExtensions.size()); for (final String str : ignoredExtensions) { - System.err.println("\t" + str); + LOG.log(INFO, "\t{0}", str); } - System.err.println("GL Forced extensions: "); + LOG.log(INFO, "GL Forced extensions: {0}", forcedExtensions.size()); for (final String str : forcedExtensions) { - System.err.println("\t" + str); + LOG.log(INFO, "\t{0}", str); } - super.dumpIgnores(); + super.logIgnores(); } - protected boolean shouldIgnoreExtension(final String symbol, final boolean criteria) { - if (criteria && glInfo != null) { - final Set<String> extensionNames = glInfo.getExtension(symbol); - if( null != extensionNames ) { - boolean ignoredExtension = false; - for(final Iterator<String> i=extensionNames.iterator(); !ignoredExtension && i.hasNext(); ) { - final String extensionName = i.next(); - if ( extensionName != null && ignoredExtensions.contains(extensionName) ) { - if (DEBUG_IGNORES) { - System.err.print("Ignore symbol <" + symbol + "> of extension <" + extensionName + ">"); - if(extensionNames.size()==1) { - System.err.println(", single ."); - } else { - System.err.println(", WARNING MULTIPLE OCCURENCE: "+extensionNames); - } - } - ignoredExtension = true; - } - } - if( ignoredExtension ) { - ignoredExtension = !shouldForceExtension( symbol, true, symbol ); - if( ignoredExtension ) { - final Set<String> origSymbols = getRenamedJavaSymbols( symbol ); - if(null != origSymbols) { - for(final String origSymbol : origSymbols) { - if( shouldForceExtension( origSymbol, true, symbol ) ) { - ignoredExtension = false; - break; - } - } - } - } + @Override + public void logRenames() { + LOG.log(INFO, "GL Renamed extensions into core: {0}", renameExtensionsIntoCore.size()); + for (final String str : renameExtensionsIntoCore) { + LOG.log(INFO, "\t{0}", str); + } + super.logRenames(); + } + + protected boolean shouldIgnoreExtension(final AliasedSymbol symbol) { + final Set<String> symExtensionNames; + // collect current-name symbol extensions + { + final Set<String> s = glSemInfo.getExtension(symbol.getName()); + if( null != s ) { + symExtensionNames = s; + } else { + symExtensionNames = new HashSet<String>(); + } + } + // collect renamed symbol extensions + if( symbol.hasAliases() ) { + final Set<String> aliases = symbol.getAliasedNames(); + for(final String alias : aliases) { + final Set<String> s = glSemInfo.getExtension(alias); + if( null != s && s.size() > 0 ) { + symExtensionNames.addAll(s); } - if( ignoredExtension ) { - return true; + } + } + boolean ignoreExtension = symExtensionNames.size() > 0 && + ignoredExtensions.containsAll(symExtensionNames); + + if( LOG.isLoggable(INFO) ) { + final Set<String> ignoredSymExtensionNames = new HashSet<String>(); + final Set<String> notIgnoredSymExtensionNames = new HashSet<String>(); + for(final Iterator<String> i=symExtensionNames.iterator(); i.hasNext(); ) { + final String extensionName = i.next(); + if ( null != extensionName && ignoredExtensions.contains(extensionName) ) { + ignoredSymExtensionNames.add(extensionName); + } else { + notIgnoredSymExtensionNames.add(extensionName); } } - final boolean isGLEnum = GLNameResolver.isGLEnumeration(symbol); - final boolean isGLFunc = GLNameResolver.isGLFunction(symbol); + if( ignoreExtension ) { + LOG.log(INFO, "Ignored symbol {0} of all extensions <{1}>", symbol.getAliasedString(), symExtensionNames); + } else if( ignoredSymExtensionNames.size() > 0 ) { + LOG.log(INFO, "Not ignored symbol {0}; Ignored in <{1}>, but active in <{2}>", + symbol.getAliasedString(), ignoredSymExtensionNames, notIgnoredSymExtensionNames); + } + } + if( !ignoreExtension ) { + // Check whether the current-name denotes an ignored vendor extension + final String name = symbol.getName(); + final boolean isGLEnum = GLNameResolver.isGLEnumeration(name); + final boolean isGLFunc = GLNameResolver.isGLFunction(name); + String extSuffix = null; if (isGLFunc || isGLEnum) { - if (GLNameResolver.isExtensionVEN(symbol, isGLFunc)) { - final String extSuffix = GLNameResolver.getExtensionSuffix(symbol, isGLFunc); + if (GLNameResolver.isExtensionVEN(name, isGLFunc)) { + extSuffix = GLNameResolver.getExtensionSuffix(name, isGLFunc); if (getDropUniqVendorExtensions(extSuffix)) { - if (DEBUG_IGNORES) { - System.err.println("Ignore UniqVendorEXT: " + symbol + ", vendor " + extSuffix); - } - return true; + LOG.log(INFO, "Ignore UniqVendorEXT: {0}, vendor {1}, isGLFunc {2}, isGLEnum {3}", + symbol.getAliasedString(), extSuffix, isGLFunc, isGLEnum); + ignoreExtension = true; } } } + if (!ignoreExtension) { + LOG.log(INFO, "Not ignored UniqVendorEXT: {0}, vendor {1}, isGLFunc {2}, isGLEnum {3}", + symbol.getAliasedString(), extSuffix, isGLFunc, isGLEnum); + } } - return false; + if( ignoreExtension ) { + ignoreExtension = !shouldForceExtension( symbol, symExtensionNames); + } + return ignoreExtension; } - - public boolean shouldForceExtension(final String symbol, final boolean criteria, final String renamedSymbol) { - if (criteria && glInfo != null) { - final Set<String> extensionNames = glInfo.getExtension(symbol); - if( null != extensionNames ) { - for(final Iterator<String> i=extensionNames.iterator(); i.hasNext(); ) { - final String extensionName = i.next(); - if ( extensionName != null && forcedExtensions.contains(extensionName) ) { - if (DEBUG_IGNORES) { - System.err.print("Not Ignore symbol <" + symbol + " -> " + renamedSymbol + "> of extension <" + extensionName + ">"); - if(extensionNames.size()==1) { - System.err.println(", single ."); - } else { - System.err.println(", WARNING MULTIPLE OCCURENCE: "+extensionNames); - } - } - return true; - } - } + public boolean shouldForceExtension(final AliasedSymbol symbol, final Set<String> symExtensionNames) { + for(final Iterator<String> i=symExtensionNames.iterator(); i.hasNext(); ) { + final String extensionName = i.next(); + if ( extensionName != null && forcedExtensions.contains(extensionName) ) { + LOG.log(INFO, "Not ignored symbol {0} of extension <{1}>", + symbol.getAliasedString(), extensionName); + return true; } } return false; } + /** + * {@inheritDoc} + * <p> + * Implementation extends the exclusion query w/ {@link #shouldIgnoreExtension(AliasedSymbol) the list of ignored extensions}. + * </p> + * <p> + * If passing the former, it calls down to {@link #shouldIgnoreInInterface_Int(AliasedSymbol)}. + * </p> + */ @Override - public boolean shouldIgnoreInInterface(final String symbol) { - return shouldIgnoreInInterface(symbol, true); - } - - public boolean shouldIgnoreInInterface(final String symbol, final boolean checkEXT) { - return shouldIgnoreExtension(symbol, checkEXT) || super.shouldIgnoreInInterface(symbol); + public boolean shouldIgnoreInInterface(final AliasedSymbol symbol) { + return shouldIgnoreExtension(symbol) || shouldIgnoreInInterface_Int(symbol); } + /** + * {@inheritDoc} + * <p> + * Implementation extends the exclusion query w/ {@link #shouldIgnoreExtension(AliasedSymbol) the list of ignored extensions}. + * </p> + * <p> + * If passing the former, it calls down to {@link #shouldIgnoreInImpl_Int(AliasedSymbol)}. + * </p> + */ @Override - public boolean shouldIgnoreInImpl(final String symbol) { - return shouldIgnoreInImpl(symbol, true); - } - - public boolean shouldIgnoreInImpl(final String symbol, final boolean checkEXT) { - return shouldIgnoreExtension(symbol, checkEXT) || super.shouldIgnoreInImpl(symbol); + public boolean shouldIgnoreInImpl(final AliasedSymbol symbol) { + return shouldIgnoreExtension(symbol) || shouldIgnoreInImpl_Int(symbol); } /** Should we automatically ignore extensions that have already been @@ -348,27 +394,114 @@ public class GLConfiguration extends ProcAddressConfiguration { return bufferObjectOnly.contains(name); } - /** Parses any GL headers specified in the configuration file for - the purpose of being able to ignore an extension at a time. */ - public void parseGLHeaders(final GlueEmitterControls controls) throws IOException { - if (!glHeaders.isEmpty()) { - glInfo = new BuildStaticGLInfo(); - glInfo.setDebug(GlueGen.debug()); - for (final String file : glHeaders) { + /** + * Parses any GL headers specified in the configuration file for + * the purpose of being able to ignore an extension at a time. + * <p> + * Targeting semantic information, i.e. influences code generation. + * </p> + */ + public void parseGLSemHeaders(final GlueEmitterControls controls) throws IOException { + glSemInfo = new BuildStaticGLInfo(); + glSemInfo.setDebug(GlueGen.debug()); + if (!glSemHeaders.isEmpty()) { + for (final String file : glSemHeaders) { + final String fullPath = controls.findHeaderFile(file); + if (fullPath == null) { + throw new IOException("Unable to locate header file \"" + file + "\""); + } + glSemInfo.parse(fullPath); + } + } + } + + /** + * Returns the information about the association between #defines, + * function symbols and the OpenGL extensions they are defined in. + * <p> + * This instance targets semantic information, i.e. influences code generation. + * </p> + */ + public BuildStaticGLInfo getGLSemInfo() { + return glSemInfo; + } + + /** + * Parses any GL headers specified in the configuration file for + * the purpose of being able to ignore an extension at a time. + * <p> + * Targeting API documentation information, i.e. <i>not</i> influencing code generation. + * </p> + */ + public void parseGLDocHeaders(final GlueEmitterControls controls) throws IOException { + glDocInfo = new BuildStaticGLInfo(); + glDocInfo.setDebug(GlueGen.debug()); + if (!glDocHeaders.isEmpty()) { + for (final String file : glDocHeaders) { final String fullPath = controls.findHeaderFile(file); if (fullPath == null) { throw new IOException("Unable to locate header file \"" + file + "\""); } - glInfo.parse(fullPath); + glDocInfo.parse(fullPath); } } } - /** Returns the information about the association between #defines, - function symbols and the OpenGL extensions they are defined - in. */ - public BuildStaticGLInfo getGLInfo() { - return glInfo; + @Override + public Set<String> getAliasedDocNames(final AliasedSymbol symbol) { + return getRenamedJavaDocSymbols(symbol.getName()); + } + + /** + * Returns the information about the association between #defines, + * function symbols and the OpenGL extensions they are defined in. + * <p> + * This instance targets API documentation information, i.e. <i>not</i> influencing code generation. + * </p> + * <p> + * GLDocInfo include GLSemInfo! + * </p> + */ + public BuildStaticGLInfo getGLDocInfo() { + return glDocInfo; + } + + /** Returns a set of replaced javadoc names to the given <code>aliasedName</code>. */ + public Set<String> getRenamedJavaDocSymbols(final String aliasedName) { + return javaDocRenamedSymbols.get(aliasedName); + } + + /** + * {@inheritDoc} + * <p> + * Also adds a javadoc rename directive for the given symbol. + * </p> + */ + @Override + public void addJavaSymbolRename(final String origName, final String newName) { + super.addJavaSymbolRename(origName, newName); + if( !dropDocInfo ) { + addJavaDocSymbolRename(origName, newName); + } + } + + /** + * Adds a javadoc rename directive for the given symbol. + */ + public void addJavaDocSymbolRename(final String origName, final String newName) { + LOG.log(INFO, "\tDoc Rename {0} -> {1}", origName, newName); + final String prevValue = javaDocSymbolRenames.put(origName, newName); + if(null != prevValue && !prevValue.equals(newName)) { + throw new RuntimeException("Doc-Rename-Override Attampt: "+origName+" -> "+newName+ + ", but "+origName+" -> "+prevValue+" already exist. Run in 'debug' mode to analyze!"); + } + + Set<String> origNames = javaDocRenamedSymbols.get(newName); + if(null == origNames) { + origNames = new HashSet<String>(); + javaDocRenamedSymbols.put(newName, origNames); + } + origNames.add(origName); } /** Returns the OpenGL extensions that should have all of their @@ -376,6 +509,6 @@ public class GLConfiguration extends ProcAddressConfiguration { namespace; for example, glGenFramebuffersEXT to glGenFramebuffers and GL_FRAMEBUFFER_EXT to GL_FRAMEBUFFER. */ public Set<String> getExtensionsRenamedIntoCore() { - return extensionsRenamedIntoCore; + return renameExtensionsIntoCore; } } diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index bc230c83a..ccac4cf6b 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -39,9 +39,12 @@ */ package com.jogamp.gluegen.opengl; +import static java.util.logging.Level.INFO; + import com.jogamp.gluegen.ConstantDefinition; import com.jogamp.gluegen.FunctionEmitter; import com.jogamp.gluegen.GlueEmitterControls; +import com.jogamp.gluegen.GlueGen; import com.jogamp.gluegen.JavaConfiguration; import com.jogamp.gluegen.JavaEmitter; import com.jogamp.gluegen.JavaMethodBindingEmitter; @@ -49,6 +52,7 @@ import com.jogamp.gluegen.JavaType; import com.jogamp.gluegen.MethodBinding; import com.jogamp.gluegen.SymbolFilter; import com.jogamp.gluegen.cgram.types.FunctionSymbol; +import com.jogamp.gluegen.cgram.types.Type; import com.jogamp.gluegen.procaddress.ProcAddressEmitter; import com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter; import com.jogamp.gluegen.runtime.opengl.GLNameResolver; @@ -56,7 +60,6 @@ import com.jogamp.gluegen.runtime.opengl.GLNameResolver; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Collection; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -78,34 +81,38 @@ public class GLEmitter extends ProcAddressEmitter { @Override public void beginEmission(final GlueEmitterControls controls) throws IOException { - getGLConfig().parseGLHeaders(controls); + getGLConfig().parseGLSemHeaders(controls); + if( null == getGLConfig().getGLSemInfo() ) { + throw new RuntimeException("No 'GLSemHeader' defined."); + } + getGLConfig().parseGLDocHeaders(controls); + if( null == getGLConfig().getGLDocInfo() ) { + throw new InternalError("XXX"); // since GLDocHeader contains all GLSemHeader .. + } renameExtensionsIntoCore(); - if (getGLConfig().getAutoUnifyExtensions()) { + if ( getGLConfig().getAutoUnifyExtensions() ) { unifyExtensions(controls); } super.beginEmission(controls); } protected void renameExtensionsIntoCore() { + final GLConfiguration config = getGLConfig(); + renameExtensionsIntoCore(config, config.getGLSemInfo(), true); + renameExtensionsIntoCore(config, config.getGLDocInfo(), false); + } + protected void renameExtensionsIntoCore(final GLConfiguration config, final BuildStaticGLInfo glInfo, final boolean isSemHeader) { // This method handles renaming of entire extensions into the // OpenGL core namespace. For example, it is used to move certain // OpenGL ES (OES) extensions into the core namespace which are // already in the core namespace in desktop OpenGL. It builds upon // renaming mechanisms that are built elsewhere. - final GLConfiguration config = getGLConfig(); - final Set<String> extensionsRenamedIntoCore = config.getExtensionsRenamedIntoCore(); - final BuildStaticGLInfo glInfo = config.getGLInfo(); - if (null == glInfo) { - if (extensionsRenamedIntoCore.size() > 0) { - throw new RuntimeException("ExtensionRenamedIntoCore (num: " + extensionsRenamedIntoCore.size() + "), but no GLHeader"); - } - return; - } - for (final String extension : extensionsRenamedIntoCore) { - if(JavaConfiguration.DEBUG_RENAMES) { - System.err.println("<RenameExtensionIntoCore: "+extension+" BEGIN"); - } + final String headerType = isSemHeader ? "GLSemHeader" : "GLDocHeader"; + final Set<String> extensionSet = isSemHeader ? config.getExtensionsRenamedIntoCore() : glInfo.getExtensions(); + + for (final String extension : extensionSet) { + LOG.log(INFO, "<RenameExtensionIntoCore: {0} BEGIN {1}", extension, headerType); final Set<String> declarations = glInfo.getDeclarations(extension); if (declarations != null) { for (final Iterator<String> iterator = declarations.iterator(); iterator.hasNext();) { @@ -118,14 +125,18 @@ public class GLEmitter extends ProcAddressEmitter { if (isGLFunction || isGLEnumeration) { final String renamed = GLNameResolver.normalize(decl, isGLFunction); if (!renamed.equals(decl)) { - config.addJavaSymbolRename(decl, renamed); + if( isSemHeader ) { + // Sem + Doc + config.addJavaSymbolRename(decl, renamed); + } else { + // Doc only + config.addJavaDocSymbolRename(decl, renamed); + } } } } } - if(JavaConfiguration.DEBUG_RENAMES) { - System.err.println("RenameExtensionIntoCore: "+extension+" END>"); - } + LOG.log(INFO, "RenameExtensionIntoCore: {0} END>", extension, headerType); } } @@ -135,35 +146,28 @@ public class GLEmitter extends ProcAddressEmitter { private List<FunctionSymbol> functions; @Override - public void filterSymbols(final List<ConstantDefinition> constants, - final List<FunctionSymbol> functions) { - this.constants = constants; - this.functions = functions; - doWork(); - } - - @Override public List<ConstantDefinition> getConstants() { return constants; } - @Override public List<FunctionSymbol> getFunctions() { return functions; } - private void doWork() { - final BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); + @Override + public void filterSymbols(final List<ConstantDefinition> inConstList, + final List<FunctionSymbol> inFuncList) { + final BuildStaticGLInfo glInfo = getGLConfig().getGLSemInfo(); if (glInfo == null) { return; } // Try to retain a "good" ordering for these symbols final Map<String, ConstantDefinition> constantMap = new LinkedHashMap<String, ConstantDefinition>(); - for (final ConstantDefinition def : constants) { + for (final ConstantDefinition def : inConstList) { constantMap.put(def.getName(), def); } final Map<String, FunctionSymbol> functionMap = new LinkedHashMap<String, FunctionSymbol>(); - for (final FunctionSymbol sym : functions) { + for (final FunctionSymbol sym : inFuncList) { functionMap.put(sym.getName(), sym); } @@ -277,6 +281,10 @@ public class GLEmitter extends ProcAddressEmitter { // Need to expand each one of the generated bindings to take a // Java long instead of a Buffer for each void* argument + if( GlueGen.debug() ) { + System.err.println("expandMethodBinding: j "+binding.toString()); + System.err.println("expandMethodBinding: c "+binding.getCSymbol()); + } // for (MethodBinding cur : bindings) { int j=0; @@ -294,24 +302,38 @@ public class GLEmitter extends ProcAddressEmitter { } MethodBinding result = cur; + int replacedCount = 0; for (int i = 0; i < cur.getNumArguments(); i++) { - if (cur.getJavaArgumentType(i).isNIOBuffer()) { + final JavaType jt = cur.getJavaArgumentType(i); + if( jt.isOpaqued() ) { + replacedCount++; // already replaced, i.e. due to opaque + } else if ( jt.isNIOBuffer() ) { result = result.replaceJavaArgumentType(i, JavaType.createForClass(Long.TYPE)); + replacedCount++; + } + if( GlueGen.debug() ) { + final Type ct = cur.getCArgumentType(i); + System.err.println(" ["+i+"]: #"+replacedCount+", "+ct.getDebugString()+", "+jt.getDebugString()); } } - if (result == cur) { + if ( 0 == replacedCount ) { throw new RuntimeException("Error: didn't find any void* arguments for BufferObject function " - + binding.getName()); + + binding.toString()); } - newBindings.add(result); // Now need to flag this MethodBinding so that we generate the // correct flags in the emitters later bufferObjectMethodBindings.put(result, result); - if( bufferObjectOnly ) { - bindings.remove(j); + if( result != cur ) { + // replaced + newBindings.add(result); + if( bufferObjectOnly ) { + bindings.remove(j); + } else { + j++; + } } else { j++; } @@ -323,12 +345,14 @@ public class GLEmitter extends ProcAddressEmitter { @Override protected boolean needsModifiedEmitters(final FunctionSymbol sym) { - if ((!needsProcAddressWrapper(sym) && !needsBufferObjectVariant(sym)) - || getConfig().isUnimplemented(sym.getName())) { + if ( ( !callThroughProcAddress(sym) && !needsBufferObjectVariant(sym) ) || + getConfig().isUnimplemented(sym) + ) + { return false; + } else { + return true; } - - return true; } public boolean isBufferObjectMethodBinding(final MethodBinding binding) { @@ -337,14 +361,10 @@ public class GLEmitter extends ProcAddressEmitter { @Override public void emitDefine(final ConstantDefinition def, final String optionalComment) throws Exception { - final BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); - if (null == glInfo) { - throw new Exception("No GLInfo for: " + def); - } final String symbolRenamed = def.getName(); final StringBuilder newComment = new StringBuilder(); newComment.append("Part of "); - if (0 == addExtensionsOfSymbols2Buffer(newComment, ", ", "; ", symbolRenamed, def.getAliasedNames())) { + if (0 == addExtensionsOfSymbols2Doc(newComment, ", ", ", ", symbolRenamed)) { if (def.isEnum()) { final String enumName = def.getEnumName(); if (null != enumName) { @@ -361,16 +381,13 @@ public class GLEmitter extends ProcAddressEmitter { // #define GL_EXT_lala 1 // ... // #endif - if (JavaConfiguration.DEBUG_IGNORES) { - final StringBuilder sb = new StringBuilder(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); - System.err.println("Dropping marker: " + sb.toString()); - } + final StringBuilder sb = new StringBuilder(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); + LOG.log(INFO, "Dropping marker: {0}", sb.toString()); return; } } } - if (null != optionalComment) { newComment.append("<br>"); newComment.append(optionalComment); @@ -379,9 +396,9 @@ public class GLEmitter extends ProcAddressEmitter { super.emitDefine(def, newComment.toString()); } - private int addExtensionListOfSymbol2Buffer(final BuildStaticGLInfo glInfo, final StringBuilder buf, final String sep1, final String name) { + private int addExtensionListOfSymbol2Doc(final BuildStaticGLInfo glDocInfo, final StringBuilder buf, final String sep1, final String name) { int num = 0; - final Set<String> extensionNames = glInfo.getExtension(name); + final Set<String> extensionNames = glDocInfo.getExtension(name); if(null!=extensionNames) { for(final Iterator<String> i=extensionNames.iterator(); i.hasNext(); ) { final String extensionName = i.next(); @@ -398,49 +415,35 @@ public class GLEmitter extends ProcAddressEmitter { } return num; } - private int addExtensionListOfAliasedSymbols2Buffer(final BuildStaticGLInfo glInfo, final StringBuilder buf, final String sep1, final String sep2, final String name, final Collection<String> exclude) { + private int addExtensionListOfAliasedSymbols2Doc(final BuildStaticGLInfo glDocInfo, final StringBuilder buf, final String sep1, final String sep2, final String name) { int num = 0; if(null != name) { - num += addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, name); // extensions of given name - boolean needsSep2 = 0<num; - final Set<String> origNames = cfg.getRenamedJavaSymbols(name); - if(null != origNames) { - for(final String origName : origNames) { - if(!exclude.contains(origName)) { - if (needsSep2) { - buf.append(sep2); // diff-name seperator - } - final int num2 = addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, origName); // extensions of orig-name - needsSep2 = num<num2; - num += num2; + num += addExtensionListOfSymbol2Doc(glDocInfo, buf, sep1, name); // extensions of given name + boolean needsSep2 = num > 0; + final Set<String> aliases = ((GLConfiguration)cfg).getRenamedJavaDocSymbols(name); + if(null != aliases) { + for(final String alias : aliases) { + if (needsSep2) { + buf.append(sep2); } + final int num2 = addExtensionListOfSymbol2Doc(glDocInfo, buf, sep1, alias); // extensions of orig-name + needsSep2 = num2 > 0; + num += num2; } } } return num; } - public int addExtensionsOfSymbols2Buffer(StringBuilder buf, final String sep1, final String sep2, final String first, final Collection<String> col) { - final BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); - if (null == glInfo) { - throw new RuntimeException("No GLInfo for: " + first); + public int addExtensionsOfSymbols2Doc(StringBuilder buf, final String sep1, final String sep2, final String first) { + final BuildStaticGLInfo glDocInfo = getGLConfig().getGLDocInfo(); + if (null == glDocInfo) { + throw new RuntimeException("No GLDocInfo for: " + first); } - int num = 0; if (null == buf) { buf = new StringBuilder(); } - - num += addExtensionListOfAliasedSymbols2Buffer(glInfo, buf, sep1, sep2, first, col); - boolean needsSep2 = 0<num; - for(final Iterator<String> iter = col.iterator(); iter.hasNext(); ) { - if(needsSep2) { - buf.append(sep2); // diff-name seperator - } - final int num2 = addExtensionListOfAliasedSymbols2Buffer(glInfo, buf, sep1, sep2, iter.next(), col); - needsSep2 = num<num2; - num += num2; - } - return num; + return addExtensionListOfAliasedSymbols2Doc(glDocInfo, buf, sep1, sep2, first); } //---------------------------------------------------------------------- diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java index d491a3712..afd9163ee 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -103,7 +103,6 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit @Override protected void emitBindingCSignature(final MethodBinding binding, final PrintWriter writer) { - final String symbolRenamed = binding.getName(); final StringBuilder newComment = new StringBuilder(); @@ -113,18 +112,25 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit writer.print(" </code> "); newComment.append("<br>Part of "); - if (0 == glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", "; ", symbolRenamed, binding.getAliasedNames())) { + if (0 == glEmitter.addExtensionsOfSymbols2Doc(newComment, ", ", ", ", symbolRenamed)) { if (glEmitter.getGLConfig().getAllowNonGLExtensions()) { newComment.append("CORE FUNC"); } else { - final StringBuilder sb = new StringBuilder(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); - final RuntimeException ex = new RuntimeException("Couldn't find extension to: " + binding + " ; " + sb.toString()); - glEmitter.getGLConfig().getGLInfo().dump(); - // glEmitter.getGLConfig().dumpRenames(); - throw ex; + 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()); + System.err.println(ex.getMessage()); + glEmitter.getGLConfig().getGLDocInfo().dump(); + // glEmitter.getGLConfig().dumpRenames(); + throw ex; + } else { + newComment.append("UNDEFINED"); + } } } + newComment.append("<br>"); + emitAliasedDocNamesComment(funcSym, newComment); writer.print(newComment.toString()); } } diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index e1ddc9c66..c36727fe4 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -1248,7 +1248,7 @@ public class FBObject { return("FBO missing draw buffer"); case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: return("FBO missing read buffer"); - case GL2ES3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + case GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: return("FBO missing multisample buffer"); case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: return("FBO missing layer targets"); @@ -1280,7 +1280,7 @@ public class FBObject { case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS: case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: - case GL2ES3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + case GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: if(0 == colorbufferCount || null == depth) { // we are in transition @@ -2500,8 +2500,8 @@ public class FBObject { if(!bound || fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER)) { checkInitialized(); if( fullFBOSupport ) { - gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, getWriteFramebuffer()); // this fb, msaa or normal - gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, getReadFramebuffer()); // msaa: sampling sink, normal: this fb + gl.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, getWriteFramebuffer()); // this fb, msaa or normal + gl.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, getReadFramebuffer()); // msaa: sampling sink, normal: this fb } else { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer()); // normal: read/write } @@ -2524,8 +2524,8 @@ public class FBObject { if(fullFBOSupport) { // default read/draw buffers, may utilize GLContext/GLDrawable override of // GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer() - gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, 0); - gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, 0); } else { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } @@ -2594,8 +2594,8 @@ public class FBObject { if( checkError ) { checkPreGLError(gl); } - gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, fbName); // read from this MSAA fb - gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer()); // write to sampling sink + gl.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, fbName); // read from this MSAA fb + gl.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer()); // write to sampling sink ((GL2ES3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2ES3 is OK GL.GL_COLOR_BUFFER_BIT, GL.GL_NEAREST); if( checkError ) { @@ -2607,8 +2607,8 @@ public class FBObject { if(fullFBOSupport) { // default read/draw buffers, may utilize GLContext/GLDrawable override of // GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer() - gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, 0); - gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, 0); } else { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } diff --git a/src/jogl/classes/com/jogamp/opengl/GLBase.java b/src/jogl/classes/com/jogamp/opengl/GLBase.java index 19b7808fc..dee5f1488 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLBase.java +++ b/src/jogl/classes/com/jogamp/opengl/GLBase.java @@ -61,19 +61,11 @@ package com.jogamp.opengl; * * <UL> * - * <LI> The memory allocators for the NVidia vertex_array_range (VAR) - * extension, in particular <code>wglAllocateMemoryNV</code> / - * <code>glXAllocateMemoryNV</code> and associated routines. {@link - * #glAllocateMemoryNV} has been provided for window system-independent - * access to VAR. {@link #isFunctionAvailable} will translate an argument - * of "glAllocateMemoryNV" or "glFreeMemoryNV" into the appropriate - * window system-specific name. </P> - * * <LI> WGL_ARB_pbuffer, WGL_ARB_pixel_format, and other * platform-specific pbuffer functionality; the availability of * pbuffers can be queried on Windows, X11 and Mac OS X platforms by * querying {@link #isExtensionAvailable} with an argument of - * "GL_ARB_pbuffer" or "GL_ARB_pixel_format". + * "GL_ARB_pbuffer" or "GL_ARB_pixel_format".</LI> * * </UL> <P> * @@ -232,6 +224,19 @@ public interface GLBase { public boolean isGLES3Compatible(); /** + * Indicates whether this GL object is compatible with the core OpenGL ES3.1 functionality. + * <p> + * Return true if the underlying context is an ES3 context ≥ 3.1 or implements + * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false. + * </p> + * <p> + * Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 ≥ 3.1 ] + * </p> + * @see GLContext#isGLES31Compatible() + */ + public boolean isGLES31Compatible(); + + /** * Indicates whether this GL object supports GLSL. * @see GLContext#hasGLSL() */ diff --git a/src/jogl/classes/com/jogamp/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java index 6366c4e37..5ecd5e1e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java @@ -193,10 +193,13 @@ public abstract class GLContext { // /** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. See {@link #isGLES2Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ - protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10; + protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10; /** <code>GL_ARB_ES3_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES3Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ - protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11; + protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11; + + /** <code>GL_ARB_ES3_1_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES31Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ + protected static final int CTX_IMPL_ES31_COMPAT = 1 << 12; /** * Context supports basic FBO, details see {@link #hasBasicFBOSupport()}. @@ -204,7 +207,7 @@ public abstract class GLContext { * @see #hasBasicFBOSupport() * @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile) */ - protected static final int CTX_IMPL_FBO = 1 << 12; + protected static final int CTX_IMPL_FBO = 1 << 13; /** * Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points, @@ -213,7 +216,7 @@ public abstract class GLContext { * @see #hasFP32CompatAPI() * @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile) */ - protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 13; + protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 14; private static final ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>(); @@ -911,6 +914,17 @@ public abstract class GLContext { } /** + * Return true if this context is an ES3 context ≥ 3.1 or implements + * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false. + * <p> + * Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 ≥ 3.1 ] + * </p> + */ + public final boolean isGLES31Compatible() { + return 0 != ( ctxOptions & CTX_IMPL_ES31_COMPAT ) ; + } + + /** * @return true if impl. is a hardware rasterizer, otherwise false. * @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile) * @see GLProfile#isHardwareRasterizer() @@ -988,7 +1002,7 @@ public abstract class GLContext { final GL gl = getGL(); final int[] val = new int[] { 0 } ; try { - gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0); + gl.glGetIntegerv(GL.GL_MAX_SAMPLES, val, 0); final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR == glerr) { return val[0]; @@ -1958,6 +1972,29 @@ public abstract class GLContext { } return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT ); } + /** + * Returns true if a ES3 ≥ 3.1 compatible profile is available, + * i.e. either a ≥ 4.5 context or a ≥ 3.1 context supporting <code>GL_ARB_ES3_1_compatibility</code>, + * otherwise false. + * <p> + * Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 ≥ 3.1 ] + * </p> + */ + public static final boolean isGLES31CompatibleAvailable(final AbstractGraphicsDevice device) { + final int major[] = { 0 }; + final int minor[] = { 0 }; + final int ctp[] = { 0 }; + boolean ok; + + ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp); + if( !ok ) { + ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp); + } + if( !ok ) { + GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_COMPAT, major, minor, ctp); + } + return 0 != ( ctp[0] & CTX_IMPL_ES31_COMPAT ); + } public static boolean isGL4bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware); diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java index 1593da25c..1bf8071ea 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java +++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java @@ -52,6 +52,7 @@ public class GLExtensions { public static final String ARB_ES2_compatibility = "GL_ARB_ES2_compatibility"; public static final String ARB_ES3_compatibility = "GL_ARB_ES3_compatibility"; + public static final String ARB_ES3_1_compatibility = "GL_ARB_ES3_1_compatibility"; public static final String EXT_abgr = "GL_EXT_abgr"; public static final String OES_rgb8_rgba8 = "GL_OES_rgb8_rgba8"; diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java index 5070f3e4e..af16348a8 100644 --- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java +++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java @@ -29,7 +29,6 @@ package com.jogamp.opengl; import com.jogamp.common.GlueGenVersion; -import com.jogamp.opengl.*; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; diff --git a/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java b/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java index 91b2f5e0c..5bf4c106c 100644 --- a/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java @@ -1994,7 +1994,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl2es3.getDefaultReadBuffer())); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: def-readBuffer 0x"+Integer.toHexString(gl2es3.getDefaultReadBuffer())); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: def-readFBO 0x"+Integer.toHexString(gl2es3.getDefaultReadFramebuffer())); - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: bound-readFBO 0x"+Integer.toHexString(gl2es3.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER))); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: bound-readFBO 0x"+Integer.toHexString(gl2es3.getBoundFramebuffer(GL.GL_READ_FRAMEBUFFER))); } } @@ -2030,7 +2030,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: def-readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: def-readFBO 0x"+Integer.toHexString(gl.getDefaultReadFramebuffer())); - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER))); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL.GL_READ_FRAMEBUFFER))); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: "+GLJPanel.this.getName()+" pixelAttribs "+pixelAttribs); } gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts); @@ -2042,7 +2042,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: def-readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: def-readFBO 0x"+Integer.toHexString(gl.getDefaultReadFramebuffer())); - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER))); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL.GL_READ_FRAMEBUFFER))); } if( viewportChange ) { gl.glViewport(usrViewport[0], usrViewport[1], usrViewport[2], usrViewport[3]); @@ -2391,8 +2391,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing gl.glBindTexture(fboTextureTarget, frameBufferTexture[0]); final int[] width = new int[1]; final int[] height = new int[1]; - gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2GL3.GL_TEXTURE_WIDTH, width, 0); - gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2GL3.GL_TEXTURE_HEIGHT, height, 0); + gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2ES3.GL_TEXTURE_WIDTH, width, 0); + gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2ES3.GL_TEXTURE_HEIGHT, height, 0); gl.glGenRenderbuffers(1, frameBufferDepthBuffer, 0); if (DEBUG) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index 6a2a02387..3340af8ab 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -717,7 +717,7 @@ public class GLBuffers extends Buffers { break; case GL.GL_RGB: case GL2ES3.GL_RGB_INTEGER: - case GL2GL3.GL_BGR: + case GL.GL_BGR: case GL2GL3.GL_BGR_INTEGER: compCount = 3; break; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java index 4575de959..c82f63898 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java @@ -270,7 +270,7 @@ public class GLPixelBuffer { break; } break; - case GL2GL3.GL_BGR: + case GL.GL_BGR: if( GL.GL_UNSIGNED_BYTE == glDataType ) { pixFmt = PixelFormat.BGR888; } @@ -392,7 +392,7 @@ public class GLPixelBuffer { break; case BGR888: if( glp.isGL2GL3() ) { - df = GL2GL3.GL_BGR; + df = GL.GL_BGR; } break; case RGBx8888: diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index c2067a9f2..cc3462f99 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -176,7 +176,7 @@ public class GLReadBufferUtil { final int reqCompCount = hasAlpha ? 4 : 3; final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), reqCompCount); final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, reqCompCount, true); - final int componentCount = pixelAttribs.pfmt.comp.componenCount(); + final int componentCount = pixelAttribs.pfmt.comp.componentCount(); hasAlpha = 0 <= pixelAttribs.pfmt.comp.find(PixelFormat.CType.A); final int alignment = 4 == componentCount ? 4 : 1 ; final int internalFormat = 4 == componentCount ? GL.GL_RGBA : GL.GL_RGB; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java index 6b0b3784d..d2f89cb9b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java @@ -235,7 +235,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { if( null == hostPixComp ) { throw new IllegalArgumentException("Null hostPixComp"); } - final int awtFormat = getAWTFormat(gl.getGLProfile(), hostPixComp.componenCount()); + final int awtFormat = getAWTFormat(gl.getGLProfile(), hostPixComp.componentCount()); final BufferedImage image = new BufferedImage(width, height, awtFormat); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); @@ -291,7 +291,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { r.dispose(); } r = allocateImpl(hostPixComp, pixelAttributes, pack, - getAWTFormat(gl.getGLProfile(), hostPixComp.componenCount()), width, height, depth, minByteSize); + getAWTFormat(gl.getGLProfile(), hostPixComp.componentCount()), width, height, depth, minByteSize); bufferMap.put(bufferKey, r); } return r; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index bb1c5e9b1..f8a66fe45 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -136,8 +136,8 @@ public class ShaderCode { case GL2ES2.GL_VERTEX_SHADER: case GL2ES2.GL_FRAGMENT_SHADER: case GL3.GL_GEOMETRY_SHADER: - case GL4.GL_TESS_CONTROL_SHADER: - case GL4.GL_TESS_EVALUATION_SHADER: + case GL3.GL_TESS_CONTROL_SHADER: + case GL3.GL_TESS_EVALUATION_SHADER: break; default: throw new GLException("Unknown shader type: "+type); @@ -166,8 +166,8 @@ public class ShaderCode { case GL2ES2.GL_VERTEX_SHADER: case GL2ES2.GL_FRAGMENT_SHADER: case GL3.GL_GEOMETRY_SHADER: - case GL4.GL_TESS_CONTROL_SHADER: - case GL4.GL_TESS_EVALUATION_SHADER: + case GL3.GL_TESS_CONTROL_SHADER: + case GL3.GL_TESS_EVALUATION_SHADER: break; default: throw new GLException("Unknown shader type: "+type); @@ -292,9 +292,9 @@ public class ShaderCode { return binary?SUFFIX_FRAGMENT_BINARY:SUFFIX_FRAGMENT_SOURCE; case GL3.GL_GEOMETRY_SHADER: return binary?SUFFIX_GEOMETRY_BINARY:SUFFIX_GEOMETRY_SOURCE; - case GL4.GL_TESS_CONTROL_SHADER: + case GL3.GL_TESS_CONTROL_SHADER: return binary?SUFFIX_TESS_CONTROL_BINARY:SUFFIX_TESS_CONTROL_SOURCE; - case GL4.GL_TESS_EVALUATION_SHADER: + case GL3.GL_TESS_EVALUATION_SHADER: return binary?SUFFIX_TESS_EVALUATION_BINARY:SUFFIX_TESS_EVALUATION_SOURCE; default: throw new GLException("illegal shader type: "+type); @@ -520,9 +520,9 @@ public class ShaderCode { return "FRAGMENT_SHADER"; case GL3.GL_GEOMETRY_SHADER: return "GEOMETRY_SHADER"; - case GL4.GL_TESS_CONTROL_SHADER: + case GL3.GL_TESS_CONTROL_SHADER: return "TESS_CONTROL_SHADER"; - case GL4.GL_TESS_EVALUATION_SHADER: + case GL3.GL_TESS_EVALUATION_SHADER: return "TESS_EVALUATION_SHADER"; } return "UNKNOWN_SHADER"; @@ -1019,8 +1019,8 @@ public class ShaderCode { switch ( shaderType ) { case GL2ES2.GL_VERTEX_SHADER: case GL3.GL_GEOMETRY_SHADER: - case GL4.GL_TESS_CONTROL_SHADER: - case GL4.GL_TESS_EVALUATION_SHADER: + case GL3.GL_TESS_CONTROL_SHADER: + case GL3.GL_TESS_EVALUATION_SHADER: defaultPrecision = gl3_default_precision_vp_gp; break; case GL2ES2.GL_FRAGMENT_SHADER: defaultPrecision = gl3_default_precision_fp; break; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java index ce1acc6d7..615d8c24f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java @@ -42,7 +42,6 @@ import java.nio.Buffer; import com.jogamp.opengl.GLProfile; import com.jogamp.common.nio.Buffers; -import com.jogamp.opengl.util.GLBuffers; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; /** diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index 27571ae0d..54a552f33 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -60,6 +60,7 @@ import com.jogamp.nativewindow.util.DimensionImmutable; import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES3; import com.jogamp.opengl.GL2GL3; import com.jogamp.opengl.GLContext; import com.jogamp.opengl.GLException; @@ -597,9 +598,9 @@ public class TextureIO { final GL2GL3 gl = _gl.getGL2GL3(); texture.bind(gl); - final int internalFormat = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_INTERNAL_FORMAT); - final int width = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_WIDTH); - final int height = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_HEIGHT); + final int internalFormat = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2ES3.GL_TEXTURE_INTERNAL_FORMAT); + final int width = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2ES3.GL_TEXTURE_WIDTH); + final int height = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2ES3.GL_TEXTURE_HEIGHT); final int border = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_BORDER); TextureData data = null; if (internalFormat == GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT || @@ -617,7 +618,7 @@ public class TextureIO { int fetchedFormat = 0; switch (internalFormat) { case GL.GL_RGB: - case GL2GL3.GL_BGR: + case GL.GL_BGR: case GL.GL_RGB8: bytesPerPixel = 3; fetchedFormat = GL.GL_RGB; @@ -1303,7 +1304,7 @@ public class TextureIO { final int pixelType = pixelAttribs.type; if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA || - pixelFormat == GL2GL3.GL_BGR || + pixelFormat == GL.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java index 1866c5921..12332dbe7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.util.texture; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; import com.jogamp.opengl.GL2GL3; -import com.jogamp.opengl.GL3; import com.jogamp.opengl.GLException; /** @@ -61,11 +61,11 @@ public class TextureState { case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break; case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break; case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break; - case GL.GL_TEXTURE_2D_ARRAY: texBindQName = GL.GL_TEXTURE_BINDING_2D_ARRAY; break; + case GL2ES3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2ES3.GL_TEXTURE_BINDING_2D_ARRAY; break; case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break; case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break; - case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; - case GL3.GL_TEXTURE_2D_MULTISAMPLE_ARRAY: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break; + case GL2ES2.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL2ES2.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; + case GL2ES2.GL_TEXTURE_2D_MULTISAMPLE_ARRAY: texBindQName = GL2ES2.GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break; default: texBindQName = 0; } return texBindQName; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java index aa0be8e9b..692061cec 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java @@ -232,7 +232,7 @@ public class AWTTextureData extends TextureData { // we can pass the image data directly to OpenGL only if // we have an integral number of pixels in each scanline if ((scanlineStride % 3) == 0) { - pixelAttributes = new GLPixelAttributes(GL2GL3.GL_BGR, GL.GL_UNSIGNED_BYTE); + pixelAttributes = new GLPixelAttributes(GL.GL_BGR, GL.GL_UNSIGNED_BYTE); rowLength = scanlineStride / 3; alignment = 1; } else { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java index 700de593f..99954ae86 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java @@ -44,7 +44,6 @@ import java.nio.*; import java.nio.channels.FileChannel; import com.jogamp.opengl.*; - import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.util.texture.*; @@ -112,7 +111,7 @@ public class NetPbmTextureWriter implements TextureWriter { final int pixelType = data.getPixelType(); if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA || - pixelFormat == GL2GL3.GL_BGR || + pixelFormat == GL.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { @@ -125,7 +124,7 @@ public class NetPbmTextureWriter implements TextureWriter { final int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ; - if( pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) { + if( pixelFormat == GL.GL_BGR || pixelFormat == GL.GL_BGRA ) { // Must reverse order of red and blue channels to get correct results for (int i = 0; i < buf.remaining(); i += comps) { final byte red = buf.get(i + 0); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java index bb872714c..831927a90 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java @@ -42,8 +42,8 @@ package com.jogamp.opengl.util.texture.spi; import java.io.*; import java.nio.*; import java.nio.channels.*; -import com.jogamp.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IOUtil; /** @@ -352,7 +352,7 @@ public class TGAImage { bpp = header.pixelDepth / 8; switch (header.pixelDepth) { case 24: - format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB; + format = glp.isGL2GL3() ? GL.GL_BGR : GL.GL_RGB; break; case 32: boolean useBGRA = glp.isGL2GL3(); diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index 0742f7b05..2aa4c4297 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -41,7 +41,6 @@ package jogamp.opengl; import com.jogamp.opengl.*; - import com.jogamp.common.util.IntIntHashMap; import com.jogamp.common.util.PropertyAccess; @@ -103,7 +102,7 @@ public class GLBufferStateTracker { // Start with known unbound targets for known keys // setBoundBufferObject(GL2ES3.GL_VERTEX_ARRAY_BINDING, 0); // not using default VAO (removed in GL3 core) - only explicit setBoundBufferObject(GL.GL_ARRAY_BUFFER, 0); - setBoundBufferObject(GL4.GL_DRAW_INDIRECT_BUFFER, 0); + setBoundBufferObject(GL3ES3.GL_DRAW_INDIRECT_BUFFER, 0); setBoundBufferObject(GL.GL_ELEMENT_ARRAY_BUFFER, 0); setBoundBufferObject(GL2ES3.GL_PIXEL_PACK_BUFFER, 0); setBoundBufferObject(GL2ES3.GL_PIXEL_UNPACK_BUFFER, 0); @@ -131,16 +130,16 @@ public class GLBufferStateTracker { private static final int getQueryName(final int target) { switch (target) { case GL.GL_ARRAY_BUFFER: return GL.GL_ARRAY_BUFFER_BINDING; - case GL4.GL_ATOMIC_COUNTER_BUFFER: return GL4.GL_ATOMIC_COUNTER_BUFFER_BINDING; + case GL2ES3.GL_ATOMIC_COUNTER_BUFFER: return GL2ES3.GL_ATOMIC_COUNTER_BUFFER_BINDING; case GL2ES3.GL_COPY_READ_BUFFER: return GL2ES3.GL_COPY_READ_BUFFER_BINDING; case GL2ES3.GL_COPY_WRITE_BUFFER: return GL2ES3.GL_COPY_WRITE_BUFFER_BINDING; - case GL4.GL_DRAW_INDIRECT_BUFFER: return GL4.GL_DRAW_INDIRECT_BUFFER_BINDING; - case GL4.GL_DISPATCH_INDIRECT_BUFFER: return GL4.GL_DISPATCH_INDIRECT_BUFFER_BINDING; + case GL3ES3.GL_DRAW_INDIRECT_BUFFER: return GL3ES3.GL_DRAW_INDIRECT_BUFFER_BINDING; + case GL3ES3.GL_DISPATCH_INDIRECT_BUFFER: return GL3ES3.GL_DISPATCH_INDIRECT_BUFFER_BINDING; case GL.GL_ELEMENT_ARRAY_BUFFER: return GL.GL_ELEMENT_ARRAY_BUFFER_BINDING; - case GL2ES3.GL_PIXEL_PACK_BUFFER: return GL2ES3.GL_PIXEL_PACK_BUFFER_BINDING; - case GL2ES3.GL_PIXEL_UNPACK_BUFFER: return GL2ES3.GL_PIXEL_UNPACK_BUFFER_BINDING; - // FIXME case GL4.GL_QUERY_BUFFER: return GL4.GL_QUERY_BUFFER_BINDING; - case GL4.GL_SHADER_STORAGE_BUFFER: return GL4.GL_SHADER_STORAGE_BUFFER_BINDING; + case GL2ES3.GL_PIXEL_PACK_BUFFER: return GL2ES3.GL_PIXEL_PACK_BUFFER_BINDING; + case GL2ES3.GL_PIXEL_UNPACK_BUFFER: return GL2ES3.GL_PIXEL_UNPACK_BUFFER_BINDING; + case GL4.GL_QUERY_BUFFER: return GL4.GL_QUERY_BUFFER_BINDING; + case GL3ES3.GL_SHADER_STORAGE_BUFFER: return GL3ES3.GL_SHADER_STORAGE_BUFFER_BINDING; case GL2GL3.GL_TEXTURE_BUFFER: return GL2GL3.GL_TEXTURE_BINDING_BUFFER; case GL2ES3.GL_TRANSFORM_FEEDBACK_BUFFER: return GL2ES3.GL_TRANSFORM_FEEDBACK_BUFFER_BINDING; case GL2ES3.GL_UNIFORM_BUFFER: return GL2ES3.GL_UNIFORM_BUFFER_BINDING; @@ -154,16 +153,16 @@ public class GLBufferStateTracker { private static final void checkTargetName(final int target) { switch (target) { case GL.GL_ARRAY_BUFFER: - case GL4.GL_ATOMIC_COUNTER_BUFFER: + case GL2ES3.GL_ATOMIC_COUNTER_BUFFER: case GL2ES3.GL_COPY_READ_BUFFER: case GL2ES3.GL_COPY_WRITE_BUFFER: - case GL4.GL_DRAW_INDIRECT_BUFFER: - case GL4.GL_DISPATCH_INDIRECT_BUFFER: + case GL3ES3.GL_DRAW_INDIRECT_BUFFER: + case GL3ES3.GL_DISPATCH_INDIRECT_BUFFER: case GL.GL_ELEMENT_ARRAY_BUFFER: case GL2ES3.GL_PIXEL_PACK_BUFFER: case GL2ES3.GL_PIXEL_UNPACK_BUFFER: - // FIXME case GL4.GL_QUERY_BUFFER: - case GL4.GL_SHADER_STORAGE_BUFFER: + case GL4.GL_QUERY_BUFFER: + case GL3ES3.GL_SHADER_STORAGE_BUFFER: case GL2GL3.GL_TEXTURE_BUFFER: case GL2ES3.GL_TRANSFORM_FEEDBACK_BUFFER: case GL2ES3.GL_UNIFORM_BUFFER: diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 1ff64725a..c56dc74da 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -41,7 +41,6 @@ package jogamp.opengl; import java.lang.reflect.Method; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.security.AccessController; import java.security.PrivilegedAction; @@ -1315,32 +1314,15 @@ public abstract class GLContextImpl extends GLContext { */ public abstract ProcAddressTable getPlatformExtProcAddressTable(); - /** - * Part of <code>GL_NV_vertex_array_range</code>. - * <p> - * Provides platform-independent access to the <code>wglAllocateMemoryNV</code> / - * <code>glXAllocateMemoryNV</code>. - * </p> - */ - public abstract ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority); - - /** - * Part of <code>GL_NV_vertex_array_range</code>. - * <p> - * Provides platform-independent access to the <code>wglFreeMemoryNV</code> / - * <code>glXFreeMemoryNV</code>. - * </p> - */ - public abstract void glFreeMemoryNV(ByteBuffer pointer); - /** Maps the given "platform-independent" function name to a real function - name. Currently this is only used to map "glAllocateMemoryNV" and - associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */ + name. Currently not used. */ protected final String mapToRealGLFunctionName(final String glFunctionName) { final Map<String, String> map = getFunctionNameMap(); - final String lookup = ( null != map ) ? map.get(glFunctionName) : null; - if (lookup != null) { - return lookup; + if( null != map ) { + final String lookup = map.get(glFunctionName); + if (lookup != null) { + return lookup; + } } return glFunctionName; } @@ -1353,9 +1335,11 @@ public abstract class GLContextImpl extends GLContext { */ protected final String mapToRealGLExtensionName(final String glExtensionName) { final Map<String, String> map = getExtensionNameMap(); - final String lookup = ( null != map ) ? map.get(glExtensionName) : null; - if (lookup != null) { - return lookup; + if( null != map ) { + final String lookup = map.get(glExtensionName); + if (lookup != null) { + return lookup; + } } return glExtensionName; } @@ -1673,7 +1657,7 @@ public abstract class GLContextImpl extends GLContext { } if( major < 2 ) { // there is no ES2/3-compat for a profile w/ major < 2 - ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT ) ; + ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT | GLContext.CTX_IMPL_ES31_COMPAT ) ; } if(!isCurrentContextHardwareRasterizer()) { @@ -1767,10 +1751,19 @@ public abstract class GLContextImpl extends GLContext { if( major >= 3 ) { ctxProfileBits |= CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ; ctxProfileBits |= CTX_IMPL_FBO; + if( minor >= 1 ) { + ctxProfileBits |= CTX_IMPL_ES31_COMPAT; + } } else if( major >= 2 ) { ctxProfileBits |= CTX_IMPL_ES2_COMPAT; ctxProfileBits |= CTX_IMPL_FBO; } + } else if( ( major > 4 || major == 4 && minor >= 5 ) || + ( ( major > 3 || major == 3 && minor >= 1 ) && isExtensionAvailable( GLExtensions.ARB_ES3_1_compatibility ) ) ) { + // See GLContext.isGLES31CompatibleAvailable(..)/isGLES31Compatible() + // Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES ≥ 3.1 ] + ctxProfileBits |= CTX_IMPL_ES31_COMPAT | CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ; + ctxProfileBits |= CTX_IMPL_FBO; } else if( ( major > 4 || major == 4 && minor >= 3 ) || ( ( major > 3 || major == 3 && minor >= 1 ) && isExtensionAvailable( GLExtensions.ARB_ES3_compatibility ) ) ) { // See GLContext.isGLES3CompatibleAvailable(..)/isGLES3Compatible() @@ -2443,10 +2436,10 @@ public abstract class GLContextImpl extends GLContext { } switch(target) { case GL.GL_FRAMEBUFFER: - case GL2ES3.GL_DRAW_FRAMEBUFFER: + case GL.GL_DRAW_FRAMEBUFFER: boundFBOTarget[0] = framebufferName; // draw break; - case GL2ES3.GL_READ_FRAMEBUFFER: + case GL.GL_READ_FRAMEBUFFER: boundFBOTarget[1] = framebufferName; // read break; default: // ignore untracked target @@ -2456,9 +2449,9 @@ public abstract class GLContextImpl extends GLContext { public final int getBoundFramebuffer(final int target) { switch(target) { case GL.GL_FRAMEBUFFER: - case GL2ES3.GL_DRAW_FRAMEBUFFER: + case GL.GL_DRAW_FRAMEBUFFER: return boundFBOTarget[0]; // draw - case GL2ES3.GL_READ_FRAMEBUFFER: + case GL.GL_READ_FRAMEBUFFER: return boundFBOTarget[1]; // read default: throw new InternalError("Invalid FBO target name: "+toHexString(target)); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 910afcd22..9d7ad64f9 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -36,7 +36,6 @@ package jogamp.opengl.egl; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Map; @@ -507,14 +506,4 @@ public class EGLContext extends GLContextImpl { protected void copyImpl(final GLContext source, final int mask) throws GLException { throw new GLException("Not yet implemented"); } - - @Override - public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { - throw new GLException("Should not call this"); - } - - @Override - public final void glFreeMemoryNV(final ByteBuffer pointer) { - throw new GLException("Should not call this"); - } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 51b243f37..3c22e612f 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -40,7 +40,6 @@ package jogamp.opengl.macosx.cgl; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Map; @@ -422,18 +421,6 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { - // FIXME: apparently the Apple extension doesn't require a custom memory allocator - throw new GLException("Not yet implemented"); - } - - @Override - public final void glFreeMemoryNV(final ByteBuffer pointer) { - // FIXME: apparently the Apple extension doesn't require a custom memory allocator - throw new GLException("Not yet implemented"); - } - - @Override protected final void updateGLXProcAddressTable() { final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index ec4575a9c..966a4dcf5 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -40,7 +40,6 @@ package jogamp.opengl.windows.wgl; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.HashMap; import java.util.Map; @@ -63,7 +62,6 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; public class WindowsWGLContext extends GLContextImpl { - static final Map<String, String> functionNameMap; static final Map<String, String> extensionNameMap; private boolean wglGetExtensionsStringEXTInitialized; private boolean wglGetExtensionsStringEXTAvailable; @@ -77,10 +75,6 @@ public class WindowsWGLContext extends GLContextImpl { private int hasSwapGroupNV = 0; static { - functionNameMap = new HashMap<String, String>(); - functionNameMap.put("glAllocateMemoryNV", "wglAllocateMemoryNV"); - functionNameMap.put("glFreeMemoryNV", "wglFreeMemoryNV"); - extensionNameMap = new HashMap<String, String>(); extensionNameMap.put(GLExtensions.ARB_pbuffer, WindowsWGLDrawableFactory.WGL_ARB_pbuffer); extensionNameMap.put(GLExtensions.ARB_pixel_format, WindowsWGLDrawableFactory.WGL_ARB_pixel_format); @@ -192,7 +186,7 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected Map<String, String> getFunctionNameMap() { return functionNameMap; } + protected Map<String, String> getFunctionNameMap() { return null; } @Override protected Map<String, String> getExtensionNameMap() { return extensionNameMap; } @@ -572,15 +566,4 @@ public class WindowsWGLContext extends GLContextImpl { } return res; } - - @Override - public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { - return getWGLExt().wglAllocateMemoryNV(size, readFrequency, writeFrequency, priority); - } - - @Override - public final void glFreeMemoryNV(final ByteBuffer pointer) { - getWGLExt().wglFreeMemoryNV(pointer); - } - } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 19056a73b..4665dc17c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -40,7 +40,6 @@ package jogamp.opengl.x11.glx; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.HashMap; import java.util.Map; @@ -68,7 +67,6 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice; import com.jogamp.opengl.GLExtensions; public class X11GLXContext extends GLContextImpl { - private static final Map<String, String> functionNameMap; private static final Map<String, String> extensionNameMap; private GLXExt _glXExt; // Table that holds the addresses of the native C-language entry points for @@ -86,10 +84,6 @@ public class X11GLXContext extends GLContextImpl { protected volatile boolean isGLXVersionGreaterEqualOneThree; static { - functionNameMap = new HashMap<String, String>(); - functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV"); - functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV"); - extensionNameMap = new HashMap<String, String>(); extensionNameMap.put(GLExtensions.ARB_pbuffer, X11GLXDrawableFactory.GLX_SGIX_pbuffer); extensionNameMap.put(GLExtensions.ARB_pixel_format, X11GLXDrawableFactory.GLX_SGIX_pbuffer); // good enough @@ -134,7 +128,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected Map<String, String> getFunctionNameMap() { return functionNameMap; } + protected Map<String, String> getFunctionNameMap() { return null; } @Override protected Map<String, String> getExtensionNameMap() { return extensionNameMap; } @@ -647,16 +641,6 @@ public class X11GLXContext extends GLContextImpl { } @Override - public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { - return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority); - } - - @Override - public final void glFreeMemoryNV(final ByteBuffer pointer) { - getGLXExt().glXFreeMemoryNV(pointer); - } - - @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); |