JOGL: src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java Source File

JOGL v2.6.0 JOGL, High-Performance Graphics Binding for Java™ (public API).

GLEmitter.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2023 JogAmp Community. All rights reserved.
3 * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * - Redistribution of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistribution in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of Sun Microsystems, Inc. or the names of
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * This software is provided "AS IS," without a warranty of any kind. ALL
21 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
22 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
23 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
24 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
25 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
26 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
27 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
28 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
29 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
30 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
31 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * You acknowledge that this software is not designed or intended for use
34 * in the design, construction, operation or maintenance of any nuclear
35 * facility.
36 *
37 * Sun gratefully acknowledges that this software was originally authored
38 * and developed by Kenneth Bradley Russell and Christopher John Kline.
39 */
40package com.jogamp.gluegen.opengl;
41
42import static java.util.logging.Level.INFO;
43
44import com.jogamp.gluegen.ConstantDefinition;
45import com.jogamp.gluegen.FunctionEmitter;
46import com.jogamp.gluegen.GlueEmitterControls;
47import com.jogamp.gluegen.GlueGen;
48import com.jogamp.gluegen.JavaCodeUnit;
49import com.jogamp.gluegen.JavaConfiguration;
50import com.jogamp.gluegen.JavaEmitter;
51import com.jogamp.gluegen.JavaMethodBindingEmitter;
52import com.jogamp.gluegen.JavaType;
53import com.jogamp.gluegen.MethodBinding;
54import com.jogamp.gluegen.SymbolFilter;
55import com.jogamp.gluegen.cgram.types.FunctionSymbol;
56import com.jogamp.gluegen.cgram.types.Type;
57import com.jogamp.gluegen.procaddress.ProcAddressEmitter;
58import com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter;
59import com.jogamp.gluegen.runtime.opengl.GLNameResolver;
60
61import java.io.IOException;
62import java.util.ArrayList;
63import java.util.IdentityHashMap;
64import java.util.Iterator;
65import java.util.LinkedHashMap;
66import java.util.List;
67import java.util.Map;
68import java.util.Set;
69
70/**
71 * A subclass of ProcAddressEmitter with special OpenGL-specific
72 * configuration abilities.
73 */
74 public class GLEmitter extends ProcAddressEmitter {
75
76 // Keeps track of which MethodBindings were created for handling
77 // Buffer Object variants. Used as a Set rather than a Map.
78 private final Map<MethodBinding, MethodBinding> bufferObjectMethodBindings = new IdentityHashMap<MethodBinding, MethodBinding>();
79
80 enum BufferObjectKind { UNPACK_PIXEL, PACK_PIXEL, ARRAY, ELEMENT, INDIRECT}
81
82 @Override
83 public void beginEmission(final GlueEmitterControls controls) throws IOException {
84 getGLConfig().parseGLSemHeaders(controls);
85 if( null == getGLConfig().getGLSemInfo() ) {
86 throw new RuntimeException("No 'GLSemHeader' defined.");
87 }
88 getGLConfig().parseGLDocHeaders(controls);
89 if( null == getGLConfig().getGLDocInfo() ) {
90 throw new InternalError("XXX"); // since GLDocHeader contains all GLSemHeader ..
91 }
92 renameExtensionsIntoCore();
93 if ( getGLConfig().getAutoUnifyExtensions() ) {
94 unifyExtensions(controls);
95 }
96 super.beginEmission(controls);
97 }
98
99 protected void renameExtensionsIntoCore() {
100 final GLConfiguration config = getGLConfig();
101 renameExtensionsIntoCore(config, config.getGLSemInfo(), true);
102 renameExtensionsIntoCore(config, config.getGLDocInfo(), false);
103 }
104 protected void renameExtensionsIntoCore(final GLConfiguration config, final BuildStaticGLInfo glInfo, final boolean isSemHeader) {
105 // This method handles renaming of entire extensions into the
106 // OpenGL core namespace. For example, it is used to move certain
107 // OpenGL ES (OES) extensions into the core namespace which are
108 // already in the core namespace in desktop OpenGL. It builds upon
109 // renaming mechanisms that are built elsewhere.
110
111 final String headerType = isSemHeader ? "GLSemHeader" : "GLDocHeader";
112 final Set<String> extensionSet = isSemHeader ? config.getExtensionsRenamedIntoCore() : glInfo.getExtensions();
113
114 for (final String extension : extensionSet) {
115 if( isSemHeader && config.isIgnoredExtension(extension) ) {
116 LOG.log(INFO, "<RenameExtensionIntoCore: {0} IGNORED {1}>", extension, headerType);
117 } else {
118 LOG.log(INFO, "<RenameExtensionIntoCore: {0} BEGIN {1}", extension, headerType);
119 final Set<String> declarations = glInfo.getDeclarations(extension);
120 if (declarations != null) {
121 for (final Iterator<String> iterator = declarations.iterator(); iterator.hasNext();) {
122 final String decl = iterator.next();
123 final boolean isGLFunction = GLNameResolver.isGLFunction(decl);
124 boolean isGLEnumeration = false;
125 if (!isGLFunction) {
126 isGLEnumeration = GLNameResolver.isGLEnumeration(decl);
127 }
128 if (isGLFunction || isGLEnumeration) {
129 final String renamed = GLNameResolver.normalize(decl, isGLFunction);
130 if (!renamed.equals(decl)) {
131 if( isSemHeader ) {
132 // Sem + Doc
133 config.addJavaSymbolRename(decl, renamed);
134 } else {
135 // Doc only
136 config.addJavaDocSymbolRename(decl, renamed);
137 }
138 }
139 }
140 }
141 }
142 LOG.log(INFO, "RenameExtensionIntoCore: {0} END>", extension, headerType);
143 }
144 }
145 }
146
147 class ExtensionUnifier implements SymbolFilter {
148
149 private List<ConstantDefinition> constants;
150 private List<FunctionSymbol> functions;
151
152 @Override
153 public List<ConstantDefinition> getConstants() {
154 return constants;
155 }
156 @Override
157 public List<FunctionSymbol> getFunctions() {
158 return functions;
159 }
160
161 @Override
162 public void filterSymbols(final List<ConstantDefinition> inConstList,
163 final List<FunctionSymbol> inFuncList) {
164 final BuildStaticGLInfo glInfo = getGLConfig().getGLSemInfo();
165 if (glInfo == null) {
166 return;
167 }
168 // Try to retain a "good" ordering for these symbols
169 final Map<String, ConstantDefinition> constantMap = new LinkedHashMap<String, ConstantDefinition>();
170 for (final ConstantDefinition def : inConstList) {
171 constantMap.put(def.getName(), def);
172 }
173 final Map<String, FunctionSymbol> functionMap = new LinkedHashMap<String, FunctionSymbol>();
174 for (final FunctionSymbol sym : inFuncList) {
175 functionMap.put(sym.getName(), sym);
176 }
177
178 // Go through all of the declared extensions.
179 // For each extension, look at its #define and function symbols.
180 // If we find all of the extension's symbols in the core API under
181 // non-ARB (or whatever is the suffix) names, then remove this extension
182 // from the public API. If it turns out that we are running on hardware
183 // that doesn't support the core version of these APIs, the runtime
184 // will take care of looking up the extension version of these entry
185 // points.
186 final Set<String> extensionNames = glInfo.getExtensions();
187
188 for (final String extension : extensionNames) {
189 final Set<String> declarations = glInfo.getDeclarations(extension);
190 boolean isExtension = true;
191 boolean shouldUnify = true;
192 String cause = null;
193 for (final String decl : declarations) {
194 final boolean isFunc = !decl.startsWith("GL_");
195 if (!GLNameResolver.isExtension(decl, isFunc)) {
196 isExtension = false;
197 break;
198 }
199 // See whether we're emitting glue code for this
200 // entry point or definition at all
201 if (isFunc) {
202 if (!functionMap.containsKey(decl)) {
203 isExtension = false;
204 break;
205 }
206 } else {
207 if (!constantMap.containsKey(decl)) {
208 isExtension = false;
209 break;
210 }
211 }
212 cause = decl;
213 final String unifiedName = GLNameResolver.normalize(decl, isFunc);
214 // NOTE that we look up the unified name in the
215 // BuildStaticGLInfo's notion of the APIs -- since
216 // we might not be emitting glue code for the
217 // headers that actually contain the core entry
218 // point. Think of the case where we are parsing the
219 // GLES2 gl2.h, which contains certain desktop
220 // OpenGL extensions that have been moved into the
221 // core, but later generating the implementing glue
222 // code (not the interface) for the desktop gl.h /
223 // glext.h.
224 shouldUnify = (glInfo.getExtension(unifiedName) != null);
225 // if (isFunc) {
226 // shouldUnify = functionMap.containsKey(unifiedName);
227 // } else {
228 // shouldUnify = constantMap.containsKey(unifiedName);
229 // }
230 if (!shouldUnify) {
231 break;
232 }
233 }
234 if (isExtension) {
235 if (shouldUnify) {
236 for (final String decl : declarations) {
237 final boolean isFunc = !decl.startsWith("GL_");
238 if (isFunc) {
239 functionMap.remove(decl);
240 } else {
241 constantMap.remove(decl);
242 }
243 }
244 System.err.println("INFO: unified extension " + extension + " into core API");
245 } else {
246 System.err.println("INFO: didn't unify extension " + extension + " into core API because of " + cause);
247 }
248 }
249 }
250 constants = new ArrayList<ConstantDefinition>(constantMap.values());
251 functions = new ArrayList<FunctionSymbol>(functionMap.values());
252 }
253 }
254
255 private void unifyExtensions(final GlueEmitterControls controls) {
256 controls.runSymbolFilter(new ExtensionUnifier());
257 }
258
259 @Override
260 protected JavaConfiguration createConfig() {
261 return new GLConfiguration(this);
262 }
263
264 /**
265 * {@inheritDoc}
266 * <p>
267 * Implementation sets the binding's native name to it's interface name,
268 * which is the final aliased shortest name.
269 * The latter is used for the proc-address-table etc ..
270 * </p>
271 */
272 @Override
273 protected void mangleBinding(final MethodBinding binding) {
274 binding.setNativeName(binding.getInterfaceName());
275 super.mangleBinding(binding);
276 }
277
278 /** In order to implement Buffer Object variants of certain
279 functions we generate another MethodBinding which maps the void*
280 argument to a Java long. The generation of emitters then takes
281 place as usual. We do however need to keep track of the modified
282 MethodBinding object so that we can also modify the emitters
283 later to inform them that their argument has changed. We might
284 want to push this functionality down into the MethodBinding
285 (i.e., mutators for argument names). We also would need to
286 inform the CMethodBindingEmitter that it is overloaded in this
287 case (though we default to true currently). */
288 @Override
289 protected List<MethodBinding> expandMethodBinding(final MethodBinding binding) {
290 final GLConfiguration glConfig = getGLConfig();
291 final List<MethodBinding> bindings = super.expandMethodBinding(binding);
292
293 if ( !glConfig.isBufferObjectFunction(binding.getCSymbol()) ) {
294 return bindings;
295 }
296 final boolean bufferObjectOnly = glConfig.isBufferObjectOnly(binding.getName());
297
298 final List<MethodBinding> newBindings = new ArrayList<MethodBinding>();
299
300 // Need to expand each one of the generated bindings to take a
301 // Java long instead of a Buffer for each void* argument
302 if( GlueGen.debug() ) {
303 System.err.println("expandMethodBinding: j "+binding.toString());
304 System.err.println("expandMethodBinding: c "+binding.getCSymbol());
305 }
306
307 // for (MethodBinding cur : bindings) {
308 int j=0;
309 while( j < bindings.size() ) {
310 final MethodBinding cur = bindings.get(j);
311
312 // Some of these routines (glBitmap) take strongly-typed
313 // primitive pointers as arguments which are expanded into
314 // non-void* arguments
315 // This test (rather than !signatureUsesNIO) is used to catch
316 // more unexpected situations
317 if (cur.signatureUsesJavaPrimitiveArrays()) {
318 j++;
319 continue;
320 }
321
322 MethodBinding result = cur;
323 int replacedCount = 0;
324 for (int i = 0; i < cur.getNumArguments(); i++) {
325 final JavaType jt = cur.getJavaArgumentType(i);
326 if( jt.isOpaqued() ) {
327 replacedCount++; // already replaced, i.e. due to opaque
328 } else if ( jt.isNIOBuffer() ) {
329 result = result.replaceJavaArgumentType(i, JavaType.createForClass(Long.TYPE));
330 replacedCount++;
331 }
332 if( GlueGen.debug() ) {
333 final Type ct = cur.getCArgumentType(i);
334 System.err.println(" ["+i+"]: #"+replacedCount+", "+ct.getDebugString()+", "+jt.getDebugString());
335 }
336 }
337
338 if ( 0 == replacedCount ) {
339 throw new RuntimeException("Error: didn't find any void* arguments for BufferObject function "
340 + binding.toString());
341 }
342
343 // Now need to flag this MethodBinding so that we generate the
344 // correct flags in the emitters later
345 bufferObjectMethodBindings.put(result, result);
346
347 if( result != cur ) {
348 // replaced
349 newBindings.add(result);
350 if( bufferObjectOnly ) {
351 bindings.remove(j);
352 } else {
353 j++;
354 }
355 } else {
356 j++;
357 }
358 }
359 bindings.addAll(newBindings);
360
361 return bindings;
362 }
363
364 @Override
365 protected boolean needsModifiedEmitters(final FunctionSymbol sym) {
366 if ( ( !callThroughProcAddress(sym) && !needsBufferObjectVariant(sym) ) ||
367 getConfig().isUnimplemented(sym)
368 )
369 {
370 return false;
371 } else {
372 return true;
373 }
374 }
375
376 public boolean isBufferObjectMethodBinding(final MethodBinding binding) {
377 return bufferObjectMethodBindings.containsKey(binding);
378 }
379
380 @Override
381 public void emitDefine(final ConstantDefinition def, final String optionalComment) throws Exception {
382 final String symbolRenamed = def.getName();
383 final StringBuilder newComment = new StringBuilder();
384 if (0 == addExtensionsOfSymbols2Doc(newComment, ", ", ", ", symbolRenamed)) {
385 if (def.isEnum()) {
386 final String enumName = def.getEnumName();
387 if (null == enumName) {
388 newComment.append("Part of CORE ");
389 newComment.append("ENUM");
390 }
391 } else {
392 if (getGLConfig().getAllowNonGLExtensions()) {
393 newComment.append("Part of CORE ");
394 newComment.append("DEF");
395 } else {
396 // Note: All GL defines must be contained within an extension marker !
397 // #ifndef GL_EXT_lala
398 // #define GL_EXT_lala 1
399 // ...
400 // #endif
401 final StringBuilder sb = new StringBuilder();
402 JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames());
403 LOG.log(INFO, def.getASTLocusTag(), "Dropping marker: {0}", sb.toString());
404 return;
405 }
406 }
407 }
408 if (null != optionalComment) {
409 if( newComment.length() > 0 ) {
410 newComment.append("<br>");
411 }
412 newComment.append(optionalComment);
413 }
414
415 super.emitDefine(def, newComment.toString());
416 }
417
418 private int addExtensionListOfSymbol2Doc(final BuildStaticGLInfo glDocInfo, final StringBuilder buf, final String sep1, final String name) {
419 int num = 0;
420 final Set<String> extensionNames = glDocInfo.getExtension(name);
421 if(null!=extensionNames) {
422 for(final Iterator<String> i=extensionNames.iterator(); i.hasNext(); ) {
423 final String extensionName = i.next();
424 if (null != extensionName) {
425 buf.append("<code>");
426 buf.append(extensionName);
427 buf.append("</code>");
428 if (i.hasNext()) {
429 buf.append(sep1); // same-name seperator
430 }
431 num++;
432 }
433 }
434 }
435 return num;
436 }
437 private int addExtensionListOfAliasedSymbols2Doc(final BuildStaticGLInfo glDocInfo, final StringBuilder buf, final String sep1, final String sep2, final String name) {
438 int num = 0;
439 if(null != name) {
440 num += addExtensionListOfSymbol2Doc(glDocInfo, buf, sep1, name); // extensions of given name
441 boolean needsSep2 = num > 0;
442 final Set<String> aliases = ((GLConfiguration)cfg).getRenamedJavaDocSymbols(name);
443 if(null != aliases) {
444 for(final String alias : aliases) {
445 if (needsSep2) {
446 buf.append(sep2);
447 }
448 final int num2 = addExtensionListOfSymbol2Doc(glDocInfo, buf, sep1, alias); // extensions of orig-name
449 needsSep2 = num2 > 0;
450 num += num2;
451 }
452 }
453 }
454 return num;
455 }
456
457 public int addExtensionsOfSymbols2Doc(StringBuilder buf, final String sep1, final String sep2, final String first) {
458 final BuildStaticGLInfo glDocInfo = getGLConfig().getGLDocInfo();
459 if (null == glDocInfo) {
460 throw new RuntimeException("No GLDocInfo for: " + first);
461 }
462 if (null == buf) {
463 buf = new StringBuilder();
464 }
465 return addExtensionListOfAliasedSymbols2Doc(glDocInfo, buf, sep1, sep2, first);
466 }
467
468 //----------------------------------------------------------------------
469 // Internals only below this point
470 //
471 @Override
472 protected void generateModifiedEmitters(final JavaMethodBindingEmitter baseJavaEmitter, final List<FunctionEmitter> emitters) {
473 final List<FunctionEmitter> superEmitters = new ArrayList<FunctionEmitter>();
474 super.generateModifiedEmitters(baseJavaEmitter, superEmitters);
475
476 // See whether this is one of the Buffer Object variants
477 final boolean bufferObjectVariant = bufferObjectMethodBindings.containsKey(baseJavaEmitter.getBinding());
478
479 for (FunctionEmitter emitter : superEmitters) {
480 if (emitter instanceof ProcAddressJavaMethodBindingEmitter) {
481 emitter = new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, this, bufferObjectVariant);
482 }
483 emitters.add(emitter);
484 }
485 }
486
487 protected boolean needsBufferObjectVariant(final FunctionSymbol sym) {
488 return getGLConfig().isBufferObjectFunction(sym);
489 }
490
491 protected GLConfiguration getGLConfig() {
492 return (GLConfiguration) getConfig();
493 }
494
495 /**
496 * {@inheritDoc}
497 */
498 @Override
499 protected void endProcAddressTable() throws Exception {
500 final JavaCodeUnit u = tableJavaUnit;
501
502 u.emitln(" @Override");
503 u.emitln(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {");
504 u.emitln(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
505 u.emitln(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
506 u.emitln(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
507 u.emitln(" final java.lang.reflect.Field addressField = com.jogamp.common.util.SecurityUtil.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
508 u.emitln(" public final java.lang.reflect.Field run() {");
509 u.emitln(" java.lang.reflect.Field addressField = null;");
510 u.emitln(" for(int i = 0; i < funcNamePermNum; i++) {");
511 u.emitln(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
512 u.emitln(" try {");
513 u.emitln(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
514 u.emitln(" addressField.setAccessible(true); // we need to read the protected value!");
515 u.emitln(" return addressField;");
516 u.emitln(" } catch (NoSuchFieldException ex) { }");
517 u.emitln(" }");
518 u.emitln(" return null;");
519 u.emitln(" } } );");
520 u.emitln();
521 u.emitln(" if(null==addressField) {");
522 u.emitln(" // The user is calling a bogus function or one which is not");
523 u.emitln(" // runtime linked");
524 u.emitln(" throw new RuntimeException(");
525 u.emitln(" \"WARNING: Address field query failed for \\\"\" + functionNameBase + \"\\\"/\\\"\" + functionNameUsr +");
526 u.emitln(" \"\\\"; it's either statically linked or address field is not a known \" +");
527 u.emitln(" \"function\");");
528 u.emitln(" } ");
529 u.emitln(" try {");
530 u.emitln(" return 0 != addressField.getLong(this);");
531 u.emitln(" } catch (Exception e) {");
532 u.emitln(" throw new RuntimeException(");
533 u.emitln(" \"WARNING: Address query failed for \\\"\" + functionNameBase + \"\\\"/\\\"\" + functionNameUsr +");
534 u.emitln(" \"\\\"; it's either statically linked or is not a known \" +");
535 u.emitln(" \"function\", e);");
536 u.emitln(" }");
537 u.emitln(" }");
538
539 u.emitln(" @Override");
540 u.emitln(" public long getAddressFor(String functionNameUsr) throws SecurityException, IllegalArgumentException {");
541 u.emitln(" SecurityUtil.checkAllLinkPermission();");
542 u.emitln(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
543 u.emitln(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
544 u.emitln(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
545 u.emitln(" final java.lang.reflect.Field addressField = com.jogamp.common.util.SecurityUtil.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
546 u.emitln(" public final java.lang.reflect.Field run() {");
547 u.emitln(" java.lang.reflect.Field addressField = null;");
548 u.emitln(" for(int i = 0; i < funcNamePermNum; i++) {");
549 u.emitln(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
550 u.emitln(" try {");
551 u.emitln(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
552 u.emitln(" addressField.setAccessible(true); // we need to read the protected value!");
553 u.emitln(" return addressField;");
554 u.emitln(" } catch (NoSuchFieldException ex) { }");
555 u.emitln(" }");
556 u.emitln(" return null;");
557 u.emitln(" } } );");
558 u.emitln();
559 u.emitln(" if(null==addressField) {");
560 u.emitln(" // The user is calling a bogus function or one which is not");
561 u.emitln(" // runtime linked");
562 u.emitln(" throw new RuntimeException(");
563 u.emitln(" \"WARNING: Address field query failed for \\\"\" + functionNameBase + \"\\\"/\\\"\" + functionNameUsr +");
564 u.emitln(" \"\\\"; it's either statically linked or address field is not a known \" +");
565 u.emitln(" \"function\");");
566 u.emitln(" } ");
567 u.emitln(" try {");
568 u.emitln(" return addressField.getLong(this);");
569 u.emitln(" } catch (Exception e) {");
570 u.emitln(" throw new RuntimeException(");
571 u.emitln(" \"WARNING: Address query failed for \\\"\" + functionNameBase + \"\\\"/\\\"\" + functionNameUsr +");
572 u.emitln(" \"\\\"; it's either statically linked or is not a known \" +");
573 u.emitln(" \"function\", e);");
574 u.emitln(" }");
575 u.emitln(" }");
576
577 u.emitln("} // end of class " + tableClassName);
578 u.close();
579 }
580}
com.jogamp.gluegen.opengl.BuildStaticGLInfo
Builds the StaticGLInfo class from the OpenGL header files (i.e., gl.h and glext.h) whose paths were ...
Definition: BuildStaticGLInfo.java:106
com.jogamp.gluegen.opengl.BuildStaticGLInfo.getExtensions
Set< String > getExtensions()
Definition: BuildStaticGLInfo.java:288
com.jogamp.gluegen.opengl.BuildStaticGLInfo.getDeclarations
Set< String > getDeclarations(final String extension)
Definition: BuildStaticGLInfo.java:284
com.jogamp.gluegen.opengl.BuildStaticGLInfo.getExtension
Set< String > getExtension(final String identifier)
Definition: BuildStaticGLInfo.java:280
com.jogamp.gluegen.opengl.GLConfiguration
Definition: GLConfiguration.java:63
com.jogamp.gluegen.opengl.GLConfiguration.parseGLDocHeaders
void parseGLDocHeaders(final GlueEmitterControls controls)
Parses any GL headers specified in the configuration file for the purpose of being able to ignore an ...
Definition: GLConfiguration.java:449
com.jogamp.gluegen.opengl.GLConfiguration.getGLDocInfo
BuildStaticGLInfo getGLDocInfo()
Returns the information about the association between #defines, function symbols and the OpenGL exten...
Definition: GLConfiguration.java:478
com.jogamp.gluegen.opengl.GLConfiguration.isIgnoredExtension
boolean isIgnoredExtension(final String extensionName)
Definition: GLConfiguration.java:257
com.jogamp.gluegen.opengl.GLConfiguration.parseGLSemHeaders
void parseGLSemHeaders(final GlueEmitterControls controls)
Parses any GL headers specified in the configuration file for the purpose of being able to ignore an ...
Definition: GLConfiguration.java:417
com.jogamp.gluegen.opengl.GLConfiguration.isBufferObjectFunction
boolean isBufferObjectFunction(final AliasedSymbol symbol)
Definition: GLConfiguration.java:402
com.jogamp.gluegen.opengl.GLConfiguration.isBufferObjectOnly
boolean isBufferObjectOnly(final String name)
Definition: GLConfiguration.java:406
com.jogamp.gluegen.opengl.GLConfiguration.addJavaSymbolRename
void addJavaSymbolRename(final String origName, final String newName)
Definition: GLConfiguration.java:494
com.jogamp.gluegen.opengl.GLConfiguration.addJavaDocSymbolRename
void addJavaDocSymbolRename(final String origName, final String newName)
Adds a javadoc rename directive for the given symbol.
Definition: GLConfiguration.java:504
com.jogamp.gluegen.opengl.GLConfiguration.getExtensionsRenamedIntoCore
Set< String > getExtensionsRenamedIntoCore()
Returns the OpenGL extensions that should have all of their constant definitions and functions rename...
Definition: GLConfiguration.java:524
com.jogamp.gluegen.opengl.GLConfiguration.getGLSemInfo
BuildStaticGLInfo getGLSemInfo()
Returns the information about the association between #defines, function symbols and the OpenGL exten...
Definition: GLConfiguration.java:438
com.jogamp.gluegen.opengl.GLEmitter
A subclass of ProcAddressEmitter with special OpenGL-specific configuration abilities.
Definition: GLEmitter.java:74
com.jogamp.gluegen.opengl.GLEmitter.emitDefine
void emitDefine(final ConstantDefinition def, final String optionalComment)
Definition: GLEmitter.java:381
com.jogamp.gluegen.opengl.GLEmitter.needsBufferObjectVariant
boolean needsBufferObjectVariant(final FunctionSymbol sym)
Definition: GLEmitter.java:487
com.jogamp.gluegen.opengl.GLEmitter.expandMethodBinding
List< MethodBinding > expandMethodBinding(final MethodBinding binding)
In order to implement Buffer Object variants of certain functions we generate another MethodBinding w...
Definition: GLEmitter.java:289
com.jogamp.gluegen.opengl.GLEmitter.renameExtensionsIntoCore
void renameExtensionsIntoCore()
Definition: GLEmitter.java:99
com.jogamp.gluegen.opengl.GLEmitter.getGLConfig
GLConfiguration getGLConfig()
Definition: GLEmitter.java:491
com.jogamp.gluegen.opengl.GLEmitter.beginEmission
void beginEmission(final GlueEmitterControls controls)
Definition: GLEmitter.java:83
com.jogamp.gluegen.opengl.GLEmitter.createConfig
JavaConfiguration createConfig()
Definition: GLEmitter.java:260
com.jogamp.gluegen.opengl.GLEmitter.generateModifiedEmitters
void generateModifiedEmitters(final JavaMethodBindingEmitter baseJavaEmitter, final List< FunctionEmitter > emitters)
Definition: GLEmitter.java:472
com.jogamp.gluegen.opengl.GLEmitter.renameExtensionsIntoCore
void renameExtensionsIntoCore(final GLConfiguration config, final BuildStaticGLInfo glInfo, final boolean isSemHeader)
Definition: GLEmitter.java:104
com.jogamp.gluegen.opengl.GLEmitter.endProcAddressTable
void endProcAddressTable()
Definition: GLEmitter.java:499
com.jogamp.gluegen.opengl.GLEmitter.isBufferObjectMethodBinding
boolean isBufferObjectMethodBinding(final MethodBinding binding)
Definition: GLEmitter.java:376
com.jogamp.gluegen.opengl.GLEmitter.mangleBinding
void mangleBinding(final MethodBinding binding)
Definition: GLEmitter.java:273
com.jogamp.gluegen.opengl.GLEmitter.addExtensionsOfSymbols2Doc
int addExtensionsOfSymbols2Doc(StringBuilder buf, final String sep1, final String sep2, final String first)
Definition: GLEmitter.java:457
com.jogamp.gluegen.opengl.GLEmitter.needsModifiedEmitters
boolean needsModifiedEmitters(final FunctionSymbol sym)
Definition: GLEmitter.java:365
com.jogamp.gluegen.opengl.GLJavaMethodBindingEmitter
A specialization of the proc address emitter which knows how to change argument names to take into ac...
Definition: GLJavaMethodBindingEmitter.java:56
com.jogamp.gluegen.runtime.opengl.GLNameResolver
Runtime utility identify and resolve extension names, which may be subsumed to core.
Definition: GLNameResolver.java:41
com.jogamp.gluegen.runtime.opengl.GLNameResolver.isGLFunction
static final boolean isGLFunction(final String str)
Definition: GLNameResolver.java:78
com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalize
static final String normalize(final String[] extensions, String str, final boolean isGLFunc)
Definition: GLNameResolver.java:123
com.jogamp.gluegen.runtime.opengl.GLNameResolver.isGLEnumeration
static final boolean isGLEnumeration(final String str)
Definition: GLNameResolver.java:84