summaryrefslogtreecommitdiffstats
path: root/opengl/libs/tools
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-04-23 18:05:44 -0700
committerMathias Agopian <mathias@google.com>2009-04-23 18:05:44 -0700
commitb519abb606c819c446a408f422530268b21a100b (patch)
tree37c78c0040545fc90abc8823c2ac0cda87c1fe5e /opengl/libs/tools
parente1e08acf4135f24281f49aa83bdd705bb0d64f23 (diff)
downloadframeworks_native-b519abb606c819c446a408f422530268b21a100b.zip
frameworks_native-b519abb606c819c446a408f422530268b21a100b.tar.gz
frameworks_native-b519abb606c819c446a408f422530268b21a100b.tar.bz2
use gl.h to generate the *.in files. we are now supporting the full gl.h and glext.h apis.
Diffstat (limited to 'opengl/libs/tools')
-rwxr-xr-xopengl/libs/tools/genfiles20
-rwxr-xr-xopengl/libs/tools/glapigen57
-rwxr-xr-xopengl/libs/tools/glentrygen31
3 files changed, 83 insertions, 25 deletions
diff --git a/opengl/libs/tools/genfiles b/opengl/libs/tools/genfiles
new file mode 100755
index 0000000..107768b
--- /dev/null
+++ b/opengl/libs/tools/genfiles
@@ -0,0 +1,20 @@
+#! /bin/sh
+#
+# Copyright (C) 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+./glapigen ../../include/GLES/gl.h > ../GLES_CM/gl_api.in
+./glentrygen ../../include/GLES/gl.h > ../gl_entries.in
+./glapigen ../../include/GLES/glext.h > ../GLES_CM/glext_api.in
+./glentrygen ../../include/GLES/glext.h > ../glext_entries.in
diff --git a/opengl/libs/tools/glapigen b/opengl/libs/tools/glapigen
index 86506a8..a2c3a7b 100755
--- a/opengl/libs/tools/glapigen
+++ b/opengl/libs/tools/glapigen
@@ -16,50 +16,57 @@
use strict;
-my $lineNum = 0;
while (my $line = <>) {
- $lineNum += 1;
next if $line =~ /^\//;
next if $line =~ /^#/;
next if $line =~ /^\s*$/;
- if ($line !~ /^GL_ENTRY\(([^,]+),\s*([^,]+),\s*([^)]+)\)/) {
- printf STDERR "Cannot parse line number $lineNum:\n$line";
+ if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
next;
}
my $type = $1;
my $name = $2;
my $args = $3;
- printf("%s API_ENTRY(%s)(", $type, $name);
- my @args = split ',', $args;
-
- my $len = scalar(@args);
- for (my $num = 0; $num < $len; $num++) {
- print ", " if $num > 0;
- my $arg = $args[$num];
- if ($arg =~ /([^]]+)(\[[^]]\])/) {
- my $argtype = $1;
- my $array = $2;
- printf("%s arg%d%s", $argtype, $num, $array);
- } else {
- if ($arg eq "void") {
- printf("void");
- } else {
- printf("%s arg%d", $arg, $num);
- }
- }
+ #printf("%s", $line);
+
+ my $prefix = "";
+ if ($name eq "glEGLImageTargetTexture2DOES") {
+ $prefix = "__";
}
- printf(") {\n");
+ if ($name eq "glEGLImageTargetRenderbufferStorageOES") {
+ $prefix = "__";
+ }
+
+ printf("%s API_ENTRY(%s%s)(%s)", $type, $prefix, $name, $args);
+
+ printf(" {\n");
if ($type eq "void") {
printf(" CALL_GL_API(%s", $name);
} else {
printf(" CALL_GL_API_RETURN(%s", $name);
}
+ my @args = split ',', $args;
+ my $len = scalar(@args);
for (my $num = 0; $num < $len; $num++) {
if ($args[$num] ne "void") {
print ", ";
- printf("arg%d", $num);
+ #
+ # extract the name from the parameter
+ # type name
+ # const type *name
+ # type *name
+ # type name[4]
+ #
+ if ($args[$num] =~ /(\S+\s)+\**\s*([\w]+)/) {
+ printf("%s", $2);
+ }
}
}
- printf(");\n}\n\n");
+ printf(");\n");
+ printf("}\n");
}
+
+
+
+
+
diff --git a/opengl/libs/tools/glentrygen b/opengl/libs/tools/glentrygen
new file mode 100755
index 0000000..5e0f7b6
--- /dev/null
+++ b/opengl/libs/tools/glentrygen
@@ -0,0 +1,31 @@
+#! /usr/bin/perl
+#
+# Copyright (C) 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+
+while (my $line = <>) {
+ next if $line =~ /^\//;
+ next if $line =~ /^#/;
+ next if $line =~ /^\s*$/;
+ if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
+ next;
+ }
+ my $type = $1;
+ my $name = $2;
+ my $args = $3;
+
+ printf("GL_ENTRY(%s, %s, %s)\n", $type, $name, $args);
+}