summaryrefslogtreecommitdiffstats
path: root/opengl/libs/tools
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-04-22 18:24:18 -0700
committerMathias Agopian <mathias@google.com>2009-04-23 13:45:48 -0700
commite29254e708bb94d0f785a00926164a0dbb0dad93 (patch)
tree65c92fe2698810d6d88877230d3c2e25f4f53e61 /opengl/libs/tools
parent644cf62660c87a9b8d5bcb22412cc2ad2aeea291 (diff)
downloadframeworks_base-e29254e708bb94d0f785a00926164a0dbb0dad93.zip
frameworks_base-e29254e708bb94d0f785a00926164a0dbb0dad93.tar.gz
frameworks_base-e29254e708bb94d0f785a00926164a0dbb0dad93.tar.bz2
integrate some OpenGL ES changes back from master_gl in preparation of opening GLES to the NDK.
Diffstat (limited to 'opengl/libs/tools')
-rwxr-xr-xopengl/libs/tools/glapigen65
1 files changed, 65 insertions, 0 deletions
diff --git a/opengl/libs/tools/glapigen b/opengl/libs/tools/glapigen
new file mode 100755
index 0000000..86506a8
--- /dev/null
+++ b/opengl/libs/tools/glapigen
@@ -0,0 +1,65 @@
+#! /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;
+
+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";
+ 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(") {\n");
+ if ($type eq "void") {
+ printf(" CALL_GL_API(%s", $name);
+ } else {
+ printf(" CALL_GL_API_RETURN(%s", $name);
+ }
+ for (my $num = 0; $num < $len; $num++) {
+ if ($args[$num] ne "void") {
+ print ", ";
+ printf("arg%d", $num);
+ }
+ }
+ printf(");\n}\n\n");
+}