From 0b98f807fc0c3cefacaa238f157b4a61874d6e2b Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 24 Apr 2010 18:13:36 +0200 Subject: Refactored ProcAddressTable generation. - ProcAddressTable is now the common superclass for all tables - Removed ProcAddressHelpers and added FunctionAddressResolver extension mechanism --- .../runtime/opengl/GLProcAddressResolver.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java (limited to 'src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java') diff --git a/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java new file mode 100644 index 000000000..ebe4d2685 --- /dev/null +++ b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010, Michael Bien + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of JogAmp nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Michael Bien BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Created on Saturday, April 24 2010 16:44 + */ +package com.jogamp.gluegen.runtime.opengl; + +import com.jogamp.common.os.DynamicLookupHelper; +import com.jogamp.gluegen.runtime.FunctionAddressResolver; + +/** + * @author Sven Gothel + * @author Michael Bien + */ +public class GLProcAddressResolver implements FunctionAddressResolver { + + + public long resolve(String name, DynamicLookupHelper lookup) { + + int permutations = GLExtensionNames.getFuncNamePermutationNumber(name); + + for (int i = 0; i < permutations; i++) { + String funcName = GLExtensionNames.getFuncNamePermutation(name, i); + try { + return lookup.dynamicLookupFunction(funcName); + } catch (Exception e) { +// if (DEBUG) { +// dout.println(e); +// e.printStackTrace(); +// } + } + } + + throw new RuntimeException("unresolveable function name: "+name); + } +} -- cgit v1.2.3 From f8fe770c3e32b8159476b2f02cd316288bae06b1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 27 Apr 2010 03:21:40 +0200 Subject: Fix GLProcAddressResolver regression: Loop through all names until found or n/a. Return 0 if not found, no Exception --- .../gluegen/runtime/opengl/GLProcAddressResolver.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java') diff --git a/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java index ebe4d2685..914e52792 100644 --- a/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java +++ b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java @@ -39,23 +39,23 @@ import com.jogamp.gluegen.runtime.FunctionAddressResolver; */ public class GLProcAddressResolver implements FunctionAddressResolver { + public static final boolean DEBUG = false; public long resolve(String name, DynamicLookupHelper lookup) { + long newProcAddress = 0; int permutations = GLExtensionNames.getFuncNamePermutationNumber(name); - for (int i = 0; i < permutations; i++) { + for (int i = 0; 0 == newProcAddress && i < permutations; i++) { String funcName = GLExtensionNames.getFuncNamePermutation(name, i); try { - return lookup.dynamicLookupFunction(funcName); + newProcAddress = lookup.dynamicLookupFunction(funcName); } catch (Exception e) { -// if (DEBUG) { -// dout.println(e); -// e.printStackTrace(); -// } + if (DEBUG) { + e.printStackTrace(); + } } } - - throw new RuntimeException("unresolveable function name: "+name); + return newProcAddress; } } -- cgit v1.2.3 From 4b3c44f66284fa932bf4dd5a4b7d00fab0d9e692 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 14 Sep 2010 04:45:37 +0200 Subject: LICENSE.txt changes: - Added JogAmp Community and common denominator: New BSD 3-clause license - Added note to make/lib binary file (source and license) Added source and license text for external binaries used in build process (make/lib folder). Changed 'Sven Gothel' and 'Michael Bien' New BSD 3-clause license to 'JogAmp Community' Simplified BSD 2-clause license. --- .../runtime/opengl/GLProcAddressResolver.java | 51 +++++++++++----------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java') diff --git a/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java index 914e52792..fe9efebc7 100644 --- a/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java +++ b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java @@ -1,30 +1,31 @@ -/* - * Copyright (c) 2010, Michael Bien - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of JogAmp nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. +/** + * Copyright 2010 JogAmp Community. All rights reserved. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Michael Bien BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. */ - + /* * Created on Saturday, April 24 2010 16:44 */ -- cgit v1.2.3