diff options
| author | Jack Palevich <jackpal@google.com> | 2009-12-08 15:43:51 +0800 |
|---|---|---|
| committer | Jack Palevich <jackpal@google.com> | 2009-12-09 16:34:46 +0800 |
| commit | 981ccfbbfd737e2bdf0cedec0089975f91fd4e0a (patch) | |
| tree | 1625a7d2cc71a5f8e86f0dc575069e030c8ac0e3 /opengl/tools/glgen/src/JniCodeEmitter.java | |
| parent | aa396b9610f339cf280159144fbea47506f060e7 (diff) | |
| download | frameworks_base-981ccfbbfd737e2bdf0cedec0089975f91fd4e0a.zip frameworks_base-981ccfbbfd737e2bdf0cedec0089975f91fd4e0a.tar.gz frameworks_base-981ccfbbfd737e2bdf0cedec0089975f91fd4e0a.tar.bz2 | |
Implement Matrix Palette extension.
Adds support for formerly-unimplemented methods:
glCurrentPaletteMatrixOES
glLoadPaletteFromModelViewMatrixOES
glMatrixIndexPointerOES
glWeightPointerOES
The bulk of the changes are related to implementing the two PointerOES
methods, which are implemented pretty much the same way as the existing
Pointer methods were implemented.
This change also changes the way glPointSizePointerOES is implemented,
making it act like all the other Pointer methods. (Previously it was
not handling non-direct-buffer arguments correctly.)
Fixes bug 2308625 "Support matrix palette skinning
in JSR239 and related APIs"
Also updated GLLogWraper to fix two bugs in GLLogWrapper that were
discovered while testing matrix palette skinning support:
a) Handle trying to print the contents of null-but-enabled buffers.
(It's not legal to draw with null-but-enabled buffers, and
in fact some OpenGL drivers will crash if you try to render in this
state, but there's no reason the GLLogWrapper should crash while trying
to debug this situation.
b) Don't read off the end of a vertex buffer with non-zero position when
printing the entire contents of the vertex buffer. Now we only print from
the current position to the end of the buffer.
Diffstat (limited to 'opengl/tools/glgen/src/JniCodeEmitter.java')
| -rw-r--r-- | opengl/tools/glgen/src/JniCodeEmitter.java | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index 4c1814a..e79170a 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -119,10 +119,15 @@ public class JniCodeEmitter { emitFunction(jfunc, out, false, false); } + boolean isPointerFunc(JFunc jfunc) { + String name = jfunc.getName(); + return (name.endsWith("Pointer") || name.endsWith("PointerOES")) + && jfunc.getCFunc().hasPointerArg(); + } + void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) { boolean isVoid = jfunc.getType().isVoid(); - boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); if (!isVoid) { out.println(iii + @@ -406,9 +411,7 @@ public class JniCodeEmitter { * if !interfaceDecl: public <returntype> func(args) { body } */ void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) { - boolean isPointerFunc = - jfunc.getName().endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); if (!nativeDecl && !interfaceDecl && !isPointerFunc) { // If it's not a pointer function, we've already emitted it @@ -510,6 +513,34 @@ public class JniCodeEmitter { out.println(iii + " (stride >= 0)) {"); out.println(iii + indent + "_vertexPointer = pointer;"); out.println(iii + "}"); + } else if (fname.equals("glPointSizePointerOES")) { + out.println(iii + "if (((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_pointSizePointerOES = pointer;"); + out.println(iii + "}"); + } else if (fname.equals("glMatrixIndexPointerOES")) { + out.println(iii + "if (((size == 2) ||"); + out.println(iii + " (size == 3) ||"); + out.println(iii + " (size == 4)) &&"); + out.println(iii + " ((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_BYTE) ||"); + out.println(iii + " (type == GL_SHORT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_matrixIndexPointerOES = pointer;"); + out.println(iii + "}"); + } else if (fname.equals("glWeightPointer")) { + out.println(iii + "if (((size == 2) ||"); + out.println(iii + " (size == 3) ||"); + out.println(iii + " (size == 4)) &&"); + out.println(iii + " ((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_BYTE) ||"); + out.println(iii + " (type == GL_SHORT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_weightPointerOES = pointer;"); + out.println(iii + "}"); } } @@ -609,9 +640,9 @@ public class JniCodeEmitter { // String outName = "android_" + jfunc.getName(); - boolean isPointerFunc = outName.endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); boolean isVBOPointerFunc = (outName.endsWith("Pointer") || + outName.endsWith("PointerOES") || outName.endsWith("DrawElements")) && !jfunc.getCFunc().hasPointerArg(); if (isPointerFunc) { |
