aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/gluegen/JavaEmitter.java
diff options
context:
space:
mode:
authorTravis Bryson <[email protected]>2005-08-23 00:34:32 +0000
committerTravis Bryson <[email protected]>2005-08-23 00:34:32 +0000
commit6b9841f75655fabd491f7410643272d36eddc77e (patch)
tree70dbc4ef0d81aa765164fe9b3f381abc46fd6d80 /src/net/java/games/gluegen/JavaEmitter.java
parent7197a255a1688551a4861ca221233956b8fd21c0 (diff)
This putback may break Windows/Mac build temporarily for a few hours
until we synchronize with builds on all of our target platforms as we are rushing this a bit so that we can properly reorganize the workspace shortly, and with such fundamental changes, this is considered a "risky" putback. So advising to hold off on bringover a few hours for non-X11 targets. This is the majority of changes required for Native I/O IndirectBuffer support for JSR 231. The changes are not yet complete, and Indirect Buffers (buffers backed by an array) should not yet be used (although what is being putback here has been tested and is working). IndirectBuffer support is being added in JSR 231 since this will be the method often used to send down arrays to the public API, by "wrapping" them, enabling us to eliminate many of the API "explosions" that happen in the older, JOGL approach, enabling the number of public APIs in JSR 231 to be greatly reduced, and map more cleanly to native OpenGL. Soon we will be removing the old API explosions and Indirect Buffers will be the only way to send down an array to many APIs, but at this point there are no public API changes putback for this. We will be providing code samples. The changes to any program source code are *very* straightforward. Offsets into Native I/O buffers and offsets within the arrays that back them are also supported. We will also provide code examples for this. So, for example, you do not need to rewrap an array when you want to send down its elements but starting at somewhere besides the zeroth index. This putback adds the support for all methods not accessed internally by function pointers (dispatch methods in the expanded code). The support for function pointers (mostly APIs that were later additions to OpenGL, mostly things that are or originally were extensions) will come in a subsequent putback. The native code for the dispatch methods is mostly generated, however (just never called currently). The Java part for dispatch methods is not complete yet, and is not yet generated. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@352 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/gluegen/JavaEmitter.java')
-rw-r--r--src/net/java/games/gluegen/JavaEmitter.java45
1 files changed, 40 insertions, 5 deletions
diff --git a/src/net/java/games/gluegen/JavaEmitter.java b/src/net/java/games/gluegen/JavaEmitter.java
index 1203bd1fb..dad954db2 100644
--- a/src/net/java/games/gluegen/JavaEmitter.java
+++ b/src/net/java/games/gluegen/JavaEmitter.java
@@ -351,7 +351,8 @@ public class JavaEmitter implements GlueEmitter {
// the binding like any normal binding because no special binding
// generation (wrapper methods, etc) will be necessary.
MethodBinding specialBinding = binding.createNIOBufferVariant();
-
+
+
if (cfg.allStatic() && binding.hasContainingType()) {
// This should not currently happen since structs are emitted using a different mechanism
throw new IllegalArgumentException("Cannot create binding in AllStatic mode because method has containing type: \"" +
@@ -359,7 +360,8 @@ public class JavaEmitter implements GlueEmitter {
}
boolean isUnimplemented = cfg.isUnimplemented(binding.getName());
-
+ JavaMethodBindingImplEmitter entryPoint=null;
+
if (cfg.emitImpl()) {
// Generate the emitter for the method which may do conversion
// from type wrappers to NIO Buffers or which may call the
@@ -371,8 +373,7 @@ public class JavaEmitter implements GlueEmitter {
arrayImplMethod = true;
}
- JavaMethodBindingImplEmitter entryPoint =
- new JavaMethodBindingImplEmitter(binding,
+ entryPoint = new JavaMethodBindingImplEmitter(binding,
(cfg.allStatic() ? javaWriter() : javaImplWriter()),
cfg.runtimeExceptionType(),
isUnimplemented,
@@ -419,8 +420,24 @@ public class JavaEmitter implements GlueEmitter {
wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.STATIC); // Doesn't really matter
wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.NATIVE);
allEmitters.add(wrappedEntryPoint);
+
+ String bindingName = specialBinding.getName();
+ if(binding != specialBinding && bindingName.contains("gl") && !bindingName.contains("glX")
+ && !bindingName.contains("wgl") && !bindingName.contains("CGL")) {
+ JavaMethodBindingEmitter wrappedEntryPoint2 =
+ new JavaMethodBindingEmitter(specialBinding, output, cfg.runtimeExceptionType(),
+ true, arrayImplMethod);
+ wrappedEntryPoint2.addModifier(JavaMethodBindingEmitter.PRIVATE);
+ wrappedEntryPoint2.addModifier(JavaMethodBindingEmitter.STATIC); // Doesn't really matter
+ wrappedEntryPoint2.addModifier(JavaMethodBindingEmitter.NATIVE);
+
+ entryPoint.setGenerateIndirectBufferInterface(true);
+ wrappedEntryPoint2.setIndirectBufferInterface(true);
+ allEmitters.add(wrappedEntryPoint2);
+ }
+
}
-
+
CMethodBindingEmitter cEmitter =
makeCEmitter(specialBinding,
overloaded,
@@ -429,6 +446,23 @@ public class JavaEmitter implements GlueEmitter {
cfg.implPackageName(), cfg.implClassName(),
cWriter());
allEmitters.add(cEmitter);
+
+ String bindingName = specialBinding.getName();
+ if(binding != specialBinding && bindingName.contains("gl") && !bindingName.contains("glX")
+ && !bindingName.contains("wgl") && !bindingName.contains("CGL") ) {
+
+ CMethodBindingEmitter cEmitter2 =
+ makeCEmitter(specialBinding,
+ //overloaded,
+ true,
+ true,
+ arrayImplMethod,
+ cfg.implPackageName(), cfg.implClassName(),
+ cWriter());
+ cEmitter2.setIndirectBufferInterface(true);
+ allEmitters.add(cEmitter2);
+ }
+
}
}
} // end iteration over expanded bindings
@@ -1351,6 +1385,7 @@ public class JavaEmitter implements GlueEmitter {
}
}
+
// NIO variants for non-void* C primitive pointer types
if ((cfg.nioMode() == JavaConfiguration.NIO_MODE_ALL_POINTERS &&
!cfg.noNio(mb.getCSymbol().getName())) ||