Merge "Dispatch screen state change events to Views Bug #6120957"
diff --git a/api/current.txt b/api/current.txt
index a18e4f8..dbbac96 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4761,6 +4761,7 @@
public class ClipData implements android.os.Parcelable {
ctor public ClipData(java.lang.CharSequence, java.lang.String[], android.content.ClipData.Item);
ctor public ClipData(android.content.ClipDescription, android.content.ClipData.Item);
+ ctor public ClipData(android.content.ClipData);
method public void addItem(android.content.ClipData.Item);
method public int describeContents();
method public android.content.ClipDescription getDescription();
@@ -5378,6 +5379,7 @@
method public java.lang.CharSequence[] getCharSequenceArrayExtra(java.lang.String);
method public java.util.ArrayList<java.lang.CharSequence> getCharSequenceArrayListExtra(java.lang.String);
method public java.lang.CharSequence getCharSequenceExtra(java.lang.String);
+ method public android.content.ClipData getClipData();
method public android.content.ComponentName getComponent();
method public android.net.Uri getData();
method public java.lang.String getDataString();
@@ -5461,6 +5463,7 @@
method public android.content.Intent setClass(android.content.Context, java.lang.Class<?>);
method public android.content.Intent setClassName(android.content.Context, java.lang.String);
method public android.content.Intent setClassName(java.lang.String, java.lang.String);
+ method public void setClipData(android.content.ClipData);
method public android.content.Intent setComponent(android.content.ComponentName);
method public android.content.Intent setData(android.net.Uri);
method public android.content.Intent setDataAndNormalize(android.net.Uri);
@@ -5646,6 +5649,7 @@
field public static final java.lang.String EXTRA_UID = "android.intent.extra.UID";
field public static final int FILL_IN_ACTION = 1; // 0x1
field public static final int FILL_IN_CATEGORIES = 4; // 0x4
+ field public static final int FILL_IN_CLIP_DATA = 128; // 0x80
field public static final int FILL_IN_COMPONENT = 8; // 0x8
field public static final int FILL_IN_DATA = 2; // 0x2
field public static final int FILL_IN_PACKAGE = 16; // 0x10
diff --git a/cmds/surfaceflinger/Android.mk b/cmds/surfaceflinger/Android.mk
deleted file mode 100644
index 1df32bb..0000000
--- a/cmds/surfaceflinger/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- main_surfaceflinger.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libsurfaceflinger \
- libbinder \
- libutils
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/../../services/surfaceflinger
-
-LOCAL_MODULE:= surfaceflinger
-
-include $(BUILD_EXECUTABLE)
diff --git a/cmds/surfaceflinger/main_surfaceflinger.cpp b/cmds/surfaceflinger/main_surfaceflinger.cpp
deleted file mode 100644
index 6dbcf5c..0000000
--- a/cmds/surfaceflinger/main_surfaceflinger.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <binder/BinderService.h>
-#include <SurfaceFlinger.h>
-
-using namespace android;
-
-int main(int argc, char** argv) {
- SurfaceFlinger::publishAndJoinThreadPool(true);
- return 0;
-}
diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk
index e8afce3..7d08a8c 100644
--- a/cmds/system_server/library/Android.mk
+++ b/cmds/system_server/library/Android.mk
@@ -5,13 +5,14 @@
system_init.cpp
base = $(LOCAL_PATH)/../../..
+native = $(LOCAL_PATH)/../../../../native
LOCAL_C_INCLUDES := \
$(base)/services/camera/libcameraservice \
$(base)/services/audioflinger \
- $(base)/services/surfaceflinger \
$(base)/services/sensorservice \
$(base)/media/libmediaplayerservice \
+ $(native)/services/surfaceflinger \
$(JNI_H_INCLUDE)
LOCAL_SHARED_LIBRARIES := \
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 8e8d37d..f895431 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -570,7 +570,18 @@
* tag. By doing so, other applications will need to declare a corresponding
* {@link android.R.styleable#AndroidManifestUsesPermission <uses-permission>}
* element in their own manifest to be able to start that activity.
- *
+ *
+ * <p>When starting an Activity you can set {@link Intent#FLAG_GRANT_READ_URI_PERMISSION
+ * Intent.FLAG_GRANT_READ_URI_PERMISSION} and/or {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION
+ * Intent.FLAG_GRANT_WRITE_URI_PERMISSION} on the Intent. This will grant the
+ * Activity access to the specific URIs in the Intent. Access will remain
+ * until the Activity has finished (it will remain across the hosting
+ * process being killed and other temporary destruction). As of
+ * {@link android.os.Build.VERSION_CODES#GINGERBREAD}, if the Activity
+ * was already created and a new Intent is being delivered to
+ * {@link #onNewIntent(Intent)}, any newly granted URI permissions will be added
+ * to the existing ones it holds.
+ *
* <p>See the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
* document for more information on permissions and security in general.
*
@@ -3549,7 +3560,16 @@
/**
* Call this to set the result that your activity will return to its
* caller.
- *
+ *
+ * <p>As of {@link android.os.Build.VERSION_CODES#GINGERBREAD}, the Intent
+ * you supply here can have {@link Intent#FLAG_GRANT_READ_URI_PERMISSION
+ * Intent.FLAG_GRANT_READ_URI_PERMISSION} and/or {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION
+ * Intent.FLAG_GRANT_WRITE_URI_PERMISSION} set. This will grant the
+ * Activity receiving the result access to the specific URIs in the Intent.
+ * Access will remain until the Activity has finished (it will remain across the hosting
+ * process being killed and other temporary destruction) and will be added
+ * to any existing set of URI permissions it already holds.
+ *
* @param resultCode The result code to propagate back to the originating
* activity, often RESULT_CANCELED or RESULT_OK
* @param data The data to propagate back to the originating activity.
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index 35bd8c0..be4b8af 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -163,7 +163,19 @@
* {@link android.R.styleable#AndroidManifestUsesPermission <uses-permission>}
* element in their own manifest to be able to start, stop, or bind to
* the service.
- *
+ *
+ * <p>As of {@link android.os.Build.VERSION_CODES#GINGERBREAD}, when using
+ * {@link Context#startService(Intent) Context.startService(Intent)}, you can
+ * also set {@link Intent#FLAG_GRANT_READ_URI_PERMISSION
+ * Intent.FLAG_GRANT_READ_URI_PERMISSION} and/or {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION
+ * Intent.FLAG_GRANT_WRITE_URI_PERMISSION} on the Intent. This will grant the
+ * Service temporary access to the specific URIs in the Intent. Access will
+ * remain until the Service has called {@link #stopSelf(int)} for that start
+ * command or a later one, or until the Service has been completely stopped.
+ * This works for granting access to the other apps that have not requested
+ * the permission protecting the Service, or even when the Service is not
+ * exported at all.
+ *
* <p>In addition, a service can protect individual IPC calls into it with
* permissions, by calling the
* {@link #checkCallingPermission}
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java
index a8b1bf4..a655dd4 100644
--- a/core/java/android/content/ClipData.java
+++ b/core/java/android/content/ClipData.java
@@ -153,7 +153,7 @@
final Bitmap mIcon;
- final ArrayList<Item> mItems = new ArrayList<Item>();
+ final ArrayList<Item> mItems;
/**
* Description of a single item in a ClippedData.
@@ -321,6 +321,33 @@
return "";
}
//END_INCLUDE(coerceToText)
+
+ @Override
+ public String toString() {
+ StringBuilder b = new StringBuilder(128);
+
+ b.append("ClipData.Item { ");
+ toShortString(b);
+ b.append(" }");
+
+ return b.toString();
+ }
+
+ /** @hide */
+ public void toShortString(StringBuilder b) {
+ if (mText != null) {
+ b.append("T:");
+ b.append(mText);
+ } else if (mUri != null) {
+ b.append("U:");
+ b.append(mUri);
+ } else if (mIntent != null) {
+ b.append("I:");
+ mIntent.toShortString(b, true, true, true, true);
+ } else {
+ b.append("NULL");
+ }
+ }
}
/**
@@ -336,6 +363,7 @@
throw new NullPointerException("item is null");
}
mIcon = null;
+ mItems = new ArrayList<Item>();
mItems.add(item);
}
@@ -351,10 +379,23 @@
throw new NullPointerException("item is null");
}
mIcon = null;
+ mItems = new ArrayList<Item>();
mItems.add(item);
}
/**
+ * Create a new clip that is a copy of another clip. This does a deep-copy
+ * of all items in the clip.
+ *
+ * @param other The existing ClipData that is to be copied.
+ */
+ public ClipData(ClipData other) {
+ mClipDescription = other.mClipDescription;
+ mIcon = other.mIcon;
+ mItems = new ArrayList<Item>(other.mItems);
+ }
+
+ /**
* Create a new ClipData holding data of the type
* {@link ClipDescription#MIMETYPE_TEXT_PLAIN}.
*
@@ -475,6 +516,46 @@
}
@Override
+ public String toString() {
+ StringBuilder b = new StringBuilder(128);
+
+ b.append("ClipData { ");
+ toShortString(b);
+ b.append(" }");
+
+ return b.toString();
+ }
+
+ /** @hide */
+ public void toShortString(StringBuilder b) {
+ boolean first;
+ if (mClipDescription != null) {
+ first = !mClipDescription.toShortString(b);
+ } else {
+ first = true;
+ }
+ if (mIcon != null) {
+ if (!first) {
+ b.append(' ');
+ }
+ first = false;
+ b.append("I:");
+ b.append(mIcon.getWidth());
+ b.append('x');
+ b.append(mIcon.getHeight());
+ }
+ for (int i=0; i<mItems.size(); i++) {
+ if (!first) {
+ b.append(' ');
+ }
+ first = false;
+ b.append('{');
+ mItems.get(i).toShortString(b);
+ b.append('}');
+ }
+ }
+
+ @Override
public int describeContents() {
return 0;
}
@@ -515,6 +596,7 @@
} else {
mIcon = null;
}
+ mItems = new ArrayList<Item>();
final int N = in.readInt();
for (int i=0; i<N; i++) {
CharSequence text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
diff --git a/core/java/android/content/ClipDescription.java b/core/java/android/content/ClipDescription.java
index b5fa20c..c6b51ef 100644
--- a/core/java/android/content/ClipDescription.java
+++ b/core/java/android/content/ClipDescription.java
@@ -184,6 +184,39 @@
}
@Override
+ public String toString() {
+ StringBuilder b = new StringBuilder(128);
+
+ b.append("ClipDescription { ");
+ toShortString(b);
+ b.append(" }");
+
+ return b.toString();
+ }
+
+ /** @hide */
+ public boolean toShortString(StringBuilder b) {
+ boolean first = true;
+ for (int i=0; i<mMimeTypes.length; i++) {
+ if (!first) {
+ b.append(' ');
+ }
+ first = false;
+ b.append(mMimeTypes[i]);
+ }
+ if (mLabel != null) {
+ if (!first) {
+ b.append(' ');
+ }
+ first = false;
+ b.append('"');
+ b.append(mLabel);
+ b.append('"');
+ }
+ return !first;
+ }
+
+ @Override
public int describeContents() {
return 0;
}
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b1b09d5..5739119 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2688,12 +2688,20 @@
/**
* If set, the recipient of this Intent will be granted permission to
- * perform read operations on the Uri in the Intent's data.
+ * perform read operations on the Uri in the Intent's data and any URIs
+ * specified in its ClipData. When applying to an Intent's ClipData,
+ * all URIs as well as recursive traversals through data or other ClipData
+ * in Intent items will be granted; only the grant flags of the top-level
+ * Intent are used.
*/
public static final int FLAG_GRANT_READ_URI_PERMISSION = 0x00000001;
/**
* If set, the recipient of this Intent will be granted permission to
- * perform write operations on the Uri in the Intent's data.
+ * perform write operations on the Uri in the Intent's data and any URIs
+ * specified in its ClipData. When applying to an Intent's ClipData,
+ * all URIs as well as recursive traversals through data or other ClipData
+ * in Intent items will be granted; only the grant flags of the top-level
+ * Intent are used.
*/
public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002;
/**
@@ -3018,6 +3026,7 @@
private Bundle mExtras;
private Rect mSourceBounds;
private Intent mSelector;
+ private ClipData mClipData;
// ---------------------------------------------------------------------
@@ -3049,6 +3058,9 @@
if (o.mSelector != null) {
this.mSelector = new Intent(o.mSelector);
}
+ if (o.mClipData != null) {
+ this.mClipData = new ClipData(o.mClipData);
+ }
}
@Override
@@ -3729,6 +3741,16 @@
}
/**
+ * Return the {@link ClipData} associated with this Intent. If there is
+ * none, returns null. See {@link #setClipData} for more information.
+ *
+ * @see #setClipData;
+ */
+ public ClipData getClipData() {
+ return mClipData;
+ }
+
+ /**
* Sets the ClassLoader that will be used when unmarshalling
* any Parcelable values from the extras of this Intent.
*
@@ -4683,6 +4705,37 @@
}
/**
+ * Set a {@link ClipData} associated with this Intent. This replaces any
+ * previously set ClipData.
+ *
+ * <p>The ClipData in an intent is not used for Intent matching or other
+ * such operations. Semantically it is like extras, used to transmit
+ * additional data with the Intent. The main feature of using this over
+ * the extras for data is that {@link #FLAG_GRANT_READ_URI_PERMISSION}
+ * and {@link #FLAG_GRANT_WRITE_URI_PERMISSION} will operate on any URI
+ * items included in the clip data. This is useful, in particular, if
+ * you want to transmit an Intent containing multiple <code>content:</code>
+ * URIs for which the recipient may not have global permission to access the
+ * content provider.
+ *
+ * <p>If the ClipData contains items that are themselves Intents, any
+ * grant flags in those Intents will be ignored. Only the top-level flags
+ * of the main Intent are respected, and will be applied to all Uri or
+ * Intent items in the clip (or sub-items of the clip).
+ *
+ * <p>The MIME type, label, and icon in the ClipData object are not
+ * directly used by Intent. Applications should generally rely on the
+ * MIME type of the Intent itself, not what it may find in the ClipData.
+ * A common practice is to construct a ClipData for use with an Intent
+ * with a MIME type of "*\/*".
+ *
+ * @param clip The new clip to set. May be null to clear the current clip.
+ */
+ public void setClipData(ClipData clip) {
+ mClipData = clip;
+ }
+
+ /**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
@@ -5660,6 +5713,12 @@
public static final int FILL_IN_SELECTOR = 1<<6;
/**
+ * Use with {@link #fillIn} to allow the current ClipData to be
+ * overwritten, even if it is already set.
+ */
+ public static final int FILL_IN_CLIP_DATA = 1<<7;
+
+ /**
* Copy the contents of <var>other</var> in to this object, but only
* where fields are not defined by this object. For purposes of a field
* being defined, the following pieces of data in the Intent are
@@ -5673,19 +5732,22 @@
* <li> package, as set by {@link #setPackage}.
* <li> component, as set by {@link #setComponent(ComponentName)} or
* related methods.
- * <li> source bounds, as set by {@link #setSourceBounds}
+ * <li> source bounds, as set by {@link #setSourceBounds}.
+ * <li> selector, as set by {@link #setSelector(Intent)}.
+ * <li> clip data, as set by {@link #setClipData(ClipData)}.
* <li> each top-level name in the associated extras.
* </ul>
*
* <p>In addition, you can use the {@link #FILL_IN_ACTION},
* {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE},
- * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, and
- * {@link #FILL_IN_SELECTOR} to override the restriction where the
- * corresponding field will not be replaced if it is already set.
+ * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS},
+ * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override
+ * the restriction where the corresponding field will not be replaced if
+ * it is already set.
*
- * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} is explicitly
- * specified. The selector will only be copied if {@link #FILL_IN_SELECTOR} is
- * explicitly specified.
+ * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT}
+ * is explicitly specified. The selector will only be copied if
+ * {@link #FILL_IN_SELECTOR} is explicitly specified.
*
* <p>For example, consider Intent A with {data="foo", categories="bar"}
* and Intent B with {action="gotit", data-type="some/thing",
@@ -5742,6 +5804,11 @@
changes |= FILL_IN_SELECTOR;
}
}
+ if (other.mClipData != null
+ && (mClipData == null || (flags&FILL_IN_CLIP_DATA) != 0)) {
+ mClipData = other.mClipData;
+ changes |= FILL_IN_CLIP_DATA;
+ }
// Component is special: it can -only- be set if explicitly allowed,
// since otherwise the sender could force the intent somewhere the
// originator didn't intend.
@@ -5938,7 +6005,7 @@
StringBuilder b = new StringBuilder(128);
b.append("Intent { ");
- toShortString(b, true, true, true);
+ toShortString(b, true, true, true, false);
b.append(" }");
return b.toString();
@@ -5949,21 +6016,33 @@
StringBuilder b = new StringBuilder(128);
b.append("Intent { ");
- toShortString(b, false, true, true);
+ toShortString(b, false, true, true, false);
b.append(" }");
return b.toString();
}
/** @hide */
- public String toShortString(boolean secure, boolean comp, boolean extras) {
+ public String toInsecureStringWithClip() {
StringBuilder b = new StringBuilder(128);
- toShortString(b, secure, comp, extras);
+
+ b.append("Intent { ");
+ toShortString(b, false, true, true, true);
+ b.append(" }");
+
return b.toString();
}
/** @hide */
- public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras) {
+ public String toShortString(boolean secure, boolean comp, boolean extras, boolean clip) {
+ StringBuilder b = new StringBuilder(128);
+ toShortString(b, secure, comp, extras, clip);
+ return b.toString();
+ }
+
+ /** @hide */
+ public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras,
+ boolean clip) {
boolean first = true;
if (mAction != null) {
b.append("act=").append(mAction);
@@ -6031,6 +6110,19 @@
first = false;
b.append("bnds=").append(mSourceBounds.toShortString());
}
+ if (mClipData != null) {
+ if (!first) {
+ b.append(' ');
+ }
+ first = false;
+ if (clip) {
+ b.append("clip={");
+ mClipData.toShortString(b);
+ b.append('}');
+ } else {
+ b.append("(has clip)");
+ }
+ }
if (extras && mExtras != null) {
if (!first) {
b.append(' ');
@@ -6040,7 +6132,7 @@
}
if (mSelector != null) {
b.append(" sel={");
- mSelector.toShortString(b, secure, comp, extras);
+ mSelector.toShortString(b, secure, comp, extras, clip);
b.append("}");
}
}
@@ -6209,6 +6301,13 @@
out.writeInt(0);
}
+ if (mClipData != null) {
+ out.writeInt(1);
+ mClipData.writeToParcel(out, flags);
+ } else {
+ out.writeInt(0);
+ }
+
out.writeBundle(mExtras);
}
@@ -6254,6 +6353,10 @@
mSelector = new Intent(in);
}
+ if (in.readInt() != 0) {
+ mClipData = new ClipData(in);
+ }
+
mExtras = in.readBundle();
}
diff --git a/core/java/android/net/http/CertificateChainValidator.java b/core/java/android/net/http/CertificateChainValidator.java
index 06c6c6e..6ad8fe3 100644
--- a/core/java/android/net/http/CertificateChainValidator.java
+++ b/core/java/android/net/http/CertificateChainValidator.java
@@ -18,6 +18,8 @@
import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.KeyManagementException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -128,10 +130,13 @@
*/
public static void handleTrustStorageUpdate() {
- X509TrustManager x509TrustManager = SSLParametersImpl.getDefaultTrustManager();
- if( x509TrustManager instanceof TrustManagerImpl ) {
- TrustManagerImpl trustManager = (TrustManagerImpl) x509TrustManager;
- trustManager.handleTrustStorageUpdate();
+ try {
+ X509TrustManager x509TrustManager = SSLParametersImpl.getDefaultTrustManager();
+ if( x509TrustManager instanceof TrustManagerImpl ) {
+ TrustManagerImpl trustManager = (TrustManagerImpl) x509TrustManager;
+ trustManager.handleTrustStorageUpdate();
+ }
+ } catch (KeyManagementException ignored) {
}
}
@@ -165,7 +170,7 @@
try {
SSLParametersImpl.getDefaultTrustManager().checkServerTrusted(chain, authType);
return null; // No errors.
- } catch (CertificateException e) {
+ } catch (GeneralSecurityException e) {
if (HttpLog.LOGV) {
HttpLog.v("failed to validate the certificate chain, error: " +
e.getMessage());
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index 603cea1..19fb7b1 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -161,6 +161,12 @@
}
@Override
+ public void setPaddingRelative(int start, int top, int end, int bottom) {
+ super.setPaddingRelative(start, top, end, bottom);
+ mBasePadding = getPaddingEnd();
+ }
+
+ @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index 5c97593..f4d5d74 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1080,6 +1080,8 @@
if (!mDropDownVerticalOffsetSet) {
mDropDownVerticalOffset = -mTempRect.top;
}
+ } else {
+ mTempRect.setEmpty();
}
// Max height available on the screen for a popup.
@@ -1092,7 +1094,25 @@
return maxHeight + padding;
}
- final int listContent = mDropDownList.measureHeightOfChildren(MeasureSpec.UNSPECIFIED,
+ final int childWidthSpec;
+ switch (mDropDownWidth) {
+ case ViewGroup.LayoutParams.WRAP_CONTENT:
+ childWidthSpec = MeasureSpec.makeMeasureSpec(
+ mContext.getResources().getDisplayMetrics().widthPixels -
+ (mTempRect.left + mTempRect.right),
+ MeasureSpec.AT_MOST);
+ break;
+ case ViewGroup.LayoutParams.MATCH_PARENT:
+ childWidthSpec = MeasureSpec.makeMeasureSpec(
+ mContext.getResources().getDisplayMetrics().widthPixels -
+ (mTempRect.left + mTempRect.right),
+ MeasureSpec.EXACTLY);
+ break;
+ default:
+ childWidthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.EXACTLY);
+ break;
+ }
+ final int listContent = mDropDownList.measureHeightOfChildren(childWidthSpec,
0, ListView.NO_POSITION, maxHeight - otherHeights, -1);
// add padding only if the list has items in it, that way we don't show
// the popup if it is not needed
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index 89c506f..6540613 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -26,7 +26,6 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 6ac889a..4c89218 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2079,6 +2079,20 @@
invalidate();
}
+ @Override
+ public void setPaddingRelative(int start, int top, int end, int bottom) {
+ if (start != getPaddingStart() ||
+ end != getPaddingEnd() ||
+ top != mPaddingTop ||
+ bottom != mPaddingBottom) {
+ nullLayouts();
+ }
+
+ // the super call will requestLayout()
+ super.setPaddingRelative(start, top, end, bottom);
+ invalidate();
+ }
+
/**
* Gets the autolink mask of the text. See {@link
* android.text.util.Linkify#ALL Linkify.ALL} and peers for
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index c6d3cee..c389cf7 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -159,12 +159,10 @@
$(JNI_H_INCLUDE) \
$(LOCAL_PATH)/android/graphics \
$(LOCAL_PATH)/../../libs/hwui \
- $(LOCAL_PATH)/../../opengl/libs \
+ $(LOCAL_PATH)/../../../native/opengl/libs \
$(call include-path-for, bluedroid) \
$(call include-path-for, libhardware)/hardware \
$(call include-path-for, libhardware_legacy)/hardware_legacy \
- $(LOCAL_PATH)/../../include/ui \
- $(LOCAL_PATH)/../../include/utils \
external/skia/include/core \
external/skia/include/effects \
external/skia/include/images \
diff --git a/docs/html/training/multiple-apks/api.jd b/docs/html/training/multiple-apks/api.jd
index 8b731bd..3492245 100644
--- a/docs/html/training/multiple-apks/api.jd
+++ b/docs/html/training/multiple-apks/api.jd
@@ -377,4 +377,8 @@
<pre>
<uses-feature android:name="android.hardware.telephony" android:required="false" />
</pre>
+<p>The <code>android.hardware.touchscreen</code> requirement is also implicitly added. If you want your APK to be visible on TVs which are non-touchscreen devices you should add the following to your manifest:</p>
+<pre>
+<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+</pre>
<p>Once you’ve completed the pre-launch checklist, upload your APKs to Google Play. It may take a bit for the application to show up when browsing Google Play, but when it does, perform one last check. Download the application onto any test devices you may have, to make sure that the APKs are targeting the intended devices. Congratulations, you’re done!</p>
diff --git a/docs/html/training/multiple-apks/multiple.jd b/docs/html/training/multiple-apks/multiple.jd
index 0c49705..b30068f 100644
--- a/docs/html/training/multiple-apks/multiple.jd
+++ b/docs/html/training/multiple-apks/multiple.jd
@@ -473,5 +473,9 @@
<pre>
<uses-feature android:name="android.hardware.telephony" android:required="false" />
</pre>
+<p>The <code>android.hardware.touchscreen</code> requirement is also implicitly added. If you want your APK to be visible on TVs which are non-touchscreen devices you should add the following to your manifest:</p>
+<pre>
+<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+</pre>
<p>Once you’ve completed the pre-launch checklist, upload your APKs to Google Play. It may take a bit for the application to show up when browsing Google Play, but when it does, perform one last check. Download the application onto any test devices you may have to make sure that the APKs are targeting the intended devices. Congratulations, you’re done!</p>
diff --git a/docs/html/training/multiple-apks/screensize.jd b/docs/html/training/multiple-apks/screensize.jd
index cbf17c5..ac679a7 100644
--- a/docs/html/training/multiple-apks/screensize.jd
+++ b/docs/html/training/multiple-apks/screensize.jd
@@ -352,4 +352,9 @@
<pre>
<uses-feature android:name="android.hardware.telephony" android:required="false" />
</pre>
+<p>The <code>android.hardware.touchscreen</code> requirement is also implicitly added. If you want your APK to be visible on TVs which are non-touchscreen devices you should add the following to your manifest:</p>
+<pre>
+<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+</pre>
+
<p>Once you’ve completed the pre-launch checklist, upload your APKs to Google Play. It may take a bit for the application to show up when browsing Google Play, but when it does, perform one last check. Download the application onto any test devices you may have to make sure that the APKs are targeting the intended devices. Congratulations, you’re done!</p>
diff --git a/docs/html/training/multiple-apks/texture.jd b/docs/html/training/multiple-apks/texture.jd
index 0dbee61..497d6b8 100644
--- a/docs/html/training/multiple-apks/texture.jd
+++ b/docs/html/training/multiple-apks/texture.jd
@@ -296,4 +296,9 @@
<pre>
<uses-feature android:name="android.hardware.telephony" android:required="false" />
</pre>
+<p>The <code>android.hardware.touchscreen</code> requirement is also implicitly added. If you want your APK to be visible on TVs which are non-touchscreen devices you should add the following to your manifest:</p>
+<pre>
+<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+</pre>
+
<p>Once you’ve completed the pre-launch checklist, upload your APKs to Google Play. It may take a bit for the application to show up when browsing Google Play, but when it does, perform one last check. Download the application onto any test devices you may have to make sure that the APKs are targeting the intended devices. Congratulations, you’re done!</p>
diff --git a/docs/html/training/multiscreen/screensizes.jd b/docs/html/training/multiscreen/screensizes.jd
index 2db0b67..bf19b08 100644
--- a/docs/html/training/multiscreen/screensizes.jd
+++ b/docs/html/training/multiscreen/screensizes.jd
@@ -164,14 +164,14 @@
{@sample development/samples/training/multiscreen/newsreader/res/layout/onepane.xml all}
</li>
- <li><code>res/layout-xlarge/main.xml</code>, two-pane layout:
+ <li><code>res/layout-large/main.xml</code>, two-pane layout:
{@sample development/samples/training/multiscreen/newsreader/res/layout/twopanes.xml all}
</li>
</ul>
-<p>Notice the <code>xlarge</code> qualifier in the directory name of the second layout. This layout
-will be selected on devices with screens classified as extra-large (for example, 10" tablets). The
+<p>Notice the <code>large</code> qualifier in the directory name of the second layout. This layout
+will be selected on devices with screens classified as large (for example, 7" tablets and above). The
other layout (without qualifiers) will be selected for smaller devices.</p>
@@ -188,7 +188,7 @@
width given in dp. For example, the typical 7" tablet has a minimum width of
600 dp, so if you want your UI to have two panes on those screens (but a single
list on smaller screens), you can use the same two layouts from the previous section for single
-and two-pane layouts, but instead of the <code>xlarge</code> size qualifier, use
+and two-pane layouts, but instead of the <code>large</code> size qualifier, use
<code>sw600dp</code> to indicate the two-pane layout is for screens on which the smallest-width
is 600 dp:</p>
@@ -209,9 +209,9 @@
layout.</p>
<p>However, this won't work well on pre-3.2 devices, because they don't
-recognize <code>sw600dp</code> as a size qualifier, so you still have to use the <code>xlarge</code>
+recognize <code>sw600dp</code> as a size qualifier, so you still have to use the <code>large</code>
qualifier as well. So, you should have a file named
-<code>res/layout-xlarge/main.xml</code>
+<code>res/layout-large/main.xml</code>
which is identical to <code>res/layout-sw600dp/main.xml</code>. In the next section
you'll see a technique that allows you to avoid duplicating the layout files this way.</p>
@@ -222,20 +222,20 @@
Therefore, you should also still use the abstract size bins (small, normal,
large and xlarge) to be compatible with earlier versions. For example, if you
want to design your UI so that it shows a single-pane UI on phones but a
-multi-pane UI on 7" tablets and larger devices, you'd have to supply these
+multi-pane UI on 7" tablets, TVs and other large devices, you'd have to supply these
files:</p>
<p><ul>
<li><code>res/layout/main.xml:</code> single-pane layout</li>
-<li><code>res/layout-xlarge:</code> multi-pane layout</li>
+<li><code>res/layout-large:</code> multi-pane layout</li>
<li><code>res/layout-sw600dp:</code> multi-pane layout</li>
</ul></p>
<p>The last two files are identical, because one of them will be matched by
-Android 3.2 devices, and the other one is for the benefit of tablets with
+Android 3.2 devices, and the other one is for the benefit of tablets and TVs with
earlier versions of Android.</p>
-<p>To avoid this duplication of the same file for tablets (and the maintenance
+<p>To avoid this duplication of the same file for tablets and TVs (and the maintenance
headache resulting from it), you can use alias files. For example, you can define the following
layouts:</p>
@@ -247,7 +247,7 @@
<p>And add these two files:</p>
<p><ul>
-<li><code>res/values-xlarge/layout.xml</code>:
+<li><code>res/values-large/layout.xml</code>:
<pre>
<resources>
<item name="main" type="layout">@layout/main_twopanes</item>
@@ -267,9 +267,9 @@
<p>These latter two files have identical content, but they don’t actually define
the layout. They merely set up {@code main} to be an alias to {@code main_twopanes}. Since
-these files have <code>xlarge</code> and <code>sw600dp</code> selectors, they are
-applied to tablets regardless of Android version (pre-3.2 tablets match
-{@code xlarge}, and post-3.2 will match <code>sw600dp</code>).</p>
+these files have <code>large</code> and <code>sw600dp</code> selectors, they are
+applied to tablets and TVs regardless of Android version (pre-3.2 tablets and TVs match
+{@code large}, and post-3.2 will match <code>sw600dp</code>).</p>
<h2 id="TaskUseOriQuali">Use Orientation Qualifiers</h2>
@@ -285,6 +285,7 @@
<li><b>7" tablet, landscape:</b> dual pane, wide, with action bar</li>
<li><b>10" tablet, portrait:</b> dual pane, narrow, with action bar</li>
<li><b>10" tablet, landscape:</b> dual pane, wide, with action bar</li>
+<li><b>TV, landscape:</b> dual pane, wide, with action bar</li>
</ul></p>
<p>So each of these layouts is defined in an XML file in the
@@ -319,11 +320,11 @@
{@sample development/samples/training/multiscreen/newsreader/res/values-sw600dp-port/layouts.xml
all}
-<p><code>res/values-xlarge-land/layouts.xml</code>:</p>
-{@sample development/samples/training/multiscreen/newsreader/res/values-xlarge-land/layouts.xml all}
+<p><code>res/values-large-land/layouts.xml</code>:</p>
+{@sample development/samples/training/multiscreen/newsreader/res/values-large-land/layouts.xml all}
-<p><code>res/values-xlarge-port/layouts.xml</code>:</p>
-{@sample development/samples/training/multiscreen/newsreader/res/values-xlarge-port/layouts.xml all}
+<p><code>res/values-large-port/layouts.xml</code>:</p>
+{@sample development/samples/training/multiscreen/newsreader/res/values-large-port/layouts.xml all}
diff --git a/include/binder/Binder.h b/include/binder/Binder.h
deleted file mode 100644
index ba3ac4b..0000000
--- a/include/binder/Binder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_BINDER_H
-#define ANDROID_BINDER_H
-
-#include <binder/IBinder.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BBinder : public IBinder
-{
-public:
- BBinder();
-
- virtual const String16& getInterfaceDescriptor() const;
- virtual bool isBinderAlive() const;
- virtual status_t pingBinder();
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- virtual status_t transact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0);
-
- virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL);
-
- virtual void attachObject( const void* objectID,
- void* object,
- void* cleanupCookie,
- object_cleanup_func func);
- virtual void* findObject(const void* objectID) const;
- virtual void detachObject(const void* objectID);
-
- virtual BBinder* localBinder();
-
-protected:
- virtual ~BBinder();
-
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
-private:
- BBinder(const BBinder& o);
- BBinder& operator=(const BBinder& o);
-
- class Extras;
-
- Extras* mExtras;
- void* mReserved0;
-};
-
-// ---------------------------------------------------------------------------
-
-class BpRefBase : public virtual RefBase
-{
-protected:
- BpRefBase(const sp<IBinder>& o);
- virtual ~BpRefBase();
- virtual void onFirstRef();
- virtual void onLastStrongRef(const void* id);
- virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
-
- inline IBinder* remote() { return mRemote; }
- inline IBinder* remote() const { return mRemote; }
-
-private:
- BpRefBase(const BpRefBase& o);
- BpRefBase& operator=(const BpRefBase& o);
-
- IBinder* const mRemote;
- RefBase::weakref_type* mRefs;
- volatile int32_t mState;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_BINDER_H
diff --git a/include/binder/BinderService.h b/include/binder/BinderService.h
deleted file mode 100644
index ca594d3..0000000
--- a/include/binder/BinderService.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_BINDER_SERVICE_H
-#define ANDROID_BINDER_SERVICE_H
-
-#include <stdint.h>
-
-#include <utils/Errors.h>
-#include <utils/String16.h>
-
-#include <binder/IServiceManager.h>
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-template<typename SERVICE>
-class BinderService
-{
-public:
- static status_t publish(bool allowIsolated = false) {
- sp<IServiceManager> sm(defaultServiceManager());
- return sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated);
- }
-
- static void publishAndJoinThreadPool(bool allowIsolated = false) {
- sp<ProcessState> proc(ProcessState::self());
- sp<IServiceManager> sm(defaultServiceManager());
- sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated);
- ProcessState::self()->startThreadPool();
- IPCThreadState::self()->joinThreadPool();
- }
-
- static void instantiate() { publish(); }
-
- static status_t shutdown() {
- return NO_ERROR;
- }
-};
-
-
-}; // namespace android
-// ---------------------------------------------------------------------------
-#endif // ANDROID_BINDER_SERVICE_H
diff --git a/include/binder/BpBinder.h b/include/binder/BpBinder.h
deleted file mode 100644
index 7ef93aa..0000000
--- a/include/binder/BpBinder.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_BPBINDER_H
-#define ANDROID_BPBINDER_H
-
-#include <binder/IBinder.h>
-#include <utils/KeyedVector.h>
-#include <utils/threads.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BpBinder : public IBinder
-{
-public:
- BpBinder(int32_t handle);
-
- inline int32_t handle() const { return mHandle; }
-
- virtual const String16& getInterfaceDescriptor() const;
- virtual bool isBinderAlive() const;
- virtual status_t pingBinder();
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- virtual status_t transact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0);
- virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL);
-
- virtual void attachObject( const void* objectID,
- void* object,
- void* cleanupCookie,
- object_cleanup_func func);
- virtual void* findObject(const void* objectID) const;
- virtual void detachObject(const void* objectID);
-
- virtual BpBinder* remoteBinder();
-
- status_t setConstantData(const void* data, size_t size);
- void sendObituary();
-
- class ObjectManager
- {
- public:
- ObjectManager();
- ~ObjectManager();
-
- void attach( const void* objectID,
- void* object,
- void* cleanupCookie,
- IBinder::object_cleanup_func func);
- void* find(const void* objectID) const;
- void detach(const void* objectID);
-
- void kill();
-
- private:
- ObjectManager(const ObjectManager&);
- ObjectManager& operator=(const ObjectManager&);
-
- struct entry_t
- {
- void* object;
- void* cleanupCookie;
- IBinder::object_cleanup_func func;
- };
-
- KeyedVector<const void*, entry_t> mObjects;
- };
-
-protected:
- virtual ~BpBinder();
- virtual void onFirstRef();
- virtual void onLastStrongRef(const void* id);
- virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
-
-private:
- const int32_t mHandle;
-
- struct Obituary {
- wp<DeathRecipient> recipient;
- void* cookie;
- uint32_t flags;
- };
-
- void reportOneDeath(const Obituary& obit);
- bool isDescriptorCached() const;
-
- mutable Mutex mLock;
- volatile int32_t mAlive;
- volatile int32_t mObitsSent;
- Vector<Obituary>* mObituaries;
- ObjectManager mObjects;
- Parcel* mConstantData;
- mutable String16 mDescriptorCache;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_BPBINDER_H
diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h
deleted file mode 100644
index 81b56c2..0000000
--- a/include/binder/IBinder.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_IBINDER_H
-#define ANDROID_IBINDER_H
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/String16.h>
-#include <utils/Vector.h>
-
-
-#define B_PACK_CHARS(c1, c2, c3, c4) \
- ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BBinder;
-class BpBinder;
-class IInterface;
-class Parcel;
-
-/**
- * Base class and low-level protocol for a remotable object.
- * You can derive from this class to create an object for which other
- * processes can hold references to it. Communication between processes
- * (method calls, property get and set) is down through a low-level
- * protocol implemented on top of the transact() API.
- */
-class IBinder : public virtual RefBase
-{
-public:
- enum {
- FIRST_CALL_TRANSACTION = 0x00000001,
- LAST_CALL_TRANSACTION = 0x00ffffff,
-
- PING_TRANSACTION = B_PACK_CHARS('_','P','N','G'),
- DUMP_TRANSACTION = B_PACK_CHARS('_','D','M','P'),
- INTERFACE_TRANSACTION = B_PACK_CHARS('_', 'N', 'T', 'F'),
-
- // Corresponds to TF_ONE_WAY -- an asynchronous call.
- FLAG_ONEWAY = 0x00000001
- };
-
- IBinder();
-
- /**
- * Check if this IBinder implements the interface named by
- * @a descriptor. If it does, the base pointer to it is returned,
- * which you can safely static_cast<> to the concrete C++ interface.
- */
- virtual sp<IInterface> queryLocalInterface(const String16& descriptor);
-
- /**
- * Return the canonical name of the interface provided by this IBinder
- * object.
- */
- virtual const String16& getInterfaceDescriptor() const = 0;
-
- virtual bool isBinderAlive() const = 0;
- virtual status_t pingBinder() = 0;
- virtual status_t dump(int fd, const Vector<String16>& args) = 0;
-
- virtual status_t transact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0) = 0;
-
- /**
- * This method allows you to add data that is transported through
- * IPC along with your IBinder pointer. When implementing a Binder
- * object, override it to write your desired data in to @a outData.
- * You can then call getConstantData() on your IBinder to retrieve
- * that data, from any process. You MUST return the number of bytes
- * written in to the parcel (including padding).
- */
- class DeathRecipient : public virtual RefBase
- {
- public:
- virtual void binderDied(const wp<IBinder>& who) = 0;
- };
-
- /**
- * Register the @a recipient for a notification if this binder
- * goes away. If this binder object unexpectedly goes away
- * (typically because its hosting process has been killed),
- * then DeathRecipient::binderDied() will be called with a reference
- * to this.
- *
- * The @a cookie is optional -- if non-NULL, it should be a
- * memory address that you own (that is, you know it is unique).
- *
- * @note You will only receive death notifications for remote binders,
- * as local binders by definition can't die without you dying as well.
- * Trying to use this function on a local binder will result in an
- * INVALID_OPERATION code being returned and nothing happening.
- *
- * @note This link always holds a weak reference to its recipient.
- *
- * @note You will only receive a weak reference to the dead
- * binder. You should not try to promote this to a strong reference.
- * (Nor should you need to, as there is nothing useful you can
- * directly do with it now that it has passed on.)
- */
- virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0) = 0;
-
- /**
- * Remove a previously registered death notification.
- * The @a recipient will no longer be called if this object
- * dies. The @a cookie is optional. If non-NULL, you can
- * supply a NULL @a recipient, and the recipient previously
- * added with that cookie will be unlinked.
- */
- virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL) = 0;
-
- virtual bool checkSubclass(const void* subclassID) const;
-
- typedef void (*object_cleanup_func)(const void* id, void* obj, void* cleanupCookie);
-
- virtual void attachObject( const void* objectID,
- void* object,
- void* cleanupCookie,
- object_cleanup_func func) = 0;
- virtual void* findObject(const void* objectID) const = 0;
- virtual void detachObject(const void* objectID) = 0;
-
- virtual BBinder* localBinder();
- virtual BpBinder* remoteBinder();
-
-protected:
- virtual ~IBinder();
-
-private:
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_IBINDER_H
diff --git a/include/binder/IInterface.h b/include/binder/IInterface.h
deleted file mode 100644
index 5f9f69c..0000000
--- a/include/binder/IInterface.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-#ifndef ANDROID_IINTERFACE_H
-#define ANDROID_IINTERFACE_H
-
-#include <binder/Binder.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class IInterface : public virtual RefBase
-{
-public:
- IInterface();
- sp<IBinder> asBinder();
- sp<const IBinder> asBinder() const;
-
-protected:
- virtual ~IInterface();
- virtual IBinder* onAsBinder() = 0;
-};
-
-// ----------------------------------------------------------------------
-
-template<typename INTERFACE>
-inline sp<INTERFACE> interface_cast(const sp<IBinder>& obj)
-{
- return INTERFACE::asInterface(obj);
-}
-
-// ----------------------------------------------------------------------
-
-template<typename INTERFACE>
-class BnInterface : public INTERFACE, public BBinder
-{
-public:
- virtual sp<IInterface> queryLocalInterface(const String16& _descriptor);
- virtual const String16& getInterfaceDescriptor() const;
-
-protected:
- virtual IBinder* onAsBinder();
-};
-
-// ----------------------------------------------------------------------
-
-template<typename INTERFACE>
-class BpInterface : public INTERFACE, public BpRefBase
-{
-public:
- BpInterface(const sp<IBinder>& remote);
-
-protected:
- virtual IBinder* onAsBinder();
-};
-
-// ----------------------------------------------------------------------
-
-#define DECLARE_META_INTERFACE(INTERFACE) \
- static const android::String16 descriptor; \
- static android::sp<I##INTERFACE> asInterface( \
- const android::sp<android::IBinder>& obj); \
- virtual const android::String16& getInterfaceDescriptor() const; \
- I##INTERFACE(); \
- virtual ~I##INTERFACE(); \
-
-
-#define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \
- const android::String16 I##INTERFACE::descriptor(NAME); \
- const android::String16& \
- I##INTERFACE::getInterfaceDescriptor() const { \
- return I##INTERFACE::descriptor; \
- } \
- android::sp<I##INTERFACE> I##INTERFACE::asInterface( \
- const android::sp<android::IBinder>& obj) \
- { \
- android::sp<I##INTERFACE> intr; \
- if (obj != NULL) { \
- intr = static_cast<I##INTERFACE*>( \
- obj->queryLocalInterface( \
- I##INTERFACE::descriptor).get()); \
- if (intr == NULL) { \
- intr = new Bp##INTERFACE(obj); \
- } \
- } \
- return intr; \
- } \
- I##INTERFACE::I##INTERFACE() { } \
- I##INTERFACE::~I##INTERFACE() { } \
-
-
-#define CHECK_INTERFACE(interface, data, reply) \
- if (!data.checkInterface(this)) { return PERMISSION_DENIED; } \
-
-
-// ----------------------------------------------------------------------
-// No user-serviceable parts after this...
-
-template<typename INTERFACE>
-inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface(
- const String16& _descriptor)
-{
- if (_descriptor == INTERFACE::descriptor) return this;
- return NULL;
-}
-
-template<typename INTERFACE>
-inline const String16& BnInterface<INTERFACE>::getInterfaceDescriptor() const
-{
- return INTERFACE::getInterfaceDescriptor();
-}
-
-template<typename INTERFACE>
-IBinder* BnInterface<INTERFACE>::onAsBinder()
-{
- return this;
-}
-
-template<typename INTERFACE>
-inline BpInterface<INTERFACE>::BpInterface(const sp<IBinder>& remote)
- : BpRefBase(remote)
-{
-}
-
-template<typename INTERFACE>
-inline IBinder* BpInterface<INTERFACE>::onAsBinder()
-{
- return remote();
-}
-
-// ----------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_IINTERFACE_H
diff --git a/include/binder/IMemory.h b/include/binder/IMemory.h
deleted file mode 100644
index 2d0db00..0000000
--- a/include/binder/IMemory.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_IMEMORY_H
-#define ANDROID_IMEMORY_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <utils/RefBase.h>
-#include <utils/Errors.h>
-#include <binder/IInterface.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-class IMemoryHeap : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(MemoryHeap);
-
- // flags returned by getFlags()
- enum {
- READ_ONLY = 0x00000001
- };
-
- virtual int getHeapID() const = 0;
- virtual void* getBase() const = 0;
- virtual size_t getSize() const = 0;
- virtual uint32_t getFlags() const = 0;
- virtual uint32_t getOffset() const = 0;
-
- // these are there just for backward source compatibility
- int32_t heapID() const { return getHeapID(); }
- void* base() const { return getBase(); }
- size_t virtualSize() const { return getSize(); }
-};
-
-class BnMemoryHeap : public BnInterface<IMemoryHeap>
-{
-public:
- virtual status_t onTransact(
- uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- BnMemoryHeap();
-protected:
- virtual ~BnMemoryHeap();
-};
-
-// ----------------------------------------------------------------------------
-
-class IMemory : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(Memory);
-
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset=0, size_t* size=0) const = 0;
-
- // helpers
- void* fastPointer(const sp<IBinder>& heap, ssize_t offset) const;
- void* pointer() const;
- size_t size() const;
- ssize_t offset() const;
-};
-
-class BnMemory : public BnInterface<IMemory>
-{
-public:
- virtual status_t onTransact(
- uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- BnMemory();
-protected:
- virtual ~BnMemory();
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_IMEMORY_H
diff --git a/include/binder/IPCThreadState.h b/include/binder/IPCThreadState.h
deleted file mode 100644
index 691ba2f..0000000
--- a/include/binder/IPCThreadState.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_IPC_THREAD_STATE_H
-#define ANDROID_IPC_THREAD_STATE_H
-
-#include <utils/Errors.h>
-#include <binder/Parcel.h>
-#include <binder/ProcessState.h>
-#include <utils/Vector.h>
-
-#ifdef HAVE_WIN32_PROC
-typedef int uid_t;
-#endif
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class IPCThreadState
-{
-public:
- static IPCThreadState* self();
- static IPCThreadState* selfOrNull(); // self(), but won't instantiate
-
- sp<ProcessState> process();
-
- status_t clearLastError();
-
- int getCallingPid();
- int getCallingUid();
- int getOrigCallingUid();
-
- void setStrictModePolicy(int32_t policy);
- int32_t getStrictModePolicy() const;
-
- void setLastTransactionBinderFlags(int32_t flags);
- int32_t getLastTransactionBinderFlags() const;
-
- int64_t clearCallingIdentity();
- void restoreCallingIdentity(int64_t token);
-
- void flushCommands();
-
- void joinThreadPool(bool isMain = true);
-
- // Stop the local process.
- void stopProcess(bool immediate = true);
-
- status_t transact(int32_t handle,
- uint32_t code, const Parcel& data,
- Parcel* reply, uint32_t flags);
-
- void incStrongHandle(int32_t handle);
- void decStrongHandle(int32_t handle);
- void incWeakHandle(int32_t handle);
- void decWeakHandle(int32_t handle);
- status_t attemptIncStrongHandle(int32_t handle);
- static void expungeHandle(int32_t handle, IBinder* binder);
- status_t requestDeathNotification( int32_t handle,
- BpBinder* proxy);
- status_t clearDeathNotification( int32_t handle,
- BpBinder* proxy);
-
- static void shutdown();
-
- // Call this to disable switching threads to background scheduling when
- // receiving incoming IPC calls. This is specifically here for the
- // Android system process, since it expects to have background apps calling
- // in to it but doesn't want to acquire locks in its services while in
- // the background.
- static void disableBackgroundScheduling(bool disable);
-
-private:
- IPCThreadState();
- ~IPCThreadState();
-
- status_t sendReply(const Parcel& reply, uint32_t flags);
- status_t waitForResponse(Parcel *reply,
- status_t *acquireResult=NULL);
- status_t talkWithDriver(bool doReceive=true);
- status_t writeTransactionData(int32_t cmd,
- uint32_t binderFlags,
- int32_t handle,
- uint32_t code,
- const Parcel& data,
- status_t* statusBuffer);
- status_t executeCommand(int32_t command);
-
- void clearCaller();
-
- static void threadDestructor(void *st);
- static void freeBuffer(Parcel* parcel,
- const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsSize,
- void* cookie);
-
- const sp<ProcessState> mProcess;
- const pid_t mMyThreadId;
- Vector<BBinder*> mPendingStrongDerefs;
- Vector<RefBase::weakref_type*> mPendingWeakDerefs;
-
- Parcel mIn;
- Parcel mOut;
- status_t mLastError;
- pid_t mCallingPid;
- uid_t mCallingUid;
- uid_t mOrigCallingUid;
- int32_t mStrictModePolicy;
- int32_t mLastTransactionBinderFlags;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_IPC_THREAD_STATE_H
diff --git a/include/binder/IPermissionController.h b/include/binder/IPermissionController.h
deleted file mode 100644
index f9d371b..0000000
--- a/include/binder/IPermissionController.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-#ifndef ANDROID_IPERMISSION_CONTROLLER_H
-#define ANDROID_IPERMISSION_CONTROLLER_H
-
-#include <binder/IInterface.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class IPermissionController : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(PermissionController);
-
- virtual bool checkPermission(const String16& permission,
- int32_t pid, int32_t uid) = 0;
-
- enum {
- CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION
- };
-};
-
-// ----------------------------------------------------------------------
-
-class BnPermissionController : public BnInterface<IPermissionController>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_IPERMISSION_CONTROLLER_H
-
diff --git a/include/binder/IServiceManager.h b/include/binder/IServiceManager.h
deleted file mode 100644
index 2c297d6..0000000
--- a/include/binder/IServiceManager.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-#ifndef ANDROID_ISERVICE_MANAGER_H
-#define ANDROID_ISERVICE_MANAGER_H
-
-#include <binder/IInterface.h>
-#include <binder/IPermissionController.h>
-#include <utils/Vector.h>
-#include <utils/String16.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class IServiceManager : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(ServiceManager);
-
- /**
- * Retrieve an existing service, blocking for a few seconds
- * if it doesn't yet exist.
- */
- virtual sp<IBinder> getService( const String16& name) const = 0;
-
- /**
- * Retrieve an existing service, non-blocking.
- */
- virtual sp<IBinder> checkService( const String16& name) const = 0;
-
- /**
- * Register a service.
- */
- virtual status_t addService( const String16& name,
- const sp<IBinder>& service,
- bool allowIsolated = false) = 0;
-
- /**
- * Return list of all existing services.
- */
- virtual Vector<String16> listServices() = 0;
-
- enum {
- GET_SERVICE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
- CHECK_SERVICE_TRANSACTION,
- ADD_SERVICE_TRANSACTION,
- LIST_SERVICES_TRANSACTION,
- };
-};
-
-sp<IServiceManager> defaultServiceManager();
-
-template<typename INTERFACE>
-status_t getService(const String16& name, sp<INTERFACE>* outService)
-{
- const sp<IServiceManager> sm = defaultServiceManager();
- if (sm != NULL) {
- *outService = interface_cast<INTERFACE>(sm->getService(name));
- if ((*outService) != NULL) return NO_ERROR;
- }
- return NAME_NOT_FOUND;
-}
-
-bool checkCallingPermission(const String16& permission);
-bool checkCallingPermission(const String16& permission,
- int32_t* outPid, int32_t* outUid);
-bool checkPermission(const String16& permission, pid_t pid, uid_t uid);
-
-
-// ----------------------------------------------------------------------
-
-class BnServiceManager : public BnInterface<IServiceManager>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_ISERVICE_MANAGER_H
-
diff --git a/include/binder/MemoryBase.h b/include/binder/MemoryBase.h
deleted file mode 100644
index 463e26d..0000000
--- a/include/binder/MemoryBase.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_MEMORY_BASE_H
-#define ANDROID_MEMORY_BASE_H
-
-#include <stdlib.h>
-#include <stdint.h>
-
-#include <binder/IMemory.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class MemoryBase : public BnMemory
-{
-public:
- MemoryBase(const sp<IMemoryHeap>& heap, ssize_t offset, size_t size);
- virtual ~MemoryBase();
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset, size_t* size) const;
-
-protected:
- size_t getSize() const { return mSize; }
- ssize_t getOffset() const { return mOffset; }
- const sp<IMemoryHeap>& getHeap() const { return mHeap; }
-
-private:
- size_t mSize;
- ssize_t mOffset;
- sp<IMemoryHeap> mHeap;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_MEMORY_BASE_H
diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h
deleted file mode 100644
index 170f20d..0000000
--- a/include/binder/MemoryDealer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_MEMORY_DEALER_H
-#define ANDROID_MEMORY_DEALER_H
-
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IMemory.h>
-#include <binder/MemoryHeapBase.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class SimpleBestFitAllocator;
-
-// ----------------------------------------------------------------------------
-
-class MemoryDealer : public RefBase
-{
-public:
- MemoryDealer(size_t size, const char* name = 0);
-
- virtual sp<IMemory> allocate(size_t size);
- virtual void deallocate(size_t offset);
- virtual void dump(const char* what) const;
-
- sp<IMemoryHeap> getMemoryHeap() const { return heap(); }
-
-protected:
- virtual ~MemoryDealer();
-
-private:
- const sp<IMemoryHeap>& heap() const;
- SimpleBestFitAllocator* allocator() const;
-
- sp<IMemoryHeap> mHeap;
- SimpleBestFitAllocator* mAllocator;
-};
-
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_MEMORY_DEALER_H
diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h
deleted file mode 100644
index bbbda9c..0000000
--- a/include/binder/MemoryHeapBase.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_MEMORY_HEAP_BASE_H
-#define ANDROID_MEMORY_HEAP_BASE_H
-
-#include <stdlib.h>
-#include <stdint.h>
-
-#include <binder/IMemory.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class MemoryHeapBase : public virtual BnMemoryHeap
-{
-public:
- enum {
- READ_ONLY = IMemoryHeap::READ_ONLY,
- // memory won't be mapped locally, but will be mapped in the remote
- // process.
- DONT_MAP_LOCALLY = 0x00000100,
- NO_CACHING = 0x00000200
- };
-
- /*
- * maps the memory referenced by fd. but DOESN'T take ownership
- * of the filedescriptor (it makes a copy with dup()
- */
- MemoryHeapBase(int fd, size_t size, uint32_t flags = 0, uint32_t offset = 0);
-
- /*
- * maps memory from the given device
- */
- MemoryHeapBase(const char* device, size_t size = 0, uint32_t flags = 0);
-
- /*
- * maps memory from ashmem, with the given name for debugging
- */
- MemoryHeapBase(size_t size, uint32_t flags = 0, char const* name = NULL);
-
- virtual ~MemoryHeapBase();
-
- /* implement IMemoryHeap interface */
- virtual int getHeapID() const;
- virtual void* getBase() const;
- virtual size_t getSize() const;
- virtual uint32_t getFlags() const;
- virtual uint32_t getOffset() const;
-
- const char* getDevice() const;
-
- /* this closes this heap -- use carefully */
- void dispose();
-
- /* this is only needed as a workaround, use only if you know
- * what you are doing */
- status_t setDevice(const char* device) {
- if (mDevice == 0)
- mDevice = device;
- return mDevice ? NO_ERROR : ALREADY_EXISTS;
- }
-
-protected:
- MemoryHeapBase();
- // init() takes ownership of fd
- status_t init(int fd, void *base, int size,
- int flags = 0, const char* device = NULL);
-
-private:
- status_t mapfd(int fd, size_t size, uint32_t offset = 0);
-
- int mFD;
- size_t mSize;
- void* mBase;
- uint32_t mFlags;
- const char* mDevice;
- bool mNeedUnmap;
- uint32_t mOffset;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_MEMORY_HEAP_BASE_H
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
deleted file mode 100644
index 33b2f00..0000000
--- a/include/binder/Parcel.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_PARCEL_H
-#define ANDROID_PARCEL_H
-
-#include <cutils/native_handle.h>
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/String16.h>
-#include <utils/Vector.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class Flattenable;
-class IBinder;
-class IPCThreadState;
-class ProcessState;
-class String8;
-class TextOutput;
-
-struct flat_binder_object; // defined in support_p/binder_module.h
-
-class Parcel
-{
-public:
- class ReadableBlob;
- class WritableBlob;
-
- Parcel();
- ~Parcel();
-
- const uint8_t* data() const;
- size_t dataSize() const;
- size_t dataAvail() const;
- size_t dataPosition() const;
- size_t dataCapacity() const;
-
- status_t setDataSize(size_t size);
- void setDataPosition(size_t pos) const;
- status_t setDataCapacity(size_t size);
-
- status_t setData(const uint8_t* buffer, size_t len);
-
- status_t appendFrom(const Parcel *parcel,
- size_t start, size_t len);
-
- bool pushAllowFds(bool allowFds);
- void restoreAllowFds(bool lastValue);
-
- bool hasFileDescriptors() const;
-
- // Writes the RPC header.
- status_t writeInterfaceToken(const String16& interface);
-
- // Parses the RPC header, returning true if the interface name
- // in the header matches the expected interface from the caller.
- //
- // Additionally, enforceInterface does part of the work of
- // propagating the StrictMode policy mask, populating the current
- // IPCThreadState, which as an optimization may optionally be
- // passed in.
- bool enforceInterface(const String16& interface,
- IPCThreadState* threadState = NULL) const;
- bool checkInterface(IBinder*) const;
-
- void freeData();
-
- const size_t* objects() const;
- size_t objectsCount() const;
-
- status_t errorCheck() const;
- void setError(status_t err);
-
- status_t write(const void* data, size_t len);
- void* writeInplace(size_t len);
- status_t writeUnpadded(const void* data, size_t len);
- status_t writeInt32(int32_t val);
- status_t writeInt64(int64_t val);
- status_t writeFloat(float val);
- status_t writeDouble(double val);
- status_t writeIntPtr(intptr_t val);
- status_t writeCString(const char* str);
- status_t writeString8(const String8& str);
- status_t writeString16(const String16& str);
- status_t writeString16(const char16_t* str, size_t len);
- status_t writeStrongBinder(const sp<IBinder>& val);
- status_t writeWeakBinder(const wp<IBinder>& val);
- status_t write(const Flattenable& val);
-
- // Place a native_handle into the parcel (the native_handle's file-
- // descriptors are dup'ed, so it is safe to delete the native_handle
- // when this function returns).
- // Doesn't take ownership of the native_handle.
- status_t writeNativeHandle(const native_handle* handle);
-
- // Place a file descriptor into the parcel. The given fd must remain
- // valid for the lifetime of the parcel.
- // The Parcel does not take ownership of the given fd unless you ask it to.
- status_t writeFileDescriptor(int fd, bool takeOwnership = false);
-
- // Place a file descriptor into the parcel. A dup of the fd is made, which
- // will be closed once the parcel is destroyed.
- status_t writeDupFileDescriptor(int fd);
-
- // Writes a blob to the parcel.
- // If the blob is small, then it is stored in-place, otherwise it is
- // transferred by way of an anonymous shared memory region.
- // The caller should call release() on the blob after writing its contents.
- status_t writeBlob(size_t len, WritableBlob* outBlob);
-
- status_t writeObject(const flat_binder_object& val, bool nullMetaData);
-
- // Like Parcel.java's writeNoException(). Just writes a zero int32.
- // Currently the native implementation doesn't do any of the StrictMode
- // stack gathering and serialization that the Java implementation does.
- status_t writeNoException();
-
- void remove(size_t start, size_t amt);
-
- status_t read(void* outData, size_t len) const;
- const void* readInplace(size_t len) const;
- int32_t readInt32() const;
- status_t readInt32(int32_t *pArg) const;
- int64_t readInt64() const;
- status_t readInt64(int64_t *pArg) const;
- float readFloat() const;
- status_t readFloat(float *pArg) const;
- double readDouble() const;
- status_t readDouble(double *pArg) const;
- intptr_t readIntPtr() const;
- status_t readIntPtr(intptr_t *pArg) const;
-
- const char* readCString() const;
- String8 readString8() const;
- String16 readString16() const;
- const char16_t* readString16Inplace(size_t* outLen) const;
- sp<IBinder> readStrongBinder() const;
- wp<IBinder> readWeakBinder() const;
- status_t read(Flattenable& val) const;
-
- // Like Parcel.java's readExceptionCode(). Reads the first int32
- // off of a Parcel's header, returning 0 or the negative error
- // code on exceptions, but also deals with skipping over rich
- // response headers. Callers should use this to read & parse the
- // response headers rather than doing it by hand.
- int32_t readExceptionCode() const;
-
- // Retrieve native_handle from the parcel. This returns a copy of the
- // parcel's native_handle (the caller takes ownership). The caller
- // must free the native_handle with native_handle_close() and
- // native_handle_delete().
- native_handle* readNativeHandle() const;
-
-
- // Retrieve a file descriptor from the parcel. This returns the raw fd
- // in the parcel, which you do not own -- use dup() to get your own copy.
- int readFileDescriptor() const;
-
- // Reads a blob from the parcel.
- // The caller should call release() on the blob after reading its contents.
- status_t readBlob(size_t len, ReadableBlob* outBlob) const;
-
- const flat_binder_object* readObject(bool nullMetaData) const;
-
- // Explicitly close all file descriptors in the parcel.
- void closeFileDescriptors();
-
- typedef void (*release_func)(Parcel* parcel,
- const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsSize,
- void* cookie);
-
- const uint8_t* ipcData() const;
- size_t ipcDataSize() const;
- const size_t* ipcObjects() const;
- size_t ipcObjectsCount() const;
- void ipcSetDataReference(const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsCount,
- release_func relFunc, void* relCookie);
-
- void print(TextOutput& to, uint32_t flags = 0) const;
-
-private:
- Parcel(const Parcel& o);
- Parcel& operator=(const Parcel& o);
-
- status_t finishWrite(size_t len);
- void releaseObjects();
- void acquireObjects();
- status_t growData(size_t len);
- status_t restartWrite(size_t desired);
- status_t continueWrite(size_t desired);
- void freeDataNoInit();
- void initState();
- void scanForFds() const;
-
- template<class T>
- status_t readAligned(T *pArg) const;
-
- template<class T> T readAligned() const;
-
- template<class T>
- status_t writeAligned(T val);
-
- status_t mError;
- uint8_t* mData;
- size_t mDataSize;
- size_t mDataCapacity;
- mutable size_t mDataPos;
- size_t* mObjects;
- size_t mObjectsSize;
- size_t mObjectsCapacity;
- mutable size_t mNextObjectHint;
-
- mutable bool mFdsKnown;
- mutable bool mHasFds;
- bool mAllowFds;
-
- release_func mOwner;
- void* mOwnerCookie;
-
- class Blob {
- public:
- Blob();
- ~Blob();
-
- void release();
- inline size_t size() const { return mSize; }
-
- protected:
- void init(bool mapped, void* data, size_t size);
- void clear();
-
- bool mMapped;
- void* mData;
- size_t mSize;
- };
-
-public:
- class ReadableBlob : public Blob {
- friend class Parcel;
- public:
- inline const void* data() const { return mData; }
- };
-
- class WritableBlob : public Blob {
- friend class Parcel;
- public:
- inline void* data() { return mData; }
- };
-};
-
-// ---------------------------------------------------------------------------
-
-inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel)
-{
- parcel.print(to);
- return to;
-}
-
-// ---------------------------------------------------------------------------
-
-// Generic acquire and release of objects.
-void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who);
-void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who);
-
-void flatten_binder(const sp<ProcessState>& proc,
- const sp<IBinder>& binder, flat_binder_object* out);
-void flatten_binder(const sp<ProcessState>& proc,
- const wp<IBinder>& binder, flat_binder_object* out);
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const flat_binder_object& flat, sp<IBinder>* out);
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const flat_binder_object& flat, wp<IBinder>* out);
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_PARCEL_H
diff --git a/include/binder/PermissionCache.h b/include/binder/PermissionCache.h
deleted file mode 100644
index 1171d48..0000000
--- a/include/binder/PermissionCache.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef BINDER_PERMISSION_H
-#define BINDER_PERMISSION_H
-
-#include <stdint.h>
-#include <unistd.h>
-
-#include <utils/String16.h>
-#include <utils/Singleton.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-/*
- * PermissionCache caches permission checks for a given uid.
- *
- * Currently the cache is not updated when there is a permission change,
- * for instance when an application is uninstalled.
- *
- * IMPORTANT: for the reason stated above, only system permissions are safe
- * to cache. This restriction may be lifted at a later time.
- *
- */
-
-class PermissionCache : Singleton<PermissionCache> {
- struct Entry {
- String16 name;
- uid_t uid;
- bool granted;
- inline bool operator < (const Entry& e) const {
- return (uid == e.uid) ? (name < e.name) : (uid < e.uid);
- }
- };
- mutable Mutex mLock;
- // we pool all the permission names we see, as many permissions checks
- // will have identical names
- SortedVector< String16 > mPermissionNamesPool;
- // this is our cache per say. it stores pooled names.
- SortedVector< Entry > mCache;
-
- // free the whole cache, but keep the permission name pool
- void purge();
-
- status_t check(bool* granted,
- const String16& permission, uid_t uid) const;
-
- void cache(const String16& permission, uid_t uid, bool granted);
-
-public:
- PermissionCache();
-
- static bool checkCallingPermission(const String16& permission);
-
- static bool checkCallingPermission(const String16& permission,
- int32_t* outPid, int32_t* outUid);
-
- static bool checkPermission(const String16& permission,
- pid_t pid, uid_t uid);
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif /* BINDER_PERMISSION_H */
diff --git a/include/binder/ProcessState.h b/include/binder/ProcessState.h
deleted file mode 100644
index 9725822..0000000
--- a/include/binder/ProcessState.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_PROCESS_STATE_H
-#define ANDROID_PROCESS_STATE_H
-
-#include <binder/IBinder.h>
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include <utils/String16.h>
-
-#include <utils/threads.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-// Global variables
-extern int mArgC;
-extern const char* const* mArgV;
-extern int mArgLen;
-
-class IPCThreadState;
-
-class ProcessState : public virtual RefBase
-{
-public:
- static sp<ProcessState> self();
-
- void setContextObject(const sp<IBinder>& object);
- sp<IBinder> getContextObject(const sp<IBinder>& caller);
-
- void setContextObject(const sp<IBinder>& object,
- const String16& name);
- sp<IBinder> getContextObject(const String16& name,
- const sp<IBinder>& caller);
-
- void startThreadPool();
-
- typedef bool (*context_check_func)(const String16& name,
- const sp<IBinder>& caller,
- void* userData);
-
- bool isContextManager(void) const;
- bool becomeContextManager(
- context_check_func checkFunc,
- void* userData);
-
- sp<IBinder> getStrongProxyForHandle(int32_t handle);
- wp<IBinder> getWeakProxyForHandle(int32_t handle);
- void expungeHandle(int32_t handle, IBinder* binder);
-
- void setArgs(int argc, const char* const argv[]);
- int getArgC() const;
- const char* const* getArgV() const;
-
- void setArgV0(const char* txt);
-
- void spawnPooledThread(bool isMain);
-
-private:
- friend class IPCThreadState;
-
- ProcessState();
- ~ProcessState();
-
- ProcessState(const ProcessState& o);
- ProcessState& operator=(const ProcessState& o);
-
- struct handle_entry {
- IBinder* binder;
- RefBase::weakref_type* refs;
- };
-
- handle_entry* lookupHandleLocked(int32_t handle);
-
- int mDriverFD;
- void* mVMStart;
-
- mutable Mutex mLock; // protects everything below.
-
- Vector<handle_entry>mHandleToObject;
-
- bool mManagesContexts;
- context_check_func mBinderContextCheckFunc;
- void* mBinderContextUserData;
-
- KeyedVector<String16, sp<IBinder> >
- mContexts;
-
-
- String8 mRootDir;
- bool mThreadPoolStarted;
- volatile int32_t mThreadPoolSeq;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_PROCESS_STATE_H
diff --git a/include/gui/BitTube.h b/include/gui/BitTube.h
deleted file mode 100644
index 76389a0..0000000
--- a/include/gui/BitTube.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SENSOR_CHANNEL_H
-#define ANDROID_GUI_SENSOR_CHANNEL_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-
-namespace android {
-// ----------------------------------------------------------------------------
-class Parcel;
-
-class BitTube : public RefBase
-{
-public:
-
- BitTube();
- BitTube(const Parcel& data);
- virtual ~BitTube();
-
- status_t initCheck() const;
- int getFd() const;
- ssize_t write(void const* vaddr, size_t size);
- ssize_t read(void* vaddr, size_t size);
-
- status_t writeToParcel(Parcel* reply) const;
-
-private:
- int mSendFd;
- mutable int mReceiveFd;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SENSOR_CHANNEL_H
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
deleted file mode 100644
index 8c21a28..0000000
--- a/include/gui/BufferQueue.h
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_BUFFERQUEUE_H
-#define ANDROID_GUI_BUFFERQUEUE_H
-
-#include <EGL/egl.h>
-
-#include <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceTexture.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-#include <utils/threads.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class BufferQueue : public BnSurfaceTexture {
-public:
- enum { MIN_UNDEQUEUED_BUFFERS = 2 };
- enum {
- MIN_ASYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS + 1,
- MIN_SYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS
- };
- enum { NUM_BUFFER_SLOTS = 32 };
- enum { NO_CONNECTED_API = 0 };
- enum { INVALID_BUFFER_SLOT = -1 };
-
- struct FrameAvailableListener : public virtual RefBase {
- // onFrameAvailable() is called from queueBuffer() each time an
- // additional frame becomes available for consumption. This means that
- // frames that are queued while in asynchronous mode only trigger the
- // callback if no previous frames are pending. Frames queued while in
- // synchronous mode always trigger the callback.
- //
- // This is called without any lock held and can be called concurrently
- // by multiple threads.
- virtual void onFrameAvailable() = 0;
- };
-
- // BufferQueue manages a pool of gralloc memory slots to be used
- // by producers and consumers.
- // allowSynchronousMode specifies whether or not synchronous mode can be
- // enabled.
- BufferQueue(bool allowSynchronousMode = true);
- virtual ~BufferQueue();
-
- virtual int query(int what, int* value);
-
- // setBufferCount updates the number of available buffer slots. After
- // calling this all buffer slots are both unallocated and owned by the
- // BufferQueue object (i.e. they are not owned by the client).
- virtual status_t setBufferCount(int bufferCount);
-
- virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf);
-
- // dequeueBuffer gets the next buffer slot index for the client to use. If a
- // buffer slot is available then that slot index is written to the location
- // pointed to by the buf argument and a status of OK is returned. If no
- // slot is available then a status of -EBUSY is returned and buf is
- // unmodified.
- // The width and height parameters must be no greater than the minimum of
- // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
- // An error due to invalid dimensions might not be reported until
- // updateTexImage() is called.
- virtual status_t dequeueBuffer(int *buf, uint32_t width, uint32_t height,
- uint32_t format, uint32_t usage);
-
- // queueBuffer returns a filled buffer to the BufferQueue. In addition, a
- // timestamp must be provided for the buffer. The timestamp is in
- // nanoseconds, and must be monotonically increasing. Its other semantics
- // (zero point, etc) are client-dependent and should be documented by the
- // client.
- virtual status_t queueBuffer(int buf, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
- virtual void cancelBuffer(int buf);
- virtual status_t setCrop(const Rect& reg);
- virtual status_t setTransform(uint32_t transform);
- virtual status_t setScalingMode(int mode);
-
- // setSynchronousMode set whether dequeueBuffer is synchronous or
- // asynchronous. In synchronous mode, dequeueBuffer blocks until
- // a buffer is available, the currently bound buffer can be dequeued and
- // queued buffers will be retired in order.
- // The default mode is asynchronous.
- virtual status_t setSynchronousMode(bool enabled);
-
- // connect attempts to connect a producer client API to the BufferQueue.
- // This must be called before any other ISurfaceTexture methods are called
- // except for getAllocator.
- //
- // This method will fail if the connect was previously called on the
- // BufferQueue and no corresponding disconnect call was made.
- virtual status_t connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
-
- // disconnect attempts to disconnect a producer client API from the
- // BufferQueue. Calling this method will cause any subsequent calls to other
- // ISurfaceTexture methods to fail except for getAllocator and connect.
- // Successfully calling connect after this will allow the other methods to
- // succeed again.
- //
- // This method will fail if the the BufferQueue is not currently
- // connected to the specified client API.
- virtual status_t disconnect(int api);
-
- // dump our state in a String
- virtual void dump(String8& result) const;
- virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
-
- // public facing structure for BufferSlot
- struct BufferItem {
-
- BufferItem()
- :
- mTransform(0),
- mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
- mTimestamp(0),
- mFrameNumber(0),
- mBuf(INVALID_BUFFER_SLOT) {
- mCrop.makeInvalid();
- }
- // mGraphicBuffer points to the buffer allocated for this slot or is NULL
- // if no buffer has been allocated.
- sp<GraphicBuffer> mGraphicBuffer;
-
- // mCrop is the current crop rectangle for this buffer slot. This gets
- // set to mNextCrop each time queueBuffer gets called for this buffer.
- Rect mCrop;
-
- // mTransform is the current transform flags for this buffer slot. This
- // gets set to mNextTransform each time queueBuffer gets called for this
- // slot.
- uint32_t mTransform;
-
- // mScalingMode is the current scaling mode for this buffer slot. This
- // gets set to mNextScalingMode each time queueBuffer gets called for
- // this slot.
- uint32_t mScalingMode;
-
- // mTimestamp is the current timestamp for this buffer slot. This gets
- // to set by queueBuffer each time this slot is queued.
- int64_t mTimestamp;
-
- // mFrameNumber is the number of the queued frame for this slot.
- uint64_t mFrameNumber;
-
- // buf is the slot index of this buffer
- int mBuf;
-
- };
-
- // The following public functions is the consumer facing interface
-
- // acquire consumes a buffer by transferring its ownership to a consumer.
- // buffer contains the GraphicBuffer and its corresponding information.
- // buffer.mGraphicsBuffer will be NULL when the buffer has been already
- // acquired by the consumer.
-
- status_t acquire(BufferItem *buffer);
-
- // releaseBuffer releases a buffer slot from the consumer back to the
- // BufferQueue pending a fence sync.
- status_t releaseBuffer(int buf, EGLDisplay display, EGLSyncKHR fence);
-
- // consumerDisconnect disconnects a consumer from the BufferQueue. All
- // buffers will be freed.
- status_t consumerDisconnect();
-
- // setDefaultBufferSize is used to set the size of buffers returned by
- // requestBuffers when a with and height of zero is requested.
- status_t setDefaultBufferSize(uint32_t w, uint32_t h);
-
- // setBufferCountServer set the buffer count. If the client has requested
- // a buffer count using setBufferCount, the server-buffer count will
- // take effect once the client sets the count back to zero.
- status_t setBufferCountServer(int bufferCount);
-
- // isSynchronousMode returns whether the SurfaceTexture is currently in
- // synchronous mode.
- bool isSynchronousMode() const;
-
- // setConsumerName sets the name used in logging
- void setConsumerName(const String8& name);
-
- // setFrameAvailableListener sets the listener object that will be notified
- // when a new frame becomes available.
- void setFrameAvailableListener(const sp<FrameAvailableListener>& listener);
-
-
-private:
- // freeBufferLocked frees the resources (both GraphicBuffer and EGLImage)
- // for the given slot.
- void freeBufferLocked(int index);
-
- // freeAllBuffersLocked frees the resources (both GraphicBuffer and
- // EGLImage) for all slots.
- void freeAllBuffersLocked();
-
- // freeAllBuffersExceptHeadLocked frees the resources (both GraphicBuffer
- // and EGLImage) for all slots except the head of mQueue
- void freeAllBuffersExceptHeadLocked();
-
- // drainQueueLocked drains the buffer queue if we're in synchronous mode
- // returns immediately otherwise. It returns NO_INIT if the BufferQueue
- // became abandoned or disconnected during this call.
- status_t drainQueueLocked();
-
- // drainQueueAndFreeBuffersLocked drains the buffer queue if we're in
- // synchronous mode and free all buffers. In asynchronous mode, all buffers
- // are freed except the current buffer.
- status_t drainQueueAndFreeBuffersLocked();
-
- status_t setBufferCountServerLocked(int bufferCount);
-
- struct BufferSlot {
-
- BufferSlot()
- : mEglDisplay(EGL_NO_DISPLAY),
- mBufferState(BufferSlot::FREE),
- mRequestBufferCalled(false),
- mTransform(0),
- mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
- mTimestamp(0),
- mFrameNumber(0),
- mFence(EGL_NO_SYNC_KHR),
- mAcquireCalled(false) {
- mCrop.makeInvalid();
- }
-
- // mGraphicBuffer points to the buffer allocated for this slot or is NULL
- // if no buffer has been allocated.
- sp<GraphicBuffer> mGraphicBuffer;
-
- // mEglDisplay is the EGLDisplay used to create mEglImage.
- EGLDisplay mEglDisplay;
-
- // BufferState represents the different states in which a buffer slot
- // can be.
- enum BufferState {
- // FREE indicates that the buffer is not currently being used and
- // will not be used in the future until it gets dequeued and
- // subsequently queued by the client.
- // aka "owned by BufferQueue, ready to be dequeued"
- FREE = 0,
-
- // DEQUEUED indicates that the buffer has been dequeued by the
- // client, but has not yet been queued or canceled. The buffer is
- // considered 'owned' by the client, and the server should not use
- // it for anything.
- //
- // Note that when in synchronous-mode (mSynchronousMode == true),
- // the buffer that's currently attached to the texture may be
- // dequeued by the client. That means that the current buffer can
- // be in either the DEQUEUED or QUEUED state. In asynchronous mode,
- // however, the current buffer is always in the QUEUED state.
- // aka "owned by producer, ready to be queued"
- DEQUEUED = 1,
-
- // QUEUED indicates that the buffer has been queued by the client,
- // and has not since been made available for the client to dequeue.
- // Attaching the buffer to the texture does NOT transition the
- // buffer away from the QUEUED state. However, in Synchronous mode
- // the current buffer may be dequeued by the client under some
- // circumstances. See the note about the current buffer in the
- // documentation for DEQUEUED.
- // aka "owned by BufferQueue, ready to be acquired"
- QUEUED = 2,
-
- // aka "owned by consumer, ready to be released"
- ACQUIRED = 3
- };
-
- // mBufferState is the current state of this buffer slot.
- BufferState mBufferState;
-
- // mRequestBufferCalled is used for validating that the client did
- // call requestBuffer() when told to do so. Technically this is not
- // needed but useful for debugging and catching client bugs.
- bool mRequestBufferCalled;
-
- // mCrop is the current crop rectangle for this buffer slot. This gets
- // set to mNextCrop each time queueBuffer gets called for this buffer.
- Rect mCrop;
-
- // mTransform is the current transform flags for this buffer slot. This
- // gets set to mNextTransform each time queueBuffer gets called for this
- // slot.
- uint32_t mTransform;
-
- // mScalingMode is the current scaling mode for this buffer slot. This
- // gets set to mNextScalingMode each time queueBuffer gets called for
- // this slot.
- uint32_t mScalingMode;
-
- // mTimestamp is the current timestamp for this buffer slot. This gets
- // to set by queueBuffer each time this slot is queued.
- int64_t mTimestamp;
-
- // mFrameNumber is the number of the queued frame for this slot.
- uint64_t mFrameNumber;
-
- // mFence is the EGL sync object that must signal before the buffer
- // associated with this buffer slot may be dequeued. It is initialized
- // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based
- // on a compile-time option) set to a new sync object in updateTexImage.
- EGLSyncKHR mFence;
-
- // Indicates whether this buffer has been seen by a consumer yet
- bool mAcquireCalled;
- };
-
- // mSlots is the array of buffer slots that must be mirrored on the client
- // side. This allows buffer ownership to be transferred between the client
- // and server without sending a GraphicBuffer over binder. The entire array
- // is initialized to NULL at construction time, and buffers are allocated
- // for a slot when requestBuffer is called with that slot's index.
- BufferSlot mSlots[NUM_BUFFER_SLOTS];
-
- // mDefaultWidth holds the default width of allocated buffers. It is used
- // in requestBuffers() if a width and height of zero is specified.
- uint32_t mDefaultWidth;
-
- // mDefaultHeight holds the default height of allocated buffers. It is used
- // in requestBuffers() if a width and height of zero is specified.
- uint32_t mDefaultHeight;
-
- // mPixelFormat holds the pixel format of allocated buffers. It is used
- // in requestBuffers() if a format of zero is specified.
- uint32_t mPixelFormat;
-
- // mBufferCount is the number of buffer slots that the client and server
- // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed
- // by calling setBufferCount or setBufferCountServer
- int mBufferCount;
-
- // mClientBufferCount is the number of buffer slots requested by the client.
- // The default is zero, which means the client doesn't care how many buffers
- // there is.
- int mClientBufferCount;
-
- // mServerBufferCount buffer count requested by the server-side
- int mServerBufferCount;
-
- // mNextCrop is the crop rectangle that will be used for the next buffer
- // that gets queued. It is set by calling setCrop.
- Rect mNextCrop;
-
- // mNextTransform is the transform identifier that will be used for the next
- // buffer that gets queued. It is set by calling setTransform.
- uint32_t mNextTransform;
-
- // mNextScalingMode is the scaling mode that will be used for the next
- // buffers that get queued. It is set by calling setScalingMode.
- int mNextScalingMode;
-
- // mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to
- // allocate new GraphicBuffer objects.
- sp<IGraphicBufferAlloc> mGraphicBufferAlloc;
-
- // mFrameAvailableListener is the listener object that will be called when a
- // new frame becomes available. If it is not NULL it will be called from
- // queueBuffer.
- sp<FrameAvailableListener> mFrameAvailableListener;
-
- // mSynchronousMode whether we're in synchronous mode or not
- bool mSynchronousMode;
-
- // mAllowSynchronousMode whether we allow synchronous mode or not
- const bool mAllowSynchronousMode;
-
- // mConnectedApi indicates the API that is currently connected to this
- // BufferQueue. It defaults to NO_CONNECTED_API (= 0), and gets updated
- // by the connect and disconnect methods.
- int mConnectedApi;
-
- // mDequeueCondition condition used for dequeueBuffer in synchronous mode
- mutable Condition mDequeueCondition;
-
- // mQueue is a FIFO of queued buffers used in synchronous mode
- typedef Vector<int> Fifo;
- Fifo mQueue;
-
- // mAbandoned indicates that the BufferQueue will no longer be used to
- // consume images buffers pushed to it using the ISurfaceTexture interface.
- // It is initialized to false, and set to true in the abandon method. A
- // BufferQueue that has been abandoned will return the NO_INIT error from
- // all ISurfaceTexture methods capable of returning an error.
- bool mAbandoned;
-
- // mName is a string used to identify the BufferQueue in log messages.
- // It is set by the setName method.
- String8 mConsumerName;
-
- // mMutex is the mutex used to prevent concurrent access to the member
- // variables of BufferQueue objects. It must be locked whenever the
- // member variables are accessed.
- mutable Mutex mMutex;
-
- // mFrameCounter is the free running counter, incremented for every buffer queued
- // with the surface Texture.
- uint64_t mFrameCounter;
-
- bool mBufferHasBeenQueued;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_BUFFERQUEUE_H
diff --git a/include/gui/DisplayEventReceiver.h b/include/gui/DisplayEventReceiver.h
deleted file mode 100644
index 7bca8d6..0000000
--- a/include/gui/DisplayEventReceiver.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_DISPLAY_EVENT_H
-#define ANDROID_GUI_DISPLAY_EVENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-
-#include <binder/IInterface.h>
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-class BitTube;
-class IDisplayEventConnection;
-
-// ----------------------------------------------------------------------------
-
-class DisplayEventReceiver {
-public:
- enum {
- DISPLAY_EVENT_VSYNC = 'vsyn'
- };
-
- struct Event {
-
- struct Header {
- uint32_t type;
- nsecs_t timestamp;
- };
-
- struct VSync {
- uint32_t count;
- };
-
- Header header;
- union {
- VSync vsync;
- };
- };
-
-public:
- /*
- * DisplayEventReceiver creates and registers an event connection with
- * SurfaceFlinger. VSync events are disabled by default. Call setVSyncRate
- * or requestNextVsync to receive them.
- * Other events start being delivered immediately.
- */
- DisplayEventReceiver();
-
- /*
- * ~DisplayEventReceiver severs the connection with SurfaceFlinger, new events
- * stop being delivered immediately. Note that the queue could have
- * some events pending. These will be delivered.
- */
- ~DisplayEventReceiver();
-
- /*
- * initCheck returns the state of DisplayEventReceiver after construction.
- */
- status_t initCheck() const;
-
- /*
- * getFd returns the file descriptor to use to receive events.
- * OWNERSHIP IS RETAINED by DisplayEventReceiver. DO NOT CLOSE this
- * file-descriptor.
- */
- int getFd() const;
-
- /*
- * getEvents reads event from the queue and returns how many events were
- * read. Returns 0 if there are no more events or a negative error code.
- * If NOT_ENOUGH_DATA is returned, the object has become invalid forever, it
- * should be destroyed and getEvents() shouldn't be called again.
- */
- ssize_t getEvents(Event* events, size_t count);
- static ssize_t getEvents(const sp<BitTube>& dataChannel,
- Event* events, size_t count);
-
- /*
- * setVsyncRate() sets the Event::VSync delivery rate. A value of
- * 1 returns every Event::VSync. A value of 2 returns every other event,
- * etc... a value of 0 returns no event unless requestNextVsync() has
- * been called.
- */
- status_t setVsyncRate(uint32_t count);
-
- /*
- * requestNextVsync() schedules the next Event::VSync. It has no effect
- * if the vsync rate is > 0.
- */
- status_t requestNextVsync();
-
-private:
- sp<IDisplayEventConnection> mEventConnection;
- sp<BitTube> mDataChannel;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_DISPLAY_EVENT_H
diff --git a/include/gui/IDisplayEventConnection.h b/include/gui/IDisplayEventConnection.h
deleted file mode 100644
index 86247de..0000000
--- a/include/gui/IDisplayEventConnection.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
-#define ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class BitTube;
-
-class IDisplayEventConnection : public IInterface
-{
-public:
-
- DECLARE_META_INTERFACE(DisplayEventConnection);
-
- /*
- * getDataChannel() returns a BitTube where to receive the events from
- */
- virtual sp<BitTube> getDataChannel() const = 0;
-
- /*
- * setVsyncRate() sets the vsync event delivery rate. A value of
- * 1 returns every vsync events. A value of 2 returns every other events,
- * etc... a value of 0 returns no event unless requestNextVsync() has
- * been called.
- */
- virtual void setVsyncRate(uint32_t count) = 0;
-
- /*
- * requestNextVsync() schedules the next vsync event. It has no effect
- * if the vsync rate is > 0.
- */
- virtual void requestNextVsync() = 0; // asynchronous
-};
-
-// ----------------------------------------------------------------------------
-
-class BnDisplayEventConnection : public BnInterface<IDisplayEventConnection>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h
deleted file mode 100644
index cee41d9..0000000
--- a/include/gui/IGraphicBufferAlloc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
-#define ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IInterface.h>
-#include <ui/PixelFormat.h>
-#include <utils/RefBase.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class GraphicBuffer;
-
-class IGraphicBufferAlloc : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(GraphicBufferAlloc);
-
- /* Create a new GraphicBuffer for the client to use.
- */
- virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t usage, status_t* error) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnGraphicBufferAlloc : public BnInterface<IGraphicBufferAlloc>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
diff --git a/include/gui/ISensorEventConnection.h b/include/gui/ISensorEventConnection.h
deleted file mode 100644
index 749065e..0000000
--- a/include/gui/ISensorEventConnection.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H
-#define ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class BitTube;
-
-class ISensorEventConnection : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SensorEventConnection);
-
- virtual sp<BitTube> getSensorChannel() const = 0;
- virtual status_t enableDisable(int handle, bool enabled) = 0;
- virtual status_t setEventRate(int handle, nsecs_t ns) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSensorEventConnection : public BnInterface<ISensorEventConnection>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H
diff --git a/include/gui/ISensorServer.h b/include/gui/ISensorServer.h
deleted file mode 100644
index 9c8afc5..0000000
--- a/include/gui/ISensorServer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_ISENSORSERVER_H
-#define ANDROID_GUI_ISENSORSERVER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class Sensor;
-class ISensorEventConnection;
-
-class ISensorServer : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SensorServer);
-
- virtual Vector<Sensor> getSensorList() = 0;
- virtual sp<ISensorEventConnection> createSensorEventConnection() = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSensorServer : public BnInterface<ISensorServer>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_ISENSORSERVER_H
diff --git a/include/gui/ISurface.h b/include/gui/ISurface.h
deleted file mode 100644
index c0ff9fc..0000000
--- a/include/gui/ISurface.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_ISURFACE_H
-#define ANDROID_GUI_ISURFACE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/PixelFormat.h>
-
-namespace android {
-
-typedef int32_t SurfaceID;
-
-class ISurfaceTexture;
-
-class ISurface : public IInterface
-{
-protected:
- enum {
- GET_SURFACE_TEXTURE = IBinder::FIRST_CALL_TRANSACTION,
- };
-
-public:
- DECLARE_META_INTERFACE(Surface);
-
- virtual sp<ISurfaceTexture> getSurfaceTexture() const = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurface : public BnInterface<ISurface>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACE_H
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h
deleted file mode 100644
index f3c0ecb..0000000
--- a/include/gui/ISurfaceComposer.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_ISURFACE_COMPOSER_H
-#define ANDROID_GUI_ISURFACE_COMPOSER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/RefBase.h>
-#include <utils/Errors.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/PixelFormat.h>
-
-#include <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceComposerClient.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class ComposerState;
-class IDisplayEventConnection;
-class IMemoryHeap;
-
-class ISurfaceComposer : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SurfaceComposer);
-
- enum { // (keep in sync with Surface.java)
- eHidden = 0x00000004,
- eDestroyBackbuffer = 0x00000020,
- eSecure = 0x00000080,
- eNonPremultiplied = 0x00000100,
- eOpaque = 0x00000400,
- eProtectedByApp = 0x00000800,
- eProtectedByDRM = 0x00001000,
-
- eFXSurfaceNormal = 0x00000000,
- eFXSurfaceBlur = 0x00010000,
- eFXSurfaceDim = 0x00020000,
- eFXSurfaceScreenshot= 0x00030000,
- eFXSurfaceMask = 0x000F0000,
- };
-
- enum {
- ePositionChanged = 0x00000001,
- eLayerChanged = 0x00000002,
- eSizeChanged = 0x00000004,
- eAlphaChanged = 0x00000008,
- eMatrixChanged = 0x00000010,
- eTransparentRegionChanged = 0x00000020,
- eVisibilityChanged = 0x00000040,
- eFreezeTintChanged = 0x00000080,
- };
-
- enum {
- eLayerHidden = 0x01,
- eLayerFrozen = 0x02,
- eLayerDither = 0x04,
- eLayerFilter = 0x08,
- eLayerBlurFreeze = 0x10
- };
-
- enum {
- eOrientationDefault = 0,
- eOrientation90 = 1,
- eOrientation180 = 2,
- eOrientation270 = 3,
- eOrientationUnchanged = 4,
- eOrientationSwapMask = 0x01
- };
-
- enum {
- eSynchronous = 0x01,
- };
-
- enum {
- eElectronBeamAnimationOn = 0x01,
- eElectronBeamAnimationOff = 0x10
- };
-
- /* create connection with surface flinger, requires
- * ACCESS_SURFACE_FLINGER permission
- */
- virtual sp<ISurfaceComposerClient> createConnection() = 0;
-
- /* create a graphic buffer allocator
- */
- virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
-
- /* retrieve the control block */
- virtual sp<IMemoryHeap> getCblk() const = 0;
-
- /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
- virtual void setTransactionState(const Vector<ComposerState>& state,
- int orientation, uint32_t flags) = 0;
-
- /* signal that we're done booting.
- * Requires ACCESS_SURFACE_FLINGER permission
- */
- virtual void bootFinished() = 0;
-
- /* Capture the specified screen. requires READ_FRAME_BUFFER permission
- * This function will fail if there is a secure window on screen.
- */
- virtual status_t captureScreen(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* width, uint32_t* height, PixelFormat* format,
- uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ) = 0;
-
- /* triggers screen off animation */
- virtual status_t turnElectronBeamOff(int32_t mode) = 0;
-
- /* triggers screen on animation */
- virtual status_t turnElectronBeamOn(int32_t mode) = 0;
-
- /* verify that an ISurfaceTexture was created by SurfaceFlinger.
- */
- virtual bool authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surface) const = 0;
-
- /* return an IDisplayEventConnection */
- virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
-{
-public:
- enum {
- // Note: BOOT_FINISHED must remain this value, it is called from
- // Java by ActivityManagerService.
- BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
- CREATE_CONNECTION,
- CREATE_GRAPHIC_BUFFER_ALLOC,
- GET_CBLK,
- SET_TRANSACTION_STATE,
- SET_ORIENTATION,
- CAPTURE_SCREEN,
- TURN_ELECTRON_BEAM_OFF,
- TURN_ELECTRON_BEAM_ON,
- AUTHENTICATE_SURFACE,
- CREATE_DISPLAY_EVENT_CONNECTION,
- };
-
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACE_COMPOSER_H
diff --git a/include/gui/ISurfaceComposerClient.h b/include/gui/ISurfaceComposerClient.h
deleted file mode 100644
index c793933..0000000
--- a/include/gui/ISurfaceComposerClient.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
-#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/PixelFormat.h>
-
-#include <gui/ISurface.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-typedef int32_t DisplayID;
-
-// ----------------------------------------------------------------------------
-
-class ISurfaceComposerClient : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SurfaceComposerClient);
-
- struct surface_data_t {
- int32_t token;
- int32_t identity;
- status_t readFromParcel(const Parcel& parcel);
- status_t writeToParcel(Parcel* parcel) const;
- };
-
- /*
- * Requires ACCESS_SURFACE_FLINGER permission
- */
- virtual sp<ISurface> createSurface( surface_data_t* data,
- const String8& name,
- DisplayID display,
- uint32_t w,
- uint32_t h,
- PixelFormat format,
- uint32_t flags) = 0;
-
- /*
- * Requires ACCESS_SURFACE_FLINGER permission
- */
- virtual status_t destroySurface(SurfaceID sid) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h
deleted file mode 100644
index 50626a0..0000000
--- a/include/gui/ISurfaceTexture.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_ISURFACETEXTURE_H
-#define ANDROID_GUI_ISURFACETEXTURE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/GraphicBuffer.h>
-#include <ui/Rect.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class SurfaceTextureClient;
-
-class ISurfaceTexture : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SurfaceTexture);
-
-protected:
- friend class SurfaceTextureClient;
-
- enum {
- BUFFER_NEEDS_REALLOCATION = 0x1,
- RELEASE_ALL_BUFFERS = 0x2,
- };
-
- // requestBuffer requests a new buffer for the given index. The server (i.e.
- // the ISurfaceTexture implementation) assigns the newly created buffer to
- // the given slot index, and the client is expected to mirror the
- // slot->buffer mapping so that it's not necessary to transfer a
- // GraphicBuffer for every dequeue operation.
- virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf) = 0;
-
- // setBufferCount sets the number of buffer slots available. Calling this
- // will also cause all buffer slots to be emptied. The caller should empty
- // its mirrored copy of the buffer slots when calling this method.
- virtual status_t setBufferCount(int bufferCount) = 0;
-
- // dequeueBuffer requests a new buffer slot for the client to use. Ownership
- // of the slot is transfered to the client, meaning that the server will not
- // use the contents of the buffer associated with that slot. The slot index
- // returned may or may not contain a buffer. If the slot is empty the client
- // should call requestBuffer to assign a new buffer to that slot. The client
- // is expected to either call cancelBuffer on the dequeued slot or to fill
- // in the contents of its associated buffer contents and call queueBuffer.
- // If dequeueBuffer return BUFFER_NEEDS_REALLOCATION, the client is
- // expected to call requestBuffer immediately.
- virtual status_t dequeueBuffer(int *slot, uint32_t w, uint32_t h,
- uint32_t format, uint32_t usage) = 0;
-
- // queueBuffer indicates that the client has finished filling in the
- // contents of the buffer associated with slot and transfers ownership of
- // that slot back to the server. It is not valid to call queueBuffer on a
- // slot that is not owned by the client or one for which a buffer associated
- // via requestBuffer. In addition, a timestamp must be provided by the
- // client for this buffer. The timestamp is measured in nanoseconds, and
- // must be monotonically increasing. Its other properties (zero point, etc)
- // are client-dependent, and should be documented by the client.
- //
- // outWidth, outHeight and outTransform are filled with the default width
- // and height of the window and current transform applied to buffers,
- // respectively.
- virtual status_t queueBuffer(int slot, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;
-
- // cancelBuffer indicates that the client does not wish to fill in the
- // buffer associated with slot and transfers ownership of the slot back to
- // the server.
- virtual void cancelBuffer(int slot) = 0;
-
- virtual status_t setCrop(const Rect& reg) = 0;
- virtual status_t setTransform(uint32_t transform) = 0;
- virtual status_t setScalingMode(int mode) = 0;
-
- // query retrieves some information for this surface
- // 'what' tokens allowed are that of android_natives.h
- virtual int query(int what, int* value) = 0;
-
- // setSynchronousMode set whether dequeueBuffer is synchronous or
- // asynchronous. In synchronous mode, dequeueBuffer blocks until
- // a buffer is available, the currently bound buffer can be dequeued and
- // queued buffers will be retired in order.
- // The default mode is asynchronous.
- virtual status_t setSynchronousMode(bool enabled) = 0;
-
- // connect attempts to connect a client API to the SurfaceTexture. This
- // must be called before any other ISurfaceTexture methods are called except
- // for getAllocator.
- //
- // This method will fail if the connect was previously called on the
- // SurfaceTexture and no corresponding disconnect call was made.
- //
- // outWidth, outHeight and outTransform are filled with the default width
- // and height of the window and current transform applied to buffers,
- // respectively.
- virtual status_t connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;
-
- // disconnect attempts to disconnect a client API from the SurfaceTexture.
- // Calling this method will cause any subsequent calls to other
- // ISurfaceTexture methods to fail except for getAllocator and connect.
- // Successfully calling connect after this will allow the other methods to
- // succeed again.
- //
- // This method will fail if the the SurfaceTexture is not currently
- // connected to the specified client API.
- virtual status_t disconnect(int api) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurfaceTexture : public BnInterface<ISurfaceTexture>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACETEXTURE_H
diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h
deleted file mode 100644
index e59757a..0000000
--- a/include/gui/Sensor.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SENSOR_H
-#define ANDROID_GUI_SENSOR_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Flattenable.h>
-#include <utils/String8.h>
-#include <utils/Timers.h>
-
-#include <hardware/sensors.h>
-
-#include <android/sensor.h>
-
-// ----------------------------------------------------------------------------
-// Concrete types for the NDK
-struct ASensor { };
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class Parcel;
-
-// ----------------------------------------------------------------------------
-
-class Sensor : public ASensor, public Flattenable
-{
-public:
- enum {
- TYPE_ACCELEROMETER = ASENSOR_TYPE_ACCELEROMETER,
- TYPE_MAGNETIC_FIELD = ASENSOR_TYPE_MAGNETIC_FIELD,
- TYPE_GYROSCOPE = ASENSOR_TYPE_GYROSCOPE,
- TYPE_LIGHT = ASENSOR_TYPE_LIGHT,
- TYPE_PROXIMITY = ASENSOR_TYPE_PROXIMITY
- };
-
- Sensor();
- Sensor(struct sensor_t const* hwSensor);
- virtual ~Sensor();
-
- const String8& getName() const;
- const String8& getVendor() const;
- int32_t getHandle() const;
- int32_t getType() const;
- float getMinValue() const;
- float getMaxValue() const;
- float getResolution() const;
- float getPowerUsage() const;
- int32_t getMinDelay() const;
- nsecs_t getMinDelayNs() const;
- int32_t getVersion() const;
-
- // Flattenable interface
- virtual size_t getFlattenedSize() const;
- virtual size_t getFdCount() const;
- virtual status_t flatten(void* buffer, size_t size,
- int fds[], size_t count) const;
- virtual status_t unflatten(void const* buffer, size_t size,
- int fds[], size_t count);
-
-private:
- String8 mName;
- String8 mVendor;
- int32_t mHandle;
- int32_t mType;
- float mMinValue;
- float mMaxValue;
- float mResolution;
- float mPower;
- int32_t mMinDelay;
- int32_t mVersion;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SENSOR_H
diff --git a/include/gui/SensorEventQueue.h b/include/gui/SensorEventQueue.h
deleted file mode 100644
index ef7c6e3..0000000
--- a/include/gui/SensorEventQueue.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SENSOR_EVENT_QUEUE_H
-#define ANDROID_SENSOR_EVENT_QUEUE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-
-#include <gui/BitTube.h>
-
-// ----------------------------------------------------------------------------
-
-struct ALooper;
-struct ASensorEvent;
-
-// Concrete types for the NDK
-struct ASensorEventQueue {
- ALooper* looper;
-};
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class ISensorEventConnection;
-class Sensor;
-class Looper;
-
-// ----------------------------------------------------------------------------
-
-class SensorEventQueue : public ASensorEventQueue, public RefBase
-{
-public:
- SensorEventQueue(const sp<ISensorEventConnection>& connection);
- virtual ~SensorEventQueue();
- virtual void onFirstRef();
-
- int getFd() const;
- ssize_t write(ASensorEvent const* events, size_t numEvents);
- ssize_t read(ASensorEvent* events, size_t numEvents);
-
- status_t waitForEvent() const;
- status_t wake() const;
-
- status_t enableSensor(Sensor const* sensor) const;
- status_t disableSensor(Sensor const* sensor) const;
- status_t setEventRate(Sensor const* sensor, nsecs_t ns) const;
-
- // these are here only to support SensorManager.java
- status_t enableSensor(int32_t handle, int32_t us) const;
- status_t disableSensor(int32_t handle) const;
-
-private:
- sp<Looper> getLooper() const;
- sp<ISensorEventConnection> mSensorEventConnection;
- sp<BitTube> mSensorChannel;
- mutable Mutex mLock;
- mutable sp<Looper> mLooper;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_SENSOR_EVENT_QUEUE_H
diff --git a/include/gui/SensorManager.h b/include/gui/SensorManager.h
deleted file mode 100644
index 3176462..0000000
--- a/include/gui/SensorManager.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SENSOR_MANAGER_H
-#define ANDROID_GUI_SENSOR_MANAGER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IBinder.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Singleton.h>
-#include <utils/Vector.h>
-
-#include <gui/SensorEventQueue.h>
-
-// ----------------------------------------------------------------------------
-// Concrete types for the NDK
-struct ASensorManager { };
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class ISensorServer;
-class Sensor;
-class SensorEventQueue;
-
-// ----------------------------------------------------------------------------
-
-class SensorManager :
- public ASensorManager,
- public Singleton<SensorManager>
-{
-public:
- SensorManager();
- ~SensorManager();
-
- ssize_t getSensorList(Sensor const* const** list) const;
- Sensor const* getDefaultSensor(int type);
- sp<SensorEventQueue> createEventQueue();
-
-private:
- // DeathRecipient interface
- void sensorManagerDied();
-
- status_t assertStateLocked() const;
-
-private:
- mutable Mutex mLock;
- mutable sp<ISensorServer> mSensorServer;
- mutable Sensor const** mSensorList;
- mutable Vector<Sensor> mSensors;
- mutable sp<IBinder::DeathRecipient> mDeathObserver;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SENSOR_MANAGER_H
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
deleted file mode 100644
index 1f90c59..0000000
--- a/include/gui/Surface.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SURFACE_H
-#define ANDROID_GUI_SURFACE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/KeyedVector.h>
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-
-#include <ui/PixelFormat.h>
-#include <ui/Region.h>
-
-#include <gui/SurfaceTextureClient.h>
-#include <gui/ISurface.h>
-#include <gui/ISurfaceComposerClient.h>
-
-#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class ISurfaceTexture;
-class Surface;
-class SurfaceComposerClient;
-
-// ---------------------------------------------------------------------------
-
-class SurfaceControl : public RefBase
-{
-public:
- static bool isValid(const sp<SurfaceControl>& surface) {
- return (surface != 0) && surface->isValid();
- }
- bool isValid() {
- return mToken>=0 && mClient!=0;
- }
- static bool isSameSurface(
- const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs);
-
- uint32_t getIdentity() const { return mIdentity; }
-
- // release surface data from java
- void clear();
-
- status_t setLayer(int32_t layer);
- status_t setPosition(int32_t x, int32_t y);
- status_t setSize(uint32_t w, uint32_t h);
- status_t hide();
- status_t show(int32_t layer = -1);
- status_t freeze();
- status_t unfreeze();
- status_t setFlags(uint32_t flags, uint32_t mask);
- status_t setTransparentRegionHint(const Region& transparent);
- status_t setAlpha(float alpha=1.0f);
- status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
- status_t setFreezeTint(uint32_t tint);
-
- static status_t writeSurfaceToParcel(
- const sp<SurfaceControl>& control, Parcel* parcel);
-
- sp<Surface> getSurface() const;
-
-private:
- // can't be copied
- SurfaceControl& operator = (SurfaceControl& rhs);
- SurfaceControl(const SurfaceControl& rhs);
-
- friend class SurfaceComposerClient;
- friend class Surface;
-
- SurfaceControl(
- const sp<SurfaceComposerClient>& client,
- const sp<ISurface>& surface,
- const ISurfaceComposerClient::surface_data_t& data);
-
- ~SurfaceControl();
-
- status_t validate() const;
- void destroy();
-
- sp<SurfaceComposerClient> mClient;
- sp<ISurface> mSurface;
- SurfaceID mToken;
- uint32_t mIdentity;
- mutable Mutex mLock;
-
- mutable sp<Surface> mSurfaceData;
-};
-
-// ---------------------------------------------------------------------------
-
-class Surface : public SurfaceTextureClient
-{
-public:
- struct SurfaceInfo {
- uint32_t w;
- uint32_t h;
- uint32_t s;
- uint32_t usage;
- PixelFormat format;
- void* bits;
- uint32_t reserved[2];
- };
-
- explicit Surface(const sp<ISurfaceTexture>& st);
-
- static status_t writeToParcel(const sp<Surface>& control, Parcel* parcel);
-
- static sp<Surface> readFromParcel(const Parcel& data);
- static bool isValid(const sp<Surface>& surface) {
- return (surface != 0) && surface->isValid();
- }
-
- bool isValid();
- uint32_t getIdentity() const { return mIdentity; }
- sp<ISurfaceTexture> getSurfaceTexture();
-
- // the lock/unlock APIs must be used from the same thread
- status_t lock(SurfaceInfo* info, Region* dirty = NULL);
- status_t unlockAndPost();
-
- sp<IBinder> asBinder() const;
-
-private:
- // this is just to be able to write some unit tests
- friend class Test;
- friend class SurfaceControl;
-
- // can't be copied
- Surface& operator = (Surface& rhs);
- Surface(const Surface& rhs);
-
- explicit Surface(const sp<SurfaceControl>& control);
- Surface(const Parcel& data, const sp<IBinder>& ref);
- ~Surface();
-
- /*
- * private stuff...
- */
- void init(const sp<ISurfaceTexture>& surfaceTexture);
-
- static void cleanCachedSurfacesLocked();
-
- virtual int query(int what, int* value) const;
-
- // constants
- sp<ISurface> mSurface;
- uint32_t mIdentity;
-
- // A cache of Surface objects that have been deserialized into this process.
- static Mutex sCachedSurfacesLock;
- static DefaultKeyedVector<wp<IBinder>, wp<Surface> > sCachedSurfaces;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACE_H
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
deleted file mode 100644
index d971031..0000000
--- a/include/gui/SurfaceComposerClient.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
-#define ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IBinder.h>
-
-#include <utils/RefBase.h>
-#include <utils/Singleton.h>
-#include <utils/SortedVector.h>
-#include <utils/threads.h>
-
-#include <ui/PixelFormat.h>
-
-#include <gui/Surface.h>
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class DisplayInfo;
-class Composer;
-class IMemoryHeap;
-class ISurfaceComposerClient;
-class Region;
-
-// ---------------------------------------------------------------------------
-
-class SurfaceComposerClient : public RefBase
-{
- friend class Composer;
-public:
- SurfaceComposerClient();
- virtual ~SurfaceComposerClient();
-
- // Always make sure we could initialize
- status_t initCheck() const;
-
- // Return the connection of this client
- sp<IBinder> connection() const;
-
- // Forcibly remove connection before all references have gone away.
- void dispose();
-
- // ------------------------------------------------------------------------
- // surface creation / destruction
-
- //! Create a surface
- sp<SurfaceControl> createSurface(
- const String8& name,// name of the surface
- DisplayID display, // Display to create this surface on
- uint32_t w, // width in pixel
- uint32_t h, // height in pixel
- PixelFormat format, // pixel-format desired
- uint32_t flags = 0 // usage flags
- );
-
- sp<SurfaceControl> createSurface(
- DisplayID display, // Display to create this surface on
- uint32_t w, // width in pixel
- uint32_t h, // height in pixel
- PixelFormat format, // pixel-format desired
- uint32_t flags = 0 // usage flags
- );
-
-
- // ------------------------------------------------------------------------
- // Composer parameters
- // All composer parameters must be changed within a transaction
- // several surfaces can be updated in one transaction, all changes are
- // committed at once when the transaction is closed.
- // closeGlobalTransaction() usually requires an IPC with the server.
-
- //! Open a composer transaction on all active SurfaceComposerClients.
- static void openGlobalTransaction();
-
- //! Close a composer transaction on all active SurfaceComposerClients.
- static void closeGlobalTransaction(bool synchronous = false);
-
- //! Freeze the specified display but not transactions.
- static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0);
-
- //! Resume updates on the specified display.
- static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0);
-
- //! Set the orientation of the given display
- static int setOrientation(DisplayID dpy, int orientation, uint32_t flags);
-
- // Query the number of displays
- static ssize_t getNumberOfDisplays();
-
- // Get information about a display
- static status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info);
- static ssize_t getDisplayWidth(DisplayID dpy);
- static ssize_t getDisplayHeight(DisplayID dpy);
- static ssize_t getDisplayOrientation(DisplayID dpy);
-
- status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient,
- void* cookie = NULL, uint32_t flags = 0);
-
- status_t hide(SurfaceID id);
- status_t show(SurfaceID id, int32_t layer = -1);
- status_t freeze(SurfaceID id);
- status_t unfreeze(SurfaceID id);
- status_t setFlags(SurfaceID id, uint32_t flags, uint32_t mask);
- status_t setTransparentRegionHint(SurfaceID id, const Region& transparent);
- status_t setLayer(SurfaceID id, int32_t layer);
- status_t setAlpha(SurfaceID id, float alpha=1.0f);
- status_t setFreezeTint(SurfaceID id, uint32_t tint);
- status_t setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy);
- status_t setPosition(SurfaceID id, float x, float y);
- status_t setSize(SurfaceID id, uint32_t w, uint32_t h);
- status_t destroySurface(SurfaceID sid);
-
-private:
- virtual void onFirstRef();
- Composer& getComposer();
-
- mutable Mutex mLock;
- status_t mStatus;
- sp<ISurfaceComposerClient> mClient;
- Composer& mComposer;
-};
-
-// ---------------------------------------------------------------------------
-
-class ScreenshotClient
-{
- sp<IMemoryHeap> mHeap;
- uint32_t mWidth;
- uint32_t mHeight;
- PixelFormat mFormat;
-public:
- ScreenshotClient();
-
- // frees the previous screenshot and capture a new one
- status_t update();
- status_t update(uint32_t reqWidth, uint32_t reqHeight);
- status_t update(uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ);
-
- // release memory occupied by the screenshot
- void release();
-
- // pixels are valid until this object is freed or
- // release() or update() is called
- void const* getPixels() const;
-
- uint32_t getWidth() const;
- uint32_t getHeight() const;
- PixelFormat getFormat() const;
- uint32_t getStride() const;
- // size of allocated memory in bytes
- size_t getSize() const;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
deleted file mode 100644
index 5531e53..0000000
--- a/include/gui/SurfaceTexture.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SURFACETEXTURE_H
-#define ANDROID_GUI_SURFACETEXTURE_H
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <gui/ISurfaceTexture.h>
-#include <gui/BufferQueue.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-#include <utils/threads.h>
-
-#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture"
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-
-class String8;
-
-class SurfaceTexture : public BufferQueue {
-public:
-
- // SurfaceTexture constructs a new SurfaceTexture object. tex indicates the
- // name of the OpenGL ES texture to which images are to be streamed. This
- // texture name cannot be changed once the SurfaceTexture is created.
- // allowSynchronousMode specifies whether or not synchronous mode can be
- // enabled. texTarget specifies the OpenGL ES texture target to which the
- // texture will be bound in updateTexImage. useFenceSync specifies whether
- // fences should be used to synchronize access to buffers if that behavior
- // is enabled at compile-time.
- SurfaceTexture(GLuint tex, bool allowSynchronousMode = true,
- GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true);
-
- virtual ~SurfaceTexture();
-
-
-
- // updateTexImage sets the image contents of the target texture to that of
- // the most recently queued buffer.
- //
- // This call may only be made while the OpenGL ES context to which the
- // target texture belongs is bound to the calling thread.
- status_t updateTexImage();
-
- // setBufferCountServer set the buffer count. If the client has requested
- // a buffer count using setBufferCount, the server-buffer count will
- // take effect once the client sets the count back to zero.
- status_t setBufferCountServer(int bufferCount);
-
- // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix
- // associated with the texture image set by the most recent call to
- // updateTexImage.
- //
- // This transform matrix maps 2D homogeneous texture coordinates of the form
- // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture
- // coordinate that should be used to sample that location from the texture.
- // Sampling the texture outside of the range of this transform is undefined.
- //
- // This transform is necessary to compensate for transforms that the stream
- // content producer may implicitly apply to the content. By forcing users of
- // a SurfaceTexture to apply this transform we avoid performing an extra
- // copy of the data that would be needed to hide the transform from the
- // user.
- //
- // The matrix is stored in column-major order so that it may be passed
- // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv
- // functions.
- void getTransformMatrix(float mtx[16]);
-
- // getTimestamp retrieves the timestamp associated with the texture image
- // set by the most recent call to updateTexImage.
- //
- // The timestamp is in nanoseconds, and is monotonically increasing. Its
- // other semantics (zero point, etc) are source-dependent and should be
- // documented by the source.
- int64_t getTimestamp();
-
- // setFrameAvailableListener sets the listener object that will be notified
- // when a new frame becomes available.
- void setFrameAvailableListener(const sp<FrameAvailableListener>& listener);
-
- // getAllocator retrieves the binder object that must be referenced as long
- // as the GraphicBuffers dequeued from this SurfaceTexture are referenced.
- // Holding this binder reference prevents SurfaceFlinger from freeing the
- // buffers before the client is done with them.
- sp<IBinder> getAllocator();
-
- // setDefaultBufferSize is used to set the size of buffers returned by
- // requestBuffers when a with and height of zero is requested.
- // A call to setDefaultBufferSize() may trigger requestBuffers() to
- // be called from the client.
- // The width and height parameters must be no greater than the minimum of
- // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
- // An error due to invalid dimensions might not be reported until
- // updateTexImage() is called.
- status_t setDefaultBufferSize(uint32_t width, uint32_t height);
-
- // getCurrentBuffer returns the buffer associated with the current image.
- sp<GraphicBuffer> getCurrentBuffer() const;
-
- // getCurrentTextureTarget returns the texture target of the current
- // texture as returned by updateTexImage().
- GLenum getCurrentTextureTarget() const;
-
- // getCurrentCrop returns the cropping rectangle of the current buffer
- Rect getCurrentCrop() const;
-
- // getCurrentTransform returns the transform of the current buffer
- uint32_t getCurrentTransform() const;
-
- // getCurrentScalingMode returns the scaling mode of the current buffer
- uint32_t getCurrentScalingMode() const;
-
- // isSynchronousMode returns whether the SurfaceTexture is currently in
- // synchronous mode.
- bool isSynchronousMode() const;
-
- // abandon frees all the buffers and puts the SurfaceTexture into the
- // 'abandoned' state. Once put in this state the SurfaceTexture can never
- // leave it. When in the 'abandoned' state, all methods of the
- // ISurfaceTexture interface will fail with the NO_INIT error.
- //
- // Note that while calling this method causes all the buffers to be freed
- // from the perspective of the the SurfaceTexture, if there are additional
- // references on the buffers (e.g. if a buffer is referenced by a client or
- // by OpenGL ES as a texture) then those buffer will remain allocated.
- void abandon();
-
- // set the name of the SurfaceTexture that will be used to identify it in
- // log messages.
- void setName(const String8& name);
-
- // dump our state in a String
- virtual void dump(String8& result) const;
- virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
-
-protected:
-
- static bool isExternalFormat(uint32_t format);
-
-private:
-
- // createImage creates a new EGLImage from a GraphicBuffer.
- EGLImageKHR createImage(EGLDisplay dpy,
- const sp<GraphicBuffer>& graphicBuffer);
-
- // computeCurrentTransformMatrix computes the transform matrix for the
- // current texture. It uses mCurrentTransform and the current GraphicBuffer
- // to compute this matrix and stores it in mCurrentTransformMatrix.
- void computeCurrentTransformMatrix();
-
- // mCurrentTextureBuf is the graphic buffer of the current texture. It's
- // possible that this buffer is not associated with any buffer slot, so we
- // must track it separately in order to support the getCurrentBuffer method.
- sp<GraphicBuffer> mCurrentTextureBuf;
-
- // mCurrentCrop is the crop rectangle that applies to the current texture.
- // It gets set each time updateTexImage is called.
- Rect mCurrentCrop;
-
- // mCurrentTransform is the transform identifier for the current texture. It
- // gets set each time updateTexImage is called.
- uint32_t mCurrentTransform;
-
- // mCurrentScalingMode is the scaling mode for the current texture. It gets
- // set to each time updateTexImage is called.
- uint32_t mCurrentScalingMode;
-
- // mCurrentTransformMatrix is the transform matrix for the current texture.
- // It gets computed by computeTransformMatrix each time updateTexImage is
- // called.
- float mCurrentTransformMatrix[16];
-
- // mCurrentTimestamp is the timestamp for the current texture. It
- // gets set each time updateTexImage is called.
- int64_t mCurrentTimestamp;
-
- // mTexName is the name of the OpenGL texture to which streamed images will
- // be bound when updateTexImage is called. It is set at construction time
- // changed with a call to setTexName.
- const GLuint mTexName;
-
- // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync
- // extension should be used to prevent buffers from being dequeued before
- // it's safe for them to be written. It gets set at construction time and
- // never changes.
- const bool mUseFenceSync;
-
- // mTexTarget is the GL texture target with which the GL texture object is
- // associated. It is set in the constructor and never changed. It is
- // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android
- // Browser. In that case it is set to GL_TEXTURE_2D to allow
- // glCopyTexSubImage to read from the texture. This is a hack to work
- // around a GL driver limitation on the number of FBO attachments, which the
- // browser's tile cache exceeds.
- const GLenum mTexTarget;
-
- // SurfaceTexture maintains EGL information about GraphicBuffers that corresponds
- // directly with BufferQueue's buffers
- struct EGLSlot {
- EGLSlot()
- : mEglImage(EGL_NO_IMAGE_KHR),
- mEglDisplay(EGL_NO_DISPLAY),
- mFence(EGL_NO_SYNC_KHR) {
- }
-
- sp<GraphicBuffer> mGraphicBuffer;
-
- // mEglImage is the EGLImage created from mGraphicBuffer.
- EGLImageKHR mEglImage;
-
- // mEglDisplay is the EGLDisplay used to create mEglImage.
- EGLDisplay mEglDisplay;
-
- // mFence is the EGL sync object that must signal before the buffer
- // associated with this buffer slot may be dequeued. It is initialized
- // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based
- // on a compile-time option) set to a new sync object in updateTexImage.
- EGLSyncKHR mFence;
- };
-
- EGLSlot mEGLSlots[NUM_BUFFER_SLOTS];
-
- // mAbandoned indicates that the BufferQueue will no longer be used to
- // consume images buffers pushed to it using the ISurfaceTexture interface.
- // It is initialized to false, and set to true in the abandon method. A
- // BufferQueue that has been abandoned will return the NO_INIT error from
- // all ISurfaceTexture methods capable of returning an error.
- bool mAbandoned;
-
- // mName is a string used to identify the SurfaceTexture in log messages.
- // It can be set by the setName method.
- String8 mName;
-
- // mMutex is the mutex used to prevent concurrent access to the member
- // variables of SurfaceTexture objects. It must be locked whenever the
- // member variables are accessed.
- mutable Mutex mMutex;
-
- // mCurrentTexture is the buffer slot index of the buffer that is currently
- // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT,
- // indicating that no buffer slot is currently bound to the texture. Note,
- // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean
- // that no buffer is bound to the texture. A call to setBufferCount will
- // reset mCurrentTexture to INVALID_BUFFER_SLOT.
- int mCurrentTexture;
-
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACETEXTURE_H
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
deleted file mode 100644
index aa7fe48..0000000
--- a/include/gui/SurfaceTextureClient.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GUI_SURFACETEXTURECLIENT_H
-#define ANDROID_GUI_SURFACETEXTURECLIENT_H
-
-#include <gui/ISurfaceTexture.h>
-#include <gui/SurfaceTexture.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/Region.h>
-
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-
-namespace android {
-
-class Surface;
-
-class SurfaceTextureClient
- : public ANativeObjectBase<ANativeWindow, SurfaceTextureClient, RefBase>
-{
-public:
- SurfaceTextureClient(const sp<ISurfaceTexture>& surfaceTexture);
-
- sp<ISurfaceTexture> getISurfaceTexture() const;
-
-protected:
- SurfaceTextureClient();
- virtual ~SurfaceTextureClient();
- void setISurfaceTexture(const sp<ISurfaceTexture>& surfaceTexture);
-
-private:
- // can't be copied
- SurfaceTextureClient& operator = (const SurfaceTextureClient& rhs);
- SurfaceTextureClient(const SurfaceTextureClient& rhs);
- void init();
-
- // ANativeWindow hooks
- static int hook_cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int hook_dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
- static int hook_lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int hook_perform(ANativeWindow* window, int operation, ...);
- static int hook_query(const ANativeWindow* window, int what, int* value);
- static int hook_queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int hook_setSwapInterval(ANativeWindow* window, int interval);
-
- int dispatchConnect(va_list args);
- int dispatchDisconnect(va_list args);
- int dispatchSetBufferCount(va_list args);
- int dispatchSetBuffersGeometry(va_list args);
- int dispatchSetBuffersDimensions(va_list args);
- int dispatchSetBuffersFormat(va_list args);
- int dispatchSetScalingMode(va_list args);
- int dispatchSetBuffersTransform(va_list args);
- int dispatchSetBuffersTimestamp(va_list args);
- int dispatchSetCrop(va_list args);
- int dispatchSetUsage(va_list args);
- int dispatchLock(va_list args);
- int dispatchUnlockAndPost(va_list args);
-
-protected:
- virtual int cancelBuffer(ANativeWindowBuffer* buffer);
- virtual int dequeueBuffer(ANativeWindowBuffer** buffer);
- virtual int lockBuffer(ANativeWindowBuffer* buffer);
- virtual int perform(int operation, va_list args);
- virtual int query(int what, int* value) const;
- virtual int queueBuffer(ANativeWindowBuffer* buffer);
- virtual int setSwapInterval(int interval);
-
- virtual int connect(int api);
- virtual int disconnect(int api);
- virtual int setBufferCount(int bufferCount);
- virtual int setBuffersDimensions(int w, int h);
- virtual int setBuffersFormat(int format);
- virtual int setScalingMode(int mode);
- virtual int setBuffersTransform(int transform);
- virtual int setBuffersTimestamp(int64_t timestamp);
- virtual int setCrop(Rect const* rect);
- virtual int setUsage(uint32_t reqUsage);
- virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds);
- virtual int unlockAndPost();
-
- enum { MIN_UNDEQUEUED_BUFFERS = SurfaceTexture::MIN_UNDEQUEUED_BUFFERS };
- enum { NUM_BUFFER_SLOTS = SurfaceTexture::NUM_BUFFER_SLOTS };
- enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 };
-
-private:
- void freeAllBuffers();
- int getSlotFromBufferLocked(android_native_buffer_t* buffer) const;
-
- // mSurfaceTexture is the interface to the surface texture server. All
- // operations on the surface texture client ultimately translate into
- // interactions with the server using this interface.
- sp<ISurfaceTexture> mSurfaceTexture;
-
- // mSlots stores the buffers that have been allocated for each buffer slot.
- // It is initialized to null pointers, and gets filled in with the result of
- // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a
- // slot that has not yet been used. The buffer allocated to a slot will also
- // be replaced if the requested buffer usage or geometry differs from that
- // of the buffer allocated to a slot.
- sp<GraphicBuffer> mSlots[NUM_BUFFER_SLOTS];
-
- // mReqWidth is the buffer width that will be requested at the next dequeue
- // operation. It is initialized to 1.
- uint32_t mReqWidth;
-
- // mReqHeight is the buffer height that will be requested at the next deuque
- // operation. It is initialized to 1.
- uint32_t mReqHeight;
-
- // mReqFormat is the buffer pixel format that will be requested at the next
- // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888.
- uint32_t mReqFormat;
-
- // mReqUsage is the set of buffer usage flags that will be requested
- // at the next deuque operation. It is initialized to 0.
- uint32_t mReqUsage;
-
- // mTimestamp is the timestamp that will be used for the next buffer queue
- // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
- // a timestamp is auto-generated when queueBuffer is called.
- int64_t mTimestamp;
-
- // mDefaultWidth is default width of the window, regardless of the
- // native_window_set_buffers_dimensions call
- uint32_t mDefaultWidth;
-
- // mDefaultHeight is default width of the window, regardless of the
- // native_window_set_buffers_dimensions call
- uint32_t mDefaultHeight;
-
- // mTransformHint is the transform probably applied to buffers of this
- // window. this is only a hint, actual transform may differ.
- uint32_t mTransformHint;
-
- // mMutex is the mutex used to prevent concurrent access to the member
- // variables of SurfaceTexture objects. It must be locked whenever the
- // member variables are accessed.
- mutable Mutex mMutex;
-
- // must be used from the lock/unlock thread
- sp<GraphicBuffer> mLockedBuffer;
- sp<GraphicBuffer> mPostedBuffer;
- mutable Region mOldDirtyRegion;
- bool mConnectedToCpu;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACETEXTURECLIENT_H
diff --git a/include/private/binder/Static.h b/include/private/binder/Static.h
deleted file mode 100644
index 5b0f9fc..0000000
--- a/include/private/binder/Static.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-// All static variables go here, to control initialization and
-// destruction order in the library.
-
-#include <utils/threads.h>
-
-#include <binder/IBinder.h>
-#include <binder/IMemory.h>
-#include <binder/ProcessState.h>
-#include <binder/IPermissionController.h>
-#include <binder/IServiceManager.h>
-
-namespace android {
-
-// For ProcessState.cpp
-extern Mutex gProcessMutex;
-extern sp<ProcessState> gProcess;
-
-// For ServiceManager.cpp
-extern Mutex gDefaultServiceManagerLock;
-extern sp<IServiceManager> gDefaultServiceManager;
-extern sp<IPermissionController> gPermissionController;
-
-} // namespace android
diff --git a/include/private/binder/binder_module.h b/include/private/binder/binder_module.h
deleted file mode 100644
index a8dd64f..0000000
--- a/include/private/binder/binder_module.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _BINDER_MODULE_H_
-#define _BINDER_MODULE_H_
-
-#ifdef __cplusplus
-namespace android {
-#endif
-
-/* obtain structures and constants from the kernel header */
-
-#include <sys/ioctl.h>
-#include <linux/binder.h>
-
-#ifdef __cplusplus
-} // namespace android
-#endif
-
-#endif // _BINDER_MODULE_H_
diff --git a/include/private/gui/ComposerService.h b/include/private/gui/ComposerService.h
deleted file mode 100644
index d04491a..0000000
--- a/include/private/gui/ComposerService.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
-#define ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Singleton.h>
-#include <utils/StrongPointer.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class IMemoryHeap;
-class ISurfaceComposer;
-class surface_flinger_cblk_t;
-
-// ---------------------------------------------------------------------------
-
-class ComposerService : public Singleton<ComposerService>
-{
- // these are constants
- sp<ISurfaceComposer> mComposerService;
- sp<IMemoryHeap> mServerCblkMemory;
- surface_flinger_cblk_t volatile* mServerCblk;
- ComposerService();
- friend class Singleton<ComposerService>;
-public:
- static sp<ISurfaceComposer> getComposerService();
- static surface_flinger_cblk_t const volatile * getControlBlock();
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
deleted file mode 100644
index ca277e0..0000000
--- a/include/private/gui/LayerState.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SF_LAYER_STATE_H
-#define ANDROID_SF_LAYER_STATE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-
-#include <ui/Region.h>
-#include <gui/ISurface.h>
-
-namespace android {
-
-class Parcel;
-class ISurfaceComposerClient;
-
-struct layer_state_t {
-
- layer_state_t()
- : surface(0), what(0),
- x(0), y(0), z(0), w(0), h(0),
- alpha(0), tint(0), flags(0), mask(0),
- reserved(0)
- {
- matrix.dsdx = matrix.dtdy = 1.0f;
- matrix.dsdy = matrix.dtdx = 0.0f;
- }
-
- status_t write(Parcel& output) const;
- status_t read(const Parcel& input);
-
- struct matrix22_t {
- float dsdx;
- float dtdx;
- float dsdy;
- float dtdy;
- };
- SurfaceID surface;
- uint32_t what;
- float x;
- float y;
- uint32_t z;
- uint32_t w;
- uint32_t h;
- float alpha;
- uint32_t tint;
- uint8_t flags;
- uint8_t mask;
- uint8_t reserved;
- matrix22_t matrix;
- // non POD must be last. see write/read
- Region transparentRegion;
-};
-
-struct ComposerState {
- sp<ISurfaceComposerClient> client;
- layer_state_t state;
- status_t write(Parcel& output) const;
- status_t read(const Parcel& input);
-};
-
-}; // namespace android
-
-#endif // ANDROID_SF_LAYER_STATE_H
-
diff --git a/include/private/gui/SharedBufferStack.h b/include/private/gui/SharedBufferStack.h
deleted file mode 100644
index 0da03d1..0000000
--- a/include/private/gui/SharedBufferStack.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SF_SHARED_BUFFER_STACK_H
-#define ANDROID_SF_SHARED_BUFFER_STACK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Debug.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-#define NUM_DISPLAY_MAX 4
-
-struct display_cblk_t
-{
- uint16_t w;
- uint16_t h;
- uint8_t format;
- uint8_t orientation;
- uint8_t reserved[2];
- float fps;
- float density;
- float xdpi;
- float ydpi;
- uint32_t pad[2];
-};
-
-struct surface_flinger_cblk_t // 4KB max
-{
- uint8_t connected;
- uint8_t reserved[3];
- uint32_t pad[7];
- display_cblk_t displays[NUM_DISPLAY_MAX];
-};
-
-// ---------------------------------------------------------------------------
-
-COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096)
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */
diff --git a/include/private/ui/RegionHelper.h b/include/private/ui/RegionHelper.h
deleted file mode 100644
index 8d76533..0000000
--- a/include/private/ui/RegionHelper.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UI_PRIVATE_REGION_HELPER_H
-#define ANDROID_UI_PRIVATE_REGION_HELPER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-template<typename RECT>
-class region_operator
-{
- typedef typename RECT::value_type TYPE;
- static const TYPE max_value = 0x7FFFFFF;
-
-public:
- /*
- * Common boolean operations:
- * value is computed as 0b101 op 0b110
- * other boolean operation are possible, simply compute
- * their corresponding value with the above formulae and use
- * it when instantiating a region_operator.
- */
- static const uint32_t LHS = 0x5; // 0b101
- static const uint32_t RHS = 0x6; // 0b110
- enum {
- op_nand = LHS & ~RHS,
- op_and = LHS & RHS,
- op_or = LHS | RHS,
- op_xor = LHS ^ RHS
- };
-
- struct region {
- RECT const* rects;
- size_t count;
- TYPE dx;
- TYPE dy;
- inline region(const region& rhs)
- : rects(rhs.rects), count(rhs.count), dx(rhs.dx), dy(rhs.dy) { }
- inline region(RECT const* r, size_t c)
- : rects(r), count(c), dx(), dy() { }
- inline region(RECT const* r, size_t c, TYPE dx, TYPE dy)
- : rects(r), count(c), dx(dx), dy(dy) { }
- };
-
- class region_rasterizer {
- friend class region_operator;
- virtual void operator()(const RECT& rect) = 0;
- public:
- virtual ~region_rasterizer() { };
- };
-
- inline region_operator(int op, const region& lhs, const region& rhs)
- : op_mask(op), spanner(lhs, rhs)
- {
- }
-
- void operator()(region_rasterizer& rasterizer) {
- RECT current;
- do {
- SpannerInner spannerInner(spanner.lhs, spanner.rhs);
- int inside = spanner.next(current.top, current.bottom);
- spannerInner.prepare(inside);
- do {
- TYPE left, right;
- int inside = spannerInner.next(current.left, current.right);
- if ((op_mask >> inside) & 1) {
- if (current.left < current.right &&
- current.top < current.bottom) {
- rasterizer(current);
- }
- }
- } while(!spannerInner.isDone());
- } while(!spanner.isDone());
- }
-
-private:
- uint32_t op_mask;
-
- class SpannerBase
- {
- public:
- enum {
- lhs_before_rhs = 0,
- lhs_after_rhs = 1,
- lhs_coincide_rhs = 2
- };
-
- protected:
- TYPE lhs_head;
- TYPE lhs_tail;
- TYPE rhs_head;
- TYPE rhs_tail;
-
- inline int next(TYPE& head, TYPE& tail,
- bool& more_lhs, bool& more_rhs)
- {
- int inside;
- more_lhs = false;
- more_rhs = false;
- if (lhs_head < rhs_head) {
- inside = lhs_before_rhs;
- head = lhs_head;
- if (lhs_tail <= rhs_head) {
- tail = lhs_tail;
- more_lhs = true;
- } else {
- lhs_head = rhs_head;
- tail = rhs_head;
- }
- } else if (rhs_head < lhs_head) {
- inside = lhs_after_rhs;
- head = rhs_head;
- if (rhs_tail <= lhs_head) {
- tail = rhs_tail;
- more_rhs = true;
- } else {
- rhs_head = lhs_head;
- tail = lhs_head;
- }
- } else {
- inside = lhs_coincide_rhs;
- head = lhs_head;
- if (lhs_tail <= rhs_tail) {
- tail = rhs_head = lhs_tail;
- more_lhs = true;
- }
- if (rhs_tail <= lhs_tail) {
- tail = lhs_head = rhs_tail;
- more_rhs = true;
- }
- }
- return inside;
- }
- };
-
- class Spanner : protected SpannerBase
- {
- friend class region_operator;
- region lhs;
- region rhs;
-
- public:
- inline Spanner(const region& lhs, const region& rhs)
- : lhs(lhs), rhs(rhs)
- {
- SpannerBase::lhs_head = lhs.rects->top + lhs.dy;
- SpannerBase::lhs_tail = lhs.rects->bottom + lhs.dy;
- SpannerBase::rhs_head = rhs.rects->top + rhs.dy;
- SpannerBase::rhs_tail = rhs.rects->bottom + rhs.dy;
- }
-
- inline bool isDone() const {
- return !rhs.count && !lhs.count;
- }
-
- inline int next(TYPE& top, TYPE& bottom)
- {
- bool more_lhs = false;
- bool more_rhs = false;
- int inside = SpannerBase::next(top, bottom, more_lhs, more_rhs);
- if (more_lhs) {
- advance(lhs, SpannerBase::lhs_head, SpannerBase::lhs_tail);
- }
- if (more_rhs) {
- advance(rhs, SpannerBase::rhs_head, SpannerBase::rhs_tail);
- }
- return inside;
- }
-
- private:
- static inline
- void advance(region& reg, TYPE& aTop, TYPE& aBottom) {
- // got to next span
- size_t count = reg.count;
- RECT const * rects = reg.rects;
- RECT const * const end = rects + count;
- const int top = rects->top;
- while (rects != end && rects->top == top) {
- rects++;
- count--;
- }
- if (rects != end) {
- aTop = rects->top + reg.dy;
- aBottom = rects->bottom + reg.dy;
- } else {
- aTop = max_value;
- aBottom = max_value;
- }
- reg.rects = rects;
- reg.count = count;
- }
- };
-
- class SpannerInner : protected SpannerBase
- {
- region lhs;
- region rhs;
-
- public:
- inline SpannerInner(const region& lhs, const region& rhs)
- : lhs(lhs), rhs(rhs)
- {
- }
-
- inline void prepare(int inside) {
- if (inside == SpannerBase::lhs_before_rhs) {
- SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
- SpannerBase::lhs_tail = lhs.rects->right + lhs.dx;
- SpannerBase::rhs_head = max_value;
- SpannerBase::rhs_tail = max_value;
- } else if (inside == SpannerBase::lhs_after_rhs) {
- SpannerBase::lhs_head = max_value;
- SpannerBase::lhs_tail = max_value;
- SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
- SpannerBase::rhs_tail = rhs.rects->right + rhs.dx;
- } else {
- SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
- SpannerBase::lhs_tail = lhs.rects->right + lhs.dx;
- SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
- SpannerBase::rhs_tail = rhs.rects->right + rhs.dx;
- }
- }
-
- inline bool isDone() const {
- return SpannerBase::lhs_head == max_value &&
- SpannerBase::rhs_head == max_value;
- }
-
- inline int next(TYPE& left, TYPE& right)
- {
- bool more_lhs = false;
- bool more_rhs = false;
- int inside = SpannerBase::next(left, right, more_lhs, more_rhs);
- if (more_lhs) {
- advance(lhs, SpannerBase::lhs_head, SpannerBase::lhs_tail);
- }
- if (more_rhs) {
- advance(rhs, SpannerBase::rhs_head, SpannerBase::rhs_tail);
- }
- return inside;
- }
-
- private:
- static inline
- void advance(region& reg, TYPE& left, TYPE& right) {
- if (reg.rects && reg.count) {
- const int cur_span_top = reg.rects->top;
- reg.rects++;
- reg.count--;
- if (!reg.count || reg.rects->top != cur_span_top) {
- left = max_value;
- right = max_value;
- } else {
- left = reg.rects->left + reg.dx;
- right = reg.rects->right + reg.dx;
- }
- }
- }
- };
-
- Spanner spanner;
-};
-
-// ----------------------------------------------------------------------------
-};
-
-#endif /* ANDROID_UI_PRIVATE_REGION_HELPER_H */
diff --git a/include/private/utils/Static.h b/include/private/utils/Static.h
deleted file mode 100644
index d95ae0d..0000000
--- a/include/private/utils/Static.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-// All static variables go here, to control initialization and
-// destruction order in the library.
-
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-
-namespace android {
-// For TextStream.cpp
-extern Vector<int32_t> gTextBuffers;
-
-// For String8.cpp
-extern void initialize_string8();
-extern void terminate_string8();
-
-// For String16.cpp
-extern void initialize_string16();
-extern void terminate_string16();
-
-} // namespace android
diff --git a/include/ui/ANativeObjectBase.h b/include/ui/ANativeObjectBase.h
deleted file mode 100644
index 76e850f..0000000
--- a/include/ui/ANativeObjectBase.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_ANDROID_NATIVES_H
-#define ANDROID_ANDROID_NATIVES_H
-
-#include <sys/types.h>
-#include <string.h>
-
-#include <hardware/gralloc.h>
-#include <system/window.h>
-
-// ---------------------------------------------------------------------------
-
-/* FIXME: this is legacy for pixmaps */
-typedef struct egl_native_pixmap_t
-{
- int32_t version; /* must be 32 */
- int32_t width;
- int32_t height;
- int32_t stride;
- uint8_t* data;
- uint8_t format;
- uint8_t rfu[3];
- union {
- uint32_t compressedFormat;
- int32_t vstride;
- };
- int32_t reserved;
-} egl_native_pixmap_t;
-
-/*****************************************************************************/
-
-#ifdef __cplusplus
-
-#include <utils/RefBase.h>
-
-namespace android {
-
-/*
- * This helper class turns a ANativeXXX object type into a C++
- * reference-counted object; with proper type conversions.
- */
-template <typename NATIVE_TYPE, typename TYPE, typename REF>
-class ANativeObjectBase : public NATIVE_TYPE, public REF
-{
-public:
- // Disambiguate between the incStrong in REF and NATIVE_TYPE
- void incStrong(const void* id) const {
- REF::incStrong(id);
- }
- void decStrong(const void* id) const {
- REF::decStrong(id);
- }
-
-protected:
- typedef ANativeObjectBase<NATIVE_TYPE, TYPE, REF> BASE;
- ANativeObjectBase() : NATIVE_TYPE(), REF() {
- NATIVE_TYPE::common.incRef = incRef;
- NATIVE_TYPE::common.decRef = decRef;
- }
- static inline TYPE* getSelf(NATIVE_TYPE* self) {
- return static_cast<TYPE*>(self);
- }
- static inline TYPE const* getSelf(NATIVE_TYPE const* self) {
- return static_cast<TYPE const *>(self);
- }
- static inline TYPE* getSelf(android_native_base_t* base) {
- return getSelf(reinterpret_cast<NATIVE_TYPE*>(base));
- }
- static inline TYPE const * getSelf(android_native_base_t const* base) {
- return getSelf(reinterpret_cast<NATIVE_TYPE const*>(base));
- }
- static void incRef(android_native_base_t* base) {
- ANativeObjectBase* self = getSelf(base);
- self->incStrong(self);
- }
- static void decRef(android_native_base_t* base) {
- ANativeObjectBase* self = getSelf(base);
- self->decStrong(self);
- }
-};
-
-} // namespace android
-#endif // __cplusplus
-
-/*****************************************************************************/
-
-#endif /* ANDROID_ANDROID_NATIVES_H */
diff --git a/include/ui/DisplayInfo.h b/include/ui/DisplayInfo.h
deleted file mode 100644
index edd28a6..0000000
--- a/include/ui/DisplayInfo.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-
-#ifndef ANDROID_UI_DISPLAY_INFO_H
-#define ANDROID_UI_DISPLAY_INFO_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/PixelFormat.h>
-
-namespace android {
-
-struct DisplayInfo {
- uint32_t w;
- uint32_t h;
- PixelFormatInfo pixelFormatInfo;
- uint8_t orientation;
- uint8_t reserved[3];
- float fps;
- float density;
- float xdpi;
- float ydpi;
-};
-
-/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */
-enum {
- DISPLAY_ORIENTATION_0 = 0,
- DISPLAY_ORIENTATION_90 = 1,
- DISPLAY_ORIENTATION_180 = 2,
- DISPLAY_ORIENTATION_270 = 3
-};
-
-
-}; // namespace android
-
-#endif // ANDROID_COMPOSER_DISPLAY_INFO_H
-
diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h
deleted file mode 100644
index b202b95..0000000
--- a/include/ui/FramebufferNativeWindow.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-#define ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-
-#include <utils/threads.h>
-#include <utils/String8.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/Rect.h>
-
-#define NUM_FRAME_BUFFERS 2
-
-extern "C" EGLNativeWindowType android_createDisplaySurface(void);
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Surface;
-class NativeBuffer;
-
-// ---------------------------------------------------------------------------
-
-class FramebufferNativeWindow
- : public ANativeObjectBase<
- ANativeWindow,
- FramebufferNativeWindow,
- LightRefBase<FramebufferNativeWindow> >
-{
-public:
- FramebufferNativeWindow();
-
- framebuffer_device_t const * getDevice() const { return fbDev; }
-
- bool isUpdateOnDemand() const { return mUpdateOnDemand; }
- status_t setUpdateRectangle(const Rect& updateRect);
- status_t compositionComplete();
-
- void dump(String8& result);
-
- // for debugging only
- int getCurrentBufferIndex() const;
-
-private:
- friend class LightRefBase<FramebufferNativeWindow>;
- ~FramebufferNativeWindow(); // this class cannot be overloaded
- static int setSwapInterval(ANativeWindow* window, int interval);
- static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
- static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int query(const ANativeWindow* window, int what, int* value);
- static int perform(ANativeWindow* window, int operation, ...);
-
- framebuffer_device_t* fbDev;
- alloc_device_t* grDev;
-
- sp<NativeBuffer> buffers[NUM_FRAME_BUFFERS];
- sp<NativeBuffer> front;
-
- mutable Mutex mutex;
- Condition mCondition;
- int32_t mNumBuffers;
- int32_t mNumFreeBuffers;
- int32_t mBufferHead;
- int32_t mCurrentBufferIndex;
- bool mUpdateOnDemand;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
deleted file mode 100644
index f318cd8..0000000
--- a/include/ui/GraphicBuffer.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_GRAPHIC_BUFFER_H
-#define ANDROID_GRAPHIC_BUFFER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/PixelFormat.h>
-#include <ui/Rect.h>
-#include <utils/Flattenable.h>
-
-
-struct ANativeWindowBuffer;
-
-namespace android {
-
-class GraphicBufferMapper;
-
-// ===========================================================================
-// GraphicBuffer
-// ===========================================================================
-
-class GraphicBuffer
- : public ANativeObjectBase<
- ANativeWindowBuffer,
- GraphicBuffer,
- LightRefBase<GraphicBuffer> >, public Flattenable
-{
-public:
-
- enum {
- USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER,
- USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY,
- USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN,
- USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK,
-
- USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER,
- USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY,
- USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN,
- USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK,
-
- USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK,
-
- USAGE_PROTECTED = GRALLOC_USAGE_PROTECTED,
-
- USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE,
- USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER,
- USAGE_HW_2D = GRALLOC_USAGE_HW_2D,
- USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER,
- USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER,
- USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK
- };
-
- GraphicBuffer();
-
- // creates w * h buffer
- GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage);
-
- // create a buffer from an existing handle
- GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
- uint32_t stride, native_handle_t* handle, bool keepOwnership);
-
- // create a buffer from an existing ANativeWindowBuffer
- GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership);
-
- // return status
- status_t initCheck() const;
-
- uint32_t getWidth() const { return width; }
- uint32_t getHeight() const { return height; }
- uint32_t getStride() const { return stride; }
- uint32_t getUsage() const { return usage; }
- PixelFormat getPixelFormat() const { return format; }
- Rect getBounds() const { return Rect(width, height); }
-
- status_t reallocate(uint32_t w, uint32_t h, PixelFormat f, uint32_t usage);
-
- status_t lock(uint32_t usage, void** vaddr);
- status_t lock(uint32_t usage, const Rect& rect, void** vaddr);
- status_t unlock();
-
- ANativeWindowBuffer* getNativeBuffer() const;
-
- void setIndex(int index);
- int getIndex() const;
-
- // for debugging
- static void dumpAllocationsToSystemLog();
-
-private:
- virtual ~GraphicBuffer();
-
- enum {
- ownNone = 0,
- ownHandle = 1,
- ownData = 2,
- };
-
- inline const GraphicBufferMapper& getBufferMapper() const {
- return mBufferMapper;
- }
- inline GraphicBufferMapper& getBufferMapper() {
- return mBufferMapper;
- }
- uint8_t mOwner;
-
-private:
- friend class Surface;
- friend class BpSurface;
- friend class BnSurface;
- friend class SurfaceTextureClient;
- friend class LightRefBase<GraphicBuffer>;
- GraphicBuffer(const GraphicBuffer& rhs);
- GraphicBuffer& operator = (const GraphicBuffer& rhs);
- const GraphicBuffer& operator = (const GraphicBuffer& rhs) const;
-
- status_t initSize(uint32_t w, uint32_t h, PixelFormat format,
- uint32_t usage);
-
- void free_handle();
-
- // Flattenable interface
- size_t getFlattenedSize() const;
- size_t getFdCount() const;
- status_t flatten(void* buffer, size_t size,
- int fds[], size_t count) const;
- status_t unflatten(void const* buffer, size_t size,
- int fds[], size_t count);
-
-
- GraphicBufferMapper& mBufferMapper;
- ssize_t mInitCheck;
- int mIndex;
-
- // If we're wrapping another buffer then this reference will make sure it
- // doesn't get freed.
- sp<ANativeWindowBuffer> mWrappedBuffer;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GRAPHIC_BUFFER_H
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
deleted file mode 100644
index dffa788..0000000
--- a/include/ui/GraphicBufferAllocator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_BUFFER_ALLOCATOR_H
-#define ANDROID_BUFFER_ALLOCATOR_H
-
-#include <stdint.h>
-
-#include <cutils/native_handle.h>
-
-#include <utils/Errors.h>
-#include <utils/KeyedVector.h>
-#include <utils/threads.h>
-#include <utils/Singleton.h>
-
-#include <ui/PixelFormat.h>
-
-#include <hardware/gralloc.h>
-
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-
-class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator>
-{
-public:
- enum {
- USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER,
- USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY,
- USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN,
- USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK,
-
- USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER,
- USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY,
- USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN,
- USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK,
-
- USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK,
-
- USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE,
- USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER,
- USAGE_HW_2D = GRALLOC_USAGE_HW_2D,
- USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK
- };
-
- static inline GraphicBufferAllocator& get() { return getInstance(); }
-
-
- status_t alloc(uint32_t w, uint32_t h, PixelFormat format, int usage,
- buffer_handle_t* handle, int32_t* stride);
-
- status_t free(buffer_handle_t handle);
-
- void dump(String8& res) const;
- static void dumpToSystemLog();
-
-private:
- struct alloc_rec_t {
- uint32_t w;
- uint32_t h;
- uint32_t s;
- PixelFormat format;
- uint32_t usage;
- size_t size;
- };
-
- static Mutex sLock;
- static KeyedVector<buffer_handle_t, alloc_rec_t> sAllocList;
-
- friend class Singleton<GraphicBufferAllocator>;
- GraphicBufferAllocator();
- ~GraphicBufferAllocator();
-
- alloc_device_t *mAllocDev;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_BUFFER_ALLOCATOR_H
diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h
deleted file mode 100644
index 697a02a..0000000
--- a/include/ui/GraphicBufferMapper.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UI_BUFFER_MAPPER_H
-#define ANDROID_UI_BUFFER_MAPPER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Singleton.h>
-
-#include <hardware/gralloc.h>
-
-
-struct gralloc_module_t;
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class Rect;
-
-class GraphicBufferMapper : public Singleton<GraphicBufferMapper>
-{
-public:
- static inline GraphicBufferMapper& get() { return getInstance(); }
-
- status_t registerBuffer(buffer_handle_t handle);
-
- status_t unregisterBuffer(buffer_handle_t handle);
-
- status_t lock(buffer_handle_t handle,
- int usage, const Rect& bounds, void** vaddr);
-
- status_t unlock(buffer_handle_t handle);
-
- // dumps information about the mapping of this handle
- void dump(buffer_handle_t handle);
-
-private:
- friend class Singleton<GraphicBufferMapper>;
- GraphicBufferMapper();
- gralloc_module_t const *mAllocMod;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_UI_BUFFER_MAPPER_H
-
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
deleted file mode 100644
index 9f3e267..0000000
--- a/include/ui/PixelFormat.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-
-// Pixel formats used across the system.
-// These formats might not all be supported by all renderers, for instance
-// skia or SurfaceFlinger are not required to support all of these formats
-// (either as source or destination)
-
-
-#ifndef UI_PIXELFORMAT_H
-#define UI_PIXELFORMAT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-#include <hardware/hardware.h>
-
-namespace android {
-
-enum {
- //
- // these constants need to match those
- // in graphics/PixelFormat.java & pixelflinger/format.h
- //
- PIXEL_FORMAT_UNKNOWN = 0,
- PIXEL_FORMAT_NONE = 0,
-
- // logical pixel formats used by the SurfaceFlinger -----------------------
- PIXEL_FORMAT_CUSTOM = -4,
- // Custom pixel-format described by a PixelFormatInfo structure
-
- PIXEL_FORMAT_TRANSLUCENT = -3,
- // System chooses a format that supports translucency (many alpha bits)
-
- PIXEL_FORMAT_TRANSPARENT = -2,
- // System chooses a format that supports transparency
- // (at least 1 alpha bit)
-
- PIXEL_FORMAT_OPAQUE = -1,
- // System chooses an opaque format (no alpha bits required)
-
- // real pixel formats supported for rendering -----------------------------
-
- PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
- PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
- PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
- PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
- PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
- PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
- PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
- PIXEL_FORMAT_A_8 = 8, // 8-bit A
-};
-
-typedef int32_t PixelFormat;
-
-struct PixelFormatInfo {
- enum {
- INDEX_ALPHA = 0,
- INDEX_RED = 1,
- INDEX_GREEN = 2,
- INDEX_BLUE = 3
- };
-
- enum { // components
- ALPHA = 1,
- RGB = 2,
- RGBA = 3,
- L = 4,
- LA = 5,
- OTHER = 0xFF
- };
-
- struct szinfo {
- uint8_t h;
- uint8_t l;
- };
-
- inline PixelFormatInfo() : version(sizeof(PixelFormatInfo)) { }
- size_t getScanlineSize(unsigned int width) const;
- size_t getSize(size_t ci) const {
- return (ci <= 3) ? (cinfo[ci].h - cinfo[ci].l) : 0;
- }
- size_t version;
- PixelFormat format;
- size_t bytesPerPixel;
- size_t bitsPerPixel;
- union {
- szinfo cinfo[4];
- struct {
- uint8_t h_alpha;
- uint8_t l_alpha;
- uint8_t h_red;
- uint8_t l_red;
- uint8_t h_green;
- uint8_t l_green;
- uint8_t h_blue;
- uint8_t l_blue;
- };
- };
- uint8_t components;
- uint8_t reserved0[3];
- uint32_t reserved1;
-};
-
-// Consider caching the results of these functions are they're not
-// guaranteed to be fast.
-ssize_t bytesPerPixel(PixelFormat format);
-ssize_t bitsPerPixel(PixelFormat format);
-status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info);
-
-}; // namespace android
-
-#endif // UI_PIXELFORMAT_H
diff --git a/include/ui/Point.h b/include/ui/Point.h
deleted file mode 100644
index 1653120..0000000
--- a/include/ui/Point.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UI_POINT
-#define ANDROID_UI_POINT
-
-#include <utils/TypeHelpers.h>
-
-namespace android {
-
-class Point
-{
-public:
- int x;
- int y;
-
- // we don't provide copy-ctor and operator= on purpose
- // because we want the compiler generated versions
-
- // Default constructor doesn't initialize the Point
- inline Point() {
- }
- inline Point(int x, int y) : x(x), y(y) {
- }
-
- inline bool operator == (const Point& rhs) const {
- return (x == rhs.x) && (y == rhs.y);
- }
- inline bool operator != (const Point& rhs) const {
- return !operator == (rhs);
- }
-
- inline bool isOrigin() const {
- return !(x|y);
- }
-
- // operator < defines an order which allows to use points in sorted
- // vectors.
- bool operator < (const Point& rhs) const {
- return y<rhs.y || (y==rhs.y && x<rhs.x);
- }
-
- inline Point& operator - () {
- x = -x;
- y = -y;
- return *this;
- }
-
- inline Point& operator += (const Point& rhs) {
- x += rhs.x;
- y += rhs.y;
- return *this;
- }
- inline Point& operator -= (const Point& rhs) {
- x -= rhs.x;
- y -= rhs.y;
- return *this;
- }
-
- const Point operator + (const Point& rhs) const {
- const Point result(x+rhs.x, y+rhs.y);
- return result;
- }
- const Point operator - (const Point& rhs) const {
- const Point result(x-rhs.x, y-rhs.y);
- return result;
- }
-};
-
-ANDROID_BASIC_TYPES_TRAITS(Point)
-
-}; // namespace android
-
-#endif // ANDROID_UI_POINT
diff --git a/include/ui/Rect.h b/include/ui/Rect.h
deleted file mode 100644
index 9e98bc5..0000000
--- a/include/ui/Rect.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UI_RECT
-#define ANDROID_UI_RECT
-
-#include <utils/TypeHelpers.h>
-#include <ui/Point.h>
-
-#include <android/rect.h>
-
-namespace android {
-
-class Rect : public ARect
-{
-public:
- typedef ARect::value_type value_type;
-
- // we don't provide copy-ctor and operator= on purpose
- // because we want the compiler generated versions
-
- inline Rect() {
- }
- inline Rect(int32_t w, int32_t h) {
- left = top = 0; right = w; bottom = h;
- }
- inline Rect(int32_t l, int32_t t, int32_t r, int32_t b) {
- left = l; top = t; right = r; bottom = b;
- }
- inline Rect(const Point& lt, const Point& rb) {
- left = lt.x; top = lt.y; right = rb.x; bottom = rb.y;
- }
-
- void makeInvalid();
-
- inline void clear() {
- left = top = right = bottom = 0;
- }
-
- // a valid rectangle has a non negative width and height
- inline bool isValid() const {
- return (width()>=0) && (height()>=0);
- }
-
- // an empty rect has a zero width or height, or is invalid
- inline bool isEmpty() const {
- return (width()<=0) || (height()<=0);
- }
-
- inline void set(const Rect& rhs) {
- operator = (rhs);
- }
-
- // rectangle's width
- inline int32_t width() const {
- return right-left;
- }
-
- // rectangle's height
- inline int32_t height() const {
- return bottom-top;
- }
-
- void setLeftTop(const Point& lt) {
- left = lt.x;
- top = lt.y;
- }
-
- void setRightBottom(const Point& rb) {
- right = rb.x;
- bottom = rb.y;
- }
-
- // the following 4 functions return the 4 corners of the rect as Point
- Point leftTop() const {
- return Point(left, top);
- }
- Point rightBottom() const {
- return Point(right, bottom);
- }
- Point rightTop() const {
- return Point(right, top);
- }
- Point leftBottom() const {
- return Point(left, bottom);
- }
-
- // comparisons
- inline bool operator == (const Rect& rhs) const {
- return (left == rhs.left) && (top == rhs.top) &&
- (right == rhs.right) && (bottom == rhs.bottom);
- }
-
- inline bool operator != (const Rect& rhs) const {
- return !operator == (rhs);
- }
-
- // operator < defines an order which allows to use rectangles in sorted
- // vectors.
- bool operator < (const Rect& rhs) const;
-
- Rect& offsetToOrigin() {
- right -= left;
- bottom -= top;
- left = top = 0;
- return *this;
- }
- Rect& offsetTo(const Point& p) {
- return offsetTo(p.x, p.y);
- }
- Rect& offsetBy(const Point& dp) {
- return offsetBy(dp.x, dp.y);
- }
- Rect& operator += (const Point& rhs) {
- return offsetBy(rhs.x, rhs.y);
- }
- Rect& operator -= (const Point& rhs) {
- return offsetBy(-rhs.x, -rhs.y);
- }
- const Rect operator + (const Point& rhs) const;
- const Rect operator - (const Point& rhs) const;
-
- void translate(int32_t dx, int32_t dy) { // legacy, don't use.
- offsetBy(dx, dy);
- }
-
- Rect& offsetTo(int32_t x, int32_t y);
- Rect& offsetBy(int32_t x, int32_t y);
- bool intersect(const Rect& with, Rect* result) const;
-};
-
-ANDROID_BASIC_TYPES_TRAITS(Rect)
-
-}; // namespace android
-
-#endif // ANDROID_UI_RECT
diff --git a/include/ui/Region.h b/include/ui/Region.h
deleted file mode 100644
index f242f18..0000000
--- a/include/ui/Region.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UI_REGION_H
-#define ANDROID_UI_REGION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Vector.h>
-
-#include <ui/Rect.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-
-// ---------------------------------------------------------------------------
-class Region
-{
-public:
- Region();
- Region(const Region& rhs);
- explicit Region(const Rect& rhs);
- explicit Region(const void* buffer);
- ~Region();
-
- Region& operator = (const Region& rhs);
-
- inline bool isEmpty() const { return mBounds.isEmpty(); }
- inline bool isRect() const { return mStorage.isEmpty(); }
-
- inline Rect getBounds() const { return mBounds; }
- inline Rect bounds() const { return getBounds(); }
-
- // the region becomes its bounds
- Region& makeBoundsSelf();
-
- void clear();
- void set(const Rect& r);
- void set(uint32_t w, uint32_t h);
-
- Region& orSelf(const Rect& rhs);
- Region& xorSelf(const Rect& rhs);
- Region& andSelf(const Rect& rhs);
- Region& subtractSelf(const Rect& rhs);
-
- // boolean operators, applied on this
- Region& orSelf(const Region& rhs);
- Region& xorSelf(const Region& rhs);
- Region& andSelf(const Region& rhs);
- Region& subtractSelf(const Region& rhs);
-
- // boolean operators
- const Region merge(const Rect& rhs) const;
- const Region mergeExclusive(const Rect& rhs) const;
- const Region intersect(const Rect& rhs) const;
- const Region subtract(const Rect& rhs) const;
-
- // boolean operators
- const Region merge(const Region& rhs) const;
- const Region mergeExclusive(const Region& rhs) const;
- const Region intersect(const Region& rhs) const;
- const Region subtract(const Region& rhs) const;
-
- // these translate rhs first
- Region& translateSelf(int dx, int dy);
- Region& orSelf(const Region& rhs, int dx, int dy);
- Region& xorSelf(const Region& rhs, int dx, int dy);
- Region& andSelf(const Region& rhs, int dx, int dy);
- Region& subtractSelf(const Region& rhs, int dx, int dy);
-
- // these translate rhs first
- const Region translate(int dx, int dy) const;
- const Region merge(const Region& rhs, int dx, int dy) const;
- const Region mergeExclusive(const Region& rhs, int dx, int dy) const;
- const Region intersect(const Region& rhs, int dx, int dy) const;
- const Region subtract(const Region& rhs, int dx, int dy) const;
-
- // convenience operators overloads
- inline const Region operator | (const Region& rhs) const;
- inline const Region operator ^ (const Region& rhs) const;
- inline const Region operator & (const Region& rhs) const;
- inline const Region operator - (const Region& rhs) const;
- inline const Region operator + (const Point& pt) const;
-
- inline Region& operator |= (const Region& rhs);
- inline Region& operator ^= (const Region& rhs);
- inline Region& operator &= (const Region& rhs);
- inline Region& operator -= (const Region& rhs);
- inline Region& operator += (const Point& pt);
-
-
- /* various ways to access the rectangle list */
-
- typedef Rect const* const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- /* no user serviceable parts here... */
-
- size_t getRects(Vector<Rect>& rectList) const;
- Rect const* getArray(size_t* count) const;
-
-
- // add a rectangle to the internal list. This rectangle must
- // be sorted in Y and X and must not make the region invalid.
- void addRectUnchecked(int l, int t, int r, int b);
-
- // flatten/unflatten a region to/from a raw buffer
- ssize_t write(void* buffer, size_t size) const;
- static ssize_t writeEmpty(void* buffer, size_t size);
-
- ssize_t read(const void* buffer);
- static bool isEmpty(void* buffer);
-
- void dump(String8& out, const char* what, uint32_t flags=0) const;
- void dump(const char* what, uint32_t flags=0) const;
-
-private:
- class rasterizer;
- friend class rasterizer;
-
- Region& operationSelf(const Rect& r, int op);
- Region& operationSelf(const Region& r, int op);
- Region& operationSelf(const Region& r, int dx, int dy, int op);
- const Region operation(const Rect& rhs, int op) const;
- const Region operation(const Region& rhs, int op) const;
- const Region operation(const Region& rhs, int dx, int dy, int op) const;
-
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs, int dx, int dy);
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs, int dx, int dy);
-
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs);
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs);
-
- static void translate(Region& reg, int dx, int dy);
- static void translate(Region& dst, const Region& reg, int dx, int dy);
-
- static bool validate(const Region& reg, const char* name);
-
- Rect mBounds;
- Vector<Rect> mStorage;
-};
-
-
-const Region Region::operator | (const Region& rhs) const {
- return merge(rhs);
-}
-const Region Region::operator ^ (const Region& rhs) const {
- return mergeExclusive(rhs);
-}
-const Region Region::operator & (const Region& rhs) const {
- return intersect(rhs);
-}
-const Region Region::operator - (const Region& rhs) const {
- return subtract(rhs);
-}
-const Region Region::operator + (const Point& pt) const {
- return translate(pt.x, pt.y);
-}
-
-
-Region& Region::operator |= (const Region& rhs) {
- return orSelf(rhs);
-}
-Region& Region::operator ^= (const Region& rhs) {
- return xorSelf(rhs);
-}
-Region& Region::operator &= (const Region& rhs) {
- return andSelf(rhs);
-}
-Region& Region::operator -= (const Region& rhs) {
- return subtractSelf(rhs);
-}
-Region& Region::operator += (const Point& pt) {
- return translateSelf(pt.x, pt.y);
-}
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_UI_REGION_H
-
diff --git a/include/utils/AndroidThreads.h b/include/utils/AndroidThreads.h
deleted file mode 100644
index f9f7aa4..0000000
--- a/include/utils/AndroidThreads.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_ANDROID_THREADS_H
-#define _LIBS_UTILS_ANDROID_THREADS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/ThreadDefs.h>
-
-// ---------------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Create and run a new thread.
-extern int androidCreateThread(android_thread_func_t, void *);
-
-// Create thread with lots of parameters
-extern int androidCreateThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-// Get some sort of unique identifier for the current thread.
-extern android_thread_id_t androidGetThreadId();
-
-// Low-level thread creation -- never creates threads that can
-// interact with the Java VM.
-extern int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-// Used by the Java Runtime to control how threads are created, so that
-// they can be proper and lovely Java threads.
-typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-extern void androidSetCreateThreadFunc(android_create_thread_fn func);
-
-// ------------------------------------------------------------------
-// Extra functions working with raw pids.
-
-// Get pid for the current thread.
-extern pid_t androidGetTid();
-
-// Change the scheduling group of a particular thread. The group
-// should be one of the ANDROID_TGROUP constants. Returns BAD_VALUE if
-// grp is out of range, else another non-zero value with errno set if
-// the operation failed. Thread ID zero means current thread.
-extern int androidSetThreadSchedulingGroup(pid_t tid, int grp);
-
-// Change the priority AND scheduling group of a particular thread. The priority
-// should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION
-// if the priority set failed, else another value if just the group set failed;
-// in either case errno is set. Thread ID zero means current thread.
-extern int androidSetThreadPriority(pid_t tid, int prio);
-
-// Get the current priority of a particular thread. Returns one of the
-// ANDROID_PRIORITY constants or a negative result in case of error.
-extern int androidGetThreadPriority(pid_t tid);
-
-// Get the current scheduling group of a particular thread. Normally returns
-// one of the ANDROID_TGROUP constants other than ANDROID_TGROUP_DEFAULT.
-// Returns ANDROID_TGROUP_DEFAULT if no pthread support (e.g. on host) or if
-// scheduling groups are disabled. Returns INVALID_OPERATION if unexpected error.
-// Thread ID zero means current thread.
-extern int androidGetThreadSchedulingGroup(pid_t tid);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ----------------------------------------------------------------------------
-// C++ API
-#ifdef __cplusplus
-namespace android {
-// ----------------------------------------------------------------------------
-
-// Create and run a new thread.
-inline bool createThread(thread_func_t f, void *a) {
- return androidCreateThread(f, a) ? true : false;
-}
-
-// Create thread with lots of parameters
-inline bool createThreadEtc(thread_func_t entryFunction,
- void *userData,
- const char* threadName = "android:unnamed_thread",
- int32_t threadPriority = PRIORITY_DEFAULT,
- size_t threadStackSize = 0,
- thread_id_t *threadId = 0)
-{
- return androidCreateThreadEtc(entryFunction, userData, threadName,
- threadPriority, threadStackSize, threadId) ? true : false;
-}
-
-// Get some sort of unique identifier for the current thread.
-inline thread_id_t getThreadId() {
- return androidGetThreadId();
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-#endif // __cplusplus
-// ----------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_ANDROID_THREADS_H
diff --git a/include/utils/Atomic.h b/include/utils/Atomic.h
deleted file mode 100644
index 7eb476c..0000000
--- a/include/utils/Atomic.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UTILS_ATOMIC_H
-#define ANDROID_UTILS_ATOMIC_H
-
-#include <cutils/atomic.h>
-
-#endif // ANDROID_UTILS_ATOMIC_H
diff --git a/include/utils/BasicHashtable.h b/include/utils/BasicHashtable.h
deleted file mode 100644
index fdf9738..0000000
--- a/include/utils/BasicHashtable.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_BASIC_HASHTABLE_H
-#define ANDROID_BASIC_HASHTABLE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/SharedBuffer.h>
-#include <utils/TypeHelpers.h>
-
-namespace android {
-
-/* Implementation type. Nothing to see here. */
-class BasicHashtableImpl {
-protected:
- struct Bucket {
- // The collision flag indicates that the bucket is part of a collision chain
- // such that at least two entries both hash to this bucket. When true, we
- // may need to seek further along the chain to find the entry.
- static const uint32_t COLLISION = 0x80000000UL;
-
- // The present flag indicates that the bucket contains an initialized entry value.
- static const uint32_t PRESENT = 0x40000000UL;
-
- // Mask for 30 bits worth of the hash code that are stored within the bucket to
- // speed up lookups and rehashing by eliminating the need to recalculate the
- // hash code of the entry's key.
- static const uint32_t HASH_MASK = 0x3fffffffUL;
-
- // Combined value that stores the collision and present flags as well as
- // a 30 bit hash code.
- uint32_t cookie;
-
- // Storage for the entry begins here.
- char entry[0];
- };
-
- BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
- size_t minimumInitialCapacity, float loadFactor);
- BasicHashtableImpl(const BasicHashtableImpl& other);
-
- void dispose();
-
- inline void edit() {
- if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) {
- clone();
- }
- }
-
- void setTo(const BasicHashtableImpl& other);
- void clear();
-
- ssize_t next(ssize_t index) const;
- ssize_t find(ssize_t index, hash_t hash, const void* __restrict__ key) const;
- size_t add(hash_t hash, const void* __restrict__ entry);
- void removeAt(size_t index);
- void rehash(size_t minimumCapacity, float loadFactor);
-
- const size_t mBucketSize; // number of bytes per bucket including the entry
- const bool mHasTrivialDestructor; // true if the entry type does not require destruction
- size_t mCapacity; // number of buckets that can be filled before exceeding load factor
- float mLoadFactor; // load factor
- size_t mSize; // number of elements actually in the table
- size_t mFilledBuckets; // number of buckets for which collision or present is true
- size_t mBucketCount; // number of slots in the mBuckets array
- void* mBuckets; // array of buckets, as a SharedBuffer
-
- inline const Bucket& bucketAt(const void* __restrict__ buckets, size_t index) const {
- return *reinterpret_cast<const Bucket*>(
- static_cast<const uint8_t*>(buckets) + index * mBucketSize);
- }
-
- inline Bucket& bucketAt(void* __restrict__ buckets, size_t index) const {
- return *reinterpret_cast<Bucket*>(static_cast<uint8_t*>(buckets) + index * mBucketSize);
- }
-
- virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const = 0;
- virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const = 0;
- virtual void destroyBucketEntry(Bucket& bucket) const = 0;
-
-private:
- void clone();
-
- // Allocates a bucket array as a SharedBuffer.
- void* allocateBuckets(size_t count) const;
-
- // Releases a bucket array's associated SharedBuffer.
- void releaseBuckets(void* __restrict__ buckets, size_t count) const;
-
- // Destroys the contents of buckets (invokes destroyBucketEntry for each
- // populated bucket if needed).
- void destroyBuckets(void* __restrict__ buckets, size_t count) const;
-
- // Copies the content of buckets (copies the cookie and invokes copyBucketEntry
- // for each populated bucket if needed).
- void copyBuckets(const void* __restrict__ fromBuckets,
- void* __restrict__ toBuckets, size_t count) const;
-
- // Determines the appropriate size of a bucket array to store a certain minimum
- // number of entries and returns its effective capacity.
- static void determineCapacity(size_t minimumCapacity, float loadFactor,
- size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity);
-
- // Trim a hash code to 30 bits to match what we store in the bucket's cookie.
- inline static hash_t trimHash(hash_t hash) {
- return (hash & Bucket::HASH_MASK) ^ (hash >> 30);
- }
-
- // Returns the index of the first bucket that is in the collision chain
- // for the specified hash code, given the total number of buckets.
- // (Primary hash)
- inline static size_t chainStart(hash_t hash, size_t count) {
- return hash % count;
- }
-
- // Returns the increment to add to a bucket index to seek to the next bucket
- // in the collision chain for the specified hash code, given the total number of buckets.
- // (Secondary hash)
- inline static size_t chainIncrement(hash_t hash, size_t count) {
- return ((hash >> 7) | (hash << 25)) % (count - 1) + 1;
- }
-
- // Returns the index of the next bucket that is in the collision chain
- // that is defined by the specified increment, given the total number of buckets.
- inline static size_t chainSeek(size_t index, size_t increment, size_t count) {
- return (index + increment) % count;
- }
-};
-
-/*
- * A BasicHashtable stores entries that are indexed by hash code in place
- * within an array. The basic operations are finding entries by key,
- * adding new entries and removing existing entries.
- *
- * This class provides a very limited set of operations with simple semantics.
- * It is intended to be used as a building block to construct more complex
- * and interesting data structures such as HashMap. Think very hard before
- * adding anything extra to BasicHashtable, it probably belongs at a
- * higher level of abstraction.
- *
- * TKey: The key type.
- * TEntry: The entry type which is what is actually stored in the array.
- *
- * TKey must support the following contract:
- * bool operator==(const TKey& other) const; // return true if equal
- * bool operator!=(const TKey& other) const; // return true if unequal
- *
- * TEntry must support the following contract:
- * const TKey& getKey() const; // get the key from the entry
- *
- * This class supports storing entries with duplicate keys. Of course, it can't
- * tell them apart during removal so only the first entry will be removed.
- * We do this because it means that operations like add() can't fail.
- */
-template <typename TKey, typename TEntry>
-class BasicHashtable : private BasicHashtableImpl {
-public:
- /* Creates a hashtable with the specified minimum initial capacity.
- * The underlying array will be created when the first entry is added.
- *
- * minimumInitialCapacity: The minimum initial capacity for the hashtable.
- * Default is 0.
- * loadFactor: The desired load factor for the hashtable, between 0 and 1.
- * Default is 0.75.
- */
- BasicHashtable(size_t minimumInitialCapacity = 0, float loadFactor = 0.75f);
-
- /* Copies a hashtable.
- * The underlying storage is shared copy-on-write.
- */
- BasicHashtable(const BasicHashtable& other);
-
- /* Clears and destroys the hashtable.
- */
- virtual ~BasicHashtable();
-
- /* Making this hashtable a copy of the other hashtable.
- * The underlying storage is shared copy-on-write.
- *
- * other: The hashtable to copy.
- */
- inline BasicHashtable<TKey, TEntry>& operator =(const BasicHashtable<TKey, TEntry> & other) {
- setTo(other);
- return *this;
- }
-
- /* Returns the number of entries in the hashtable.
- */
- inline size_t size() const {
- return mSize;
- }
-
- /* Returns the capacity of the hashtable, which is the number of elements that can
- * added to the hashtable without requiring it to be grown.
- */
- inline size_t capacity() const {
- return mCapacity;
- }
-
- /* Returns the number of buckets that the hashtable has, which is the size of its
- * underlying array.
- */
- inline size_t bucketCount() const {
- return mBucketCount;
- }
-
- /* Returns the load factor of the hashtable. */
- inline float loadFactor() const {
- return mLoadFactor;
- };
-
- /* Returns a const reference to the entry at the specified index.
- *
- * index: The index of the entry to retrieve. Must be a valid index within
- * the bounds of the hashtable.
- */
- inline const TEntry& entryAt(size_t index) const {
- return entryFor(bucketAt(mBuckets, index));
- }
-
- /* Returns a non-const reference to the entry at the specified index.
- *
- * index: The index of the entry to edit. Must be a valid index within
- * the bounds of the hashtable.
- */
- inline TEntry& editEntryAt(size_t index) {
- edit();
- return entryFor(bucketAt(mBuckets, index));
- }
-
- /* Clears the hashtable.
- * All entries in the hashtable are destroyed immediately.
- * If you need to do something special with the entries in the hashtable then iterate
- * over them and do what you need before clearing the hashtable.
- */
- inline void clear() {
- BasicHashtableImpl::clear();
- }
-
- /* Returns the index of the next entry in the hashtable given the index of a previous entry.
- * If the given index is -1, then returns the index of the first entry in the hashtable,
- * if there is one, or -1 otherwise.
- * If the given index is not -1, then returns the index of the next entry in the hashtable,
- * in strictly increasing order, or -1 if there are none left.
- *
- * index: The index of the previous entry that was iterated, or -1 to begin
- * iteration at the beginning of the hashtable.
- */
- inline ssize_t next(ssize_t index) const {
- return BasicHashtableImpl::next(index);
- }
-
- /* Finds the index of an entry with the specified key.
- * If the given index is -1, then returns the index of the first matching entry,
- * otherwise returns the index of the next matching entry.
- * If the hashtable contains multiple entries with keys that match the requested
- * key, then the sequence of entries returned is arbitrary.
- * Returns -1 if no entry was found.
- *
- * index: The index of the previous entry with the specified key, or -1 to
- * find the first matching entry.
- * hash: The hashcode of the key.
- * key: The key.
- */
- inline ssize_t find(ssize_t index, hash_t hash, const TKey& key) const {
- return BasicHashtableImpl::find(index, hash, &key);
- }
-
- /* Adds the entry to the hashtable.
- * Returns the index of the newly added entry.
- * If an entry with the same key already exists, then a duplicate entry is added.
- * If the entry will not fit, then the hashtable's capacity is increased and
- * its contents are rehashed. See rehash().
- *
- * hash: The hashcode of the key.
- * entry: The entry to add.
- */
- inline size_t add(hash_t hash, const TEntry& entry) {
- return BasicHashtableImpl::add(hash, &entry);
- }
-
- /* Removes the entry with the specified index from the hashtable.
- * The entry is destroyed immediately.
- * The index must be valid.
- *
- * The hashtable is not compacted after an item is removed, so it is legal
- * to continue iterating over the hashtable using next() or find().
- *
- * index: The index of the entry to remove. Must be a valid index within the
- * bounds of the hashtable, and it must refer to an existing entry.
- */
- inline void removeAt(size_t index) {
- BasicHashtableImpl::removeAt(index);
- }
-
- /* Rehashes the contents of the hashtable.
- * Grows the hashtable to at least the specified minimum capacity or the
- * current number of elements, whichever is larger.
- *
- * Rehashing causes all entries to be copied and the entry indices may change.
- * Although the hash codes are cached by the hashtable, rehashing can be an
- * expensive operation and should be avoided unless the hashtable's size
- * needs to be changed.
- *
- * Rehashing is the only way to change the capacity or load factor of the
- * hashtable once it has been created. It can be used to compact the
- * hashtable by choosing a minimum capacity that is smaller than the current
- * capacity (such as 0).
- *
- * minimumCapacity: The desired minimum capacity after rehashing.
- * loadFactor: The desired load factor after rehashing.
- */
- inline void rehash(size_t minimumCapacity, float loadFactor) {
- BasicHashtableImpl::rehash(minimumCapacity, loadFactor);
- }
-
-protected:
- static inline const TEntry& entryFor(const Bucket& bucket) {
- return reinterpret_cast<const TEntry&>(bucket.entry);
- }
-
- static inline TEntry& entryFor(Bucket& bucket) {
- return reinterpret_cast<TEntry&>(bucket.entry);
- }
-
- virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const;
- virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const;
- virtual void destroyBucketEntry(Bucket& bucket) const;
-
-private:
- // For dumping the raw contents of a hashtable during testing.
- friend class BasicHashtableTest;
- inline uint32_t cookieAt(size_t index) const {
- return bucketAt(mBuckets, index).cookie;
- }
-};
-
-template <typename TKey, typename TEntry>
-BasicHashtable<TKey, TEntry>::BasicHashtable(size_t minimumInitialCapacity, float loadFactor) :
- BasicHashtableImpl(sizeof(TEntry), traits<TEntry>::has_trivial_dtor,
- minimumInitialCapacity, loadFactor) {
-}
-
-template <typename TKey, typename TEntry>
-BasicHashtable<TKey, TEntry>::BasicHashtable(const BasicHashtable<TKey, TEntry>& other) :
- BasicHashtableImpl(other) {
-}
-
-template <typename TKey, typename TEntry>
-BasicHashtable<TKey, TEntry>::~BasicHashtable() {
- dispose();
-}
-
-template <typename TKey, typename TEntry>
-bool BasicHashtable<TKey, TEntry>::compareBucketKey(const Bucket& bucket,
- const void* __restrict__ key) const {
- return entryFor(bucket).getKey() == *static_cast<const TKey*>(key);
-}
-
-template <typename TKey, typename TEntry>
-void BasicHashtable<TKey, TEntry>::initializeBucketEntry(Bucket& bucket,
- const void* __restrict__ entry) const {
- if (!traits<TEntry>::has_trivial_copy) {
- new (&entryFor(bucket)) TEntry(*(static_cast<const TEntry*>(entry)));
- } else {
- memcpy(&entryFor(bucket), entry, sizeof(TEntry));
- }
-}
-
-template <typename TKey, typename TEntry>
-void BasicHashtable<TKey, TEntry>::destroyBucketEntry(Bucket& bucket) const {
- if (!traits<TEntry>::has_trivial_dtor) {
- entryFor(bucket).~TEntry();
- }
-}
-
-}; // namespace android
-
-#endif // ANDROID_BASIC_HASHTABLE_H
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h
deleted file mode 100644
index 9452e86..0000000
--- a/include/utils/BitSet.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef UTILS_BITSET_H
-#define UTILS_BITSET_H
-
-#include <stdint.h>
-
-/*
- * Contains some bit manipulation helpers.
- */
-
-namespace android {
-
-// A simple set of 32 bits that can be individually marked or cleared.
-struct BitSet32 {
- uint32_t value;
-
- inline BitSet32() : value(0) { }
- explicit inline BitSet32(uint32_t value) : value(value) { }
-
- // Gets the value associated with a particular bit index.
- static inline uint32_t valueForBit(uint32_t n) { return 0x80000000 >> n; }
-
- // Clears the bit set.
- inline void clear() { value = 0; }
-
- // Returns the number of marked bits in the set.
- inline uint32_t count() const { return __builtin_popcount(value); }
-
- // Returns true if the bit set does not contain any marked bits.
- inline bool isEmpty() const { return ! value; }
-
- // Returns true if the bit set does not contain any unmarked bits.
- inline bool isFull() const { return value == 0xffffffff; }
-
- // Returns true if the specified bit is marked.
- inline bool hasBit(uint32_t n) const { return value & valueForBit(n); }
-
- // Marks the specified bit.
- inline void markBit(uint32_t n) { value |= valueForBit(n); }
-
- // Clears the specified bit.
- inline void clearBit(uint32_t n) { value &= ~ valueForBit(n); }
-
- // Finds the first marked bit in the set.
- // Result is undefined if all bits are unmarked.
- inline uint32_t firstMarkedBit() const { return __builtin_clz(value); }
-
- // Finds the first unmarked bit in the set.
- // Result is undefined if all bits are marked.
- inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); }
-
- // Finds the last marked bit in the set.
- // Result is undefined if all bits are unmarked.
- inline uint32_t lastMarkedBit() const { return 31 - __builtin_ctz(value); }
-
- // Finds the first marked bit in the set and clears it. Returns the bit index.
- // Result is undefined if all bits are unmarked.
- inline uint32_t clearFirstMarkedBit() {
- uint32_t n = firstMarkedBit();
- clearBit(n);
- return n;
- }
-
- // Finds the first unmarked bit in the set and marks it. Returns the bit index.
- // Result is undefined if all bits are marked.
- inline uint32_t markFirstUnmarkedBit() {
- uint32_t n = firstUnmarkedBit();
- markBit(n);
- return n;
- }
-
- // Finds the last marked bit in the set and clears it. Returns the bit index.
- // Result is undefined if all bits are unmarked.
- inline uint32_t clearLastMarkedBit() {
- uint32_t n = lastMarkedBit();
- clearBit(n);
- return n;
- }
-
- // Gets the index of the specified bit in the set, which is the number of
- // marked bits that appear before the specified bit.
- inline uint32_t getIndexOfBit(uint32_t n) const {
- return __builtin_popcount(value & ~(0xffffffffUL >> n));
- }
-
- inline bool operator== (const BitSet32& other) const { return value == other.value; }
- inline bool operator!= (const BitSet32& other) const { return value != other.value; }
-};
-
-} // namespace android
-
-#endif // UTILS_BITSET_H
diff --git a/include/utils/BlobCache.h b/include/utils/BlobCache.h
deleted file mode 100644
index 4f342a2..0000000
--- a/include/utils/BlobCache.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_BLOB_CACHE_H
-#define ANDROID_BLOB_CACHE_H
-
-#include <stddef.h>
-
-#include <utils/Flattenable.h>
-#include <utils/RefBase.h>
-#include <utils/SortedVector.h>
-#include <utils/threads.h>
-
-namespace android {
-
-// A BlobCache is an in-memory cache for binary key/value pairs. A BlobCache
-// does NOT provide any thread-safety guarantees.
-//
-// The cache contents can be serialized to an in-memory buffer or mmap'd file
-// and then reloaded in a subsequent execution of the program. This
-// serialization is non-portable and the data should only be used by the device
-// that generated it.
-class BlobCache : public RefBase, public Flattenable {
-public:
-
- // Create an empty blob cache. The blob cache will cache key/value pairs
- // with key and value sizes less than or equal to maxKeySize and
- // maxValueSize, respectively. The total combined size of ALL cache entries
- // (key sizes plus value sizes) will not exceed maxTotalSize.
- BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize);
-
- // set inserts a new binary value into the cache and associates it with the
- // given binary key. If the key or value are too large for the cache then
- // the cache remains unchanged. This includes the case where a different
- // value was previously associated with the given key - the old value will
- // remain in the cache. If the given key and value are small enough to be
- // put in the cache (based on the maxKeySize, maxValueSize, and maxTotalSize
- // values specified to the BlobCache constructor), then the key/value pair
- // will be in the cache after set returns. Note, however, that a subsequent
- // call to set may evict old key/value pairs from the cache.
- //
- // Preconditions:
- // key != NULL
- // 0 < keySize
- // value != NULL
- // 0 < valueSize
- void set(const void* key, size_t keySize, const void* value,
- size_t valueSize);
-
- // get retrieves from the cache the binary value associated with a given
- // binary key. If the key is present in the cache then the length of the
- // binary value associated with that key is returned. If the value argument
- // is non-NULL and the size of the cached value is less than valueSize bytes
- // then the cached value is copied into the buffer pointed to by the value
- // argument. If the key is not present in the cache then 0 is returned and
- // the buffer pointed to by the value argument is not modified.
- //
- // Note that when calling get multiple times with the same key, the later
- // calls may fail, returning 0, even if earlier calls succeeded. The return
- // value must be checked for each call.
- //
- // Preconditions:
- // key != NULL
- // 0 < keySize
- // 0 <= valueSize
- size_t get(const void* key, size_t keySize, void* value, size_t valueSize);
-
- // getFlattenedSize returns the number of bytes needed to store the entire
- // serialized cache.
- virtual size_t getFlattenedSize() const;
-
- // getFdCount returns the number of file descriptors that will result from
- // flattening the cache. This will always return 0 so as to allow the
- // flattened cache to be saved to disk and then later restored.
- virtual size_t getFdCount() const;
-
- // flatten serializes the current contents of the cache into the memory
- // pointed to by 'buffer'. The serialized cache contents can later be
- // loaded into a BlobCache object using the unflatten method. The contents
- // of the BlobCache object will not be modified.
- //
- // Preconditions:
- // size >= this.getFlattenedSize()
- // count == 0
- virtual status_t flatten(void* buffer, size_t size, int fds[],
- size_t count) const;
-
- // unflatten replaces the contents of the cache with the serialized cache
- // contents in the memory pointed to by 'buffer'. The previous contents of
- // the BlobCache will be evicted from the cache. If an error occurs while
- // unflattening the serialized cache contents then the BlobCache will be
- // left in an empty state.
- //
- // Preconditions:
- // count == 0
- virtual status_t unflatten(void const* buffer, size_t size, int fds[],
- size_t count);
-
-private:
- // Copying is disallowed.
- BlobCache(const BlobCache&);
- void operator=(const BlobCache&);
-
- // A random function helper to get around MinGW not having nrand48()
- long int blob_random();
-
- // clean evicts a randomly chosen set of entries from the cache such that
- // the total size of all remaining entries is less than mMaxTotalSize/2.
- void clean();
-
- // isCleanable returns true if the cache is full enough for the clean method
- // to have some effect, and false otherwise.
- bool isCleanable() const;
-
- // A Blob is an immutable sized unstructured data blob.
- class Blob : public RefBase {
- public:
- Blob(const void* data, size_t size, bool copyData);
- ~Blob();
-
- bool operator<(const Blob& rhs) const;
-
- const void* getData() const;
- size_t getSize() const;
-
- private:
- // Copying is not allowed.
- Blob(const Blob&);
- void operator=(const Blob&);
-
- // mData points to the buffer containing the blob data.
- const void* mData;
-
- // mSize is the size of the blob data in bytes.
- size_t mSize;
-
- // mOwnsData indicates whether or not this Blob object should free the
- // memory pointed to by mData when the Blob gets destructed.
- bool mOwnsData;
- };
-
- // A CacheEntry is a single key/value pair in the cache.
- class CacheEntry {
- public:
- CacheEntry();
- CacheEntry(const sp<Blob>& key, const sp<Blob>& value);
- CacheEntry(const CacheEntry& ce);
-
- bool operator<(const CacheEntry& rhs) const;
- const CacheEntry& operator=(const CacheEntry&);
-
- sp<Blob> getKey() const;
- sp<Blob> getValue() const;
-
- void setValue(const sp<Blob>& value);
-
- private:
-
- // mKey is the key that identifies the cache entry.
- sp<Blob> mKey;
-
- // mValue is the cached data associated with the key.
- sp<Blob> mValue;
- };
-
- // A Header is the header for the entire BlobCache serialization format. No
- // need to make this portable, so we simply write the struct out.
- struct Header {
- // mMagicNumber is the magic number that identifies the data as
- // serialized BlobCache contents. It must always contain 'Blb$'.
- uint32_t mMagicNumber;
-
- // mBlobCacheVersion is the serialization format version.
- uint32_t mBlobCacheVersion;
-
- // mDeviceVersion is the device-specific version of the cache. This can
- // be used to invalidate the cache.
- uint32_t mDeviceVersion;
-
- // mNumEntries is number of cache entries following the header in the
- // data.
- size_t mNumEntries;
- };
-
- // An EntryHeader is the header for a serialized cache entry. No need to
- // make this portable, so we simply write the struct out. Each EntryHeader
- // is followed imediately by the key data and then the value data.
- //
- // The beginning of each serialized EntryHeader is 4-byte aligned, so the
- // number of bytes that a serialized cache entry will occupy is:
- //
- // ((sizeof(EntryHeader) + keySize + valueSize) + 3) & ~3
- //
- struct EntryHeader {
- // mKeySize is the size of the entry key in bytes.
- size_t mKeySize;
-
- // mValueSize is the size of the entry value in bytes.
- size_t mValueSize;
-
- // mData contains both the key and value data for the cache entry. The
- // key comes first followed immediately by the value.
- uint8_t mData[];
- };
-
- // mMaxKeySize is the maximum key size that will be cached. Calls to
- // BlobCache::set with a keySize parameter larger than mMaxKeySize will
- // simply not add the key/value pair to the cache.
- const size_t mMaxKeySize;
-
- // mMaxValueSize is the maximum value size that will be cached. Calls to
- // BlobCache::set with a valueSize parameter larger than mMaxValueSize will
- // simply not add the key/value pair to the cache.
- const size_t mMaxValueSize;
-
- // mMaxTotalSize is the maximum size that all cache entries can occupy. This
- // includes space for both keys and values. When a call to BlobCache::set
- // would otherwise cause this limit to be exceeded, either the key/value
- // pair passed to BlobCache::set will not be cached or other cache entries
- // will be evicted from the cache to make room for the new entry.
- const size_t mMaxTotalSize;
-
- // mTotalSize is the total combined size of all keys and values currently in
- // the cache.
- size_t mTotalSize;
-
- // mRandState is the pseudo-random number generator state. It is passed to
- // nrand48 to generate random numbers when needed.
- unsigned short mRandState[3];
-
- // mCacheEntries stores all the cache entries that are resident in memory.
- // Cache entries are added to it by the 'set' method.
- SortedVector<CacheEntry> mCacheEntries;
-};
-
-}
-
-#endif // ANDROID_BLOB_CACHE_H
diff --git a/include/utils/BufferedTextOutput.h b/include/utils/BufferedTextOutput.h
deleted file mode 100644
index 69c6240..0000000
--- a/include/utils/BufferedTextOutput.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_BUFFEREDTEXTOUTPUT_H
-#define ANDROID_BUFFEREDTEXTOUTPUT_H
-
-#include <utils/TextOutput.h>
-#include <utils/threads.h>
-#include <cutils/uio.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BufferedTextOutput : public TextOutput
-{
-public:
- //** Flags for constructor */
- enum {
- MULTITHREADED = 0x0001
- };
-
- BufferedTextOutput(uint32_t flags = 0);
- virtual ~BufferedTextOutput();
-
- virtual status_t print(const char* txt, size_t len);
- virtual void moveIndent(int delta);
-
- virtual void pushBundle();
- virtual void popBundle();
-
-protected:
- virtual status_t writeLines(const struct iovec& vec, size_t N) = 0;
-
-private:
- struct BufferState;
- struct ThreadState;
-
- static ThreadState*getThreadState();
- static void threadDestructor(void *st);
-
- BufferState*getBuffer() const;
-
- uint32_t mFlags;
- const int32_t mSeq;
- const int32_t mIndex;
-
- Mutex mLock;
- BufferState* mGlobalState;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_BUFFEREDTEXTOUTPUT_H
diff --git a/include/utils/ByteOrder.h b/include/utils/ByteOrder.h
deleted file mode 100644
index baa3a83..0000000
--- a/include/utils/ByteOrder.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-//
-
-#ifndef _LIBS_UTILS_BYTE_ORDER_H
-#define _LIBS_UTILS_BYTE_ORDER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#ifdef HAVE_WINSOCK
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#endif
-
-/*
- * These macros are like the hton/ntoh byte swapping macros,
- * except they allow you to swap to and from the "device" byte
- * order. The device byte order is the endianness of the target
- * device -- for the ARM CPUs we use today, this is little endian.
- *
- * Note that the byte swapping functions have not been optimized
- * much; performance is currently not an issue for them since the
- * intent is to allow us to avoid byte swapping on the device.
- */
-
-static inline uint32_t android_swap_long(uint32_t v)
-{
- return (v<<24) | ((v<<8)&0x00FF0000) | ((v>>8)&0x0000FF00) | (v>>24);
-}
-
-static inline uint16_t android_swap_short(uint16_t v)
-{
- return (v<<8) | (v>>8);
-}
-
-#define DEVICE_BYTE_ORDER LITTLE_ENDIAN
-
-#if BYTE_ORDER == DEVICE_BYTE_ORDER
-
-#define dtohl(x) (x)
-#define dtohs(x) (x)
-#define htodl(x) (x)
-#define htods(x) (x)
-
-#else
-
-#define dtohl(x) (android_swap_long(x))
-#define dtohs(x) (android_swap_short(x))
-#define htodl(x) (android_swap_long(x))
-#define htods(x) (android_swap_short(x))
-
-#endif
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define fromlel(x) (x)
-#define fromles(x) (x)
-#define tolel(x) (x)
-#define toles(x) (x)
-#else
-#define fromlel(x) (android_swap_long(x))
-#define fromles(x) (android_swap_short(x))
-#define tolel(x) (android_swap_long(x))
-#define toles(x) (android_swap_short(x))
-#endif
-
-#endif // _LIBS_UTILS_BYTE_ORDER_H
diff --git a/include/utils/CallStack.h b/include/utils/CallStack.h
deleted file mode 100644
index 079e20c..0000000
--- a/include/utils/CallStack.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_CALLSTACK_H
-#define ANDROID_CALLSTACK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/String8.h>
-#include <corkscrew/backtrace.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class CallStack
-{
-public:
- enum {
- MAX_DEPTH = 31
- };
-
- CallStack();
- CallStack(const CallStack& rhs);
- ~CallStack();
-
- CallStack& operator = (const CallStack& rhs);
-
- bool operator == (const CallStack& rhs) const;
- bool operator != (const CallStack& rhs) const;
- bool operator < (const CallStack& rhs) const;
- bool operator >= (const CallStack& rhs) const;
- bool operator > (const CallStack& rhs) const;
- bool operator <= (const CallStack& rhs) const;
-
- const void* operator [] (int index) const;
-
- void clear();
-
- void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH);
-
- // Dump a stack trace to the log
- void dump(const char* prefix = 0) const;
-
- // Return a string (possibly very long) containing the complete stack trace
- String8 toString(const char* prefix = 0) const;
-
- size_t size() const { return mCount; }
-
-private:
- size_t mCount;
- backtrace_frame_t mStack[MAX_DEPTH];
-};
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_CALLSTACK_H
diff --git a/include/utils/Compat.h b/include/utils/Compat.h
deleted file mode 100644
index 1819266..0000000
--- a/include/utils/Compat.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef __LIB_UTILS_COMPAT_H
-#define __LIB_UTILS_COMPAT_H
-
-#include <unistd.h>
-
-/* Compatibility definitions for non-Linux (i.e., BSD-based) hosts. */
-#ifndef HAVE_OFF64_T
-#if _FILE_OFFSET_BITS < 64
-#error "_FILE_OFFSET_BITS < 64; large files are not supported on this platform"
-#endif /* _FILE_OFFSET_BITS < 64 */
-
-typedef off_t off64_t;
-
-static inline off64_t lseek64(int fd, off64_t offset, int whence) {
- return lseek(fd, offset, whence);
-}
-
-#ifdef HAVE_PREAD
-static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset) {
- return pread(fd, buf, nbytes, offset);
-}
-#endif
-
-#endif /* !HAVE_OFF64_T */
-
-#endif /* __LIB_UTILS_COMPAT_H */
diff --git a/include/utils/Condition.h b/include/utils/Condition.h
deleted file mode 100644
index 8852d53..0000000
--- a/include/utils/Condition.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_CONDITION_H
-#define _LIBS_UTILS_CONDITION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Errors.h>
-#include <utils/Mutex.h>
-#include <utils/Timers.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-/*
- * Condition variable class. The implementation is system-dependent.
- *
- * Condition variables are paired up with mutexes. Lock the mutex,
- * call wait(), then either re-wait() if things aren't quite what you want,
- * or unlock the mutex and continue. All threads calling wait() must
- * use the same mutex for a given Condition.
- */
-class Condition {
-public:
- enum {
- PRIVATE = 0,
- SHARED = 1
- };
-
- Condition();
- Condition(int type);
- ~Condition();
- // Wait on the condition variable. Lock the mutex before calling.
- status_t wait(Mutex& mutex);
- // same with relative timeout
- status_t waitRelative(Mutex& mutex, nsecs_t reltime);
- // Signal the condition variable, allowing one thread to continue.
- void signal();
- // Signal the condition variable, allowing all threads to continue.
- void broadcast();
-
-private:
-#if defined(HAVE_PTHREADS)
- pthread_cond_t mCond;
-#else
- void* mState;
-#endif
-};
-
-// ---------------------------------------------------------------------------
-
-#if defined(HAVE_PTHREADS)
-
-inline Condition::Condition() {
- pthread_cond_init(&mCond, NULL);
-}
-inline Condition::Condition(int type) {
- if (type == SHARED) {
- pthread_condattr_t attr;
- pthread_condattr_init(&attr);
- pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
- pthread_cond_init(&mCond, &attr);
- pthread_condattr_destroy(&attr);
- } else {
- pthread_cond_init(&mCond, NULL);
- }
-}
-inline Condition::~Condition() {
- pthread_cond_destroy(&mCond);
-}
-inline status_t Condition::wait(Mutex& mutex) {
- return -pthread_cond_wait(&mCond, &mutex.mMutex);
-}
-inline status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) {
-#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE)
- struct timespec ts;
- ts.tv_sec = reltime/1000000000;
- ts.tv_nsec = reltime%1000000000;
- return -pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts);
-#else // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
- struct timespec ts;
-#if defined(HAVE_POSIX_CLOCKS)
- clock_gettime(CLOCK_REALTIME, &ts);
-#else // HAVE_POSIX_CLOCKS
- // we don't support the clocks here.
- struct timeval t;
- gettimeofday(&t, NULL);
- ts.tv_sec = t.tv_sec;
- ts.tv_nsec= t.tv_usec*1000;
-#endif // HAVE_POSIX_CLOCKS
- ts.tv_sec += reltime/1000000000;
- ts.tv_nsec+= reltime%1000000000;
- if (ts.tv_nsec >= 1000000000) {
- ts.tv_nsec -= 1000000000;
- ts.tv_sec += 1;
- }
- return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts);
-#endif // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
-}
-inline void Condition::signal() {
- pthread_cond_signal(&mCond);
-}
-inline void Condition::broadcast() {
- pthread_cond_broadcast(&mCond);
-}
-
-#endif // HAVE_PTHREADS
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_CONDITON_H
diff --git a/include/utils/Debug.h b/include/utils/Debug.h
deleted file mode 100644
index d9ed32d..0000000
--- a/include/utils/Debug.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_DEBUG_H
-#define ANDROID_DEBUG_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-template<bool> struct CompileTimeAssert;
-template<> struct CompileTimeAssert<true> {};
-#define COMPILE_TIME_ASSERT(_exp) \
- template class CompileTimeAssert< (_exp) >;
-#endif
-#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \
- CompileTimeAssert<( _exp )>();
-
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-template<bool C, typename LSH, typename RHS> struct CompileTimeIfElse;
-template<typename LHS, typename RHS>
-struct CompileTimeIfElse<true, LHS, RHS> { typedef LHS TYPE; };
-template<typename LHS, typename RHS>
-struct CompileTimeIfElse<false, LHS, RHS> { typedef RHS TYPE; };
-#endif
-
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char* stringForIndent(int32_t indentLevel);
-
-typedef void (*debugPrintFunc)(void* cookie, const char* txt);
-
-void printTypeCode(uint32_t typeCode,
- debugPrintFunc func = 0, void* cookie = 0);
-
-void printHexData(int32_t indent, const void *buf, size_t length,
- size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16,
- size_t alignment=0, bool cArrayStyle=false,
- debugPrintFunc func = 0, void* cookie = 0);
-
-#ifdef __cplusplus
-}
-#endif
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_DEBUG_H
diff --git a/include/utils/Endian.h b/include/utils/Endian.h
deleted file mode 100644
index 19f2504..0000000
--- a/include/utils/Endian.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Android endian-ness defines.
-//
-#ifndef _LIBS_UTILS_ENDIAN_H
-#define _LIBS_UTILS_ENDIAN_H
-
-#if defined(HAVE_ENDIAN_H)
-
-#include <endian.h>
-
-#else /*not HAVE_ENDIAN_H*/
-
-#define __BIG_ENDIAN 0x1000
-#define __LITTLE_ENDIAN 0x0001
-
-#if defined(HAVE_LITTLE_ENDIAN)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#else
-# define __BYTE_ORDER __BIG_ENDIAN
-#endif
-
-#endif /*not HAVE_ENDIAN_H*/
-
-#endif /*_LIBS_UTILS_ENDIAN_H*/
diff --git a/include/utils/Errors.h b/include/utils/Errors.h
deleted file mode 100644
index 0b75b19..0000000
--- a/include/utils/Errors.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_ERRORS_H
-#define ANDROID_ERRORS_H
-
-#include <sys/types.h>
-#include <errno.h>
-
-namespace android {
-
-// use this type to return error codes
-#ifdef HAVE_MS_C_RUNTIME
-typedef int status_t;
-#else
-typedef int32_t status_t;
-#endif
-
-/* the MS C runtime lacks a few error codes */
-
-/*
- * Error codes.
- * All error codes are negative values.
- */
-
-// Win32 #defines NO_ERROR as well. It has the same value, so there's no
-// real conflict, though it's a bit awkward.
-#ifdef _WIN32
-# undef NO_ERROR
-#endif
-
-enum {
- OK = 0, // Everything's swell.
- NO_ERROR = 0, // No errors.
-
- UNKNOWN_ERROR = 0x80000000,
-
- NO_MEMORY = -ENOMEM,
- INVALID_OPERATION = -ENOSYS,
- BAD_VALUE = -EINVAL,
- BAD_TYPE = 0x80000001,
- NAME_NOT_FOUND = -ENOENT,
- PERMISSION_DENIED = -EPERM,
- NO_INIT = -ENODEV,
- ALREADY_EXISTS = -EEXIST,
- DEAD_OBJECT = -EPIPE,
- FAILED_TRANSACTION = 0x80000002,
- JPARKS_BROKE_IT = -EPIPE,
-#if !defined(HAVE_MS_C_RUNTIME)
- BAD_INDEX = -EOVERFLOW,
- NOT_ENOUGH_DATA = -ENODATA,
- WOULD_BLOCK = -EWOULDBLOCK,
- TIMED_OUT = -ETIMEDOUT,
- UNKNOWN_TRANSACTION = -EBADMSG,
-#else
- BAD_INDEX = -E2BIG,
- NOT_ENOUGH_DATA = 0x80000003,
- WOULD_BLOCK = 0x80000004,
- TIMED_OUT = 0x80000005,
- UNKNOWN_TRANSACTION = 0x80000006,
-#endif
- FDS_NOT_ALLOWED = 0x80000007,
-};
-
-// Restore define; enumeration is in "android" namespace, so the value defined
-// there won't work for Win32 code in a different namespace.
-#ifdef _WIN32
-# define NO_ERROR 0L
-#endif
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_ERRORS_H
diff --git a/include/utils/FileMap.h b/include/utils/FileMap.h
deleted file mode 100644
index dfe6d51..0000000
--- a/include/utils/FileMap.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Encapsulate a shared file mapping.
-//
-#ifndef __LIBS_FILE_MAP_H
-#define __LIBS_FILE_MAP_H
-
-#include <sys/types.h>
-
-#include <utils/Compat.h>
-
-#ifdef HAVE_WIN32_FILEMAP
-#include <windows.h>
-#endif
-
-namespace android {
-
-/*
- * This represents a memory-mapped file. It might be the entire file or
- * only part of it. This requires a little bookkeeping because the mapping
- * needs to be aligned on page boundaries, and in some cases we'd like to
- * have multiple references to the mapped area without creating additional
- * maps.
- *
- * This always uses MAP_SHARED.
- *
- * TODO: we should be able to create a new FileMap that is a subset of
- * an existing FileMap and shares the underlying mapped pages. Requires
- * completing the refcounting stuff and possibly introducing the notion
- * of a FileMap hierarchy.
- */
-class FileMap {
-public:
- FileMap(void);
-
- /*
- * Create a new mapping on an open file.
- *
- * Closing the file descriptor does not unmap the pages, so we don't
- * claim ownership of the fd.
- *
- * Returns "false" on failure.
- */
- bool create(const char* origFileName, int fd,
- off64_t offset, size_t length, bool readOnly);
-
- /*
- * Return the name of the file this map came from, if known.
- */
- const char* getFileName(void) const { return mFileName; }
-
- /*
- * Get a pointer to the piece of the file we requested.
- */
- void* getDataPtr(void) const { return mDataPtr; }
-
- /*
- * Get the length we requested.
- */
- size_t getDataLength(void) const { return mDataLength; }
-
- /*
- * Get the data offset used to create this map.
- */
- off64_t getDataOffset(void) const { return mDataOffset; }
-
- /*
- * Get a "copy" of the object.
- */
- FileMap* acquire(void) { mRefCount++; return this; }
-
- /*
- * Call this when mapping is no longer needed.
- */
- void release(void) {
- if (--mRefCount <= 0)
- delete this;
- }
-
- /*
- * This maps directly to madvise() values, but allows us to avoid
- * including <sys/mman.h> everywhere.
- */
- enum MapAdvice {
- NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED
- };
-
- /*
- * Apply an madvise() call to the entire file.
- *
- * Returns 0 on success, -1 on failure.
- */
- int advise(MapAdvice advice);
-
-protected:
- // don't delete objects; call release()
- ~FileMap(void);
-
-private:
- // these are not implemented
- FileMap(const FileMap& src);
- const FileMap& operator=(const FileMap& src);
-
- int mRefCount; // reference count
- char* mFileName; // original file name, if known
- void* mBasePtr; // base of mmap area; page aligned
- size_t mBaseLength; // length, measured from "mBasePtr"
- off64_t mDataOffset; // offset used when map was created
- void* mDataPtr; // start of requested data, offset from base
- size_t mDataLength; // length, measured from "mDataPtr"
-#ifdef HAVE_WIN32_FILEMAP
- HANDLE mFileHandle; // Win32 file handle
- HANDLE mFileMapping; // Win32 file mapping handle
-#endif
-
- static long mPageSize;
-};
-
-}; // namespace android
-
-#endif // __LIBS_FILE_MAP_H
diff --git a/include/utils/Flattenable.h b/include/utils/Flattenable.h
deleted file mode 100644
index 852be3b..0000000
--- a/include/utils/Flattenable.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UTILS_FLATTENABLE_H
-#define ANDROID_UTILS_FLATTENABLE_H
-
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-
-namespace android {
-
-class Flattenable
-{
-public:
- // size in bytes of the flattened object
- virtual size_t getFlattenedSize() const = 0;
-
- // number of file descriptors to flatten
- virtual size_t getFdCount() const = 0;
-
- // flattens the object into buffer.
- // size should be at least of getFlattenedSize()
- // file descriptors are written in the fds[] array but ownership is
- // not transfered (ie: they must be dupped by the caller of
- // flatten() if needed).
- virtual status_t flatten(void* buffer, size_t size,
- int fds[], size_t count) const = 0;
-
- // unflattens the object from buffer.
- // size should be equal to the value of getFlattenedSize() when the
- // object was flattened.
- // unflattened file descriptors are found in the fds[] array and
- // don't need to be dupped(). ie: the caller of unflatten doesn't
- // keep ownership. If a fd is not retained by unflatten() it must be
- // explicitly closed.
- virtual status_t unflatten(void const* buffer, size_t size,
- int fds[], size_t count) = 0;
-
-protected:
- virtual ~Flattenable() = 0;
-
-};
-
-}; // namespace android
-
-
-#endif /* ANDROID_UTILS_FLATTENABLE_H */
diff --git a/include/utils/Functor.h b/include/utils/Functor.h
deleted file mode 100644
index e24ded4..0000000
--- a/include/utils/Functor.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_FUNCTOR_H
-#define ANDROID_FUNCTOR_H
-
-#include <utils/Errors.h>
-
-namespace android {
-
-class Functor {
-public:
- Functor() {}
- virtual ~Functor() {}
- virtual status_t operator ()(int what, void* data) { return NO_ERROR; }
-};
-
-}; // namespace android
-
-#endif // ANDROID_FUNCTOR_H
diff --git a/include/utils/GenerationCache.h b/include/utils/GenerationCache.h
deleted file mode 100644
index 40722d1..0000000
--- a/include/utils/GenerationCache.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UTILS_GENERATION_CACHE_H
-#define ANDROID_UTILS_GENERATION_CACHE_H
-
-#include <utils/KeyedVector.h>
-#include <utils/RefBase.h>
-
-namespace android {
-
-/**
- * GenerationCache callback used when an item is removed
- */
-template<typename EntryKey, typename EntryValue>
-class OnEntryRemoved {
-public:
- virtual ~OnEntryRemoved() { };
- virtual void operator()(EntryKey& key, EntryValue& value) = 0;
-}; // class OnEntryRemoved
-
-template<typename EntryKey, typename EntryValue>
-struct Entry: public LightRefBase<Entry<EntryKey, EntryValue> > {
- Entry(const Entry<EntryKey, EntryValue>& e) :
- key(e.key), value(e.value),
- parent(e.parent), child(e.child) { }
- Entry(const EntryKey& key, const EntryValue& value) :
- key(key), value(value) { }
-
- EntryKey key;
- EntryValue value;
-
- sp<Entry<EntryKey, EntryValue> > parent; // next older entry
- sp<Entry<EntryKey, EntryValue> > child; // next younger entry
-}; // struct Entry
-
-/**
- * A LRU type cache
- */
-template<typename K, typename V>
-class GenerationCache {
-public:
- GenerationCache(uint32_t maxCapacity);
- virtual ~GenerationCache();
-
- enum Capacity {
- kUnlimitedCapacity,
- };
-
- void setOnEntryRemovedListener(OnEntryRemoved<K, V>* listener);
-
- size_t size() const;
-
- void clear();
-
- bool contains(const K& key) const;
- const K& getKeyAt(size_t index) const;
- const V& getValueAt(size_t index) const;
-
- const V& get(const K& key);
- bool put(const K& key, const V& value);
-
- void removeAt(ssize_t index);
- bool remove(const K& key);
- bool removeOldest();
-
-private:
- KeyedVector<K, sp<Entry<K, V> > > mCache;
- uint32_t mMaxCapacity;
-
- OnEntryRemoved<K, V>* mListener;
-
- sp<Entry<K, V> > mOldest;
- sp<Entry<K, V> > mYoungest;
-
- void attachToCache(const sp<Entry<K, V> >& entry);
- void detachFromCache(const sp<Entry<K, V> >& entry);
-
- const V mNullValue;
-}; // class GenerationCache
-
-template<typename K, typename V>
-GenerationCache<K, V>::GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity),
- mListener(NULL), mNullValue(NULL) {
-};
-
-template<typename K, typename V>
-GenerationCache<K, V>::~GenerationCache() {
- clear();
-};
-
-template<typename K, typename V>
-uint32_t GenerationCache<K, V>::size() const {
- return mCache.size();
-}
-
-/**
- * Should be set by the user of the Cache so that the callback is called whenever an item is
- * removed from the cache
- */
-template<typename K, typename V>
-void GenerationCache<K, V>::setOnEntryRemovedListener(OnEntryRemoved<K, V>* listener) {
- mListener = listener;
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::clear() {
- if (mListener) {
- for (uint32_t i = 0; i < mCache.size(); i++) {
- sp<Entry<K, V> > entry = mCache.valueAt(i);
- if (mListener) {
- (*mListener)(entry->key, entry->value);
- }
- }
- }
- mCache.clear();
- mYoungest.clear();
- mOldest.clear();
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::contains(const K& key) const {
- return mCache.indexOfKey(key) >= 0;
-}
-
-template<typename K, typename V>
-const K& GenerationCache<K, V>::getKeyAt(size_t index) const {
- return mCache.keyAt(index);
-}
-
-template<typename K, typename V>
-const V& GenerationCache<K, V>::getValueAt(size_t index) const {
- return mCache.valueAt(index)->value;
-}
-
-template<typename K, typename V>
-const V& GenerationCache<K, V>::get(const K& key) {
- ssize_t index = mCache.indexOfKey(key);
- if (index >= 0) {
- const sp<Entry<K, V> >& entry = mCache.valueAt(index);
- detachFromCache(entry);
- attachToCache(entry);
- return entry->value;
- }
-
- return mNullValue;
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::put(const K& key, const V& value) {
- if (mMaxCapacity != kUnlimitedCapacity && mCache.size() >= mMaxCapacity) {
- removeOldest();
- }
-
- ssize_t index = mCache.indexOfKey(key);
- if (index < 0) {
- sp<Entry<K, V> > entry = new Entry<K, V>(key, value);
- mCache.add(key, entry);
- attachToCache(entry);
- return true;
- }
-
- return false;
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::remove(const K& key) {
- ssize_t index = mCache.indexOfKey(key);
- if (index >= 0) {
- removeAt(index);
- return true;
- }
-
- return false;
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::removeAt(ssize_t index) {
- sp<Entry<K, V> > entry = mCache.valueAt(index);
- if (mListener) {
- (*mListener)(entry->key, entry->value);
- }
- mCache.removeItemsAt(index, 1);
- detachFromCache(entry);
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::removeOldest() {
- if (mOldest.get()) {
- ssize_t index = mCache.indexOfKey(mOldest->key);
- if (index >= 0) {
- removeAt(index);
- return true;
- }
- ALOGE("GenerationCache: removeOldest failed to find the item in the cache "
- "with the given key, but we know it must be in there. "
- "Is the key comparator kaput?");
- }
-
- return false;
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::attachToCache(const sp<Entry<K, V> >& entry) {
- if (!mYoungest.get()) {
- mYoungest = mOldest = entry;
- } else {
- entry->parent = mYoungest;
- mYoungest->child = entry;
- mYoungest = entry;
- }
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::detachFromCache(const sp<Entry<K, V> >& entry) {
- if (entry->parent.get()) {
- entry->parent->child = entry->child;
- } else {
- mOldest = entry->child;
- }
-
- if (entry->child.get()) {
- entry->child->parent = entry->parent;
- } else {
- mYoungest = entry->parent;
- }
-
- entry->parent.clear();
- entry->child.clear();
-}
-
-}; // namespace android
-
-#endif // ANDROID_UTILS_GENERATION_CACHE_H
diff --git a/include/utils/KeyedVector.h b/include/utils/KeyedVector.h
deleted file mode 100644
index 85535bd..0000000
--- a/include/utils/KeyedVector.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_KEYED_VECTOR_H
-#define ANDROID_KEYED_VECTOR_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/SortedVector.h>
-#include <utils/TypeHelpers.h>
-#include <utils/Errors.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-template <typename KEY, typename VALUE>
-class KeyedVector
-{
-public:
- typedef KEY key_type;
- typedef VALUE value_type;
-
- inline KeyedVector();
-
- /*
- * empty the vector
- */
-
- inline void clear() { mVector.clear(); }
-
- /*!
- * vector stats
- */
-
- //! returns number of items in the vector
- inline size_t size() const { return mVector.size(); }
- //! returns wether or not the vector is empty
- inline bool isEmpty() const { return mVector.isEmpty(); }
- //! returns how many items can be stored without reallocating the backing store
- inline size_t capacity() const { return mVector.capacity(); }
- //! setst the capacity. capacity can never be reduced less than size()
- inline ssize_t setCapacity(size_t size) { return mVector.setCapacity(size); }
-
- /*!
- * accessors
- */
- const VALUE& valueFor(const KEY& key) const;
- const VALUE& valueAt(size_t index) const;
- const KEY& keyAt(size_t index) const;
- ssize_t indexOfKey(const KEY& key) const;
-
- /*!
- * modifying the array
- */
-
- VALUE& editValueFor(const KEY& key);
- VALUE& editValueAt(size_t index);
-
- /*!
- * add/insert/replace items
- */
-
- ssize_t add(const KEY& key, const VALUE& item);
- ssize_t replaceValueFor(const KEY& key, const VALUE& item);
- ssize_t replaceValueAt(size_t index, const VALUE& item);
-
- /*!
- * remove items
- */
-
- ssize_t removeItem(const KEY& key);
- ssize_t removeItemsAt(size_t index, size_t count = 1);
-
-private:
- SortedVector< key_value_pair_t<KEY, VALUE> > mVector;
-};
-
-// ---------------------------------------------------------------------------
-
-/**
- * Variation of KeyedVector that holds a default value to return when
- * valueFor() is called with a key that doesn't exist.
- */
-template <typename KEY, typename VALUE>
-class DefaultKeyedVector : public KeyedVector<KEY, VALUE>
-{
-public:
- inline DefaultKeyedVector(const VALUE& defValue = VALUE());
- const VALUE& valueFor(const KEY& key) const;
-
-private:
- VALUE mDefault;
-};
-
-// ---------------------------------------------------------------------------
-
-template<typename KEY, typename VALUE> inline
-KeyedVector<KEY,VALUE>::KeyedVector()
-{
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::indexOfKey(const KEY& key) const {
- return mVector.indexOf( key_value_pair_t<KEY,VALUE>(key) );
-}
-
-template<typename KEY, typename VALUE> inline
-const VALUE& KeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
- ssize_t i = this->indexOfKey(key);
- assert(i>=0);
- return mVector.itemAt(i).value;
-}
-
-template<typename KEY, typename VALUE> inline
-const VALUE& KeyedVector<KEY,VALUE>::valueAt(size_t index) const {
- return mVector.itemAt(index).value;
-}
-
-template<typename KEY, typename VALUE> inline
-const KEY& KeyedVector<KEY,VALUE>::keyAt(size_t index) const {
- return mVector.itemAt(index).key;
-}
-
-template<typename KEY, typename VALUE> inline
-VALUE& KeyedVector<KEY,VALUE>::editValueFor(const KEY& key) {
- ssize_t i = this->indexOfKey(key);
- assert(i>=0);
- return mVector.editItemAt(i).value;
-}
-
-template<typename KEY, typename VALUE> inline
-VALUE& KeyedVector<KEY,VALUE>::editValueAt(size_t index) {
- return mVector.editItemAt(index).value;
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::add(const KEY& key, const VALUE& value) {
- return mVector.add( key_value_pair_t<KEY,VALUE>(key, value) );
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::replaceValueFor(const KEY& key, const VALUE& value) {
- key_value_pair_t<KEY,VALUE> pair(key, value);
- mVector.remove(pair);
- return mVector.add(pair);
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::replaceValueAt(size_t index, const VALUE& item) {
- if (index<size()) {
- mVector.editItemAt(index).value = item;
- return index;
- }
- return BAD_INDEX;
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::removeItem(const KEY& key) {
- return mVector.remove(key_value_pair_t<KEY,VALUE>(key));
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY, VALUE>::removeItemsAt(size_t index, size_t count) {
- return mVector.removeItemsAt(index, count);
-}
-
-// ---------------------------------------------------------------------------
-
-template<typename KEY, typename VALUE> inline
-DefaultKeyedVector<KEY,VALUE>::DefaultKeyedVector(const VALUE& defValue)
- : mDefault(defValue)
-{
-}
-
-template<typename KEY, typename VALUE> inline
-const VALUE& DefaultKeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
- ssize_t i = this->indexOfKey(key);
- return i >= 0 ? KeyedVector<KEY,VALUE>::valueAt(i) : mDefault;
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_KEYED_VECTOR_H
diff --git a/include/utils/LinearTransform.h b/include/utils/LinearTransform.h
deleted file mode 100644
index 04cb355..0000000
--- a/include/utils/LinearTransform.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_LINEAR_TRANSFORM_H
-#define _LIBS_UTILS_LINEAR_TRANSFORM_H
-
-#include <stdint.h>
-
-namespace android {
-
-// LinearTransform defines a structure which hold the definition of a
-// transformation from single dimensional coordinate system A into coordinate
-// system B (and back again). Values in A and in B are 64 bit, the linear
-// scale factor is expressed as a rational number using two 32 bit values.
-//
-// Specifically, let
-// f(a) = b
-// F(b) = f^-1(b) = a
-// then
-//
-// f(a) = (((a - a_zero) * a_to_b_numer) / a_to_b_denom) + b_zero;
-//
-// and
-//
-// F(b) = (((b - b_zero) * a_to_b_denom) / a_to_b_numer) + a_zero;
-//
-struct LinearTransform {
- int64_t a_zero;
- int64_t b_zero;
- int32_t a_to_b_numer;
- uint32_t a_to_b_denom;
-
- // Transform from A->B
- // Returns true on success, or false in the case of a singularity or an
- // overflow.
- bool doForwardTransform(int64_t a_in, int64_t* b_out) const;
-
- // Transform from B->A
- // Returns true on success, or false in the case of a singularity or an
- // overflow.
- bool doReverseTransform(int64_t b_in, int64_t* a_out) const;
-
- // Helpers which will reduce the fraction N/D using Euclid's method.
- template <class T> static void reduce(T* N, T* D);
- static void reduce(int32_t* N, uint32_t* D);
-};
-
-
-}
-
-#endif // _LIBS_UTILS_LINEAR_TRANSFORM_H
diff --git a/include/utils/List.h b/include/utils/List.h
deleted file mode 100644
index 403cd7f..0000000
--- a/include/utils/List.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Templated list class. Normally we'd use STL, but we don't have that.
-// This class mimics STL's interfaces.
-//
-// Objects are copied into the list with the '=' operator or with copy-
-// construction, so if the compiler's auto-generated versions won't work for
-// you, define your own.
-//
-// The only class you want to use from here is "List".
-//
-#ifndef _LIBS_UTILS_LIST_H
-#define _LIBS_UTILS_LIST_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace android {
-
-/*
- * Doubly-linked list. Instantiate with "List<MyClass> myList".
- *
- * Objects added to the list are copied using the assignment operator,
- * so this must be defined.
- */
-template<typename T>
-class List
-{
-protected:
- /*
- * One element in the list.
- */
- class _Node {
- public:
- explicit _Node(const T& val) : mVal(val) {}
- ~_Node() {}
- inline T& getRef() { return mVal; }
- inline const T& getRef() const { return mVal; }
- inline _Node* getPrev() const { return mpPrev; }
- inline _Node* getNext() const { return mpNext; }
- inline void setVal(const T& val) { mVal = val; }
- inline void setPrev(_Node* ptr) { mpPrev = ptr; }
- inline void setNext(_Node* ptr) { mpNext = ptr; }
- private:
- friend class List;
- friend class _ListIterator;
- T mVal;
- _Node* mpPrev;
- _Node* mpNext;
- };
-
- /*
- * Iterator for walking through the list.
- */
-
- template <typename TYPE>
- struct CONST_ITERATOR {
- typedef _Node const * NodePtr;
- typedef const TYPE Type;
- };
-
- template <typename TYPE>
- struct NON_CONST_ITERATOR {
- typedef _Node* NodePtr;
- typedef TYPE Type;
- };
-
- template<
- typename U,
- template <class> class Constness
- >
- class _ListIterator {
- typedef _ListIterator<U, Constness> _Iter;
- typedef typename Constness<U>::NodePtr _NodePtr;
- typedef typename Constness<U>::Type _Type;
-
- explicit _ListIterator(_NodePtr ptr) : mpNode(ptr) {}
-
- public:
- _ListIterator() {}
- _ListIterator(const _Iter& rhs) : mpNode(rhs.mpNode) {}
- ~_ListIterator() {}
-
- // this will handle conversions from iterator to const_iterator
- // (and also all convertible iterators)
- // Here, in this implementation, the iterators can be converted
- // if the nodes can be converted
- template<typename V> explicit
- _ListIterator(const V& rhs) : mpNode(rhs.mpNode) {}
-
-
- /*
- * Dereference operator. Used to get at the juicy insides.
- */
- _Type& operator*() const { return mpNode->getRef(); }
- _Type* operator->() const { return &(mpNode->getRef()); }
-
- /*
- * Iterator comparison.
- */
- inline bool operator==(const _Iter& right) const {
- return mpNode == right.mpNode; }
-
- inline bool operator!=(const _Iter& right) const {
- return mpNode != right.mpNode; }
-
- /*
- * handle comparisons between iterator and const_iterator
- */
- template<typename OTHER>
- inline bool operator==(const OTHER& right) const {
- return mpNode == right.mpNode; }
-
- template<typename OTHER>
- inline bool operator!=(const OTHER& right) const {
- return mpNode != right.mpNode; }
-
- /*
- * Incr/decr, used to move through the list.
- */
- inline _Iter& operator++() { // pre-increment
- mpNode = mpNode->getNext();
- return *this;
- }
- const _Iter operator++(int) { // post-increment
- _Iter tmp(*this);
- mpNode = mpNode->getNext();
- return tmp;
- }
- inline _Iter& operator--() { // pre-increment
- mpNode = mpNode->getPrev();
- return *this;
- }
- const _Iter operator--(int) { // post-increment
- _Iter tmp(*this);
- mpNode = mpNode->getPrev();
- return tmp;
- }
-
- inline _NodePtr getNode() const { return mpNode; }
-
- _NodePtr mpNode; /* should be private, but older gcc fails */
- private:
- friend class List;
- };
-
-public:
- List() {
- prep();
- }
- List(const List<T>& src) { // copy-constructor
- prep();
- insert(begin(), src.begin(), src.end());
- }
- virtual ~List() {
- clear();
- delete[] (unsigned char*) mpMiddle;
- }
-
- typedef _ListIterator<T, NON_CONST_ITERATOR> iterator;
- typedef _ListIterator<T, CONST_ITERATOR> const_iterator;
-
- List<T>& operator=(const List<T>& right);
-
- /* returns true if the list is empty */
- inline bool empty() const { return mpMiddle->getNext() == mpMiddle; }
-
- /* return #of elements in list */
- size_t size() const {
- return size_t(distance(begin(), end()));
- }
-
- /*
- * Return the first element or one past the last element. The
- * _Node* we're returning is converted to an "iterator" by a
- * constructor in _ListIterator.
- */
- inline iterator begin() {
- return iterator(mpMiddle->getNext());
- }
- inline const_iterator begin() const {
- return const_iterator(const_cast<_Node const*>(mpMiddle->getNext()));
- }
- inline iterator end() {
- return iterator(mpMiddle);
- }
- inline const_iterator end() const {
- return const_iterator(const_cast<_Node const*>(mpMiddle));
- }
-
- /* add the object to the head or tail of the list */
- void push_front(const T& val) { insert(begin(), val); }
- void push_back(const T& val) { insert(end(), val); }
-
- /* insert before the current node; returns iterator at new node */
- iterator insert(iterator posn, const T& val)
- {
- _Node* newNode = new _Node(val); // alloc & copy-construct
- newNode->setNext(posn.getNode());
- newNode->setPrev(posn.getNode()->getPrev());
- posn.getNode()->getPrev()->setNext(newNode);
- posn.getNode()->setPrev(newNode);
- return iterator(newNode);
- }
-
- /* insert a range of elements before the current node */
- void insert(iterator posn, const_iterator first, const_iterator last) {
- for ( ; first != last; ++first)
- insert(posn, *first);
- }
-
- /* remove one entry; returns iterator at next node */
- iterator erase(iterator posn) {
- _Node* pNext = posn.getNode()->getNext();
- _Node* pPrev = posn.getNode()->getPrev();
- pPrev->setNext(pNext);
- pNext->setPrev(pPrev);
- delete posn.getNode();
- return iterator(pNext);
- }
-
- /* remove a range of elements */
- iterator erase(iterator first, iterator last) {
- while (first != last)
- erase(first++); // don't erase than incr later!
- return iterator(last);
- }
-
- /* remove all contents of the list */
- void clear() {
- _Node* pCurrent = mpMiddle->getNext();
- _Node* pNext;
-
- while (pCurrent != mpMiddle) {
- pNext = pCurrent->getNext();
- delete pCurrent;
- pCurrent = pNext;
- }
- mpMiddle->setPrev(mpMiddle);
- mpMiddle->setNext(mpMiddle);
- }
-
- /*
- * Measure the distance between two iterators. On exist, "first"
- * will be equal to "last". The iterators must refer to the same
- * list.
- *
- * FIXME: This is actually a generic iterator function. It should be a
- * template function at the top-level with specializations for things like
- * vector<>, which can just do pointer math). Here we limit it to
- * _ListIterator of the same type but different constness.
- */
- template<
- typename U,
- template <class> class CL,
- template <class> class CR
- >
- ptrdiff_t distance(
- _ListIterator<U, CL> first, _ListIterator<U, CR> last) const
- {
- ptrdiff_t count = 0;
- while (first != last) {
- ++first;
- ++count;
- }
- return count;
- }
-
-private:
- /*
- * I want a _Node but don't need it to hold valid data. More
- * to the point, I don't want T's constructor to fire, since it
- * might have side-effects or require arguments. So, we do this
- * slightly uncouth storage alloc.
- */
- void prep() {
- mpMiddle = (_Node*) new unsigned char[sizeof(_Node)];
- mpMiddle->setPrev(mpMiddle);
- mpMiddle->setNext(mpMiddle);
- }
-
- /*
- * This node plays the role of "pointer to head" and "pointer to tail".
- * It sits in the middle of a circular list of nodes. The iterator
- * runs around the circle until it encounters this one.
- */
- _Node* mpMiddle;
-};
-
-/*
- * Assignment operator.
- *
- * The simplest way to do this would be to clear out the target list and
- * fill it with the source. However, we can speed things along by
- * re-using existing elements.
- */
-template<class T>
-List<T>& List<T>::operator=(const List<T>& right)
-{
- if (this == &right)
- return *this; // self-assignment
- iterator firstDst = begin();
- iterator lastDst = end();
- const_iterator firstSrc = right.begin();
- const_iterator lastSrc = right.end();
- while (firstSrc != lastSrc && firstDst != lastDst)
- *firstDst++ = *firstSrc++;
- if (firstSrc == lastSrc) // ran out of elements in source?
- erase(firstDst, lastDst); // yes, erase any extras
- else
- insert(lastDst, firstSrc, lastSrc); // copy remaining over
- return *this;
-}
-
-}; // namespace android
-
-#endif // _LIBS_UTILS_LIST_H
diff --git a/include/utils/Log.h b/include/utils/Log.h
deleted file mode 100644
index 3c6cc8b..0000000
--- a/include/utils/Log.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// C/C++ logging functions. See the logging documentation for API details.
-//
-// We'd like these to be available from C code (in case we import some from
-// somewhere), so this has a C interface.
-//
-// The output will be correct when the log file is shared between multiple
-// threads and/or multiple processes so long as the operating system
-// supports O_APPEND. These calls have mutex-protected data structures
-// and so are NOT reentrant. Do not use LOG in a signal handler.
-//
-#ifndef _LIBS_UTILS_LOG_H
-#define _LIBS_UTILS_LOG_H
-
-#include <cutils/log.h>
-
-#endif // _LIBS_UTILS_LOG_H
diff --git a/include/utils/Looper.h b/include/utils/Looper.h
deleted file mode 100644
index 3c2905d..0000000
--- a/include/utils/Looper.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef UTILS_LOOPER_H
-#define UTILS_LOOPER_H
-
-#include <utils/threads.h>
-#include <utils/RefBase.h>
-#include <utils/KeyedVector.h>
-#include <utils/Timers.h>
-
-#include <android/looper.h>
-
-// When defined, uses epoll_wait() for polling, otherwise uses poll().
-#define LOOPER_USES_EPOLL
-
-// When defined, logs performance statistics for tuning and debugging purposes.
-//#define LOOPER_STATISTICS
-
-#ifdef LOOPER_USES_EPOLL
-#include <sys/epoll.h>
-#else
-#include <sys/poll.h>
-#endif
-
-/*
- * Declare a concrete type for the NDK's looper forward declaration.
- */
-struct ALooper {
-};
-
-namespace android {
-
-/**
- * A message that can be posted to a Looper.
- */
-struct Message {
- Message() : what(0) { }
- Message(int what) : what(what) { }
-
- /* The message type. (interpretation is left up to the handler) */
- int what;
-};
-
-
-/**
- * Interface for a Looper message handler.
- *
- * The Looper holds a strong reference to the message handler whenever it has
- * a message to deliver to it. Make sure to call Looper::removeMessages
- * to remove any pending messages destined for the handler so that the handler
- * can be destroyed.
- */
-class MessageHandler : public virtual RefBase {
-protected:
- virtual ~MessageHandler() { }
-
-public:
- /**
- * Handles a message.
- */
- virtual void handleMessage(const Message& message) = 0;
-};
-
-
-/**
- * A simple proxy that holds a weak reference to a message handler.
- */
-class WeakMessageHandler : public MessageHandler {
-public:
- WeakMessageHandler(const wp<MessageHandler>& handler);
- virtual void handleMessage(const Message& message);
-
-private:
- wp<MessageHandler> mHandler;
-};
-
-
-/**
- * A polling loop that supports monitoring file descriptor events, optionally
- * using callbacks. The implementation uses epoll() internally.
- *
- * A looper can be associated with a thread although there is no requirement that it must be.
- */
-class Looper : public ALooper, public RefBase {
-protected:
- virtual ~Looper();
-
-public:
- /**
- * Creates a looper.
- *
- * If allowNonCallbaks is true, the looper will allow file descriptors to be
- * registered without associated callbacks. This assumes that the caller of
- * pollOnce() is prepared to handle callback-less events itself.
- */
- Looper(bool allowNonCallbacks);
-
- /**
- * Returns whether this looper instance allows the registration of file descriptors
- * using identifiers instead of callbacks.
- */
- bool getAllowNonCallbacks() const;
-
- /**
- * Waits for events to be available, with optional timeout in milliseconds.
- * Invokes callbacks for all file descriptors on which an event occurred.
- *
- * If the timeout is zero, returns immediately without blocking.
- * If the timeout is negative, waits indefinitely until an event appears.
- *
- * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before
- * the timeout expired and no callbacks were invoked and no other file
- * descriptors were ready.
- *
- * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked.
- *
- * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given
- * timeout expired.
- *
- * Returns ALOOPER_POLL_ERROR if an error occurred.
- *
- * Returns a value >= 0 containing an identifier if its file descriptor has data
- * and it has no callback function (requiring the caller here to handle it).
- * In this (and only this) case outFd, outEvents and outData will contain the poll
- * events and data associated with the fd, otherwise they will be set to NULL.
- *
- * This method does not return until it has finished invoking the appropriate callbacks
- * for all file descriptors that were signalled.
- */
- int pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
- inline int pollOnce(int timeoutMillis) {
- return pollOnce(timeoutMillis, NULL, NULL, NULL);
- }
-
- /**
- * Like pollOnce(), but performs all pending callbacks until all
- * data has been consumed or a file descriptor is available with no callback.
- * This function will never return ALOOPER_POLL_CALLBACK.
- */
- int pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);
- inline int pollAll(int timeoutMillis) {
- return pollAll(timeoutMillis, NULL, NULL, NULL);
- }
-
- /**
- * Wakes the poll asynchronously.
- *
- * This method can be called on any thread.
- * This method returns immediately.
- */
- void wake();
-
- /**
- * Adds a new file descriptor to be polled by the looper.
- * If the same file descriptor was previously added, it is replaced.
- *
- * "fd" is the file descriptor to be added.
- * "ident" is an identifier for this event, which is returned from ALooper_pollOnce().
- * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback.
- * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT.
- * "callback" is the function to call when there is an event on the file descriptor.
- * "data" is a private data pointer to supply to the callback.
- *
- * There are two main uses of this function:
- *
- * (1) If "callback" is non-NULL, then this function will be called when there is
- * data on the file descriptor. It should execute any events it has pending,
- * appropriately reading from the file descriptor. The 'ident' is ignored in this case.
- *
- * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce
- * when its file descriptor has data available, requiring the caller to take
- * care of processing it.
- *
- * Returns 1 if the file descriptor was added, 0 if the arguments were invalid.
- *
- * This method can be called on any thread.
- * This method may block briefly if it needs to wake the poll.
- */
- int addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data);
-
- /**
- * Removes a previously added file descriptor from the looper.
- *
- * When this method returns, it is safe to close the file descriptor since the looper
- * will no longer have a reference to it. However, it is possible for the callback to
- * already be running or for it to run one last time if the file descriptor was already
- * signalled. Calling code is responsible for ensuring that this case is safely handled.
- * For example, if the callback takes care of removing itself during its own execution either
- * by returning 0 or by calling this method, then it can be guaranteed to not be invoked
- * again at any later time unless registered anew.
- *
- * Returns 1 if the file descriptor was removed, 0 if none was previously registered.
- *
- * This method can be called on any thread.
- * This method may block briefly if it needs to wake the poll.
- */
- int removeFd(int fd);
-
- /**
- * Enqueues a message to be processed by the specified handler.
- *
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void sendMessage(const sp<MessageHandler>& handler, const Message& message);
-
- /**
- * Enqueues a message to be processed by the specified handler after all pending messages
- * after the specified delay.
- *
- * The time delay is specified in uptime nanoseconds.
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void sendMessageDelayed(nsecs_t uptimeDelay, const sp<MessageHandler>& handler,
- const Message& message);
-
- /**
- * Enqueues a message to be processed by the specified handler after all pending messages
- * at the specified time.
- *
- * The time is specified in uptime nanoseconds.
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler,
- const Message& message);
-
- /**
- * Removes all messages for the specified handler from the queue.
- *
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void removeMessages(const sp<MessageHandler>& handler);
-
- /**
- * Removes all messages of a particular type for the specified handler from the queue.
- *
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void removeMessages(const sp<MessageHandler>& handler, int what);
-
- /**
- * Prepares a looper associated with the calling thread, and returns it.
- * If the thread already has a looper, it is returned. Otherwise, a new
- * one is created, associated with the thread, and returned.
- *
- * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0.
- */
- static sp<Looper> prepare(int opts);
-
- /**
- * Sets the given looper to be associated with the calling thread.
- * If another looper is already associated with the thread, it is replaced.
- *
- * If "looper" is NULL, removes the currently associated looper.
- */
- static void setForThread(const sp<Looper>& looper);
-
- /**
- * Returns the looper associated with the calling thread, or NULL if
- * there is not one.
- */
- static sp<Looper> getForThread();
-
-private:
- struct Request {
- int fd;
- int ident;
- ALooper_callbackFunc callback;
- void* data;
- };
-
- struct Response {
- int events;
- Request request;
- };
-
- struct MessageEnvelope {
- MessageEnvelope() : uptime(0) { }
-
- MessageEnvelope(nsecs_t uptime, const sp<MessageHandler> handler,
- const Message& message) : uptime(uptime), handler(handler), message(message) {
- }
-
- nsecs_t uptime;
- sp<MessageHandler> handler;
- Message message;
- };
-
- const bool mAllowNonCallbacks; // immutable
-
- int mWakeReadPipeFd; // immutable
- int mWakeWritePipeFd; // immutable
- Mutex mLock;
-
- Vector<MessageEnvelope> mMessageEnvelopes; // guarded by mLock
- bool mSendingMessage; // guarded by mLock
-
-#ifdef LOOPER_USES_EPOLL
- int mEpollFd; // immutable
-
- // Locked list of file descriptor monitoring requests.
- KeyedVector<int, Request> mRequests; // guarded by mLock
-#else
- // The lock guards state used to track whether there is a poll() in progress and whether
- // there are any other threads waiting in wakeAndLock(). The condition variables
- // are used to transfer control among these threads such that all waiters are
- // serviced before a new poll can begin.
- // The wakeAndLock() method increments mWaiters, wakes the poll, blocks on mAwake
- // until mPolling becomes false, then decrements mWaiters again.
- // The poll() method blocks on mResume until mWaiters becomes 0, then sets
- // mPolling to true, blocks until the poll completes, then resets mPolling to false
- // and signals mResume if there are waiters.
- bool mPolling; // guarded by mLock
- uint32_t mWaiters; // guarded by mLock
- Condition mAwake; // guarded by mLock
- Condition mResume; // guarded by mLock
-
- Vector<struct pollfd> mRequestedFds; // must hold mLock and mPolling must be false to modify
- Vector<Request> mRequests; // must hold mLock and mPolling must be false to modify
-
- ssize_t getRequestIndexLocked(int fd);
- void wakeAndLock();
-#endif
-
-#ifdef LOOPER_STATISTICS
- static const int SAMPLED_WAKE_CYCLES_TO_AGGREGATE = 100;
- static const int SAMPLED_POLLS_TO_AGGREGATE = 1000;
-
- nsecs_t mPendingWakeTime;
- int mPendingWakeCount;
-
- int mSampledWakeCycles;
- int mSampledWakeCountSum;
- nsecs_t mSampledWakeLatencySum;
-
- int mSampledPolls;
- int mSampledZeroPollCount;
- int mSampledZeroPollLatencySum;
- int mSampledTimeoutPollCount;
- int mSampledTimeoutPollLatencySum;
-#endif
-
- // This state is only used privately by pollOnce and does not require a lock since
- // it runs on a single thread.
- Vector<Response> mResponses;
- size_t mResponseIndex;
- nsecs_t mNextMessageUptime; // set to LLONG_MAX when none
-
- int pollInner(int timeoutMillis);
- void awoken();
- void pushResponse(int events, const Request& request);
-
- static void initTLSKey();
- static void threadDestructor(void *st);
-};
-
-} // namespace android
-
-#endif // UTILS_LOOPER_H
diff --git a/include/utils/Mutex.h b/include/utils/Mutex.h
deleted file mode 100644
index de6fb39..0000000
--- a/include/utils/Mutex.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_MUTEX_H
-#define _LIBS_UTILS_MUTEX_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Errors.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Condition;
-
-/*
- * Simple mutex class. The implementation is system-dependent.
- *
- * The mutex must be unlocked by the thread that locked it. They are not
- * recursive, i.e. the same thread can't lock it multiple times.
- */
-class Mutex {
-public:
- enum {
- PRIVATE = 0,
- SHARED = 1
- };
-
- Mutex();
- Mutex(const char* name);
- Mutex(int type, const char* name = NULL);
- ~Mutex();
-
- // lock or unlock the mutex
- status_t lock();
- void unlock();
-
- // lock if possible; returns 0 on success, error otherwise
- status_t tryLock();
-
- // Manages the mutex automatically. It'll be locked when Autolock is
- // constructed and released when Autolock goes out of scope.
- class Autolock {
- public:
- inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); }
- inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); }
- inline ~Autolock() { mLock.unlock(); }
- private:
- Mutex& mLock;
- };
-
-private:
- friend class Condition;
-
- // A mutex cannot be copied
- Mutex(const Mutex&);
- Mutex& operator = (const Mutex&);
-
-#if defined(HAVE_PTHREADS)
- pthread_mutex_t mMutex;
-#else
- void _init();
- void* mState;
-#endif
-};
-
-// ---------------------------------------------------------------------------
-
-#if defined(HAVE_PTHREADS)
-
-inline Mutex::Mutex() {
- pthread_mutex_init(&mMutex, NULL);
-}
-inline Mutex::Mutex(const char* name) {
- pthread_mutex_init(&mMutex, NULL);
-}
-inline Mutex::Mutex(int type, const char* name) {
- if (type == SHARED) {
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
- pthread_mutex_init(&mMutex, &attr);
- pthread_mutexattr_destroy(&attr);
- } else {
- pthread_mutex_init(&mMutex, NULL);
- }
-}
-inline Mutex::~Mutex() {
- pthread_mutex_destroy(&mMutex);
-}
-inline status_t Mutex::lock() {
- return -pthread_mutex_lock(&mMutex);
-}
-inline void Mutex::unlock() {
- pthread_mutex_unlock(&mMutex);
-}
-inline status_t Mutex::tryLock() {
- return -pthread_mutex_trylock(&mMutex);
-}
-
-#endif // HAVE_PTHREADS
-
-// ---------------------------------------------------------------------------
-
-/*
- * Automatic mutex. Declare one of these at the top of a function.
- * When the function returns, it will go out of scope, and release the
- * mutex.
- */
-
-typedef Mutex::Autolock AutoMutex;
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_MUTEX_H
diff --git a/include/utils/PropertyMap.h b/include/utils/PropertyMap.h
deleted file mode 100644
index a9e674f..0000000
--- a/include/utils/PropertyMap.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _UTILS_PROPERTY_MAP_H
-#define _UTILS_PROPERTY_MAP_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include <utils/Errors.h>
-#include <utils/Tokenizer.h>
-
-namespace android {
-
-/*
- * Provides a mechanism for passing around string-based property key / value pairs
- * and loading them from property files.
- *
- * The property files have the following simple structure:
- *
- * # Comment
- * key = value
- *
- * Keys and values are any sequence of printable ASCII characters.
- * The '=' separates the key from the value.
- * The key and value may not contain whitespace.
- *
- * The '\' character is reserved for escape sequences and is not currently supported.
- * The '"" character is reserved for quoting and is not currently supported.
- * Files that contain the '\' or '"' character will fail to parse.
- *
- * The file must not contain duplicate keys.
- *
- * TODO Support escape sequences and quoted values when needed.
- */
-class PropertyMap {
-public:
- /* Creates an empty property map. */
- PropertyMap();
- ~PropertyMap();
-
- /* Clears the property map. */
- void clear();
-
- /* Adds a property.
- * Replaces the property with the same key if it is already present.
- */
- void addProperty(const String8& key, const String8& value);
-
- /* Returns true if the property map contains the specified key. */
- bool hasProperty(const String8& key) const;
-
- /* Gets the value of a property and parses it.
- * Returns true and sets outValue if the key was found and its value was parsed successfully.
- * Otherwise returns false and does not modify outValue. (Also logs a warning.)
- */
- bool tryGetProperty(const String8& key, String8& outValue) const;
- bool tryGetProperty(const String8& key, bool& outValue) const;
- bool tryGetProperty(const String8& key, int32_t& outValue) const;
- bool tryGetProperty(const String8& key, float& outValue) const;
-
- /* Adds all values from the specified property map. */
- void addAll(const PropertyMap* map);
-
- /* Gets the underlying property map. */
- inline const KeyedVector<String8, String8>& getProperties() const { return mProperties; }
-
- /* Loads a property map from a file. */
- static status_t load(const String8& filename, PropertyMap** outMap);
-
-private:
- class Parser {
- PropertyMap* mMap;
- Tokenizer* mTokenizer;
-
- public:
- Parser(PropertyMap* map, Tokenizer* tokenizer);
- ~Parser();
- status_t parse();
-
- private:
- status_t parseType();
- status_t parseKey();
- status_t parseKeyProperty();
- status_t parseModifier(const String8& token, int32_t* outMetaState);
- status_t parseCharacterLiteral(char16_t* outCharacter);
- };
-
- KeyedVector<String8, String8> mProperties;
-};
-
-} // namespace android
-
-#endif // _UTILS_PROPERTY_MAP_H
diff --git a/include/utils/RWLock.h b/include/utils/RWLock.h
deleted file mode 100644
index a5abea2..0000000
--- a/include/utils/RWLock.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_RWLOCK_H
-#define _LIBS_UTILS_RWLOCK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Errors.h>
-#include <utils/ThreadDefs.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-#if defined(HAVE_PTHREADS)
-
-/*
- * Simple mutex class. The implementation is system-dependent.
- *
- * The mutex must be unlocked by the thread that locked it. They are not
- * recursive, i.e. the same thread can't lock it multiple times.
- */
-class RWLock {
-public:
- enum {
- PRIVATE = 0,
- SHARED = 1
- };
-
- RWLock();
- RWLock(const char* name);
- RWLock(int type, const char* name = NULL);
- ~RWLock();
-
- status_t readLock();
- status_t tryReadLock();
- status_t writeLock();
- status_t tryWriteLock();
- void unlock();
-
- class AutoRLock {
- public:
- inline AutoRLock(RWLock& rwlock) : mLock(rwlock) { mLock.readLock(); }
- inline ~AutoRLock() { mLock.unlock(); }
- private:
- RWLock& mLock;
- };
-
- class AutoWLock {
- public:
- inline AutoWLock(RWLock& rwlock) : mLock(rwlock) { mLock.writeLock(); }
- inline ~AutoWLock() { mLock.unlock(); }
- private:
- RWLock& mLock;
- };
-
-private:
- // A RWLock cannot be copied
- RWLock(const RWLock&);
- RWLock& operator = (const RWLock&);
-
- pthread_rwlock_t mRWLock;
-};
-
-inline RWLock::RWLock() {
- pthread_rwlock_init(&mRWLock, NULL);
-}
-inline RWLock::RWLock(const char* name) {
- pthread_rwlock_init(&mRWLock, NULL);
-}
-inline RWLock::RWLock(int type, const char* name) {
- if (type == SHARED) {
- pthread_rwlockattr_t attr;
- pthread_rwlockattr_init(&attr);
- pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
- pthread_rwlock_init(&mRWLock, &attr);
- pthread_rwlockattr_destroy(&attr);
- } else {
- pthread_rwlock_init(&mRWLock, NULL);
- }
-}
-inline RWLock::~RWLock() {
- pthread_rwlock_destroy(&mRWLock);
-}
-inline status_t RWLock::readLock() {
- return -pthread_rwlock_rdlock(&mRWLock);
-}
-inline status_t RWLock::tryReadLock() {
- return -pthread_rwlock_tryrdlock(&mRWLock);
-}
-inline status_t RWLock::writeLock() {
- return -pthread_rwlock_wrlock(&mRWLock);
-}
-inline status_t RWLock::tryWriteLock() {
- return -pthread_rwlock_trywrlock(&mRWLock);
-}
-inline void RWLock::unlock() {
- pthread_rwlock_unlock(&mRWLock);
-}
-
-#endif // HAVE_PTHREADS
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_RWLOCK_H
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
deleted file mode 100644
index c7a9b78..0000000
--- a/include/utils/RefBase.h
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_REF_BASE_H
-#define ANDROID_REF_BASE_H
-
-#include <cutils/atomic.h>
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <utils/StrongPointer.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class TextOutput;
-TextOutput& printWeakPointer(TextOutput& to, const void* val);
-
-// ---------------------------------------------------------------------------
-
-#define COMPARE_WEAK(_op_) \
-inline bool operator _op_ (const sp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-inline bool operator _op_ (const T* o) const { \
- return m_ptr _op_ o; \
-} \
-template<typename U> \
-inline bool operator _op_ (const sp<U>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-template<typename U> \
-inline bool operator _op_ (const U* o) const { \
- return m_ptr _op_ o; \
-}
-
-// ---------------------------------------------------------------------------
-class ReferenceMover;
-class ReferenceConverterBase {
-public:
- virtual size_t getReferenceTypeSize() const = 0;
- virtual void* getReferenceBase(void const*) const = 0;
- inline virtual ~ReferenceConverterBase() { }
-};
-
-// ---------------------------------------------------------------------------
-
-class RefBase
-{
-public:
- void incStrong(const void* id) const;
- void decStrong(const void* id) const;
-
- void forceIncStrong(const void* id) const;
-
- //! DEBUGGING ONLY: Get current strong ref count.
- int32_t getStrongCount() const;
-
- class weakref_type
- {
- public:
- RefBase* refBase() const;
-
- void incWeak(const void* id);
- void decWeak(const void* id);
-
- // acquires a strong reference if there is already one.
- bool attemptIncStrong(const void* id);
-
- // acquires a weak reference if there is already one.
- // This is not always safe. see ProcessState.cpp and BpBinder.cpp
- // for proper use.
- bool attemptIncWeak(const void* id);
-
- //! DEBUGGING ONLY: Get current weak ref count.
- int32_t getWeakCount() const;
-
- //! DEBUGGING ONLY: Print references held on object.
- void printRefs() const;
-
- //! DEBUGGING ONLY: Enable tracking for this object.
- // enable -- enable/disable tracking
- // retain -- when tracking is enable, if true, then we save a stack trace
- // for each reference and dereference; when retain == false, we
- // match up references and dereferences and keep only the
- // outstanding ones.
-
- void trackMe(bool enable, bool retain);
- };
-
- weakref_type* createWeak(const void* id) const;
-
- weakref_type* getWeakRefs() const;
-
- //! DEBUGGING ONLY: Print references held on object.
- inline void printRefs() const { getWeakRefs()->printRefs(); }
-
- //! DEBUGGING ONLY: Enable tracking of object.
- inline void trackMe(bool enable, bool retain)
- {
- getWeakRefs()->trackMe(enable, retain);
- }
-
- typedef RefBase basetype;
-
-protected:
- RefBase();
- virtual ~RefBase();
-
- //! Flags for extendObjectLifetime()
- enum {
- OBJECT_LIFETIME_STRONG = 0x0000,
- OBJECT_LIFETIME_WEAK = 0x0001,
- OBJECT_LIFETIME_MASK = 0x0001
- };
-
- void extendObjectLifetime(int32_t mode);
-
- //! Flags for onIncStrongAttempted()
- enum {
- FIRST_INC_STRONG = 0x0001
- };
-
- virtual void onFirstRef();
- virtual void onLastStrongRef(const void* id);
- virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
- virtual void onLastWeakRef(const void* id);
-
-private:
- friend class ReferenceMover;
- static void moveReferences(void* d, void const* s, size_t n,
- const ReferenceConverterBase& caster);
-
-private:
- friend class weakref_type;
- class weakref_impl;
-
- RefBase(const RefBase& o);
- RefBase& operator=(const RefBase& o);
-
- weakref_impl* const mRefs;
-};
-
-// ---------------------------------------------------------------------------
-
-template <class T>
-class LightRefBase
-{
-public:
- inline LightRefBase() : mCount(0) { }
- inline void incStrong(const void* id) const {
- android_atomic_inc(&mCount);
- }
- inline void decStrong(const void* id) const {
- if (android_atomic_dec(&mCount) == 1) {
- delete static_cast<const T*>(this);
- }
- }
- //! DEBUGGING ONLY: Get current strong ref count.
- inline int32_t getStrongCount() const {
- return mCount;
- }
-
- typedef LightRefBase<T> basetype;
-
-protected:
- inline ~LightRefBase() { }
-
-private:
- friend class ReferenceMover;
- inline static void moveReferences(void* d, void const* s, size_t n,
- const ReferenceConverterBase& caster) { }
-
-private:
- mutable volatile int32_t mCount;
-};
-
-// ---------------------------------------------------------------------------
-
-template <typename T>
-class wp
-{
-public:
- typedef typename RefBase::weakref_type weakref_type;
-
- inline wp() : m_ptr(0) { }
-
- wp(T* other);
- wp(const wp<T>& other);
- wp(const sp<T>& other);
- template<typename U> wp(U* other);
- template<typename U> wp(const sp<U>& other);
- template<typename U> wp(const wp<U>& other);
-
- ~wp();
-
- // Assignment
-
- wp& operator = (T* other);
- wp& operator = (const wp<T>& other);
- wp& operator = (const sp<T>& other);
-
- template<typename U> wp& operator = (U* other);
- template<typename U> wp& operator = (const wp<U>& other);
- template<typename U> wp& operator = (const sp<U>& other);
-
- void set_object_and_refs(T* other, weakref_type* refs);
-
- // promotion to sp
-
- sp<T> promote() const;
-
- // Reset
-
- void clear();
-
- // Accessors
-
- inline weakref_type* get_refs() const { return m_refs; }
-
- inline T* unsafe_get() const { return m_ptr; }
-
- // Operators
-
- COMPARE_WEAK(==)
- COMPARE_WEAK(!=)
- COMPARE_WEAK(>)
- COMPARE_WEAK(<)
- COMPARE_WEAK(<=)
- COMPARE_WEAK(>=)
-
- inline bool operator == (const wp<T>& o) const {
- return (m_ptr == o.m_ptr) && (m_refs == o.m_refs);
- }
- template<typename U>
- inline bool operator == (const wp<U>& o) const {
- return m_ptr == o.m_ptr;
- }
-
- inline bool operator > (const wp<T>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr);
- }
- template<typename U>
- inline bool operator > (const wp<U>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr);
- }
-
- inline bool operator < (const wp<T>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr);
- }
- template<typename U>
- inline bool operator < (const wp<U>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr);
- }
- inline bool operator != (const wp<T>& o) const { return m_refs != o.m_refs; }
- template<typename U> inline bool operator != (const wp<U>& o) const { return !operator == (o); }
- inline bool operator <= (const wp<T>& o) const { return !operator > (o); }
- template<typename U> inline bool operator <= (const wp<U>& o) const { return !operator > (o); }
- inline bool operator >= (const wp<T>& o) const { return !operator < (o); }
- template<typename U> inline bool operator >= (const wp<U>& o) const { return !operator < (o); }
-
-private:
- template<typename Y> friend class sp;
- template<typename Y> friend class wp;
-
- T* m_ptr;
- weakref_type* m_refs;
-};
-
-template <typename T>
-TextOutput& operator<<(TextOutput& to, const wp<T>& val);
-
-#undef COMPARE_WEAK
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts below here.
-
-template<typename T>
-wp<T>::wp(T* other)
- : m_ptr(other)
-{
- if (other) m_refs = other->createWeak(this);
-}
-
-template<typename T>
-wp<T>::wp(const wp<T>& other)
- : m_ptr(other.m_ptr), m_refs(other.m_refs)
-{
- if (m_ptr) m_refs->incWeak(this);
-}
-
-template<typename T>
-wp<T>::wp(const sp<T>& other)
- : m_ptr(other.m_ptr)
-{
- if (m_ptr) {
- m_refs = m_ptr->createWeak(this);
- }
-}
-
-template<typename T> template<typename U>
-wp<T>::wp(U* other)
- : m_ptr(other)
-{
- if (other) m_refs = other->createWeak(this);
-}
-
-template<typename T> template<typename U>
-wp<T>::wp(const wp<U>& other)
- : m_ptr(other.m_ptr)
-{
- if (m_ptr) {
- m_refs = other.m_refs;
- m_refs->incWeak(this);
- }
-}
-
-template<typename T> template<typename U>
-wp<T>::wp(const sp<U>& other)
- : m_ptr(other.m_ptr)
-{
- if (m_ptr) {
- m_refs = m_ptr->createWeak(this);
- }
-}
-
-template<typename T>
-wp<T>::~wp()
-{
- if (m_ptr) m_refs->decWeak(this);
-}
-
-template<typename T>
-wp<T>& wp<T>::operator = (T* other)
-{
- weakref_type* newRefs =
- other ? other->createWeak(this) : 0;
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = other;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T>
-wp<T>& wp<T>::operator = (const wp<T>& other)
-{
- weakref_type* otherRefs(other.m_refs);
- T* otherPtr(other.m_ptr);
- if (otherPtr) otherRefs->incWeak(this);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = otherRefs;
- return *this;
-}
-
-template<typename T>
-wp<T>& wp<T>::operator = (const sp<T>& other)
-{
- weakref_type* newRefs =
- other != NULL ? other->createWeak(this) : 0;
- T* otherPtr(other.m_ptr);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T> template<typename U>
-wp<T>& wp<T>::operator = (U* other)
-{
- weakref_type* newRefs =
- other ? other->createWeak(this) : 0;
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = other;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T> template<typename U>
-wp<T>& wp<T>::operator = (const wp<U>& other)
-{
- weakref_type* otherRefs(other.m_refs);
- U* otherPtr(other.m_ptr);
- if (otherPtr) otherRefs->incWeak(this);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = otherRefs;
- return *this;
-}
-
-template<typename T> template<typename U>
-wp<T>& wp<T>::operator = (const sp<U>& other)
-{
- weakref_type* newRefs =
- other != NULL ? other->createWeak(this) : 0;
- U* otherPtr(other.m_ptr);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T>
-void wp<T>::set_object_and_refs(T* other, weakref_type* refs)
-{
- if (other) refs->incWeak(this);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = other;
- m_refs = refs;
-}
-
-template<typename T>
-sp<T> wp<T>::promote() const
-{
- sp<T> result;
- if (m_ptr && m_refs->attemptIncStrong(&result)) {
- result.set_pointer(m_ptr);
- }
- return result;
-}
-
-template<typename T>
-void wp<T>::clear()
-{
- if (m_ptr) {
- m_refs->decWeak(this);
- m_ptr = 0;
- }
-}
-
-template <typename T>
-inline TextOutput& operator<<(TextOutput& to, const wp<T>& val)
-{
- return printWeakPointer(to, val.unsafe_get());
-}
-
-// ---------------------------------------------------------------------------
-
-// this class just serves as a namespace so TYPE::moveReferences can stay
-// private.
-
-class ReferenceMover {
- // StrongReferenceCast and WeakReferenceCast do the impedance matching
- // between the generic (void*) implementation in Refbase and the strongly typed
- // template specializations below.
-
- template <typename TYPE>
- struct StrongReferenceCast : public ReferenceConverterBase {
- virtual size_t getReferenceTypeSize() const { return sizeof( sp<TYPE> ); }
- virtual void* getReferenceBase(void const* p) const {
- sp<TYPE> const* sptr(reinterpret_cast<sp<TYPE> const*>(p));
- return static_cast<typename TYPE::basetype *>(sptr->get());
- }
- };
-
- template <typename TYPE>
- struct WeakReferenceCast : public ReferenceConverterBase {
- virtual size_t getReferenceTypeSize() const { return sizeof( wp<TYPE> ); }
- virtual void* getReferenceBase(void const* p) const {
- wp<TYPE> const* sptr(reinterpret_cast<wp<TYPE> const*>(p));
- return static_cast<typename TYPE::basetype *>(sptr->unsafe_get());
- }
- };
-
-public:
- template<typename TYPE> static inline
- void move_references(sp<TYPE>* d, sp<TYPE> const* s, size_t n) {
- memmove(d, s, n*sizeof(sp<TYPE>));
- StrongReferenceCast<TYPE> caster;
- TYPE::moveReferences(d, s, n, caster);
- }
- template<typename TYPE> static inline
- void move_references(wp<TYPE>* d, wp<TYPE> const* s, size_t n) {
- memmove(d, s, n*sizeof(wp<TYPE>));
- WeakReferenceCast<TYPE> caster;
- TYPE::moveReferences(d, s, n, caster);
- }
-};
-
-// specialization for moving sp<> and wp<> types.
-// these are used by the [Sorted|Keyed]Vector<> implementations
-// sp<> and wp<> need to be handled specially, because they do not
-// have trivial copy operation in the general case (see RefBase.cpp
-// when DEBUG ops are enabled), but can be implemented very
-// efficiently in most cases.
-
-template<typename TYPE> inline
-void move_forward_type(sp<TYPE>* d, sp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-template<typename TYPE> inline
-void move_backward_type(sp<TYPE>* d, sp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-template<typename TYPE> inline
-void move_forward_type(wp<TYPE>* d, wp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-template<typename TYPE> inline
-void move_backward_type(wp<TYPE>* d, wp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_REF_BASE_H
diff --git a/include/utils/SharedBuffer.h b/include/utils/SharedBuffer.h
deleted file mode 100644
index 24508b0..0000000
--- a/include/utils/SharedBuffer.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SHARED_BUFFER_H
-#define ANDROID_SHARED_BUFFER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class SharedBuffer
-{
-public:
-
- /* flags to use with release() */
- enum {
- eKeepStorage = 0x00000001
- };
-
- /*! allocate a buffer of size 'size' and acquire() it.
- * call release() to free it.
- */
- static SharedBuffer* alloc(size_t size);
-
- /*! free the memory associated with the SharedBuffer.
- * Fails if there are any users associated with this SharedBuffer.
- * In other words, the buffer must have been release by all its
- * users.
- */
- static ssize_t dealloc(const SharedBuffer* released);
-
- //! get the SharedBuffer from the data pointer
- static inline const SharedBuffer* sharedBuffer(const void* data);
-
- //! access the data for read
- inline const void* data() const;
-
- //! access the data for read/write
- inline void* data();
-
- //! get size of the buffer
- inline size_t size() const;
-
- //! get back a SharedBuffer object from its data
- static inline SharedBuffer* bufferFromData(void* data);
-
- //! get back a SharedBuffer object from its data
- static inline const SharedBuffer* bufferFromData(const void* data);
-
- //! get the size of a SharedBuffer object from its data
- static inline size_t sizeFromData(const void* data);
-
- //! edit the buffer (get a writtable, or non-const, version of it)
- SharedBuffer* edit() const;
-
- //! edit the buffer, resizing if needed
- SharedBuffer* editResize(size_t size) const;
-
- //! like edit() but fails if a copy is required
- SharedBuffer* attemptEdit() const;
-
- //! resize and edit the buffer, loose it's content.
- SharedBuffer* reset(size_t size) const;
-
- //! acquire/release a reference on this buffer
- void acquire() const;
-
- /*! release a reference on this buffer, with the option of not
- * freeing the memory associated with it if it was the last reference
- * returns the previous reference count
- */
- int32_t release(uint32_t flags = 0) const;
-
- //! returns wether or not we're the only owner
- inline bool onlyOwner() const;
-
-
-private:
- inline SharedBuffer() { }
- inline ~SharedBuffer() { }
- inline SharedBuffer(const SharedBuffer&);
-
- // 16 bytes. must be sized to preserve correct alingment.
- mutable int32_t mRefs;
- size_t mSize;
- uint32_t mReserved[2];
-};
-
-// ---------------------------------------------------------------------------
-
-const SharedBuffer* SharedBuffer::sharedBuffer(const void* data) {
- return data ? reinterpret_cast<const SharedBuffer *>(data)-1 : 0;
-}
-
-const void* SharedBuffer::data() const {
- return this + 1;
-}
-
-void* SharedBuffer::data() {
- return this + 1;
-}
-
-size_t SharedBuffer::size() const {
- return mSize;
-}
-
-SharedBuffer* SharedBuffer::bufferFromData(void* data)
-{
- return ((SharedBuffer*)data)-1;
-}
-
-const SharedBuffer* SharedBuffer::bufferFromData(const void* data)
-{
- return ((const SharedBuffer*)data)-1;
-}
-
-size_t SharedBuffer::sizeFromData(const void* data)
-{
- return (((const SharedBuffer*)data)-1)->mSize;
-}
-
-bool SharedBuffer::onlyOwner() const {
- return (mRefs == 1);
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_VECTOR_H
diff --git a/include/utils/Singleton.h b/include/utils/Singleton.h
deleted file mode 100644
index a42ce21..0000000
--- a/include/utils/Singleton.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UTILS_SINGLETON_H
-#define ANDROID_UTILS_SINGLETON_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/threads.h>
-#include <cutils/compiler.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-template <typename TYPE>
-class ANDROID_API Singleton
-{
-public:
- static TYPE& getInstance() {
- Mutex::Autolock _l(sLock);
- TYPE* instance = sInstance;
- if (instance == 0) {
- instance = new TYPE();
- sInstance = instance;
- }
- return *instance;
- }
-
- static bool hasInstance() {
- Mutex::Autolock _l(sLock);
- return sInstance != 0;
- }
-
-protected:
- ~Singleton() { };
- Singleton() { };
-
-private:
- Singleton(const Singleton&);
- Singleton& operator = (const Singleton&);
- static Mutex sLock;
- static TYPE* sInstance;
-};
-
-/*
- * use ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) in your implementation file
- * (eg: <TYPE>.cpp) to create the static instance of Singleton<>'s attributes,
- * and avoid to have a copy of them in each compilation units Singleton<TYPE>
- * is used.
- * NOTE: we use a version of Mutex ctor that takes a parameter, because
- * for some unknown reason using the default ctor doesn't emit the variable!
- */
-
-#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \
- template class Singleton< TYPE >; \
- template<> Mutex Singleton< TYPE >::sLock(Mutex::PRIVATE); \
- template<> TYPE* Singleton< TYPE >::sInstance(0);
-
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_UTILS_SINGLETON_H
-
diff --git a/include/utils/SortedVector.h b/include/utils/SortedVector.h
deleted file mode 100644
index 0e98aeb..0000000
--- a/include/utils/SortedVector.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SORTED_VECTOR_H
-#define ANDROID_SORTED_VECTOR_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Vector.h>
-#include <utils/VectorImpl.h>
-#include <utils/TypeHelpers.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-template <class TYPE>
-class SortedVector : private SortedVectorImpl
-{
- friend class Vector<TYPE>;
-
-public:
- typedef TYPE value_type;
-
- /*!
- * Constructors and destructors
- */
-
- SortedVector();
- SortedVector(const SortedVector<TYPE>& rhs);
- virtual ~SortedVector();
-
- /*! copy operator */
- const SortedVector<TYPE>& operator = (const SortedVector<TYPE>& rhs) const;
- SortedVector<TYPE>& operator = (const SortedVector<TYPE>& rhs);
-
- /*
- * empty the vector
- */
-
- inline void clear() { VectorImpl::clear(); }
-
- /*!
- * vector stats
- */
-
- //! returns number of items in the vector
- inline size_t size() const { return VectorImpl::size(); }
- //! returns wether or not the vector is empty
- inline bool isEmpty() const { return VectorImpl::isEmpty(); }
- //! returns how many items can be stored without reallocating the backing store
- inline size_t capacity() const { return VectorImpl::capacity(); }
- //! setst the capacity. capacity can never be reduced less than size()
- inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); }
-
- /*!
- * C-style array access
- */
-
- //! read-only C-style access
- inline const TYPE* array() const;
-
- //! read-write C-style access. BE VERY CAREFUL when modifying the array
- //! you ust keep it sorted! You usually don't use this function.
- TYPE* editArray();
-
- //! finds the index of an item
- ssize_t indexOf(const TYPE& item) const;
-
- //! finds where this item should be inserted
- size_t orderOf(const TYPE& item) const;
-
-
- /*!
- * accessors
- */
-
- //! read-only access to an item at a given index
- inline const TYPE& operator [] (size_t index) const;
- //! alternate name for operator []
- inline const TYPE& itemAt(size_t index) const;
- //! stack-usage of the vector. returns the top of the stack (last element)
- const TYPE& top() const;
- //! same as operator [], but allows to access the vector backward (from the end) with a negative index
- const TYPE& mirrorItemAt(ssize_t index) const;
-
- /*!
- * modifing the array
- */
-
- //! add an item in the right place (and replace the one that is there)
- ssize_t add(const TYPE& item);
-
- //! editItemAt() MUST NOT change the order of this item
- TYPE& editItemAt(size_t index) {
- return *( static_cast<TYPE *>(VectorImpl::editItemLocation(index)) );
- }
-
- //! merges a vector into this one
- ssize_t merge(const Vector<TYPE>& vector);
- ssize_t merge(const SortedVector<TYPE>& vector);
-
- //! removes an item
- ssize_t remove(const TYPE&);
-
- //! remove several items
- inline ssize_t removeItemsAt(size_t index, size_t count = 1);
- //! remove one item
- inline ssize_t removeAt(size_t index) { return removeItemsAt(index); }
-
-protected:
- virtual void do_construct(void* storage, size_t num) const;
- virtual void do_destroy(void* storage, size_t num) const;
- virtual void do_copy(void* dest, const void* from, size_t num) const;
- virtual void do_splat(void* dest, const void* item, size_t num) const;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const;
- virtual int do_compare(const void* lhs, const void* rhs) const;
-};
-
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts from here...
-// ---------------------------------------------------------------------------
-
-template<class TYPE> inline
-SortedVector<TYPE>::SortedVector()
- : SortedVectorImpl(sizeof(TYPE),
- ((traits<TYPE>::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0)
- |(traits<TYPE>::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0)
- |(traits<TYPE>::has_trivial_copy ? HAS_TRIVIAL_COPY : 0))
- )
-{
-}
-
-template<class TYPE> inline
-SortedVector<TYPE>::SortedVector(const SortedVector<TYPE>& rhs)
- : SortedVectorImpl(rhs) {
-}
-
-template<class TYPE> inline
-SortedVector<TYPE>::~SortedVector() {
- finish_vector();
-}
-
-template<class TYPE> inline
-SortedVector<TYPE>& SortedVector<TYPE>::operator = (const SortedVector<TYPE>& rhs) {
- SortedVectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const SortedVector<TYPE>& SortedVector<TYPE>::operator = (const SortedVector<TYPE>& rhs) const {
- SortedVectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const TYPE* SortedVector<TYPE>::array() const {
- return static_cast<const TYPE *>(arrayImpl());
-}
-
-template<class TYPE> inline
-TYPE* SortedVector<TYPE>::editArray() {
- return static_cast<TYPE *>(editArrayImpl());
-}
-
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::operator[](size_t index) const {
- assert( index<size() );
- return *(array() + index);
-}
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::itemAt(size_t index) const {
- return operator[](index);
-}
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::mirrorItemAt(ssize_t index) const {
- assert( (index>0 ? index : -index)<size() );
- return *(array() + ((index<0) ? (size()-index) : index));
-}
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::top() const {
- return *(array() + size() - 1);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::add(const TYPE& item) {
- return SortedVectorImpl::add(&item);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::indexOf(const TYPE& item) const {
- return SortedVectorImpl::indexOf(&item);
-}
-
-template<class TYPE> inline
-size_t SortedVector<TYPE>::orderOf(const TYPE& item) const {
- return SortedVectorImpl::orderOf(&item);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::merge(const Vector<TYPE>& vector) {
- return SortedVectorImpl::merge(reinterpret_cast<const VectorImpl&>(vector));
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::merge(const SortedVector<TYPE>& vector) {
- return SortedVectorImpl::merge(reinterpret_cast<const SortedVectorImpl&>(vector));
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::remove(const TYPE& item) {
- return SortedVectorImpl::remove(&item);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::removeItemsAt(size_t index, size_t count) {
- return VectorImpl::removeItemsAt(index, count);
-}
-
-// ---------------------------------------------------------------------------
-
-template<class TYPE>
-void SortedVector<TYPE>::do_construct(void* storage, size_t num) const {
- construct_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_destroy(void* storage, size_t num) const {
- destroy_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_copy(void* dest, const void* from, size_t num) const {
- copy_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_splat(void* dest, const void* item, size_t num) const {
- splat_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(item), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_move_forward(void* dest, const void* from, size_t num) const {
- move_forward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_move_backward(void* dest, const void* from, size_t num) const {
- move_backward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-int SortedVector<TYPE>::do_compare(const void* lhs, const void* rhs) const {
- return compare_type( *reinterpret_cast<const TYPE*>(lhs), *reinterpret_cast<const TYPE*>(rhs) );
-}
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_SORTED_VECTOR_H
diff --git a/include/utils/StopWatch.h b/include/utils/StopWatch.h
deleted file mode 100644
index 693dd3c..0000000
--- a/include/utils/StopWatch.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_STOPWATCH_H
-#define ANDROID_STOPWATCH_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Timers.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class StopWatch
-{
-public:
- StopWatch( const char *name,
- int clock = SYSTEM_TIME_MONOTONIC,
- uint32_t flags = 0);
- ~StopWatch();
-
- const char* name() const;
- nsecs_t lap();
- nsecs_t elapsedTime() const;
-
- void reset();
-
-private:
- const char* mName;
- int mClock;
- uint32_t mFlags;
-
- struct lap_t {
- nsecs_t soFar;
- nsecs_t thisLap;
- };
-
- nsecs_t mStartTime;
- lap_t mLaps[8];
- int mNumLaps;
-};
-
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STOPWATCH_H
diff --git a/include/utils/String16.h b/include/utils/String16.h
deleted file mode 100644
index 360f407..0000000
--- a/include/utils/String16.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_STRING16_H
-#define ANDROID_STRING16_H
-
-#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
-#include <utils/Unicode.h>
-
-// ---------------------------------------------------------------------------
-
-extern "C" {
-
-}
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class String8;
-class TextOutput;
-
-//! This is a string holding UTF-16 characters.
-class String16
-{
-public:
- String16();
- String16(const String16& o);
- String16(const String16& o,
- size_t len,
- size_t begin=0);
- explicit String16(const char16_t* o);
- explicit String16(const char16_t* o, size_t len);
- explicit String16(const String8& o);
- explicit String16(const char* o);
- explicit String16(const char* o, size_t len);
-
- ~String16();
-
- inline const char16_t* string() const;
- inline size_t size() const;
-
- inline const SharedBuffer* sharedBuffer() const;
-
- void setTo(const String16& other);
- status_t setTo(const char16_t* other);
- status_t setTo(const char16_t* other, size_t len);
- status_t setTo(const String16& other,
- size_t len,
- size_t begin=0);
-
- status_t append(const String16& other);
- status_t append(const char16_t* other, size_t len);
-
- inline String16& operator=(const String16& other);
-
- inline String16& operator+=(const String16& other);
- inline String16 operator+(const String16& other) const;
-
- status_t insert(size_t pos, const char16_t* chrs);
- status_t insert(size_t pos,
- const char16_t* chrs, size_t len);
-
- ssize_t findFirst(char16_t c) const;
- ssize_t findLast(char16_t c) const;
-
- bool startsWith(const String16& prefix) const;
- bool startsWith(const char16_t* prefix) const;
-
- status_t makeLower();
-
- status_t replaceAll(char16_t replaceThis,
- char16_t withThis);
-
- status_t remove(size_t len, size_t begin=0);
-
- inline int compare(const String16& other) const;
-
- inline bool operator<(const String16& other) const;
- inline bool operator<=(const String16& other) const;
- inline bool operator==(const String16& other) const;
- inline bool operator!=(const String16& other) const;
- inline bool operator>=(const String16& other) const;
- inline bool operator>(const String16& other) const;
-
- inline bool operator<(const char16_t* other) const;
- inline bool operator<=(const char16_t* other) const;
- inline bool operator==(const char16_t* other) const;
- inline bool operator!=(const char16_t* other) const;
- inline bool operator>=(const char16_t* other) const;
- inline bool operator>(const char16_t* other) const;
-
- inline operator const char16_t*() const;
-
-private:
- const char16_t* mString;
-};
-
-TextOutput& operator<<(TextOutput& to, const String16& val);
-
-// ---------------------------------------------------------------------------
-// No user servicable parts below.
-
-inline int compare_type(const String16& lhs, const String16& rhs)
-{
- return lhs.compare(rhs);
-}
-
-inline int strictly_order_type(const String16& lhs, const String16& rhs)
-{
- return compare_type(lhs, rhs) < 0;
-}
-
-inline const char16_t* String16::string() const
-{
- return mString;
-}
-
-inline size_t String16::size() const
-{
- return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1;
-}
-
-inline const SharedBuffer* String16::sharedBuffer() const
-{
- return SharedBuffer::bufferFromData(mString);
-}
-
-inline String16& String16::operator=(const String16& other)
-{
- setTo(other);
- return *this;
-}
-
-inline String16& String16::operator+=(const String16& other)
-{
- append(other);
- return *this;
-}
-
-inline String16 String16::operator+(const String16& other) const
-{
- String16 tmp(*this);
- tmp += other;
- return tmp;
-}
-
-inline int String16::compare(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size());
-}
-
-inline bool String16::operator<(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) < 0;
-}
-
-inline bool String16::operator<=(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) <= 0;
-}
-
-inline bool String16::operator==(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) == 0;
-}
-
-inline bool String16::operator!=(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) != 0;
-}
-
-inline bool String16::operator>=(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) >= 0;
-}
-
-inline bool String16::operator>(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) > 0;
-}
-
-inline bool String16::operator<(const char16_t* other) const
-{
- return strcmp16(mString, other) < 0;
-}
-
-inline bool String16::operator<=(const char16_t* other) const
-{
- return strcmp16(mString, other) <= 0;
-}
-
-inline bool String16::operator==(const char16_t* other) const
-{
- return strcmp16(mString, other) == 0;
-}
-
-inline bool String16::operator!=(const char16_t* other) const
-{
- return strcmp16(mString, other) != 0;
-}
-
-inline bool String16::operator>=(const char16_t* other) const
-{
- return strcmp16(mString, other) >= 0;
-}
-
-inline bool String16::operator>(const char16_t* other) const
-{
- return strcmp16(mString, other) > 0;
-}
-
-inline String16::operator const char16_t*() const
-{
- return mString;
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STRING16_H
diff --git a/include/utils/String8.h b/include/utils/String8.h
deleted file mode 100644
index 4163697..0000000
--- a/include/utils/String8.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_STRING8_H
-#define ANDROID_STRING8_H
-
-#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
-#include <utils/Unicode.h>
-
-#include <string.h> // for strcmp
-#include <stdarg.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class String16;
-class TextOutput;
-
-//! This is a string holding UTF-8 characters. Does not allow the value more
-// than 0x10FFFF, which is not valid unicode codepoint.
-class String8
-{
-public:
- String8();
- String8(const String8& o);
- explicit String8(const char* o);
- explicit String8(const char* o, size_t numChars);
-
- explicit String8(const String16& o);
- explicit String8(const char16_t* o);
- explicit String8(const char16_t* o, size_t numChars);
- explicit String8(const char32_t* o);
- explicit String8(const char32_t* o, size_t numChars);
- ~String8();
-
- static inline const String8 empty();
-
- static String8 format(const char* fmt, ...) __attribute__((format (printf, 1, 2)));
- static String8 formatV(const char* fmt, va_list args);
-
- inline const char* string() const;
- inline size_t size() const;
- inline size_t length() const;
- inline size_t bytes() const;
- inline bool isEmpty() const;
-
- inline const SharedBuffer* sharedBuffer() const;
-
- void clear();
-
- void setTo(const String8& other);
- status_t setTo(const char* other);
- status_t setTo(const char* other, size_t numChars);
- status_t setTo(const char16_t* other, size_t numChars);
- status_t setTo(const char32_t* other,
- size_t length);
-
- status_t append(const String8& other);
- status_t append(const char* other);
- status_t append(const char* other, size_t numChars);
-
- status_t appendFormat(const char* fmt, ...)
- __attribute__((format (printf, 2, 3)));
- status_t appendFormatV(const char* fmt, va_list args);
-
- // Note that this function takes O(N) time to calculate the value.
- // No cache value is stored.
- size_t getUtf32Length() const;
- int32_t getUtf32At(size_t index,
- size_t *next_index) const;
- void getUtf32(char32_t* dst) const;
-
- inline String8& operator=(const String8& other);
- inline String8& operator=(const char* other);
-
- inline String8& operator+=(const String8& other);
- inline String8 operator+(const String8& other) const;
-
- inline String8& operator+=(const char* other);
- inline String8 operator+(const char* other) const;
-
- inline int compare(const String8& other) const;
-
- inline bool operator<(const String8& other) const;
- inline bool operator<=(const String8& other) const;
- inline bool operator==(const String8& other) const;
- inline bool operator!=(const String8& other) const;
- inline bool operator>=(const String8& other) const;
- inline bool operator>(const String8& other) const;
-
- inline bool operator<(const char* other) const;
- inline bool operator<=(const char* other) const;
- inline bool operator==(const char* other) const;
- inline bool operator!=(const char* other) const;
- inline bool operator>=(const char* other) const;
- inline bool operator>(const char* other) const;
-
- inline operator const char*() const;
-
- char* lockBuffer(size_t size);
- void unlockBuffer();
- status_t unlockBuffer(size_t size);
-
- // return the index of the first byte of other in this at or after
- // start, or -1 if not found
- ssize_t find(const char* other, size_t start = 0) const;
-
- void toLower();
- void toLower(size_t start, size_t numChars);
- void toUpper();
- void toUpper(size_t start, size_t numChars);
-
- /*
- * These methods operate on the string as if it were a path name.
- */
-
- /*
- * Set the filename field to a specific value.
- *
- * Normalizes the filename, removing a trailing '/' if present.
- */
- void setPathName(const char* name);
- void setPathName(const char* name, size_t numChars);
-
- /*
- * Get just the filename component.
- *
- * "/tmp/foo/bar.c" --> "bar.c"
- */
- String8 getPathLeaf(void) const;
-
- /*
- * Remove the last (file name) component, leaving just the directory
- * name.
- *
- * "/tmp/foo/bar.c" --> "/tmp/foo"
- * "/tmp" --> "" // ????? shouldn't this be "/" ???? XXX
- * "bar.c" --> ""
- */
- String8 getPathDir(void) const;
-
- /*
- * Retrieve the front (root dir) component. Optionally also return the
- * remaining components.
- *
- * "/tmp/foo/bar.c" --> "tmp" (remain = "foo/bar.c")
- * "/tmp" --> "tmp" (remain = "")
- * "bar.c" --> "bar.c" (remain = "")
- */
- String8 walkPath(String8* outRemains = NULL) const;
-
- /*
- * Return the filename extension. This is the last '.' and any number
- * of characters that follow it. The '.' is included in case we
- * decide to expand our definition of what constitutes an extension.
- *
- * "/tmp/foo/bar.c" --> ".c"
- * "/tmp" --> ""
- * "/tmp/foo.bar/baz" --> ""
- * "foo.jpeg" --> ".jpeg"
- * "foo." --> ""
- */
- String8 getPathExtension(void) const;
-
- /*
- * Return the path without the extension. Rules for what constitutes
- * an extension are described in the comment for getPathExtension().
- *
- * "/tmp/foo/bar.c" --> "/tmp/foo/bar"
- */
- String8 getBasePath(void) const;
-
- /*
- * Add a component to the pathname. We guarantee that there is
- * exactly one path separator between the old path and the new.
- * If there is no existing name, we just copy the new name in.
- *
- * If leaf is a fully qualified path (i.e. starts with '/', it
- * replaces whatever was there before.
- */
- String8& appendPath(const char* leaf);
- String8& appendPath(const String8& leaf) { return appendPath(leaf.string()); }
-
- /*
- * Like appendPath(), but does not affect this string. Returns a new one instead.
- */
- String8 appendPathCopy(const char* leaf) const
- { String8 p(*this); p.appendPath(leaf); return p; }
- String8 appendPathCopy(const String8& leaf) const { return appendPathCopy(leaf.string()); }
-
- /*
- * Converts all separators in this string to /, the default path separator.
- *
- * If the default OS separator is backslash, this converts all
- * backslashes to slashes, in-place. Otherwise it does nothing.
- * Returns self.
- */
- String8& convertToResPath();
-
-private:
- status_t real_append(const char* other, size_t numChars);
- char* find_extension(void) const;
-
- const char* mString;
-};
-
-TextOutput& operator<<(TextOutput& to, const String16& val);
-
-// ---------------------------------------------------------------------------
-// No user servicable parts below.
-
-inline int compare_type(const String8& lhs, const String8& rhs)
-{
- return lhs.compare(rhs);
-}
-
-inline int strictly_order_type(const String8& lhs, const String8& rhs)
-{
- return compare_type(lhs, rhs) < 0;
-}
-
-inline const String8 String8::empty() {
- return String8();
-}
-
-inline const char* String8::string() const
-{
- return mString;
-}
-
-inline size_t String8::length() const
-{
- return SharedBuffer::sizeFromData(mString)-1;
-}
-
-inline size_t String8::size() const
-{
- return length();
-}
-
-inline bool String8::isEmpty() const
-{
- return length() == 0;
-}
-
-inline size_t String8::bytes() const
-{
- return SharedBuffer::sizeFromData(mString)-1;
-}
-
-inline const SharedBuffer* String8::sharedBuffer() const
-{
- return SharedBuffer::bufferFromData(mString);
-}
-
-inline String8& String8::operator=(const String8& other)
-{
- setTo(other);
- return *this;
-}
-
-inline String8& String8::operator=(const char* other)
-{
- setTo(other);
- return *this;
-}
-
-inline String8& String8::operator+=(const String8& other)
-{
- append(other);
- return *this;
-}
-
-inline String8 String8::operator+(const String8& other) const
-{
- String8 tmp(*this);
- tmp += other;
- return tmp;
-}
-
-inline String8& String8::operator+=(const char* other)
-{
- append(other);
- return *this;
-}
-
-inline String8 String8::operator+(const char* other) const
-{
- String8 tmp(*this);
- tmp += other;
- return tmp;
-}
-
-inline int String8::compare(const String8& other) const
-{
- return strcmp(mString, other.mString);
-}
-
-inline bool String8::operator<(const String8& other) const
-{
- return strcmp(mString, other.mString) < 0;
-}
-
-inline bool String8::operator<=(const String8& other) const
-{
- return strcmp(mString, other.mString) <= 0;
-}
-
-inline bool String8::operator==(const String8& other) const
-{
- return strcmp(mString, other.mString) == 0;
-}
-
-inline bool String8::operator!=(const String8& other) const
-{
- return strcmp(mString, other.mString) != 0;
-}
-
-inline bool String8::operator>=(const String8& other) const
-{
- return strcmp(mString, other.mString) >= 0;
-}
-
-inline bool String8::operator>(const String8& other) const
-{
- return strcmp(mString, other.mString) > 0;
-}
-
-inline bool String8::operator<(const char* other) const
-{
- return strcmp(mString, other) < 0;
-}
-
-inline bool String8::operator<=(const char* other) const
-{
- return strcmp(mString, other) <= 0;
-}
-
-inline bool String8::operator==(const char* other) const
-{
- return strcmp(mString, other) == 0;
-}
-
-inline bool String8::operator!=(const char* other) const
-{
- return strcmp(mString, other) != 0;
-}
-
-inline bool String8::operator>=(const char* other) const
-{
- return strcmp(mString, other) >= 0;
-}
-
-inline bool String8::operator>(const char* other) const
-{
- return strcmp(mString, other) > 0;
-}
-
-inline String8::operator const char*() const
-{
- return mString;
-}
-
-} // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STRING8_H
diff --git a/include/utils/StringArray.h b/include/utils/StringArray.h
deleted file mode 100644
index c244587..0000000
--- a/include/utils/StringArray.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Sortable array of strings. STL-ish, but STL-free.
-//
-#ifndef _LIBS_UTILS_STRING_ARRAY_H
-#define _LIBS_UTILS_STRING_ARRAY_H
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace android {
-
-//
-// An expanding array of strings. Add, get, sort, delete.
-//
-class StringArray {
-public:
- StringArray();
- virtual ~StringArray();
-
- //
- // Add a string. A copy of the string is made.
- //
- bool push_back(const char* str);
-
- //
- // Delete an entry.
- //
- void erase(int idx);
-
- //
- // Sort the array.
- //
- void sort(int (*compare)(const void*, const void*));
-
- //
- // Pass this to the sort routine to do an ascending alphabetical sort.
- //
- static int cmpAscendingAlpha(const void* pstr1, const void* pstr2);
-
- //
- // Get the #of items in the array.
- //
- inline int size(void) const { return mCurrent; }
-
- //
- // Return entry N.
- // [should use operator[] here]
- //
- const char* getEntry(int idx) const {
- return (unsigned(idx) >= unsigned(mCurrent)) ? NULL : mArray[idx];
- }
-
- //
- // Set entry N to specified string.
- // [should use operator[] here]
- //
- void setEntry(int idx, const char* str);
-
-private:
- int mMax;
- int mCurrent;
- char** mArray;
-};
-
-}; // namespace android
-
-#endif // _LIBS_UTILS_STRING_ARRAY_H
diff --git a/include/utils/StrongPointer.h b/include/utils/StrongPointer.h
deleted file mode 100644
index 49fa3a8..0000000
--- a/include/utils/StrongPointer.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_STRONG_POINTER_H
-#define ANDROID_STRONG_POINTER_H
-
-#include <cutils/atomic.h>
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class TextOutput;
-TextOutput& printStrongPointer(TextOutput& to, const void* val);
-
-template<typename T> class wp;
-
-// ---------------------------------------------------------------------------
-
-#define COMPARE(_op_) \
-inline bool operator _op_ (const sp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-inline bool operator _op_ (const T* o) const { \
- return m_ptr _op_ o; \
-} \
-template<typename U> \
-inline bool operator _op_ (const sp<U>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-template<typename U> \
-inline bool operator _op_ (const U* o) const { \
- return m_ptr _op_ o; \
-} \
-inline bool operator _op_ (const wp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-template<typename U> \
-inline bool operator _op_ (const wp<U>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-}
-
-// ---------------------------------------------------------------------------
-
-template <typename T>
-class sp
-{
-public:
- inline sp() : m_ptr(0) { }
-
- sp(T* other);
- sp(const sp<T>& other);
- template<typename U> sp(U* other);
- template<typename U> sp(const sp<U>& other);
-
- ~sp();
-
- // Assignment
-
- sp& operator = (T* other);
- sp& operator = (const sp<T>& other);
-
- template<typename U> sp& operator = (const sp<U>& other);
- template<typename U> sp& operator = (U* other);
-
- //! Special optimization for use by ProcessState (and nobody else).
- void force_set(T* other);
-
- // Reset
-
- void clear();
-
- // Accessors
-
- inline T& operator* () const { return *m_ptr; }
- inline T* operator-> () const { return m_ptr; }
- inline T* get() const { return m_ptr; }
-
- // Operators
-
- COMPARE(==)
- COMPARE(!=)
- COMPARE(>)
- COMPARE(<)
- COMPARE(<=)
- COMPARE(>=)
-
-private:
- template<typename Y> friend class sp;
- template<typename Y> friend class wp;
- void set_pointer(T* ptr);
- T* m_ptr;
-};
-
-#undef COMPARE
-
-template <typename T>
-TextOutput& operator<<(TextOutput& to, const sp<T>& val);
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts below here.
-
-template<typename T>
-sp<T>::sp(T* other)
-: m_ptr(other)
- {
- if (other) other->incStrong(this);
- }
-
-template<typename T>
-sp<T>::sp(const sp<T>& other)
-: m_ptr(other.m_ptr)
- {
- if (m_ptr) m_ptr->incStrong(this);
- }
-
-template<typename T> template<typename U>
-sp<T>::sp(U* other) : m_ptr(other)
-{
- if (other) ((T*)other)->incStrong(this);
-}
-
-template<typename T> template<typename U>
-sp<T>::sp(const sp<U>& other)
-: m_ptr(other.m_ptr)
- {
- if (m_ptr) m_ptr->incStrong(this);
- }
-
-template<typename T>
-sp<T>::~sp()
-{
- if (m_ptr) m_ptr->decStrong(this);
-}
-
-template<typename T>
-sp<T>& sp<T>::operator = (const sp<T>& other) {
- T* otherPtr(other.m_ptr);
- if (otherPtr) otherPtr->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = otherPtr;
- return *this;
-}
-
-template<typename T>
-sp<T>& sp<T>::operator = (T* other)
-{
- if (other) other->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = other;
- return *this;
-}
-
-template<typename T> template<typename U>
-sp<T>& sp<T>::operator = (const sp<U>& other)
-{
- T* otherPtr(other.m_ptr);
- if (otherPtr) otherPtr->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = otherPtr;
- return *this;
-}
-
-template<typename T> template<typename U>
-sp<T>& sp<T>::operator = (U* other)
-{
- if (other) ((T*)other)->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = other;
- return *this;
-}
-
-template<typename T>
-void sp<T>::force_set(T* other)
-{
- other->forceIncStrong(this);
- m_ptr = other;
-}
-
-template<typename T>
-void sp<T>::clear()
-{
- if (m_ptr) {
- m_ptr->decStrong(this);
- m_ptr = 0;
- }
-}
-
-template<typename T>
-void sp<T>::set_pointer(T* ptr) {
- m_ptr = ptr;
-}
-
-template <typename T>
-inline TextOutput& operator<<(TextOutput& to, const sp<T>& val)
-{
- return printStrongPointer(to, val.get());
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STRONG_POINTER_H
diff --git a/include/utils/SystemClock.h b/include/utils/SystemClock.h
deleted file mode 100644
index 7c319be..0000000
--- a/include/utils/SystemClock.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UTILS_SYSTEMCLOCK_H
-#define ANDROID_UTILS_SYSTEMCLOCK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-namespace android {
-
-int setCurrentTimeMillis(int64_t millis);
-int64_t uptimeMillis();
-int64_t elapsedRealtime();
-
-}; // namespace android
-
-#endif // ANDROID_UTILS_SYSTEMCLOCK_H
-
diff --git a/include/utils/TextOutput.h b/include/utils/TextOutput.h
deleted file mode 100644
index de2fbbe..0000000
--- a/include/utils/TextOutput.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_TEXTOUTPUT_H
-#define ANDROID_TEXTOUTPUT_H
-
-#include <utils/Errors.h>
-
-#include <stdint.h>
-#include <string.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class TextOutput
-{
-public:
- TextOutput();
- virtual ~TextOutput();
-
- virtual status_t print(const char* txt, size_t len) = 0;
- virtual void moveIndent(int delta) = 0;
-
- class Bundle {
- public:
- inline Bundle(TextOutput& to) : mTO(to) { to.pushBundle(); }
- inline ~Bundle() { mTO.popBundle(); }
- private:
- TextOutput& mTO;
- };
-
- virtual void pushBundle() = 0;
- virtual void popBundle() = 0;
-};
-
-// ---------------------------------------------------------------------------
-
-// Text output stream for printing to the log (via utils/Log.h).
-extern TextOutput& alog;
-
-// Text output stream for printing to stdout.
-extern TextOutput& aout;
-
-// Text output stream for printing to stderr.
-extern TextOutput& aerr;
-
-typedef TextOutput& (*TextOutputManipFunc)(TextOutput&);
-
-TextOutput& endl(TextOutput& to);
-TextOutput& indent(TextOutput& to);
-TextOutput& dedent(TextOutput& to);
-
-TextOutput& operator<<(TextOutput& to, const char* str);
-TextOutput& operator<<(TextOutput& to, char); // writes raw character
-TextOutput& operator<<(TextOutput& to, bool);
-TextOutput& operator<<(TextOutput& to, int);
-TextOutput& operator<<(TextOutput& to, long);
-TextOutput& operator<<(TextOutput& to, unsigned int);
-TextOutput& operator<<(TextOutput& to, unsigned long);
-TextOutput& operator<<(TextOutput& to, long long);
-TextOutput& operator<<(TextOutput& to, unsigned long long);
-TextOutput& operator<<(TextOutput& to, float);
-TextOutput& operator<<(TextOutput& to, double);
-TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func);
-TextOutput& operator<<(TextOutput& to, const void*);
-
-class TypeCode
-{
-public:
- inline TypeCode(uint32_t code);
- inline ~TypeCode();
-
- inline uint32_t typeCode() const;
-
-private:
- uint32_t mCode;
-};
-
-TextOutput& operator<<(TextOutput& to, const TypeCode& val);
-
-class HexDump
-{
-public:
- HexDump(const void *buf, size_t size, size_t bytesPerLine=16);
- inline ~HexDump();
-
- inline HexDump& setBytesPerLine(size_t bytesPerLine);
- inline HexDump& setSingleLineCutoff(int32_t bytes);
- inline HexDump& setAlignment(size_t alignment);
- inline HexDump& setCArrayStyle(bool enabled);
-
- inline const void* buffer() const;
- inline size_t size() const;
- inline size_t bytesPerLine() const;
- inline int32_t singleLineCutoff() const;
- inline size_t alignment() const;
- inline bool carrayStyle() const;
-
-private:
- const void* mBuffer;
- size_t mSize;
- size_t mBytesPerLine;
- int32_t mSingleLineCutoff;
- size_t mAlignment;
- bool mCArrayStyle;
-};
-
-TextOutput& operator<<(TextOutput& to, const HexDump& val);
-
-// ---------------------------------------------------------------------------
-// No user servicable parts below.
-
-inline TextOutput& endl(TextOutput& to)
-{
- to.print("\n", 1);
- return to;
-}
-
-inline TextOutput& indent(TextOutput& to)
-{
- to.moveIndent(1);
- return to;
-}
-
-inline TextOutput& dedent(TextOutput& to)
-{
- to.moveIndent(-1);
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, const char* str)
-{
- to.print(str, strlen(str));
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, char c)
-{
- to.print(&c, 1);
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func)
-{
- return (*func)(to);
-}
-
-inline TypeCode::TypeCode(uint32_t code) : mCode(code) { }
-inline TypeCode::~TypeCode() { }
-inline uint32_t TypeCode::typeCode() const { return mCode; }
-
-inline HexDump::~HexDump() { }
-
-inline HexDump& HexDump::setBytesPerLine(size_t bytesPerLine) {
- mBytesPerLine = bytesPerLine; return *this;
-}
-inline HexDump& HexDump::setSingleLineCutoff(int32_t bytes) {
- mSingleLineCutoff = bytes; return *this;
-}
-inline HexDump& HexDump::setAlignment(size_t alignment) {
- mAlignment = alignment; return *this;
-}
-inline HexDump& HexDump::setCArrayStyle(bool enabled) {
- mCArrayStyle = enabled; return *this;
-}
-
-inline const void* HexDump::buffer() const { return mBuffer; }
-inline size_t HexDump::size() const { return mSize; }
-inline size_t HexDump::bytesPerLine() const { return mBytesPerLine; }
-inline int32_t HexDump::singleLineCutoff() const { return mSingleLineCutoff; }
-inline size_t HexDump::alignment() const { return mAlignment; }
-inline bool HexDump::carrayStyle() const { return mCArrayStyle; }
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_TEXTOUTPUT_H
diff --git a/include/utils/Thread.h b/include/utils/Thread.h
deleted file mode 100644
index 4a34abd..0000000
--- a/include/utils/Thread.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_THREAD_H
-#define _LIBS_UTILS_THREAD_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Condition.h>
-#include <utils/Errors.h>
-#include <utils/Mutex.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-#include <utils/ThreadDefs.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Thread : virtual public RefBase
-{
-public:
- // Create a Thread object, but doesn't create or start the associated
- // thread. See the run() method.
- Thread(bool canCallJava = true);
- virtual ~Thread();
-
- // Start the thread in threadLoop() which needs to be implemented.
- virtual status_t run( const char* name = 0,
- int32_t priority = PRIORITY_DEFAULT,
- size_t stack = 0);
-
- // Ask this object's thread to exit. This function is asynchronous, when the
- // function returns the thread might still be running. Of course, this
- // function can be called from a different thread.
- virtual void requestExit();
-
- // Good place to do one-time initializations
- virtual status_t readyToRun();
-
- // Call requestExit() and wait until this object's thread exits.
- // BE VERY CAREFUL of deadlocks. In particular, it would be silly to call
- // this function from this object's thread. Will return WOULD_BLOCK in
- // that case.
- status_t requestExitAndWait();
-
- // Wait until this object's thread exits. Returns immediately if not yet running.
- // Do not call from this object's thread; will return WOULD_BLOCK in that case.
- status_t join();
-
-#ifdef HAVE_ANDROID_OS
- // Return the thread's kernel ID, same as the thread itself calling gettid() or
- // androidGetTid(), or -1 if the thread is not running.
- pid_t getTid() const;
-#endif
-
-protected:
- // exitPending() returns true if requestExit() has been called.
- bool exitPending() const;
-
-private:
- // Derived class must implement threadLoop(). The thread starts its life
- // here. There are two ways of using the Thread object:
- // 1) loop: if threadLoop() returns true, it will be called again if
- // requestExit() wasn't called.
- // 2) once: if threadLoop() returns false, the thread will exit upon return.
- virtual bool threadLoop() = 0;
-
-private:
- Thread& operator=(const Thread&);
- static int _threadLoop(void* user);
- const bool mCanCallJava;
- // always hold mLock when reading or writing
- thread_id_t mThread;
- mutable Mutex mLock;
- Condition mThreadExitedCondition;
- status_t mStatus;
- // note that all accesses of mExitPending and mRunning need to hold mLock
- volatile bool mExitPending;
- volatile bool mRunning;
- sp<Thread> mHoldSelf;
-#ifdef HAVE_ANDROID_OS
- // legacy for debugging, not used by getTid() as it is set by the child thread
- // and so is not initialized until the child reaches that point
- pid_t mTid;
-#endif
-};
-
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-#endif // _LIBS_UTILS_THREAD_H
-// ---------------------------------------------------------------------------
diff --git a/include/utils/ThreadDefs.h b/include/utils/ThreadDefs.h
deleted file mode 100644
index 3e56373..0000000
--- a/include/utils/ThreadDefs.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_THREAD_DEFS_H
-#define _LIBS_UTILS_THREAD_DEFS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <system/graphics.h>
-
-// ---------------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void* android_thread_id_t;
-
-typedef int (*android_thread_func_t)(void*);
-
-enum {
- /*
- * ***********************************************
- * ** Keep in sync with android.os.Process.java **
- * ***********************************************
- *
- * This maps directly to the "nice" priorities we use in Android.
- * A thread priority should be chosen inverse-proportionally to
- * the amount of work the thread is expected to do. The more work
- * a thread will do, the less favorable priority it should get so that
- * it doesn't starve the system. Threads not behaving properly might
- * be "punished" by the kernel.
- * Use the levels below when appropriate. Intermediate values are
- * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
- */
- ANDROID_PRIORITY_LOWEST = 19,
-
- /* use for background tasks */
- ANDROID_PRIORITY_BACKGROUND = 10,
-
- /* most threads run at normal priority */
- ANDROID_PRIORITY_NORMAL = 0,
-
- /* threads currently running a UI that the user is interacting with */
- ANDROID_PRIORITY_FOREGROUND = -2,
-
- /* the main UI thread has a slightly more favorable priority */
- ANDROID_PRIORITY_DISPLAY = -4,
-
- /* ui service treads might want to run at a urgent display (uncommon) */
- ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY,
-
- /* all normal audio threads */
- ANDROID_PRIORITY_AUDIO = -16,
-
- /* service audio threads (uncommon) */
- ANDROID_PRIORITY_URGENT_AUDIO = -19,
-
- /* should never be used in practice. regular process might not
- * be allowed to use this level */
- ANDROID_PRIORITY_HIGHEST = -20,
-
- ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL,
- ANDROID_PRIORITY_MORE_FAVORABLE = -1,
- ANDROID_PRIORITY_LESS_FAVORABLE = +1,
-};
-
-enum {
- ANDROID_TGROUP_DEFAULT = 0,
- ANDROID_TGROUP_BG_NONINTERACT = 1,
- ANDROID_TGROUP_FG_BOOST = 2,
- ANDROID_TGROUP_MAX = ANDROID_TGROUP_FG_BOOST,
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ---------------------------------------------------------------------------
-// C++ API
-#ifdef __cplusplus
-namespace android {
-// ---------------------------------------------------------------------------
-
-typedef android_thread_id_t thread_id_t;
-typedef android_thread_func_t thread_func_t;
-
-enum {
- PRIORITY_LOWEST = ANDROID_PRIORITY_LOWEST,
- PRIORITY_BACKGROUND = ANDROID_PRIORITY_BACKGROUND,
- PRIORITY_NORMAL = ANDROID_PRIORITY_NORMAL,
- PRIORITY_FOREGROUND = ANDROID_PRIORITY_FOREGROUND,
- PRIORITY_DISPLAY = ANDROID_PRIORITY_DISPLAY,
- PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_URGENT_DISPLAY,
- PRIORITY_AUDIO = ANDROID_PRIORITY_AUDIO,
- PRIORITY_URGENT_AUDIO = ANDROID_PRIORITY_URGENT_AUDIO,
- PRIORITY_HIGHEST = ANDROID_PRIORITY_HIGHEST,
- PRIORITY_DEFAULT = ANDROID_PRIORITY_DEFAULT,
- PRIORITY_MORE_FAVORABLE = ANDROID_PRIORITY_MORE_FAVORABLE,
- PRIORITY_LESS_FAVORABLE = ANDROID_PRIORITY_LESS_FAVORABLE,
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-#endif // __cplusplus
-// ---------------------------------------------------------------------------
-
-
-#endif // _LIBS_UTILS_THREAD_DEFS_H
diff --git a/include/utils/Timers.h b/include/utils/Timers.h
deleted file mode 100644
index 8b4d322..0000000
--- a/include/utils/Timers.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Timer functions.
-//
-#ifndef _LIBS_UTILS_TIMERS_H
-#define _LIBS_UTILS_TIMERS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-// ------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int64_t nsecs_t; // nano-seconds
-
-static inline nsecs_t seconds_to_nanoseconds(nsecs_t secs)
-{
- return secs*1000000000;
-}
-
-static inline nsecs_t milliseconds_to_nanoseconds(nsecs_t secs)
-{
- return secs*1000000;
-}
-
-static inline nsecs_t microseconds_to_nanoseconds(nsecs_t secs)
-{
- return secs*1000;
-}
-
-static inline nsecs_t nanoseconds_to_seconds(nsecs_t secs)
-{
- return secs/1000000000;
-}
-
-static inline nsecs_t nanoseconds_to_milliseconds(nsecs_t secs)
-{
- return secs/1000000;
-}
-
-static inline nsecs_t nanoseconds_to_microseconds(nsecs_t secs)
-{
- return secs/1000;
-}
-
-static inline nsecs_t s2ns(nsecs_t v) {return seconds_to_nanoseconds(v);}
-static inline nsecs_t ms2ns(nsecs_t v) {return milliseconds_to_nanoseconds(v);}
-static inline nsecs_t us2ns(nsecs_t v) {return microseconds_to_nanoseconds(v);}
-static inline nsecs_t ns2s(nsecs_t v) {return nanoseconds_to_seconds(v);}
-static inline nsecs_t ns2ms(nsecs_t v) {return nanoseconds_to_milliseconds(v);}
-static inline nsecs_t ns2us(nsecs_t v) {return nanoseconds_to_microseconds(v);}
-
-static inline nsecs_t seconds(nsecs_t v) { return s2ns(v); }
-static inline nsecs_t milliseconds(nsecs_t v) { return ms2ns(v); }
-static inline nsecs_t microseconds(nsecs_t v) { return us2ns(v); }
-
-enum {
- SYSTEM_TIME_REALTIME = 0, // system-wide realtime clock
- SYSTEM_TIME_MONOTONIC = 1, // monotonic time since unspecified starting point
- SYSTEM_TIME_PROCESS = 2, // high-resolution per-process clock
- SYSTEM_TIME_THREAD = 3 // high-resolution per-thread clock
-};
-
-// return the system-time according to the specified clock
-#ifdef __cplusplus
-nsecs_t systemTime(int clock = SYSTEM_TIME_MONOTONIC);
-#else
-nsecs_t systemTime(int clock);
-#endif // def __cplusplus
-
-/**
- * Returns the number of milliseconds to wait between the reference time and the timeout time.
- * If the timeout is in the past relative to the reference time, returns 0.
- * If the timeout is more than INT_MAX milliseconds in the future relative to the reference time,
- * such as when timeoutTime == LLONG_MAX, returns -1 to indicate an infinite timeout delay.
- * Otherwise, returns the difference between the reference time and timeout time
- * rounded up to the next millisecond.
- */
-int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ------------------------------------------------------------------
-// C++ API
-
-#ifdef __cplusplus
-
-namespace android {
-/*
- * Time the duration of something.
- *
- * Includes some timeval manipulation functions.
- */
-class DurationTimer {
-public:
- DurationTimer() {}
- ~DurationTimer() {}
-
- // Start the timer.
- void start();
- // Stop the timer.
- void stop();
- // Get the duration in microseconds.
- long long durationUsecs() const;
-
- // Subtract two timevals. Returns the difference (ptv1-ptv2) in
- // microseconds.
- static long long subtractTimevals(const struct timeval* ptv1,
- const struct timeval* ptv2);
-
- // Add the specified amount of time to the timeval.
- static void addToTimeval(struct timeval* ptv, long usec);
-
-private:
- struct timeval mStartWhen;
- struct timeval mStopWhen;
-};
-
-}; // android
-#endif // def __cplusplus
-
-#endif // _LIBS_UTILS_TIMERS_H
diff --git a/include/utils/Tokenizer.h b/include/utils/Tokenizer.h
deleted file mode 100644
index c7db5fb..0000000
--- a/include/utils/Tokenizer.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _UTILS_TOKENIZER_H
-#define _UTILS_TOKENIZER_H
-
-#include <assert.h>
-#include <utils/Errors.h>
-#include <utils/FileMap.h>
-#include <utils/String8.h>
-
-namespace android {
-
-/**
- * A simple tokenizer for loading and parsing ASCII text files line by line.
- */
-class Tokenizer {
- Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, size_t length);
-
-public:
- ~Tokenizer();
-
- /**
- * Opens a file and maps it into memory.
- *
- * Returns NO_ERROR and a tokenizer for the file, if successful.
- * Otherwise returns an error and sets outTokenizer to NULL.
- */
- static status_t open(const String8& filename, Tokenizer** outTokenizer);
-
- /**
- * Returns true if at the end of the file.
- */
- inline bool isEof() const { return mCurrent == getEnd(); }
-
- /**
- * Returns true if at the end of the line or end of the file.
- */
- inline bool isEol() const { return isEof() || *mCurrent == '\n'; }
-
- /**
- * Gets the name of the file.
- */
- inline String8 getFilename() const { return mFilename; }
-
- /**
- * Gets a 1-based line number index for the current position.
- */
- inline int32_t getLineNumber() const { return mLineNumber; }
-
- /**
- * Formats a location string consisting of the filename and current line number.
- * Returns a string like "MyFile.txt:33".
- */
- String8 getLocation() const;
-
- /**
- * Gets the character at the current position.
- * Returns null at end of file.
- */
- inline char peekChar() const { return isEof() ? '\0' : *mCurrent; }
-
- /**
- * Gets the remainder of the current line as a string, excluding the newline character.
- */
- String8 peekRemainderOfLine() const;
-
- /**
- * Gets the character at the current position and advances past it.
- * Returns null at end of file.
- */
- inline char nextChar() { return isEof() ? '\0' : *(mCurrent++); }
-
- /**
- * Gets the next token on this line stopping at the specified delimiters
- * or the end of the line whichever comes first and advances past it.
- * Also stops at embedded nulls.
- * Returns the token or an empty string if the current character is a delimiter
- * or is at the end of the line.
- */
- String8 nextToken(const char* delimiters);
-
- /**
- * Advances to the next line.
- * Does nothing if already at the end of the file.
- */
- void nextLine();
-
- /**
- * Skips over the specified delimiters in the line.
- * Also skips embedded nulls.
- */
- void skipDelimiters(const char* delimiters);
-
-private:
- Tokenizer(const Tokenizer& other); // not copyable
-
- String8 mFilename;
- FileMap* mFileMap;
- char* mBuffer;
- size_t mLength;
-
- const char* mCurrent;
- int32_t mLineNumber;
-
- inline const char* getEnd() const { return mBuffer + mLength; }
-
-};
-
-} // namespace android
-
-#endif // _UTILS_TOKENIZER_H
diff --git a/include/utils/Trace.h b/include/utils/Trace.h
deleted file mode 100644
index f33ddf6..0000000
--- a/include/utils/Trace.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_TRACE_H
-#define ANDROID_TRACE_H
-
-#include <fcntl.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <cutils/compiler.h>
-#include <utils/threads.h>
-
-// The ATRACE_TAG macro can be defined before including this header to trace
-// using one of the tags defined below. It must be defined to one of the
-// following ATRACE_TAG_* macros. The trace tag is used to filter tracing in
-// userland to avoid some of the runtime cost of tracing when it is not desired.
-//
-// Defining ATRACE_TAG to be ATRACE_TAG_ALWAYS will result in the tracing always
-// being enabled - this should ONLY be done for debug code, as userland tracing
-// has a performance cost even when the trace is not being recorded. Defining
-// ATRACE_TAG to be ATRACE_TAG_NEVER or leaving ATRACE_TAG undefined will result
-// in the tracing always being disabled.
-#define ATRACE_TAG_NEVER 0 // The "never" tag is never enabled.
-#define ATRACE_TAG_ALWAYS (1<<0) // The "always" tag is always enabled.
-#define ATRACE_TAG_GRAPHICS (1<<1)
-#define ATRACE_TAG_LAST (1<<1)
-
-#define ATRACE_TAG_INVALID (~((ATRACE_TAG_LAST - 1) | ATRACE_TAG_LAST))
-
-#ifndef ATRACE_TAG
-#define ATRACE_TAG ATRACE_TAG_NEVER
-#elif ATRACE_TAG > ATRACE_TAG_LAST
-#error ATRACE_TAG must be defined to be one of the tags defined in utils/Trace.h
-#endif
-
-// ATRACE_CALL traces the beginning and end of the current function. To trace
-// the correct start and end times this macro should be the first line of the
-// function body.
-#define ATRACE_CALL() android::ScopedTrace ___tracer(ATRACE_TAG, __FUNCTION__)
-
-// ATRACE_INT traces a named integer value. This can be used to track how the
-// value changes over time in a trace.
-#define ATRACE_INT(name, value) android::Tracer::traceCounter(ATRACE_TAG, name, value)
-
-namespace android {
-
-class Tracer {
-
-public:
-
- static inline void traceCounter(uint64_t tag, const char* name,
- int32_t value) {
- if (!android_atomic_acquire_load(&sIsReady)) {
- init();
- }
- int traceFD = sTraceFD;
- if (CC_UNLIKELY(tagEnabled(tag) && traceFD != -1)) {
- char buf[1024];
- snprintf(buf, 1024, "C|%d|%s|%d", getpid(), name, value);
- write(traceFD, buf, strlen(buf));
- }
- }
-
- static inline void traceBegin(uint64_t tag, const char* name) {
- if (CC_UNLIKELY(!android_atomic_acquire_load(&sIsReady))) {
- init();
- }
- int traceFD = sTraceFD;
- if (CC_UNLIKELY(tagEnabled(tag) && (traceFD != -1))) {
- char buf[1024];
- size_t len = snprintf(buf, 1024, "B|%d|%s", getpid(), name);
- write(traceFD, buf, len);
- }
- }
-
- static inline void traceEnd(uint64_t tag) {
- if (CC_UNLIKELY(!android_atomic_acquire_load(&sIsReady))) {
- init();
- }
- int traceFD = sTraceFD;
- if (CC_UNLIKELY(tagEnabled(tag) && (traceFD != -1))) {
- char buf = 'E';
- write(traceFD, &buf, 1);
- }
- }
-
-private:
-
- static inline bool tagEnabled(uint64_t tag) {
- return !(tag & ATRACE_TAG_INVALID) && (tag & sEnabledTags);
- }
-
- // init opens the trace marker file for writing and reads the
- // atrace.tags.enableflags system property. It does this only the first
- // time it is run, using sMutex for synchronization.
- static void init();
-
- // sIsReady is a boolean value indicating whether a call to init() has
- // completed in this process. It is initialized to 0 and set to 1 when the
- // first init() call completes. It is set to 1 even if a failure occurred
- // in init (e.g. the trace marker file couldn't be opened).
- //
- // This should be checked by all tracing functions using an atomic acquire
- // load operation before calling init(). This check avoids the need to lock
- // a mutex each time a trace function gets called.
- static volatile int32_t sIsReady;
-
- // sTraceFD is the file descriptor used to write to the kernel's trace
- // buffer. It is initialized to -1 and set to an open file descriptor in
- // init() while a lock on sMutex is held.
- //
- // This should only be used by a trace function after init() has
- // successfully completed.
- static int sTraceFD;
-
- // sEnabledTags is the set of tag bits for which tracing is currently
- // enabled. It is initialized to 0 and set based on the
- // atrace.tags.enableflags system property in init() while a lock on sMutex
- // is held.
- //
- // This should only be used by a trace function after init() has
- // successfully completed.
- static uint64_t sEnabledTags;
-
- // sMutex is used to protect the execution of init().
- static Mutex sMutex;
-};
-
-class ScopedTrace {
-
-public:
- inline ScopedTrace(uint64_t tag, const char* name) :
- mTag(tag) {
- Tracer::traceBegin(mTag, name);
- }
-
- inline ~ScopedTrace() {
- Tracer::traceEnd(mTag);
- }
-
-private:
-
- uint64_t mTag;
-};
-
-}; // namespace android
-
-#endif // ANDROID_TRACE_H
diff --git a/include/utils/TypeHelpers.h b/include/utils/TypeHelpers.h
deleted file mode 100644
index 1f2c2d5..0000000
--- a/include/utils/TypeHelpers.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_TYPE_HELPERS_H
-#define ANDROID_TYPE_HELPERS_H
-
-#include <new>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-/*
- * Types traits
- */
-
-template <typename T> struct trait_trivial_ctor { enum { value = false }; };
-template <typename T> struct trait_trivial_dtor { enum { value = false }; };
-template <typename T> struct trait_trivial_copy { enum { value = false }; };
-template <typename T> struct trait_trivial_move { enum { value = false }; };
-template <typename T> struct trait_pointer { enum { value = false }; };
-template <typename T> struct trait_pointer<T*> { enum { value = true }; };
-
-template <typename TYPE>
-struct traits {
- enum {
- // whether this type is a pointer
- is_pointer = trait_pointer<TYPE>::value,
- // whether this type's constructor is a no-op
- has_trivial_ctor = is_pointer || trait_trivial_ctor<TYPE>::value,
- // whether this type's destructor is a no-op
- has_trivial_dtor = is_pointer || trait_trivial_dtor<TYPE>::value,
- // whether this type type can be copy-constructed with memcpy
- has_trivial_copy = is_pointer || trait_trivial_copy<TYPE>::value,
- // whether this type can be moved with memmove
- has_trivial_move = is_pointer || trait_trivial_move<TYPE>::value
- };
-};
-
-template <typename T, typename U>
-struct aggregate_traits {
- enum {
- is_pointer = false,
- has_trivial_ctor =
- traits<T>::has_trivial_ctor && traits<U>::has_trivial_ctor,
- has_trivial_dtor =
- traits<T>::has_trivial_dtor && traits<U>::has_trivial_dtor,
- has_trivial_copy =
- traits<T>::has_trivial_copy && traits<U>::has_trivial_copy,
- has_trivial_move =
- traits<T>::has_trivial_move && traits<U>::has_trivial_move
- };
-};
-
-#define ANDROID_BASIC_TYPES_TRAITS( T ) \
- template<> struct trait_trivial_ctor< T > { enum { value = true }; }; \
- template<> struct trait_trivial_dtor< T > { enum { value = true }; }; \
- template<> struct trait_trivial_copy< T > { enum { value = true }; }; \
- template<> struct trait_trivial_move< T > { enum { value = true }; };
-
-// ---------------------------------------------------------------------------
-
-/*
- * basic types traits
- */
-
-ANDROID_BASIC_TYPES_TRAITS( void )
-ANDROID_BASIC_TYPES_TRAITS( bool )
-ANDROID_BASIC_TYPES_TRAITS( char )
-ANDROID_BASIC_TYPES_TRAITS( unsigned char )
-ANDROID_BASIC_TYPES_TRAITS( short )
-ANDROID_BASIC_TYPES_TRAITS( unsigned short )
-ANDROID_BASIC_TYPES_TRAITS( int )
-ANDROID_BASIC_TYPES_TRAITS( unsigned int )
-ANDROID_BASIC_TYPES_TRAITS( long )
-ANDROID_BASIC_TYPES_TRAITS( unsigned long )
-ANDROID_BASIC_TYPES_TRAITS( long long )
-ANDROID_BASIC_TYPES_TRAITS( unsigned long long )
-ANDROID_BASIC_TYPES_TRAITS( float )
-ANDROID_BASIC_TYPES_TRAITS( double )
-
-// ---------------------------------------------------------------------------
-
-
-/*
- * compare and order types
- */
-
-template<typename TYPE> inline
-int strictly_order_type(const TYPE& lhs, const TYPE& rhs) {
- return (lhs < rhs) ? 1 : 0;
-}
-
-template<typename TYPE> inline
-int compare_type(const TYPE& lhs, const TYPE& rhs) {
- return strictly_order_type(rhs, lhs) - strictly_order_type(lhs, rhs);
-}
-
-/*
- * create, destroy, copy and move types...
- */
-
-template<typename TYPE> inline
-void construct_type(TYPE* p, size_t n) {
- if (!traits<TYPE>::has_trivial_ctor) {
- while (n--) {
- new(p++) TYPE;
- }
- }
-}
-
-template<typename TYPE> inline
-void destroy_type(TYPE* p, size_t n) {
- if (!traits<TYPE>::has_trivial_dtor) {
- while (n--) {
- p->~TYPE();
- p++;
- }
- }
-}
-
-template<typename TYPE> inline
-void copy_type(TYPE* d, const TYPE* s, size_t n) {
- if (!traits<TYPE>::has_trivial_copy) {
- while (n--) {
- new(d) TYPE(*s);
- d++, s++;
- }
- } else {
- memcpy(d,s,n*sizeof(TYPE));
- }
-}
-
-template<typename TYPE> inline
-void splat_type(TYPE* where, const TYPE* what, size_t n) {
- if (!traits<TYPE>::has_trivial_copy) {
- while (n--) {
- new(where) TYPE(*what);
- where++;
- }
- } else {
- while (n--) {
- *where++ = *what;
- }
- }
-}
-
-template<typename TYPE> inline
-void move_forward_type(TYPE* d, const TYPE* s, size_t n = 1) {
- if ((traits<TYPE>::has_trivial_dtor && traits<TYPE>::has_trivial_copy)
- || traits<TYPE>::has_trivial_move)
- {
- memmove(d,s,n*sizeof(TYPE));
- } else {
- d += n;
- s += n;
- while (n--) {
- --d, --s;
- if (!traits<TYPE>::has_trivial_copy) {
- new(d) TYPE(*s);
- } else {
- *d = *s;
- }
- if (!traits<TYPE>::has_trivial_dtor) {
- s->~TYPE();
- }
- }
- }
-}
-
-template<typename TYPE> inline
-void move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) {
- if ((traits<TYPE>::has_trivial_dtor && traits<TYPE>::has_trivial_copy)
- || traits<TYPE>::has_trivial_move)
- {
- memmove(d,s,n*sizeof(TYPE));
- } else {
- while (n--) {
- if (!traits<TYPE>::has_trivial_copy) {
- new(d) TYPE(*s);
- } else {
- *d = *s;
- }
- if (!traits<TYPE>::has_trivial_dtor) {
- s->~TYPE();
- }
- d++, s++;
- }
- }
-}
-
-// ---------------------------------------------------------------------------
-
-/*
- * a key/value pair
- */
-
-template <typename KEY, typename VALUE>
-struct key_value_pair_t {
- typedef KEY key_t;
- typedef VALUE value_t;
-
- KEY key;
- VALUE value;
- key_value_pair_t() { }
- key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { }
- key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { }
- key_value_pair_t(const KEY& k) : key(k) { }
- inline bool operator < (const key_value_pair_t& o) const {
- return strictly_order_type(key, o.key);
- }
- inline const KEY& getKey() const {
- return key;
- }
- inline const VALUE& getValue() const {
- return value;
- }
-};
-
-template <typename K, typename V>
-struct trait_trivial_ctor< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_ctor }; };
-template <typename K, typename V>
-struct trait_trivial_dtor< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_dtor }; };
-template <typename K, typename V>
-struct trait_trivial_copy< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_copy }; };
-template <typename K, typename V>
-struct trait_trivial_move< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_move }; };
-
-// ---------------------------------------------------------------------------
-
-/*
- * Hash codes.
- */
-typedef uint32_t hash_t;
-
-template <typename TKey>
-hash_t hash_type(const TKey& key);
-
-/* Built-in hash code specializations.
- * Assumes pointers are 32bit. */
-#define ANDROID_INT32_HASH(T) \
- template <> inline hash_t hash_type(const T& value) { return hash_t(value); }
-#define ANDROID_INT64_HASH(T) \
- template <> inline hash_t hash_type(const T& value) { \
- return hash_t((value >> 32) ^ value); }
-#define ANDROID_REINTERPRET_HASH(T, R) \
- template <> inline hash_t hash_type(const T& value) { \
- return hash_type(*reinterpret_cast<const R*>(&value)); }
-
-ANDROID_INT32_HASH(bool)
-ANDROID_INT32_HASH(int8_t)
-ANDROID_INT32_HASH(uint8_t)
-ANDROID_INT32_HASH(int16_t)
-ANDROID_INT32_HASH(uint16_t)
-ANDROID_INT32_HASH(int32_t)
-ANDROID_INT32_HASH(uint32_t)
-ANDROID_INT64_HASH(int64_t)
-ANDROID_INT64_HASH(uint64_t)
-ANDROID_REINTERPRET_HASH(float, uint32_t)
-ANDROID_REINTERPRET_HASH(double, uint64_t)
-
-template <typename T> inline hash_t hash_type(const T*& value) {
- return hash_type(uintptr_t(value));
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_TYPE_HELPERS_H
diff --git a/include/utils/Unicode.h b/include/utils/Unicode.h
deleted file mode 100644
index 9273533..0000000
--- a/include/utils/Unicode.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_UNICODE_H
-#define ANDROID_UNICODE_H
-
-#include <sys/types.h>
-#include <stdint.h>
-
-extern "C" {
-
-typedef uint32_t char32_t;
-typedef uint16_t char16_t;
-
-// Standard string functions on char16_t strings.
-int strcmp16(const char16_t *, const char16_t *);
-int strncmp16(const char16_t *s1, const char16_t *s2, size_t n);
-size_t strlen16(const char16_t *);
-size_t strnlen16(const char16_t *, size_t);
-char16_t *strcpy16(char16_t *, const char16_t *);
-char16_t *strncpy16(char16_t *, const char16_t *, size_t);
-
-// Version of comparison that supports embedded nulls.
-// This is different than strncmp() because we don't stop
-// at a nul character and consider the strings to be different
-// if the lengths are different (thus we need to supply the
-// lengths of both strings). This can also be used when
-// your string is not nul-terminated as it will have the
-// equivalent result as strcmp16 (unlike strncmp16).
-int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2);
-
-// Version of strzcmp16 for comparing strings in different endianness.
-int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2);
-
-// Standard string functions on char32_t strings.
-size_t strlen32(const char32_t *);
-size_t strnlen32(const char32_t *, size_t);
-
-/**
- * Measure the length of a UTF-32 string in UTF-8. If the string is invalid
- * such as containing a surrogate character, -1 will be returned.
- */
-ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len);
-
-/**
- * Stores a UTF-8 string converted from "src" in "dst", if "dst_length" is not
- * large enough to store the string, the part of the "src" string is stored
- * into "dst" as much as possible. See the examples for more detail.
- * Returns the size actually used for storing the string.
- * dst" is not null-terminated when dst_len is fully used (like strncpy).
- *
- * Example 1
- * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
- * "src_len" == 2
- * "dst_len" >= 7
- * ->
- * Returned value == 6
- * "dst" becomes \xE3\x81\x82\xE3\x81\x84\0
- * (note that "dst" is null-terminated)
- *
- * Example 2
- * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
- * "src_len" == 2
- * "dst_len" == 5
- * ->
- * Returned value == 3
- * "dst" becomes \xE3\x81\x82\0
- * (note that "dst" is null-terminated, but \u3044 is not stored in "dst"
- * since "dst" does not have enough size to store the character)
- *
- * Example 3
- * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
- * "src_len" == 2
- * "dst_len" == 6
- * ->
- * Returned value == 6
- * "dst" becomes \xE3\x81\x82\xE3\x81\x84
- * (note that "dst" is NOT null-terminated, like strncpy)
- */
-void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst);
-
-/**
- * Returns the unicode value at "index".
- * Returns -1 when the index is invalid (equals to or more than "src_len").
- * If returned value is positive, it is able to be converted to char32_t, which
- * is unsigned. Then, if "next_index" is not NULL, the next index to be used is
- * stored in "next_index". "next_index" can be NULL.
- */
-int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index);
-
-
-/**
- * Returns the UTF-8 length of UTF-16 string "src".
- */
-ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len);
-
-/**
- * Converts a UTF-16 string to UTF-8. The destination buffer must be large
- * enough to fit the UTF-16 as measured by utf16_to_utf8_length with an added
- * NULL terminator.
- */
-void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst);
-
-/**
- * Returns the length of "src" when "src" is valid UTF-8 string.
- * Returns 0 if src is NULL or 0-length string. Returns -1 when the source
- * is an invalid string.
- *
- * This function should be used to determine whether "src" is valid UTF-8
- * characters with valid unicode codepoints. "src" must be null-terminated.
- *
- * If you are going to use other utf8_to_... functions defined in this header
- * with string which may not be valid UTF-8 with valid codepoint (form 0 to
- * 0x10FFFF), you should use this function before calling others, since the
- * other functions do not check whether the string is valid UTF-8 or not.
- *
- * If you do not care whether "src" is valid UTF-8 or not, you should use
- * strlen() as usual, which should be much faster.
- */
-ssize_t utf8_length(const char *src);
-
-/**
- * Measure the length of a UTF-32 string.
- */
-size_t utf8_to_utf32_length(const char *src, size_t src_len);
-
-/**
- * Stores a UTF-32 string converted from "src" in "dst". "dst" must be large
- * enough to store the entire converted string as measured by
- * utf8_to_utf32_length plus space for a NULL terminator.
- */
-void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst);
-
-/**
- * Returns the UTF-16 length of UTF-8 string "src".
- */
-ssize_t utf8_to_utf16_length(const uint8_t* src, size_t srcLen);
-
-/**
- * Convert UTF-8 to UTF-16 including surrogate pairs.
- * Returns a pointer to the end of the string (where a null terminator might go
- * if you wanted to add one).
- */
-char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* src, size_t srcLen, char16_t* dst);
-
-/**
- * Convert UTF-8 to UTF-16 including surrogate pairs. The destination buffer
- * must be large enough to hold the result as measured by utf8_to_utf16_length
- * plus an added NULL terminator.
- */
-void utf8_to_utf16(const uint8_t* src, size_t srcLen, char16_t* dst);
-
-}
-
-#endif
diff --git a/include/utils/Vector.h b/include/utils/Vector.h
deleted file mode 100644
index 5b5296b..0000000
--- a/include/utils/Vector.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_VECTOR_H
-#define ANDROID_VECTOR_H
-
-#include <new>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Log.h>
-#include <utils/VectorImpl.h>
-#include <utils/TypeHelpers.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-template <typename TYPE>
-class SortedVector;
-
-/*!
- * The main templated vector class ensuring type safety
- * while making use of VectorImpl.
- * This is the class users want to use.
- */
-
-template <class TYPE>
-class Vector : private VectorImpl
-{
-public:
- typedef TYPE value_type;
-
- /*!
- * Constructors and destructors
- */
-
- Vector();
- Vector(const Vector<TYPE>& rhs);
- explicit Vector(const SortedVector<TYPE>& rhs);
- virtual ~Vector();
-
- /*! copy operator */
- const Vector<TYPE>& operator = (const Vector<TYPE>& rhs) const;
- Vector<TYPE>& operator = (const Vector<TYPE>& rhs);
-
- const Vector<TYPE>& operator = (const SortedVector<TYPE>& rhs) const;
- Vector<TYPE>& operator = (const SortedVector<TYPE>& rhs);
-
- /*
- * empty the vector
- */
-
- inline void clear() { VectorImpl::clear(); }
-
- /*!
- * vector stats
- */
-
- //! returns number of items in the vector
- inline size_t size() const { return VectorImpl::size(); }
- //! returns wether or not the vector is empty
- inline bool isEmpty() const { return VectorImpl::isEmpty(); }
- //! returns how many items can be stored without reallocating the backing store
- inline size_t capacity() const { return VectorImpl::capacity(); }
- //! setst the capacity. capacity can never be reduced less than size()
- inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); }
-
- /*!
- * C-style array access
- */
-
- //! read-only C-style access
- inline const TYPE* array() const;
- //! read-write C-style access
- TYPE* editArray();
-
- /*!
- * accessors
- */
-
- //! read-only access to an item at a given index
- inline const TYPE& operator [] (size_t index) const;
- //! alternate name for operator []
- inline const TYPE& itemAt(size_t index) const;
- //! stack-usage of the vector. returns the top of the stack (last element)
- const TYPE& top() const;
- //! same as operator [], but allows to access the vector backward (from the end) with a negative index
- const TYPE& mirrorItemAt(ssize_t index) const;
-
- /*!
- * modifing the array
- */
-
- //! copy-on write support, grants write access to an item
- TYPE& editItemAt(size_t index);
- //! grants right acces to the top of the stack (last element)
- TYPE& editTop();
-
- /*!
- * append/insert another vector
- */
-
- //! insert another vector at a given index
- ssize_t insertVectorAt(const Vector<TYPE>& vector, size_t index);
-
- //! append another vector at the end of this one
- ssize_t appendVector(const Vector<TYPE>& vector);
-
-
- //! insert an array at a given index
- ssize_t insertArrayAt(const TYPE* array, size_t index, size_t length);
-
- //! append an array at the end of this vector
- ssize_t appendArray(const TYPE* array, size_t length);
-
- /*!
- * add/insert/replace items
- */
-
- //! insert one or several items initialized with their default constructor
- inline ssize_t insertAt(size_t index, size_t numItems = 1);
- //! insert one or several items initialized from a prototype item
- ssize_t insertAt(const TYPE& prototype_item, size_t index, size_t numItems = 1);
- //! pop the top of the stack (removes the last element). No-op if the stack's empty
- inline void pop();
- //! pushes an item initialized with its default constructor
- inline void push();
- //! pushes an item on the top of the stack
- void push(const TYPE& item);
- //! same as push() but returns the index the item was added at (or an error)
- inline ssize_t add();
- //! same as push() but returns the index the item was added at (or an error)
- ssize_t add(const TYPE& item);
- //! replace an item with a new one initialized with its default constructor
- inline ssize_t replaceAt(size_t index);
- //! replace an item with a new one
- ssize_t replaceAt(const TYPE& item, size_t index);
-
- /*!
- * remove items
- */
-
- //! remove several items
- inline ssize_t removeItemsAt(size_t index, size_t count = 1);
- //! remove one item
- inline ssize_t removeAt(size_t index) { return removeItemsAt(index); }
-
- /*!
- * sort (stable) the array
- */
-
- typedef int (*compar_t)(const TYPE* lhs, const TYPE* rhs);
- typedef int (*compar_r_t)(const TYPE* lhs, const TYPE* rhs, void* state);
-
- inline status_t sort(compar_t cmp);
- inline status_t sort(compar_r_t cmp, void* state);
-
- // for debugging only
- inline size_t getItemSize() const { return itemSize(); }
-
-
- /*
- * these inlines add some level of compatibility with STL. eventually
- * we should probably turn things around.
- */
- typedef TYPE* iterator;
- typedef TYPE const* const_iterator;
-
- inline iterator begin() { return editArray(); }
- inline iterator end() { return editArray() + size(); }
- inline const_iterator begin() const { return array(); }
- inline const_iterator end() const { return array() + size(); }
- inline void reserve(size_t n) { setCapacity(n); }
- inline bool empty() const{ return isEmpty(); }
- inline void push_back(const TYPE& item) { insertAt(item, size(), 1); }
- inline void push_front(const TYPE& item) { insertAt(item, 0, 1); }
- inline iterator erase(iterator pos) {
- return begin() + removeItemsAt(pos-array());
- }
-
-protected:
- virtual void do_construct(void* storage, size_t num) const;
- virtual void do_destroy(void* storage, size_t num) const;
- virtual void do_copy(void* dest, const void* from, size_t num) const;
- virtual void do_splat(void* dest, const void* item, size_t num) const;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const;
-};
-
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts from here...
-// ---------------------------------------------------------------------------
-
-template<class TYPE> inline
-Vector<TYPE>::Vector()
- : VectorImpl(sizeof(TYPE),
- ((traits<TYPE>::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0)
- |(traits<TYPE>::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0)
- |(traits<TYPE>::has_trivial_copy ? HAS_TRIVIAL_COPY : 0))
- )
-{
-}
-
-template<class TYPE> inline
-Vector<TYPE>::Vector(const Vector<TYPE>& rhs)
- : VectorImpl(rhs) {
-}
-
-template<class TYPE> inline
-Vector<TYPE>::Vector(const SortedVector<TYPE>& rhs)
- : VectorImpl(static_cast<const VectorImpl&>(rhs)) {
-}
-
-template<class TYPE> inline
-Vector<TYPE>::~Vector() {
- finish_vector();
-}
-
-template<class TYPE> inline
-Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) {
- VectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const {
- VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
- return *this;
-}
-
-template<class TYPE> inline
-Vector<TYPE>& Vector<TYPE>::operator = (const SortedVector<TYPE>& rhs) {
- VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
- return *this;
-}
-
-template<class TYPE> inline
-const Vector<TYPE>& Vector<TYPE>::operator = (const SortedVector<TYPE>& rhs) const {
- VectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const TYPE* Vector<TYPE>::array() const {
- return static_cast<const TYPE *>(arrayImpl());
-}
-
-template<class TYPE> inline
-TYPE* Vector<TYPE>::editArray() {
- return static_cast<TYPE *>(editArrayImpl());
-}
-
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::operator[](size_t index) const {
- LOG_FATAL_IF( index>=size(),
- "itemAt: index %d is past size %d", (int)index, (int)size() );
- return *(array() + index);
-}
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::itemAt(size_t index) const {
- return operator[](index);
-}
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::mirrorItemAt(ssize_t index) const {
- LOG_FATAL_IF( (index>0 ? index : -index)>=size(),
- "mirrorItemAt: index %d is past size %d",
- (int)index, (int)size() );
- return *(array() + ((index<0) ? (size()-index) : index));
-}
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::top() const {
- return *(array() + size() - 1);
-}
-
-template<class TYPE> inline
-TYPE& Vector<TYPE>::editItemAt(size_t index) {
- return *( static_cast<TYPE *>(editItemLocation(index)) );
-}
-
-template<class TYPE> inline
-TYPE& Vector<TYPE>::editTop() {
- return *( static_cast<TYPE *>(editItemLocation(size()-1)) );
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertVectorAt(const Vector<TYPE>& vector, size_t index) {
- return VectorImpl::insertVectorAt(reinterpret_cast<const VectorImpl&>(vector), index);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::appendVector(const Vector<TYPE>& vector) {
- return VectorImpl::appendVector(reinterpret_cast<const VectorImpl&>(vector));
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertArrayAt(const TYPE* array, size_t index, size_t length) {
- return VectorImpl::insertArrayAt(array, index, length);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::appendArray(const TYPE* array, size_t length) {
- return VectorImpl::appendArray(array, length);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertAt(const TYPE& item, size_t index, size_t numItems) {
- return VectorImpl::insertAt(&item, index, numItems);
-}
-
-template<class TYPE> inline
-void Vector<TYPE>::push(const TYPE& item) {
- return VectorImpl::push(&item);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::add(const TYPE& item) {
- return VectorImpl::add(&item);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::replaceAt(const TYPE& item, size_t index) {
- return VectorImpl::replaceAt(&item, index);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertAt(size_t index, size_t numItems) {
- return VectorImpl::insertAt(index, numItems);
-}
-
-template<class TYPE> inline
-void Vector<TYPE>::pop() {
- VectorImpl::pop();
-}
-
-template<class TYPE> inline
-void Vector<TYPE>::push() {
- VectorImpl::push();
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::add() {
- return VectorImpl::add();
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::replaceAt(size_t index) {
- return VectorImpl::replaceAt(index);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::removeItemsAt(size_t index, size_t count) {
- return VectorImpl::removeItemsAt(index, count);
-}
-
-template<class TYPE> inline
-status_t Vector<TYPE>::sort(Vector<TYPE>::compar_t cmp) {
- return VectorImpl::sort((VectorImpl::compar_t)cmp);
-}
-
-template<class TYPE> inline
-status_t Vector<TYPE>::sort(Vector<TYPE>::compar_r_t cmp, void* state) {
- return VectorImpl::sort((VectorImpl::compar_r_t)cmp, state);
-}
-
-// ---------------------------------------------------------------------------
-
-template<class TYPE>
-void Vector<TYPE>::do_construct(void* storage, size_t num) const {
- construct_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_destroy(void* storage, size_t num) const {
- destroy_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_copy(void* dest, const void* from, size_t num) const {
- copy_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_splat(void* dest, const void* item, size_t num) const {
- splat_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(item), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_move_forward(void* dest, const void* from, size_t num) const {
- move_forward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_move_backward(void* dest, const void* from, size_t num) const {
- move_backward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_VECTOR_H
diff --git a/include/utils/VectorImpl.h b/include/utils/VectorImpl.h
deleted file mode 100644
index c4ec2ff..0000000
--- a/include/utils/VectorImpl.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_VECTOR_IMPL_H
-#define ANDROID_VECTOR_IMPL_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts in here...
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-/*!
- * Implementation of the guts of the vector<> class
- * this ensures backward binary compatibility and
- * reduces code size.
- * For performance reasons, we expose mStorage and mCount
- * so these fields are set in stone.
- *
- */
-
-class VectorImpl
-{
-public:
- enum { // flags passed to the ctor
- HAS_TRIVIAL_CTOR = 0x00000001,
- HAS_TRIVIAL_DTOR = 0x00000002,
- HAS_TRIVIAL_COPY = 0x00000004,
- };
-
- VectorImpl(size_t itemSize, uint32_t flags);
- VectorImpl(const VectorImpl& rhs);
- virtual ~VectorImpl();
-
- /*! must be called from subclasses destructor */
- void finish_vector();
-
- VectorImpl& operator = (const VectorImpl& rhs);
-
- /*! C-style array access */
- inline const void* arrayImpl() const { return mStorage; }
- void* editArrayImpl();
-
- /*! vector stats */
- inline size_t size() const { return mCount; }
- inline bool isEmpty() const { return mCount == 0; }
- size_t capacity() const;
- ssize_t setCapacity(size_t size);
-
- /*! append/insert another vector or array */
- ssize_t insertVectorAt(const VectorImpl& vector, size_t index);
- ssize_t appendVector(const VectorImpl& vector);
- ssize_t insertArrayAt(const void* array, size_t index, size_t length);
- ssize_t appendArray(const void* array, size_t length);
-
- /*! add/insert/replace items */
- ssize_t insertAt(size_t where, size_t numItems = 1);
- ssize_t insertAt(const void* item, size_t where, size_t numItems = 1);
- void pop();
- void push();
- void push(const void* item);
- ssize_t add();
- ssize_t add(const void* item);
- ssize_t replaceAt(size_t index);
- ssize_t replaceAt(const void* item, size_t index);
-
- /*! remove items */
- ssize_t removeItemsAt(size_t index, size_t count = 1);
- void clear();
-
- const void* itemLocation(size_t index) const;
- void* editItemLocation(size_t index);
-
- typedef int (*compar_t)(const void* lhs, const void* rhs);
- typedef int (*compar_r_t)(const void* lhs, const void* rhs, void* state);
- status_t sort(compar_t cmp);
- status_t sort(compar_r_t cmp, void* state);
-
-protected:
- size_t itemSize() const;
- void release_storage();
-
- virtual void do_construct(void* storage, size_t num) const = 0;
- virtual void do_destroy(void* storage, size_t num) const = 0;
- virtual void do_copy(void* dest, const void* from, size_t num) const = 0;
- virtual void do_splat(void* dest, const void* item, size_t num) const = 0;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0;
-
- // take care of FBC...
- virtual void reservedVectorImpl1();
- virtual void reservedVectorImpl2();
- virtual void reservedVectorImpl3();
- virtual void reservedVectorImpl4();
- virtual void reservedVectorImpl5();
- virtual void reservedVectorImpl6();
- virtual void reservedVectorImpl7();
- virtual void reservedVectorImpl8();
-
-private:
- void* _grow(size_t where, size_t amount);
- void _shrink(size_t where, size_t amount);
-
- inline void _do_construct(void* storage, size_t num) const;
- inline void _do_destroy(void* storage, size_t num) const;
- inline void _do_copy(void* dest, const void* from, size_t num) const;
- inline void _do_splat(void* dest, const void* item, size_t num) const;
- inline void _do_move_forward(void* dest, const void* from, size_t num) const;
- inline void _do_move_backward(void* dest, const void* from, size_t num) const;
-
- // These 2 fields are exposed in the inlines below,
- // so they're set in stone.
- void * mStorage; // base address of the vector
- size_t mCount; // number of items
-
- const uint32_t mFlags;
- const size_t mItemSize;
-};
-
-
-
-class SortedVectorImpl : public VectorImpl
-{
-public:
- SortedVectorImpl(size_t itemSize, uint32_t flags);
- SortedVectorImpl(const VectorImpl& rhs);
- virtual ~SortedVectorImpl();
-
- SortedVectorImpl& operator = (const SortedVectorImpl& rhs);
-
- //! finds the index of an item
- ssize_t indexOf(const void* item) const;
-
- //! finds where this item should be inserted
- size_t orderOf(const void* item) const;
-
- //! add an item in the right place (or replaces it if there is one)
- ssize_t add(const void* item);
-
- //! merges a vector into this one
- ssize_t merge(const VectorImpl& vector);
- ssize_t merge(const SortedVectorImpl& vector);
-
- //! removes an item
- ssize_t remove(const void* item);
-
-protected:
- virtual int do_compare(const void* lhs, const void* rhs) const = 0;
-
- // take care of FBC...
- virtual void reservedSortedVectorImpl1();
- virtual void reservedSortedVectorImpl2();
- virtual void reservedSortedVectorImpl3();
- virtual void reservedSortedVectorImpl4();
- virtual void reservedSortedVectorImpl5();
- virtual void reservedSortedVectorImpl6();
- virtual void reservedSortedVectorImpl7();
- virtual void reservedSortedVectorImpl8();
-
-private:
- ssize_t _indexOrderOf(const void* item, size_t* order = 0) const;
-
- // these are made private, because they can't be used on a SortedVector
- // (they don't have an implementation either)
- ssize_t add();
- void pop();
- void push();
- void push(const void* item);
- ssize_t insertVectorAt(const VectorImpl& vector, size_t index);
- ssize_t appendVector(const VectorImpl& vector);
- ssize_t insertArrayAt(const void* array, size_t index, size_t length);
- ssize_t appendArray(const void* array, size_t length);
- ssize_t insertAt(size_t where, size_t numItems = 1);
- ssize_t insertAt(const void* item, size_t where, size_t numItems = 1);
- ssize_t replaceAt(size_t index);
- ssize_t replaceAt(const void* item, size_t index);
-};
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_VECTOR_IMPL_H
diff --git a/include/utils/ashmem.h b/include/utils/ashmem.h
deleted file mode 100644
index 0854775..0000000
--- a/include/utils/ashmem.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* utils/ashmem.h
- **
- ** Copyright 2008 The Android Open Source Project
- **
- ** This file is dual licensed. It may be redistributed and/or modified
- ** under the terms of the Apache 2.0 License OR version 2 of the GNU
- ** General Public License.
- */
-
-#ifndef _UTILS_ASHMEM_H
-#define _UTILS_ASHMEM_H
-
-#include <linux/limits.h>
-#include <linux/ioctl.h>
-
-#define ASHMEM_NAME_LEN 256
-
-#define ASHMEM_NAME_DEF "dev/ashmem"
-
-/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
-#define ASHMEM_NOT_REAPED 0
-#define ASHMEM_WAS_REAPED 1
-
-/* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */
-#define ASHMEM_NOW_UNPINNED 0
-#define ASHMEM_NOW_PINNED 1
-
-#define __ASHMEMIOC 0x77
-
-#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
-#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
-#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
-#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
-#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
-#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
-#define ASHMEM_PIN _IO(__ASHMEMIOC, 7)
-#define ASHMEM_UNPIN _IO(__ASHMEMIOC, 8)
-#define ASHMEM_ISPINNED _IO(__ASHMEMIOC, 9)
-#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
-
-#endif /* _UTILS_ASHMEM_H */
diff --git a/include/utils/misc.h b/include/utils/misc.h
deleted file mode 100644
index 23f2a4c..0000000
--- a/include/utils/misc.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Handy utility functions and portability code.
-//
-#ifndef _LIBS_UTILS_MISC_H
-#define _LIBS_UTILS_MISC_H
-
-#include <sys/time.h>
-#include <utils/Endian.h>
-
-namespace android {
-
-/* get #of elements in a static array */
-#ifndef NELEM
-# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
-#endif
-
-/*
- * Make a copy of the string, using "new[]" instead of "malloc". Free the
- * string with delete[].
- *
- * Returns NULL if "str" is NULL.
- */
-char* strdupNew(const char* str);
-
-/*
- * Concatenate an argument vector into a single string. If argc is >= 0
- * it will be used; if it's < 0 then the last element in the arg vector
- * must be NULL.
- *
- * This inserts a space between each argument.
- *
- * This does not automatically add double quotes around arguments with
- * spaces in them. This practice is necessary for Win32, because Win32's
- * CreateProcess call is stupid.
- *
- * The caller should delete[] the returned string.
- */
-char* concatArgv(int argc, const char* const argv[]);
-
-/*
- * Count up the number of arguments in "argv". The count does not include
- * the final NULL entry.
- */
-int countArgv(const char* const argv[]);
-
-/*
- * Some utility functions for working with files. These could be made
- * part of a "File" class.
- */
-typedef enum FileType {
- kFileTypeUnknown = 0,
- kFileTypeNonexistent, // i.e. ENOENT
- kFileTypeRegular,
- kFileTypeDirectory,
- kFileTypeCharDev,
- kFileTypeBlockDev,
- kFileTypeFifo,
- kFileTypeSymlink,
- kFileTypeSocket,
-} FileType;
-/* get the file's type; follows symlinks */
-FileType getFileType(const char* fileName);
-/* get the file's modification date; returns -1 w/errno set on failure */
-time_t getFileModDate(const char* fileName);
-
-/*
- * Round up to the nearest power of 2. Handy for hash tables.
- */
-unsigned int roundUpPower2(unsigned int val);
-
-void strreverse(char* begin, char* end);
-void k_itoa(int value, char* str, int base);
-char* itoa(int val, int base);
-
-}; // namespace android
-
-#endif // _LIBS_UTILS_MISC_H
diff --git a/include/utils/threads.h b/include/utils/threads.h
deleted file mode 100644
index 9de3382..0000000
--- a/include/utils/threads.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef _LIBS_UTILS_THREADS_H
-#define _LIBS_UTILS_THREADS_H
-
-/*
- * Please, DO NOT USE!
- *
- * This file is here only for legacy reasons. Instead, include directly
- * the headers you need below.
- *
- */
-
-#include <utils/AndroidThreads.h>
-
-#ifdef __cplusplus
-#include <utils/Condition.h>
-#include <utils/Errors.h>
-#include <utils/Mutex.h>
-#include <utils/RWLock.h>
-#include <utils/Thread.h>
-#endif
-
-#endif // _LIBS_UTILS_THREADS_H
diff --git a/libs/androidfw/tests/InputChannel_test.cpp b/libs/androidfw/tests/InputChannel_test.cpp
index 0e5d19d..7fff8af 100644
--- a/libs/androidfw/tests/InputChannel_test.cpp
+++ b/libs/androidfw/tests/InputChannel_test.cpp
@@ -23,7 +23,7 @@
#include <time.h>
#include <errno.h>
-#include "../../utils/tests/TestHelpers.h"
+#include "TestHelpers.h"
namespace android {
diff --git a/libs/androidfw/tests/InputPublisherAndConsumer_test.cpp b/libs/androidfw/tests/InputPublisherAndConsumer_test.cpp
index bb45247..442b62f 100644
--- a/libs/androidfw/tests/InputPublisherAndConsumer_test.cpp
+++ b/libs/androidfw/tests/InputPublisherAndConsumer_test.cpp
@@ -23,7 +23,7 @@
#include <sys/mman.h>
#include <cutils/ashmem.h>
-#include "../../utils/tests/TestHelpers.h"
+#include "TestHelpers.h"
namespace android {
diff --git a/libs/utils/tests/TestHelpers.h b/libs/androidfw/tests/TestHelpers.h
similarity index 100%
rename from libs/utils/tests/TestHelpers.h
rename to libs/androidfw/tests/TestHelpers.h
diff --git a/libs/binder/Android.mk b/libs/binder/Android.mk
deleted file mode 100644
index d449298..0000000
--- a/libs/binder/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# 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.
-
-# we have the common sources, plus some device-specific stuff
-sources := \
- Binder.cpp \
- BpBinder.cpp \
- IInterface.cpp \
- IMemory.cpp \
- IPCThreadState.cpp \
- IPermissionController.cpp \
- IServiceManager.cpp \
- MemoryDealer.cpp \
- MemoryBase.cpp \
- MemoryHeapBase.cpp \
- Parcel.cpp \
- PermissionCache.cpp \
- ProcessState.cpp \
- Static.cpp
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_LDLIBS += -lpthread
-LOCAL_MODULE := libbinder
-LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
-LOCAL_SRC_FILES := $(sources)
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_LDLIBS += -lpthread
-LOCAL_MODULE := libbinder
-LOCAL_SRC_FILES := $(sources)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
deleted file mode 100644
index e20d8a3..0000000
--- a/libs/binder/Binder.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <binder/Binder.h>
-
-#include <utils/Atomic.h>
-#include <binder/BpBinder.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-
-#include <stdio.h>
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-IBinder::IBinder()
- : RefBase()
-{
-}
-
-IBinder::~IBinder()
-{
-}
-
-// ---------------------------------------------------------------------------
-
-sp<IInterface> IBinder::queryLocalInterface(const String16& descriptor)
-{
- return NULL;
-}
-
-BBinder* IBinder::localBinder()
-{
- return NULL;
-}
-
-BpBinder* IBinder::remoteBinder()
-{
- return NULL;
-}
-
-bool IBinder::checkSubclass(const void* /*subclassID*/) const
-{
- return false;
-}
-
-// ---------------------------------------------------------------------------
-
-class BBinder::Extras
-{
-public:
- Mutex mLock;
- BpBinder::ObjectManager mObjects;
-};
-
-// ---------------------------------------------------------------------------
-
-BBinder::BBinder()
- : mExtras(NULL)
-{
-}
-
-bool BBinder::isBinderAlive() const
-{
- return true;
-}
-
-status_t BBinder::pingBinder()
-{
- return NO_ERROR;
-}
-
-const String16& BBinder::getInterfaceDescriptor() const
-{
- // This is a local static rather than a global static,
- // to avoid static initializer ordering issues.
- static String16 sEmptyDescriptor;
- ALOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this);
- return sEmptyDescriptor;
-}
-
-status_t BBinder::transact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- data.setDataPosition(0);
-
- status_t err = NO_ERROR;
- switch (code) {
- case PING_TRANSACTION:
- reply->writeInt32(pingBinder());
- break;
- default:
- err = onTransact(code, data, reply, flags);
- break;
- }
-
- if (reply != NULL) {
- reply->setDataPosition(0);
- }
-
- return err;
-}
-
-status_t BBinder::linkToDeath(
- const sp<DeathRecipient>& recipient, void* cookie, uint32_t flags)
-{
- return INVALID_OPERATION;
-}
-
-status_t BBinder::unlinkToDeath(
- const wp<DeathRecipient>& recipient, void* cookie, uint32_t flags,
- wp<DeathRecipient>* outRecipient)
-{
- return INVALID_OPERATION;
-}
-
-status_t BBinder::dump(int fd, const Vector<String16>& args)
-{
- return NO_ERROR;
-}
-
-void BBinder::attachObject(
- const void* objectID, void* object, void* cleanupCookie,
- object_cleanup_func func)
-{
- Extras* e = mExtras;
-
- if (!e) {
- e = new Extras;
- if (android_atomic_cmpxchg(0, reinterpret_cast<int32_t>(e),
- reinterpret_cast<volatile int32_t*>(&mExtras)) != 0) {
- delete e;
- e = mExtras;
- }
- if (e == 0) return; // out of memory
- }
-
- AutoMutex _l(e->mLock);
- e->mObjects.attach(objectID, object, cleanupCookie, func);
-}
-
-void* BBinder::findObject(const void* objectID) const
-{
- Extras* e = mExtras;
- if (!e) return NULL;
-
- AutoMutex _l(e->mLock);
- return e->mObjects.find(objectID);
-}
-
-void BBinder::detachObject(const void* objectID)
-{
- Extras* e = mExtras;
- if (!e) return;
-
- AutoMutex _l(e->mLock);
- e->mObjects.detach(objectID);
-}
-
-BBinder* BBinder::localBinder()
-{
- return this;
-}
-
-BBinder::~BBinder()
-{
- if (mExtras) delete mExtras;
-}
-
-
-status_t BBinder::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch (code) {
- case INTERFACE_TRANSACTION:
- reply->writeString16(getInterfaceDescriptor());
- return NO_ERROR;
-
- case DUMP_TRANSACTION: {
- int fd = data.readFileDescriptor();
- int argc = data.readInt32();
- Vector<String16> args;
- for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
- args.add(data.readString16());
- }
- return dump(fd, args);
- }
- default:
- return UNKNOWN_TRANSACTION;
- }
-}
-
-// ---------------------------------------------------------------------------
-
-enum {
- // This is used to transfer ownership of the remote binder from
- // the BpRefBase object holding it (when it is constructed), to the
- // owner of the BpRefBase object when it first acquires that BpRefBase.
- kRemoteAcquired = 0x00000001
-};
-
-BpRefBase::BpRefBase(const sp<IBinder>& o)
- : mRemote(o.get()), mRefs(NULL), mState(0)
-{
- extendObjectLifetime(OBJECT_LIFETIME_WEAK);
-
- if (mRemote) {
- mRemote->incStrong(this); // Removed on first IncStrong().
- mRefs = mRemote->createWeak(this); // Held for our entire lifetime.
- }
-}
-
-BpRefBase::~BpRefBase()
-{
- if (mRemote) {
- if (!(mState&kRemoteAcquired)) {
- mRemote->decStrong(this);
- }
- mRefs->decWeak(this);
- }
-}
-
-void BpRefBase::onFirstRef()
-{
- android_atomic_or(kRemoteAcquired, &mState);
-}
-
-void BpRefBase::onLastStrongRef(const void* id)
-{
- if (mRemote) {
- mRemote->decStrong(this);
- }
-}
-
-bool BpRefBase::onIncStrongAttempted(uint32_t flags, const void* id)
-{
- return mRemote ? mRefs->attemptIncStrong(this) : false;
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
deleted file mode 100644
index 47a62db..0000000
--- a/libs/binder/BpBinder.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "BpBinder"
-//#define LOG_NDEBUG 0
-
-#include <binder/BpBinder.h>
-
-#include <binder/IPCThreadState.h>
-#include <utils/Log.h>
-
-#include <stdio.h>
-
-//#undef ALOGV
-//#define ALOGV(...) fprintf(stderr, __VA_ARGS__)
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-BpBinder::ObjectManager::ObjectManager()
-{
-}
-
-BpBinder::ObjectManager::~ObjectManager()
-{
- kill();
-}
-
-void BpBinder::ObjectManager::attach(
- const void* objectID, void* object, void* cleanupCookie,
- IBinder::object_cleanup_func func)
-{
- entry_t e;
- e.object = object;
- e.cleanupCookie = cleanupCookie;
- e.func = func;
-
- if (mObjects.indexOfKey(objectID) >= 0) {
- ALOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use",
- objectID, this, object);
- return;
- }
-
- mObjects.add(objectID, e);
-}
-
-void* BpBinder::ObjectManager::find(const void* objectID) const
-{
- const ssize_t i = mObjects.indexOfKey(objectID);
- if (i < 0) return NULL;
- return mObjects.valueAt(i).object;
-}
-
-void BpBinder::ObjectManager::detach(const void* objectID)
-{
- mObjects.removeItem(objectID);
-}
-
-void BpBinder::ObjectManager::kill()
-{
- const size_t N = mObjects.size();
- ALOGV("Killing %d objects in manager %p", N, this);
- for (size_t i=0; i<N; i++) {
- const entry_t& e = mObjects.valueAt(i);
- if (e.func != NULL) {
- e.func(mObjects.keyAt(i), e.object, e.cleanupCookie);
- }
- }
-
- mObjects.clear();
-}
-
-// ---------------------------------------------------------------------------
-
-BpBinder::BpBinder(int32_t handle)
- : mHandle(handle)
- , mAlive(1)
- , mObitsSent(0)
- , mObituaries(NULL)
-{
- ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);
-
- extendObjectLifetime(OBJECT_LIFETIME_WEAK);
- IPCThreadState::self()->incWeakHandle(handle);
-}
-
-bool BpBinder::isDescriptorCached() const {
- Mutex::Autolock _l(mLock);
- return mDescriptorCache.size() ? true : false;
-}
-
-const String16& BpBinder::getInterfaceDescriptor() const
-{
- if (isDescriptorCached() == false) {
- Parcel send, reply;
- // do the IPC without a lock held.
- status_t err = const_cast<BpBinder*>(this)->transact(
- INTERFACE_TRANSACTION, send, &reply);
- if (err == NO_ERROR) {
- String16 res(reply.readString16());
- Mutex::Autolock _l(mLock);
- // mDescriptorCache could have been assigned while the lock was
- // released.
- if (mDescriptorCache.size() == 0)
- mDescriptorCache = res;
- }
- }
-
- // we're returning a reference to a non-static object here. Usually this
- // is not something smart to do, however, with binder objects it is
- // (usually) safe because they are reference-counted.
-
- return mDescriptorCache;
-}
-
-bool BpBinder::isBinderAlive() const
-{
- return mAlive != 0;
-}
-
-status_t BpBinder::pingBinder()
-{
- Parcel send;
- Parcel reply;
- status_t err = transact(PING_TRANSACTION, send, &reply);
- if (err != NO_ERROR) return err;
- if (reply.dataSize() < sizeof(status_t)) return NOT_ENOUGH_DATA;
- return (status_t)reply.readInt32();
-}
-
-status_t BpBinder::dump(int fd, const Vector<String16>& args)
-{
- Parcel send;
- Parcel reply;
- send.writeFileDescriptor(fd);
- const size_t numArgs = args.size();
- send.writeInt32(numArgs);
- for (size_t i = 0; i < numArgs; i++) {
- send.writeString16(args[i]);
- }
- status_t err = transact(DUMP_TRANSACTION, send, &reply);
- return err;
-}
-
-status_t BpBinder::transact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- // Once a binder has died, it will never come back to life.
- if (mAlive) {
- status_t status = IPCThreadState::self()->transact(
- mHandle, code, data, reply, flags);
- if (status == DEAD_OBJECT) mAlive = 0;
- return status;
- }
-
- return DEAD_OBJECT;
-}
-
-status_t BpBinder::linkToDeath(
- const sp<DeathRecipient>& recipient, void* cookie, uint32_t flags)
-{
- Obituary ob;
- ob.recipient = recipient;
- ob.cookie = cookie;
- ob.flags = flags;
-
- LOG_ALWAYS_FATAL_IF(recipient == NULL,
- "linkToDeath(): recipient must be non-NULL");
-
- {
- AutoMutex _l(mLock);
-
- if (!mObitsSent) {
- if (!mObituaries) {
- mObituaries = new Vector<Obituary>;
- if (!mObituaries) {
- return NO_MEMORY;
- }
- ALOGV("Requesting death notification: %p handle %d\n", this, mHandle);
- getWeakRefs()->incWeak(this);
- IPCThreadState* self = IPCThreadState::self();
- self->requestDeathNotification(mHandle, this);
- self->flushCommands();
- }
- ssize_t res = mObituaries->add(ob);
- return res >= (ssize_t)NO_ERROR ? (status_t)NO_ERROR : res;
- }
- }
-
- return DEAD_OBJECT;
-}
-
-status_t BpBinder::unlinkToDeath(
- const wp<DeathRecipient>& recipient, void* cookie, uint32_t flags,
- wp<DeathRecipient>* outRecipient)
-{
- AutoMutex _l(mLock);
-
- if (mObitsSent) {
- return DEAD_OBJECT;
- }
-
- const size_t N = mObituaries ? mObituaries->size() : 0;
- for (size_t i=0; i<N; i++) {
- const Obituary& obit = mObituaries->itemAt(i);
- if ((obit.recipient == recipient
- || (recipient == NULL && obit.cookie == cookie))
- && obit.flags == flags) {
- const uint32_t allFlags = obit.flags|flags;
- if (outRecipient != NULL) {
- *outRecipient = mObituaries->itemAt(i).recipient;
- }
- mObituaries->removeAt(i);
- if (mObituaries->size() == 0) {
- ALOGV("Clearing death notification: %p handle %d\n", this, mHandle);
- IPCThreadState* self = IPCThreadState::self();
- self->clearDeathNotification(mHandle, this);
- self->flushCommands();
- delete mObituaries;
- mObituaries = NULL;
- }
- return NO_ERROR;
- }
- }
-
- return NAME_NOT_FOUND;
-}
-
-void BpBinder::sendObituary()
-{
- ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
- this, mHandle, mObitsSent ? "true" : "false");
-
- mAlive = 0;
- if (mObitsSent) return;
-
- mLock.lock();
- Vector<Obituary>* obits = mObituaries;
- if(obits != NULL) {
- ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
- IPCThreadState* self = IPCThreadState::self();
- self->clearDeathNotification(mHandle, this);
- self->flushCommands();
- mObituaries = NULL;
- }
- mObitsSent = 1;
- mLock.unlock();
-
- ALOGV("Reporting death of proxy %p for %d recipients\n",
- this, obits ? obits->size() : 0);
-
- if (obits != NULL) {
- const size_t N = obits->size();
- for (size_t i=0; i<N; i++) {
- reportOneDeath(obits->itemAt(i));
- }
-
- delete obits;
- }
-}
-
-void BpBinder::reportOneDeath(const Obituary& obit)
-{
- sp<DeathRecipient> recipient = obit.recipient.promote();
- ALOGV("Reporting death to recipient: %p\n", recipient.get());
- if (recipient == NULL) return;
-
- recipient->binderDied(this);
-}
-
-
-void BpBinder::attachObject(
- const void* objectID, void* object, void* cleanupCookie,
- object_cleanup_func func)
-{
- AutoMutex _l(mLock);
- ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
- mObjects.attach(objectID, object, cleanupCookie, func);
-}
-
-void* BpBinder::findObject(const void* objectID) const
-{
- AutoMutex _l(mLock);
- return mObjects.find(objectID);
-}
-
-void BpBinder::detachObject(const void* objectID)
-{
- AutoMutex _l(mLock);
- mObjects.detach(objectID);
-}
-
-BpBinder* BpBinder::remoteBinder()
-{
- return this;
-}
-
-BpBinder::~BpBinder()
-{
- ALOGV("Destroying BpBinder %p handle %d\n", this, mHandle);
-
- IPCThreadState* ipc = IPCThreadState::self();
-
- mLock.lock();
- Vector<Obituary>* obits = mObituaries;
- if(obits != NULL) {
- if (ipc) ipc->clearDeathNotification(mHandle, this);
- mObituaries = NULL;
- }
- mLock.unlock();
-
- if (obits != NULL) {
- // XXX Should we tell any remaining DeathRecipient
- // objects that the last strong ref has gone away, so they
- // are no longer linked?
- delete obits;
- }
-
- if (ipc) {
- ipc->expungeHandle(mHandle, this);
- ipc->decWeakHandle(mHandle);
- }
-}
-
-void BpBinder::onFirstRef()
-{
- ALOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
- IPCThreadState* ipc = IPCThreadState::self();
- if (ipc) ipc->incStrongHandle(mHandle);
-}
-
-void BpBinder::onLastStrongRef(const void* id)
-{
- ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
- IF_ALOGV() {
- printRefs();
- }
- IPCThreadState* ipc = IPCThreadState::self();
- if (ipc) ipc->decStrongHandle(mHandle);
-}
-
-bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id)
-{
- ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
- IPCThreadState* ipc = IPCThreadState::self();
- return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false;
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/binder/IInterface.cpp b/libs/binder/IInterface.cpp
deleted file mode 100644
index 29acf5d..0000000
--- a/libs/binder/IInterface.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <binder/IInterface.h>
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-IInterface::IInterface()
- : RefBase() {
-}
-
-IInterface::~IInterface() {
-}
-
-sp<IBinder> IInterface::asBinder()
-{
- return this ? onAsBinder() : NULL;
-}
-
-sp<const IBinder> IInterface::asBinder() const
-{
- return this ? const_cast<IInterface*>(this)->onAsBinder() : NULL;
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
deleted file mode 100644
index cd2451a..0000000
--- a/libs/binder/IMemory.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "IMemory"
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <binder/IMemory.h>
-#include <utils/KeyedVector.h>
-#include <utils/threads.h>
-#include <utils/Atomic.h>
-#include <binder/Parcel.h>
-#include <utils/CallStack.h>
-
-#define VERBOSE 0
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class HeapCache : public IBinder::DeathRecipient
-{
-public:
- HeapCache();
- virtual ~HeapCache();
-
- virtual void binderDied(const wp<IBinder>& who);
-
- sp<IMemoryHeap> find_heap(const sp<IBinder>& binder);
- void free_heap(const sp<IBinder>& binder);
- sp<IMemoryHeap> get_heap(const sp<IBinder>& binder);
- void dump_heaps();
-
-private:
- // For IMemory.cpp
- struct heap_info_t {
- sp<IMemoryHeap> heap;
- int32_t count;
- };
-
- void free_heap(const wp<IBinder>& binder);
-
- Mutex mHeapCacheLock;
- KeyedVector< wp<IBinder>, heap_info_t > mHeapCache;
-};
-
-static sp<HeapCache> gHeapCache = new HeapCache();
-
-/******************************************************************************/
-
-enum {
- HEAP_ID = IBinder::FIRST_CALL_TRANSACTION
-};
-
-class BpMemoryHeap : public BpInterface<IMemoryHeap>
-{
-public:
- BpMemoryHeap(const sp<IBinder>& impl);
- virtual ~BpMemoryHeap();
-
- virtual int getHeapID() const;
- virtual void* getBase() const;
- virtual size_t getSize() const;
- virtual uint32_t getFlags() const;
- virtual uint32_t getOffset() const;
-
-private:
- friend class IMemory;
- friend class HeapCache;
-
- // for debugging in this module
- static inline sp<IMemoryHeap> find_heap(const sp<IBinder>& binder) {
- return gHeapCache->find_heap(binder);
- }
- static inline void free_heap(const sp<IBinder>& binder) {
- gHeapCache->free_heap(binder);
- }
- static inline sp<IMemoryHeap> get_heap(const sp<IBinder>& binder) {
- return gHeapCache->get_heap(binder);
- }
- static inline void dump_heaps() {
- gHeapCache->dump_heaps();
- }
-
- void assertMapped() const;
- void assertReallyMapped() const;
-
- mutable volatile int32_t mHeapId;
- mutable void* mBase;
- mutable size_t mSize;
- mutable uint32_t mFlags;
- mutable uint32_t mOffset;
- mutable bool mRealHeap;
- mutable Mutex mLock;
-};
-
-// ----------------------------------------------------------------------------
-
-enum {
- GET_MEMORY = IBinder::FIRST_CALL_TRANSACTION
-};
-
-class BpMemory : public BpInterface<IMemory>
-{
-public:
- BpMemory(const sp<IBinder>& impl);
- virtual ~BpMemory();
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset=0, size_t* size=0) const;
-
-private:
- mutable sp<IMemoryHeap> mHeap;
- mutable ssize_t mOffset;
- mutable size_t mSize;
-};
-
-/******************************************************************************/
-
-void* IMemory::fastPointer(const sp<IBinder>& binder, ssize_t offset) const
-{
- sp<IMemoryHeap> realHeap = BpMemoryHeap::get_heap(binder);
- void* const base = realHeap->base();
- if (base == MAP_FAILED)
- return 0;
- return static_cast<char*>(base) + offset;
-}
-
-void* IMemory::pointer() const {
- ssize_t offset;
- sp<IMemoryHeap> heap = getMemory(&offset);
- void* const base = heap!=0 ? heap->base() : MAP_FAILED;
- if (base == MAP_FAILED)
- return 0;
- return static_cast<char*>(base) + offset;
-}
-
-size_t IMemory::size() const {
- size_t size;
- getMemory(NULL, &size);
- return size;
-}
-
-ssize_t IMemory::offset() const {
- ssize_t offset;
- getMemory(&offset);
- return offset;
-}
-
-/******************************************************************************/
-
-BpMemory::BpMemory(const sp<IBinder>& impl)
- : BpInterface<IMemory>(impl), mOffset(0), mSize(0)
-{
-}
-
-BpMemory::~BpMemory()
-{
-}
-
-sp<IMemoryHeap> BpMemory::getMemory(ssize_t* offset, size_t* size) const
-{
- if (mHeap == 0) {
- Parcel data, reply;
- data.writeInterfaceToken(IMemory::getInterfaceDescriptor());
- if (remote()->transact(GET_MEMORY, data, &reply) == NO_ERROR) {
- sp<IBinder> heap = reply.readStrongBinder();
- ssize_t o = reply.readInt32();
- size_t s = reply.readInt32();
- if (heap != 0) {
- mHeap = interface_cast<IMemoryHeap>(heap);
- if (mHeap != 0) {
- mOffset = o;
- mSize = s;
- }
- }
- }
- }
- if (offset) *offset = mOffset;
- if (size) *size = mSize;
- return mHeap;
-}
-
-// ---------------------------------------------------------------------------
-
-IMPLEMENT_META_INTERFACE(Memory, "android.utils.IMemory");
-
-BnMemory::BnMemory() {
-}
-
-BnMemory::~BnMemory() {
-}
-
-status_t BnMemory::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case GET_MEMORY: {
- CHECK_INTERFACE(IMemory, data, reply);
- ssize_t offset;
- size_t size;
- reply->writeStrongBinder( getMemory(&offset, &size)->asBinder() );
- reply->writeInt32(offset);
- reply->writeInt32(size);
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-
-/******************************************************************************/
-
-BpMemoryHeap::BpMemoryHeap(const sp<IBinder>& impl)
- : BpInterface<IMemoryHeap>(impl),
- mHeapId(-1), mBase(MAP_FAILED), mSize(0), mFlags(0), mOffset(0), mRealHeap(false)
-{
-}
-
-BpMemoryHeap::~BpMemoryHeap() {
- if (mHeapId != -1) {
- close(mHeapId);
- if (mRealHeap) {
- // by construction we're the last one
- if (mBase != MAP_FAILED) {
- sp<IBinder> binder = const_cast<BpMemoryHeap*>(this)->asBinder();
-
- if (VERBOSE) {
- ALOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d",
- binder.get(), this, mSize, mHeapId);
- CallStack stack;
- stack.update();
- stack.dump("callstack");
- }
-
- munmap(mBase, mSize);
- }
- } else {
- // remove from list only if it was mapped before
- sp<IBinder> binder = const_cast<BpMemoryHeap*>(this)->asBinder();
- free_heap(binder);
- }
- }
-}
-
-void BpMemoryHeap::assertMapped() const
-{
- if (mHeapId == -1) {
- sp<IBinder> binder(const_cast<BpMemoryHeap*>(this)->asBinder());
- sp<BpMemoryHeap> heap(static_cast<BpMemoryHeap*>(find_heap(binder).get()));
- heap->assertReallyMapped();
- if (heap->mBase != MAP_FAILED) {
- Mutex::Autolock _l(mLock);
- if (mHeapId == -1) {
- mBase = heap->mBase;
- mSize = heap->mSize;
- mOffset = heap->mOffset;
- android_atomic_write( dup( heap->mHeapId ), &mHeapId );
- }
- } else {
- // something went wrong
- free_heap(binder);
- }
- }
-}
-
-void BpMemoryHeap::assertReallyMapped() const
-{
- if (mHeapId == -1) {
-
- // remote call without mLock held, worse case scenario, we end up
- // calling transact() from multiple threads, but that's not a problem,
- // only mmap below must be in the critical section.
-
- Parcel data, reply;
- data.writeInterfaceToken(IMemoryHeap::getInterfaceDescriptor());
- status_t err = remote()->transact(HEAP_ID, data, &reply);
- int parcel_fd = reply.readFileDescriptor();
- ssize_t size = reply.readInt32();
- uint32_t flags = reply.readInt32();
- uint32_t offset = reply.readInt32();
-
- ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
- asBinder().get(), parcel_fd, size, err, strerror(-err));
-
- int fd = dup( parcel_fd );
- ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)",
- parcel_fd, size, err, strerror(errno));
-
- int access = PROT_READ;
- if (!(flags & READ_ONLY)) {
- access |= PROT_WRITE;
- }
-
- Mutex::Autolock _l(mLock);
- if (mHeapId == -1) {
- mRealHeap = true;
- mBase = mmap(0, size, access, MAP_SHARED, fd, offset);
- if (mBase == MAP_FAILED) {
- ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)",
- asBinder().get(), size, fd, strerror(errno));
- close(fd);
- } else {
- mSize = size;
- mFlags = flags;
- mOffset = offset;
- android_atomic_write(fd, &mHeapId);
- }
- }
- }
-}
-
-int BpMemoryHeap::getHeapID() const {
- assertMapped();
- return mHeapId;
-}
-
-void* BpMemoryHeap::getBase() const {
- assertMapped();
- return mBase;
-}
-
-size_t BpMemoryHeap::getSize() const {
- assertMapped();
- return mSize;
-}
-
-uint32_t BpMemoryHeap::getFlags() const {
- assertMapped();
- return mFlags;
-}
-
-uint32_t BpMemoryHeap::getOffset() const {
- assertMapped();
- return mOffset;
-}
-
-// ---------------------------------------------------------------------------
-
-IMPLEMENT_META_INTERFACE(MemoryHeap, "android.utils.IMemoryHeap");
-
-BnMemoryHeap::BnMemoryHeap() {
-}
-
-BnMemoryHeap::~BnMemoryHeap() {
-}
-
-status_t BnMemoryHeap::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case HEAP_ID: {
- CHECK_INTERFACE(IMemoryHeap, data, reply);
- reply->writeFileDescriptor(getHeapID());
- reply->writeInt32(getSize());
- reply->writeInt32(getFlags());
- reply->writeInt32(getOffset());
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-/*****************************************************************************/
-
-HeapCache::HeapCache()
- : DeathRecipient()
-{
-}
-
-HeapCache::~HeapCache()
-{
-}
-
-void HeapCache::binderDied(const wp<IBinder>& binder)
-{
- //ALOGD("binderDied binder=%p", binder.unsafe_get());
- free_heap(binder);
-}
-
-sp<IMemoryHeap> HeapCache::find_heap(const sp<IBinder>& binder)
-{
- Mutex::Autolock _l(mHeapCacheLock);
- ssize_t i = mHeapCache.indexOfKey(binder);
- if (i>=0) {
- heap_info_t& info = mHeapCache.editValueAt(i);
- ALOGD_IF(VERBOSE,
- "found binder=%p, heap=%p, size=%d, fd=%d, count=%d",
- binder.get(), info.heap.get(),
- static_cast<BpMemoryHeap*>(info.heap.get())->mSize,
- static_cast<BpMemoryHeap*>(info.heap.get())->mHeapId,
- info.count);
- android_atomic_inc(&info.count);
- return info.heap;
- } else {
- heap_info_t info;
- info.heap = interface_cast<IMemoryHeap>(binder);
- info.count = 1;
- //ALOGD("adding binder=%p, heap=%p, count=%d",
- // binder.get(), info.heap.get(), info.count);
- mHeapCache.add(binder, info);
- return info.heap;
- }
-}
-
-void HeapCache::free_heap(const sp<IBinder>& binder) {
- free_heap( wp<IBinder>(binder) );
-}
-
-void HeapCache::free_heap(const wp<IBinder>& binder)
-{
- sp<IMemoryHeap> rel;
- {
- Mutex::Autolock _l(mHeapCacheLock);
- ssize_t i = mHeapCache.indexOfKey(binder);
- if (i>=0) {
- heap_info_t& info(mHeapCache.editValueAt(i));
- int32_t c = android_atomic_dec(&info.count);
- if (c == 1) {
- ALOGD_IF(VERBOSE,
- "removing binder=%p, heap=%p, size=%d, fd=%d, count=%d",
- binder.unsafe_get(), info.heap.get(),
- static_cast<BpMemoryHeap*>(info.heap.get())->mSize,
- static_cast<BpMemoryHeap*>(info.heap.get())->mHeapId,
- info.count);
- rel = mHeapCache.valueAt(i).heap;
- mHeapCache.removeItemsAt(i);
- }
- } else {
- ALOGE("free_heap binder=%p not found!!!", binder.unsafe_get());
- }
- }
-}
-
-sp<IMemoryHeap> HeapCache::get_heap(const sp<IBinder>& binder)
-{
- sp<IMemoryHeap> realHeap;
- Mutex::Autolock _l(mHeapCacheLock);
- ssize_t i = mHeapCache.indexOfKey(binder);
- if (i>=0) realHeap = mHeapCache.valueAt(i).heap;
- else realHeap = interface_cast<IMemoryHeap>(binder);
- return realHeap;
-}
-
-void HeapCache::dump_heaps()
-{
- Mutex::Autolock _l(mHeapCacheLock);
- int c = mHeapCache.size();
- for (int i=0 ; i<c ; i++) {
- const heap_info_t& info = mHeapCache.valueAt(i);
- BpMemoryHeap const* h(static_cast<BpMemoryHeap const *>(info.heap.get()));
- ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)",
- mHeapCache.keyAt(i).unsafe_get(),
- info.heap.get(), info.count,
- h->mHeapId, h->mBase, h->mSize);
- }
-}
-
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
deleted file mode 100644
index 96cef2c..0000000
--- a/libs/binder/IPCThreadState.cpp
+++ /dev/null
@@ -1,1131 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "IPCThreadState"
-
-#include <binder/IPCThreadState.h>
-
-#include <binder/Binder.h>
-#include <binder/BpBinder.h>
-#include <utils/Debug.h>
-#include <utils/Log.h>
-#include <utils/TextOutput.h>
-#include <utils/threads.h>
-
-#include <private/binder/binder_module.h>
-#include <private/binder/Static.h>
-
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#ifdef HAVE_PTHREADS
-#include <pthread.h>
-#include <sched.h>
-#include <sys/resource.h>
-#endif
-#ifdef HAVE_WIN32_THREADS
-#include <windows.h>
-#endif
-
-
-#if LOG_NDEBUG
-
-#define IF_LOG_TRANSACTIONS() if (false)
-#define IF_LOG_COMMANDS() if (false)
-#define LOG_REMOTEREFS(...)
-#define IF_LOG_REMOTEREFS() if (false)
-#define LOG_THREADPOOL(...)
-#define LOG_ONEWAY(...)
-
-#else
-
-#define IF_LOG_TRANSACTIONS() IF_ALOG(LOG_VERBOSE, "transact")
-#define IF_LOG_COMMANDS() IF_ALOG(LOG_VERBOSE, "ipc")
-#define LOG_REMOTEREFS(...) ALOG(LOG_DEBUG, "remoterefs", __VA_ARGS__)
-#define IF_LOG_REMOTEREFS() IF_ALOG(LOG_DEBUG, "remoterefs")
-#define LOG_THREADPOOL(...) ALOG(LOG_DEBUG, "threadpool", __VA_ARGS__)
-#define LOG_ONEWAY(...) ALOG(LOG_DEBUG, "ipc", __VA_ARGS__)
-
-#endif
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-static const char* getReturnString(size_t idx);
-static const char* getCommandString(size_t idx);
-static const void* printReturnCommand(TextOutput& out, const void* _cmd);
-static const void* printCommand(TextOutput& out, const void* _cmd);
-
-// This will result in a missing symbol failure if the IF_LOG_COMMANDS()
-// conditionals don't get stripped... but that is probably what we want.
-#if !LOG_NDEBUG
-static const char *kReturnStrings[] = {
- "BR_ERROR",
- "BR_OK",
- "BR_TRANSACTION",
- "BR_REPLY",
- "BR_ACQUIRE_RESULT",
- "BR_DEAD_REPLY",
- "BR_TRANSACTION_COMPLETE",
- "BR_INCREFS",
- "BR_ACQUIRE",
- "BR_RELEASE",
- "BR_DECREFS",
- "BR_ATTEMPT_ACQUIRE",
- "BR_NOOP",
- "BR_SPAWN_LOOPER",
- "BR_FINISHED",
- "BR_DEAD_BINDER",
- "BR_CLEAR_DEATH_NOTIFICATION_DONE",
- "BR_FAILED_REPLY"
-};
-
-static const char *kCommandStrings[] = {
- "BC_TRANSACTION",
- "BC_REPLY",
- "BC_ACQUIRE_RESULT",
- "BC_FREE_BUFFER",
- "BC_INCREFS",
- "BC_ACQUIRE",
- "BC_RELEASE",
- "BC_DECREFS",
- "BC_INCREFS_DONE",
- "BC_ACQUIRE_DONE",
- "BC_ATTEMPT_ACQUIRE",
- "BC_REGISTER_LOOPER",
- "BC_ENTER_LOOPER",
- "BC_EXIT_LOOPER",
- "BC_REQUEST_DEATH_NOTIFICATION",
- "BC_CLEAR_DEATH_NOTIFICATION",
- "BC_DEAD_BINDER_DONE"
-};
-
-static const char* getReturnString(size_t idx)
-{
- if (idx < sizeof(kReturnStrings) / sizeof(kReturnStrings[0]))
- return kReturnStrings[idx];
- else
- return "unknown";
-}
-
-static const char* getCommandString(size_t idx)
-{
- if (idx < sizeof(kCommandStrings) / sizeof(kCommandStrings[0]))
- return kCommandStrings[idx];
- else
- return "unknown";
-}
-
-static const void* printBinderTransactionData(TextOutput& out, const void* data)
-{
- const binder_transaction_data* btd =
- (const binder_transaction_data*)data;
- if (btd->target.handle < 1024) {
- /* want to print descriptors in decimal; guess based on value */
- out << "target.desc=" << btd->target.handle;
- } else {
- out << "target.ptr=" << btd->target.ptr;
- }
- out << " (cookie " << btd->cookie << ")" << endl
- << "code=" << TypeCode(btd->code) << ", flags=" << (void*)btd->flags << endl
- << "data=" << btd->data.ptr.buffer << " (" << (void*)btd->data_size
- << " bytes)" << endl
- << "offsets=" << btd->data.ptr.offsets << " (" << (void*)btd->offsets_size
- << " bytes)";
- return btd+1;
-}
-
-static const void* printReturnCommand(TextOutput& out, const void* _cmd)
-{
- static const size_t N = sizeof(kReturnStrings)/sizeof(kReturnStrings[0]);
- const int32_t* cmd = (const int32_t*)_cmd;
- int32_t code = *cmd++;
- size_t cmdIndex = code & 0xff;
- if (code == (int32_t) BR_ERROR) {
- out << "BR_ERROR: " << (void*)(*cmd++) << endl;
- return cmd;
- } else if (cmdIndex >= N) {
- out << "Unknown reply: " << code << endl;
- return cmd;
- }
- out << kReturnStrings[cmdIndex];
-
- switch (code) {
- case BR_TRANSACTION:
- case BR_REPLY: {
- out << ": " << indent;
- cmd = (const int32_t *)printBinderTransactionData(out, cmd);
- out << dedent;
- } break;
-
- case BR_ACQUIRE_RESULT: {
- const int32_t res = *cmd++;
- out << ": " << res << (res ? " (SUCCESS)" : " (FAILURE)");
- } break;
-
- case BR_INCREFS:
- case BR_ACQUIRE:
- case BR_RELEASE:
- case BR_DECREFS: {
- const int32_t b = *cmd++;
- const int32_t c = *cmd++;
- out << ": target=" << (void*)b << " (cookie " << (void*)c << ")";
- } break;
-
- case BR_ATTEMPT_ACQUIRE: {
- const int32_t p = *cmd++;
- const int32_t b = *cmd++;
- const int32_t c = *cmd++;
- out << ": target=" << (void*)b << " (cookie " << (void*)c
- << "), pri=" << p;
- } break;
-
- case BR_DEAD_BINDER:
- case BR_CLEAR_DEATH_NOTIFICATION_DONE: {
- const int32_t c = *cmd++;
- out << ": death cookie " << (void*)c;
- } break;
-
- default:
- // no details to show for: BR_OK, BR_DEAD_REPLY,
- // BR_TRANSACTION_COMPLETE, BR_FINISHED
- break;
- }
-
- out << endl;
- return cmd;
-}
-
-static const void* printCommand(TextOutput& out, const void* _cmd)
-{
- static const size_t N = sizeof(kCommandStrings)/sizeof(kCommandStrings[0]);
- const int32_t* cmd = (const int32_t*)_cmd;
- int32_t code = *cmd++;
- size_t cmdIndex = code & 0xff;
-
- if (cmdIndex >= N) {
- out << "Unknown command: " << code << endl;
- return cmd;
- }
- out << kCommandStrings[cmdIndex];
-
- switch (code) {
- case BC_TRANSACTION:
- case BC_REPLY: {
- out << ": " << indent;
- cmd = (const int32_t *)printBinderTransactionData(out, cmd);
- out << dedent;
- } break;
-
- case BC_ACQUIRE_RESULT: {
- const int32_t res = *cmd++;
- out << ": " << res << (res ? " (SUCCESS)" : " (FAILURE)");
- } break;
-
- case BC_FREE_BUFFER: {
- const int32_t buf = *cmd++;
- out << ": buffer=" << (void*)buf;
- } break;
-
- case BC_INCREFS:
- case BC_ACQUIRE:
- case BC_RELEASE:
- case BC_DECREFS: {
- const int32_t d = *cmd++;
- out << ": desc=" << d;
- } break;
-
- case BC_INCREFS_DONE:
- case BC_ACQUIRE_DONE: {
- const int32_t b = *cmd++;
- const int32_t c = *cmd++;
- out << ": target=" << (void*)b << " (cookie " << (void*)c << ")";
- } break;
-
- case BC_ATTEMPT_ACQUIRE: {
- const int32_t p = *cmd++;
- const int32_t d = *cmd++;
- out << ": desc=" << d << ", pri=" << p;
- } break;
-
- case BC_REQUEST_DEATH_NOTIFICATION:
- case BC_CLEAR_DEATH_NOTIFICATION: {
- const int32_t h = *cmd++;
- const int32_t c = *cmd++;
- out << ": handle=" << h << " (death cookie " << (void*)c << ")";
- } break;
-
- case BC_DEAD_BINDER_DONE: {
- const int32_t c = *cmd++;
- out << ": death cookie " << (void*)c;
- } break;
-
- default:
- // no details to show for: BC_REGISTER_LOOPER, BC_ENTER_LOOPER,
- // BC_EXIT_LOOPER
- break;
- }
-
- out << endl;
- return cmd;
-}
-#endif
-
-static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER;
-static bool gHaveTLS = false;
-static pthread_key_t gTLS = 0;
-static bool gShutdown = false;
-static bool gDisableBackgroundScheduling = false;
-
-IPCThreadState* IPCThreadState::self()
-{
- if (gHaveTLS) {
-restart:
- const pthread_key_t k = gTLS;
- IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k);
- if (st) return st;
- return new IPCThreadState;
- }
-
- if (gShutdown) return NULL;
-
- pthread_mutex_lock(&gTLSMutex);
- if (!gHaveTLS) {
- if (pthread_key_create(&gTLS, threadDestructor) != 0) {
- pthread_mutex_unlock(&gTLSMutex);
- return NULL;
- }
- gHaveTLS = true;
- }
- pthread_mutex_unlock(&gTLSMutex);
- goto restart;
-}
-
-IPCThreadState* IPCThreadState::selfOrNull()
-{
- if (gHaveTLS) {
- const pthread_key_t k = gTLS;
- IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k);
- return st;
- }
- return NULL;
-}
-
-void IPCThreadState::shutdown()
-{
- gShutdown = true;
-
- if (gHaveTLS) {
- // XXX Need to wait for all thread pool threads to exit!
- IPCThreadState* st = (IPCThreadState*)pthread_getspecific(gTLS);
- if (st) {
- delete st;
- pthread_setspecific(gTLS, NULL);
- }
- gHaveTLS = false;
- }
-}
-
-void IPCThreadState::disableBackgroundScheduling(bool disable)
-{
- gDisableBackgroundScheduling = disable;
-}
-
-sp<ProcessState> IPCThreadState::process()
-{
- return mProcess;
-}
-
-status_t IPCThreadState::clearLastError()
-{
- const status_t err = mLastError;
- mLastError = NO_ERROR;
- return err;
-}
-
-int IPCThreadState::getCallingPid()
-{
- return mCallingPid;
-}
-
-int IPCThreadState::getCallingUid()
-{
- return mCallingUid;
-}
-
-int IPCThreadState::getOrigCallingUid()
-{
- return mOrigCallingUid;
-}
-
-int64_t IPCThreadState::clearCallingIdentity()
-{
- int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid;
- clearCaller();
- return token;
-}
-
-void IPCThreadState::setStrictModePolicy(int32_t policy)
-{
- mStrictModePolicy = policy;
-}
-
-int32_t IPCThreadState::getStrictModePolicy() const
-{
- return mStrictModePolicy;
-}
-
-void IPCThreadState::setLastTransactionBinderFlags(int32_t flags)
-{
- mLastTransactionBinderFlags = flags;
-}
-
-int32_t IPCThreadState::getLastTransactionBinderFlags() const
-{
- return mLastTransactionBinderFlags;
-}
-
-void IPCThreadState::restoreCallingIdentity(int64_t token)
-{
- mCallingUid = (int)(token>>32);
- mCallingPid = (int)token;
-}
-
-void IPCThreadState::clearCaller()
-{
- mCallingPid = getpid();
- mCallingUid = getuid();
-}
-
-void IPCThreadState::flushCommands()
-{
- if (mProcess->mDriverFD <= 0)
- return;
- talkWithDriver(false);
-}
-
-void IPCThreadState::joinThreadPool(bool isMain)
-{
- LOG_THREADPOOL("**** THREAD %p (PID %d) IS JOINING THE THREAD POOL\n", (void*)pthread_self(), getpid());
-
- mOut.writeInt32(isMain ? BC_ENTER_LOOPER : BC_REGISTER_LOOPER);
-
- // This thread may have been spawned by a thread that was in the background
- // scheduling group, so first we will make sure it is in the default/foreground
- // one to avoid performing an initial transaction in the background.
- androidSetThreadSchedulingGroup(mMyThreadId, ANDROID_TGROUP_DEFAULT);
-
- status_t result;
- do {
- int32_t cmd;
-
- // When we've cleared the incoming command queue, process any pending derefs
- if (mIn.dataPosition() >= mIn.dataSize()) {
- size_t numPending = mPendingWeakDerefs.size();
- if (numPending > 0) {
- for (size_t i = 0; i < numPending; i++) {
- RefBase::weakref_type* refs = mPendingWeakDerefs[i];
- refs->decWeak(mProcess.get());
- }
- mPendingWeakDerefs.clear();
- }
-
- numPending = mPendingStrongDerefs.size();
- if (numPending > 0) {
- for (size_t i = 0; i < numPending; i++) {
- BBinder* obj = mPendingStrongDerefs[i];
- obj->decStrong(mProcess.get());
- }
- mPendingStrongDerefs.clear();
- }
- }
-
- // now get the next command to be processed, waiting if necessary
- result = talkWithDriver();
- if (result >= NO_ERROR) {
- size_t IN = mIn.dataAvail();
- if (IN < sizeof(int32_t)) continue;
- cmd = mIn.readInt32();
- IF_LOG_COMMANDS() {
- alog << "Processing top-level Command: "
- << getReturnString(cmd) << endl;
- }
-
-
- result = executeCommand(cmd);
- }
-
- // After executing the command, ensure that the thread is returned to the
- // default cgroup before rejoining the pool. The driver takes care of
- // restoring the priority, but doesn't do anything with cgroups so we
- // need to take care of that here in userspace. Note that we do make
- // sure to go in the foreground after executing a transaction, but
- // there are other callbacks into user code that could have changed
- // our group so we want to make absolutely sure it is put back.
- androidSetThreadSchedulingGroup(mMyThreadId, ANDROID_TGROUP_DEFAULT);
-
- // Let this thread exit the thread pool if it is no longer
- // needed and it is not the main process thread.
- if(result == TIMED_OUT && !isMain) {
- break;
- }
- } while (result != -ECONNREFUSED && result != -EBADF);
-
- LOG_THREADPOOL("**** THREAD %p (PID %d) IS LEAVING THE THREAD POOL err=%p\n",
- (void*)pthread_self(), getpid(), (void*)result);
-
- mOut.writeInt32(BC_EXIT_LOOPER);
- talkWithDriver(false);
-}
-
-void IPCThreadState::stopProcess(bool immediate)
-{
- //ALOGI("**** STOPPING PROCESS");
- flushCommands();
- int fd = mProcess->mDriverFD;
- mProcess->mDriverFD = -1;
- close(fd);
- //kill(getpid(), SIGKILL);
-}
-
-status_t IPCThreadState::transact(int32_t handle,
- uint32_t code, const Parcel& data,
- Parcel* reply, uint32_t flags)
-{
- status_t err = data.errorCheck();
-
- flags |= TF_ACCEPT_FDS;
-
- IF_LOG_TRANSACTIONS() {
- TextOutput::Bundle _b(alog);
- alog << "BC_TRANSACTION thr " << (void*)pthread_self() << " / hand "
- << handle << " / code " << TypeCode(code) << ": "
- << indent << data << dedent << endl;
- }
-
- if (err == NO_ERROR) {
- LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
- (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
- err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
- }
-
- if (err != NO_ERROR) {
- if (reply) reply->setError(err);
- return (mLastError = err);
- }
-
- if ((flags & TF_ONE_WAY) == 0) {
- #if 0
- if (code == 4) { // relayout
- ALOGI(">>>>>> CALLING transaction 4");
- } else {
- ALOGI(">>>>>> CALLING transaction %d", code);
- }
- #endif
- if (reply) {
- err = waitForResponse(reply);
- } else {
- Parcel fakeReply;
- err = waitForResponse(&fakeReply);
- }
- #if 0
- if (code == 4) { // relayout
- ALOGI("<<<<<< RETURNING transaction 4");
- } else {
- ALOGI("<<<<<< RETURNING transaction %d", code);
- }
- #endif
-
- IF_LOG_TRANSACTIONS() {
- TextOutput::Bundle _b(alog);
- alog << "BR_REPLY thr " << (void*)pthread_self() << " / hand "
- << handle << ": ";
- if (reply) alog << indent << *reply << dedent << endl;
- else alog << "(none requested)" << endl;
- }
- } else {
- err = waitForResponse(NULL, NULL);
- }
-
- return err;
-}
-
-void IPCThreadState::incStrongHandle(int32_t handle)
-{
- LOG_REMOTEREFS("IPCThreadState::incStrongHandle(%d)\n", handle);
- mOut.writeInt32(BC_ACQUIRE);
- mOut.writeInt32(handle);
-}
-
-void IPCThreadState::decStrongHandle(int32_t handle)
-{
- LOG_REMOTEREFS("IPCThreadState::decStrongHandle(%d)\n", handle);
- mOut.writeInt32(BC_RELEASE);
- mOut.writeInt32(handle);
-}
-
-void IPCThreadState::incWeakHandle(int32_t handle)
-{
- LOG_REMOTEREFS("IPCThreadState::incWeakHandle(%d)\n", handle);
- mOut.writeInt32(BC_INCREFS);
- mOut.writeInt32(handle);
-}
-
-void IPCThreadState::decWeakHandle(int32_t handle)
-{
- LOG_REMOTEREFS("IPCThreadState::decWeakHandle(%d)\n", handle);
- mOut.writeInt32(BC_DECREFS);
- mOut.writeInt32(handle);
-}
-
-status_t IPCThreadState::attemptIncStrongHandle(int32_t handle)
-{
- LOG_REMOTEREFS("IPCThreadState::attemptIncStrongHandle(%d)\n", handle);
- mOut.writeInt32(BC_ATTEMPT_ACQUIRE);
- mOut.writeInt32(0); // xxx was thread priority
- mOut.writeInt32(handle);
- status_t result = UNKNOWN_ERROR;
-
- waitForResponse(NULL, &result);
-
-#if LOG_REFCOUNTS
- printf("IPCThreadState::attemptIncStrongHandle(%ld) = %s\n",
- handle, result == NO_ERROR ? "SUCCESS" : "FAILURE");
-#endif
-
- return result;
-}
-
-void IPCThreadState::expungeHandle(int32_t handle, IBinder* binder)
-{
-#if LOG_REFCOUNTS
- printf("IPCThreadState::expungeHandle(%ld)\n", handle);
-#endif
- self()->mProcess->expungeHandle(handle, binder);
-}
-
-status_t IPCThreadState::requestDeathNotification(int32_t handle, BpBinder* proxy)
-{
- mOut.writeInt32(BC_REQUEST_DEATH_NOTIFICATION);
- mOut.writeInt32((int32_t)handle);
- mOut.writeInt32((int32_t)proxy);
- return NO_ERROR;
-}
-
-status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy)
-{
- mOut.writeInt32(BC_CLEAR_DEATH_NOTIFICATION);
- mOut.writeInt32((int32_t)handle);
- mOut.writeInt32((int32_t)proxy);
- return NO_ERROR;
-}
-
-IPCThreadState::IPCThreadState()
- : mProcess(ProcessState::self()),
- mMyThreadId(androidGetTid()),
- mStrictModePolicy(0),
- mLastTransactionBinderFlags(0)
-{
- pthread_setspecific(gTLS, this);
- clearCaller();
- mOrigCallingUid = mCallingUid;
- mIn.setDataCapacity(256);
- mOut.setDataCapacity(256);
-}
-
-IPCThreadState::~IPCThreadState()
-{
-}
-
-status_t IPCThreadState::sendReply(const Parcel& reply, uint32_t flags)
-{
- status_t err;
- status_t statusBuffer;
- err = writeTransactionData(BC_REPLY, flags, -1, 0, reply, &statusBuffer);
- if (err < NO_ERROR) return err;
-
- return waitForResponse(NULL, NULL);
-}
-
-status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
-{
- int32_t cmd;
- int32_t err;
-
- while (1) {
- if ((err=talkWithDriver()) < NO_ERROR) break;
- err = mIn.errorCheck();
- if (err < NO_ERROR) break;
- if (mIn.dataAvail() == 0) continue;
-
- cmd = mIn.readInt32();
-
- IF_LOG_COMMANDS() {
- alog << "Processing waitForResponse Command: "
- << getReturnString(cmd) << endl;
- }
-
- switch (cmd) {
- case BR_TRANSACTION_COMPLETE:
- if (!reply && !acquireResult) goto finish;
- break;
-
- case BR_DEAD_REPLY:
- err = DEAD_OBJECT;
- goto finish;
-
- case BR_FAILED_REPLY:
- err = FAILED_TRANSACTION;
- goto finish;
-
- case BR_ACQUIRE_RESULT:
- {
- ALOG_ASSERT(acquireResult != NULL, "Unexpected brACQUIRE_RESULT");
- const int32_t result = mIn.readInt32();
- if (!acquireResult) continue;
- *acquireResult = result ? NO_ERROR : INVALID_OPERATION;
- }
- goto finish;
-
- case BR_REPLY:
- {
- binder_transaction_data tr;
- err = mIn.read(&tr, sizeof(tr));
- ALOG_ASSERT(err == NO_ERROR, "Not enough command data for brREPLY");
- if (err != NO_ERROR) goto finish;
-
- if (reply) {
- if ((tr.flags & TF_STATUS_CODE) == 0) {
- reply->ipcSetDataReference(
- reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
- tr.data_size,
- reinterpret_cast<const size_t*>(tr.data.ptr.offsets),
- tr.offsets_size/sizeof(size_t),
- freeBuffer, this);
- } else {
- err = *static_cast<const status_t*>(tr.data.ptr.buffer);
- freeBuffer(NULL,
- reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
- tr.data_size,
- reinterpret_cast<const size_t*>(tr.data.ptr.offsets),
- tr.offsets_size/sizeof(size_t), this);
- }
- } else {
- freeBuffer(NULL,
- reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
- tr.data_size,
- reinterpret_cast<const size_t*>(tr.data.ptr.offsets),
- tr.offsets_size/sizeof(size_t), this);
- continue;
- }
- }
- goto finish;
-
- default:
- err = executeCommand(cmd);
- if (err != NO_ERROR) goto finish;
- break;
- }
- }
-
-finish:
- if (err != NO_ERROR) {
- if (acquireResult) *acquireResult = err;
- if (reply) reply->setError(err);
- mLastError = err;
- }
-
- return err;
-}
-
-status_t IPCThreadState::talkWithDriver(bool doReceive)
-{
- ALOG_ASSERT(mProcess->mDriverFD >= 0, "Binder driver is not opened");
-
- binder_write_read bwr;
-
- // Is the read buffer empty?
- const bool needRead = mIn.dataPosition() >= mIn.dataSize();
-
- // We don't want to write anything if we are still reading
- // from data left in the input buffer and the caller
- // has requested to read the next data.
- const size_t outAvail = (!doReceive || needRead) ? mOut.dataSize() : 0;
-
- bwr.write_size = outAvail;
- bwr.write_buffer = (long unsigned int)mOut.data();
-
- // This is what we'll read.
- if (doReceive && needRead) {
- bwr.read_size = mIn.dataCapacity();
- bwr.read_buffer = (long unsigned int)mIn.data();
- } else {
- bwr.read_size = 0;
- bwr.read_buffer = 0;
- }
-
- IF_LOG_COMMANDS() {
- TextOutput::Bundle _b(alog);
- if (outAvail != 0) {
- alog << "Sending commands to driver: " << indent;
- const void* cmds = (const void*)bwr.write_buffer;
- const void* end = ((const uint8_t*)cmds)+bwr.write_size;
- alog << HexDump(cmds, bwr.write_size) << endl;
- while (cmds < end) cmds = printCommand(alog, cmds);
- alog << dedent;
- }
- alog << "Size of receive buffer: " << bwr.read_size
- << ", needRead: " << needRead << ", doReceive: " << doReceive << endl;
- }
-
- // Return immediately if there is nothing to do.
- if ((bwr.write_size == 0) && (bwr.read_size == 0)) return NO_ERROR;
-
- bwr.write_consumed = 0;
- bwr.read_consumed = 0;
- status_t err;
- do {
- IF_LOG_COMMANDS() {
- alog << "About to read/write, write size = " << mOut.dataSize() << endl;
- }
-#if defined(HAVE_ANDROID_OS)
- if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0)
- err = NO_ERROR;
- else
- err = -errno;
-#else
- err = INVALID_OPERATION;
-#endif
- IF_LOG_COMMANDS() {
- alog << "Finished read/write, write size = " << mOut.dataSize() << endl;
- }
- } while (err == -EINTR);
-
- IF_LOG_COMMANDS() {
- alog << "Our err: " << (void*)err << ", write consumed: "
- << bwr.write_consumed << " (of " << mOut.dataSize()
- << "), read consumed: " << bwr.read_consumed << endl;
- }
-
- if (err >= NO_ERROR) {
- if (bwr.write_consumed > 0) {
- if (bwr.write_consumed < (ssize_t)mOut.dataSize())
- mOut.remove(0, bwr.write_consumed);
- else
- mOut.setDataSize(0);
- }
- if (bwr.read_consumed > 0) {
- mIn.setDataSize(bwr.read_consumed);
- mIn.setDataPosition(0);
- }
- IF_LOG_COMMANDS() {
- TextOutput::Bundle _b(alog);
- alog << "Remaining data size: " << mOut.dataSize() << endl;
- alog << "Received commands from driver: " << indent;
- const void* cmds = mIn.data();
- const void* end = mIn.data() + mIn.dataSize();
- alog << HexDump(cmds, mIn.dataSize()) << endl;
- while (cmds < end) cmds = printReturnCommand(alog, cmds);
- alog << dedent;
- }
- return NO_ERROR;
- }
-
- return err;
-}
-
-status_t IPCThreadState::writeTransactionData(int32_t cmd, uint32_t binderFlags,
- int32_t handle, uint32_t code, const Parcel& data, status_t* statusBuffer)
-{
- binder_transaction_data tr;
-
- tr.target.handle = handle;
- tr.code = code;
- tr.flags = binderFlags;
- tr.cookie = 0;
- tr.sender_pid = 0;
- tr.sender_euid = 0;
-
- const status_t err = data.errorCheck();
- if (err == NO_ERROR) {
- tr.data_size = data.ipcDataSize();
- tr.data.ptr.buffer = data.ipcData();
- tr.offsets_size = data.ipcObjectsCount()*sizeof(size_t);
- tr.data.ptr.offsets = data.ipcObjects();
- } else if (statusBuffer) {
- tr.flags |= TF_STATUS_CODE;
- *statusBuffer = err;
- tr.data_size = sizeof(status_t);
- tr.data.ptr.buffer = statusBuffer;
- tr.offsets_size = 0;
- tr.data.ptr.offsets = NULL;
- } else {
- return (mLastError = err);
- }
-
- mOut.writeInt32(cmd);
- mOut.write(&tr, sizeof(tr));
-
- return NO_ERROR;
-}
-
-sp<BBinder> the_context_object;
-
-void setTheContextObject(sp<BBinder> obj)
-{
- the_context_object = obj;
-}
-
-status_t IPCThreadState::executeCommand(int32_t cmd)
-{
- BBinder* obj;
- RefBase::weakref_type* refs;
- status_t result = NO_ERROR;
-
- switch (cmd) {
- case BR_ERROR:
- result = mIn.readInt32();
- break;
-
- case BR_OK:
- break;
-
- case BR_ACQUIRE:
- refs = (RefBase::weakref_type*)mIn.readInt32();
- obj = (BBinder*)mIn.readInt32();
- ALOG_ASSERT(refs->refBase() == obj,
- "BR_ACQUIRE: object %p does not match cookie %p (expected %p)",
- refs, obj, refs->refBase());
- obj->incStrong(mProcess.get());
- IF_LOG_REMOTEREFS() {
- LOG_REMOTEREFS("BR_ACQUIRE from driver on %p", obj);
- obj->printRefs();
- }
- mOut.writeInt32(BC_ACQUIRE_DONE);
- mOut.writeInt32((int32_t)refs);
- mOut.writeInt32((int32_t)obj);
- break;
-
- case BR_RELEASE:
- refs = (RefBase::weakref_type*)mIn.readInt32();
- obj = (BBinder*)mIn.readInt32();
- ALOG_ASSERT(refs->refBase() == obj,
- "BR_RELEASE: object %p does not match cookie %p (expected %p)",
- refs, obj, refs->refBase());
- IF_LOG_REMOTEREFS() {
- LOG_REMOTEREFS("BR_RELEASE from driver on %p", obj);
- obj->printRefs();
- }
- mPendingStrongDerefs.push(obj);
- break;
-
- case BR_INCREFS:
- refs = (RefBase::weakref_type*)mIn.readInt32();
- obj = (BBinder*)mIn.readInt32();
- refs->incWeak(mProcess.get());
- mOut.writeInt32(BC_INCREFS_DONE);
- mOut.writeInt32((int32_t)refs);
- mOut.writeInt32((int32_t)obj);
- break;
-
- case BR_DECREFS:
- refs = (RefBase::weakref_type*)mIn.readInt32();
- obj = (BBinder*)mIn.readInt32();
- // NOTE: This assertion is not valid, because the object may no
- // longer exist (thus the (BBinder*)cast above resulting in a different
- // memory address).
- //ALOG_ASSERT(refs->refBase() == obj,
- // "BR_DECREFS: object %p does not match cookie %p (expected %p)",
- // refs, obj, refs->refBase());
- mPendingWeakDerefs.push(refs);
- break;
-
- case BR_ATTEMPT_ACQUIRE:
- refs = (RefBase::weakref_type*)mIn.readInt32();
- obj = (BBinder*)mIn.readInt32();
-
- {
- const bool success = refs->attemptIncStrong(mProcess.get());
- ALOG_ASSERT(success && refs->refBase() == obj,
- "BR_ATTEMPT_ACQUIRE: object %p does not match cookie %p (expected %p)",
- refs, obj, refs->refBase());
-
- mOut.writeInt32(BC_ACQUIRE_RESULT);
- mOut.writeInt32((int32_t)success);
- }
- break;
-
- case BR_TRANSACTION:
- {
- binder_transaction_data tr;
- result = mIn.read(&tr, sizeof(tr));
- ALOG_ASSERT(result == NO_ERROR,
- "Not enough command data for brTRANSACTION");
- if (result != NO_ERROR) break;
-
- Parcel buffer;
- buffer.ipcSetDataReference(
- reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
- tr.data_size,
- reinterpret_cast<const size_t*>(tr.data.ptr.offsets),
- tr.offsets_size/sizeof(size_t), freeBuffer, this);
-
- const pid_t origPid = mCallingPid;
- const uid_t origUid = mCallingUid;
-
- mCallingPid = tr.sender_pid;
- mCallingUid = tr.sender_euid;
- mOrigCallingUid = tr.sender_euid;
-
- int curPrio = getpriority(PRIO_PROCESS, mMyThreadId);
- if (gDisableBackgroundScheduling) {
- if (curPrio > ANDROID_PRIORITY_NORMAL) {
- // We have inherited a reduced priority from the caller, but do not
- // want to run in that state in this process. The driver set our
- // priority already (though not our scheduling class), so bounce
- // it back to the default before invoking the transaction.
- setpriority(PRIO_PROCESS, mMyThreadId, ANDROID_PRIORITY_NORMAL);
- }
- } else {
- if (curPrio >= ANDROID_PRIORITY_BACKGROUND) {
- // We want to use the inherited priority from the caller.
- // Ensure this thread is in the background scheduling class,
- // since the driver won't modify scheduling classes for us.
- // The scheduling group is reset to default by the caller
- // once this method returns after the transaction is complete.
- androidSetThreadSchedulingGroup(mMyThreadId,
- ANDROID_TGROUP_BG_NONINTERACT);
- }
- }
-
- //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid);
-
- Parcel reply;
- IF_LOG_TRANSACTIONS() {
- TextOutput::Bundle _b(alog);
- alog << "BR_TRANSACTION thr " << (void*)pthread_self()
- << " / obj " << tr.target.ptr << " / code "
- << TypeCode(tr.code) << ": " << indent << buffer
- << dedent << endl
- << "Data addr = "
- << reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer)
- << ", offsets addr="
- << reinterpret_cast<const size_t*>(tr.data.ptr.offsets) << endl;
- }
- if (tr.target.ptr) {
- sp<BBinder> b((BBinder*)tr.cookie);
- const status_t error = b->transact(tr.code, buffer, &reply, tr.flags);
- if (error < NO_ERROR) reply.setError(error);
-
- } else {
- const status_t error = the_context_object->transact(tr.code, buffer, &reply, tr.flags);
- if (error < NO_ERROR) reply.setError(error);
- }
-
- //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n",
- // mCallingPid, origPid, origUid);
-
- if ((tr.flags & TF_ONE_WAY) == 0) {
- LOG_ONEWAY("Sending reply to %d!", mCallingPid);
- sendReply(reply, 0);
- } else {
- LOG_ONEWAY("NOT sending reply to %d!", mCallingPid);
- }
-
- mCallingPid = origPid;
- mCallingUid = origUid;
- mOrigCallingUid = origUid;
-
- IF_LOG_TRANSACTIONS() {
- TextOutput::Bundle _b(alog);
- alog << "BC_REPLY thr " << (void*)pthread_self() << " / obj "
- << tr.target.ptr << ": " << indent << reply << dedent << endl;
- }
-
- }
- break;
-
- case BR_DEAD_BINDER:
- {
- BpBinder *proxy = (BpBinder*)mIn.readInt32();
- proxy->sendObituary();
- mOut.writeInt32(BC_DEAD_BINDER_DONE);
- mOut.writeInt32((int32_t)proxy);
- } break;
-
- case BR_CLEAR_DEATH_NOTIFICATION_DONE:
- {
- BpBinder *proxy = (BpBinder*)mIn.readInt32();
- proxy->getWeakRefs()->decWeak(proxy);
- } break;
-
- case BR_FINISHED:
- result = TIMED_OUT;
- break;
-
- case BR_NOOP:
- break;
-
- case BR_SPAWN_LOOPER:
- mProcess->spawnPooledThread(false);
- break;
-
- default:
- printf("*** BAD COMMAND %d received from Binder driver\n", cmd);
- result = UNKNOWN_ERROR;
- break;
- }
-
- if (result != NO_ERROR) {
- mLastError = result;
- }
-
- return result;
-}
-
-void IPCThreadState::threadDestructor(void *st)
-{
- IPCThreadState* const self = static_cast<IPCThreadState*>(st);
- if (self) {
- self->flushCommands();
-#if defined(HAVE_ANDROID_OS)
- ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0);
-#endif
- delete self;
- }
-}
-
-
-void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsSize,
- void* cookie)
-{
- //ALOGI("Freeing parcel %p", &parcel);
- IF_LOG_COMMANDS() {
- alog << "Writing BC_FREE_BUFFER for " << data << endl;
- }
- ALOG_ASSERT(data != NULL, "Called with NULL data");
- if (parcel != NULL) parcel->closeFileDescriptors();
- IPCThreadState* state = self();
- state->mOut.writeInt32(BC_FREE_BUFFER);
- state->mOut.writeInt32((int32_t)data);
-}
-
-}; // namespace android
diff --git a/libs/binder/IPermissionController.cpp b/libs/binder/IPermissionController.cpp
deleted file mode 100644
index e13036f..0000000
--- a/libs/binder/IPermissionController.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "PermissionController"
-
-#include <binder/IPermissionController.h>
-
-#include <utils/Debug.h>
-#include <utils/Log.h>
-#include <binder/Parcel.h>
-#include <utils/String8.h>
-
-#include <private/binder/Static.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class BpPermissionController : public BpInterface<IPermissionController>
-{
-public:
- BpPermissionController(const sp<IBinder>& impl)
- : BpInterface<IPermissionController>(impl)
- {
- }
-
- virtual bool checkPermission(const String16& permission, int32_t pid, int32_t uid)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IPermissionController::getInterfaceDescriptor());
- data.writeString16(permission);
- data.writeInt32(pid);
- data.writeInt32(uid);
- remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply);
- // fail on exception
- if (reply.readExceptionCode() != 0) return 0;
- return reply.readInt32() != 0;
- }
-};
-
-IMPLEMENT_META_INTERFACE(PermissionController, "android.os.IPermissionController");
-
-// ----------------------------------------------------------------------
-
-status_t BnPermissionController::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- //printf("PermissionController received: "); data.print();
- switch(code) {
- case CHECK_PERMISSION_TRANSACTION: {
- CHECK_INTERFACE(IPermissionController, data, reply);
- String16 permission = data.readString16();
- int32_t pid = data.readInt32();
- int32_t uid = data.readInt32();
- bool res = checkPermission(permission, pid, uid);
- reply->writeNoException();
- reply->writeInt32(res ? 1 : 0);
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-}; // namespace android
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
deleted file mode 100644
index 1750640..0000000
--- a/libs/binder/IServiceManager.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "ServiceManager"
-
-#include <binder/IServiceManager.h>
-
-#include <utils/Debug.h>
-#include <utils/Log.h>
-#include <binder/IPCThreadState.h>
-#include <binder/Parcel.h>
-#include <utils/String8.h>
-#include <utils/SystemClock.h>
-
-#include <private/binder/Static.h>
-
-#include <unistd.h>
-
-namespace android {
-
-sp<IServiceManager> defaultServiceManager()
-{
- if (gDefaultServiceManager != NULL) return gDefaultServiceManager;
-
- {
- AutoMutex _l(gDefaultServiceManagerLock);
- if (gDefaultServiceManager == NULL) {
- gDefaultServiceManager = interface_cast<IServiceManager>(
- ProcessState::self()->getContextObject(NULL));
- }
- }
-
- return gDefaultServiceManager;
-}
-
-bool checkCallingPermission(const String16& permission)
-{
- return checkCallingPermission(permission, NULL, NULL);
-}
-
-static String16 _permission("permission");
-
-
-bool checkCallingPermission(const String16& permission, int32_t* outPid, int32_t* outUid)
-{
- IPCThreadState* ipcState = IPCThreadState::self();
- pid_t pid = ipcState->getCallingPid();
- uid_t uid = ipcState->getCallingUid();
- if (outPid) *outPid = pid;
- if (outUid) *outUid = uid;
- return checkPermission(permission, pid, uid);
-}
-
-bool checkPermission(const String16& permission, pid_t pid, uid_t uid)
-{
- sp<IPermissionController> pc;
- gDefaultServiceManagerLock.lock();
- pc = gPermissionController;
- gDefaultServiceManagerLock.unlock();
-
- int64_t startTime = 0;
-
- while (true) {
- if (pc != NULL) {
- bool res = pc->checkPermission(permission, pid, uid);
- if (res) {
- if (startTime != 0) {
- ALOGI("Check passed after %d seconds for %s from uid=%d pid=%d",
- (int)((uptimeMillis()-startTime)/1000),
- String8(permission).string(), uid, pid);
- }
- return res;
- }
-
- // Is this a permission failure, or did the controller go away?
- if (pc->asBinder()->isBinderAlive()) {
- ALOGW("Permission failure: %s from uid=%d pid=%d",
- String8(permission).string(), uid, pid);
- return false;
- }
-
- // Object is dead!
- gDefaultServiceManagerLock.lock();
- if (gPermissionController == pc) {
- gPermissionController = NULL;
- }
- gDefaultServiceManagerLock.unlock();
- }
-
- // Need to retrieve the permission controller.
- sp<IBinder> binder = defaultServiceManager()->checkService(_permission);
- if (binder == NULL) {
- // Wait for the permission controller to come back...
- if (startTime == 0) {
- startTime = uptimeMillis();
- ALOGI("Waiting to check permission %s from uid=%d pid=%d",
- String8(permission).string(), uid, pid);
- }
- sleep(1);
- } else {
- pc = interface_cast<IPermissionController>(binder);
- // Install the new permission controller, and try again.
- gDefaultServiceManagerLock.lock();
- gPermissionController = pc;
- gDefaultServiceManagerLock.unlock();
- }
- }
-}
-
-// ----------------------------------------------------------------------
-
-class BpServiceManager : public BpInterface<IServiceManager>
-{
-public:
- BpServiceManager(const sp<IBinder>& impl)
- : BpInterface<IServiceManager>(impl)
- {
- }
-
- virtual sp<IBinder> getService(const String16& name) const
- {
- unsigned n;
- for (n = 0; n < 5; n++){
- sp<IBinder> svc = checkService(name);
- if (svc != NULL) return svc;
- ALOGI("Waiting for service %s...\n", String8(name).string());
- sleep(1);
- }
- return NULL;
- }
-
- virtual sp<IBinder> checkService( const String16& name) const
- {
- Parcel data, reply;
- data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor());
- data.writeString16(name);
- remote()->transact(CHECK_SERVICE_TRANSACTION, data, &reply);
- return reply.readStrongBinder();
- }
-
- virtual status_t addService(const String16& name, const sp<IBinder>& service,
- bool allowIsolated)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor());
- data.writeString16(name);
- data.writeStrongBinder(service);
- data.writeInt32(allowIsolated ? 1 : 0);
- status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply);
- return err == NO_ERROR ? reply.readExceptionCode() : err;
- }
-
- virtual Vector<String16> listServices()
- {
- Vector<String16> res;
- int n = 0;
-
- for (;;) {
- Parcel data, reply;
- data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor());
- data.writeInt32(n++);
- status_t err = remote()->transact(LIST_SERVICES_TRANSACTION, data, &reply);
- if (err != NO_ERROR)
- break;
- res.add(reply.readString16());
- }
- return res;
- }
-};
-
-IMPLEMENT_META_INTERFACE(ServiceManager, "android.os.IServiceManager");
-
-// ----------------------------------------------------------------------
-
-status_t BnServiceManager::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- //printf("ServiceManager received: "); data.print();
- switch(code) {
- case GET_SERVICE_TRANSACTION: {
- CHECK_INTERFACE(IServiceManager, data, reply);
- String16 which = data.readString16();
- sp<IBinder> b = const_cast<BnServiceManager*>(this)->getService(which);
- reply->writeStrongBinder(b);
- return NO_ERROR;
- } break;
- case CHECK_SERVICE_TRANSACTION: {
- CHECK_INTERFACE(IServiceManager, data, reply);
- String16 which = data.readString16();
- sp<IBinder> b = const_cast<BnServiceManager*>(this)->checkService(which);
- reply->writeStrongBinder(b);
- return NO_ERROR;
- } break;
- case ADD_SERVICE_TRANSACTION: {
- CHECK_INTERFACE(IServiceManager, data, reply);
- String16 which = data.readString16();
- sp<IBinder> b = data.readStrongBinder();
- status_t err = addService(which, b);
- reply->writeInt32(err);
- return NO_ERROR;
- } break;
- case LIST_SERVICES_TRANSACTION: {
- CHECK_INTERFACE(IServiceManager, data, reply);
- Vector<String16> list = listServices();
- const size_t N = list.size();
- reply->writeInt32(N);
- for (size_t i=0; i<N; i++) {
- reply->writeString16(list[i]);
- }
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-}; // namespace android
diff --git a/libs/binder/MemoryBase.cpp b/libs/binder/MemoryBase.cpp
deleted file mode 100644
index 033066b..0000000
--- a/libs/binder/MemoryBase.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-#include <stdlib.h>
-#include <stdint.h>
-
-#include <binder/MemoryBase.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-MemoryBase::MemoryBase(const sp<IMemoryHeap>& heap,
- ssize_t offset, size_t size)
- : mSize(size), mOffset(offset), mHeap(heap)
-{
-}
-
-sp<IMemoryHeap> MemoryBase::getMemory(ssize_t* offset, size_t* size) const
-{
- if (offset) *offset = mOffset;
- if (size) *size = mSize;
- return mHeap;
-}
-
-MemoryBase::~MemoryBase()
-{
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp
deleted file mode 100644
index 8d0e0a7..0000000
--- a/libs/binder/MemoryDealer.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "MemoryDealer"
-
-#include <binder/MemoryDealer.h>
-#include <binder/IPCThreadState.h>
-#include <binder/MemoryBase.h>
-
-#include <utils/Log.h>
-#include <utils/SortedVector.h>
-#include <utils/String8.h>
-#include <utils/threads.h>
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/file.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-/*
- * A simple templatized doubly linked-list implementation
- */
-
-template <typename NODE>
-class LinkedList
-{
- NODE* mFirst;
- NODE* mLast;
-
-public:
- LinkedList() : mFirst(0), mLast(0) { }
- bool isEmpty() const { return mFirst == 0; }
- NODE const* head() const { return mFirst; }
- NODE* head() { return mFirst; }
- NODE const* tail() const { return mLast; }
- NODE* tail() { return mLast; }
-
- void insertAfter(NODE* node, NODE* newNode) {
- newNode->prev = node;
- newNode->next = node->next;
- if (node->next == 0) mLast = newNode;
- else node->next->prev = newNode;
- node->next = newNode;
- }
-
- void insertBefore(NODE* node, NODE* newNode) {
- newNode->prev = node->prev;
- newNode->next = node;
- if (node->prev == 0) mFirst = newNode;
- else node->prev->next = newNode;
- node->prev = newNode;
- }
-
- void insertHead(NODE* newNode) {
- if (mFirst == 0) {
- mFirst = mLast = newNode;
- newNode->prev = newNode->next = 0;
- } else {
- newNode->prev = 0;
- newNode->next = mFirst;
- mFirst->prev = newNode;
- mFirst = newNode;
- }
- }
-
- void insertTail(NODE* newNode) {
- if (mLast == 0) {
- insertHead(newNode);
- } else {
- newNode->prev = mLast;
- newNode->next = 0;
- mLast->next = newNode;
- mLast = newNode;
- }
- }
-
- NODE* remove(NODE* node) {
- if (node->prev == 0) mFirst = node->next;
- else node->prev->next = node->next;
- if (node->next == 0) mLast = node->prev;
- else node->next->prev = node->prev;
- return node;
- }
-};
-
-// ----------------------------------------------------------------------------
-
-class Allocation : public MemoryBase {
-public:
- Allocation(const sp<MemoryDealer>& dealer,
- const sp<IMemoryHeap>& heap, ssize_t offset, size_t size);
- virtual ~Allocation();
-private:
- sp<MemoryDealer> mDealer;
-};
-
-// ----------------------------------------------------------------------------
-
-class SimpleBestFitAllocator
-{
- enum {
- PAGE_ALIGNED = 0x00000001
- };
-public:
- SimpleBestFitAllocator(size_t size);
- ~SimpleBestFitAllocator();
-
- size_t allocate(size_t size, uint32_t flags = 0);
- status_t deallocate(size_t offset);
- size_t size() const;
- void dump(const char* what) const;
- void dump(String8& res, const char* what) const;
-
-private:
-
- struct chunk_t {
- chunk_t(size_t start, size_t size)
- : start(start), size(size), free(1), prev(0), next(0) {
- }
- size_t start;
- size_t size : 28;
- int free : 4;
- mutable chunk_t* prev;
- mutable chunk_t* next;
- };
-
- ssize_t alloc(size_t size, uint32_t flags);
- chunk_t* dealloc(size_t start);
- void dump_l(const char* what) const;
- void dump_l(String8& res, const char* what) const;
-
- static const int kMemoryAlign;
- mutable Mutex mLock;
- LinkedList<chunk_t> mList;
- size_t mHeapSize;
-};
-
-// ----------------------------------------------------------------------------
-
-Allocation::Allocation(
- const sp<MemoryDealer>& dealer,
- const sp<IMemoryHeap>& heap, ssize_t offset, size_t size)
- : MemoryBase(heap, offset, size), mDealer(dealer)
-{
-#ifndef NDEBUG
- void* const start_ptr = (void*)(intptr_t(heap->base()) + offset);
- memset(start_ptr, 0xda, size);
-#endif
-}
-
-Allocation::~Allocation()
-{
- size_t freedOffset = getOffset();
- size_t freedSize = getSize();
- if (freedSize) {
- /* NOTE: it's VERY important to not free allocations of size 0 because
- * they're special as they don't have any record in the allocator
- * and could alias some real allocation (their offset is zero). */
-
- // keep the size to unmap in excess
- size_t pagesize = getpagesize();
- size_t start = freedOffset;
- size_t end = start + freedSize;
- start &= ~(pagesize-1);
- end = (end + pagesize-1) & ~(pagesize-1);
-
- // give back to the kernel the pages we don't need
- size_t free_start = freedOffset;
- size_t free_end = free_start + freedSize;
- if (start < free_start)
- start = free_start;
- if (end > free_end)
- end = free_end;
- start = (start + pagesize-1) & ~(pagesize-1);
- end &= ~(pagesize-1);
-
- if (start < end) {
- void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + start);
- size_t size = end-start;
-
-#ifndef NDEBUG
- memset(start_ptr, 0xdf, size);
-#endif
-
- // MADV_REMOVE is not defined on Dapper based Goobuntu
-#ifdef MADV_REMOVE
- if (size) {
- int err = madvise(start_ptr, size, MADV_REMOVE);
- ALOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s",
- start_ptr, size, err<0 ? strerror(errno) : "Ok");
- }
-#endif
- }
-
- // This should be done after madvise(MADV_REMOVE), otherwise madvise()
- // might kick out the memory region that's allocated and/or written
- // right after the deallocation.
- mDealer->deallocate(freedOffset);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-MemoryDealer::MemoryDealer(size_t size, const char* name)
- : mHeap(new MemoryHeapBase(size, 0, name)),
- mAllocator(new SimpleBestFitAllocator(size))
-{
-}
-
-MemoryDealer::~MemoryDealer()
-{
- delete mAllocator;
-}
-
-sp<IMemory> MemoryDealer::allocate(size_t size)
-{
- sp<IMemory> memory;
- const ssize_t offset = allocator()->allocate(size);
- if (offset >= 0) {
- memory = new Allocation(this, heap(), offset, size);
- }
- return memory;
-}
-
-void MemoryDealer::deallocate(size_t offset)
-{
- allocator()->deallocate(offset);
-}
-
-void MemoryDealer::dump(const char* what) const
-{
- allocator()->dump(what);
-}
-
-const sp<IMemoryHeap>& MemoryDealer::heap() const {
- return mHeap;
-}
-
-SimpleBestFitAllocator* MemoryDealer::allocator() const {
- return mAllocator;
-}
-
-// ----------------------------------------------------------------------------
-
-// align all the memory blocks on a cache-line boundary
-const int SimpleBestFitAllocator::kMemoryAlign = 32;
-
-SimpleBestFitAllocator::SimpleBestFitAllocator(size_t size)
-{
- size_t pagesize = getpagesize();
- mHeapSize = ((size + pagesize-1) & ~(pagesize-1));
-
- chunk_t* node = new chunk_t(0, mHeapSize / kMemoryAlign);
- mList.insertHead(node);
-}
-
-SimpleBestFitAllocator::~SimpleBestFitAllocator()
-{
- while(!mList.isEmpty()) {
- delete mList.remove(mList.head());
- }
-}
-
-size_t SimpleBestFitAllocator::size() const
-{
- return mHeapSize;
-}
-
-size_t SimpleBestFitAllocator::allocate(size_t size, uint32_t flags)
-{
- Mutex::Autolock _l(mLock);
- ssize_t offset = alloc(size, flags);
- return offset;
-}
-
-status_t SimpleBestFitAllocator::deallocate(size_t offset)
-{
- Mutex::Autolock _l(mLock);
- chunk_t const * const freed = dealloc(offset);
- if (freed) {
- return NO_ERROR;
- }
- return NAME_NOT_FOUND;
-}
-
-ssize_t SimpleBestFitAllocator::alloc(size_t size, uint32_t flags)
-{
- if (size == 0) {
- return 0;
- }
- size = (size + kMemoryAlign-1) / kMemoryAlign;
- chunk_t* free_chunk = 0;
- chunk_t* cur = mList.head();
-
- size_t pagesize = getpagesize();
- while (cur) {
- int extra = 0;
- if (flags & PAGE_ALIGNED)
- extra = ( -cur->start & ((pagesize/kMemoryAlign)-1) ) ;
-
- // best fit
- if (cur->free && (cur->size >= (size+extra))) {
- if ((!free_chunk) || (cur->size < free_chunk->size)) {
- free_chunk = cur;
- }
- if (cur->size == size) {
- break;
- }
- }
- cur = cur->next;
- }
-
- if (free_chunk) {
- const size_t free_size = free_chunk->size;
- free_chunk->free = 0;
- free_chunk->size = size;
- if (free_size > size) {
- int extra = 0;
- if (flags & PAGE_ALIGNED)
- extra = ( -free_chunk->start & ((pagesize/kMemoryAlign)-1) ) ;
- if (extra) {
- chunk_t* split = new chunk_t(free_chunk->start, extra);
- free_chunk->start += extra;
- mList.insertBefore(free_chunk, split);
- }
-
- ALOGE_IF((flags&PAGE_ALIGNED) &&
- ((free_chunk->start*kMemoryAlign)&(pagesize-1)),
- "PAGE_ALIGNED requested, but page is not aligned!!!");
-
- const ssize_t tail_free = free_size - (size+extra);
- if (tail_free > 0) {
- chunk_t* split = new chunk_t(
- free_chunk->start + free_chunk->size, tail_free);
- mList.insertAfter(free_chunk, split);
- }
- }
- return (free_chunk->start)*kMemoryAlign;
- }
- return NO_MEMORY;
-}
-
-SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start)
-{
- start = start / kMemoryAlign;
- chunk_t* cur = mList.head();
- while (cur) {
- if (cur->start == start) {
- LOG_FATAL_IF(cur->free,
- "block at offset 0x%08lX of size 0x%08lX already freed",
- cur->start*kMemoryAlign, cur->size*kMemoryAlign);
-
- // merge freed blocks together
- chunk_t* freed = cur;
- cur->free = 1;
- do {
- chunk_t* const p = cur->prev;
- chunk_t* const n = cur->next;
- if (p && (p->free || !cur->size)) {
- freed = p;
- p->size += cur->size;
- mList.remove(cur);
- delete cur;
- }
- cur = n;
- } while (cur && cur->free);
-
- #ifndef NDEBUG
- if (!freed->free) {
- dump_l("dealloc (!freed->free)");
- }
- #endif
- LOG_FATAL_IF(!freed->free,
- "freed block at offset 0x%08lX of size 0x%08lX is not free!",
- freed->start * kMemoryAlign, freed->size * kMemoryAlign);
-
- return freed;
- }
- cur = cur->next;
- }
- return 0;
-}
-
-void SimpleBestFitAllocator::dump(const char* what) const
-{
- Mutex::Autolock _l(mLock);
- dump_l(what);
-}
-
-void SimpleBestFitAllocator::dump_l(const char* what) const
-{
- String8 result;
- dump_l(result, what);
- ALOGD("%s", result.string());
-}
-
-void SimpleBestFitAllocator::dump(String8& result,
- const char* what) const
-{
- Mutex::Autolock _l(mLock);
- dump_l(result, what);
-}
-
-void SimpleBestFitAllocator::dump_l(String8& result,
- const char* what) const
-{
- size_t size = 0;
- int32_t i = 0;
- chunk_t const* cur = mList.head();
-
- const size_t SIZE = 256;
- char buffer[SIZE];
- snprintf(buffer, SIZE, " %s (%p, size=%u)\n",
- what, this, (unsigned int)mHeapSize);
-
- result.append(buffer);
-
- while (cur) {
- const char* errs[] = {"", "| link bogus NP",
- "| link bogus PN", "| link bogus NP+PN" };
- int np = ((cur->next) && cur->next->prev != cur) ? 1 : 0;
- int pn = ((cur->prev) && cur->prev->next != cur) ? 2 : 0;
-
- snprintf(buffer, SIZE, " %3u: %08x | 0x%08X | 0x%08X | %s %s\n",
- i, int(cur), int(cur->start*kMemoryAlign),
- int(cur->size*kMemoryAlign),
- int(cur->free) ? "F" : "A",
- errs[np|pn]);
-
- result.append(buffer);
-
- if (!cur->free)
- size += cur->size*kMemoryAlign;
-
- i++;
- cur = cur->next;
- }
- snprintf(buffer, SIZE,
- " size allocated: %u (%u KB)\n", int(size), int(size/1024));
- result.append(buffer);
-}
-
-
-}; // namespace android
diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp
deleted file mode 100644
index d1cbf1c..0000000
--- a/libs/binder/MemoryHeapBase.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "MemoryHeapBase"
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-
-#include <cutils/log.h>
-#include <cutils/ashmem.h>
-#include <cutils/atomic.h>
-
-#include <binder/MemoryHeapBase.h>
-
-#ifdef HAVE_ANDROID_OS
-#include <linux/android_pmem.h>
-#endif
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-MemoryHeapBase::MemoryHeapBase()
- : mFD(-1), mSize(0), mBase(MAP_FAILED),
- mDevice(NULL), mNeedUnmap(false), mOffset(0)
-{
-}
-
-MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name)
- : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
- mDevice(0), mNeedUnmap(false), mOffset(0)
-{
- const size_t pagesize = getpagesize();
- size = ((size + pagesize-1) & ~(pagesize-1));
- int fd = ashmem_create_region(name == NULL ? "MemoryHeapBase" : name, size);
- ALOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno));
- if (fd >= 0) {
- if (mapfd(fd, size) == NO_ERROR) {
- if (flags & READ_ONLY) {
- ashmem_set_prot_region(fd, PROT_READ);
- }
- }
- }
-}
-
-MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags)
- : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
- mDevice(0), mNeedUnmap(false), mOffset(0)
-{
- int open_flags = O_RDWR;
- if (flags & NO_CACHING)
- open_flags |= O_SYNC;
-
- int fd = open(device, open_flags);
- ALOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno));
- if (fd >= 0) {
- const size_t pagesize = getpagesize();
- size = ((size + pagesize-1) & ~(pagesize-1));
- if (mapfd(fd, size) == NO_ERROR) {
- mDevice = device;
- }
- }
-}
-
-MemoryHeapBase::MemoryHeapBase(int fd, size_t size, uint32_t flags, uint32_t offset)
- : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
- mDevice(0), mNeedUnmap(false), mOffset(0)
-{
- const size_t pagesize = getpagesize();
- size = ((size + pagesize-1) & ~(pagesize-1));
- mapfd(dup(fd), size, offset);
-}
-
-status_t MemoryHeapBase::init(int fd, void *base, int size, int flags, const char* device)
-{
- if (mFD != -1) {
- return INVALID_OPERATION;
- }
- mFD = fd;
- mBase = base;
- mSize = size;
- mFlags = flags;
- mDevice = device;
- return NO_ERROR;
-}
-
-status_t MemoryHeapBase::mapfd(int fd, size_t size, uint32_t offset)
-{
- if (size == 0) {
- // try to figure out the size automatically
-#ifdef HAVE_ANDROID_OS
- // first try the PMEM ioctl
- pmem_region reg;
- int err = ioctl(fd, PMEM_GET_TOTAL_SIZE, ®);
- if (err == 0)
- size = reg.len;
-#endif
- if (size == 0) { // try fstat
- struct stat sb;
- if (fstat(fd, &sb) == 0)
- size = sb.st_size;
- }
- // if it didn't work, let mmap() fail.
- }
-
- if ((mFlags & DONT_MAP_LOCALLY) == 0) {
- void* base = (uint8_t*)mmap(0, size,
- PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset);
- if (base == MAP_FAILED) {
- ALOGE("mmap(fd=%d, size=%u) failed (%s)",
- fd, uint32_t(size), strerror(errno));
- close(fd);
- return -errno;
- }
- //ALOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size);
- mBase = base;
- mNeedUnmap = true;
- } else {
- mBase = 0; // not MAP_FAILED
- mNeedUnmap = false;
- }
- mFD = fd;
- mSize = size;
- mOffset = offset;
- return NO_ERROR;
-}
-
-MemoryHeapBase::~MemoryHeapBase()
-{
- dispose();
-}
-
-void MemoryHeapBase::dispose()
-{
- int fd = android_atomic_or(-1, &mFD);
- if (fd >= 0) {
- if (mNeedUnmap) {
- //ALOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize);
- munmap(mBase, mSize);
- }
- mBase = 0;
- mSize = 0;
- close(fd);
- }
-}
-
-int MemoryHeapBase::getHeapID() const {
- return mFD;
-}
-
-void* MemoryHeapBase::getBase() const {
- return mBase;
-}
-
-size_t MemoryHeapBase::getSize() const {
- return mSize;
-}
-
-uint32_t MemoryHeapBase::getFlags() const {
- return mFlags;
-}
-
-const char* MemoryHeapBase::getDevice() const {
- return mDevice;
-}
-
-uint32_t MemoryHeapBase::getOffset() const {
- return mOffset;
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
deleted file mode 100644
index dea14bb..0000000
--- a/libs/binder/Parcel.cpp
+++ /dev/null
@@ -1,1590 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Parcel"
-//#define LOG_NDEBUG 0
-
-#include <binder/Parcel.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/Binder.h>
-#include <binder/BpBinder.h>
-#include <utils/Debug.h>
-#include <binder/ProcessState.h>
-#include <utils/Log.h>
-#include <utils/String8.h>
-#include <utils/String16.h>
-#include <utils/TextOutput.h>
-#include <utils/misc.h>
-#include <utils/Flattenable.h>
-#include <cutils/ashmem.h>
-
-#include <private/binder/binder_module.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/mman.h>
-
-#ifndef INT32_MAX
-#define INT32_MAX ((int32_t)(2147483647))
-#endif
-
-#define LOG_REFS(...)
-//#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__)
-
-// ---------------------------------------------------------------------------
-
-#define PAD_SIZE(s) (((s)+3)&~3)
-
-// Note: must be kept in sync with android/os/StrictMode.java's PENALTY_GATHER
-#define STRICT_MODE_PENALTY_GATHER 0x100
-
-// Note: must be kept in sync with android/os/Parcel.java's EX_HAS_REPLY_HEADER
-#define EX_HAS_REPLY_HEADER -128
-
-// Maximum size of a blob to transfer in-place.
-static const size_t IN_PLACE_BLOB_LIMIT = 40 * 1024;
-
-// XXX This can be made public if we want to provide
-// support for typed data.
-struct small_flat_data
-{
- uint32_t type;
- uint32_t data;
-};
-
-namespace android {
-
-void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who)
-{
- switch (obj.type) {
- case BINDER_TYPE_BINDER:
- if (obj.binder) {
- LOG_REFS("Parcel %p acquiring reference on local %p", who, obj.cookie);
- static_cast<IBinder*>(obj.cookie)->incStrong(who);
- }
- return;
- case BINDER_TYPE_WEAK_BINDER:
- if (obj.binder)
- static_cast<RefBase::weakref_type*>(obj.binder)->incWeak(who);
- return;
- case BINDER_TYPE_HANDLE: {
- const sp<IBinder> b = proc->getStrongProxyForHandle(obj.handle);
- if (b != NULL) {
- LOG_REFS("Parcel %p acquiring reference on remote %p", who, b.get());
- b->incStrong(who);
- }
- return;
- }
- case BINDER_TYPE_WEAK_HANDLE: {
- const wp<IBinder> b = proc->getWeakProxyForHandle(obj.handle);
- if (b != NULL) b.get_refs()->incWeak(who);
- return;
- }
- case BINDER_TYPE_FD: {
- // intentionally blank -- nothing to do to acquire this, but we do
- // recognize it as a legitimate object type.
- return;
- }
- }
-
- ALOGD("Invalid object type 0x%08lx", obj.type);
-}
-
-void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who)
-{
- switch (obj.type) {
- case BINDER_TYPE_BINDER:
- if (obj.binder) {
- LOG_REFS("Parcel %p releasing reference on local %p", who, obj.cookie);
- static_cast<IBinder*>(obj.cookie)->decStrong(who);
- }
- return;
- case BINDER_TYPE_WEAK_BINDER:
- if (obj.binder)
- static_cast<RefBase::weakref_type*>(obj.binder)->decWeak(who);
- return;
- case BINDER_TYPE_HANDLE: {
- const sp<IBinder> b = proc->getStrongProxyForHandle(obj.handle);
- if (b != NULL) {
- LOG_REFS("Parcel %p releasing reference on remote %p", who, b.get());
- b->decStrong(who);
- }
- return;
- }
- case BINDER_TYPE_WEAK_HANDLE: {
- const wp<IBinder> b = proc->getWeakProxyForHandle(obj.handle);
- if (b != NULL) b.get_refs()->decWeak(who);
- return;
- }
- case BINDER_TYPE_FD: {
- if (obj.cookie != (void*)0) close(obj.handle);
- return;
- }
- }
-
- ALOGE("Invalid object type 0x%08lx", obj.type);
-}
-
-inline static status_t finish_flatten_binder(
- const sp<IBinder>& binder, const flat_binder_object& flat, Parcel* out)
-{
- return out->writeObject(flat, false);
-}
-
-status_t flatten_binder(const sp<ProcessState>& proc,
- const sp<IBinder>& binder, Parcel* out)
-{
- flat_binder_object obj;
-
- obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
- if (binder != NULL) {
- IBinder *local = binder->localBinder();
- if (!local) {
- BpBinder *proxy = binder->remoteBinder();
- if (proxy == NULL) {
- ALOGE("null proxy");
- }
- const int32_t handle = proxy ? proxy->handle() : 0;
- obj.type = BINDER_TYPE_HANDLE;
- obj.handle = handle;
- obj.cookie = NULL;
- } else {
- obj.type = BINDER_TYPE_BINDER;
- obj.binder = local->getWeakRefs();
- obj.cookie = local;
- }
- } else {
- obj.type = BINDER_TYPE_BINDER;
- obj.binder = NULL;
- obj.cookie = NULL;
- }
-
- return finish_flatten_binder(binder, obj, out);
-}
-
-status_t flatten_binder(const sp<ProcessState>& proc,
- const wp<IBinder>& binder, Parcel* out)
-{
- flat_binder_object obj;
-
- obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
- if (binder != NULL) {
- sp<IBinder> real = binder.promote();
- if (real != NULL) {
- IBinder *local = real->localBinder();
- if (!local) {
- BpBinder *proxy = real->remoteBinder();
- if (proxy == NULL) {
- ALOGE("null proxy");
- }
- const int32_t handle = proxy ? proxy->handle() : 0;
- obj.type = BINDER_TYPE_WEAK_HANDLE;
- obj.handle = handle;
- obj.cookie = NULL;
- } else {
- obj.type = BINDER_TYPE_WEAK_BINDER;
- obj.binder = binder.get_refs();
- obj.cookie = binder.unsafe_get();
- }
- return finish_flatten_binder(real, obj, out);
- }
-
- // XXX How to deal? In order to flatten the given binder,
- // we need to probe it for information, which requires a primary
- // reference... but we don't have one.
- //
- // The OpenBinder implementation uses a dynamic_cast<> here,
- // but we can't do that with the different reference counting
- // implementation we are using.
- ALOGE("Unable to unflatten Binder weak reference!");
- obj.type = BINDER_TYPE_BINDER;
- obj.binder = NULL;
- obj.cookie = NULL;
- return finish_flatten_binder(NULL, obj, out);
-
- } else {
- obj.type = BINDER_TYPE_BINDER;
- obj.binder = NULL;
- obj.cookie = NULL;
- return finish_flatten_binder(NULL, obj, out);
- }
-}
-
-inline static status_t finish_unflatten_binder(
- BpBinder* proxy, const flat_binder_object& flat, const Parcel& in)
-{
- return NO_ERROR;
-}
-
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const Parcel& in, sp<IBinder>* out)
-{
- const flat_binder_object* flat = in.readObject(false);
-
- if (flat) {
- switch (flat->type) {
- case BINDER_TYPE_BINDER:
- *out = static_cast<IBinder*>(flat->cookie);
- return finish_unflatten_binder(NULL, *flat, in);
- case BINDER_TYPE_HANDLE:
- *out = proc->getStrongProxyForHandle(flat->handle);
- return finish_unflatten_binder(
- static_cast<BpBinder*>(out->get()), *flat, in);
- }
- }
- return BAD_TYPE;
-}
-
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const Parcel& in, wp<IBinder>* out)
-{
- const flat_binder_object* flat = in.readObject(false);
-
- if (flat) {
- switch (flat->type) {
- case BINDER_TYPE_BINDER:
- *out = static_cast<IBinder*>(flat->cookie);
- return finish_unflatten_binder(NULL, *flat, in);
- case BINDER_TYPE_WEAK_BINDER:
- if (flat->binder != NULL) {
- out->set_object_and_refs(
- static_cast<IBinder*>(flat->cookie),
- static_cast<RefBase::weakref_type*>(flat->binder));
- } else {
- *out = NULL;
- }
- return finish_unflatten_binder(NULL, *flat, in);
- case BINDER_TYPE_HANDLE:
- case BINDER_TYPE_WEAK_HANDLE:
- *out = proc->getWeakProxyForHandle(flat->handle);
- return finish_unflatten_binder(
- static_cast<BpBinder*>(out->unsafe_get()), *flat, in);
- }
- }
- return BAD_TYPE;
-}
-
-// ---------------------------------------------------------------------------
-
-Parcel::Parcel()
-{
- initState();
-}
-
-Parcel::~Parcel()
-{
- freeDataNoInit();
-}
-
-const uint8_t* Parcel::data() const
-{
- return mData;
-}
-
-size_t Parcel::dataSize() const
-{
- return (mDataSize > mDataPos ? mDataSize : mDataPos);
-}
-
-size_t Parcel::dataAvail() const
-{
- // TODO: decide what to do about the possibility that this can
- // report an available-data size that exceeds a Java int's max
- // positive value, causing havoc. Fortunately this will only
- // happen if someone constructs a Parcel containing more than two
- // gigabytes of data, which on typical phone hardware is simply
- // not possible.
- return dataSize() - dataPosition();
-}
-
-size_t Parcel::dataPosition() const
-{
- return mDataPos;
-}
-
-size_t Parcel::dataCapacity() const
-{
- return mDataCapacity;
-}
-
-status_t Parcel::setDataSize(size_t size)
-{
- status_t err;
- err = continueWrite(size);
- if (err == NO_ERROR) {
- mDataSize = size;
- ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
- }
- return err;
-}
-
-void Parcel::setDataPosition(size_t pos) const
-{
- mDataPos = pos;
- mNextObjectHint = 0;
-}
-
-status_t Parcel::setDataCapacity(size_t size)
-{
- if (size > mDataCapacity) return continueWrite(size);
- return NO_ERROR;
-}
-
-status_t Parcel::setData(const uint8_t* buffer, size_t len)
-{
- status_t err = restartWrite(len);
- if (err == NO_ERROR) {
- memcpy(const_cast<uint8_t*>(data()), buffer, len);
- mDataSize = len;
- mFdsKnown = false;
- }
- return err;
-}
-
-status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)
-{
- const sp<ProcessState> proc(ProcessState::self());
- status_t err;
- const uint8_t *data = parcel->mData;
- const size_t *objects = parcel->mObjects;
- size_t size = parcel->mObjectsSize;
- int startPos = mDataPos;
- int firstIndex = -1, lastIndex = -2;
-
- if (len == 0) {
- return NO_ERROR;
- }
-
- // range checks against the source parcel size
- if ((offset > parcel->mDataSize)
- || (len > parcel->mDataSize)
- || (offset + len > parcel->mDataSize)) {
- return BAD_VALUE;
- }
-
- // Count objects in range
- for (int i = 0; i < (int) size; i++) {
- size_t off = objects[i];
- if ((off >= offset) && (off < offset + len)) {
- if (firstIndex == -1) {
- firstIndex = i;
- }
- lastIndex = i;
- }
- }
- int numObjects = lastIndex - firstIndex + 1;
-
- if ((mDataSize+len) > mDataCapacity) {
- // grow data
- err = growData(len);
- if (err != NO_ERROR) {
- return err;
- }
- }
-
- // append data
- memcpy(mData + mDataPos, data + offset, len);
- mDataPos += len;
- mDataSize += len;
-
- err = NO_ERROR;
-
- if (numObjects > 0) {
- // grow objects
- if (mObjectsCapacity < mObjectsSize + numObjects) {
- int newSize = ((mObjectsSize + numObjects)*3)/2;
- size_t *objects =
- (size_t*)realloc(mObjects, newSize*sizeof(size_t));
- if (objects == (size_t*)0) {
- return NO_MEMORY;
- }
- mObjects = objects;
- mObjectsCapacity = newSize;
- }
-
- // append and acquire objects
- int idx = mObjectsSize;
- for (int i = firstIndex; i <= lastIndex; i++) {
- size_t off = objects[i] - offset + startPos;
- mObjects[idx++] = off;
- mObjectsSize++;
-
- flat_binder_object* flat
- = reinterpret_cast<flat_binder_object*>(mData + off);
- acquire_object(proc, *flat, this);
-
- if (flat->type == BINDER_TYPE_FD) {
- // If this is a file descriptor, we need to dup it so the
- // new Parcel now owns its own fd, and can declare that we
- // officially know we have fds.
- flat->handle = dup(flat->handle);
- flat->cookie = (void*)1;
- mHasFds = mFdsKnown = true;
- if (!mAllowFds) {
- err = FDS_NOT_ALLOWED;
- }
- }
- }
- }
-
- return err;
-}
-
-bool Parcel::pushAllowFds(bool allowFds)
-{
- const bool origValue = mAllowFds;
- if (!allowFds) {
- mAllowFds = false;
- }
- return origValue;
-}
-
-void Parcel::restoreAllowFds(bool lastValue)
-{
- mAllowFds = lastValue;
-}
-
-bool Parcel::hasFileDescriptors() const
-{
- if (!mFdsKnown) {
- scanForFds();
- }
- return mHasFds;
-}
-
-// Write RPC headers. (previously just the interface token)
-status_t Parcel::writeInterfaceToken(const String16& interface)
-{
- writeInt32(IPCThreadState::self()->getStrictModePolicy() |
- STRICT_MODE_PENALTY_GATHER);
- // currently the interface identification token is just its name as a string
- return writeString16(interface);
-}
-
-bool Parcel::checkInterface(IBinder* binder) const
-{
- return enforceInterface(binder->getInterfaceDescriptor());
-}
-
-bool Parcel::enforceInterface(const String16& interface,
- IPCThreadState* threadState) const
-{
- int32_t strictPolicy = readInt32();
- if (threadState == NULL) {
- threadState = IPCThreadState::self();
- }
- if ((threadState->getLastTransactionBinderFlags() &
- IBinder::FLAG_ONEWAY) != 0) {
- // For one-way calls, the callee is running entirely
- // disconnected from the caller, so disable StrictMode entirely.
- // Not only does disk/network usage not impact the caller, but
- // there's no way to commuicate back any violations anyway.
- threadState->setStrictModePolicy(0);
- } else {
- threadState->setStrictModePolicy(strictPolicy);
- }
- const String16 str(readString16());
- if (str == interface) {
- return true;
- } else {
- ALOGW("**** enforceInterface() expected '%s' but read '%s'\n",
- String8(interface).string(), String8(str).string());
- return false;
- }
-}
-
-const size_t* Parcel::objects() const
-{
- return mObjects;
-}
-
-size_t Parcel::objectsCount() const
-{
- return mObjectsSize;
-}
-
-status_t Parcel::errorCheck() const
-{
- return mError;
-}
-
-void Parcel::setError(status_t err)
-{
- mError = err;
-}
-
-status_t Parcel::finishWrite(size_t len)
-{
- //printf("Finish write of %d\n", len);
- mDataPos += len;
- ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
- if (mDataPos > mDataSize) {
- mDataSize = mDataPos;
- ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
- }
- //printf("New pos=%d, size=%d\n", mDataPos, mDataSize);
- return NO_ERROR;
-}
-
-status_t Parcel::writeUnpadded(const void* data, size_t len)
-{
- size_t end = mDataPos + len;
- if (end < mDataPos) {
- // integer overflow
- return BAD_VALUE;
- }
-
- if (end <= mDataCapacity) {
-restart_write:
- memcpy(mData+mDataPos, data, len);
- return finishWrite(len);
- }
-
- status_t err = growData(len);
- if (err == NO_ERROR) goto restart_write;
- return err;
-}
-
-status_t Parcel::write(const void* data, size_t len)
-{
- void* const d = writeInplace(len);
- if (d) {
- memcpy(d, data, len);
- return NO_ERROR;
- }
- return mError;
-}
-
-void* Parcel::writeInplace(size_t len)
-{
- const size_t padded = PAD_SIZE(len);
-
- // sanity check for integer overflow
- if (mDataPos+padded < mDataPos) {
- return NULL;
- }
-
- if ((mDataPos+padded) <= mDataCapacity) {
-restart_write:
- //printf("Writing %ld bytes, padded to %ld\n", len, padded);
- uint8_t* const data = mData+mDataPos;
-
- // Need to pad at end?
- if (padded != len) {
-#if BYTE_ORDER == BIG_ENDIAN
- static const uint32_t mask[4] = {
- 0x00000000, 0xffffff00, 0xffff0000, 0xff000000
- };
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN
- static const uint32_t mask[4] = {
- 0x00000000, 0x00ffffff, 0x0000ffff, 0x000000ff
- };
-#endif
- //printf("Applying pad mask: %p to %p\n", (void*)mask[padded-len],
- // *reinterpret_cast<void**>(data+padded-4));
- *reinterpret_cast<uint32_t*>(data+padded-4) &= mask[padded-len];
- }
-
- finishWrite(padded);
- return data;
- }
-
- status_t err = growData(padded);
- if (err == NO_ERROR) goto restart_write;
- return NULL;
-}
-
-status_t Parcel::writeInt32(int32_t val)
-{
- return writeAligned(val);
-}
-
-status_t Parcel::writeInt64(int64_t val)
-{
- return writeAligned(val);
-}
-
-status_t Parcel::writeFloat(float val)
-{
- return writeAligned(val);
-}
-
-status_t Parcel::writeDouble(double val)
-{
- return writeAligned(val);
-}
-
-status_t Parcel::writeIntPtr(intptr_t val)
-{
- return writeAligned(val);
-}
-
-status_t Parcel::writeCString(const char* str)
-{
- return write(str, strlen(str)+1);
-}
-
-status_t Parcel::writeString8(const String8& str)
-{
- status_t err = writeInt32(str.bytes());
- // only write string if its length is more than zero characters,
- // as readString8 will only read if the length field is non-zero.
- // this is slightly different from how writeString16 works.
- if (str.bytes() > 0 && err == NO_ERROR) {
- err = write(str.string(), str.bytes()+1);
- }
- return err;
-}
-
-status_t Parcel::writeString16(const String16& str)
-{
- return writeString16(str.string(), str.size());
-}
-
-status_t Parcel::writeString16(const char16_t* str, size_t len)
-{
- if (str == NULL) return writeInt32(-1);
-
- status_t err = writeInt32(len);
- if (err == NO_ERROR) {
- len *= sizeof(char16_t);
- uint8_t* data = (uint8_t*)writeInplace(len+sizeof(char16_t));
- if (data) {
- memcpy(data, str, len);
- *reinterpret_cast<char16_t*>(data+len) = 0;
- return NO_ERROR;
- }
- err = mError;
- }
- return err;
-}
-
-status_t Parcel::writeStrongBinder(const sp<IBinder>& val)
-{
- return flatten_binder(ProcessState::self(), val, this);
-}
-
-status_t Parcel::writeWeakBinder(const wp<IBinder>& val)
-{
- return flatten_binder(ProcessState::self(), val, this);
-}
-
-status_t Parcel::writeNativeHandle(const native_handle* handle)
-{
- if (!handle || handle->version != sizeof(native_handle))
- return BAD_TYPE;
-
- status_t err;
- err = writeInt32(handle->numFds);
- if (err != NO_ERROR) return err;
-
- err = writeInt32(handle->numInts);
- if (err != NO_ERROR) return err;
-
- for (int i=0 ; err==NO_ERROR && i<handle->numFds ; i++)
- err = writeDupFileDescriptor(handle->data[i]);
-
- if (err != NO_ERROR) {
- ALOGD("write native handle, write dup fd failed");
- return err;
- }
- err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts);
- return err;
-}
-
-status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership)
-{
- flat_binder_object obj;
- obj.type = BINDER_TYPE_FD;
- obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
- obj.handle = fd;
- obj.cookie = (void*) (takeOwnership ? 1 : 0);
- return writeObject(obj, true);
-}
-
-status_t Parcel::writeDupFileDescriptor(int fd)
-{
- int dupFd = dup(fd);
- if (dupFd < 0) {
- return -errno;
- }
- status_t err = writeFileDescriptor(dupFd, true /*takeOwnership*/);
- if (err) {
- close(dupFd);
- }
- return err;
-}
-
-status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob)
-{
- status_t status;
-
- if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) {
- ALOGV("writeBlob: write in place");
- status = writeInt32(0);
- if (status) return status;
-
- void* ptr = writeInplace(len);
- if (!ptr) return NO_MEMORY;
-
- outBlob->init(false /*mapped*/, ptr, len);
- return NO_ERROR;
- }
-
- ALOGV("writeBlob: write to ashmem");
- int fd = ashmem_create_region("Parcel Blob", len);
- if (fd < 0) return NO_MEMORY;
-
- int result = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
- if (result < 0) {
- status = result;
- } else {
- void* ptr = ::mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (ptr == MAP_FAILED) {
- status = -errno;
- } else {
- result = ashmem_set_prot_region(fd, PROT_READ);
- if (result < 0) {
- status = result;
- } else {
- status = writeInt32(1);
- if (!status) {
- status = writeFileDescriptor(fd, true /*takeOwnership*/);
- if (!status) {
- outBlob->init(true /*mapped*/, ptr, len);
- return NO_ERROR;
- }
- }
- }
- }
- ::munmap(ptr, len);
- }
- ::close(fd);
- return status;
-}
-
-status_t Parcel::write(const Flattenable& val)
-{
- status_t err;
-
- // size if needed
- size_t len = val.getFlattenedSize();
- size_t fd_count = val.getFdCount();
-
- err = this->writeInt32(len);
- if (err) return err;
-
- err = this->writeInt32(fd_count);
- if (err) return err;
-
- // payload
- void* buf = this->writeInplace(PAD_SIZE(len));
- if (buf == NULL)
- return BAD_VALUE;
-
- int* fds = NULL;
- if (fd_count) {
- fds = new int[fd_count];
- }
-
- err = val.flatten(buf, len, fds, fd_count);
- for (size_t i=0 ; i<fd_count && err==NO_ERROR ; i++) {
- err = this->writeDupFileDescriptor( fds[i] );
- }
-
- if (fd_count) {
- delete [] fds;
- }
-
- return err;
-}
-
-status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData)
-{
- const bool enoughData = (mDataPos+sizeof(val)) <= mDataCapacity;
- const bool enoughObjects = mObjectsSize < mObjectsCapacity;
- if (enoughData && enoughObjects) {
-restart_write:
- *reinterpret_cast<flat_binder_object*>(mData+mDataPos) = val;
-
- // Need to write meta-data?
- if (nullMetaData || val.binder != NULL) {
- mObjects[mObjectsSize] = mDataPos;
- acquire_object(ProcessState::self(), val, this);
- mObjectsSize++;
- }
-
- // remember if it's a file descriptor
- if (val.type == BINDER_TYPE_FD) {
- if (!mAllowFds) {
- return FDS_NOT_ALLOWED;
- }
- mHasFds = mFdsKnown = true;
- }
-
- return finishWrite(sizeof(flat_binder_object));
- }
-
- if (!enoughData) {
- const status_t err = growData(sizeof(val));
- if (err != NO_ERROR) return err;
- }
- if (!enoughObjects) {
- size_t newSize = ((mObjectsSize+2)*3)/2;
- size_t* objects = (size_t*)realloc(mObjects, newSize*sizeof(size_t));
- if (objects == NULL) return NO_MEMORY;
- mObjects = objects;
- mObjectsCapacity = newSize;
- }
-
- goto restart_write;
-}
-
-status_t Parcel::writeNoException()
-{
- return writeInt32(0);
-}
-
-void Parcel::remove(size_t start, size_t amt)
-{
- LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!");
-}
-
-status_t Parcel::read(void* outData, size_t len) const
-{
- if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
- memcpy(outData, mData+mDataPos, len);
- mDataPos += PAD_SIZE(len);
- ALOGV("read Setting data pos of %p to %d\n", this, mDataPos);
- return NO_ERROR;
- }
- return NOT_ENOUGH_DATA;
-}
-
-const void* Parcel::readInplace(size_t len) const
-{
- if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
- const void* data = mData+mDataPos;
- mDataPos += PAD_SIZE(len);
- ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
- return data;
- }
- return NULL;
-}
-
-template<class T>
-status_t Parcel::readAligned(T *pArg) const {
- COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T));
-
- if ((mDataPos+sizeof(T)) <= mDataSize) {
- const void* data = mData+mDataPos;
- mDataPos += sizeof(T);
- *pArg = *reinterpret_cast<const T*>(data);
- return NO_ERROR;
- } else {
- return NOT_ENOUGH_DATA;
- }
-}
-
-template<class T>
-T Parcel::readAligned() const {
- T result;
- if (readAligned(&result) != NO_ERROR) {
- result = 0;
- }
-
- return result;
-}
-
-template<class T>
-status_t Parcel::writeAligned(T val) {
- COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T));
-
- if ((mDataPos+sizeof(val)) <= mDataCapacity) {
-restart_write:
- *reinterpret_cast<T*>(mData+mDataPos) = val;
- return finishWrite(sizeof(val));
- }
-
- status_t err = growData(sizeof(val));
- if (err == NO_ERROR) goto restart_write;
- return err;
-}
-
-status_t Parcel::readInt32(int32_t *pArg) const
-{
- return readAligned(pArg);
-}
-
-int32_t Parcel::readInt32() const
-{
- return readAligned<int32_t>();
-}
-
-
-status_t Parcel::readInt64(int64_t *pArg) const
-{
- return readAligned(pArg);
-}
-
-
-int64_t Parcel::readInt64() const
-{
- return readAligned<int64_t>();
-}
-
-status_t Parcel::readFloat(float *pArg) const
-{
- return readAligned(pArg);
-}
-
-
-float Parcel::readFloat() const
-{
- return readAligned<float>();
-}
-
-status_t Parcel::readDouble(double *pArg) const
-{
- return readAligned(pArg);
-}
-
-
-double Parcel::readDouble() const
-{
- return readAligned<double>();
-}
-
-status_t Parcel::readIntPtr(intptr_t *pArg) const
-{
- return readAligned(pArg);
-}
-
-
-intptr_t Parcel::readIntPtr() const
-{
- return readAligned<intptr_t>();
-}
-
-
-const char* Parcel::readCString() const
-{
- const size_t avail = mDataSize-mDataPos;
- if (avail > 0) {
- const char* str = reinterpret_cast<const char*>(mData+mDataPos);
- // is the string's trailing NUL within the parcel's valid bounds?
- const char* eos = reinterpret_cast<const char*>(memchr(str, 0, avail));
- if (eos) {
- const size_t len = eos - str;
- mDataPos += PAD_SIZE(len+1);
- ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
- return str;
- }
- }
- return NULL;
-}
-
-String8 Parcel::readString8() const
-{
- int32_t size = readInt32();
- // watch for potential int overflow adding 1 for trailing NUL
- if (size > 0 && size < INT32_MAX) {
- const char* str = (const char*)readInplace(size+1);
- if (str) return String8(str, size);
- }
- return String8();
-}
-
-String16 Parcel::readString16() const
-{
- size_t len;
- const char16_t* str = readString16Inplace(&len);
- if (str) return String16(str, len);
- ALOGE("Reading a NULL string not supported here.");
- return String16();
-}
-
-const char16_t* Parcel::readString16Inplace(size_t* outLen) const
-{
- int32_t size = readInt32();
- // watch for potential int overflow from size+1
- if (size >= 0 && size < INT32_MAX) {
- *outLen = size;
- const char16_t* str = (const char16_t*)readInplace((size+1)*sizeof(char16_t));
- if (str != NULL) {
- return str;
- }
- }
- *outLen = 0;
- return NULL;
-}
-
-sp<IBinder> Parcel::readStrongBinder() const
-{
- sp<IBinder> val;
- unflatten_binder(ProcessState::self(), *this, &val);
- return val;
-}
-
-wp<IBinder> Parcel::readWeakBinder() const
-{
- wp<IBinder> val;
- unflatten_binder(ProcessState::self(), *this, &val);
- return val;
-}
-
-int32_t Parcel::readExceptionCode() const
-{
- int32_t exception_code = readAligned<int32_t>();
- if (exception_code == EX_HAS_REPLY_HEADER) {
- int32_t header_size = readAligned<int32_t>();
- // Skip over fat responses headers. Not used (or propagated) in
- // native code
- setDataPosition(dataPosition() + header_size);
- // And fat response headers are currently only used when there are no
- // exceptions, so return no error:
- return 0;
- }
- return exception_code;
-}
-
-native_handle* Parcel::readNativeHandle() const
-{
- int numFds, numInts;
- status_t err;
- err = readInt32(&numFds);
- if (err != NO_ERROR) return 0;
- err = readInt32(&numInts);
- if (err != NO_ERROR) return 0;
-
- native_handle* h = native_handle_create(numFds, numInts);
- for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
- h->data[i] = dup(readFileDescriptor());
- if (h->data[i] < 0) err = BAD_VALUE;
- }
- err = read(h->data + numFds, sizeof(int)*numInts);
- if (err != NO_ERROR) {
- native_handle_close(h);
- native_handle_delete(h);
- h = 0;
- }
- return h;
-}
-
-
-int Parcel::readFileDescriptor() const
-{
- const flat_binder_object* flat = readObject(true);
- if (flat) {
- switch (flat->type) {
- case BINDER_TYPE_FD:
- //ALOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this);
- return flat->handle;
- }
- }
- return BAD_TYPE;
-}
-
-status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
-{
- int32_t useAshmem;
- status_t status = readInt32(&useAshmem);
- if (status) return status;
-
- if (!useAshmem) {
- ALOGV("readBlob: read in place");
- const void* ptr = readInplace(len);
- if (!ptr) return BAD_VALUE;
-
- outBlob->init(false /*mapped*/, const_cast<void*>(ptr), len);
- return NO_ERROR;
- }
-
- ALOGV("readBlob: read from ashmem");
- int fd = readFileDescriptor();
- if (fd == int(BAD_TYPE)) return BAD_VALUE;
-
- void* ptr = ::mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
- if (!ptr) return NO_MEMORY;
-
- outBlob->init(true /*mapped*/, ptr, len);
- return NO_ERROR;
-}
-
-status_t Parcel::read(Flattenable& val) const
-{
- // size
- const size_t len = this->readInt32();
- const size_t fd_count = this->readInt32();
-
- // payload
- void const* buf = this->readInplace(PAD_SIZE(len));
- if (buf == NULL)
- return BAD_VALUE;
-
- int* fds = NULL;
- if (fd_count) {
- fds = new int[fd_count];
- }
-
- status_t err = NO_ERROR;
- for (size_t i=0 ; i<fd_count && err==NO_ERROR ; i++) {
- fds[i] = dup(this->readFileDescriptor());
- if (fds[i] < 0) err = BAD_VALUE;
- }
-
- if (err == NO_ERROR) {
- err = val.unflatten(buf, len, fds, fd_count);
- }
-
- if (fd_count) {
- delete [] fds;
- }
-
- return err;
-}
-const flat_binder_object* Parcel::readObject(bool nullMetaData) const
-{
- const size_t DPOS = mDataPos;
- if ((DPOS+sizeof(flat_binder_object)) <= mDataSize) {
- const flat_binder_object* obj
- = reinterpret_cast<const flat_binder_object*>(mData+DPOS);
- mDataPos = DPOS + sizeof(flat_binder_object);
- if (!nullMetaData && (obj->cookie == NULL && obj->binder == NULL)) {
- // When transferring a NULL object, we don't write it into
- // the object list, so we don't want to check for it when
- // reading.
- ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
- return obj;
- }
-
- // Ensure that this object is valid...
- size_t* const OBJS = mObjects;
- const size_t N = mObjectsSize;
- size_t opos = mNextObjectHint;
-
- if (N > 0) {
- ALOGV("Parcel %p looking for obj at %d, hint=%d\n",
- this, DPOS, opos);
-
- // Start at the current hint position, looking for an object at
- // the current data position.
- if (opos < N) {
- while (opos < (N-1) && OBJS[opos] < DPOS) {
- opos++;
- }
- } else {
- opos = N-1;
- }
- if (OBJS[opos] == DPOS) {
- // Found it!
- ALOGV("Parcel found obj %d at index %d with forward search",
- this, DPOS, opos);
- mNextObjectHint = opos+1;
- ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
- return obj;
- }
-
- // Look backwards for it...
- while (opos > 0 && OBJS[opos] > DPOS) {
- opos--;
- }
- if (OBJS[opos] == DPOS) {
- // Found it!
- ALOGV("Parcel found obj %d at index %d with backward search",
- this, DPOS, opos);
- mNextObjectHint = opos+1;
- ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
- return obj;
- }
- }
- ALOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list",
- this, DPOS);
- }
- return NULL;
-}
-
-void Parcel::closeFileDescriptors()
-{
- size_t i = mObjectsSize;
- if (i > 0) {
- //ALOGI("Closing file descriptors for %d objects...", mObjectsSize);
- }
- while (i > 0) {
- i--;
- const flat_binder_object* flat
- = reinterpret_cast<flat_binder_object*>(mData+mObjects[i]);
- if (flat->type == BINDER_TYPE_FD) {
- //ALOGI("Closing fd: %ld\n", flat->handle);
- close(flat->handle);
- }
- }
-}
-
-const uint8_t* Parcel::ipcData() const
-{
- return mData;
-}
-
-size_t Parcel::ipcDataSize() const
-{
- return (mDataSize > mDataPos ? mDataSize : mDataPos);
-}
-
-const size_t* Parcel::ipcObjects() const
-{
- return mObjects;
-}
-
-size_t Parcel::ipcObjectsCount() const
-{
- return mObjectsSize;
-}
-
-void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie)
-{
- freeDataNoInit();
- mError = NO_ERROR;
- mData = const_cast<uint8_t*>(data);
- mDataSize = mDataCapacity = dataSize;
- //ALOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid());
- mDataPos = 0;
- ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
- mObjects = const_cast<size_t*>(objects);
- mObjectsSize = mObjectsCapacity = objectsCount;
- mNextObjectHint = 0;
- mOwner = relFunc;
- mOwnerCookie = relCookie;
- scanForFds();
-}
-
-void Parcel::print(TextOutput& to, uint32_t flags) const
-{
- to << "Parcel(";
-
- if (errorCheck() != NO_ERROR) {
- const status_t err = errorCheck();
- to << "Error: " << (void*)err << " \"" << strerror(-err) << "\"";
- } else if (dataSize() > 0) {
- const uint8_t* DATA = data();
- to << indent << HexDump(DATA, dataSize()) << dedent;
- const size_t* OBJS = objects();
- const size_t N = objectsCount();
- for (size_t i=0; i<N; i++) {
- const flat_binder_object* flat
- = reinterpret_cast<const flat_binder_object*>(DATA+OBJS[i]);
- to << endl << "Object #" << i << " @ " << (void*)OBJS[i] << ": "
- << TypeCode(flat->type & 0x7f7f7f00)
- << " = " << flat->binder;
- }
- } else {
- to << "NULL";
- }
-
- to << ")";
-}
-
-void Parcel::releaseObjects()
-{
- const sp<ProcessState> proc(ProcessState::self());
- size_t i = mObjectsSize;
- uint8_t* const data = mData;
- size_t* const objects = mObjects;
- while (i > 0) {
- i--;
- const flat_binder_object* flat
- = reinterpret_cast<flat_binder_object*>(data+objects[i]);
- release_object(proc, *flat, this);
- }
-}
-
-void Parcel::acquireObjects()
-{
- const sp<ProcessState> proc(ProcessState::self());
- size_t i = mObjectsSize;
- uint8_t* const data = mData;
- size_t* const objects = mObjects;
- while (i > 0) {
- i--;
- const flat_binder_object* flat
- = reinterpret_cast<flat_binder_object*>(data+objects[i]);
- acquire_object(proc, *flat, this);
- }
-}
-
-void Parcel::freeData()
-{
- freeDataNoInit();
- initState();
-}
-
-void Parcel::freeDataNoInit()
-{
- if (mOwner) {
- //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid());
- mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie);
- } else {
- releaseObjects();
- if (mData) free(mData);
- if (mObjects) free(mObjects);
- }
-}
-
-status_t Parcel::growData(size_t len)
-{
- size_t newSize = ((mDataSize+len)*3)/2;
- return (newSize <= mDataSize)
- ? (status_t) NO_MEMORY
- : continueWrite(newSize);
-}
-
-status_t Parcel::restartWrite(size_t desired)
-{
- if (mOwner) {
- freeData();
- return continueWrite(desired);
- }
-
- uint8_t* data = (uint8_t*)realloc(mData, desired);
- if (!data && desired > mDataCapacity) {
- mError = NO_MEMORY;
- return NO_MEMORY;
- }
-
- releaseObjects();
-
- if (data) {
- mData = data;
- mDataCapacity = desired;
- }
-
- mDataSize = mDataPos = 0;
- ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
- ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
-
- free(mObjects);
- mObjects = NULL;
- mObjectsSize = mObjectsCapacity = 0;
- mNextObjectHint = 0;
- mHasFds = false;
- mFdsKnown = true;
- mAllowFds = true;
-
- return NO_ERROR;
-}
-
-status_t Parcel::continueWrite(size_t desired)
-{
- // If shrinking, first adjust for any objects that appear
- // after the new data size.
- size_t objectsSize = mObjectsSize;
- if (desired < mDataSize) {
- if (desired == 0) {
- objectsSize = 0;
- } else {
- while (objectsSize > 0) {
- if (mObjects[objectsSize-1] < desired)
- break;
- objectsSize--;
- }
- }
- }
-
- if (mOwner) {
- // If the size is going to zero, just release the owner's data.
- if (desired == 0) {
- freeData();
- return NO_ERROR;
- }
-
- // If there is a different owner, we need to take
- // posession.
- uint8_t* data = (uint8_t*)malloc(desired);
- if (!data) {
- mError = NO_MEMORY;
- return NO_MEMORY;
- }
- size_t* objects = NULL;
-
- if (objectsSize) {
- objects = (size_t*)malloc(objectsSize*sizeof(size_t));
- if (!objects) {
- mError = NO_MEMORY;
- return NO_MEMORY;
- }
-
- // Little hack to only acquire references on objects
- // we will be keeping.
- size_t oldObjectsSize = mObjectsSize;
- mObjectsSize = objectsSize;
- acquireObjects();
- mObjectsSize = oldObjectsSize;
- }
-
- if (mData) {
- memcpy(data, mData, mDataSize < desired ? mDataSize : desired);
- }
- if (objects && mObjects) {
- memcpy(objects, mObjects, objectsSize*sizeof(size_t));
- }
- //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid());
- mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie);
- mOwner = NULL;
-
- mData = data;
- mObjects = objects;
- mDataSize = (mDataSize < desired) ? mDataSize : desired;
- ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
- mDataCapacity = desired;
- mObjectsSize = mObjectsCapacity = objectsSize;
- mNextObjectHint = 0;
-
- } else if (mData) {
- if (objectsSize < mObjectsSize) {
- // Need to release refs on any objects we are dropping.
- const sp<ProcessState> proc(ProcessState::self());
- for (size_t i=objectsSize; i<mObjectsSize; i++) {
- const flat_binder_object* flat
- = reinterpret_cast<flat_binder_object*>(mData+mObjects[i]);
- if (flat->type == BINDER_TYPE_FD) {
- // will need to rescan because we may have lopped off the only FDs
- mFdsKnown = false;
- }
- release_object(proc, *flat, this);
- }
- size_t* objects =
- (size_t*)realloc(mObjects, objectsSize*sizeof(size_t));
- if (objects) {
- mObjects = objects;
- }
- mObjectsSize = objectsSize;
- mNextObjectHint = 0;
- }
-
- // We own the data, so we can just do a realloc().
- if (desired > mDataCapacity) {
- uint8_t* data = (uint8_t*)realloc(mData, desired);
- if (data) {
- mData = data;
- mDataCapacity = desired;
- } else if (desired > mDataCapacity) {
- mError = NO_MEMORY;
- return NO_MEMORY;
- }
- } else {
- if (mDataSize > desired) {
- mDataSize = desired;
- ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
- }
- if (mDataPos > desired) {
- mDataPos = desired;
- ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
- }
- }
-
- } else {
- // This is the first data. Easy!
- uint8_t* data = (uint8_t*)malloc(desired);
- if (!data) {
- mError = NO_MEMORY;
- return NO_MEMORY;
- }
-
- if(!(mDataCapacity == 0 && mObjects == NULL
- && mObjectsCapacity == 0)) {
- ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired);
- }
-
- mData = data;
- mDataSize = mDataPos = 0;
- ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
- ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
- mDataCapacity = desired;
- }
-
- return NO_ERROR;
-}
-
-void Parcel::initState()
-{
- mError = NO_ERROR;
- mData = 0;
- mDataSize = 0;
- mDataCapacity = 0;
- mDataPos = 0;
- ALOGV("initState Setting data size of %p to %d\n", this, mDataSize);
- ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
- mObjects = NULL;
- mObjectsSize = 0;
- mObjectsCapacity = 0;
- mNextObjectHint = 0;
- mHasFds = false;
- mFdsKnown = true;
- mAllowFds = true;
- mOwner = NULL;
-}
-
-void Parcel::scanForFds() const
-{
- bool hasFds = false;
- for (size_t i=0; i<mObjectsSize; i++) {
- const flat_binder_object* flat
- = reinterpret_cast<const flat_binder_object*>(mData + mObjects[i]);
- if (flat->type == BINDER_TYPE_FD) {
- hasFds = true;
- break;
- }
- }
- mHasFds = hasFds;
- mFdsKnown = true;
-}
-
-// --- Parcel::Blob ---
-
-Parcel::Blob::Blob() :
- mMapped(false), mData(NULL), mSize(0) {
-}
-
-Parcel::Blob::~Blob() {
- release();
-}
-
-void Parcel::Blob::release() {
- if (mMapped && mData) {
- ::munmap(mData, mSize);
- }
- clear();
-}
-
-void Parcel::Blob::init(bool mapped, void* data, size_t size) {
- mMapped = mapped;
- mData = data;
- mSize = size;
-}
-
-void Parcel::Blob::clear() {
- mMapped = false;
- mData = NULL;
- mSize = 0;
-}
-
-}; // namespace android
diff --git a/libs/binder/PermissionCache.cpp b/libs/binder/PermissionCache.cpp
deleted file mode 100644
index a503be8..0000000
--- a/libs/binder/PermissionCache.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "PermissionCache"
-
-#include <stdint.h>
-#include <utils/Log.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-#include <binder/PermissionCache.h>
-#include <utils/String8.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-ANDROID_SINGLETON_STATIC_INSTANCE(PermissionCache) ;
-
-// ----------------------------------------------------------------------------
-
-PermissionCache::PermissionCache() {
-}
-
-status_t PermissionCache::check(bool* granted,
- const String16& permission, uid_t uid) const {
- Mutex::Autolock _l(mLock);
- Entry e;
- e.name = permission;
- e.uid = uid;
- ssize_t index = mCache.indexOf(e);
- if (index >= 0) {
- *granted = mCache.itemAt(index).granted;
- return NO_ERROR;
- }
- return NAME_NOT_FOUND;
-}
-
-void PermissionCache::cache(const String16& permission,
- uid_t uid, bool granted) {
- Mutex::Autolock _l(mLock);
- Entry e;
- ssize_t index = mPermissionNamesPool.indexOf(permission);
- if (index > 0) {
- e.name = mPermissionNamesPool.itemAt(index);
- } else {
- mPermissionNamesPool.add(permission);
- e.name = permission;
- }
- // note, we don't need to store the pid, which is not actually used in
- // permission checks
- e.uid = uid;
- e.granted = granted;
- index = mCache.indexOf(e);
- if (index < 0) {
- mCache.add(e);
- }
-}
-
-void PermissionCache::purge() {
- Mutex::Autolock _l(mLock);
- mCache.clear();
-}
-
-bool PermissionCache::checkCallingPermission(const String16& permission) {
- return PermissionCache::checkCallingPermission(permission, NULL, NULL);
-}
-
-bool PermissionCache::checkCallingPermission(
- const String16& permission, int32_t* outPid, int32_t* outUid) {
- IPCThreadState* ipcState = IPCThreadState::self();
- pid_t pid = ipcState->getCallingPid();
- uid_t uid = ipcState->getCallingUid();
- if (outPid) *outPid = pid;
- if (outUid) *outUid = uid;
- return PermissionCache::checkPermission(permission, pid, uid);
-}
-
-bool PermissionCache::checkPermission(
- const String16& permission, pid_t pid, uid_t uid) {
- if ((uid == 0) || (pid == getpid())) {
- // root and ourselves is always okay
- return true;
- }
-
- PermissionCache& pc(PermissionCache::getInstance());
- bool granted = false;
- if (pc.check(&granted, permission, uid) != NO_ERROR) {
- nsecs_t t = -systemTime();
- granted = android::checkPermission(permission, pid, uid);
- t += systemTime();
- ALOGD("checking %s for uid=%d => %s (%d us)",
- String8(permission).string(), uid,
- granted?"granted":"denied", (int)ns2us(t));
- pc.cache(permission, uid, granted);
- }
- return granted;
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
deleted file mode 100644
index 9fa412c..0000000
--- a/libs/binder/ProcessState.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "ProcessState"
-
-#include <cutils/process_name.h>
-
-#include <binder/ProcessState.h>
-
-#include <utils/Atomic.h>
-#include <binder/BpBinder.h>
-#include <binder/IPCThreadState.h>
-#include <utils/Log.h>
-#include <utils/String8.h>
-#include <binder/IServiceManager.h>
-#include <utils/String8.h>
-#include <utils/threads.h>
-
-#include <private/binder/binder_module.h>
-#include <private/binder/Static.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2))
-
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// Global variables
-int mArgC;
-const char* const* mArgV;
-int mArgLen;
-
-class PoolThread : public Thread
-{
-public:
- PoolThread(bool isMain)
- : mIsMain(isMain)
- {
- }
-
-protected:
- virtual bool threadLoop()
- {
- IPCThreadState::self()->joinThreadPool(mIsMain);
- return false;
- }
-
- const bool mIsMain;
-};
-
-sp<ProcessState> ProcessState::self()
-{
- if (gProcess != NULL) return gProcess;
-
- AutoMutex _l(gProcessMutex);
- if (gProcess == NULL) gProcess = new ProcessState;
- return gProcess;
-}
-
-void ProcessState::setContextObject(const sp<IBinder>& object)
-{
- setContextObject(object, String16("default"));
-}
-
-sp<IBinder> ProcessState::getContextObject(const sp<IBinder>& caller)
-{
- return getStrongProxyForHandle(0);
-}
-
-void ProcessState::setContextObject(const sp<IBinder>& object, const String16& name)
-{
- AutoMutex _l(mLock);
- mContexts.add(name, object);
-}
-
-sp<IBinder> ProcessState::getContextObject(const String16& name, const sp<IBinder>& caller)
-{
- mLock.lock();
- sp<IBinder> object(
- mContexts.indexOfKey(name) >= 0 ? mContexts.valueFor(name) : NULL);
- mLock.unlock();
-
- //printf("Getting context object %s for %p\n", String8(name).string(), caller.get());
-
- if (object != NULL) return object;
-
- // Don't attempt to retrieve contexts if we manage them
- if (mManagesContexts) {
- ALOGE("getContextObject(%s) failed, but we manage the contexts!\n",
- String8(name).string());
- return NULL;
- }
-
- IPCThreadState* ipc = IPCThreadState::self();
- {
- Parcel data, reply;
- // no interface token on this magic transaction
- data.writeString16(name);
- data.writeStrongBinder(caller);
- status_t result = ipc->transact(0 /*magic*/, 0, data, &reply, 0);
- if (result == NO_ERROR) {
- object = reply.readStrongBinder();
- }
- }
-
- ipc->flushCommands();
-
- if (object != NULL) setContextObject(object, name);
- return object;
-}
-
-void ProcessState::startThreadPool()
-{
- AutoMutex _l(mLock);
- if (!mThreadPoolStarted) {
- mThreadPoolStarted = true;
- spawnPooledThread(true);
- }
-}
-
-bool ProcessState::isContextManager(void) const
-{
- return mManagesContexts;
-}
-
-bool ProcessState::becomeContextManager(context_check_func checkFunc, void* userData)
-{
- if (!mManagesContexts) {
- AutoMutex _l(mLock);
- mBinderContextCheckFunc = checkFunc;
- mBinderContextUserData = userData;
-
- int dummy = 0;
- status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR, &dummy);
- if (result == 0) {
- mManagesContexts = true;
- } else if (result == -1) {
- mBinderContextCheckFunc = NULL;
- mBinderContextUserData = NULL;
- ALOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno));
- }
- }
- return mManagesContexts;
-}
-
-ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle)
-{
- const size_t N=mHandleToObject.size();
- if (N <= (size_t)handle) {
- handle_entry e;
- e.binder = NULL;
- e.refs = NULL;
- status_t err = mHandleToObject.insertAt(e, N, handle+1-N);
- if (err < NO_ERROR) return NULL;
- }
- return &mHandleToObject.editItemAt(handle);
-}
-
-sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle)
-{
- sp<IBinder> result;
-
- AutoMutex _l(mLock);
-
- handle_entry* e = lookupHandleLocked(handle);
-
- if (e != NULL) {
- // We need to create a new BpBinder if there isn't currently one, OR we
- // are unable to acquire a weak reference on this current one. See comment
- // in getWeakProxyForHandle() for more info about this.
- IBinder* b = e->binder;
- if (b == NULL || !e->refs->attemptIncWeak(this)) {
- b = new BpBinder(handle);
- e->binder = b;
- if (b) e->refs = b->getWeakRefs();
- result = b;
- } else {
- // This little bit of nastyness is to allow us to add a primary
- // reference to the remote proxy when this team doesn't have one
- // but another team is sending the handle to us.
- result.force_set(b);
- e->refs->decWeak(this);
- }
- }
-
- return result;
-}
-
-wp<IBinder> ProcessState::getWeakProxyForHandle(int32_t handle)
-{
- wp<IBinder> result;
-
- AutoMutex _l(mLock);
-
- handle_entry* e = lookupHandleLocked(handle);
-
- if (e != NULL) {
- // We need to create a new BpBinder if there isn't currently one, OR we
- // are unable to acquire a weak reference on this current one. The
- // attemptIncWeak() is safe because we know the BpBinder destructor will always
- // call expungeHandle(), which acquires the same lock we are holding now.
- // We need to do this because there is a race condition between someone
- // releasing a reference on this BpBinder, and a new reference on its handle
- // arriving from the driver.
- IBinder* b = e->binder;
- if (b == NULL || !e->refs->attemptIncWeak(this)) {
- b = new BpBinder(handle);
- result = b;
- e->binder = b;
- if (b) e->refs = b->getWeakRefs();
- } else {
- result = b;
- e->refs->decWeak(this);
- }
- }
-
- return result;
-}
-
-void ProcessState::expungeHandle(int32_t handle, IBinder* binder)
-{
- AutoMutex _l(mLock);
-
- handle_entry* e = lookupHandleLocked(handle);
-
- // This handle may have already been replaced with a new BpBinder
- // (if someone failed the AttemptIncWeak() above); we don't want
- // to overwrite it.
- if (e && e->binder == binder) e->binder = NULL;
-}
-
-void ProcessState::setArgs(int argc, const char* const argv[])
-{
- mArgC = argc;
- mArgV = (const char **)argv;
-
- mArgLen = 0;
- for (int i=0; i<argc; i++) {
- mArgLen += strlen(argv[i]) + 1;
- }
- mArgLen--;
-}
-
-int ProcessState::getArgC() const
-{
- return mArgC;
-}
-
-const char* const* ProcessState::getArgV() const
-{
- return mArgV;
-}
-
-void ProcessState::setArgV0(const char* txt)
-{
- if (mArgV != NULL) {
- strncpy((char*)mArgV[0], txt, mArgLen);
- set_process_name(txt);
- }
-}
-
-void ProcessState::spawnPooledThread(bool isMain)
-{
- if (mThreadPoolStarted) {
- int32_t s = android_atomic_add(1, &mThreadPoolSeq);
- char buf[16];
- snprintf(buf, sizeof(buf), "Binder_%X", s);
- ALOGV("Spawning new pooled thread, name=%s\n", buf);
- sp<Thread> t = new PoolThread(isMain);
- t->run(buf);
- }
-}
-
-static int open_driver()
-{
- int fd = open("/dev/binder", O_RDWR);
- if (fd >= 0) {
- fcntl(fd, F_SETFD, FD_CLOEXEC);
- int vers;
- status_t result = ioctl(fd, BINDER_VERSION, &vers);
- if (result == -1) {
- ALOGE("Binder ioctl to obtain version failed: %s", strerror(errno));
- close(fd);
- fd = -1;
- }
- if (result != 0 || vers != BINDER_CURRENT_PROTOCOL_VERSION) {
- ALOGE("Binder driver protocol does not match user space protocol!");
- close(fd);
- fd = -1;
- }
- size_t maxThreads = 15;
- result = ioctl(fd, BINDER_SET_MAX_THREADS, &maxThreads);
- if (result == -1) {
- ALOGE("Binder ioctl to set max threads failed: %s", strerror(errno));
- }
- } else {
- ALOGW("Opening '/dev/binder' failed: %s\n", strerror(errno));
- }
- return fd;
-}
-
-ProcessState::ProcessState()
- : mDriverFD(open_driver())
- , mVMStart(MAP_FAILED)
- , mManagesContexts(false)
- , mBinderContextCheckFunc(NULL)
- , mBinderContextUserData(NULL)
- , mThreadPoolStarted(false)
- , mThreadPoolSeq(1)
-{
- if (mDriverFD >= 0) {
- // XXX Ideally, there should be a specific define for whether we
- // have mmap (or whether we could possibly have the kernel module
- // availabla).
-#if !defined(HAVE_WIN32_IPC)
- // mmap the binder, providing a chunk of virtual address space to receive transactions.
- mVMStart = mmap(0, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
- if (mVMStart == MAP_FAILED) {
- // *sigh*
- ALOGE("Using /dev/binder failed: unable to mmap transaction memory.\n");
- close(mDriverFD);
- mDriverFD = -1;
- }
-#else
- mDriverFD = -1;
-#endif
- }
-
- LOG_ALWAYS_FATAL_IF(mDriverFD < 0, "Binder driver could not be opened. Terminating.");
-}
-
-ProcessState::~ProcessState()
-{
-}
-
-}; // namespace android
diff --git a/libs/binder/Static.cpp b/libs/binder/Static.cpp
deleted file mode 100644
index 12b0308..0000000
--- a/libs/binder/Static.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-// All static variables go here, to control initialization and
-// destruction order in the library.
-
-#include <private/binder/Static.h>
-
-#include <binder/IPCThreadState.h>
-#include <utils/Log.h>
-
-namespace android {
-
-// ------------ ProcessState.cpp
-
-Mutex gProcessMutex;
-sp<ProcessState> gProcess;
-
-class LibUtilsIPCtStatics
-{
-public:
- LibUtilsIPCtStatics()
- {
- }
-
- ~LibUtilsIPCtStatics()
- {
- IPCThreadState::shutdown();
- }
-};
-
-static LibUtilsIPCtStatics gIPCStatics;
-
-// ------------ ServiceManager.cpp
-
-Mutex gDefaultServiceManagerLock;
-sp<IServiceManager> gDefaultServiceManager;
-sp<IPermissionController> gPermissionController;
-
-} // namespace android
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk
deleted file mode 100644
index 2f4ac62..0000000
--- a/libs/gui/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- BitTube.cpp \
- BufferQueue.cpp \
- DisplayEventReceiver.cpp \
- IDisplayEventConnection.cpp \
- ISensorEventConnection.cpp \
- ISensorServer.cpp \
- ISurfaceTexture.cpp \
- Sensor.cpp \
- SensorEventQueue.cpp \
- SensorManager.cpp \
- SurfaceTexture.cpp \
- SurfaceTextureClient.cpp \
- ISurfaceComposer.cpp \
- ISurface.cpp \
- ISurfaceComposerClient.cpp \
- IGraphicBufferAlloc.cpp \
- LayerState.cpp \
- Surface.cpp \
- SurfaceComposerClient.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libbinder \
- libhardware \
- libhardware_legacy \
- libui \
- libEGL \
- libGLESv2 \
-
-
-LOCAL_MODULE:= libgui
-
-ifeq ($(TARGET_BOARD_PLATFORM), omap4)
- LOCAL_CFLAGS += -DUSE_FENCE_SYNC
-endif
-ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
- LOCAL_CFLAGS += -DUSE_FENCE_SYNC
-endif
-
-ifeq ($(TARGET_BOARD_PLATFORM), tegra)
- LOCAL_CFLAGS += -DALLOW_DEQUEUE_CURRENT_BUFFER
-endif
-
-include $(BUILD_SHARED_LIBRARY)
-
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/libs/gui/BitTube.cpp b/libs/gui/BitTube.cpp
deleted file mode 100644
index 55f4178..0000000
--- a/libs/gui/BitTube.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <fcntl.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <utils/Errors.h>
-
-#include <binder/Parcel.h>
-
-#include <gui/BitTube.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-BitTube::BitTube()
- : mSendFd(-1), mReceiveFd(-1)
-{
- int fds[2];
- if (pipe(fds) == 0) {
- mReceiveFd = fds[0];
- mSendFd = fds[1];
- fcntl(mReceiveFd, F_SETFL, O_NONBLOCK);
- fcntl(mSendFd, F_SETFL, O_NONBLOCK);
- // ignore SIGPIPE, we handle write errors through EPIPE instead
- signal(SIGPIPE, SIG_IGN);
- } else {
- mReceiveFd = -errno;
- ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd));
- }
-}
-
-BitTube::BitTube(const Parcel& data)
- : mSendFd(-1), mReceiveFd(-1)
-{
- mReceiveFd = dup(data.readFileDescriptor());
- if (mReceiveFd >= 0) {
- fcntl(mReceiveFd, F_SETFL, O_NONBLOCK);
- } else {
- mReceiveFd = -errno;
- ALOGE("BitTube(Parcel): can't dup filedescriptor (%s)",
- strerror(-mReceiveFd));
- }
-}
-
-BitTube::~BitTube()
-{
- if (mSendFd >= 0)
- close(mSendFd);
-
- if (mReceiveFd >= 0)
- close(mReceiveFd);
-}
-
-status_t BitTube::initCheck() const
-{
- if (mReceiveFd < 0) {
- return status_t(mReceiveFd);
- }
- return NO_ERROR;
-}
-
-int BitTube::getFd() const
-{
- return mReceiveFd;
-}
-
-ssize_t BitTube::write(void const* vaddr, size_t size)
-{
- ssize_t err, len;
- do {
- len = ::write(mSendFd, vaddr, size);
- err = len < 0 ? errno : 0;
- } while (err == EINTR);
- return err == 0 ? len : -err;
-
-}
-
-ssize_t BitTube::read(void* vaddr, size_t size)
-{
- ssize_t err, len;
- do {
- len = ::read(mReceiveFd, vaddr, size);
- err = len < 0 ? errno : 0;
- } while (err == EINTR);
- if (err == EAGAIN || err == EWOULDBLOCK) {
- // EAGAIN means that we have non-blocking I/O but there was
- // no data to be read. Nothing the client should care about.
- return 0;
- }
- return err == 0 ? len : -err;
-}
-
-status_t BitTube::writeToParcel(Parcel* reply) const
-{
- if (mReceiveFd < 0)
- return -EINVAL;
-
- status_t result = reply->writeDupFileDescriptor(mReceiveFd);
- close(mReceiveFd);
- mReceiveFd = -1;
- return result;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
deleted file mode 100644
index cb8abdd..0000000
--- a/libs/gui/BufferQueue.cpp
+++ /dev/null
@@ -1,957 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "BufferQueue"
-//#define LOG_NDEBUG 0
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#define GL_GLEXT_PROTOTYPES
-#define EGL_EGLEXT_PROTOTYPES
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <gui/BufferQueue.h>
-#include <gui/ISurfaceComposer.h>
-#include <private/gui/ComposerService.h>
-
-#include <utils/Log.h>
-#include <gui/SurfaceTexture.h>
-#include <utils/Trace.h>
-
-// This compile option causes SurfaceTexture to return the buffer that is currently
-// attached to the GL texture from dequeueBuffer when no other buffers are
-// available. It requires the drivers (Gralloc, GL, OMX IL, and Camera) to do
-// implicit cross-process synchronization to prevent the buffer from being
-// written to before the buffer has (a) been detached from the GL texture and
-// (b) all GL reads from the buffer have completed.
-
-// During refactoring, do not support dequeuing the current buffer
-#undef ALLOW_DEQUEUE_CURRENT_BUFFER
-
-#ifdef ALLOW_DEQUEUE_CURRENT_BUFFER
-#define FLAG_ALLOW_DEQUEUE_CURRENT_BUFFER true
-#warning "ALLOW_DEQUEUE_CURRENT_BUFFER enabled"
-#else
-#define FLAG_ALLOW_DEQUEUE_CURRENT_BUFFER false
-#endif
-
-// Macros for including the BufferQueue name in log messages
-#define ST_LOGV(x, ...) ALOGV("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
-#define ST_LOGD(x, ...) ALOGD("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
-#define ST_LOGI(x, ...) ALOGI("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
-#define ST_LOGW(x, ...) ALOGW("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
-#define ST_LOGE(x, ...) ALOGE("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
-
-#define ATRACE_BUFFER_INDEX(index) \
- char ___traceBuf[1024]; \
- snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), (index)); \
- android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf);
-
-namespace android {
-
-// Get an ID that's unique within this process.
-static int32_t createProcessUniqueId() {
- static volatile int32_t globalCounter = 0;
- return android_atomic_inc(&globalCounter);
-}
-
-BufferQueue::BufferQueue( bool allowSynchronousMode ) :
- mDefaultWidth(1),
- mDefaultHeight(1),
- mPixelFormat(PIXEL_FORMAT_RGBA_8888),
- mBufferCount(MIN_ASYNC_BUFFER_SLOTS),
- mClientBufferCount(0),
- mServerBufferCount(MIN_ASYNC_BUFFER_SLOTS),
- mNextTransform(0),
- mNextScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
- mSynchronousMode(false),
- mAllowSynchronousMode(allowSynchronousMode),
- mConnectedApi(NO_CONNECTED_API),
- mAbandoned(false),
- mFrameCounter(0),
- mBufferHasBeenQueued(false)
-{
- // Choose a name using the PID and a process-unique ID.
- mConsumerName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());
-
- ST_LOGV("BufferQueue");
- sp<ISurfaceComposer> composer(ComposerService::getComposerService());
- mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
- mNextCrop.makeInvalid();
-}
-
-BufferQueue::~BufferQueue() {
- ST_LOGV("~BufferQueue");
-}
-
-status_t BufferQueue::setBufferCountServerLocked(int bufferCount) {
- if (bufferCount > NUM_BUFFER_SLOTS)
- return BAD_VALUE;
-
- // special-case, nothing to do
- if (bufferCount == mBufferCount)
- return OK;
-
- if (!mClientBufferCount &&
- bufferCount >= mBufferCount) {
- // easy, we just have more buffers
- mBufferCount = bufferCount;
- mServerBufferCount = bufferCount;
- mDequeueCondition.broadcast();
- } else {
- // we're here because we're either
- // - reducing the number of available buffers
- // - or there is a client-buffer-count in effect
-
- // less than 2 buffers is never allowed
- if (bufferCount < 2)
- return BAD_VALUE;
-
- // when there is non client-buffer-count in effect, the client is not
- // allowed to dequeue more than one buffer at a time,
- // so the next time they dequeue a buffer, we know that they don't
- // own one. the actual resizing will happen during the next
- // dequeueBuffer.
-
- mServerBufferCount = bufferCount;
- }
- return OK;
-}
-
-bool BufferQueue::isSynchronousMode() const {
- Mutex::Autolock lock(mMutex);
- return mSynchronousMode;
-}
-
-void BufferQueue::setConsumerName(const String8& name) {
- Mutex::Autolock lock(mMutex);
- mConsumerName = name;
-}
-
-void BufferQueue::setFrameAvailableListener(
- const sp<FrameAvailableListener>& listener) {
- ST_LOGV("setFrameAvailableListener");
- Mutex::Autolock lock(mMutex);
- mFrameAvailableListener = listener;
-}
-
-status_t BufferQueue::setBufferCount(int bufferCount) {
- ST_LOGV("setBufferCount: count=%d", bufferCount);
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- ST_LOGE("setBufferCount: SurfaceTexture has been abandoned!");
- return NO_INIT;
- }
- if (bufferCount > NUM_BUFFER_SLOTS) {
- ST_LOGE("setBufferCount: bufferCount larger than slots available");
- return BAD_VALUE;
- }
-
- // Error out if the user has dequeued buffers
- for (int i=0 ; i<mBufferCount ; i++) {
- if (mSlots[i].mBufferState == BufferSlot::DEQUEUED) {
- ST_LOGE("setBufferCount: client owns some buffers");
- return -EINVAL;
- }
- }
-
- const int minBufferSlots = mSynchronousMode ?
- MIN_SYNC_BUFFER_SLOTS : MIN_ASYNC_BUFFER_SLOTS;
- if (bufferCount == 0) {
- mClientBufferCount = 0;
- bufferCount = (mServerBufferCount >= minBufferSlots) ?
- mServerBufferCount : minBufferSlots;
- return setBufferCountServerLocked(bufferCount);
- }
-
- if (bufferCount < minBufferSlots) {
- ST_LOGE("setBufferCount: requested buffer count (%d) is less than "
- "minimum (%d)", bufferCount, minBufferSlots);
- return BAD_VALUE;
- }
-
- // here we're guaranteed that the client doesn't have dequeued buffers
- // and will release all of its buffer references.
- freeAllBuffersLocked();
- mBufferCount = bufferCount;
- mClientBufferCount = bufferCount;
- mBufferHasBeenQueued = false;
- mQueue.clear();
- mDequeueCondition.broadcast();
- return OK;
-}
-
-int BufferQueue::query(int what, int* outValue)
-{
- ATRACE_CALL();
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- ST_LOGE("query: SurfaceTexture has been abandoned!");
- return NO_INIT;
- }
-
- int value;
- switch (what) {
- case NATIVE_WINDOW_WIDTH:
- value = mDefaultWidth;
- break;
- case NATIVE_WINDOW_HEIGHT:
- value = mDefaultHeight;
- break;
- case NATIVE_WINDOW_FORMAT:
- value = mPixelFormat;
- break;
- case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
- value = mSynchronousMode ?
- (MIN_UNDEQUEUED_BUFFERS-1) : MIN_UNDEQUEUED_BUFFERS;
- break;
- default:
- return BAD_VALUE;
- }
- outValue[0] = value;
- return NO_ERROR;
-}
-
-status_t BufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
- ATRACE_CALL();
- ST_LOGV("requestBuffer: slot=%d", slot);
- Mutex::Autolock lock(mMutex);
- if (mAbandoned) {
- ST_LOGE("requestBuffer: SurfaceTexture has been abandoned!");
- return NO_INIT;
- }
- if (slot < 0 || mBufferCount <= slot) {
- ST_LOGE("requestBuffer: slot index out of range [0, %d]: %d",
- mBufferCount, slot);
- return BAD_VALUE;
- }
- mSlots[slot].mRequestBufferCalled = true;
- *buf = mSlots[slot].mGraphicBuffer;
- return NO_ERROR;
-}
-
-status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
- uint32_t format, uint32_t usage) {
- ATRACE_CALL();
- ST_LOGV("dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x", w, h, format, usage);
-
- if ((w && !h) || (!w && h)) {
- ST_LOGE("dequeueBuffer: invalid size: w=%u, h=%u", w, h);
- return BAD_VALUE;
- }
-
- status_t returnFlags(OK);
- EGLDisplay dpy = EGL_NO_DISPLAY;
- EGLSyncKHR fence = EGL_NO_SYNC_KHR;
-
- { // Scope for the lock
- Mutex::Autolock lock(mMutex);
-
- int found = -1;
- int foundSync = -1;
- int dequeuedCount = 0;
- bool tryAgain = true;
- while (tryAgain) {
- if (mAbandoned) {
- ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
- return NO_INIT;
- }
-
- // We need to wait for the FIFO to drain if the number of buffer
- // needs to change.
- //
- // The condition "number of buffers needs to change" is true if
- // - the client doesn't care about how many buffers there are
- // - AND the actual number of buffer is different from what was
- // set in the last setBufferCountServer()
- // - OR -
- // setBufferCountServer() was set to a value incompatible with
- // the synchronization mode (for instance because the sync mode
- // changed since)
- //
- // As long as this condition is true AND the FIFO is not empty, we
- // wait on mDequeueCondition.
-
- const int minBufferCountNeeded = mSynchronousMode ?
- MIN_SYNC_BUFFER_SLOTS : MIN_ASYNC_BUFFER_SLOTS;
-
- const bool numberOfBuffersNeedsToChange = !mClientBufferCount &&
- ((mServerBufferCount != mBufferCount) ||
- (mServerBufferCount < minBufferCountNeeded));
-
- if (!mQueue.isEmpty() && numberOfBuffersNeedsToChange) {
- // wait for the FIFO to drain
- mDequeueCondition.wait(mMutex);
- // NOTE: we continue here because we need to reevaluate our
- // whole state (eg: we could be abandoned or disconnected)
- continue;
- }
-
- if (numberOfBuffersNeedsToChange) {
- // here we're guaranteed that mQueue is empty
- freeAllBuffersLocked();
- // XXX: signal?
- mBufferCount = mServerBufferCount;
- if (mBufferCount < minBufferCountNeeded)
- mBufferCount = minBufferCountNeeded;
- mBufferHasBeenQueued = false;
- returnFlags |= ISurfaceTexture::RELEASE_ALL_BUFFERS;
- }
-
- // look for a free buffer to give to the client
- found = INVALID_BUFFER_SLOT;
- foundSync = INVALID_BUFFER_SLOT;
- dequeuedCount = 0;
- for (int i = 0; i < mBufferCount; i++) {
- const int state = mSlots[i].mBufferState;
- if (state == BufferSlot::DEQUEUED) {
- dequeuedCount++;
- }
-
- // this logic used to be if (FLAG_ALLOW_DEQUEUE_CURRENT_BUFFER)
- // but dequeuing the current buffer is disabled.
- if (false) {
- // This functionality has been temporarily removed so
- // BufferQueue and SurfaceTexture can be refactored into
- // separate objects
- } else {
- if (state == BufferSlot::FREE) {
- /* We return the oldest of the free buffers to avoid
- * stalling the producer if possible. This is because
- * the consumer may still have pending reads of the
- * buffers in flight.
- */
- bool isOlder = mSlots[i].mFrameNumber <
- mSlots[found].mFrameNumber;
- if (found < 0 || isOlder) {
- foundSync = i;
- found = i;
- }
- }
- }
- }
-
- // clients are not allowed to dequeue more than one buffer
- // if they didn't set a buffer count.
- if (!mClientBufferCount && dequeuedCount) {
- ST_LOGE("dequeueBuffer: can't dequeue multiple buffers without "
- "setting the buffer count");
- return -EINVAL;
- }
-
- // See whether a buffer has been queued since the last
- // setBufferCount so we know whether to perform the
- // MIN_UNDEQUEUED_BUFFERS check below.
- if (mBufferHasBeenQueued) {
- // make sure the client is not trying to dequeue more buffers
- // than allowed.
- const int avail = mBufferCount - (dequeuedCount+1);
- if (avail < (MIN_UNDEQUEUED_BUFFERS-int(mSynchronousMode))) {
- ST_LOGE("dequeueBuffer: MIN_UNDEQUEUED_BUFFERS=%d exceeded "
- "(dequeued=%d)",
- MIN_UNDEQUEUED_BUFFERS-int(mSynchronousMode),
- dequeuedCount);
- return -EBUSY;
- }
- }
-
- // if no buffer is found, wait for a buffer to be released
- tryAgain = found == INVALID_BUFFER_SLOT;
- if (tryAgain) {
- mDequeueCondition.wait(mMutex);
- }
- }
-
-
- if (found == INVALID_BUFFER_SLOT) {
- // This should not happen.
- ST_LOGE("dequeueBuffer: no available buffer slots");
- return -EBUSY;
- }
-
- const int buf = found;
- *outBuf = found;
-
- ATRACE_BUFFER_INDEX(buf);
-
- const bool useDefaultSize = !w && !h;
- if (useDefaultSize) {
- // use the default size
- w = mDefaultWidth;
- h = mDefaultHeight;
- }
-
- const bool updateFormat = (format != 0);
- if (!updateFormat) {
- // keep the current (or default) format
- format = mPixelFormat;
- }
-
- // buffer is now in DEQUEUED (but can also be current at the same time,
- // if we're in synchronous mode)
- mSlots[buf].mBufferState = BufferSlot::DEQUEUED;
-
- const sp<GraphicBuffer>& buffer(mSlots[buf].mGraphicBuffer);
- if ((buffer == NULL) ||
- (uint32_t(buffer->width) != w) ||
- (uint32_t(buffer->height) != h) ||
- (uint32_t(buffer->format) != format) ||
- ((uint32_t(buffer->usage) & usage) != usage))
- {
- usage |= GraphicBuffer::USAGE_HW_TEXTURE;
- status_t error;
- sp<GraphicBuffer> graphicBuffer(
- mGraphicBufferAlloc->createGraphicBuffer(
- w, h, format, usage, &error));
- if (graphicBuffer == 0) {
- ST_LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer "
- "failed");
- return error;
- }
- if (updateFormat) {
- mPixelFormat = format;
- }
-
- mSlots[buf].mAcquireCalled = false;
- mSlots[buf].mGraphicBuffer = graphicBuffer;
- mSlots[buf].mRequestBufferCalled = false;
- mSlots[buf].mFence = EGL_NO_SYNC_KHR;
- mSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
-
-
-
-
- returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
- }
-
- dpy = mSlots[buf].mEglDisplay;
- fence = mSlots[buf].mFence;
- mSlots[buf].mFence = EGL_NO_SYNC_KHR;
- } // end lock scope
-
- if (fence != EGL_NO_SYNC_KHR) {
- EGLint result = eglClientWaitSyncKHR(dpy, fence, 0, 1000000000);
- // If something goes wrong, log the error, but return the buffer without
- // synchronizing access to it. It's too late at this point to abort the
- // dequeue operation.
- if (result == EGL_FALSE) {
- ALOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError());
- } else if (result == EGL_TIMEOUT_EXPIRED_KHR) {
- ALOGE("dequeueBuffer: timeout waiting for fence");
- }
- eglDestroySyncKHR(dpy, fence);
-
- }
-
- ST_LOGV("dequeueBuffer: returning slot=%d buf=%p flags=%#x", *outBuf,
- mSlots[*outBuf].mGraphicBuffer->handle, returnFlags);
-
- return returnFlags;
-}
-
-status_t BufferQueue::setSynchronousMode(bool enabled) {
- ATRACE_CALL();
- ST_LOGV("setSynchronousMode: enabled=%d", enabled);
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- ST_LOGE("setSynchronousMode: SurfaceTexture has been abandoned!");
- return NO_INIT;
- }
-
- status_t err = OK;
- if (!mAllowSynchronousMode && enabled)
- return err;
-
- if (!enabled) {
- // going to asynchronous mode, drain the queue
- err = drainQueueLocked();
- if (err != NO_ERROR)
- return err;
- }
-
- if (mSynchronousMode != enabled) {
- // - if we're going to asynchronous mode, the queue is guaranteed to be
- // empty here
- // - if the client set the number of buffers, we're guaranteed that
- // we have at least 3 (because we don't allow less)
- mSynchronousMode = enabled;
- mDequeueCondition.broadcast();
- }
- return err;
-}
-
-status_t BufferQueue::queueBuffer(int buf, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
- ATRACE_CALL();
- ATRACE_BUFFER_INDEX(buf);
-
- ST_LOGV("queueBuffer: slot=%d time=%lld", buf, timestamp);
-
- sp<FrameAvailableListener> listener;
-
- { // scope for the lock
- Mutex::Autolock lock(mMutex);
- if (mAbandoned) {
- ST_LOGE("queueBuffer: SurfaceTexture has been abandoned!");
- return NO_INIT;
- }
- if (buf < 0 || buf >= mBufferCount) {
- ST_LOGE("queueBuffer: slot index out of range [0, %d]: %d",
- mBufferCount, buf);
- return -EINVAL;
- } else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
- ST_LOGE("queueBuffer: slot %d is not owned by the client "
- "(state=%d)", buf, mSlots[buf].mBufferState);
- return -EINVAL;
- } else if (!mSlots[buf].mRequestBufferCalled) {
- ST_LOGE("queueBuffer: slot %d was enqueued without requesting a "
- "buffer", buf);
- return -EINVAL;
- }
-
- if (mSynchronousMode) {
- // In synchronous mode we queue all buffers in a FIFO.
- mQueue.push_back(buf);
-
- // Synchronous mode always signals that an additional frame should
- // be consumed.
- listener = mFrameAvailableListener;
- } else {
- // In asynchronous mode we only keep the most recent buffer.
- if (mQueue.empty()) {
- mQueue.push_back(buf);
-
- // Asynchronous mode only signals that a frame should be
- // consumed if no previous frame was pending. If a frame were
- // pending then the consumer would have already been notified.
- listener = mFrameAvailableListener;
- } else {
- Fifo::iterator front(mQueue.begin());
- // buffer currently queued is freed
- mSlots[*front].mBufferState = BufferSlot::FREE;
- // and we record the new buffer index in the queued list
- *front = buf;
- }
- }
-
- mSlots[buf].mBufferState = BufferSlot::QUEUED;
- mSlots[buf].mCrop = mNextCrop;
- mSlots[buf].mTransform = mNextTransform;
- mSlots[buf].mScalingMode = mNextScalingMode;
- mSlots[buf].mTimestamp = timestamp;
- mFrameCounter++;
- mSlots[buf].mFrameNumber = mFrameCounter;
-
- mBufferHasBeenQueued = true;
- mDequeueCondition.broadcast();
-
- *outWidth = mDefaultWidth;
- *outHeight = mDefaultHeight;
- *outTransform = 0;
-
- ATRACE_INT(mConsumerName.string(), mQueue.size());
- } // scope for the lock
-
- // call back without lock held
- if (listener != 0) {
- listener->onFrameAvailable();
- }
- return OK;
-}
-
-void BufferQueue::cancelBuffer(int buf) {
- ATRACE_CALL();
- ST_LOGV("cancelBuffer: slot=%d", buf);
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- ST_LOGW("cancelBuffer: BufferQueue has been abandoned!");
- return;
- }
-
- if (buf < 0 || buf >= mBufferCount) {
- ST_LOGE("cancelBuffer: slot index out of range [0, %d]: %d",
- mBufferCount, buf);
- return;
- } else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
- ST_LOGE("cancelBuffer: slot %d is not owned by the client (state=%d)",
- buf, mSlots[buf].mBufferState);
- return;
- }
- mSlots[buf].mBufferState = BufferSlot::FREE;
- mSlots[buf].mFrameNumber = 0;
- mDequeueCondition.broadcast();
-}
-
-status_t BufferQueue::setCrop(const Rect& crop) {
- ATRACE_CALL();
- ST_LOGV("setCrop: crop=[%d,%d,%d,%d]", crop.left, crop.top, crop.right,
- crop.bottom);
-
- Mutex::Autolock lock(mMutex);
- if (mAbandoned) {
- ST_LOGE("setCrop: BufferQueue has been abandoned!");
- return NO_INIT;
- }
- mNextCrop = crop;
- return OK;
-}
-
-status_t BufferQueue::setTransform(uint32_t transform) {
- ATRACE_CALL();
- ST_LOGV("setTransform: xform=%#x", transform);
- Mutex::Autolock lock(mMutex);
- if (mAbandoned) {
- ST_LOGE("setTransform: BufferQueue has been abandoned!");
- return NO_INIT;
- }
- mNextTransform = transform;
- return OK;
-}
-
-status_t BufferQueue::setScalingMode(int mode) {
- ATRACE_CALL();
- ST_LOGV("setScalingMode: mode=%d", mode);
-
- switch (mode) {
- case NATIVE_WINDOW_SCALING_MODE_FREEZE:
- case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
- break;
- default:
- ST_LOGE("unknown scaling mode: %d", mode);
- return BAD_VALUE;
- }
-
- Mutex::Autolock lock(mMutex);
- mNextScalingMode = mode;
- return OK;
-}
-
-status_t BufferQueue::connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
- ATRACE_CALL();
- ST_LOGV("connect: api=%d", api);
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- ST_LOGE("connect: BufferQueue has been abandoned!");
- return NO_INIT;
- }
-
- int err = NO_ERROR;
- switch (api) {
- case NATIVE_WINDOW_API_EGL:
- case NATIVE_WINDOW_API_CPU:
- case NATIVE_WINDOW_API_MEDIA:
- case NATIVE_WINDOW_API_CAMERA:
- if (mConnectedApi != NO_CONNECTED_API) {
- ST_LOGE("connect: already connected (cur=%d, req=%d)",
- mConnectedApi, api);
- err = -EINVAL;
- } else {
- mConnectedApi = api;
- *outWidth = mDefaultWidth;
- *outHeight = mDefaultHeight;
- *outTransform = 0;
- }
- break;
- default:
- err = -EINVAL;
- break;
- }
-
- mBufferHasBeenQueued = false;
-
- return err;
-}
-
-status_t BufferQueue::disconnect(int api) {
- ATRACE_CALL();
- ST_LOGV("disconnect: api=%d", api);
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- // it is not really an error to disconnect after the surface
- // has been abandoned, it should just be a no-op.
- return NO_ERROR;
- }
-
- int err = NO_ERROR;
- switch (api) {
- case NATIVE_WINDOW_API_EGL:
- case NATIVE_WINDOW_API_CPU:
- case NATIVE_WINDOW_API_MEDIA:
- case NATIVE_WINDOW_API_CAMERA:
- if (mConnectedApi == api) {
- drainQueueAndFreeBuffersLocked();
- mConnectedApi = NO_CONNECTED_API;
- mNextCrop.makeInvalid();
- mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
- mNextTransform = 0;
- mDequeueCondition.broadcast();
- } else {
- ST_LOGE("disconnect: connected to another api (cur=%d, req=%d)",
- mConnectedApi, api);
- err = -EINVAL;
- }
- break;
- default:
- ST_LOGE("disconnect: unknown API %d", api);
- err = -EINVAL;
- break;
- }
- return err;
-}
-
-void BufferQueue::dump(String8& result) const
-{
- char buffer[1024];
- BufferQueue::dump(result, "", buffer, 1024);
-}
-
-void BufferQueue::dump(String8& result, const char* prefix,
- char* buffer, size_t SIZE) const
-{
- Mutex::Autolock _l(mMutex);
- snprintf(buffer, SIZE,
- "%snext : {crop=[%d,%d,%d,%d], transform=0x%02x}\n"
- ,prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right,
- mNextCrop.bottom, mNextTransform
- );
- result.append(buffer);
-
- String8 fifo;
- int fifoSize = 0;
- Fifo::const_iterator i(mQueue.begin());
- while (i != mQueue.end()) {
- snprintf(buffer, SIZE, "%02d ", *i++);
- fifoSize++;
- fifo.append(buffer);
- }
-
- snprintf(buffer, SIZE,
- "%s-BufferQueue mBufferCount=%d, mSynchronousMode=%d, default-size=[%dx%d], "
- "mPixelFormat=%d, FIFO(%d)={%s}\n",
- prefix, mBufferCount, mSynchronousMode, mDefaultWidth,
- mDefaultHeight, mPixelFormat, fifoSize, fifo.string());
- result.append(buffer);
-
-
- struct {
- const char * operator()(int state) const {
- switch (state) {
- case BufferSlot::DEQUEUED: return "DEQUEUED";
- case BufferSlot::QUEUED: return "QUEUED";
- case BufferSlot::FREE: return "FREE";
- case BufferSlot::ACQUIRED: return "ACQUIRED";
- default: return "Unknown";
- }
- }
- } stateName;
-
- for (int i=0 ; i<mBufferCount ; i++) {
- const BufferSlot& slot(mSlots[i]);
- snprintf(buffer, SIZE,
- "%s%s[%02d] "
- "state=%-8s, crop=[%d,%d,%d,%d], "
- "transform=0x%02x, timestamp=%lld",
- prefix, (slot.mBufferState == BufferSlot::ACQUIRED)?">":" ", i,
- stateName(slot.mBufferState),
- slot.mCrop.left, slot.mCrop.top, slot.mCrop.right,
- slot.mCrop.bottom, slot.mTransform, slot.mTimestamp
- );
- result.append(buffer);
-
- const sp<GraphicBuffer>& buf(slot.mGraphicBuffer);
- if (buf != NULL) {
- snprintf(buffer, SIZE,
- ", %p [%4ux%4u:%4u,%3X]",
- buf->handle, buf->width, buf->height, buf->stride,
- buf->format);
- result.append(buffer);
- }
- result.append("\n");
- }
-}
-
-void BufferQueue::freeBufferLocked(int i) {
- mSlots[i].mGraphicBuffer = 0;
- mSlots[i].mBufferState = BufferSlot::FREE;
- mSlots[i].mFrameNumber = 0;
- mSlots[i].mAcquireCalled = false;
-
- // destroy fence as BufferQueue now takes ownership
- if (mSlots[i].mFence != EGL_NO_SYNC_KHR) {
- eglDestroySyncKHR(mSlots[i].mEglDisplay, mSlots[i].mFence);
- mSlots[i].mFence = EGL_NO_SYNC_KHR;
- }
-}
-
-void BufferQueue::freeAllBuffersLocked() {
- ALOGW_IF(!mQueue.isEmpty(),
- "freeAllBuffersLocked called but mQueue is not empty");
- mQueue.clear();
- mBufferHasBeenQueued = false;
- for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- freeBufferLocked(i);
- }
-}
-
-status_t BufferQueue::acquire(BufferItem *buffer) {
- ATRACE_CALL();
- Mutex::Autolock _l(mMutex);
- // check if queue is empty
- // In asynchronous mode the list is guaranteed to be one buffer
- // deep, while in synchronous mode we use the oldest buffer.
- if (!mQueue.empty()) {
- Fifo::iterator front(mQueue.begin());
- int buf = *front;
-
- ATRACE_BUFFER_INDEX(buf);
-
- if (mSlots[buf].mAcquireCalled) {
- buffer->mGraphicBuffer = NULL;
- }
- else {
- buffer->mGraphicBuffer = mSlots[buf].mGraphicBuffer;
- }
- buffer->mCrop = mSlots[buf].mCrop;
- buffer->mTransform = mSlots[buf].mTransform;
- buffer->mScalingMode = mSlots[buf].mScalingMode;
- buffer->mFrameNumber = mSlots[buf].mFrameNumber;
- buffer->mTimestamp = mSlots[buf].mTimestamp;
- buffer->mBuf = buf;
- mSlots[buf].mAcquireCalled = true;
-
- mSlots[buf].mBufferState = BufferSlot::ACQUIRED;
- mQueue.erase(front);
- mDequeueCondition.broadcast();
-
- ATRACE_INT(mConsumerName.string(), mQueue.size());
- }
- else {
- return -EINVAL; //should be a better return code
- }
-
- return OK;
-}
-
-status_t BufferQueue::releaseBuffer(int buf, EGLDisplay display,
- EGLSyncKHR fence) {
- ATRACE_CALL();
- ATRACE_BUFFER_INDEX(buf);
-
- Mutex::Autolock _l(mMutex);
-
- if (buf == INVALID_BUFFER_SLOT) {
- return -EINVAL;
- }
-
- mSlots[buf].mEglDisplay = display;
- mSlots[buf].mFence = fence;
-
- // The current buffer becomes FREE if it was still in the queued
- // state. If it has already been given to the client
- // (synchronous mode), then it stays in DEQUEUED state.
- if (mSlots[buf].mBufferState == BufferSlot::QUEUED
- || mSlots[buf].mBufferState == BufferSlot::ACQUIRED) {
- mSlots[buf].mBufferState = BufferSlot::FREE;
- }
-
- mDequeueCondition.broadcast();
-
- return OK;
-}
-
-status_t BufferQueue::consumerDisconnect() {
- Mutex::Autolock lock(mMutex);
- // Once the SurfaceTexture disconnects, the BufferQueue
- // is considered abandoned
- mAbandoned = true;
- freeAllBuffersLocked();
- mDequeueCondition.broadcast();
- return OK;
-}
-
-status_t BufferQueue::setDefaultBufferSize(uint32_t w, uint32_t h)
-{
- ST_LOGV("setDefaultBufferSize: w=%d, h=%d", w, h);
- if (!w || !h) {
- ST_LOGE("setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)",
- w, h);
- return BAD_VALUE;
- }
-
- Mutex::Autolock lock(mMutex);
- mDefaultWidth = w;
- mDefaultHeight = h;
- return OK;
-}
-
-status_t BufferQueue::setBufferCountServer(int bufferCount) {
- ATRACE_CALL();
- Mutex::Autolock lock(mMutex);
- return setBufferCountServerLocked(bufferCount);
-}
-
-void BufferQueue::freeAllBuffersExceptHeadLocked() {
- ALOGW_IF(!mQueue.isEmpty(),
- "freeAllBuffersExceptCurrentLocked called but mQueue is not empty");
- int head = -1;
- if (!mQueue.empty()) {
- Fifo::iterator front(mQueue.begin());
- head = *front;
- }
- mBufferHasBeenQueued = false;
- for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- if (i != head) {
- freeBufferLocked(i);
- }
- }
-}
-
-status_t BufferQueue::drainQueueLocked() {
- while (mSynchronousMode && !mQueue.isEmpty()) {
- mDequeueCondition.wait(mMutex);
- if (mAbandoned) {
- ST_LOGE("drainQueueLocked: BufferQueue has been abandoned!");
- return NO_INIT;
- }
- if (mConnectedApi == NO_CONNECTED_API) {
- ST_LOGE("drainQueueLocked: BufferQueue is not connected!");
- return NO_INIT;
- }
- }
- return NO_ERROR;
-}
-
-status_t BufferQueue::drainQueueAndFreeBuffersLocked() {
- status_t err = drainQueueLocked();
- if (err == NO_ERROR) {
- if (mSynchronousMode) {
- freeAllBuffersLocked();
- } else {
- freeAllBuffersExceptHeadLocked();
- }
- }
- return err;
-}
-
-}; // namespace android
diff --git a/libs/gui/DisplayEventReceiver.cpp b/libs/gui/DisplayEventReceiver.cpp
deleted file mode 100644
index a6790ad..0000000
--- a/libs/gui/DisplayEventReceiver.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <string.h>
-
-#include <utils/Errors.h>
-
-#include <gui/BitTube.h>
-#include <gui/DisplayEventReceiver.h>
-#include <gui/IDisplayEventConnection.h>
-#include <gui/ISurfaceComposer.h>
-
-#include <private/gui/ComposerService.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-DisplayEventReceiver::DisplayEventReceiver() {
- sp<ISurfaceComposer> sf(ComposerService::getComposerService());
- if (sf != NULL) {
- mEventConnection = sf->createDisplayEventConnection();
- if (mEventConnection != NULL) {
- mDataChannel = mEventConnection->getDataChannel();
- }
- }
-}
-
-DisplayEventReceiver::~DisplayEventReceiver() {
-}
-
-status_t DisplayEventReceiver::initCheck() const {
- if (mDataChannel != NULL)
- return NO_ERROR;
- return NO_INIT;
-}
-
-int DisplayEventReceiver::getFd() const {
- if (mDataChannel == NULL)
- return NO_INIT;
-
- return mDataChannel->getFd();
-}
-
-status_t DisplayEventReceiver::setVsyncRate(uint32_t count) {
- if (int32_t(count) < 0)
- return BAD_VALUE;
-
- if (mEventConnection != NULL) {
- mEventConnection->setVsyncRate(count);
- return NO_ERROR;
- }
- return NO_INIT;
-}
-
-status_t DisplayEventReceiver::requestNextVsync() {
- if (mEventConnection != NULL) {
- mEventConnection->requestNextVsync();
- return NO_ERROR;
- }
- return NO_INIT;
-}
-
-
-ssize_t DisplayEventReceiver::getEvents(DisplayEventReceiver::Event* events,
- size_t count) {
- return DisplayEventReceiver::getEvents(mDataChannel, events, count);
-}
-
-ssize_t DisplayEventReceiver::getEvents(const sp<BitTube>& dataChannel,
- Event* events, size_t count)
-{
- ssize_t size = dataChannel->read(events, sizeof(events[0])*count);
- ALOGE_IF(size<0,
- "DisplayEventReceiver::getEvents error (%s)",
- strerror(-size));
- if (size >= 0) {
- // Note: if (size % sizeof(events[0])) != 0, we've got a
- // partial read. This can happen if the queue filed up (ie: if we
- // didn't pull from it fast enough).
- // We discard the partial event and rely on the sender to
- // re-send the event if appropriate (some events, like VSYNC
- // can be lost forever).
-
- // returns number of events read
- size /= sizeof(events[0]);
- }
- return size;
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/gui/IDisplayEventConnection.cpp b/libs/gui/IDisplayEventConnection.cpp
deleted file mode 100644
index 887d176..0000000
--- a/libs/gui/IDisplayEventConnection.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-
-#include <binder/Parcel.h>
-#include <binder/IInterface.h>
-
-#include <gui/IDisplayEventConnection.h>
-#include <gui/BitTube.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-enum {
- GET_DATA_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
- SET_VSYNC_RATE,
- REQUEST_NEXT_VSYNC
-};
-
-class BpDisplayEventConnection : public BpInterface<IDisplayEventConnection>
-{
-public:
- BpDisplayEventConnection(const sp<IBinder>& impl)
- : BpInterface<IDisplayEventConnection>(impl)
- {
- }
-
- virtual sp<BitTube> getDataChannel() const
- {
- Parcel data, reply;
- data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
- remote()->transact(GET_DATA_CHANNEL, data, &reply);
- return new BitTube(reply);
- }
-
- virtual void setVsyncRate(uint32_t count) {
- Parcel data, reply;
- data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
- data.writeInt32(count);
- remote()->transact(SET_VSYNC_RATE, data, &reply);
- }
-
- virtual void requestNextVsync() {
- Parcel data, reply;
- data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
- remote()->transact(REQUEST_NEXT_VSYNC, data, &reply, IBinder::FLAG_ONEWAY);
- }
-};
-
-IMPLEMENT_META_INTERFACE(DisplayEventConnection, "android.gui.DisplayEventConnection");
-
-// ----------------------------------------------------------------------------
-
-status_t BnDisplayEventConnection::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case GET_DATA_CHANNEL: {
- CHECK_INTERFACE(IDisplayEventConnection, data, reply);
- sp<BitTube> channel(getDataChannel());
- channel->writeToParcel(reply);
- return NO_ERROR;
- } break;
- case SET_VSYNC_RATE: {
- CHECK_INTERFACE(IDisplayEventConnection, data, reply);
- setVsyncRate(data.readInt32());
- return NO_ERROR;
- } break;
- case REQUEST_NEXT_VSYNC: {
- CHECK_INTERFACE(IDisplayEventConnection, data, reply);
- requestNextVsync();
- return NO_ERROR;
- } break;
- }
- return BBinder::onTransact(code, data, reply, flags);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/IGraphicBufferAlloc.cpp b/libs/gui/IGraphicBufferAlloc.cpp
deleted file mode 100644
index a70a5e8..0000000
--- a/libs/gui/IGraphicBufferAlloc.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-// tag as surfaceflinger
-#define LOG_TAG "SurfaceFlinger"
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/Parcel.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include <gui/IGraphicBufferAlloc.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-enum {
- CREATE_GRAPHIC_BUFFER = IBinder::FIRST_CALL_TRANSACTION,
-};
-
-class BpGraphicBufferAlloc : public BpInterface<IGraphicBufferAlloc>
-{
-public:
- BpGraphicBufferAlloc(const sp<IBinder>& impl)
- : BpInterface<IGraphicBufferAlloc>(impl)
- {
- }
-
- virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t usage, status_t* error) {
- Parcel data, reply;
- data.writeInterfaceToken(IGraphicBufferAlloc::getInterfaceDescriptor());
- data.writeInt32(w);
- data.writeInt32(h);
- data.writeInt32(format);
- data.writeInt32(usage);
- remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply);
- sp<GraphicBuffer> graphicBuffer;
- status_t result = reply.readInt32();
- if (result == NO_ERROR) {
- graphicBuffer = new GraphicBuffer();
- reply.read(*graphicBuffer);
- // reply.readStrongBinder();
- // here we don't even have to read the BufferReference from
- // the parcel, it'll die with the parcel.
- }
- *error = result;
- return graphicBuffer;
- }
-};
-
-IMPLEMENT_META_INTERFACE(GraphicBufferAlloc, "android.ui.IGraphicBufferAlloc");
-
-// ----------------------------------------------------------------------
-
-status_t BnGraphicBufferAlloc::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- // codes that don't require permission check
-
- /* BufferReference just keeps a strong reference to a
- * GraphicBuffer until it is destroyed (that is, until
- * no local or remote process have a reference to it).
- */
- class BufferReference : public BBinder {
- sp<GraphicBuffer> buffer;
- public:
- BufferReference(const sp<GraphicBuffer>& buffer) : buffer(buffer) { }
- };
-
-
- switch(code) {
- case CREATE_GRAPHIC_BUFFER: {
- CHECK_INTERFACE(IGraphicBufferAlloc, data, reply);
- uint32_t w = data.readInt32();
- uint32_t h = data.readInt32();
- PixelFormat format = data.readInt32();
- uint32_t usage = data.readInt32();
- status_t error;
- sp<GraphicBuffer> result =
- createGraphicBuffer(w, h, format, usage, &error);
- reply->writeInt32(error);
- if (result != 0) {
- reply->write(*result);
- // We add a BufferReference to this parcel to make sure the
- // buffer stays alive until the GraphicBuffer object on
- // the other side has been created.
- // This is needed so that the buffer handle can be
- // registered before the buffer is destroyed on implementations
- // that do not use file-descriptors to track their buffers.
- reply->writeStrongBinder( new BufferReference(result) );
- }
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-}; // namespace android
diff --git a/libs/gui/ISensorEventConnection.cpp b/libs/gui/ISensorEventConnection.cpp
deleted file mode 100644
index 0e51e8e..0000000
--- a/libs/gui/ISensorEventConnection.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-
-#include <binder/Parcel.h>
-#include <binder/IInterface.h>
-
-#include <gui/ISensorEventConnection.h>
-#include <gui/BitTube.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-enum {
- GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
- ENABLE_DISABLE,
- SET_EVENT_RATE
-};
-
-class BpSensorEventConnection : public BpInterface<ISensorEventConnection>
-{
-public:
- BpSensorEventConnection(const sp<IBinder>& impl)
- : BpInterface<ISensorEventConnection>(impl)
- {
- }
-
- virtual sp<BitTube> getSensorChannel() const
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor());
- remote()->transact(GET_SENSOR_CHANNEL, data, &reply);
- return new BitTube(reply);
- }
-
- virtual status_t enableDisable(int handle, bool enabled)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor());
- data.writeInt32(handle);
- data.writeInt32(enabled);
- remote()->transact(ENABLE_DISABLE, data, &reply);
- return reply.readInt32();
- }
-
- virtual status_t setEventRate(int handle, nsecs_t ns)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor());
- data.writeInt32(handle);
- data.writeInt64(ns);
- remote()->transact(SET_EVENT_RATE, data, &reply);
- return reply.readInt32();
- }
-};
-
-IMPLEMENT_META_INTERFACE(SensorEventConnection, "android.gui.SensorEventConnection");
-
-// ----------------------------------------------------------------------------
-
-status_t BnSensorEventConnection::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case GET_SENSOR_CHANNEL: {
- CHECK_INTERFACE(ISensorEventConnection, data, reply);
- sp<BitTube> channel(getSensorChannel());
- channel->writeToParcel(reply);
- return NO_ERROR;
- } break;
- case ENABLE_DISABLE: {
- CHECK_INTERFACE(ISensorEventConnection, data, reply);
- int handle = data.readInt32();
- int enabled = data.readInt32();
- status_t result = enableDisable(handle, enabled);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case SET_EVENT_RATE: {
- CHECK_INTERFACE(ISensorEventConnection, data, reply);
- int handle = data.readInt32();
- int ns = data.readInt64();
- status_t result = setEventRate(handle, ns);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- }
- return BBinder::onTransact(code, data, reply, flags);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/ISensorServer.cpp b/libs/gui/ISensorServer.cpp
deleted file mode 100644
index 7111092..0000000
--- a/libs/gui/ISensorServer.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Vector.h>
-#include <utils/Timers.h>
-
-#include <binder/Parcel.h>
-#include <binder/IInterface.h>
-
-#include <gui/Sensor.h>
-#include <gui/ISensorServer.h>
-#include <gui/ISensorEventConnection.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-enum {
- GET_SENSOR_LIST = IBinder::FIRST_CALL_TRANSACTION,
- CREATE_SENSOR_EVENT_CONNECTION,
-};
-
-class BpSensorServer : public BpInterface<ISensorServer>
-{
-public:
- BpSensorServer(const sp<IBinder>& impl)
- : BpInterface<ISensorServer>(impl)
- {
- }
-
- virtual Vector<Sensor> getSensorList()
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor());
- remote()->transact(GET_SENSOR_LIST, data, &reply);
- Sensor s;
- Vector<Sensor> v;
- int32_t n = reply.readInt32();
- v.setCapacity(n);
- while (n--) {
- reply.read(static_cast<Flattenable&>(s));
- v.add(s);
- }
- return v;
- }
-
- virtual sp<ISensorEventConnection> createSensorEventConnection()
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor());
- remote()->transact(CREATE_SENSOR_EVENT_CONNECTION, data, &reply);
- return interface_cast<ISensorEventConnection>(reply.readStrongBinder());
- }
-};
-
-IMPLEMENT_META_INTERFACE(SensorServer, "android.gui.SensorServer");
-
-// ----------------------------------------------------------------------
-
-status_t BnSensorServer::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case GET_SENSOR_LIST: {
- CHECK_INTERFACE(ISensorServer, data, reply);
- Vector<Sensor> v(getSensorList());
- size_t n = v.size();
- reply->writeInt32(n);
- for (size_t i=0 ; i<n ; i++) {
- reply->write(static_cast<const Flattenable&>(v[i]));
- }
- return NO_ERROR;
- } break;
- case CREATE_SENSOR_EVENT_CONNECTION: {
- CHECK_INTERFACE(ISensorServer, data, reply);
- sp<ISensorEventConnection> connection(createSensorEventConnection());
- reply->writeStrongBinder(connection->asBinder());
- return NO_ERROR;
- } break;
- }
- return BBinder::onTransact(code, data, reply, flags);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/ISurface.cpp b/libs/gui/ISurface.cpp
deleted file mode 100644
index c2ea183..0000000
--- a/libs/gui/ISurface.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "ISurface"
-
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/Parcel.h>
-
-#include <gui/ISurface.h>
-#include <gui/ISurfaceTexture.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class BpSurface : public BpInterface<ISurface>
-{
-public:
- BpSurface(const sp<IBinder>& impl)
- : BpInterface<ISurface>(impl)
- {
- }
-
- virtual sp<ISurfaceTexture> getSurfaceTexture() const {
- Parcel data, reply;
- data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
- remote()->transact(GET_SURFACE_TEXTURE, data, &reply);
- return interface_cast<ISurfaceTexture>(reply.readStrongBinder());
- }
-};
-
-IMPLEMENT_META_INTERFACE(Surface, "android.ui.ISurface");
-
-// ----------------------------------------------------------------------
-
-status_t BnSurface::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case GET_SURFACE_TEXTURE: {
- CHECK_INTERFACE(ISurface, data, reply);
- reply->writeStrongBinder( getSurfaceTexture()->asBinder() );
- return NO_ERROR;
- }
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-}; // namespace android
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
deleted file mode 100644
index 1f1794c..0000000
--- a/libs/gui/ISurfaceComposer.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-// tag as surfaceflinger
-#define LOG_TAG "SurfaceFlinger"
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/Parcel.h>
-#include <binder/IMemory.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-
-#include <gui/BitTube.h>
-#include <gui/IDisplayEventConnection.h>
-#include <gui/ISurfaceComposer.h>
-#include <gui/ISurfaceTexture.h>
-
-#include <private/gui/LayerState.h>
-
-#include <ui/DisplayInfo.h>
-
-#include <utils/Log.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class IDisplayEventConnection;
-
-class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
-{
-public:
- BpSurfaceComposer(const sp<IBinder>& impl)
- : BpInterface<ISurfaceComposer>(impl)
- {
- }
-
- virtual sp<ISurfaceComposerClient> createConnection()
- {
- uint32_t n;
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply);
- return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder());
- }
-
- virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc()
- {
- uint32_t n;
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- remote()->transact(BnSurfaceComposer::CREATE_GRAPHIC_BUFFER_ALLOC, data, &reply);
- return interface_cast<IGraphicBufferAlloc>(reply.readStrongBinder());
- }
-
- virtual sp<IMemoryHeap> getCblk() const
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- remote()->transact(BnSurfaceComposer::GET_CBLK, data, &reply);
- return interface_cast<IMemoryHeap>(reply.readStrongBinder());
- }
-
- virtual void setTransactionState(const Vector<ComposerState>& state,
- int orientation, uint32_t flags)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- Vector<ComposerState>::const_iterator b(state.begin());
- Vector<ComposerState>::const_iterator e(state.end());
- data.writeInt32(state.size());
- for ( ; b != e ; ++b ) {
- b->write(data);
- }
- data.writeInt32(orientation);
- data.writeInt32(flags);
- remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
- }
-
- virtual void bootFinished()
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply);
- }
-
- virtual status_t captureScreen(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* width, uint32_t* height, PixelFormat* format,
- uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- data.writeInt32(dpy);
- data.writeInt32(reqWidth);
- data.writeInt32(reqHeight);
- data.writeInt32(minLayerZ);
- data.writeInt32(maxLayerZ);
- remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
- *heap = interface_cast<IMemoryHeap>(reply.readStrongBinder());
- *width = reply.readInt32();
- *height = reply.readInt32();
- *format = reply.readInt32();
- return reply.readInt32();
- }
-
- virtual status_t turnElectronBeamOff(int32_t mode)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- data.writeInt32(mode);
- remote()->transact(BnSurfaceComposer::TURN_ELECTRON_BEAM_OFF, data, &reply);
- return reply.readInt32();
- }
-
- virtual status_t turnElectronBeamOn(int32_t mode)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- data.writeInt32(mode);
- remote()->transact(BnSurfaceComposer::TURN_ELECTRON_BEAM_ON, data, &reply);
- return reply.readInt32();
- }
-
- virtual bool authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture) const
- {
- Parcel data, reply;
- int err = NO_ERROR;
- err = data.writeInterfaceToken(
- ISurfaceComposer::getInterfaceDescriptor());
- if (err != NO_ERROR) {
- ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
- "interface descriptor: %s (%d)", strerror(-err), -err);
- return false;
- }
- err = data.writeStrongBinder(surfaceTexture->asBinder());
- if (err != NO_ERROR) {
- ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
- "strong binder to parcel: %s (%d)", strerror(-err), -err);
- return false;
- }
- err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data,
- &reply);
- if (err != NO_ERROR) {
- ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
- "performing transaction: %s (%d)", strerror(-err), -err);
- return false;
- }
- int32_t result = 0;
- err = reply.readInt32(&result);
- if (err != NO_ERROR) {
- ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
- "retrieving result: %s (%d)", strerror(-err), -err);
- return false;
- }
- return result != 0;
- }
-
- virtual sp<IDisplayEventConnection> createDisplayEventConnection()
- {
- Parcel data, reply;
- sp<IDisplayEventConnection> result;
- int err = data.writeInterfaceToken(
- ISurfaceComposer::getInterfaceDescriptor());
- if (err != NO_ERROR) {
- return result;
- }
- err = remote()->transact(
- BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION,
- data, &reply);
- if (err != NO_ERROR) {
- ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing "
- "transaction: %s (%d)", strerror(-err), -err);
- return result;
- }
- result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder());
- return result;
- }
-};
-
-IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer");
-
-// ----------------------------------------------------------------------
-
-status_t BnSurfaceComposer::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case CREATE_CONNECTION: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> b = createConnection()->asBinder();
- reply->writeStrongBinder(b);
- } break;
- case CREATE_GRAPHIC_BUFFER_ALLOC: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> b = createGraphicBufferAlloc()->asBinder();
- reply->writeStrongBinder(b);
- } break;
- case SET_TRANSACTION_STATE: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- size_t count = data.readInt32();
- ComposerState s;
- Vector<ComposerState> state;
- state.setCapacity(count);
- for (size_t i=0 ; i<count ; i++) {
- s.read(data);
- state.add(s);
- }
- int orientation = data.readInt32();
- uint32_t flags = data.readInt32();
- setTransactionState(state, orientation, flags);
- } break;
- case BOOT_FINISHED: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- bootFinished();
- } break;
- case GET_CBLK: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> b = getCblk()->asBinder();
- reply->writeStrongBinder(b);
- } break;
- case CAPTURE_SCREEN: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- DisplayID dpy = data.readInt32();
- uint32_t reqWidth = data.readInt32();
- uint32_t reqHeight = data.readInt32();
- uint32_t minLayerZ = data.readInt32();
- uint32_t maxLayerZ = data.readInt32();
- sp<IMemoryHeap> heap;
- uint32_t w, h;
- PixelFormat f;
- status_t res = captureScreen(dpy, &heap, &w, &h, &f,
- reqWidth, reqHeight, minLayerZ, maxLayerZ);
- reply->writeStrongBinder(heap->asBinder());
- reply->writeInt32(w);
- reply->writeInt32(h);
- reply->writeInt32(f);
- reply->writeInt32(res);
- } break;
- case TURN_ELECTRON_BEAM_OFF: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- int32_t mode = data.readInt32();
- status_t res = turnElectronBeamOff(mode);
- reply->writeInt32(res);
- } break;
- case TURN_ELECTRON_BEAM_ON: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- int32_t mode = data.readInt32();
- status_t res = turnElectronBeamOn(mode);
- reply->writeInt32(res);
- } break;
- case AUTHENTICATE_SURFACE: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<ISurfaceTexture> surfaceTexture =
- interface_cast<ISurfaceTexture>(data.readStrongBinder());
- int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0;
- reply->writeInt32(result);
- } break;
- case CREATE_DISPLAY_EVENT_CONNECTION: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IDisplayEventConnection> connection(createDisplayEventConnection());
- reply->writeStrongBinder(connection->asBinder());
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-};
diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp
deleted file mode 100644
index ca9ed5b..0000000
--- a/libs/gui/ISurfaceComposerClient.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-// tag as surfaceflinger
-#define LOG_TAG "SurfaceFlinger"
-
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/Parcel.h>
-#include <binder/IMemory.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-
-#include <ui/Point.h>
-#include <ui/Rect.h>
-
-#include <gui/ISurface.h>
-#include <gui/ISurfaceComposerClient.h>
-#include <private/gui/LayerState.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-enum {
- CREATE_SURFACE = IBinder::FIRST_CALL_TRANSACTION,
- DESTROY_SURFACE
-};
-
-class BpSurfaceComposerClient : public BpInterface<ISurfaceComposerClient>
-{
-public:
- BpSurfaceComposerClient(const sp<IBinder>& impl)
- : BpInterface<ISurfaceComposerClient>(impl)
- {
- }
-
- virtual sp<ISurface> createSurface( surface_data_t* params,
- const String8& name,
- DisplayID display,
- uint32_t w,
- uint32_t h,
- PixelFormat format,
- uint32_t flags)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor());
- data.writeString8(name);
- data.writeInt32(display);
- data.writeInt32(w);
- data.writeInt32(h);
- data.writeInt32(format);
- data.writeInt32(flags);
- remote()->transact(CREATE_SURFACE, data, &reply);
- params->readFromParcel(reply);
- return interface_cast<ISurface>(reply.readStrongBinder());
- }
-
- virtual status_t destroySurface(SurfaceID sid)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor());
- data.writeInt32(sid);
- remote()->transact(DESTROY_SURFACE, data, &reply);
- return reply.readInt32();
- }
-};
-
-IMPLEMENT_META_INTERFACE(SurfaceComposerClient, "android.ui.ISurfaceComposerClient");
-
-// ----------------------------------------------------------------------
-
-status_t BnSurfaceComposerClient::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case CREATE_SURFACE: {
- CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
- surface_data_t params;
- String8 name = data.readString8();
- DisplayID display = data.readInt32();
- uint32_t w = data.readInt32();
- uint32_t h = data.readInt32();
- PixelFormat format = data.readInt32();
- uint32_t flags = data.readInt32();
- sp<ISurface> s = createSurface(¶ms, name, display, w, h,
- format, flags);
- params.writeToParcel(reply);
- reply->writeStrongBinder(s->asBinder());
- return NO_ERROR;
- } break;
- case DESTROY_SURFACE: {
- CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
- reply->writeInt32( destroySurface( data.readInt32() ) );
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------
-
-status_t ISurfaceComposerClient::surface_data_t::readFromParcel(const Parcel& parcel)
-{
- token = parcel.readInt32();
- identity = parcel.readInt32();
- return NO_ERROR;
-}
-
-status_t ISurfaceComposerClient::surface_data_t::writeToParcel(Parcel* parcel) const
-{
- parcel->writeInt32(token);
- parcel->writeInt32(identity);
- return NO_ERROR;
-}
-
-}; // namespace android
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp
deleted file mode 100644
index d2e5627..0000000
--- a/libs/gui/ISurfaceTexture.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Vector.h>
-#include <utils/Timers.h>
-
-#include <binder/Parcel.h>
-#include <binder/IInterface.h>
-
-#include <gui/ISurfaceTexture.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-enum {
- REQUEST_BUFFER = IBinder::FIRST_CALL_TRANSACTION,
- SET_BUFFER_COUNT,
- DEQUEUE_BUFFER,
- QUEUE_BUFFER,
- CANCEL_BUFFER,
- SET_CROP,
- SET_TRANSFORM,
- QUERY,
- SET_SYNCHRONOUS_MODE,
- CONNECT,
- DISCONNECT,
- SET_SCALING_MODE,
-};
-
-
-class BpSurfaceTexture : public BpInterface<ISurfaceTexture>
-{
-public:
- BpSurfaceTexture(const sp<IBinder>& impl)
- : BpInterface<ISurfaceTexture>(impl)
- {
- }
-
- virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(bufferIdx);
- status_t result =remote()->transact(REQUEST_BUFFER, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- bool nonNull = reply.readInt32();
- if (nonNull) {
- *buf = new GraphicBuffer();
- reply.read(**buf);
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t setBufferCount(int bufferCount)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(bufferCount);
- status_t result =remote()->transact(SET_BUFFER_COUNT, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t dequeueBuffer(int *buf, uint32_t w, uint32_t h,
- uint32_t format, uint32_t usage) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(w);
- data.writeInt32(h);
- data.writeInt32(format);
- data.writeInt32(usage);
- status_t result = remote()->transact(DEQUEUE_BUFFER, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- *buf = reply.readInt32();
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t queueBuffer(int buf, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(buf);
- data.writeInt64(timestamp);
- status_t result = remote()->transact(QUEUE_BUFFER, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- *outWidth = reply.readInt32();
- *outHeight = reply.readInt32();
- *outTransform = reply.readInt32();
- result = reply.readInt32();
- return result;
- }
-
- virtual void cancelBuffer(int buf) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(buf);
- remote()->transact(CANCEL_BUFFER, data, &reply);
- }
-
- virtual status_t setCrop(const Rect& reg) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeFloat(reg.left);
- data.writeFloat(reg.top);
- data.writeFloat(reg.right);
- data.writeFloat(reg.bottom);
- status_t result = remote()->transact(SET_CROP, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t setTransform(uint32_t transform) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(transform);
- status_t result = remote()->transact(SET_TRANSFORM, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t setScalingMode(int mode) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(mode);
- status_t result = remote()->transact(SET_SCALING_MODE, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual int query(int what, int* value) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(what);
- status_t result = remote()->transact(QUERY, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- value[0] = reply.readInt32();
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t setSynchronousMode(bool enabled) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(enabled);
- status_t result = remote()->transact(SET_SYNCHRONOUS_MODE, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(api);
- status_t result = remote()->transact(CONNECT, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- *outWidth = reply.readInt32();
- *outHeight = reply.readInt32();
- *outTransform = reply.readInt32();
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t disconnect(int api) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(api);
- status_t result =remote()->transact(DISCONNECT, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-};
-
-IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture");
-
-// ----------------------------------------------------------------------
-
-status_t BnSurfaceTexture::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case REQUEST_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int bufferIdx = data.readInt32();
- sp<GraphicBuffer> buffer;
- int result = requestBuffer(bufferIdx, &buffer);
- reply->writeInt32(buffer != 0);
- if (buffer != 0) {
- reply->write(*buffer);
- }
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case SET_BUFFER_COUNT: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int bufferCount = data.readInt32();
- int result = setBufferCount(bufferCount);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case DEQUEUE_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- uint32_t w = data.readInt32();
- uint32_t h = data.readInt32();
- uint32_t format = data.readInt32();
- uint32_t usage = data.readInt32();
- int buf;
- int result = dequeueBuffer(&buf, w, h, format, usage);
- reply->writeInt32(buf);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case QUEUE_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int buf = data.readInt32();
- int64_t timestamp = data.readInt64();
- uint32_t outWidth, outHeight, outTransform;
- status_t result = queueBuffer(buf, timestamp,
- &outWidth, &outHeight, &outTransform);
- reply->writeInt32(outWidth);
- reply->writeInt32(outHeight);
- reply->writeInt32(outTransform);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case CANCEL_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int buf = data.readInt32();
- cancelBuffer(buf);
- return NO_ERROR;
- } break;
- case SET_CROP: {
- Rect reg;
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- reg.left = data.readFloat();
- reg.top = data.readFloat();
- reg.right = data.readFloat();
- reg.bottom = data.readFloat();
- status_t result = setCrop(reg);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case SET_TRANSFORM: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- uint32_t transform = data.readInt32();
- status_t result = setTransform(transform);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case SET_SCALING_MODE: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int mode = data.readInt32();
- status_t result = setScalingMode(mode);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case QUERY: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int value;
- int what = data.readInt32();
- int res = query(what, &value);
- reply->writeInt32(value);
- reply->writeInt32(res);
- return NO_ERROR;
- } break;
- case SET_SYNCHRONOUS_MODE: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- bool enabled = data.readInt32();
- status_t res = setSynchronousMode(enabled);
- reply->writeInt32(res);
- return NO_ERROR;
- } break;
- case CONNECT: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int api = data.readInt32();
- uint32_t outWidth, outHeight, outTransform;
- status_t res = connect(api,
- &outWidth, &outHeight, &outTransform);
- reply->writeInt32(outWidth);
- reply->writeInt32(outHeight);
- reply->writeInt32(outTransform);
- reply->writeInt32(res);
- return NO_ERROR;
- } break;
- case DISCONNECT: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int api = data.readInt32();
- status_t res = disconnect(api);
- reply->writeInt32(res);
- return NO_ERROR;
- } break;
- }
- return BBinder::onTransact(code, data, reply, flags);
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
deleted file mode 100644
index 224c305..0000000
--- a/libs/gui/LayerState.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/Errors.h>
-#include <binder/Parcel.h>
-#include <gui/ISurfaceComposerClient.h>
-#include <private/gui/LayerState.h>
-
-namespace android {
-
-status_t layer_state_t::write(Parcel& output) const
-{
- status_t err;
-
- size_t len = transparentRegion.write(NULL, 0);
- err = output.writeInt32(len);
- if (err < NO_ERROR) return err;
-
- void* buf = output.writeInplace(len);
- if (buf == NULL) return NO_MEMORY;
-
- err = transparentRegion.write(buf, len);
- if (err < NO_ERROR) return err;
-
- // NOTE: regions are at the end of the structure
- size_t size = sizeof(layer_state_t);
- size -= sizeof(transparentRegion);
- err = output.write(this, size);
- return err;
-}
-
-status_t layer_state_t::read(const Parcel& input)
-{
- status_t err;
- size_t len = input.readInt32();
- void const* buf = input.readInplace(len);
- if (buf == NULL) return NO_MEMORY;
-
- err = transparentRegion.read(buf);
- if (err < NO_ERROR) return err;
-
- // NOTE: regions are at the end of the structure
- size_t size = sizeof(layer_state_t);
- size -= sizeof(transparentRegion);
- input.read(this, size);
- return NO_ERROR;
-}
-
-status_t ComposerState::write(Parcel& output) const {
- output.writeStrongBinder(client->asBinder());
- return state.write(output);
-}
-
-status_t ComposerState::read(const Parcel& input) {
- client = interface_cast<ISurfaceComposerClient>(input.readStrongBinder());
- return state.read(input);
-}
-
-}; // namespace android
diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp
deleted file mode 100644
index f9a2c046..0000000
--- a/libs/gui/Sensor.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/String8.h>
-#include <utils/Flattenable.h>
-
-#include <hardware/sensors.h>
-
-#include <gui/Sensor.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-Sensor::Sensor()
- : mHandle(0), mType(0),
- mMinValue(0), mMaxValue(0), mResolution(0),
- mPower(0), mMinDelay(0)
-{
-}
-
-Sensor::Sensor(struct sensor_t const* hwSensor)
-{
- mName = hwSensor->name;
- mVendor = hwSensor->vendor;
- mHandle = hwSensor->handle;
- mType = hwSensor->type;
- mMinValue = 0; // FIXME: minValue
- mMaxValue = hwSensor->maxRange; // FIXME: maxValue
- mResolution = hwSensor->resolution;
- mPower = hwSensor->power;
- mMinDelay = hwSensor->minDelay;
-}
-
-Sensor::~Sensor()
-{
-}
-
-const String8& Sensor::getName() const {
- return mName;
-}
-
-const String8& Sensor::getVendor() const {
- return mVendor;
-}
-
-int32_t Sensor::getHandle() const {
- return mHandle;
-}
-
-int32_t Sensor::getType() const {
- return mType;
-}
-
-float Sensor::getMinValue() const {
- return mMinValue;
-}
-
-float Sensor::getMaxValue() const {
- return mMaxValue;
-}
-
-float Sensor::getResolution() const {
- return mResolution;
-}
-
-float Sensor::getPowerUsage() const {
- return mPower;
-}
-
-int32_t Sensor::getMinDelay() const {
- return mMinDelay;
-}
-
-nsecs_t Sensor::getMinDelayNs() const {
- return getMinDelay() * 1000;
-}
-
-int32_t Sensor::getVersion() const {
- return mVersion;
-}
-
-size_t Sensor::getFlattenedSize() const
-{
- return sizeof(int32_t) + ((mName.length() + 3) & ~3) +
- sizeof(int32_t) + ((mVendor.length() + 3) & ~3) +
- sizeof(int32_t) * 2 +
- sizeof(float) * 4 +
- sizeof(int32_t);
-}
-
-size_t Sensor::getFdCount() const
-{
- return 0;
-}
-
-static inline
-size_t write(void* buffer, size_t offset, const String8& value) {
- memcpy(static_cast<char*>(buffer) + offset, value.string(), value.length());
- return (value.length() + 3) & ~3;
-}
-
-static inline
-size_t write(void* buffer, size_t offset, float value) {
- *reinterpret_cast<float*>(static_cast<char*>(buffer) + offset) = value;
- return sizeof(float);
-}
-
-static inline
-size_t write(void* buffer, size_t offset, int32_t value) {
- *reinterpret_cast<int32_t*>(static_cast<char*>(buffer) + offset) = value;
- return sizeof(int32_t);
-}
-
-status_t Sensor::flatten(void* buffer, size_t size,
- int fds[], size_t count) const
-{
- if (size < Sensor::getFlattenedSize())
- return -ENOMEM;
-
- size_t offset = 0;
- offset += write(buffer, offset, int32_t(mName.length()));
- offset += write(buffer, offset, mName);
- offset += write(buffer, offset, int32_t(mVendor.length()));
- offset += write(buffer, offset, mVendor);
- offset += write(buffer, offset, mHandle);
- offset += write(buffer, offset, mType);
- offset += write(buffer, offset, mMinValue);
- offset += write(buffer, offset, mMaxValue);
- offset += write(buffer, offset, mResolution);
- offset += write(buffer, offset, mPower);
- offset += write(buffer, offset, mMinDelay);
-
- return NO_ERROR;
-}
-
-static inline
-size_t read(void const* buffer, size_t offset, String8* value, int32_t len) {
- value->setTo(static_cast<char const*>(buffer) + offset, len);
- return (len + 3) & ~3;
-}
-
-static inline
-size_t read(void const* buffer, size_t offset, float* value) {
- *value = *reinterpret_cast<float const*>(static_cast<char const*>(buffer) + offset);
- return sizeof(float);
-}
-
-static inline
-size_t read(void const* buffer, size_t offset, int32_t* value) {
- *value = *reinterpret_cast<int32_t const*>(static_cast<char const*>(buffer) + offset);
- return sizeof(int32_t);
-}
-
-status_t Sensor::unflatten(void const* buffer, size_t size,
- int fds[], size_t count)
-{
- int32_t len;
- size_t offset = 0;
- offset += read(buffer, offset, &len);
- offset += read(buffer, offset, &mName, len);
- offset += read(buffer, offset, &len);
- offset += read(buffer, offset, &mVendor, len);
- offset += read(buffer, offset, &mHandle);
- offset += read(buffer, offset, &mType);
- offset += read(buffer, offset, &mMinValue);
- offset += read(buffer, offset, &mMaxValue);
- offset += read(buffer, offset, &mResolution);
- offset += read(buffer, offset, &mPower);
- offset += read(buffer, offset, &mMinDelay);
-
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
deleted file mode 100644
index b95dd902..0000000
--- a/libs/gui/SensorEventQueue.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Sensors"
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Looper.h>
-
-#include <gui/Sensor.h>
-#include <gui/BitTube.h>
-#include <gui/SensorEventQueue.h>
-#include <gui/ISensorEventConnection.h>
-
-#include <android/sensor.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-SensorEventQueue::SensorEventQueue(const sp<ISensorEventConnection>& connection)
- : mSensorEventConnection(connection)
-{
-}
-
-SensorEventQueue::~SensorEventQueue()
-{
-}
-
-void SensorEventQueue::onFirstRef()
-{
- mSensorChannel = mSensorEventConnection->getSensorChannel();
-}
-
-int SensorEventQueue::getFd() const
-{
- return mSensorChannel->getFd();
-}
-
-ssize_t SensorEventQueue::write(ASensorEvent const* events, size_t numEvents)
-{
- ssize_t size = mSensorChannel->write(events, numEvents * sizeof(events[0]));
- if (size >= 0) {
- if (size % sizeof(events[0])) {
- // partial write!!! should never happen.
- return -EINVAL;
- }
- // returns number of events written
- size /= sizeof(events[0]);
- }
- return size;
-}
-
-ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents)
-{
- ssize_t size = mSensorChannel->read(events, numEvents*sizeof(events[0]));
- ALOGE_IF(size<0 && size!=-EAGAIN,
- "SensorChannel::read error (%s)", strerror(-size));
- if (size >= 0) {
- if (size % sizeof(events[0])) {
- // partial read!!! should never happen.
- ALOGE("SensorEventQueue partial read (event-size=%u, read=%d)",
- sizeof(events[0]), int(size));
- return -EINVAL;
- }
- // returns number of events read
- size /= sizeof(events[0]);
- }
- return size;
-}
-
-sp<Looper> SensorEventQueue::getLooper() const
-{
- Mutex::Autolock _l(mLock);
- if (mLooper == 0) {
- mLooper = new Looper(true);
- mLooper->addFd(getFd(), getFd(), ALOOPER_EVENT_INPUT, NULL, NULL);
- }
- return mLooper;
-}
-
-status_t SensorEventQueue::waitForEvent() const
-{
- const int fd = getFd();
- sp<Looper> looper(getLooper());
-
- int32_t result;
- do {
- result = looper->pollOnce(-1);
- if (result == ALOOPER_EVENT_ERROR) {
- ALOGE("SensorEventQueue::waitForEvent error (errno=%d)", errno);
- result = -EPIPE; // unknown error, so we make up one
- break;
- }
- } while (result != fd);
-
- return (result == fd) ? status_t(NO_ERROR) : result;
-}
-
-status_t SensorEventQueue::wake() const
-{
- sp<Looper> looper(getLooper());
- looper->wake();
- return NO_ERROR;
-}
-
-status_t SensorEventQueue::enableSensor(Sensor const* sensor) const {
- return mSensorEventConnection->enableDisable(sensor->getHandle(), true);
-}
-
-status_t SensorEventQueue::disableSensor(Sensor const* sensor) const {
- return mSensorEventConnection->enableDisable(sensor->getHandle(), false);
-}
-
-status_t SensorEventQueue::enableSensor(int32_t handle, int32_t us) const {
- status_t err = mSensorEventConnection->enableDisable(handle, true);
- if (err == NO_ERROR) {
- mSensorEventConnection->setEventRate(handle, us2ns(us));
- }
- return err;
-}
-
-status_t SensorEventQueue::disableSensor(int32_t handle) const {
- return mSensorEventConnection->enableDisable(handle, false);
-}
-
-status_t SensorEventQueue::setEventRate(Sensor const* sensor, nsecs_t ns) const {
- return mSensorEventConnection->setEventRate(sensor->getHandle(), ns);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp
deleted file mode 100644
index b80da56..0000000
--- a/libs/gui/SensorManager.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Sensors"
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Singleton.h>
-
-#include <binder/IBinder.h>
-#include <binder/IServiceManager.h>
-
-#include <gui/ISensorServer.h>
-#include <gui/ISensorEventConnection.h>
-#include <gui/Sensor.h>
-#include <gui/SensorManager.h>
-#include <gui/SensorEventQueue.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-ANDROID_SINGLETON_STATIC_INSTANCE(SensorManager)
-
-SensorManager::SensorManager()
- : mSensorList(0)
-{
- // okay we're not locked here, but it's not needed during construction
- assertStateLocked();
-}
-
-SensorManager::~SensorManager()
-{
- free(mSensorList);
-}
-
-void SensorManager::sensorManagerDied()
-{
- Mutex::Autolock _l(mLock);
- mSensorServer.clear();
- free(mSensorList);
- mSensorList = NULL;
- mSensors.clear();
-}
-
-status_t SensorManager::assertStateLocked() const {
- if (mSensorServer == NULL) {
- // try for one second
- const String16 name("sensorservice");
- for (int i=0 ; i<4 ; i++) {
- status_t err = getService(name, &mSensorServer);
- if (err == NAME_NOT_FOUND) {
- usleep(250000);
- continue;
- }
- if (err != NO_ERROR) {
- return err;
- }
- break;
- }
-
- class DeathObserver : public IBinder::DeathRecipient {
- SensorManager& mSensorManger;
- virtual void binderDied(const wp<IBinder>& who) {
- ALOGW("sensorservice died [%p]", who.unsafe_get());
- mSensorManger.sensorManagerDied();
- }
- public:
- DeathObserver(SensorManager& mgr) : mSensorManger(mgr) { }
- };
-
- mDeathObserver = new DeathObserver(*const_cast<SensorManager *>(this));
- mSensorServer->asBinder()->linkToDeath(mDeathObserver);
-
- mSensors = mSensorServer->getSensorList();
- size_t count = mSensors.size();
- mSensorList = (Sensor const**)malloc(count * sizeof(Sensor*));
- for (size_t i=0 ; i<count ; i++) {
- mSensorList[i] = mSensors.array() + i;
- }
- }
-
- return NO_ERROR;
-}
-
-
-
-ssize_t SensorManager::getSensorList(Sensor const* const** list) const
-{
- Mutex::Autolock _l(mLock);
- status_t err = assertStateLocked();
- if (err < 0) {
- return ssize_t(err);
- }
- *list = mSensorList;
- return mSensors.size();
-}
-
-Sensor const* SensorManager::getDefaultSensor(int type)
-{
- Mutex::Autolock _l(mLock);
- if (assertStateLocked() == NO_ERROR) {
- // For now we just return the first sensor of that type we find.
- // in the future it will make sense to let the SensorService make
- // that decision.
- for (size_t i=0 ; i<mSensors.size() ; i++) {
- if (mSensorList[i]->getType() == type)
- return mSensorList[i];
- }
- }
- return NULL;
-}
-
-sp<SensorEventQueue> SensorManager::createEventQueue()
-{
- sp<SensorEventQueue> queue;
-
- Mutex::Autolock _l(mLock);
- while (assertStateLocked() == NO_ERROR) {
- sp<ISensorEventConnection> connection =
- mSensorServer->createSensorEventConnection();
- if (connection == NULL) {
- // SensorService just died.
- ALOGE("createEventQueue: connection is NULL. SensorService died.");
- continue;
- }
- queue = new SensorEventQueue(connection);
- break;
- }
- return queue;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
deleted file mode 100644
index 72b27ed..0000000
--- a/libs/gui/Surface.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Surface"
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <utils/CallStack.h>
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <utils/threads.h>
-
-#include <binder/IPCThreadState.h>
-
-#include <ui/DisplayInfo.h>
-#include <ui/GraphicBuffer.h>
-#include <ui/Rect.h>
-
-#include <gui/ISurface.h>
-#include <gui/ISurfaceComposer.h>
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTextureClient.h>
-
-namespace android {
-
-// ============================================================================
-// SurfaceControl
-// ============================================================================
-
-SurfaceControl::SurfaceControl(
- const sp<SurfaceComposerClient>& client,
- const sp<ISurface>& surface,
- const ISurfaceComposerClient::surface_data_t& data)
- : mClient(client), mSurface(surface),
- mToken(data.token), mIdentity(data.identity)
-{
-}
-
-SurfaceControl::~SurfaceControl()
-{
- destroy();
-}
-
-void SurfaceControl::destroy()
-{
- if (isValid()) {
- mClient->destroySurface(mToken);
- }
-
- // clear all references and trigger an IPC now, to make sure things
- // happen without delay, since these resources are quite heavy.
- mClient.clear();
- mSurface.clear();
- IPCThreadState::self()->flushCommands();
-}
-
-void SurfaceControl::clear()
-{
- // here, the window manager tells us explicitly that we should destroy
- // the surface's resource. Soon after this call, it will also release
- // its last reference (which will call the dtor); however, it is possible
- // that a client living in the same process still holds references which
- // would delay the call to the dtor -- that is why we need this explicit
- // "clear()" call.
- destroy();
-}
-
-bool SurfaceControl::isSameSurface(
- const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs)
-{
- if (lhs == 0 || rhs == 0)
- return false;
- return lhs->mSurface->asBinder() == rhs->mSurface->asBinder();
-}
-
-status_t SurfaceControl::setLayer(int32_t layer) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setLayer(mToken, layer);
-}
-status_t SurfaceControl::setPosition(int32_t x, int32_t y) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setPosition(mToken, x, y);
-}
-status_t SurfaceControl::setSize(uint32_t w, uint32_t h) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setSize(mToken, w, h);
-}
-status_t SurfaceControl::hide() {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->hide(mToken);
-}
-status_t SurfaceControl::show(int32_t layer) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->show(mToken, layer);
-}
-status_t SurfaceControl::freeze() {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->freeze(mToken);
-}
-status_t SurfaceControl::unfreeze() {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->unfreeze(mToken);
-}
-status_t SurfaceControl::setFlags(uint32_t flags, uint32_t mask) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setFlags(mToken, flags, mask);
-}
-status_t SurfaceControl::setTransparentRegionHint(const Region& transparent) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setTransparentRegionHint(mToken, transparent);
-}
-status_t SurfaceControl::setAlpha(float alpha) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setAlpha(mToken, alpha);
-}
-status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setMatrix(mToken, dsdx, dtdx, dsdy, dtdy);
-}
-status_t SurfaceControl::setFreezeTint(uint32_t tint) {
- status_t err = validate();
- if (err < 0) return err;
- const sp<SurfaceComposerClient>& client(mClient);
- return client->setFreezeTint(mToken, tint);
-}
-
-status_t SurfaceControl::validate() const
-{
- if (mToken<0 || mClient==0) {
- ALOGE("invalid token (%d, identity=%u) or client (%p)",
- mToken, mIdentity, mClient.get());
- return NO_INIT;
- }
- return NO_ERROR;
-}
-
-status_t SurfaceControl::writeSurfaceToParcel(
- const sp<SurfaceControl>& control, Parcel* parcel)
-{
- sp<ISurface> sur;
- uint32_t identity = 0;
- if (SurfaceControl::isValid(control)) {
- sur = control->mSurface;
- identity = control->mIdentity;
- }
- parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL);
- parcel->writeStrongBinder(NULL); // NULL ISurfaceTexture in this case.
- parcel->writeInt32(identity);
- return NO_ERROR;
-}
-
-sp<Surface> SurfaceControl::getSurface() const
-{
- Mutex::Autolock _l(mLock);
- if (mSurfaceData == 0) {
- sp<SurfaceControl> surface_control(const_cast<SurfaceControl*>(this));
- mSurfaceData = new Surface(surface_control);
- }
- return mSurfaceData;
-}
-
-// ============================================================================
-// Surface
-// ============================================================================
-
-// ---------------------------------------------------------------------------
-
-Surface::Surface(const sp<SurfaceControl>& surface)
- : SurfaceTextureClient(),
- mSurface(surface->mSurface),
- mIdentity(surface->mIdentity)
-{
- sp<ISurfaceTexture> st;
- if (mSurface != NULL) {
- st = mSurface->getSurfaceTexture();
- }
- init(st);
-}
-
-Surface::Surface(const Parcel& parcel, const sp<IBinder>& ref)
- : SurfaceTextureClient()
-{
- mSurface = interface_cast<ISurface>(ref);
- sp<IBinder> st_binder(parcel.readStrongBinder());
- sp<ISurfaceTexture> st;
- if (st_binder != NULL) {
- st = interface_cast<ISurfaceTexture>(st_binder);
- } else if (mSurface != NULL) {
- st = mSurface->getSurfaceTexture();
- }
-
- mIdentity = parcel.readInt32();
- init(st);
-}
-
-Surface::Surface(const sp<ISurfaceTexture>& st)
- : SurfaceTextureClient(),
- mSurface(NULL),
- mIdentity(0)
-{
- init(st);
-}
-
-status_t Surface::writeToParcel(
- const sp<Surface>& surface, Parcel* parcel)
-{
- sp<ISurface> sur;
- sp<ISurfaceTexture> st;
- uint32_t identity = 0;
- if (Surface::isValid(surface)) {
- sur = surface->mSurface;
- st = surface->getISurfaceTexture();
- identity = surface->mIdentity;
- } else if (surface != 0 &&
- (surface->mSurface != NULL ||
- surface->getISurfaceTexture() != NULL)) {
- ALOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: "
- "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ",
- surface->mSurface.get(), surface->getISurfaceTexture().get(),
- surface->mIdentity);
- }
-
- parcel->writeStrongBinder(sur != NULL ? sur->asBinder() : NULL);
- parcel->writeStrongBinder(st != NULL ? st->asBinder() : NULL);
- parcel->writeInt32(identity);
- return NO_ERROR;
-
-}
-
-Mutex Surface::sCachedSurfacesLock;
-DefaultKeyedVector<wp<IBinder>, wp<Surface> > Surface::sCachedSurfaces;
-
-sp<Surface> Surface::readFromParcel(const Parcel& data) {
- Mutex::Autolock _l(sCachedSurfacesLock);
- sp<IBinder> binder(data.readStrongBinder());
- sp<Surface> surface = sCachedSurfaces.valueFor(binder).promote();
- if (surface == 0) {
- surface = new Surface(data, binder);
- sCachedSurfaces.add(binder, surface);
- } else {
- // The Surface was found in the cache, but we still should clear any
- // remaining data from the parcel.
- data.readStrongBinder(); // ISurfaceTexture
- data.readInt32(); // identity
- }
- if (surface->mSurface == NULL && surface->getISurfaceTexture() == NULL) {
- surface = 0;
- }
- cleanCachedSurfacesLocked();
- return surface;
-}
-
-// Remove the stale entries from the surface cache. This should only be called
-// with sCachedSurfacesLock held.
-void Surface::cleanCachedSurfacesLocked() {
- for (int i = sCachedSurfaces.size()-1; i >= 0; --i) {
- wp<Surface> s(sCachedSurfaces.valueAt(i));
- if (s == 0 || s.promote() == 0) {
- sCachedSurfaces.removeItemsAt(i);
- }
- }
-}
-
-void Surface::init(const sp<ISurfaceTexture>& surfaceTexture)
-{
- if (mSurface != NULL || surfaceTexture != NULL) {
- ALOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface");
- if (surfaceTexture != NULL) {
- setISurfaceTexture(surfaceTexture);
- setUsage(GraphicBuffer::USAGE_HW_RENDER);
- }
-
- DisplayInfo dinfo;
- SurfaceComposerClient::getDisplayInfo(0, &dinfo);
- const_cast<float&>(ANativeWindow::xdpi) = dinfo.xdpi;
- const_cast<float&>(ANativeWindow::ydpi) = dinfo.ydpi;
- const_cast<uint32_t&>(ANativeWindow::flags) = 0;
- }
-}
-
-Surface::~Surface()
-{
- // clear all references and trigger an IPC now, to make sure things
- // happen without delay, since these resources are quite heavy.
- mSurface.clear();
- IPCThreadState::self()->flushCommands();
-}
-
-bool Surface::isValid() {
- return getISurfaceTexture() != NULL;
-}
-
-sp<ISurfaceTexture> Surface::getSurfaceTexture() {
- return getISurfaceTexture();
-}
-
-sp<IBinder> Surface::asBinder() const {
- return mSurface!=0 ? mSurface->asBinder() : 0;
-}
-
-// ----------------------------------------------------------------------------
-
-int Surface::query(int what, int* value) const {
- switch (what) {
- case NATIVE_WINDOW_CONCRETE_TYPE:
- *value = NATIVE_WINDOW_SURFACE;
- return NO_ERROR;
- }
- return SurfaceTextureClient::query(what, value);
-}
-
-// ----------------------------------------------------------------------------
-
-status_t Surface::lock(SurfaceInfo* other, Region* inOutDirtyRegion) {
- ANativeWindow_Buffer outBuffer;
-
- ARect temp;
- ARect* inOutDirtyBounds = NULL;
- if (inOutDirtyRegion) {
- temp = inOutDirtyRegion->getBounds();
- inOutDirtyBounds = &temp;
- }
-
- status_t err = SurfaceTextureClient::lock(&outBuffer, inOutDirtyBounds);
-
- if (err == NO_ERROR) {
- other->w = uint32_t(outBuffer.width);
- other->h = uint32_t(outBuffer.height);
- other->s = uint32_t(outBuffer.stride);
- other->usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
- other->format = uint32_t(outBuffer.format);
- other->bits = outBuffer.bits;
- }
-
- if (inOutDirtyRegion) {
- inOutDirtyRegion->set( static_cast<Rect const&>(temp) );
- }
-
- return err;
-}
-
-status_t Surface::unlockAndPost() {
- return SurfaceTextureClient::unlockAndPost();
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
deleted file mode 100644
index ceb1ba6..0000000
--- a/libs/gui/SurfaceComposerClient.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "SurfaceComposerClient"
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <utils/Singleton.h>
-#include <utils/SortedVector.h>
-#include <utils/String8.h>
-#include <utils/threads.h>
-
-#include <binder/IMemory.h>
-#include <binder/IServiceManager.h>
-
-#include <ui/DisplayInfo.h>
-
-#include <gui/ISurface.h>
-#include <gui/ISurfaceComposer.h>
-#include <gui/ISurfaceComposerClient.h>
-#include <gui/SurfaceComposerClient.h>
-
-#include <private/gui/ComposerService.h>
-#include <private/gui/LayerState.h>
-#include <private/gui/SharedBufferStack.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-ANDROID_SINGLETON_STATIC_INSTANCE(ComposerService);
-
-ComposerService::ComposerService()
-: Singleton<ComposerService>() {
- const String16 name("SurfaceFlinger");
- while (getService(name, &mComposerService) != NO_ERROR) {
- usleep(250000);
- }
- mServerCblkMemory = mComposerService->getCblk();
- mServerCblk = static_cast<surface_flinger_cblk_t volatile *>(
- mServerCblkMemory->getBase());
-}
-
-sp<ISurfaceComposer> ComposerService::getComposerService() {
- return ComposerService::getInstance().mComposerService;
-}
-
-surface_flinger_cblk_t const volatile * ComposerService::getControlBlock() {
- return ComposerService::getInstance().mServerCblk;
-}
-
-static inline sp<ISurfaceComposer> getComposerService() {
- return ComposerService::getComposerService();
-}
-
-static inline surface_flinger_cblk_t const volatile * get_cblk() {
- return ComposerService::getControlBlock();
-}
-
-// ---------------------------------------------------------------------------
-
-// NOTE: this is NOT a member function (it's a friend defined with its
-// declaration).
-static inline
-int compare_type( const ComposerState& lhs, const ComposerState& rhs) {
- if (lhs.client < rhs.client) return -1;
- if (lhs.client > rhs.client) return 1;
- if (lhs.state.surface < rhs.state.surface) return -1;
- if (lhs.state.surface > rhs.state.surface) return 1;
- return 0;
-}
-
-class Composer : public Singleton<Composer>
-{
- friend class Singleton<Composer>;
-
- mutable Mutex mLock;
- SortedVector<ComposerState> mStates;
- int mOrientation;
- uint32_t mForceSynchronous;
-
- Composer() : Singleton<Composer>(),
- mOrientation(ISurfaceComposer::eOrientationUnchanged),
- mForceSynchronous(0)
- { }
-
- void closeGlobalTransactionImpl(bool synchronous);
-
- layer_state_t* getLayerStateLocked(
- const sp<SurfaceComposerClient>& client, SurfaceID id);
-
-public:
-
- status_t setPosition(const sp<SurfaceComposerClient>& client, SurfaceID id,
- float x, float y);
- status_t setSize(const sp<SurfaceComposerClient>& client, SurfaceID id,
- uint32_t w, uint32_t h);
- status_t setLayer(const sp<SurfaceComposerClient>& client, SurfaceID id,
- int32_t z);
- status_t setFlags(const sp<SurfaceComposerClient>& client, SurfaceID id,
- uint32_t flags, uint32_t mask);
- status_t setTransparentRegionHint(
- const sp<SurfaceComposerClient>& client, SurfaceID id,
- const Region& transparentRegion);
- status_t setAlpha(const sp<SurfaceComposerClient>& client, SurfaceID id,
- float alpha);
- status_t setMatrix(const sp<SurfaceComposerClient>& client, SurfaceID id,
- float dsdx, float dtdx, float dsdy, float dtdy);
- status_t setFreezeTint(
- const sp<SurfaceComposerClient>& client, SurfaceID id,
- uint32_t tint);
- status_t setOrientation(int orientation);
-
- static void closeGlobalTransaction(bool synchronous) {
- Composer::getInstance().closeGlobalTransactionImpl(synchronous);
- }
-};
-
-ANDROID_SINGLETON_STATIC_INSTANCE(Composer);
-
-// ---------------------------------------------------------------------------
-
-void Composer::closeGlobalTransactionImpl(bool synchronous) {
- sp<ISurfaceComposer> sm(getComposerService());
-
- Vector<ComposerState> transaction;
- int orientation;
- uint32_t flags = 0;
-
- { // scope for the lock
- Mutex::Autolock _l(mLock);
- transaction = mStates;
- mStates.clear();
-
- orientation = mOrientation;
- mOrientation = ISurfaceComposer::eOrientationUnchanged;
-
- if (synchronous || mForceSynchronous) {
- flags |= ISurfaceComposer::eSynchronous;
- }
- mForceSynchronous = false;
- }
-
- sm->setTransactionState(transaction, orientation, flags);
-}
-
-layer_state_t* Composer::getLayerStateLocked(
- const sp<SurfaceComposerClient>& client, SurfaceID id) {
-
- ComposerState s;
- s.client = client->mClient;
- s.state.surface = id;
-
- ssize_t index = mStates.indexOf(s);
- if (index < 0) {
- // we don't have it, add an initialized layer_state to our list
- index = mStates.add(s);
- }
-
- ComposerState* const out = mStates.editArray();
- return &(out[index].state);
-}
-
-status_t Composer::setPosition(const sp<SurfaceComposerClient>& client,
- SurfaceID id, float x, float y) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::ePositionChanged;
- s->x = x;
- s->y = y;
- return NO_ERROR;
-}
-
-status_t Composer::setSize(const sp<SurfaceComposerClient>& client,
- SurfaceID id, uint32_t w, uint32_t h) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eSizeChanged;
- s->w = w;
- s->h = h;
-
- // Resizing a surface makes the transaction synchronous.
- mForceSynchronous = true;
-
- return NO_ERROR;
-}
-
-status_t Composer::setLayer(const sp<SurfaceComposerClient>& client,
- SurfaceID id, int32_t z) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eLayerChanged;
- s->z = z;
- return NO_ERROR;
-}
-
-status_t Composer::setFlags(const sp<SurfaceComposerClient>& client,
- SurfaceID id, uint32_t flags,
- uint32_t mask) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eVisibilityChanged;
- s->flags &= ~mask;
- s->flags |= (flags & mask);
- s->mask |= mask;
- return NO_ERROR;
-}
-
-status_t Composer::setTransparentRegionHint(
- const sp<SurfaceComposerClient>& client, SurfaceID id,
- const Region& transparentRegion) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eTransparentRegionChanged;
- s->transparentRegion = transparentRegion;
- return NO_ERROR;
-}
-
-status_t Composer::setAlpha(const sp<SurfaceComposerClient>& client,
- SurfaceID id, float alpha) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eAlphaChanged;
- s->alpha = alpha;
- return NO_ERROR;
-}
-
-status_t Composer::setMatrix(const sp<SurfaceComposerClient>& client,
- SurfaceID id, float dsdx, float dtdx,
- float dsdy, float dtdy) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eMatrixChanged;
- layer_state_t::matrix22_t matrix;
- matrix.dsdx = dsdx;
- matrix.dtdx = dtdx;
- matrix.dsdy = dsdy;
- matrix.dtdy = dtdy;
- s->matrix = matrix;
- return NO_ERROR;
-}
-
-status_t Composer::setFreezeTint(const sp<SurfaceComposerClient>& client,
- SurfaceID id, uint32_t tint) {
- Mutex::Autolock _l(mLock);
- layer_state_t* s = getLayerStateLocked(client, id);
- if (!s)
- return BAD_INDEX;
- s->what |= ISurfaceComposer::eFreezeTintChanged;
- s->tint = tint;
- return NO_ERROR;
-}
-
-status_t Composer::setOrientation(int orientation) {
- Mutex::Autolock _l(mLock);
- mOrientation = orientation;
-
- // Changing the orientation makes the transaction synchronous.
- mForceSynchronous = true;
-
- return NO_ERROR;
-}
-
-// ---------------------------------------------------------------------------
-
-SurfaceComposerClient::SurfaceComposerClient()
- : mStatus(NO_INIT), mComposer(Composer::getInstance())
-{
-}
-
-void SurfaceComposerClient::onFirstRef() {
- sp<ISurfaceComposer> sm(getComposerService());
- if (sm != 0) {
- sp<ISurfaceComposerClient> conn = sm->createConnection();
- if (conn != 0) {
- mClient = conn;
- mStatus = NO_ERROR;
- }
- }
-}
-
-SurfaceComposerClient::~SurfaceComposerClient() {
- dispose();
-}
-
-status_t SurfaceComposerClient::initCheck() const {
- return mStatus;
-}
-
-sp<IBinder> SurfaceComposerClient::connection() const {
- return (mClient != 0) ? mClient->asBinder() : 0;
-}
-
-status_t SurfaceComposerClient::linkToComposerDeath(
- const sp<IBinder::DeathRecipient>& recipient,
- void* cookie, uint32_t flags) {
- sp<ISurfaceComposer> sm(getComposerService());
- return sm->asBinder()->linkToDeath(recipient, cookie, flags);
-}
-
-void SurfaceComposerClient::dispose() {
- // this can be called more than once.
- sp<ISurfaceComposerClient> client;
- Mutex::Autolock _lm(mLock);
- if (mClient != 0) {
- client = mClient; // hold ref while lock is held
- mClient.clear();
- }
- mStatus = NO_INIT;
-}
-
-sp<SurfaceControl> SurfaceComposerClient::createSurface(
- DisplayID display,
- uint32_t w,
- uint32_t h,
- PixelFormat format,
- uint32_t flags)
-{
- String8 name;
- const size_t SIZE = 128;
- char buffer[SIZE];
- snprintf(buffer, SIZE, "<pid_%d>", getpid());
- name.append(buffer);
-
- return SurfaceComposerClient::createSurface(name, display,
- w, h, format, flags);
-}
-
-sp<SurfaceControl> SurfaceComposerClient::createSurface(
- const String8& name,
- DisplayID display,
- uint32_t w,
- uint32_t h,
- PixelFormat format,
- uint32_t flags)
-{
- sp<SurfaceControl> result;
- if (mStatus == NO_ERROR) {
- ISurfaceComposerClient::surface_data_t data;
- sp<ISurface> surface = mClient->createSurface(&data, name,
- display, w, h, format, flags);
- if (surface != 0) {
- result = new SurfaceControl(this, surface, data);
- }
- }
- return result;
-}
-
-status_t SurfaceComposerClient::destroySurface(SurfaceID sid) {
- if (mStatus != NO_ERROR)
- return mStatus;
- status_t err = mClient->destroySurface(sid);
- return err;
-}
-
-inline Composer& SurfaceComposerClient::getComposer() {
- return mComposer;
-}
-
-// ----------------------------------------------------------------------------
-
-void SurfaceComposerClient::openGlobalTransaction() {
- // Currently a no-op
-}
-
-void SurfaceComposerClient::closeGlobalTransaction(bool synchronous) {
- Composer::closeGlobalTransaction(synchronous);
-}
-
-// ----------------------------------------------------------------------------
-
-status_t SurfaceComposerClient::setFreezeTint(SurfaceID id, uint32_t tint) {
- return getComposer().setFreezeTint(this, id, tint);
-}
-
-status_t SurfaceComposerClient::setPosition(SurfaceID id, float x, float y) {
- return getComposer().setPosition(this, id, x, y);
-}
-
-status_t SurfaceComposerClient::setSize(SurfaceID id, uint32_t w, uint32_t h) {
- return getComposer().setSize(this, id, w, h);
-}
-
-status_t SurfaceComposerClient::setLayer(SurfaceID id, int32_t z) {
- return getComposer().setLayer(this, id, z);
-}
-
-status_t SurfaceComposerClient::hide(SurfaceID id) {
- return getComposer().setFlags(this, id,
- ISurfaceComposer::eLayerHidden,
- ISurfaceComposer::eLayerHidden);
-}
-
-status_t SurfaceComposerClient::show(SurfaceID id, int32_t) {
- return getComposer().setFlags(this, id,
- 0,
- ISurfaceComposer::eLayerHidden);
-}
-
-status_t SurfaceComposerClient::freeze(SurfaceID id) {
- return getComposer().setFlags(this, id,
- ISurfaceComposer::eLayerFrozen,
- ISurfaceComposer::eLayerFrozen);
-}
-
-status_t SurfaceComposerClient::unfreeze(SurfaceID id) {
- return getComposer().setFlags(this, id,
- 0,
- ISurfaceComposer::eLayerFrozen);
-}
-
-status_t SurfaceComposerClient::setFlags(SurfaceID id, uint32_t flags,
- uint32_t mask) {
- return getComposer().setFlags(this, id, flags, mask);
-}
-
-status_t SurfaceComposerClient::setTransparentRegionHint(SurfaceID id,
- const Region& transparentRegion) {
- return getComposer().setTransparentRegionHint(this, id, transparentRegion);
-}
-
-status_t SurfaceComposerClient::setAlpha(SurfaceID id, float alpha) {
- return getComposer().setAlpha(this, id, alpha);
-}
-
-status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx,
- float dsdy, float dtdy) {
- return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy);
-}
-
-status_t SurfaceComposerClient::setOrientation(DisplayID dpy,
- int orientation, uint32_t flags)
-{
- return Composer::getInstance().setOrientation(orientation);
-}
-
-// ----------------------------------------------------------------------------
-
-status_t SurfaceComposerClient::getDisplayInfo(
- DisplayID dpy, DisplayInfo* info)
-{
- if (uint32_t(dpy)>=NUM_DISPLAY_MAX)
- return BAD_VALUE;
-
- volatile surface_flinger_cblk_t const * cblk = get_cblk();
- volatile display_cblk_t const * dcblk = cblk->displays + dpy;
-
- info->w = dcblk->w;
- info->h = dcblk->h;
- info->orientation = dcblk->orientation;
- info->xdpi = dcblk->xdpi;
- info->ydpi = dcblk->ydpi;
- info->fps = dcblk->fps;
- info->density = dcblk->density;
- return getPixelFormatInfo(dcblk->format, &(info->pixelFormatInfo));
-}
-
-ssize_t SurfaceComposerClient::getDisplayWidth(DisplayID dpy)
-{
- if (uint32_t(dpy)>=NUM_DISPLAY_MAX)
- return BAD_VALUE;
- volatile surface_flinger_cblk_t const * cblk = get_cblk();
- volatile display_cblk_t const * dcblk = cblk->displays + dpy;
- return dcblk->w;
-}
-
-ssize_t SurfaceComposerClient::getDisplayHeight(DisplayID dpy)
-{
- if (uint32_t(dpy)>=NUM_DISPLAY_MAX)
- return BAD_VALUE;
- volatile surface_flinger_cblk_t const * cblk = get_cblk();
- volatile display_cblk_t const * dcblk = cblk->displays + dpy;
- return dcblk->h;
-}
-
-ssize_t SurfaceComposerClient::getDisplayOrientation(DisplayID dpy)
-{
- if (uint32_t(dpy)>=NUM_DISPLAY_MAX)
- return BAD_VALUE;
- volatile surface_flinger_cblk_t const * cblk = get_cblk();
- volatile display_cblk_t const * dcblk = cblk->displays + dpy;
- return dcblk->orientation;
-}
-
-ssize_t SurfaceComposerClient::getNumberOfDisplays()
-{
- volatile surface_flinger_cblk_t const * cblk = get_cblk();
- uint32_t connected = cblk->connected;
- int n = 0;
- while (connected) {
- if (connected&1) n++;
- connected >>= 1;
- }
- return n;
-}
-
-// ----------------------------------------------------------------------------
-
-status_t SurfaceComposerClient::freezeDisplay(DisplayID dpy, uint32_t flags)
-{
- // This has been made a no-op because it can cause Gralloc buffer deadlocks.
- return NO_ERROR;
-}
-
-status_t SurfaceComposerClient::unfreezeDisplay(DisplayID dpy, uint32_t flags)
-{
- // This has been made a no-op because it can cause Gralloc buffer deadlocks.
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-ScreenshotClient::ScreenshotClient()
- : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) {
-}
-
-status_t ScreenshotClient::update() {
- sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (s == NULL) return NO_INIT;
- mHeap = 0;
- return s->captureScreen(0, &mHeap,
- &mWidth, &mHeight, &mFormat, 0, 0,
- 0, -1UL);
-}
-
-status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight) {
- sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (s == NULL) return NO_INIT;
- mHeap = 0;
- return s->captureScreen(0, &mHeap,
- &mWidth, &mHeight, &mFormat, reqWidth, reqHeight,
- 0, -1UL);
-}
-
-status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ) {
- sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (s == NULL) return NO_INIT;
- mHeap = 0;
- return s->captureScreen(0, &mHeap,
- &mWidth, &mHeight, &mFormat, reqWidth, reqHeight,
- minLayerZ, maxLayerZ);
-}
-
-void ScreenshotClient::release() {
- mHeap = 0;
-}
-
-void const* ScreenshotClient::getPixels() const {
- return mHeap->getBase();
-}
-
-uint32_t ScreenshotClient::getWidth() const {
- return mWidth;
-}
-
-uint32_t ScreenshotClient::getHeight() const {
- return mHeight;
-}
-
-PixelFormat ScreenshotClient::getFormat() const {
- return mFormat;
-}
-
-uint32_t ScreenshotClient::getStride() const {
- return mWidth;
-}
-
-size_t ScreenshotClient::getSize() const {
- return mHeap->getSize();
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
deleted file mode 100644
index b42aa34..0000000
--- a/libs/gui/SurfaceTexture.cpp
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "SurfaceTexture"
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-//#define LOG_NDEBUG 0
-
-#define GL_GLEXT_PROTOTYPES
-#define EGL_EGLEXT_PROTOTYPES
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <hardware/hardware.h>
-
-#include <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceComposer.h>
-#include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTexture.h>
-
-#include <private/gui/ComposerService.h>
-
-#include <utils/Log.h>
-#include <utils/String8.h>
-#include <utils/Trace.h>
-
-// This compile option makes SurfaceTexture use the EGL_KHR_fence_sync extension
-// to synchronize access to the buffers. It will cause dequeueBuffer to stall,
-// waiting for the GL reads for the buffer being dequeued to complete before
-// allowing the buffer to be dequeued.
-#ifdef USE_FENCE_SYNC
-#ifdef ALLOW_DEQUEUE_CURRENT_BUFFER
-#error "USE_FENCE_SYNC and ALLOW_DEQUEUE_CURRENT_BUFFER are incompatible"
-#endif
-#endif
-
-// Macros for including the SurfaceTexture name in log messages
-#define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGD(x, ...) ALOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGI(x, ...) ALOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGW(x, ...) ALOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGE(x, ...) ALOGE("[%s] "x, mName.string(), ##__VA_ARGS__)
-
-namespace android {
-
-// Transform matrices
-static float mtxIdentity[16] = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1,
-};
-static float mtxFlipH[16] = {
- -1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 0, 0, 1,
-};
-static float mtxFlipV[16] = {
- 1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, 1, 0,
- 0, 1, 0, 1,
-};
-static float mtxRot90[16] = {
- 0, 1, 0, 0,
- -1, 0, 0, 0,
- 0, 0, 1, 0,
- 1, 0, 0, 1,
-};
-static float mtxRot180[16] = {
- -1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, 1, 0,
- 1, 1, 0, 1,
-};
-static float mtxRot270[16] = {
- 0, -1, 0, 0,
- 1, 0, 0, 0,
- 0, 0, 1, 0,
- 0, 1, 0, 1,
-};
-
-static void mtxMul(float out[16], const float a[16], const float b[16]);
-
-// Get an ID that's unique within this process.
-static int32_t createProcessUniqueId() {
- static volatile int32_t globalCounter = 0;
- return android_atomic_inc(&globalCounter);
-}
-
-SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
- GLenum texTarget, bool useFenceSync) :
- BufferQueue(allowSynchronousMode),
- mCurrentTransform(0),
- mCurrentTimestamp(0),
- mTexName(tex),
-#ifdef USE_FENCE_SYNC
- mUseFenceSync(useFenceSync),
-#else
- mUseFenceSync(false),
-#endif
- mTexTarget(texTarget),
- mAbandoned(false),
- mCurrentTexture(BufferQueue::INVALID_BUFFER_SLOT)
-{
- // Choose a name using the PID and a process-unique ID.
- mName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());
- BufferQueue::setConsumerName(mName);
-
- ST_LOGV("SurfaceTexture");
- memcpy(mCurrentTransformMatrix, mtxIdentity,
- sizeof(mCurrentTransformMatrix));
-}
-
-SurfaceTexture::~SurfaceTexture() {
- ST_LOGV("~SurfaceTexture");
- abandon();
-}
-
-status_t SurfaceTexture::setBufferCountServer(int bufferCount) {
- Mutex::Autolock lock(mMutex);
- return BufferQueue::setBufferCountServer(bufferCount);
-}
-
-
-status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
-{
- return BufferQueue::setDefaultBufferSize(w, h);
-}
-
-status_t SurfaceTexture::updateTexImage() {
- ATRACE_CALL();
- ST_LOGV("updateTexImage");
- Mutex::Autolock lock(mMutex);
-
- if (mAbandoned) {
- ST_LOGE("calling updateTexImage() on an abandoned SurfaceTexture");
- return NO_INIT;
- }
-
- BufferItem item;
-
- // In asynchronous mode the list is guaranteed to be one buffer
- // deep, while in synchronous mode we use the oldest buffer.
- if (acquire(&item) == NO_ERROR) {
- int buf = item.mBuf;
- // This buffer was newly allocated, so we need to clean up on our side
- if (item.mGraphicBuffer != NULL) {
- mEGLSlots[buf].mGraphicBuffer = 0;
- if (mEGLSlots[buf].mEglImage != EGL_NO_IMAGE_KHR) {
- eglDestroyImageKHR(mEGLSlots[buf].mEglDisplay,
- mEGLSlots[buf].mEglImage);
- mEGLSlots[buf].mEglImage = EGL_NO_IMAGE_KHR;
- mEGLSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
- }
- mEGLSlots[buf].mGraphicBuffer = item.mGraphicBuffer;
- }
-
- // Update the GL texture object.
- EGLImageKHR image = mEGLSlots[buf].mEglImage;
- EGLDisplay dpy = eglGetCurrentDisplay();
- if (image == EGL_NO_IMAGE_KHR) {
- if (item.mGraphicBuffer == 0) {
- ST_LOGE("buffer at slot %d is null", buf);
- return BAD_VALUE;
- }
- image = createImage(dpy, item.mGraphicBuffer);
- mEGLSlots[buf].mEglImage = image;
- mEGLSlots[buf].mEglDisplay = dpy;
- if (image == EGL_NO_IMAGE_KHR) {
- // NOTE: if dpy was invalid, createImage() is guaranteed to
- // fail. so we'd end up here.
- return -EINVAL;
- }
- }
-
- GLint error;
- while ((error = glGetError()) != GL_NO_ERROR) {
- ST_LOGW("updateTexImage: clearing GL error: %#04x", error);
- }
-
- glBindTexture(mTexTarget, mTexName);
- glEGLImageTargetTexture2DOES(mTexTarget, (GLeglImageOES)image);
-
- bool failed = false;
- while ((error = glGetError()) != GL_NO_ERROR) {
- ST_LOGE("error binding external texture image %p (slot %d): %#04x",
- image, buf, error);
- failed = true;
- }
- if (failed) {
- releaseBuffer(buf, mEGLSlots[buf].mEglDisplay,
- mEGLSlots[buf].mFence);
- return -EINVAL;
- }
-
- if (mCurrentTexture != INVALID_BUFFER_SLOT) {
- if (mUseFenceSync) {
- EGLSyncKHR fence = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR,
- NULL);
- if (fence == EGL_NO_SYNC_KHR) {
- ALOGE("updateTexImage: error creating fence: %#x",
- eglGetError());
- releaseBuffer(buf, mEGLSlots[buf].mEglDisplay,
- mEGLSlots[buf].mFence);
- return -EINVAL;
- }
- glFlush();
- mEGLSlots[mCurrentTexture].mFence = fence;
- }
- }
-
- ST_LOGV("updateTexImage: (slot=%d buf=%p) -> (slot=%d buf=%p)",
- mCurrentTexture,
- mCurrentTextureBuf != NULL ? mCurrentTextureBuf->handle : 0,
- buf, item.mGraphicBuffer != NULL ? item.mGraphicBuffer->handle : 0);
-
- // release old buffer
- releaseBuffer(mCurrentTexture,
- mEGLSlots[mCurrentTexture].mEglDisplay,
- mEGLSlots[mCurrentTexture].mFence);
-
- // Update the SurfaceTexture state.
- mCurrentTexture = buf;
- mCurrentTextureBuf = mEGLSlots[buf].mGraphicBuffer;
- mCurrentCrop = item.mCrop;
- mCurrentTransform = item.mTransform;
- mCurrentScalingMode = item.mScalingMode;
- mCurrentTimestamp = item.mTimestamp;
- computeCurrentTransformMatrix();
-
- // Now that we've passed the point at which failures can happen,
- // it's safe to remove the buffer from the front of the queue.
-
- } else {
- // We always bind the texture even if we don't update its contents.
- glBindTexture(mTexTarget, mTexName);
- }
-
- return OK;
-}
-
-bool SurfaceTexture::isExternalFormat(uint32_t format)
-{
- switch (format) {
- // supported YUV formats
- case HAL_PIXEL_FORMAT_YV12:
- // Legacy/deprecated YUV formats
- case HAL_PIXEL_FORMAT_YCbCr_422_SP:
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- case HAL_PIXEL_FORMAT_YCbCr_422_I:
- return true;
- }
-
- // Any OEM format needs to be considered
- if (format>=0x100 && format<=0x1FF)
- return true;
-
- return false;
-}
-
-GLenum SurfaceTexture::getCurrentTextureTarget() const {
- return mTexTarget;
-}
-
-void SurfaceTexture::getTransformMatrix(float mtx[16]) {
- Mutex::Autolock lock(mMutex);
- memcpy(mtx, mCurrentTransformMatrix, sizeof(mCurrentTransformMatrix));
-}
-
-void SurfaceTexture::computeCurrentTransformMatrix() {
- ST_LOGV("computeCurrentTransformMatrix");
-
- float xform[16];
- for (int i = 0; i < 16; i++) {
- xform[i] = mtxIdentity[i];
- }
- if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) {
- float result[16];
- mtxMul(result, xform, mtxFlipH);
- for (int i = 0; i < 16; i++) {
- xform[i] = result[i];
- }
- }
- if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) {
- float result[16];
- mtxMul(result, xform, mtxFlipV);
- for (int i = 0; i < 16; i++) {
- xform[i] = result[i];
- }
- }
- if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
- float result[16];
- mtxMul(result, xform, mtxRot90);
- for (int i = 0; i < 16; i++) {
- xform[i] = result[i];
- }
- }
-
- sp<GraphicBuffer>& buf(mCurrentTextureBuf);
- float tx, ty, sx, sy;
- if (!mCurrentCrop.isEmpty()) {
- // In order to prevent bilinear sampling at the of the crop rectangle we
- // may need to shrink it by 2 texels in each direction. Normally this
- // would just need to take 1/2 a texel off each end, but because the
- // chroma channels will likely be subsampled we need to chop off a whole
- // texel. This will cause artifacts if someone does nearest sampling
- // with 1:1 pixel:texel ratio, but it's impossible to simultaneously
- // accomodate the bilinear and nearest sampling uses.
- //
- // If nearest sampling turns out to be a desirable usage of these
- // textures then we could add the ability to switch a SurfaceTexture to
- // nearest-mode. Preferably, however, the image producers (video
- // decoder, camera, etc.) would simply not use a crop rectangle (or at
- // least not tell the framework about it) so that the GPU can do the
- // correct edge behavior.
- int xshrink = 0, yshrink = 0;
- if (mCurrentCrop.left > 0) {
- tx = float(mCurrentCrop.left + 1) / float(buf->getWidth());
- xshrink++;
- } else {
- tx = 0.0f;
- }
- if (mCurrentCrop.right < int32_t(buf->getWidth())) {
- xshrink++;
- }
- if (mCurrentCrop.bottom < int32_t(buf->getHeight())) {
- ty = (float(buf->getHeight() - mCurrentCrop.bottom) + 1.0f) /
- float(buf->getHeight());
- yshrink++;
- } else {
- ty = 0.0f;
- }
- if (mCurrentCrop.top > 0) {
- yshrink++;
- }
- sx = float(mCurrentCrop.width() - xshrink) / float(buf->getWidth());
- sy = float(mCurrentCrop.height() - yshrink) / float(buf->getHeight());
- } else {
- tx = 0.0f;
- ty = 0.0f;
- sx = 1.0f;
- sy = 1.0f;
- }
- float crop[16] = {
- sx, 0, 0, 0,
- 0, sy, 0, 0,
- 0, 0, 1, 0,
- tx, ty, 0, 1,
- };
-
- float mtxBeforeFlipV[16];
- mtxMul(mtxBeforeFlipV, crop, xform);
-
- // SurfaceFlinger expects the top of its window textures to be at a Y
- // coordinate of 0, so SurfaceTexture must behave the same way. We don't
- // want to expose this to applications, however, so we must add an
- // additional vertical flip to the transform after all the other transforms.
- mtxMul(mCurrentTransformMatrix, mtxFlipV, mtxBeforeFlipV);
-}
-
-nsecs_t SurfaceTexture::getTimestamp() {
- ST_LOGV("getTimestamp");
- Mutex::Autolock lock(mMutex);
- return mCurrentTimestamp;
-}
-
-void SurfaceTexture::setFrameAvailableListener(
- const sp<FrameAvailableListener>& listener) {
- ST_LOGV("setFrameAvailableListener");
- Mutex::Autolock lock(mMutex);
- BufferQueue::setFrameAvailableListener(listener);
-}
-
-EGLImageKHR SurfaceTexture::createImage(EGLDisplay dpy,
- const sp<GraphicBuffer>& graphicBuffer) {
- EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer->getNativeBuffer();
- EGLint attrs[] = {
- EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
- EGL_NONE,
- };
- EGLImageKHR image = eglCreateImageKHR(dpy, EGL_NO_CONTEXT,
- EGL_NATIVE_BUFFER_ANDROID, cbuf, attrs);
- if (image == EGL_NO_IMAGE_KHR) {
- EGLint error = eglGetError();
- ST_LOGE("error creating EGLImage: %#x", error);
- }
- return image;
-}
-
-sp<GraphicBuffer> SurfaceTexture::getCurrentBuffer() const {
- Mutex::Autolock lock(mMutex);
- return mCurrentTextureBuf;
-}
-
-Rect SurfaceTexture::getCurrentCrop() const {
- Mutex::Autolock lock(mMutex);
- return mCurrentCrop;
-}
-
-uint32_t SurfaceTexture::getCurrentTransform() const {
- Mutex::Autolock lock(mMutex);
- return mCurrentTransform;
-}
-
-uint32_t SurfaceTexture::getCurrentScalingMode() const {
- Mutex::Autolock lock(mMutex);
- return mCurrentScalingMode;
-}
-
-bool SurfaceTexture::isSynchronousMode() const {
- Mutex::Autolock lock(mMutex);
- return BufferQueue::isSynchronousMode();
-}
-
-void SurfaceTexture::abandon() {
- Mutex::Autolock lock(mMutex);
- mAbandoned = true;
- mCurrentTextureBuf.clear();
-
- // destroy all egl buffers
- for (int i =0; i < NUM_BUFFER_SLOTS; i++) {
- mEGLSlots[i].mGraphicBuffer = 0;
- if (mEGLSlots[i].mEglImage != EGL_NO_IMAGE_KHR) {
- eglDestroyImageKHR(mEGLSlots[i].mEglDisplay,
- mEGLSlots[i].mEglImage);
- mEGLSlots[i].mEglImage = EGL_NO_IMAGE_KHR;
- mEGLSlots[i].mEglDisplay = EGL_NO_DISPLAY;
- }
- }
-
- // disconnect from the BufferQueue
- BufferQueue::consumerDisconnect();
-}
-
-void SurfaceTexture::setName(const String8& name) {
- Mutex::Autolock _l(mMutex);
- mName = name;
- BufferQueue::setConsumerName(name);
-}
-
-void SurfaceTexture::dump(String8& result) const
-{
- char buffer[1024];
- dump(result, "", buffer, 1024);
-}
-
-void SurfaceTexture::dump(String8& result, const char* prefix,
- char* buffer, size_t SIZE) const
-{
- Mutex::Autolock _l(mMutex);
- snprintf(buffer, SIZE, "%smTexName=%d\n", prefix, mTexName);
- result.append(buffer);
-
- snprintf(buffer, SIZE,
- "%snext : {crop=[%d,%d,%d,%d], transform=0x%02x, current=%d}\n"
- ,prefix, mCurrentCrop.left,
- mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
- mCurrentTransform, mCurrentTexture
- );
- result.append(buffer);
-
-
- BufferQueue::dump(result, prefix, buffer, SIZE);
-}
-
-static void mtxMul(float out[16], const float a[16], const float b[16]) {
- out[0] = a[0]*b[0] + a[4]*b[1] + a[8]*b[2] + a[12]*b[3];
- out[1] = a[1]*b[0] + a[5]*b[1] + a[9]*b[2] + a[13]*b[3];
- out[2] = a[2]*b[0] + a[6]*b[1] + a[10]*b[2] + a[14]*b[3];
- out[3] = a[3]*b[0] + a[7]*b[1] + a[11]*b[2] + a[15]*b[3];
-
- out[4] = a[0]*b[4] + a[4]*b[5] + a[8]*b[6] + a[12]*b[7];
- out[5] = a[1]*b[4] + a[5]*b[5] + a[9]*b[6] + a[13]*b[7];
- out[6] = a[2]*b[4] + a[6]*b[5] + a[10]*b[6] + a[14]*b[7];
- out[7] = a[3]*b[4] + a[7]*b[5] + a[11]*b[6] + a[15]*b[7];
-
- out[8] = a[0]*b[8] + a[4]*b[9] + a[8]*b[10] + a[12]*b[11];
- out[9] = a[1]*b[8] + a[5]*b[9] + a[9]*b[10] + a[13]*b[11];
- out[10] = a[2]*b[8] + a[6]*b[9] + a[10]*b[10] + a[14]*b[11];
- out[11] = a[3]*b[8] + a[7]*b[9] + a[11]*b[10] + a[15]*b[11];
-
- out[12] = a[0]*b[12] + a[4]*b[13] + a[8]*b[14] + a[12]*b[15];
- out[13] = a[1]*b[12] + a[5]*b[13] + a[9]*b[14] + a[13]*b[15];
- out[14] = a[2]*b[12] + a[6]*b[13] + a[10]*b[14] + a[14]*b[15];
- out[15] = a[3]*b[12] + a[7]*b[13] + a[11]*b[14] + a[15]*b[15];
-}
-
-}; // namespace android
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
deleted file mode 100644
index f88dcaf..0000000
--- a/libs/gui/SurfaceTextureClient.cpp
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "SurfaceTextureClient"
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-//#define LOG_NDEBUG 0
-
-#include <utils/Log.h>
-#include <utils/Trace.h>
-
-#include <gui/ISurfaceComposer.h>
-#include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTextureClient.h>
-
-#include <private/gui/ComposerService.h>
-
-namespace android {
-
-SurfaceTextureClient::SurfaceTextureClient(
- const sp<ISurfaceTexture>& surfaceTexture)
-{
- SurfaceTextureClient::init();
- SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
-}
-
-SurfaceTextureClient::SurfaceTextureClient() {
- SurfaceTextureClient::init();
-}
-
-SurfaceTextureClient::~SurfaceTextureClient() {
- if (mConnectedToCpu) {
- SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU);
- }
-}
-
-void SurfaceTextureClient::init() {
- // Initialize the ANativeWindow function pointers.
- ANativeWindow::setSwapInterval = hook_setSwapInterval;
- ANativeWindow::dequeueBuffer = hook_dequeueBuffer;
- ANativeWindow::cancelBuffer = hook_cancelBuffer;
- ANativeWindow::lockBuffer = hook_lockBuffer;
- ANativeWindow::queueBuffer = hook_queueBuffer;
- ANativeWindow::query = hook_query;
- ANativeWindow::perform = hook_perform;
-
- const_cast<int&>(ANativeWindow::minSwapInterval) = 0;
- const_cast<int&>(ANativeWindow::maxSwapInterval) = 1;
-
- mReqWidth = 0;
- mReqHeight = 0;
- mReqFormat = 0;
- mReqUsage = 0;
- mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO;
- mDefaultWidth = 0;
- mDefaultHeight = 0;
- mTransformHint = 0;
- mConnectedToCpu = false;
-}
-
-void SurfaceTextureClient::setISurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture)
-{
- mSurfaceTexture = surfaceTexture;
-}
-
-sp<ISurfaceTexture> SurfaceTextureClient::getISurfaceTexture() const {
- return mSurfaceTexture;
-}
-
-int SurfaceTextureClient::hook_setSwapInterval(ANativeWindow* window, int interval) {
- SurfaceTextureClient* c = getSelf(window);
- return c->setSwapInterval(interval);
-}
-
-int SurfaceTextureClient::hook_dequeueBuffer(ANativeWindow* window,
- ANativeWindowBuffer** buffer) {
- SurfaceTextureClient* c = getSelf(window);
- return c->dequeueBuffer(buffer);
-}
-
-int SurfaceTextureClient::hook_cancelBuffer(ANativeWindow* window,
- ANativeWindowBuffer* buffer) {
- SurfaceTextureClient* c = getSelf(window);
- return c->cancelBuffer(buffer);
-}
-
-int SurfaceTextureClient::hook_lockBuffer(ANativeWindow* window,
- ANativeWindowBuffer* buffer) {
- SurfaceTextureClient* c = getSelf(window);
- return c->lockBuffer(buffer);
-}
-
-int SurfaceTextureClient::hook_queueBuffer(ANativeWindow* window,
- ANativeWindowBuffer* buffer) {
- SurfaceTextureClient* c = getSelf(window);
- return c->queueBuffer(buffer);
-}
-
-int SurfaceTextureClient::hook_query(const ANativeWindow* window,
- int what, int* value) {
- const SurfaceTextureClient* c = getSelf(window);
- return c->query(what, value);
-}
-
-int SurfaceTextureClient::hook_perform(ANativeWindow* window, int operation, ...) {
- va_list args;
- va_start(args, operation);
- SurfaceTextureClient* c = getSelf(window);
- return c->perform(operation, args);
-}
-
-int SurfaceTextureClient::setSwapInterval(int interval) {
- ATRACE_CALL();
- // EGL specification states:
- // interval is silently clamped to minimum and maximum implementation
- // dependent values before being stored.
- // Although we don't have to, we apply the same logic here.
-
- if (interval < minSwapInterval)
- interval = minSwapInterval;
-
- if (interval > maxSwapInterval)
- interval = maxSwapInterval;
-
- status_t res = mSurfaceTexture->setSynchronousMode(interval ? true : false);
-
- return res;
-}
-
-int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::dequeueBuffer");
- Mutex::Autolock lock(mMutex);
- int buf = -1;
- status_t result = mSurfaceTexture->dequeueBuffer(&buf, mReqWidth, mReqHeight,
- mReqFormat, mReqUsage);
- if (result < 0) {
- ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
- "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
- result);
- return result;
- }
- sp<GraphicBuffer>& gbuf(mSlots[buf]);
- if (result & ISurfaceTexture::RELEASE_ALL_BUFFERS) {
- freeAllBuffers();
- }
-
- if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
- result = mSurfaceTexture->requestBuffer(buf, &gbuf);
- if (result != NO_ERROR) {
- ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d",
- result);
- return result;
- }
- }
- *buffer = gbuf.get();
- return OK;
-}
-
-int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) {
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::cancelBuffer");
- Mutex::Autolock lock(mMutex);
- int i = getSlotFromBufferLocked(buffer);
- if (i < 0) {
- return i;
- }
- mSurfaceTexture->cancelBuffer(i);
- return OK;
-}
-
-int SurfaceTextureClient::getSlotFromBufferLocked(
- android_native_buffer_t* buffer) const {
- bool dumpedState = false;
- for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- // XXX: Dump the slots whenever we hit a NULL entry while searching for
- // a buffer.
- if (mSlots[i] == NULL) {
- if (!dumpedState) {
- ALOGD("getSlotFromBufferLocked: encountered NULL buffer in slot %d "
- "looking for buffer %p", i, buffer->handle);
- for (int j = 0; j < NUM_BUFFER_SLOTS; j++) {
- if (mSlots[j] == NULL) {
- ALOGD("getSlotFromBufferLocked: %02d: NULL", j);
- } else {
- ALOGD("getSlotFromBufferLocked: %02d: %p", j, mSlots[j]->handle);
- }
- }
- dumpedState = true;
- }
- }
-
- if (mSlots[i] != NULL && mSlots[i]->handle == buffer->handle) {
- return i;
- }
- }
- ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
- return BAD_VALUE;
-}
-
-int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) {
- ALOGV("SurfaceTextureClient::lockBuffer");
- Mutex::Autolock lock(mMutex);
- return OK;
-}
-
-int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::queueBuffer");
- Mutex::Autolock lock(mMutex);
- int64_t timestamp;
- if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
- timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
- ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
- timestamp / 1000000.f);
- } else {
- timestamp = mTimestamp;
- }
- int i = getSlotFromBufferLocked(buffer);
- if (i < 0) {
- return i;
- }
- status_t err = mSurfaceTexture->queueBuffer(i, timestamp,
- &mDefaultWidth, &mDefaultHeight, &mTransformHint);
- if (err != OK) {
- ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err);
- }
- return err;
-}
-
-int SurfaceTextureClient::query(int what, int* value) const {
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::query");
- { // scope for the lock
- Mutex::Autolock lock(mMutex);
- switch (what) {
- case NATIVE_WINDOW_FORMAT:
- if (mReqFormat) {
- *value = mReqFormat;
- return NO_ERROR;
- }
- break;
- case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
- {
- sp<ISurfaceComposer> composer(
- ComposerService::getComposerService());
- if (composer->authenticateSurfaceTexture(mSurfaceTexture)) {
- *value = 1;
- } else {
- *value = 0;
- }
- }
- return NO_ERROR;
- case NATIVE_WINDOW_CONCRETE_TYPE:
- *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT;
- return NO_ERROR;
- case NATIVE_WINDOW_DEFAULT_WIDTH:
- *value = mDefaultWidth;
- return NO_ERROR;
- case NATIVE_WINDOW_DEFAULT_HEIGHT:
- *value = mDefaultHeight;
- return NO_ERROR;
- case NATIVE_WINDOW_TRANSFORM_HINT:
- *value = mTransformHint;
- return NO_ERROR;
- }
- }
- return mSurfaceTexture->query(what, value);
-}
-
-int SurfaceTextureClient::perform(int operation, va_list args)
-{
- int res = NO_ERROR;
- switch (operation) {
- case NATIVE_WINDOW_CONNECT:
- // deprecated. must return NO_ERROR.
- break;
- case NATIVE_WINDOW_DISCONNECT:
- // deprecated. must return NO_ERROR.
- break;
- case NATIVE_WINDOW_SET_USAGE:
- res = dispatchSetUsage(args);
- break;
- case NATIVE_WINDOW_SET_CROP:
- res = dispatchSetCrop(args);
- break;
- case NATIVE_WINDOW_SET_BUFFER_COUNT:
- res = dispatchSetBufferCount(args);
- break;
- case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY:
- res = dispatchSetBuffersGeometry(args);
- break;
- case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
- res = dispatchSetBuffersTransform(args);
- break;
- case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP:
- res = dispatchSetBuffersTimestamp(args);
- break;
- case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS:
- res = dispatchSetBuffersDimensions(args);
- break;
- case NATIVE_WINDOW_SET_BUFFERS_FORMAT:
- res = dispatchSetBuffersFormat(args);
- break;
- case NATIVE_WINDOW_LOCK:
- res = dispatchLock(args);
- break;
- case NATIVE_WINDOW_UNLOCK_AND_POST:
- res = dispatchUnlockAndPost(args);
- break;
- case NATIVE_WINDOW_SET_SCALING_MODE:
- res = dispatchSetScalingMode(args);
- break;
- case NATIVE_WINDOW_API_CONNECT:
- res = dispatchConnect(args);
- break;
- case NATIVE_WINDOW_API_DISCONNECT:
- res = dispatchDisconnect(args);
- break;
- default:
- res = NAME_NOT_FOUND;
- break;
- }
- return res;
-}
-
-int SurfaceTextureClient::dispatchConnect(va_list args) {
- int api = va_arg(args, int);
- return connect(api);
-}
-
-int SurfaceTextureClient::dispatchDisconnect(va_list args) {
- int api = va_arg(args, int);
- return disconnect(api);
-}
-
-int SurfaceTextureClient::dispatchSetUsage(va_list args) {
- int usage = va_arg(args, int);
- return setUsage(usage);
-}
-
-int SurfaceTextureClient::dispatchSetCrop(va_list args) {
- android_native_rect_t const* rect = va_arg(args, android_native_rect_t*);
- return setCrop(reinterpret_cast<Rect const*>(rect));
-}
-
-int SurfaceTextureClient::dispatchSetBufferCount(va_list args) {
- size_t bufferCount = va_arg(args, size_t);
- return setBufferCount(bufferCount);
-}
-
-int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) {
- int w = va_arg(args, int);
- int h = va_arg(args, int);
- int f = va_arg(args, int);
- int err = setBuffersDimensions(w, h);
- if (err != 0) {
- return err;
- }
- return setBuffersFormat(f);
-}
-
-int SurfaceTextureClient::dispatchSetBuffersDimensions(va_list args) {
- int w = va_arg(args, int);
- int h = va_arg(args, int);
- return setBuffersDimensions(w, h);
-}
-
-int SurfaceTextureClient::dispatchSetBuffersFormat(va_list args) {
- int f = va_arg(args, int);
- return setBuffersFormat(f);
-}
-
-int SurfaceTextureClient::dispatchSetScalingMode(va_list args) {
- int m = va_arg(args, int);
- return setScalingMode(m);
-}
-
-int SurfaceTextureClient::dispatchSetBuffersTransform(va_list args) {
- int transform = va_arg(args, int);
- return setBuffersTransform(transform);
-}
-
-int SurfaceTextureClient::dispatchSetBuffersTimestamp(va_list args) {
- int64_t timestamp = va_arg(args, int64_t);
- return setBuffersTimestamp(timestamp);
-}
-
-int SurfaceTextureClient::dispatchLock(va_list args) {
- ANativeWindow_Buffer* outBuffer = va_arg(args, ANativeWindow_Buffer*);
- ARect* inOutDirtyBounds = va_arg(args, ARect*);
- return lock(outBuffer, inOutDirtyBounds);
-}
-
-int SurfaceTextureClient::dispatchUnlockAndPost(va_list args) {
- return unlockAndPost();
-}
-
-
-int SurfaceTextureClient::connect(int api) {
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::connect");
- Mutex::Autolock lock(mMutex);
- int err = mSurfaceTexture->connect(api,
- &mDefaultWidth, &mDefaultHeight, &mTransformHint);
- if (!err && api == NATIVE_WINDOW_API_CPU) {
- mConnectedToCpu = true;
- }
- return err;
-}
-
-int SurfaceTextureClient::disconnect(int api) {
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::disconnect");
- Mutex::Autolock lock(mMutex);
- freeAllBuffers();
- int err = mSurfaceTexture->disconnect(api);
- if (!err) {
- mReqFormat = 0;
- mReqWidth = 0;
- mReqHeight = 0;
- mReqUsage = 0;
- if (api == NATIVE_WINDOW_API_CPU) {
- mConnectedToCpu = false;
- }
- }
- return err;
-}
-
-int SurfaceTextureClient::setUsage(uint32_t reqUsage)
-{
- ALOGV("SurfaceTextureClient::setUsage");
- Mutex::Autolock lock(mMutex);
- mReqUsage = reqUsage;
- return OK;
-}
-
-int SurfaceTextureClient::setCrop(Rect const* rect)
-{
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::setCrop");
- Mutex::Autolock lock(mMutex);
-
- Rect realRect;
- if (rect == NULL || rect->isEmpty()) {
- realRect = Rect(0, 0);
- } else {
- realRect = *rect;
- }
-
- status_t err = mSurfaceTexture->setCrop(*rect);
- ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
-
- return err;
-}
-
-int SurfaceTextureClient::setBufferCount(int bufferCount)
-{
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::setBufferCount");
- Mutex::Autolock lock(mMutex);
-
- status_t err = mSurfaceTexture->setBufferCount(bufferCount);
- ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s",
- bufferCount, strerror(-err));
-
- if (err == NO_ERROR) {
- freeAllBuffers();
- }
-
- return err;
-}
-
-int SurfaceTextureClient::setBuffersDimensions(int w, int h)
-{
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::setBuffersDimensions");
- Mutex::Autolock lock(mMutex);
-
- if (w<0 || h<0)
- return BAD_VALUE;
-
- if ((w && !h) || (!w && h))
- return BAD_VALUE;
-
- mReqWidth = w;
- mReqHeight = h;
-
- status_t err = mSurfaceTexture->setCrop(Rect(0, 0));
- ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
-
- return err;
-}
-
-int SurfaceTextureClient::setBuffersFormat(int format)
-{
- ALOGV("SurfaceTextureClient::setBuffersFormat");
- Mutex::Autolock lock(mMutex);
-
- if (format<0)
- return BAD_VALUE;
-
- mReqFormat = format;
-
- return NO_ERROR;
-}
-
-int SurfaceTextureClient::setScalingMode(int mode)
-{
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
- Mutex::Autolock lock(mMutex);
- // mode is validated on the server
- status_t err = mSurfaceTexture->setScalingMode(mode);
- ALOGE_IF(err, "ISurfaceTexture::setScalingMode(%d) returned %s",
- mode, strerror(-err));
-
- return err;
-}
-
-int SurfaceTextureClient::setBuffersTransform(int transform)
-{
- ATRACE_CALL();
- ALOGV("SurfaceTextureClient::setBuffersTransform");
- Mutex::Autolock lock(mMutex);
- status_t err = mSurfaceTexture->setTransform(transform);
- return err;
-}
-
-int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
-{
- ALOGV("SurfaceTextureClient::setBuffersTimestamp");
- Mutex::Autolock lock(mMutex);
- mTimestamp = timestamp;
- return NO_ERROR;
-}
-
-void SurfaceTextureClient::freeAllBuffers() {
- for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- mSlots[i] = 0;
- }
-}
-
-// ----------------------------------------------------------------------
-// the lock/unlock APIs must be used from the same thread
-
-static status_t copyBlt(
- const sp<GraphicBuffer>& dst,
- const sp<GraphicBuffer>& src,
- const Region& reg)
-{
- // src and dst with, height and format must be identical. no verification
- // is done here.
- status_t err;
- uint8_t const * src_bits = NULL;
- err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), (void**)&src_bits);
- ALOGE_IF(err, "error locking src buffer %s", strerror(-err));
-
- uint8_t* dst_bits = NULL;
- err = dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), (void**)&dst_bits);
- ALOGE_IF(err, "error locking dst buffer %s", strerror(-err));
-
- Region::const_iterator head(reg.begin());
- Region::const_iterator tail(reg.end());
- if (head != tail && src_bits && dst_bits) {
- const size_t bpp = bytesPerPixel(src->format);
- const size_t dbpr = dst->stride * bpp;
- const size_t sbpr = src->stride * bpp;
-
- while (head != tail) {
- const Rect& r(*head++);
- ssize_t h = r.height();
- if (h <= 0) continue;
- size_t size = r.width() * bpp;
- uint8_t const * s = src_bits + (r.left + src->stride * r.top) * bpp;
- uint8_t * d = dst_bits + (r.left + dst->stride * r.top) * bpp;
- if (dbpr==sbpr && size==sbpr) {
- size *= h;
- h = 1;
- }
- do {
- memcpy(d, s, size);
- d += dbpr;
- s += sbpr;
- } while (--h > 0);
- }
- }
-
- if (src_bits)
- src->unlock();
-
- if (dst_bits)
- dst->unlock();
-
- return err;
-}
-
-// ----------------------------------------------------------------------------
-
-status_t SurfaceTextureClient::lock(
- ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds)
-{
- if (mLockedBuffer != 0) {
- ALOGE("Surface::lock failed, already locked");
- return INVALID_OPERATION;
- }
-
- if (!mConnectedToCpu) {
- int err = SurfaceTextureClient::connect(NATIVE_WINDOW_API_CPU);
- if (err) {
- return err;
- }
- // we're intending to do software rendering from this point
- setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
- }
-
- ANativeWindowBuffer* out;
- status_t err = dequeueBuffer(&out);
- ALOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err));
- if (err == NO_ERROR) {
- sp<GraphicBuffer> backBuffer(GraphicBuffer::getSelf(out));
- err = lockBuffer(backBuffer.get());
- ALOGE_IF(err, "lockBuffer (handle=%p) failed (%s)",
- backBuffer->handle, strerror(-err));
- if (err == NO_ERROR) {
- const Rect bounds(backBuffer->width, backBuffer->height);
-
- Region newDirtyRegion;
- if (inOutDirtyBounds) {
- newDirtyRegion.set(static_cast<Rect const&>(*inOutDirtyBounds));
- newDirtyRegion.andSelf(bounds);
- } else {
- newDirtyRegion.set(bounds);
- }
-
- // figure out if we can copy the frontbuffer back
- const sp<GraphicBuffer>& frontBuffer(mPostedBuffer);
- const bool canCopyBack = (frontBuffer != 0 &&
- backBuffer->width == frontBuffer->width &&
- backBuffer->height == frontBuffer->height &&
- backBuffer->format == frontBuffer->format);
-
- if (canCopyBack) {
- // copy the area that is invalid and not repainted this round
- const Region copyback(mOldDirtyRegion.subtract(newDirtyRegion));
- if (!copyback.isEmpty())
- copyBlt(backBuffer, frontBuffer, copyback);
- } else {
- // if we can't copy-back anything, modify the user's dirty
- // region to make sure they redraw the whole buffer
- newDirtyRegion.set(bounds);
- }
-
- // keep track of the are of the buffer that is "clean"
- // (ie: that will be redrawn)
- mOldDirtyRegion = newDirtyRegion;
-
- if (inOutDirtyBounds) {
- *inOutDirtyBounds = newDirtyRegion.getBounds();
- }
-
- void* vaddr;
- status_t res = backBuffer->lock(
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
- newDirtyRegion.bounds(), &vaddr);
-
- ALOGW_IF(res, "failed locking buffer (handle = %p)",
- backBuffer->handle);
-
- mLockedBuffer = backBuffer;
- outBuffer->width = backBuffer->width;
- outBuffer->height = backBuffer->height;
- outBuffer->stride = backBuffer->stride;
- outBuffer->format = backBuffer->format;
- outBuffer->bits = vaddr;
- }
- }
- return err;
-}
-
-status_t SurfaceTextureClient::unlockAndPost()
-{
- if (mLockedBuffer == 0) {
- ALOGE("Surface::unlockAndPost failed, no locked buffer");
- return INVALID_OPERATION;
- }
-
- status_t err = mLockedBuffer->unlock();
- ALOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle);
-
- err = queueBuffer(mLockedBuffer.get());
- ALOGE_IF(err, "queueBuffer (handle=%p) failed (%s)",
- mLockedBuffer->handle, strerror(-err));
-
- mPostedBuffer = mLockedBuffer;
- mLockedBuffer = 0;
- return err;
-}
-
-}; // namespace android
diff --git a/libs/gui/tests/Android.mk b/libs/gui/tests/Android.mk
deleted file mode 100644
index 55ac133..0000000
--- a/libs/gui/tests/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Build the unit tests,
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := SurfaceTexture_test
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- Surface_test.cpp \
- SurfaceTextureClient_test.cpp \
- SurfaceTexture_test.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- libEGL \
- libGLESv2 \
- libandroid \
- libbinder \
- libcutils \
- libgui \
- libstlport \
- libui \
- libutils \
-
-LOCAL_C_INCLUDES := \
- bionic \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport \
-
-# Build the binary to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
-# to integrate with auto-test framework.
-include $(BUILD_NATIVE_TEST)
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
deleted file mode 100644
index c1a3c98..0000000
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <EGL/egl.h>
-#include <gtest/gtest.h>
-#include <gui/SurfaceTextureClient.h>
-#include <utils/threads.h>
-
-namespace android {
-
-class SurfaceTextureClientTest : public ::testing::Test {
-protected:
- SurfaceTextureClientTest():
- mEglDisplay(EGL_NO_DISPLAY),
- mEglSurface(EGL_NO_SURFACE),
- mEglContext(EGL_NO_CONTEXT) {
- }
-
- virtual void SetUp() {
- mST = new SurfaceTexture(123);
- mSTC = new SurfaceTextureClient(mST);
- mANW = mSTC;
-
- // We need a valid GL context so we can test updateTexImage()
- // This initializes EGL and create a dummy GL context with a
- // pbuffer render target.
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
-
- EGLint majorVersion, minorVersion;
- EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLConfig myConfig;
- EGLint numConfigs = 0;
- EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(),
- &myConfig, 1, &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLint pbufferAttribs[] = {
- EGL_WIDTH, 16,
- EGL_HEIGHT, 16,
- EGL_NONE };
- mEglSurface = eglCreatePbufferSurface(mEglDisplay, myConfig, pbufferAttribs);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglSurface);
-
- mEglContext = eglCreateContext(mEglDisplay, myConfig, EGL_NO_CONTEXT, 0);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
-
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- }
-
- virtual void TearDown() {
- mST.clear();
- mSTC.clear();
- mANW.clear();
-
- eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- eglDestroyContext(mEglDisplay, mEglContext);
- eglDestroySurface(mEglDisplay, mEglSurface);
- eglTerminate(mEglDisplay);
- }
-
- virtual EGLint const* getConfigAttribs() {
- static EGLint sDefaultConfigAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_NONE
- };
-
- return sDefaultConfigAttribs;
- }
-
- sp<SurfaceTexture> mST;
- sp<SurfaceTextureClient> mSTC;
- sp<ANativeWindow> mANW;
-
- EGLDisplay mEglDisplay;
- EGLSurface mEglSurface;
- EGLContext mEglContext;
-};
-
-TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
- sp<ISurfaceTexture> ist(mSTC->getISurfaceTexture());
- ASSERT_TRUE(ist != NULL);
-}
-
-TEST_F(SurfaceTextureClientTest, QueuesToWindowCompositorIsFalse) {
- int result = -123;
- int err = mANW->query(mANW.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
- &result);
- EXPECT_EQ(NO_ERROR, err);
- EXPECT_EQ(0, result);
-}
-
-TEST_F(SurfaceTextureClientTest, ConcreteTypeIsSurfaceTextureClient) {
- int result = -123;
- int err = mANW->query(mANW.get(), NATIVE_WINDOW_CONCRETE_TYPE, &result);
- EXPECT_EQ(NO_ERROR, err);
- EXPECT_EQ(NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT, result);
-}
-
-TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) {
- EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_DISPLAY, dpy);
-
- EGLint majorVersion;
- EGLint minorVersion;
- EXPECT_TRUE(eglInitialize(dpy, &majorVersion, &minorVersion));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLConfig myConfig = {0};
- EGLint numConfigs = 0;
- EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_DEPTH_SIZE, 16,
- EGL_STENCIL_SIZE, 8,
- EGL_NONE };
- EXPECT_TRUE(eglChooseConfig(dpy, configAttribs, &myConfig, 1,
- &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLSurface eglSurface = eglCreateWindowSurface(dpy, myConfig, mANW.get(),
- NULL);
- EXPECT_NE(EGL_NO_SURFACE, eglSurface);
- EXPECT_EQ(EGL_SUCCESS, eglGetError());
-
- eglTerminate(dpy);
-}
-
-TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {
- EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, 0, 0));
- EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, -1, 0));
- EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, -1));
- EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, -1, 0));
- EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, 8, 0));
- EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 8, 0, 0));
-}
-
-TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {
- ANativeWindowBuffer* buf;
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(1, buf->width);
- EXPECT_EQ(1, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {
- ANativeWindowBuffer* buf;
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, PIXEL_FORMAT_RGB_565));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(16, buf->width);
- EXPECT_EQ(8, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {
- ANativeWindowBuffer* buf;
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, PIXEL_FORMAT_RGB_565));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(1, buf->width);
- EXPECT_EQ(1, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {
- ANativeWindowBuffer* buf;
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(16, buf->width);
- EXPECT_EQ(8, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {
- ANativeWindowBuffer* buf;
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(16, buf->width);
- EXPECT_EQ(8, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, 0));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(1, buf->width);
- EXPECT_EQ(1, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
- ANativeWindowBuffer* buf;
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, PIXEL_FORMAT_RGB_565));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(1, buf->width);
- EXPECT_EQ(1, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(16, buf->width);
- EXPECT_EQ(8, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
- sp<SurfaceTexture> st(mST);
- ANativeWindowBuffer* buf;
- EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf));
- EXPECT_EQ(16, buf->width);
- EXPECT_EQ(8, buf->height);
- EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf));
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeAfterDequeue) {
- ANativeWindowBuffer* buf[2];
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- EXPECT_NE(buf[0], buf[1]);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1]));
- EXPECT_EQ(OK, mST->setDefaultBufferSize(16, 8));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- EXPECT_NE(buf[0], buf[1]);
- EXPECT_EQ(16, buf[0]->width);
- EXPECT_EQ(16, buf[1]->width);
- EXPECT_EQ(8, buf[0]->height);
- EXPECT_EQ(8, buf[1]->height);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1]));
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeVsGeometry) {
- ANativeWindowBuffer* buf[2];
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- EXPECT_EQ(OK, mST->setDefaultBufferSize(16, 8));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- EXPECT_NE(buf[0], buf[1]);
- EXPECT_EQ(16, buf[0]->width);
- EXPECT_EQ(16, buf[1]->width);
- EXPECT_EQ(8, buf[0]->height);
- EXPECT_EQ(8, buf[1]->height);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1]));
- EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 12, 24, 0));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- EXPECT_NE(buf[0], buf[1]);
- EXPECT_EQ(12, buf[0]->width);
- EXPECT_EQ(12, buf[1]->width);
- EXPECT_EQ(24, buf[0]->height);
- EXPECT_EQ(24, buf[1]->height);
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1]));
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureTooManyUpdateTexImage) {
- android_native_buffer_t* buf[3];
- ASSERT_EQ(OK, mST->setSynchronousMode(false));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
-
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(OK, mST->updateTexImage());
-
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3));
-
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
-
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(OK, mST->updateTexImage());
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeSlowRetire) {
- android_native_buffer_t* buf[3];
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
- EXPECT_NE(buf[0], buf[1]);
- EXPECT_NE(buf[1], buf[2]);
- EXPECT_NE(buf[2], buf[0]);
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[0]);
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]);
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[2]);
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeFastRetire) {
- android_native_buffer_t* buf[3];
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
- EXPECT_NE(buf[0], buf[1]);
- EXPECT_NE(buf[1], buf[2]);
- EXPECT_NE(buf[2], buf[0]);
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[0]);
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]);
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[2]);
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeDQQR) {
- android_native_buffer_t* buf[3];
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3));
-
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[0]);
-
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- EXPECT_NE(buf[0], buf[1]);
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]);
-
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
- EXPECT_NE(buf[1], buf[2]);
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2]));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[2]);
-}
-
-// XXX: We currently have no hardware that properly handles dequeuing the
-// buffer that is currently bound to the texture.
-TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeDequeueCurrent) {
- android_native_buffer_t* buf[3];
- android_native_buffer_t* firstBuf;
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &firstBuf));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), firstBuf));
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), firstBuf);
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2]));
- EXPECT_NE(buf[0], buf[1]);
- EXPECT_NE(buf[1], buf[2]);
- EXPECT_NE(buf[2], buf[0]);
- EXPECT_EQ(firstBuf, buf[2]);
-}
-
-TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeMinUndequeued) {
- android_native_buffer_t* buf[3];
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3));
-
- // We should be able to dequeue all the buffers before we've queued mANWy.
- EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
-
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
-
- EXPECT_EQ(OK, mST->updateTexImage());
- EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]);
-
- EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
-
- // Once we've queued a buffer, however we should not be able to dequeue more
- // than (buffer-count - MIN_UNDEQUEUED_BUFFERS), which is 2 in this case.
- EXPECT_EQ(-EBUSY, mANW->dequeueBuffer(mANW.get(), &buf[1]));
-
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2]));
-}
-
-// XXX: This is not expected to pass until the synchronization hacks are removed
-// from the SurfaceTexture class.
-TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeWaitRetire) {
- class MyThread : public Thread {
- sp<SurfaceTexture> mST;
- EGLContext ctx;
- EGLSurface sur;
- EGLDisplay dpy;
- bool mBufferRetired;
- Mutex mLock;
- virtual bool threadLoop() {
- eglMakeCurrent(dpy, sur, sur, ctx);
- usleep(20000);
- Mutex::Autolock _l(mLock);
- mST->updateTexImage();
- mBufferRetired = true;
- eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- return false;
- }
- public:
- MyThread(const sp<SurfaceTexture>& mST)
- : mST(mST), mBufferRetired(false) {
- ctx = eglGetCurrentContext();
- sur = eglGetCurrentSurface(EGL_DRAW);
- dpy = eglGetCurrentDisplay();
- eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- }
- ~MyThread() {
- eglMakeCurrent(dpy, sur, sur, ctx);
- }
- void bufferDequeued() {
- Mutex::Autolock _l(mLock);
- EXPECT_EQ(true, mBufferRetired);
- }
- };
-
- android_native_buffer_t* buf[3];
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3));
- // dequeue/queue/update so we have a current buffer
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- mST->updateTexImage();
-
- MyThread* thread = new MyThread(mST);
- sp<Thread> threadBase(thread);
-
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- thread->run();
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1]));
- //ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2]));
- //ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2]));
- thread->bufferDequeued();
- thread->requestExitAndWait();
-}
-
-TEST_F(SurfaceTextureClientTest, GetTransformMatrixReturnsVerticalFlip) {
- android_native_buffer_t* buf[3];
- float mtx[16] = {};
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mST->updateTexImage());
- mST->getTransformMatrix(mtx);
-
- EXPECT_EQ(1.f, mtx[0]);
- EXPECT_EQ(0.f, mtx[1]);
- EXPECT_EQ(0.f, mtx[2]);
- EXPECT_EQ(0.f, mtx[3]);
-
- EXPECT_EQ(0.f, mtx[4]);
- EXPECT_EQ(-1.f, mtx[5]);
- EXPECT_EQ(0.f, mtx[6]);
- EXPECT_EQ(0.f, mtx[7]);
-
- EXPECT_EQ(0.f, mtx[8]);
- EXPECT_EQ(0.f, mtx[9]);
- EXPECT_EQ(1.f, mtx[10]);
- EXPECT_EQ(0.f, mtx[11]);
-
- EXPECT_EQ(0.f, mtx[12]);
- EXPECT_EQ(1.f, mtx[13]);
- EXPECT_EQ(0.f, mtx[14]);
- EXPECT_EQ(1.f, mtx[15]);
-}
-
-TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffers) {
- android_native_buffer_t* buf[3];
- float mtx[16] = {};
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mST->updateTexImage());
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 6)); // frees buffers
- mST->getTransformMatrix(mtx);
-
- EXPECT_EQ(1.f, mtx[0]);
- EXPECT_EQ(0.f, mtx[1]);
- EXPECT_EQ(0.f, mtx[2]);
- EXPECT_EQ(0.f, mtx[3]);
-
- EXPECT_EQ(0.f, mtx[4]);
- EXPECT_EQ(-1.f, mtx[5]);
- EXPECT_EQ(0.f, mtx[6]);
- EXPECT_EQ(0.f, mtx[7]);
-
- EXPECT_EQ(0.f, mtx[8]);
- EXPECT_EQ(0.f, mtx[9]);
- EXPECT_EQ(1.f, mtx[10]);
- EXPECT_EQ(0.f, mtx[11]);
-
- EXPECT_EQ(0.f, mtx[12]);
- EXPECT_EQ(1.f, mtx[13]);
- EXPECT_EQ(0.f, mtx[14]);
- EXPECT_EQ(1.f, mtx[15]);
-}
-
-TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWithCrop) {
- android_native_buffer_t* buf[3];
- float mtx[16] = {};
- android_native_rect_t crop;
- crop.left = 0;
- crop.top = 0;
- crop.right = 5;
- crop.bottom = 5;
-
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
- ASSERT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 8, 8, 0));
- ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0]));
- ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &crop));
- ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0]));
- ASSERT_EQ(OK, mST->updateTexImage());
- ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 6)); // frees buffers
- mST->getTransformMatrix(mtx);
-
- // This accounts for the 1 texel shrink for each edge that's included in the
- // transform matrix to avoid texturing outside the crop region.
- EXPECT_EQ(.5f, mtx[0]);
- EXPECT_EQ(0.f, mtx[1]);
- EXPECT_EQ(0.f, mtx[2]);
- EXPECT_EQ(0.f, mtx[3]);
-
- EXPECT_EQ(0.f, mtx[4]);
- EXPECT_EQ(-.5f, mtx[5]);
- EXPECT_EQ(0.f, mtx[6]);
- EXPECT_EQ(0.f, mtx[7]);
-
- EXPECT_EQ(0.f, mtx[8]);
- EXPECT_EQ(0.f, mtx[9]);
- EXPECT_EQ(1.f, mtx[10]);
- EXPECT_EQ(0.f, mtx[11]);
-
- EXPECT_EQ(0.f, mtx[12]);
- EXPECT_EQ(.5f, mtx[13]);
- EXPECT_EQ(0.f, mtx[14]);
- EXPECT_EQ(1.f, mtx[15]);
-}
-
-// This test verifies that the buffer format can be queried immediately after
-// it is set.
-TEST_F(SurfaceTextureClientTest, QueryFormatAfterSettingWorks) {
- sp<ANativeWindow> anw(mSTC);
- int fmts[] = {
- // RGBA_8888 should not come first, as it's the default
- HAL_PIXEL_FORMAT_RGBX_8888,
- HAL_PIXEL_FORMAT_RGBA_8888,
- HAL_PIXEL_FORMAT_RGB_888,
- HAL_PIXEL_FORMAT_RGB_565,
- HAL_PIXEL_FORMAT_BGRA_8888,
- HAL_PIXEL_FORMAT_RGBA_5551,
- HAL_PIXEL_FORMAT_RGBA_4444,
- HAL_PIXEL_FORMAT_YV12,
- };
-
- const int numFmts = (sizeof(fmts) / sizeof(fmts[0]));
- for (int i = 0; i < numFmts; i++) {
- int fmt = -1;
- ASSERT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, fmts[i]));
- ASSERT_EQ(OK, anw->query(anw.get(), NATIVE_WINDOW_FORMAT, &fmt));
- EXPECT_EQ(fmts[i], fmt);
- }
-}
-
-class MultiSurfaceTextureClientTest : public ::testing::Test {
-
-public:
- MultiSurfaceTextureClientTest() :
- mEglDisplay(EGL_NO_DISPLAY),
- mEglContext(EGL_NO_CONTEXT) {
- for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
- mEglSurfaces[i] = EGL_NO_CONTEXT;
- }
- }
-
-protected:
-
- enum { NUM_SURFACE_TEXTURES = 32 };
-
- virtual void SetUp() {
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
-
- EGLint majorVersion, minorVersion;
- EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLConfig myConfig;
- EGLint numConfigs = 0;
- EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE
- };
- EXPECT_TRUE(eglChooseConfig(mEglDisplay, configAttribs, &myConfig, 1,
- &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- mEglContext = eglCreateContext(mEglDisplay, myConfig, EGL_NO_CONTEXT,
- 0);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
-
- for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
- sp<SurfaceTexture> st(new SurfaceTexture(i));
- sp<SurfaceTextureClient> stc(new SurfaceTextureClient(st));
- mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig,
- static_cast<ANativeWindow*>(stc.get()), NULL);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglSurfaces[i]);
- }
- }
-
- virtual void TearDown() {
- eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
-
- for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
- if (mEglSurfaces[i] != EGL_NO_SURFACE) {
- eglDestroySurface(mEglDisplay, mEglSurfaces[i]);
- }
- }
-
- if (mEglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(mEglDisplay, mEglContext);
- }
-
- if (mEglDisplay != EGL_NO_DISPLAY) {
- eglTerminate(mEglDisplay);
- }
- }
-
- EGLDisplay mEglDisplay;
- EGLSurface mEglSurfaces[NUM_SURFACE_TEXTURES];
- EGLContext mEglContext;
-};
-
-// XXX: This test is disabled because it causes a hang on some devices. See bug
-// 5015672.
-TEST_F(MultiSurfaceTextureClientTest, DISABLED_MakeCurrentBetweenSurfacesWorks) {
- for (int iter = 0; iter < 8; iter++) {
- for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
- eglMakeCurrent(mEglDisplay, mEglSurfaces[i], mEglSurfaces[i],
- mEglContext);
- glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(mEglDisplay, mEglSurfaces[i]);
- }
- }
-}
-
-} // namespace android
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
deleted file mode 100644
index 8c6defe..0000000
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ /dev/null
@@ -1,1730 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "SurfaceTexture_test"
-//#define LOG_NDEBUG 0
-
-#include <gtest/gtest.h>
-#include <gui/SurfaceTexture.h>
-#include <gui/SurfaceTextureClient.h>
-#include <ui/GraphicBuffer.h>
-#include <utils/String8.h>
-#include <utils/threads.h>
-
-#include <gui/ISurfaceComposer.h>
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-
-namespace android {
-
-class GLTest : public ::testing::Test {
-protected:
-
- GLTest():
- mEglDisplay(EGL_NO_DISPLAY),
- mEglSurface(EGL_NO_SURFACE),
- mEglContext(EGL_NO_CONTEXT) {
- }
-
- virtual void SetUp() {
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
-
- EGLint majorVersion;
- EGLint minorVersion;
- EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- RecordProperty("EglVersionMajor", majorVersion);
- RecordProperty("EglVersionMajor", minorVersion);
-
- EGLint numConfigs = 0;
- EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(), &mGlConfig,
- 1, &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- char* displaySecsEnv = getenv("GLTEST_DISPLAY_SECS");
- if (displaySecsEnv != NULL) {
- mDisplaySecs = atoi(displaySecsEnv);
- if (mDisplaySecs < 0) {
- mDisplaySecs = 0;
- }
- } else {
- mDisplaySecs = 0;
- }
-
- if (mDisplaySecs > 0) {
- mComposerClient = new SurfaceComposerClient;
- ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
-
- mSurfaceControl = mComposerClient->createSurface(
- String8("Test Surface"), 0,
- getSurfaceWidth(), getSurfaceHeight(),
- PIXEL_FORMAT_RGB_888, 0);
-
- ASSERT_TRUE(mSurfaceControl != NULL);
- ASSERT_TRUE(mSurfaceControl->isValid());
-
- SurfaceComposerClient::openGlobalTransaction();
- ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(0x7FFFFFFF));
- ASSERT_EQ(NO_ERROR, mSurfaceControl->show());
- SurfaceComposerClient::closeGlobalTransaction();
-
- sp<ANativeWindow> window = mSurfaceControl->getSurface();
- mEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig,
- window.get(), NULL);
- } else {
- EGLint pbufferAttribs[] = {
- EGL_WIDTH, getSurfaceWidth(),
- EGL_HEIGHT, getSurfaceHeight(),
- EGL_NONE };
-
- mEglSurface = eglCreatePbufferSurface(mEglDisplay, mGlConfig,
- pbufferAttribs);
- }
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglSurface);
-
- mEglContext = eglCreateContext(mEglDisplay, mGlConfig, EGL_NO_CONTEXT,
- getContextAttribs());
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
-
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLint w, h;
- EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, &w));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, &h));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- RecordProperty("EglSurfaceWidth", w);
- RecordProperty("EglSurfaceHeight", h);
-
- glViewport(0, 0, w, h);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- }
-
- virtual void TearDown() {
- // Display the result
- if (mDisplaySecs > 0 && mEglSurface != EGL_NO_SURFACE) {
- eglSwapBuffers(mEglDisplay, mEglSurface);
- sleep(mDisplaySecs);
- }
-
- if (mComposerClient != NULL) {
- mComposerClient->dispose();
- }
- if (mEglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(mEglDisplay, mEglContext);
- }
- if (mEglSurface != EGL_NO_SURFACE) {
- eglDestroySurface(mEglDisplay, mEglSurface);
- }
- if (mEglDisplay != EGL_NO_DISPLAY) {
- eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- eglTerminate(mEglDisplay);
- }
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- }
-
- virtual EGLint const* getConfigAttribs() {
- static EGLint sDefaultConfigAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_DEPTH_SIZE, 16,
- EGL_STENCIL_SIZE, 8,
- EGL_NONE };
-
- return sDefaultConfigAttribs;
- }
-
- virtual EGLint const* getContextAttribs() {
- static EGLint sDefaultContextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE };
-
- return sDefaultContextAttribs;
- }
-
- virtual EGLint getSurfaceWidth() {
- return 512;
- }
-
- virtual EGLint getSurfaceHeight() {
- return 512;
- }
-
- void loadShader(GLenum shaderType, const char* pSource, GLuint* outShader) {
- GLuint shader = glCreateShader(shaderType);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glCompileShader(shader);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- printf("Shader compile log:\n%s\n", buf);
- free(buf);
- FAIL();
- }
- } else {
- char* buf = (char*) malloc(0x1000);
- if (buf) {
- glGetShaderInfoLog(shader, 0x1000, NULL, buf);
- printf("Shader compile log:\n%s\n", buf);
- free(buf);
- FAIL();
- }
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- ASSERT_TRUE(shader != 0);
- *outShader = shader;
- }
-
- void createProgram(const char* pVertexSource, const char* pFragmentSource,
- GLuint* outPgm) {
- GLuint vertexShader, fragmentShader;
- {
- SCOPED_TRACE("compiling vertex shader");
- loadShader(GL_VERTEX_SHADER, pVertexSource, &vertexShader);
- if (HasFatalFailure()) {
- return;
- }
- }
- {
- SCOPED_TRACE("compiling fragment shader");
- loadShader(GL_FRAGMENT_SHADER, pFragmentSource, &fragmentShader);
- if (HasFatalFailure()) {
- return;
- }
- }
-
- GLuint program = glCreateProgram();
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- if (program) {
- glAttachShader(program, vertexShader);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glAttachShader(program, fragmentShader);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- printf("Program link log:\n%s\n", buf);
- free(buf);
- FAIL();
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- glDeleteShader(vertexShader);
- glDeleteShader(fragmentShader);
- ASSERT_TRUE(program != 0);
- *outPgm = program;
- }
-
- static int abs(int value) {
- return value > 0 ? value : -value;
- }
-
- ::testing::AssertionResult checkPixel(int x, int y, int r,
- int g, int b, int a, int tolerance=2) {
- GLubyte pixel[4];
- String8 msg;
- glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
- GLenum err = glGetError();
- if (err != GL_NO_ERROR) {
- msg += String8::format("error reading pixel: %#x", err);
- while ((err = glGetError()) != GL_NO_ERROR) {
- msg += String8::format(", %#x", err);
- }
- fprintf(stderr, "pixel check failure: %s\n", msg.string());
- return ::testing::AssertionFailure(
- ::testing::Message(msg.string()));
- }
- if (r >= 0 && abs(r - int(pixel[0])) > tolerance) {
- msg += String8::format("r(%d isn't %d)", pixel[0], r);
- }
- if (g >= 0 && abs(g - int(pixel[1])) > tolerance) {
- if (!msg.isEmpty()) {
- msg += " ";
- }
- msg += String8::format("g(%d isn't %d)", pixel[1], g);
- }
- if (b >= 0 && abs(b - int(pixel[2])) > tolerance) {
- if (!msg.isEmpty()) {
- msg += " ";
- }
- msg += String8::format("b(%d isn't %d)", pixel[2], b);
- }
- if (a >= 0 && abs(a - int(pixel[3])) > tolerance) {
- if (!msg.isEmpty()) {
- msg += " ";
- }
- msg += String8::format("a(%d isn't %d)", pixel[3], a);
- }
- if (!msg.isEmpty()) {
- fprintf(stderr, "pixel check failure: %s\n", msg.string());
- return ::testing::AssertionFailure(
- ::testing::Message(msg.string()));
- } else {
- return ::testing::AssertionSuccess();
- }
- }
-
- int mDisplaySecs;
- sp<SurfaceComposerClient> mComposerClient;
- sp<SurfaceControl> mSurfaceControl;
-
- EGLDisplay mEglDisplay;
- EGLSurface mEglSurface;
- EGLContext mEglContext;
- EGLConfig mGlConfig;
-};
-
-// XXX: Code above this point should live elsewhere
-
-class SurfaceTextureGLTest : public GLTest {
-protected:
- enum { TEX_ID = 123 };
-
- virtual void SetUp() {
- GLTest::SetUp();
- mST = new SurfaceTexture(TEX_ID);
- mSTC = new SurfaceTextureClient(mST);
- mANW = mSTC;
-
- const char vsrc[] =
- "attribute vec4 vPosition;\n"
- "varying vec2 texCoords;\n"
- "uniform mat4 texMatrix;\n"
- "void main() {\n"
- " vec2 vTexCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n"
- " texCoords = (texMatrix * vec4(vTexCoords, 0.0, 1.0)).xy;\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
- const char fsrc[] =
- "#extension GL_OES_EGL_image_external : require\n"
- "precision mediump float;\n"
- "uniform samplerExternalOES texSampler;\n"
- "varying vec2 texCoords;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(texSampler, texCoords);\n"
- "}\n";
-
- {
- SCOPED_TRACE("creating shader program");
- createProgram(vsrc, fsrc, &mPgm);
- if (HasFatalFailure()) {
- return;
- }
- }
-
- mPositionHandle = glGetAttribLocation(mPgm, "vPosition");
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- ASSERT_NE(-1, mPositionHandle);
- mTexSamplerHandle = glGetUniformLocation(mPgm, "texSampler");
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- ASSERT_NE(-1, mTexSamplerHandle);
- mTexMatrixHandle = glGetUniformLocation(mPgm, "texMatrix");
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- ASSERT_NE(-1, mTexMatrixHandle);
- }
-
- virtual void TearDown() {
- mANW.clear();
- mSTC.clear();
- mST.clear();
- GLTest::TearDown();
- }
-
- // drawTexture draws the SurfaceTexture over the entire GL viewport.
- void drawTexture() {
- const GLfloat triangleVertices[] = {
- -1.0f, 1.0f,
- -1.0f, -1.0f,
- 1.0f, -1.0f,
- 1.0f, 1.0f,
- };
-
- glVertexAttribPointer(mPositionHandle, 2, GL_FLOAT, GL_FALSE, 0,
- triangleVertices);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glEnableVertexAttribArray(mPositionHandle);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
-
- glUseProgram(mPgm);
- glUniform1i(mTexSamplerHandle, 0);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, TEX_ID);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
-
- // XXX: These calls are not needed for GL_TEXTURE_EXTERNAL_OES as
- // they're setting the defautls for that target, but when hacking things
- // to use GL_TEXTURE_2D they are needed to achieve the same behavior.
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER,
- GL_LINEAR);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S,
- GL_CLAMP_TO_EDGE);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T,
- GL_CLAMP_TO_EDGE);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
-
- GLfloat texMatrix[16];
- mST->getTransformMatrix(texMatrix);
- glUniformMatrix4fv(mTexMatrixHandle, 1, GL_FALSE, texMatrix);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- }
-
- class FrameWaiter : public SurfaceTexture::FrameAvailableListener {
- public:
- FrameWaiter():
- mPendingFrames(0) {
- }
-
- void waitForFrame() {
- Mutex::Autolock lock(mMutex);
- while (mPendingFrames == 0) {
- mCondition.wait(mMutex);
- }
- mPendingFrames--;
- }
-
- virtual void onFrameAvailable() {
- Mutex::Autolock lock(mMutex);
- mPendingFrames++;
- mCondition.signal();
- }
-
- int mPendingFrames;
- Mutex mMutex;
- Condition mCondition;
- };
-
- sp<SurfaceTexture> mST;
- sp<SurfaceTextureClient> mSTC;
- sp<ANativeWindow> mANW;
-
- GLuint mPgm;
- GLint mPositionHandle;
- GLint mTexSamplerHandle;
- GLint mTexMatrixHandle;
-};
-
-// Fill a YV12 buffer with a multi-colored checkerboard pattern
-void fillYV12Buffer(uint8_t* buf, int w, int h, int stride) {
- const int blockWidth = w > 16 ? w / 16 : 1;
- const int blockHeight = h > 16 ? h / 16 : 1;
- const int yuvTexOffsetY = 0;
- int yuvTexStrideY = stride;
- int yuvTexOffsetV = yuvTexStrideY * h;
- int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
- int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2;
- int yuvTexStrideU = yuvTexStrideV;
- for (int x = 0; x < w; x++) {
- for (int y = 0; y < h; y++) {
- int parityX = (x / blockWidth) & 1;
- int parityY = (y / blockHeight) & 1;
- unsigned char intensity = (parityX ^ parityY) ? 63 : 191;
- buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity;
- if (x < w / 2 && y < h / 2) {
- buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity;
- if (x * 2 < w / 2 && y * 2 < h / 2) {
- buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] =
- buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] =
- buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] =
- buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] =
- intensity;
- }
- }
- }
- }
-}
-
-// Fill a YV12 buffer with red outside a given rectangle and green inside it.
-void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride,
- const android_native_rect_t& rect) {
- const int yuvTexOffsetY = 0;
- int yuvTexStrideY = stride;
- int yuvTexOffsetV = yuvTexStrideY * h;
- int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
- int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2;
- int yuvTexStrideU = yuvTexStrideV;
- for (int x = 0; x < w; x++) {
- for (int y = 0; y < h; y++) {
- bool inside = rect.left <= x && x < rect.right &&
- rect.top <= y && y < rect.bottom;
- buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = inside ? 240 : 64;
- if (x < w / 2 && y < h / 2) {
- bool inside = rect.left <= 2*x && 2*x < rect.right &&
- rect.top <= 2*y && 2*y < rect.bottom;
- buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = 16;
- buf[yuvTexOffsetV + (y * yuvTexStrideV) + x] =
- inside ? 16 : 255;
- }
- }
- }
-}
-
-void fillRGBA8Buffer(uint8_t* buf, int w, int h, int stride) {
- const size_t PIXEL_SIZE = 4;
- for (int x = 0; x < w; x++) {
- for (int y = 0; y < h; y++) {
- off_t offset = (y * stride + x) * PIXEL_SIZE;
- for (int c = 0; c < 4; c++) {
- int parityX = (x / (1 << (c+2))) & 1;
- int parityY = (y / (1 << (c+2))) & 1;
- buf[offset + c] = (parityX ^ parityY) ? 231 : 35;
- }
- }
- }
-}
-
-void fillRGBA8BufferSolid(uint8_t* buf, int w, int h, int stride, uint8_t r,
- uint8_t g, uint8_t b, uint8_t a) {
- const size_t PIXEL_SIZE = 4;
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < h; x++) {
- off_t offset = (y * stride + x) * PIXEL_SIZE;
- buf[offset + 0] = r;
- buf[offset + 1] = g;
- buf[offset + 2] = b;
- buf[offset + 3] = a;
- }
- }
-}
-
-TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) {
- const int texWidth = 64;
- const int texHeight = 66;
-
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- ANativeWindowBuffer* anb;
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
-
- // Fill the buffer with the a checkerboard pattern
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- fillYV12Buffer(img, texWidth, texHeight, buf->getStride());
- buf->unlock();
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
-
- mST->updateTexImage();
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, texWidth, texHeight);
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 0, 0, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(63, 0, 0, 133, 0, 255));
- EXPECT_TRUE(checkPixel(63, 65, 0, 133, 0, 255));
- EXPECT_TRUE(checkPixel( 0, 65, 255, 127, 255, 255));
-
- EXPECT_TRUE(checkPixel(22, 44, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(45, 52, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(52, 51, 98, 255, 73, 255));
- EXPECT_TRUE(checkPixel( 7, 31, 155, 0, 118, 255));
- EXPECT_TRUE(checkPixel(31, 9, 107, 24, 87, 255));
- EXPECT_TRUE(checkPixel(29, 35, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(36, 22, 155, 29, 0, 255));
-}
-
-TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferPow2) {
- const int texWidth = 64;
- const int texHeight = 64;
-
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- ANativeWindowBuffer* anb;
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
-
- // Fill the buffer with the a checkerboard pattern
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- fillYV12Buffer(img, texWidth, texHeight, buf->getStride());
- buf->unlock();
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
-
- mST->updateTexImage();
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, texWidth, texHeight);
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 0, 0, 0, 133, 0, 255));
- EXPECT_TRUE(checkPixel(63, 0, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(63, 63, 0, 133, 0, 255));
- EXPECT_TRUE(checkPixel( 0, 63, 255, 127, 255, 255));
-
- EXPECT_TRUE(checkPixel(22, 19, 100, 255, 74, 255));
- EXPECT_TRUE(checkPixel(45, 11, 100, 255, 74, 255));
- EXPECT_TRUE(checkPixel(52, 12, 155, 0, 181, 255));
- EXPECT_TRUE(checkPixel( 7, 32, 150, 237, 170, 255));
- EXPECT_TRUE(checkPixel(31, 54, 0, 71, 117, 255));
- EXPECT_TRUE(checkPixel(29, 28, 0, 133, 0, 255));
- EXPECT_TRUE(checkPixel(36, 41, 100, 232, 255, 255));
-}
-
-TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) {
- const int texWidth = 64;
- const int texHeight = 66;
-
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- android_native_rect_t crops[] = {
- {4, 6, 22, 36},
- {0, 6, 22, 36},
- {4, 0, 22, 36},
- {4, 6, texWidth, 36},
- {4, 6, 22, texHeight},
- };
-
- for (int i = 0; i < 5; i++) {
- const android_native_rect_t& crop(crops[i]);
- SCOPED_TRACE(String8::format("rect{ l: %d t: %d r: %d b: %d }",
- crop.left, crop.top, crop.right, crop.bottom).string());
-
- ASSERT_EQ(NO_ERROR, native_window_set_crop(mANW.get(), &crop));
-
- ANativeWindowBuffer* anb;
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(),
- buf->getNativeBuffer()));
-
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- fillYV12BufferRect(img, texWidth, texHeight, buf->getStride(), crop);
- buf->unlock();
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(),
- buf->getNativeBuffer()));
-
- mST->updateTexImage();
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, 64, 64);
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 0, 0, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(63, 0, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(63, 63, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel( 0, 63, 82, 255, 35, 255));
-
- EXPECT_TRUE(checkPixel(25, 14, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(35, 31, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(57, 6, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel( 5, 42, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(32, 33, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(16, 26, 82, 255, 35, 255));
- EXPECT_TRUE(checkPixel(46, 51, 82, 255, 35, 255));
- }
-}
-
-// This test is intended to catch synchronization bugs between the CPU-written
-// and GPU-read buffers.
-TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BuffersRepeatedly) {
- enum { texWidth = 16 };
- enum { texHeight = 16 };
- enum { numFrames = 1024 };
-
- ASSERT_EQ(NO_ERROR, mST->setSynchronousMode(true));
- ASSERT_EQ(NO_ERROR, mST->setBufferCountServer(2));
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- struct TestPixel {
- int x;
- int y;
- };
- const TestPixel testPixels[] = {
- { 4, 11 },
- { 12, 14 },
- { 7, 2 },
- };
- enum {numTestPixels = sizeof(testPixels) / sizeof(testPixels[0])};
-
- class ProducerThread : public Thread {
- public:
- ProducerThread(const sp<ANativeWindow>& anw,
- const TestPixel* testPixels):
- mANW(anw),
- mTestPixels(testPixels) {
- }
-
- virtual ~ProducerThread() {
- }
-
- virtual bool threadLoop() {
- for (int i = 0; i < numFrames; i++) {
- ANativeWindowBuffer* anb;
- if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) {
- return false;
- }
- if (anb == NULL) {
- return false;
- }
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- if (mANW->lockBuffer(mANW.get(), buf->getNativeBuffer())
- != NO_ERROR) {
- return false;
- }
-
- const int yuvTexOffsetY = 0;
- int stride = buf->getStride();
- int yuvTexStrideY = stride;
- int yuvTexOffsetV = yuvTexStrideY * texHeight;
- int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
- int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * texHeight/2;
- int yuvTexStrideU = yuvTexStrideV;
-
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
-
- // Gray out all the test pixels first, so we're more likely to
- // see a failure if GL is still texturing from the buffer we
- // just dequeued.
- for (int j = 0; j < numTestPixels; j++) {
- int x = mTestPixels[j].x;
- int y = mTestPixels[j].y;
- uint8_t value = 128;
- img[y*stride + x] = value;
- }
-
- // Fill the buffer with gray.
- for (int y = 0; y < texHeight; y++) {
- for (int x = 0; x < texWidth; x++) {
- img[yuvTexOffsetY + y*yuvTexStrideY + x] = 128;
- img[yuvTexOffsetU + (y/2)*yuvTexStrideU + x/2] = 128;
- img[yuvTexOffsetV + (y/2)*yuvTexStrideV + x/2] = 128;
- }
- }
-
- // Set the test pixels to either white or black.
- for (int j = 0; j < numTestPixels; j++) {
- int x = mTestPixels[j].x;
- int y = mTestPixels[j].y;
- uint8_t value = 0;
- if (j == (i % numTestPixels)) {
- value = 255;
- }
- img[y*stride + x] = value;
- }
-
- buf->unlock();
- if (mANW->queueBuffer(mANW.get(), buf->getNativeBuffer())
- != NO_ERROR) {
- return false;
- }
- }
- return false;
- }
-
- sp<ANativeWindow> mANW;
- const TestPixel* mTestPixels;
- };
-
- sp<FrameWaiter> fw(new FrameWaiter);
- mST->setFrameAvailableListener(fw);
-
- sp<Thread> pt(new ProducerThread(mANW, testPixels));
- pt->run();
-
- glViewport(0, 0, texWidth, texHeight);
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // We wait for the first two frames up front so that the producer will be
- // likely to dequeue the buffer that's currently being textured from.
- fw->waitForFrame();
- fw->waitForFrame();
-
- for (int i = 0; i < numFrames; i++) {
- SCOPED_TRACE(String8::format("frame %d", i).string());
-
- // We must wait for each frame to come in because if we ever do an
- // updateTexImage call that doesn't consume a newly available buffer
- // then the producer and consumer will get out of sync, which will cause
- // a deadlock.
- if (i > 1) {
- fw->waitForFrame();
- }
- mST->updateTexImage();
- drawTexture();
-
- for (int j = 0; j < numTestPixels; j++) {
- int x = testPixels[j].x;
- int y = testPixels[j].y;
- uint8_t value = 0;
- if (j == (i % numTestPixels)) {
- // We must y-invert the texture coords
- EXPECT_TRUE(checkPixel(x, texHeight-y-1, 255, 255, 255, 255));
- } else {
- // We must y-invert the texture coords
- EXPECT_TRUE(checkPixel(x, texHeight-y-1, 0, 0, 0, 255));
- }
- }
- }
-
- pt->requestExitAndWait();
-}
-
-TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferNpot) {
- const int texWidth = 64;
- const int texHeight = 66;
-
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- android_native_buffer_t* anb;
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
-
- // Fill the buffer with the a checkerboard pattern
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- fillRGBA8Buffer(img, texWidth, texHeight, buf->getStride());
- buf->unlock();
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
-
- mST->updateTexImage();
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, texWidth, texHeight);
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35));
- EXPECT_TRUE(checkPixel(63, 0, 231, 231, 231, 231));
- EXPECT_TRUE(checkPixel(63, 65, 231, 231, 231, 231));
- EXPECT_TRUE(checkPixel( 0, 65, 35, 35, 35, 35));
-
- EXPECT_TRUE(checkPixel(15, 10, 35, 231, 231, 231));
- EXPECT_TRUE(checkPixel(23, 65, 231, 35, 231, 35));
- EXPECT_TRUE(checkPixel(19, 40, 35, 231, 35, 35));
- EXPECT_TRUE(checkPixel(38, 30, 231, 35, 35, 35));
- EXPECT_TRUE(checkPixel(42, 54, 35, 35, 35, 231));
- EXPECT_TRUE(checkPixel(37, 34, 35, 231, 231, 231));
- EXPECT_TRUE(checkPixel(31, 8, 231, 35, 35, 231));
- EXPECT_TRUE(checkPixel(37, 47, 231, 35, 231, 231));
- EXPECT_TRUE(checkPixel(25, 38, 35, 35, 35, 35));
- EXPECT_TRUE(checkPixel(49, 6, 35, 231, 35, 35));
- EXPECT_TRUE(checkPixel(54, 50, 35, 231, 231, 231));
- EXPECT_TRUE(checkPixel(27, 26, 231, 231, 231, 231));
- EXPECT_TRUE(checkPixel(10, 6, 35, 35, 231, 231));
- EXPECT_TRUE(checkPixel(29, 4, 35, 35, 35, 231));
- EXPECT_TRUE(checkPixel(55, 28, 35, 35, 231, 35));
- EXPECT_TRUE(checkPixel(58, 55, 35, 35, 231, 231));
-}
-
-TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) {
- const int texWidth = 64;
- const int texHeight = 64;
-
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- android_native_buffer_t* anb;
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
-
- // Fill the buffer with the a checkerboard pattern
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- fillRGBA8Buffer(img, texWidth, texHeight, buf->getStride());
- buf->unlock();
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
-
- mST->updateTexImage();
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, texWidth, texHeight);
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 0, 0, 231, 231, 231, 231));
- EXPECT_TRUE(checkPixel(63, 0, 35, 35, 35, 35));
- EXPECT_TRUE(checkPixel(63, 63, 231, 231, 231, 231));
- EXPECT_TRUE(checkPixel( 0, 63, 35, 35, 35, 35));
-
- EXPECT_TRUE(checkPixel(12, 46, 231, 231, 231, 35));
- EXPECT_TRUE(checkPixel(16, 1, 231, 231, 35, 231));
- EXPECT_TRUE(checkPixel(21, 12, 231, 35, 35, 231));
- EXPECT_TRUE(checkPixel(26, 51, 231, 35, 231, 35));
- EXPECT_TRUE(checkPixel( 5, 32, 35, 231, 231, 35));
- EXPECT_TRUE(checkPixel(13, 8, 35, 231, 231, 231));
- EXPECT_TRUE(checkPixel(46, 3, 35, 35, 231, 35));
- EXPECT_TRUE(checkPixel(30, 33, 35, 35, 35, 35));
- EXPECT_TRUE(checkPixel( 6, 52, 231, 231, 35, 35));
- EXPECT_TRUE(checkPixel(55, 33, 35, 231, 35, 231));
- EXPECT_TRUE(checkPixel(16, 29, 35, 35, 231, 231));
- EXPECT_TRUE(checkPixel( 1, 30, 35, 35, 35, 231));
- EXPECT_TRUE(checkPixel(41, 37, 35, 35, 231, 231));
- EXPECT_TRUE(checkPixel(46, 29, 231, 231, 35, 35));
- EXPECT_TRUE(checkPixel(15, 25, 35, 231, 35, 231));
- EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35));
-}
-
-TEST_F(SurfaceTextureGLTest, AbandonUnblocksDequeueBuffer) {
- class ProducerThread : public Thread {
- public:
- ProducerThread(const sp<ANativeWindow>& anw):
- mANW(anw),
- mDequeueError(NO_ERROR) {
- }
-
- virtual ~ProducerThread() {
- }
-
- virtual bool threadLoop() {
- Mutex::Autolock lock(mMutex);
- ANativeWindowBuffer* anb;
-
- // Frame 1
- if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) {
- return false;
- }
- if (anb == NULL) {
- return false;
- }
- if (mANW->queueBuffer(mANW.get(), anb)
- != NO_ERROR) {
- return false;
- }
-
- // Frame 2
- if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) {
- return false;
- }
- if (anb == NULL) {
- return false;
- }
- if (mANW->queueBuffer(mANW.get(), anb)
- != NO_ERROR) {
- return false;
- }
-
- // Frame 3 - error expected
- mDequeueError = mANW->dequeueBuffer(mANW.get(), &anb);
- return false;
- }
-
- status_t getDequeueError() {
- Mutex::Autolock lock(mMutex);
- return mDequeueError;
- }
-
- private:
- sp<ANativeWindow> mANW;
- status_t mDequeueError;
- Mutex mMutex;
- };
-
- sp<FrameWaiter> fw(new FrameWaiter);
- mST->setFrameAvailableListener(fw);
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, mST->setBufferCountServer(2));
-
- sp<Thread> pt(new ProducerThread(mANW));
- pt->run();
-
- fw->waitForFrame();
- fw->waitForFrame();
-
- // Sleep for 100ms to allow the producer thread's dequeueBuffer call to
- // block waiting for a buffer to become available.
- usleep(100000);
-
- mST->abandon();
-
- pt->requestExitAndWait();
- ASSERT_EQ(NO_INIT,
- reinterpret_cast<ProducerThread*>(pt.get())->getDequeueError());
-}
-
-TEST_F(SurfaceTextureGLTest, InvalidWidthOrHeightFails) {
- int texHeight = 16;
- ANativeWindowBuffer* anb;
-
- GLint maxTextureSize;
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
-
- // make sure it works with small textures
- mST->setDefaultBufferSize(16, texHeight);
- EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- EXPECT_EQ(16, anb->width);
- EXPECT_EQ(texHeight, anb->height);
- EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb));
- EXPECT_EQ(NO_ERROR, mST->updateTexImage());
-
- // make sure it works with GL_MAX_TEXTURE_SIZE
- mST->setDefaultBufferSize(maxTextureSize, texHeight);
- EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- EXPECT_EQ(maxTextureSize, anb->width);
- EXPECT_EQ(texHeight, anb->height);
- EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb));
- EXPECT_EQ(NO_ERROR, mST->updateTexImage());
-
- // make sure it fails with GL_MAX_TEXTURE_SIZE+1
- mST->setDefaultBufferSize(maxTextureSize+1, texHeight);
- EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- EXPECT_EQ(maxTextureSize+1, anb->width);
- EXPECT_EQ(texHeight, anb->height);
- EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb));
- ASSERT_NE(NO_ERROR, mST->updateTexImage());
-}
-
-/*
- * This test fixture is for testing GL -> GL texture streaming. It creates an
- * EGLSurface and an EGLContext for the image producer to use.
- */
-class SurfaceTextureGLToGLTest : public SurfaceTextureGLTest {
-protected:
- SurfaceTextureGLToGLTest():
- mProducerEglSurface(EGL_NO_SURFACE),
- mProducerEglContext(EGL_NO_CONTEXT) {
- }
-
- virtual void SetUp() {
- SurfaceTextureGLTest::SetUp();
-
- EGLConfig myConfig = {0};
- EGLint numConfigs = 0;
- EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(), &myConfig,
- 1, &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- mProducerEglSurface = eglCreateWindowSurface(mEglDisplay, myConfig,
- mANW.get(), NULL);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mProducerEglSurface);
-
- mProducerEglContext = eglCreateContext(mEglDisplay, myConfig,
- EGL_NO_CONTEXT, getContextAttribs());
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_CONTEXT, mProducerEglContext);
- }
-
- virtual void TearDown() {
- if (mProducerEglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(mEglDisplay, mProducerEglContext);
- }
- if (mProducerEglSurface != EGL_NO_SURFACE) {
- eglDestroySurface(mEglDisplay, mProducerEglSurface);
- }
- SurfaceTextureGLTest::TearDown();
- }
-
- EGLSurface mProducerEglSurface;
- EGLContext mProducerEglContext;
-};
-
-TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) {
- const int texWidth = 64;
- const int texHeight = 64;
-
- mST->setDefaultBufferSize(texWidth, texHeight);
-
- // Do the producer side of things
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // This is needed to ensure we pick up a buffer of the correct size.
- eglSwapBuffers(mEglDisplay, mProducerEglSurface);
-
- glClearColor(0.6, 0.6, 0.6, 0.6);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glEnable(GL_SCISSOR_TEST);
- glScissor(4, 4, 4, 4);
- glClearColor(1.0, 0.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glScissor(24, 48, 4, 4);
- glClearColor(0.0, 1.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glScissor(37, 17, 4, 4);
- glClearColor(0.0, 0.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- eglSwapBuffers(mEglDisplay, mProducerEglSurface);
-
- // Do the consumer side of things
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- glDisable(GL_SCISSOR_TEST);
-
- mST->updateTexImage(); // Skip the first frame, which was empty
- mST->updateTexImage();
-
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, texWidth, texHeight);
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153));
-
- EXPECT_TRUE(checkPixel( 4, 7, 255, 0, 0, 255));
- EXPECT_TRUE(checkPixel(25, 51, 0, 255, 0, 255));
- EXPECT_TRUE(checkPixel(40, 19, 0, 0, 255, 255));
- EXPECT_TRUE(checkPixel(29, 51, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel( 5, 32, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(13, 8, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(46, 3, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(30, 33, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel( 6, 52, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(55, 33, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(16, 29, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel( 1, 30, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(41, 37, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(46, 29, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel(15, 25, 153, 153, 153, 153));
- EXPECT_TRUE(checkPixel( 3, 52, 153, 153, 153, 153));
-}
-
-TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) {
- sp<GraphicBuffer> buffers[3];
-
- // This test requires async mode to run on a single thread.
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_TRUE(eglSwapInterval(mEglDisplay, 0));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- for (int i = 0; i < 3; i++) {
- // Produce a frame
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(mEglDisplay, mProducerEglSurface);
-
- // Consume a frame
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- mST->updateTexImage();
- buffers[i] = mST->getCurrentBuffer();
- }
-
- // Destroy the GL texture object to release its ref on buffers[2].
- GLuint texID = TEX_ID;
- glDeleteTextures(1, &texID);
-
- // Destroy the EGLSurface
- EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Release the ref that the SurfaceTexture has on buffers[2].
- mST->abandon();
-
- EXPECT_EQ(1, buffers[0]->getStrongCount());
- EXPECT_EQ(1, buffers[1]->getStrongCount());
-
- // Depending on how lazily the GL driver dequeues buffers, we may end up
- // with either two or three total buffers. If there are three, make sure
- // the last one was properly down-ref'd.
- if (buffers[2] != buffers[0]) {
- EXPECT_EQ(1, buffers[2]->getStrongCount());
- }
-}
-
-TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
- sp<GraphicBuffer> buffers[3];
-
- // This test requires async mode to run on a single thread.
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_TRUE(eglSwapInterval(mEglDisplay, 0));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- for (int i = 0; i < 3; i++) {
- // Produce a frame
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- glClear(GL_COLOR_BUFFER_BIT);
- EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Consume a frame
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_EQ(NO_ERROR, mST->updateTexImage());
- buffers[i] = mST->getCurrentBuffer();
- }
-
- // Abandon the SurfaceTexture, releasing the ref that the SurfaceTexture has
- // on buffers[2].
- mST->abandon();
-
- // Destroy the GL texture object to release its ref on buffers[2].
- GLuint texID = TEX_ID;
- glDeleteTextures(1, &texID);
-
- // Destroy the EGLSurface.
- EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EXPECT_EQ(1, buffers[0]->getStrongCount());
- EXPECT_EQ(1, buffers[1]->getStrongCount());
-
- // Depending on how lazily the GL driver dequeues buffers, we may end up
- // with either two or three total buffers. If there are three, make sure
- // the last one was properly down-ref'd.
- if (buffers[2] != buffers[0]) {
- EXPECT_EQ(1, buffers[2]->getStrongCount());
- }
-}
-
-TEST_F(SurfaceTextureGLToGLTest, EglSurfaceDefaultsToSynchronousMode) {
- // This test requires 3 buffers to run on a single thread.
- mST->setBufferCountServer(3);
-
- ASSERT_TRUE(mST->isSynchronousMode());
-
- for (int i = 0; i < 10; i++) {
- // Produce a frame
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- glClear(GL_COLOR_BUFFER_BIT);
- EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Consume a frame
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_EQ(NO_ERROR, mST->updateTexImage());
- }
-
- ASSERT_TRUE(mST->isSynchronousMode());
-}
-
-/*
- * This test fixture is for testing GL -> GL texture streaming from one thread
- * to another. It contains functionality to create a producer thread that will
- * perform GL rendering to an ANativeWindow that feeds frames to a
- * SurfaceTexture. Additionally it supports interlocking the producer and
- * consumer threads so that a specific sequence of calls can be
- * deterministically created by the test.
- *
- * The intended usage is as follows:
- *
- * TEST_F(...) {
- * class PT : public ProducerThread {
- * virtual void render() {
- * ...
- * swapBuffers();
- * }
- * };
- *
- * runProducerThread(new PT());
- *
- * // The order of these calls will vary from test to test and may include
- * // multiple frames and additional operations (e.g. GL rendering from the
- * // texture).
- * fc->waitForFrame();
- * mST->updateTexImage();
- * fc->finishFrame();
- * }
- *
- */
-class SurfaceTextureGLThreadToGLTest : public SurfaceTextureGLToGLTest {
-protected:
-
- // ProducerThread is an abstract base class to simplify the creation of
- // OpenGL ES frame producer threads.
- class ProducerThread : public Thread {
- public:
- virtual ~ProducerThread() {
- }
-
- void setEglObjects(EGLDisplay producerEglDisplay,
- EGLSurface producerEglSurface,
- EGLContext producerEglContext) {
- mProducerEglDisplay = producerEglDisplay;
- mProducerEglSurface = producerEglSurface;
- mProducerEglContext = producerEglContext;
- }
-
- virtual bool threadLoop() {
- eglMakeCurrent(mProducerEglDisplay, mProducerEglSurface,
- mProducerEglSurface, mProducerEglContext);
- render();
- eglMakeCurrent(mProducerEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- return false;
- }
-
- protected:
- virtual void render() = 0;
-
- void swapBuffers() {
- eglSwapBuffers(mProducerEglDisplay, mProducerEglSurface);
- }
-
- EGLDisplay mProducerEglDisplay;
- EGLSurface mProducerEglSurface;
- EGLContext mProducerEglContext;
- };
-
- // FrameCondition is a utility class for interlocking between the producer
- // and consumer threads. The FrameCondition object should be created and
- // destroyed in the consumer thread only. The consumer thread should set
- // the FrameCondition as the FrameAvailableListener of the SurfaceTexture,
- // and should call both waitForFrame and finishFrame once for each expected
- // frame.
- //
- // This interlocking relies on the fact that onFrameAvailable gets called
- // synchronously from SurfaceTexture::queueBuffer.
- class FrameCondition : public SurfaceTexture::FrameAvailableListener {
- public:
- FrameCondition():
- mFrameAvailable(false),
- mFrameFinished(false) {
- }
-
- // waitForFrame waits for the next frame to arrive. This should be
- // called from the consumer thread once for every frame expected by the
- // test.
- void waitForFrame() {
- Mutex::Autolock lock(mMutex);
- ALOGV("+waitForFrame");
- while (!mFrameAvailable) {
- mFrameAvailableCondition.wait(mMutex);
- }
- mFrameAvailable = false;
- ALOGV("-waitForFrame");
- }
-
- // Allow the producer to return from its swapBuffers call and continue
- // on to produce the next frame. This should be called by the consumer
- // thread once for every frame expected by the test.
- void finishFrame() {
- Mutex::Autolock lock(mMutex);
- ALOGV("+finishFrame");
- mFrameFinished = true;
- mFrameFinishCondition.signal();
- ALOGV("-finishFrame");
- }
-
- // This should be called by SurfaceTexture on the producer thread.
- virtual void onFrameAvailable() {
- Mutex::Autolock lock(mMutex);
- ALOGV("+onFrameAvailable");
- mFrameAvailable = true;
- mFrameAvailableCondition.signal();
- while (!mFrameFinished) {
- mFrameFinishCondition.wait(mMutex);
- }
- mFrameFinished = false;
- ALOGV("-onFrameAvailable");
- }
-
- protected:
- bool mFrameAvailable;
- bool mFrameFinished;
-
- Mutex mMutex;
- Condition mFrameAvailableCondition;
- Condition mFrameFinishCondition;
- };
-
- virtual void SetUp() {
- SurfaceTextureGLToGLTest::SetUp();
- mFC = new FrameCondition();
- mST->setFrameAvailableListener(mFC);
- }
-
- virtual void TearDown() {
- if (mProducerThread != NULL) {
- mProducerThread->requestExitAndWait();
- }
- mProducerThread.clear();
- mFC.clear();
- SurfaceTextureGLToGLTest::TearDown();
- }
-
- void runProducerThread(const sp<ProducerThread> producerThread) {
- ASSERT_TRUE(mProducerThread == NULL);
- mProducerThread = producerThread;
- producerThread->setEglObjects(mEglDisplay, mProducerEglSurface,
- mProducerEglContext);
- producerThread->run();
- }
-
- sp<ProducerThread> mProducerThread;
- sp<FrameCondition> mFC;
-};
-
-TEST_F(SurfaceTextureGLThreadToGLTest,
- UpdateTexImageBeforeFrameFinishedCompletes) {
- class PT : public ProducerThread {
- virtual void render() {
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- swapBuffers();
- }
- };
-
- runProducerThread(new PT());
-
- mFC->waitForFrame();
- mST->updateTexImage();
- mFC->finishFrame();
-
- // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
-}
-
-TEST_F(SurfaceTextureGLThreadToGLTest,
- UpdateTexImageAfterFrameFinishedCompletes) {
- class PT : public ProducerThread {
- virtual void render() {
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- swapBuffers();
- }
- };
-
- runProducerThread(new PT());
-
- mFC->waitForFrame();
- mFC->finishFrame();
- mST->updateTexImage();
-
- // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
-}
-
-TEST_F(SurfaceTextureGLThreadToGLTest,
- RepeatedUpdateTexImageBeforeFrameFinishedCompletes) {
- enum { NUM_ITERATIONS = 1024 };
-
- class PT : public ProducerThread {
- virtual void render() {
- for (int i = 0; i < NUM_ITERATIONS; i++) {
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- ALOGV("+swapBuffers");
- swapBuffers();
- ALOGV("-swapBuffers");
- }
- }
- };
-
- runProducerThread(new PT());
-
- for (int i = 0; i < NUM_ITERATIONS; i++) {
- mFC->waitForFrame();
- ALOGV("+updateTexImage");
- mST->updateTexImage();
- ALOGV("-updateTexImage");
- mFC->finishFrame();
-
- // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
- }
-}
-
-TEST_F(SurfaceTextureGLThreadToGLTest,
- RepeatedUpdateTexImageAfterFrameFinishedCompletes) {
- enum { NUM_ITERATIONS = 1024 };
-
- class PT : public ProducerThread {
- virtual void render() {
- for (int i = 0; i < NUM_ITERATIONS; i++) {
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- ALOGV("+swapBuffers");
- swapBuffers();
- ALOGV("-swapBuffers");
- }
- }
- };
-
- runProducerThread(new PT());
-
- for (int i = 0; i < NUM_ITERATIONS; i++) {
- mFC->waitForFrame();
- mFC->finishFrame();
- ALOGV("+updateTexImage");
- mST->updateTexImage();
- ALOGV("-updateTexImage");
-
- // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
- }
-}
-
-// XXX: This test is disabled because it is currently hanging on some devices.
-TEST_F(SurfaceTextureGLThreadToGLTest,
- DISABLED_RepeatedSwapBuffersWhileDequeueStalledCompletes) {
- enum { NUM_ITERATIONS = 64 };
-
- class PT : public ProducerThread {
- virtual void render() {
- for (int i = 0; i < NUM_ITERATIONS; i++) {
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- ALOGV("+swapBuffers");
- swapBuffers();
- ALOGV("-swapBuffers");
- }
- }
- };
-
- ASSERT_EQ(OK, mST->setSynchronousMode(true));
- ASSERT_EQ(OK, mST->setBufferCountServer(2));
-
- runProducerThread(new PT());
-
- // Allow three frames to be rendered and queued before starting the
- // rendering in this thread. For the latter two frames we don't call
- // updateTexImage so the next dequeue from the producer thread will block
- // waiting for a frame to become available.
- mFC->waitForFrame();
- mFC->finishFrame();
-
- // We must call updateTexImage to consume the first frame so that the
- // SurfaceTexture is able to reduce the buffer count to 2. This is because
- // the GL driver may dequeue a buffer when the EGLSurface is created, and
- // that happens before we call setBufferCountServer. It's possible that the
- // driver does not dequeue a buffer at EGLSurface creation time, so we
- // cannot rely on this to cause the second dequeueBuffer call to block.
- mST->updateTexImage();
-
- mFC->waitForFrame();
- mFC->finishFrame();
- mFC->waitForFrame();
- mFC->finishFrame();
-
- // Sleep for 100ms to allow the producer thread's dequeueBuffer call to
- // block waiting for a buffer to become available.
- usleep(100000);
-
- // Render and present a number of images. This thread should not be blocked
- // by the fact that the producer thread is blocking in dequeue.
- for (int i = 0; i < NUM_ITERATIONS; i++) {
- glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(mEglDisplay, mEglSurface);
- }
-
- // Consume the two pending buffers to unblock the producer thread.
- mST->updateTexImage();
- mST->updateTexImage();
-
- // Consume the remaining buffers from the producer thread.
- for (int i = 0; i < NUM_ITERATIONS-3; i++) {
- mFC->waitForFrame();
- mFC->finishFrame();
- ALOGV("+updateTexImage");
- mST->updateTexImage();
- ALOGV("-updateTexImage");
- }
-}
-
-class SurfaceTextureFBOTest : public SurfaceTextureGLTest {
-protected:
-
- virtual void SetUp() {
- SurfaceTextureGLTest::SetUp();
-
- glGenFramebuffers(1, &mFbo);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
-
- glGenTextures(1, &mFboTex);
- glBindTexture(GL_TEXTURE_2D, mFboTex);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getSurfaceWidth(),
- getSurfaceHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glBindTexture(GL_TEXTURE_2D, 0);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
-
- glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, mFboTex, 0);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- }
-
- virtual void TearDown() {
- SurfaceTextureGLTest::TearDown();
-
- glDeleteTextures(1, &mFboTex);
- glDeleteFramebuffers(1, &mFbo);
- }
-
- GLuint mFbo;
- GLuint mFboTex;
-};
-
-// This test is intended to verify that proper synchronization is done when
-// rendering into an FBO.
-TEST_F(SurfaceTextureFBOTest, BlitFromCpuFilledBufferToFbo) {
- const int texWidth = 64;
- const int texHeight = 64;
-
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
- texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
- ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
-
- android_native_buffer_t* anb;
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
-
- // Fill the buffer with green
- uint8_t* img = NULL;
- buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 0, 255,
- 0, 255);
- buf->unlock();
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
-
- ASSERT_EQ(NO_ERROR, mST->updateTexImage());
-
- glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
- drawTexture();
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
- for (int i = 0; i < 4; i++) {
- SCOPED_TRACE(String8::format("frame %d", i).string());
-
- ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
- ASSERT_TRUE(anb != NULL);
-
- buf = new GraphicBuffer(anb, false);
- ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(),
- buf->getNativeBuffer()));
-
- // Fill the buffer with red
- ASSERT_EQ(NO_ERROR, buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN,
- (void**)(&img)));
- fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 255, 0,
- 0, 255);
- ASSERT_EQ(NO_ERROR, buf->unlock());
- ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(),
- buf->getNativeBuffer()));
-
- ASSERT_EQ(NO_ERROR, mST->updateTexImage());
-
- drawTexture();
-
- EXPECT_TRUE(checkPixel( 24, 39, 255, 0, 0, 255));
- }
-
- glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
-
- EXPECT_TRUE(checkPixel( 24, 39, 0, 255, 0, 255));
-}
-
-} // namespace android
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
deleted file mode 100644
index b585d68..0000000
--- a/libs/gui/tests/Surface_test.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <binder/IMemory.h>
-#include <gui/ISurfaceComposer.h>
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-#include <utils/String8.h>
-
-#include <private/gui/ComposerService.h>
-
-namespace android {
-
-class SurfaceTest : public ::testing::Test {
-protected:
- virtual void SetUp() {
- mComposerClient = new SurfaceComposerClient;
- ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
-
- mSurfaceControl = mComposerClient->createSurface(
- String8("Test Surface"), 0, 32, 32, PIXEL_FORMAT_RGBA_8888, 0);
-
- ASSERT_TRUE(mSurfaceControl != NULL);
- ASSERT_TRUE(mSurfaceControl->isValid());
-
- SurfaceComposerClient::openGlobalTransaction();
- ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(0x7fffffff));
- ASSERT_EQ(NO_ERROR, mSurfaceControl->show());
- SurfaceComposerClient::closeGlobalTransaction();
-
- mSurface = mSurfaceControl->getSurface();
- ASSERT_TRUE(mSurface != NULL);
- }
-
- virtual void TearDown() {
- mComposerClient->dispose();
- }
-
- sp<Surface> mSurface;
- sp<SurfaceComposerClient> mComposerClient;
- sp<SurfaceControl> mSurfaceControl;
-};
-
-TEST_F(SurfaceTest, QueuesToWindowComposerIsTrueWhenVisible) {
- sp<ANativeWindow> anw(mSurface);
- int result = -123;
- int err = anw->query(anw.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
- &result);
- EXPECT_EQ(NO_ERROR, err);
- EXPECT_EQ(1, result);
-}
-
-TEST_F(SurfaceTest, QueuesToWindowComposerIsTrueWhenPurgatorized) {
- mSurfaceControl.clear();
-
- sp<ANativeWindow> anw(mSurface);
- int result = -123;
- int err = anw->query(anw.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
- &result);
- EXPECT_EQ(NO_ERROR, err);
- EXPECT_EQ(1, result);
-}
-
-// This test probably doesn't belong here.
-TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersSucceed) {
- sp<ANativeWindow> anw(mSurface);
-
- // Verify the screenshot works with no protected buffers.
- sp<IMemoryHeap> heap;
- uint32_t w=0, h=0;
- PixelFormat fmt=0;
- sp<ISurfaceComposer> sf(ComposerService::getComposerService());
- ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt, 64, 64, 0,
- 0x7fffffff));
- ASSERT_TRUE(heap != NULL);
-
- // Set the PROTECTED usage bit and verify that the screenshot fails. Note
- // that we need to dequeue a buffer in order for it to actually get
- // allocated in SurfaceFlinger.
- ASSERT_EQ(NO_ERROR, native_window_set_usage(anw.get(),
- GRALLOC_USAGE_PROTECTED));
- ASSERT_EQ(NO_ERROR, native_window_set_buffer_count(anw.get(), 3));
- ANativeWindowBuffer* buf = 0;
-
- status_t err = anw->dequeueBuffer(anw.get(), &buf);
- if (err) {
- // we could fail if GRALLOC_USAGE_PROTECTED is not supported.
- // that's okay as long as this is the reason for the failure.
- // try again without the GRALLOC_USAGE_PROTECTED bit.
- ASSERT_EQ(NO_ERROR, native_window_set_usage(anw.get(), 0));
- ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf));
- return;
- }
- ASSERT_EQ(NO_ERROR, anw->cancelBuffer(anw.get(), buf));
-
- for (int i = 0; i < 4; i++) {
- // Loop to make sure SurfaceFlinger has retired a protected buffer.
- ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf));
- ASSERT_EQ(NO_ERROR, anw->lockBuffer(anw.get(), buf));
- ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf));
- }
- heap = 0;
- w = h = fmt = 0;
- ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt,
- 64, 64, 0, 0x7fffffff));
- ASSERT_TRUE(heap != NULL);
-}
-
-TEST_F(SurfaceTest, ConcreteTypeIsSurface) {
- sp<ANativeWindow> anw(mSurface);
- int result = -123;
- int err = anw->query(anw.get(), NATIVE_WINDOW_CONCRETE_TYPE, &result);
- EXPECT_EQ(NO_ERROR, err);
- EXPECT_EQ(NATIVE_WINDOW_SURFACE, result);
-}
-
-}
diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk
deleted file mode 100644
index 5aff7a4..0000000
--- a/libs/ui/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2010 The Android Open Source Project
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- FramebufferNativeWindow.cpp \
- GraphicBuffer.cpp \
- GraphicBufferAllocator.cpp \
- GraphicBufferMapper.cpp \
- PixelFormat.cpp \
- Rect.cpp \
- Region.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libhardware
-
-ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),)
-LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT)
-endif
-
-LOCAL_MODULE:= libui
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
deleted file mode 100644
index dec99b6..0000000
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
-**
-** Copyright 2007 The Android Open Source Project
-**
-** 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.
-*/
-
-#define LOG_TAG "FramebufferNativeWindow"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <utils/threads.h>
-#include <utils/RefBase.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/Rect.h>
-
-#include <EGL/egl.h>
-
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class NativeBuffer
- : public ANativeObjectBase<
- ANativeWindowBuffer,
- NativeBuffer,
- LightRefBase<NativeBuffer> >
-{
-public:
- NativeBuffer(int w, int h, int f, int u) : BASE() {
- ANativeWindowBuffer::width = w;
- ANativeWindowBuffer::height = h;
- ANativeWindowBuffer::format = f;
- ANativeWindowBuffer::usage = u;
- }
-private:
- friend class LightRefBase<NativeBuffer>;
- ~NativeBuffer() { }; // this class cannot be overloaded
-};
-
-
-/*
- * This implements the (main) framebuffer management. This class is used
- * mostly by SurfaceFlinger, but also by command line GL application.
- *
- * In fact this is an implementation of ANativeWindow on top of
- * the framebuffer.
- *
- * Currently it is pretty simple, it manages only two buffers (the front and
- * back buffer).
- *
- */
-
-FramebufferNativeWindow::FramebufferNativeWindow()
- : BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false)
-{
- hw_module_t const* module;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) {
- int stride;
- int err;
- int i;
- err = framebuffer_open(module, &fbDev);
- ALOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err));
-
- err = gralloc_open(module, &grDev);
- ALOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err));
-
- // bail out if we can't initialize the modules
- if (!fbDev || !grDev)
- return;
-
- mUpdateOnDemand = (fbDev->setUpdateRect != 0);
-
- // initialize the buffer FIFO
- mNumBuffers = NUM_FRAME_BUFFERS;
- mNumFreeBuffers = NUM_FRAME_BUFFERS;
- mBufferHead = mNumBuffers-1;
-
- /*
- * This does not actually change the framebuffer format. It merely
- * fakes this format to surfaceflinger so that when it creates
- * framebuffer surfaces it will use this format. It's really a giant
- * HACK to allow interworking with buggy gralloc+GPU driver
- * implementations. You should *NEVER* need to set this for shipping
- * devices.
- */
-#ifdef FRAMEBUFFER_FORCE_FORMAT
- *((uint32_t *)&fbDev->format) = FRAMEBUFFER_FORCE_FORMAT;
-#endif
-
- for (i = 0; i < mNumBuffers; i++)
- {
- buffers[i] = new NativeBuffer(
- fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB);
- }
-
- for (i = 0; i < mNumBuffers; i++)
- {
- err = grDev->alloc(grDev,
- fbDev->width, fbDev->height, fbDev->format,
- GRALLOC_USAGE_HW_FB, &buffers[i]->handle, &buffers[i]->stride);
-
- ALOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s",
- i, fbDev->width, fbDev->height, strerror(-err));
-
- if (err)
- {
- mNumBuffers = i;
- mNumFreeBuffers = i;
- mBufferHead = mNumBuffers-1;
- break;
- }
- }
-
- const_cast<uint32_t&>(ANativeWindow::flags) = fbDev->flags;
- const_cast<float&>(ANativeWindow::xdpi) = fbDev->xdpi;
- const_cast<float&>(ANativeWindow::ydpi) = fbDev->ydpi;
- const_cast<int&>(ANativeWindow::minSwapInterval) =
- fbDev->minSwapInterval;
- const_cast<int&>(ANativeWindow::maxSwapInterval) =
- fbDev->maxSwapInterval;
- } else {
- ALOGE("Couldn't get gralloc module");
- }
-
- ANativeWindow::setSwapInterval = setSwapInterval;
- ANativeWindow::dequeueBuffer = dequeueBuffer;
- ANativeWindow::lockBuffer = lockBuffer;
- ANativeWindow::queueBuffer = queueBuffer;
- ANativeWindow::query = query;
- ANativeWindow::perform = perform;
-}
-
-FramebufferNativeWindow::~FramebufferNativeWindow()
-{
- if (grDev) {
- if (buffers[0] != NULL)
- grDev->free(grDev, buffers[0]->handle);
- if (buffers[1] != NULL)
- grDev->free(grDev, buffers[1]->handle);
- gralloc_close(grDev);
- }
-
- if (fbDev) {
- framebuffer_close(fbDev);
- }
-}
-
-status_t FramebufferNativeWindow::setUpdateRectangle(const Rect& r)
-{
- if (!mUpdateOnDemand) {
- return INVALID_OPERATION;
- }
- return fbDev->setUpdateRect(fbDev, r.left, r.top, r.width(), r.height());
-}
-
-status_t FramebufferNativeWindow::compositionComplete()
-{
- if (fbDev->compositionComplete) {
- return fbDev->compositionComplete(fbDev);
- }
- return INVALID_OPERATION;
-}
-
-int FramebufferNativeWindow::setSwapInterval(
- ANativeWindow* window, int interval)
-{
- framebuffer_device_t* fb = getSelf(window)->fbDev;
- return fb->setSwapInterval(fb, interval);
-}
-
-void FramebufferNativeWindow::dump(String8& result) {
- if (fbDev->common.version >= 1 && fbDev->dump) {
- const size_t SIZE = 4096;
- char buffer[SIZE];
-
- fbDev->dump(fbDev, buffer, SIZE);
- result.append(buffer);
- }
-}
-
-// only for debugging / logging
-int FramebufferNativeWindow::getCurrentBufferIndex() const
-{
- Mutex::Autolock _l(mutex);
- const int index = mCurrentBufferIndex;
- return index;
-}
-
-int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window,
- ANativeWindowBuffer** buffer)
-{
- FramebufferNativeWindow* self = getSelf(window);
- Mutex::Autolock _l(self->mutex);
- framebuffer_device_t* fb = self->fbDev;
-
- int index = self->mBufferHead++;
- if (self->mBufferHead >= self->mNumBuffers)
- self->mBufferHead = 0;
-
- // wait for a free buffer
- while (!self->mNumFreeBuffers) {
- self->mCondition.wait(self->mutex);
- }
- // get this buffer
- self->mNumFreeBuffers--;
- self->mCurrentBufferIndex = index;
-
- *buffer = self->buffers[index].get();
-
- return 0;
-}
-
-int FramebufferNativeWindow::lockBuffer(ANativeWindow* window,
- ANativeWindowBuffer* buffer)
-{
- FramebufferNativeWindow* self = getSelf(window);
- Mutex::Autolock _l(self->mutex);
-
- const int index = self->mCurrentBufferIndex;
-
- // wait that the buffer we're locking is not front anymore
- while (self->front == buffer) {
- self->mCondition.wait(self->mutex);
- }
-
- return NO_ERROR;
-}
-
-int FramebufferNativeWindow::queueBuffer(ANativeWindow* window,
- ANativeWindowBuffer* buffer)
-{
- FramebufferNativeWindow* self = getSelf(window);
- Mutex::Autolock _l(self->mutex);
- framebuffer_device_t* fb = self->fbDev;
- buffer_handle_t handle = static_cast<NativeBuffer*>(buffer)->handle;
-
- const int index = self->mCurrentBufferIndex;
- int res = fb->post(fb, handle);
- self->front = static_cast<NativeBuffer*>(buffer);
- self->mNumFreeBuffers++;
- self->mCondition.broadcast();
- return res;
-}
-
-int FramebufferNativeWindow::query(const ANativeWindow* window,
- int what, int* value)
-{
- const FramebufferNativeWindow* self = getSelf(window);
- Mutex::Autolock _l(self->mutex);
- framebuffer_device_t* fb = self->fbDev;
- switch (what) {
- case NATIVE_WINDOW_WIDTH:
- *value = fb->width;
- return NO_ERROR;
- case NATIVE_WINDOW_HEIGHT:
- *value = fb->height;
- return NO_ERROR;
- case NATIVE_WINDOW_FORMAT:
- *value = fb->format;
- return NO_ERROR;
- case NATIVE_WINDOW_CONCRETE_TYPE:
- *value = NATIVE_WINDOW_FRAMEBUFFER;
- return NO_ERROR;
- case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
- *value = 0;
- return NO_ERROR;
- case NATIVE_WINDOW_DEFAULT_WIDTH:
- *value = fb->width;
- return NO_ERROR;
- case NATIVE_WINDOW_DEFAULT_HEIGHT:
- *value = fb->height;
- return NO_ERROR;
- case NATIVE_WINDOW_TRANSFORM_HINT:
- *value = 0;
- return NO_ERROR;
- }
- *value = 0;
- return BAD_VALUE;
-}
-
-int FramebufferNativeWindow::perform(ANativeWindow* window,
- int operation, ...)
-{
- switch (operation) {
- case NATIVE_WINDOW_CONNECT:
- case NATIVE_WINDOW_DISCONNECT:
- case NATIVE_WINDOW_SET_USAGE:
- case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY:
- case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS:
- case NATIVE_WINDOW_SET_BUFFERS_FORMAT:
- case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
- case NATIVE_WINDOW_API_CONNECT:
- case NATIVE_WINDOW_API_DISCONNECT:
- // TODO: we should implement these
- return NO_ERROR;
-
- case NATIVE_WINDOW_LOCK:
- case NATIVE_WINDOW_UNLOCK_AND_POST:
- case NATIVE_WINDOW_SET_CROP:
- case NATIVE_WINDOW_SET_BUFFER_COUNT:
- case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP:
- case NATIVE_WINDOW_SET_SCALING_MODE:
- return INVALID_OPERATION;
- }
- return NAME_NOT_FOUND;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-EGLNativeWindowType android_createDisplaySurface(void)
-{
- FramebufferNativeWindow* w;
- w = new FramebufferNativeWindow();
- if (w->getDevice() == NULL) {
- // get a ref so it can be destroyed when we exit this block
- sp<FramebufferNativeWindow> ref(w);
- return NULL;
- }
- return (EGLNativeWindowType)w;
-}
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
deleted file mode 100644
index 57063e5..0000000
--- a/libs/ui/GraphicBuffer.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "GraphicBuffer"
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-
-#include <ui/GraphicBuffer.h>
-#include <ui/GraphicBufferAllocator.h>
-#include <ui/GraphicBufferMapper.h>
-#include <ui/PixelFormat.h>
-
-namespace android {
-
-// ===========================================================================
-// Buffer and implementation of ANativeWindowBuffer
-// ===========================================================================
-
-GraphicBuffer::GraphicBuffer()
- : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
- mInitCheck(NO_ERROR), mIndex(-1)
-{
- width =
- height =
- stride =
- format =
- usage = 0;
- handle = NULL;
-}
-
-GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat reqFormat, uint32_t reqUsage)
- : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
- mInitCheck(NO_ERROR), mIndex(-1)
-{
- width =
- height =
- stride =
- format =
- usage = 0;
- handle = NULL;
- mInitCheck = initSize(w, h, reqFormat, reqUsage);
-}
-
-GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat inFormat, uint32_t inUsage,
- uint32_t inStride, native_handle_t* inHandle, bool keepOwnership)
- : BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
- mBufferMapper(GraphicBufferMapper::get()),
- mInitCheck(NO_ERROR), mIndex(-1)
-{
- width = w;
- height = h;
- stride = inStride;
- format = inFormat;
- usage = inUsage;
- handle = inHandle;
-}
-
-GraphicBuffer::GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership)
- : BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
- mBufferMapper(GraphicBufferMapper::get()),
- mInitCheck(NO_ERROR), mIndex(-1), mWrappedBuffer(buffer)
-{
- width = buffer->width;
- height = buffer->height;
- stride = buffer->stride;
- format = buffer->format;
- usage = buffer->usage;
- handle = buffer->handle;
-}
-
-GraphicBuffer::~GraphicBuffer()
-{
- if (handle) {
- free_handle();
- }
-}
-
-void GraphicBuffer::free_handle()
-{
- if (mOwner == ownHandle) {
- mBufferMapper.unregisterBuffer(handle);
- native_handle_close(handle);
- native_handle_delete(const_cast<native_handle*>(handle));
- } else if (mOwner == ownData) {
- GraphicBufferAllocator& allocator(GraphicBufferAllocator::get());
- allocator.free(handle);
- }
- mWrappedBuffer = 0;
-}
-
-status_t GraphicBuffer::initCheck() const {
- return mInitCheck;
-}
-
-void GraphicBuffer::dumpAllocationsToSystemLog()
-{
- GraphicBufferAllocator::dumpToSystemLog();
-}
-
-ANativeWindowBuffer* GraphicBuffer::getNativeBuffer() const
-{
- return static_cast<ANativeWindowBuffer*>(
- const_cast<GraphicBuffer*>(this));
-}
-
-status_t GraphicBuffer::reallocate(uint32_t w, uint32_t h, PixelFormat f,
- uint32_t reqUsage)
-{
- if (mOwner != ownData)
- return INVALID_OPERATION;
-
- if (handle && w==width && h==height && f==format && reqUsage==usage)
- return NO_ERROR;
-
- if (handle) {
- GraphicBufferAllocator& allocator(GraphicBufferAllocator::get());
- allocator.free(handle);
- handle = 0;
- }
- return initSize(w, h, f, reqUsage);
-}
-
-status_t GraphicBuffer::initSize(uint32_t w, uint32_t h, PixelFormat format,
- uint32_t reqUsage)
-{
- GraphicBufferAllocator& allocator = GraphicBufferAllocator::get();
- status_t err = allocator.alloc(w, h, format, reqUsage, &handle, &stride);
- if (err == NO_ERROR) {
- this->width = w;
- this->height = h;
- this->format = format;
- this->usage = reqUsage;
- }
- return err;
-}
-
-status_t GraphicBuffer::lock(uint32_t usage, void** vaddr)
-{
- const Rect lockBounds(width, height);
- status_t res = lock(usage, lockBounds, vaddr);
- return res;
-}
-
-status_t GraphicBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr)
-{
- if (rect.left < 0 || rect.right > this->width ||
- rect.top < 0 || rect.bottom > this->height) {
- ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
- rect.left, rect.top, rect.right, rect.bottom,
- this->width, this->height);
- return BAD_VALUE;
- }
- status_t res = getBufferMapper().lock(handle, usage, rect, vaddr);
- return res;
-}
-
-status_t GraphicBuffer::unlock()
-{
- status_t res = getBufferMapper().unlock(handle);
- return res;
-}
-
-size_t GraphicBuffer::getFlattenedSize() const {
- return (8 + (handle ? handle->numInts : 0))*sizeof(int);
-}
-
-size_t GraphicBuffer::getFdCount() const {
- return handle ? handle->numFds : 0;
-}
-
-status_t GraphicBuffer::flatten(void* buffer, size_t size,
- int fds[], size_t count) const
-{
- size_t sizeNeeded = GraphicBuffer::getFlattenedSize();
- if (size < sizeNeeded) return NO_MEMORY;
-
- size_t fdCountNeeded = GraphicBuffer::getFdCount();
- if (count < fdCountNeeded) return NO_MEMORY;
-
- int* buf = static_cast<int*>(buffer);
- buf[0] = 'GBFR';
- buf[1] = width;
- buf[2] = height;
- buf[3] = stride;
- buf[4] = format;
- buf[5] = usage;
- buf[6] = 0;
- buf[7] = 0;
-
- if (handle) {
- buf[6] = handle->numFds;
- buf[7] = handle->numInts;
- native_handle_t const* const h = handle;
- memcpy(fds, h->data, h->numFds*sizeof(int));
- memcpy(&buf[8], h->data + h->numFds, h->numInts*sizeof(int));
- }
-
- return NO_ERROR;
-}
-
-status_t GraphicBuffer::unflatten(void const* buffer, size_t size,
- int fds[], size_t count)
-{
- if (size < 8*sizeof(int)) return NO_MEMORY;
-
- int const* buf = static_cast<int const*>(buffer);
- if (buf[0] != 'GBFR') return BAD_TYPE;
-
- const size_t numFds = buf[6];
- const size_t numInts = buf[7];
-
- const size_t sizeNeeded = (8 + numInts) * sizeof(int);
- if (size < sizeNeeded) return NO_MEMORY;
-
- size_t fdCountNeeded = 0;
- if (count < fdCountNeeded) return NO_MEMORY;
-
- if (handle) {
- // free previous handle if any
- free_handle();
- }
-
- if (numFds || numInts) {
- width = buf[1];
- height = buf[2];
- stride = buf[3];
- format = buf[4];
- usage = buf[5];
- native_handle* h = native_handle_create(numFds, numInts);
- memcpy(h->data, fds, numFds*sizeof(int));
- memcpy(h->data + numFds, &buf[8], numInts*sizeof(int));
- handle = h;
- } else {
- width = height = stride = format = usage = 0;
- handle = NULL;
- }
-
- mOwner = ownHandle;
-
- if (handle != 0) {
- mBufferMapper.registerBuffer(handle);
- }
-
- return NO_ERROR;
-}
-
-
-void GraphicBuffer::setIndex(int index) {
- mIndex = index;
-}
-
-int GraphicBuffer::getIndex() const {
- return mIndex;
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
deleted file mode 100644
index ff550d9..0000000
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-#define LOG_TAG "GraphicBufferAllocator"
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#include <cutils/log.h>
-
-#include <utils/Singleton.h>
-#include <utils/String8.h>
-#include <utils/Trace.h>
-
-#include <ui/GraphicBufferAllocator.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-ANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferAllocator )
-
-Mutex GraphicBufferAllocator::sLock;
-KeyedVector<buffer_handle_t,
- GraphicBufferAllocator::alloc_rec_t> GraphicBufferAllocator::sAllocList;
-
-GraphicBufferAllocator::GraphicBufferAllocator()
- : mAllocDev(0)
-{
- hw_module_t const* module;
- int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
- ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
- if (err == 0) {
- gralloc_open(module, &mAllocDev);
- }
-}
-
-GraphicBufferAllocator::~GraphicBufferAllocator()
-{
- gralloc_close(mAllocDev);
-}
-
-void GraphicBufferAllocator::dump(String8& result) const
-{
- Mutex::Autolock _l(sLock);
- KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
- size_t total = 0;
- const size_t SIZE = 4096;
- char buffer[SIZE];
- snprintf(buffer, SIZE, "Allocated buffers:\n");
- result.append(buffer);
- const size_t c = list.size();
- for (size_t i=0 ; i<c ; i++) {
- const alloc_rec_t& rec(list.valueAt(i));
- if (rec.size) {
- snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %8X | 0x%08x\n",
- list.keyAt(i), rec.size/1024.0f,
- rec.w, rec.s, rec.h, rec.format, rec.usage);
- } else {
- snprintf(buffer, SIZE, "%10p: unknown | %4u (%4u) x %4u | %8X | 0x%08x\n",
- list.keyAt(i),
- rec.w, rec.s, rec.h, rec.format, rec.usage);
- }
- result.append(buffer);
- total += rec.size;
- }
- snprintf(buffer, SIZE, "Total allocated (estimate): %.2f KB\n", total/1024.0f);
- result.append(buffer);
- if (mAllocDev->common.version >= 1 && mAllocDev->dump) {
- mAllocDev->dump(mAllocDev, buffer, SIZE);
- result.append(buffer);
- }
-}
-
-void GraphicBufferAllocator::dumpToSystemLog()
-{
- String8 s;
- GraphicBufferAllocator::getInstance().dump(s);
- ALOGD("%s", s.string());
-}
-
-status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format,
- int usage, buffer_handle_t* handle, int32_t* stride)
-{
- ATRACE_CALL();
- // make sure to not allocate a N x 0 or 0 x N buffer, since this is
- // allowed from an API stand-point allocate a 1x1 buffer instead.
- if (!w || !h)
- w = h = 1;
-
- // we have a h/w allocator and h/w buffer is requested
- status_t err;
-
- err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);
-
- ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
- w, h, format, usage, err, strerror(-err));
-
- if (err == NO_ERROR) {
- Mutex::Autolock _l(sLock);
- KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
- int bpp = bytesPerPixel(format);
- if (bpp < 0) {
- // probably a HAL custom format. in any case, we don't know
- // what its pixel size is.
- bpp = 0;
- }
- alloc_rec_t rec;
- rec.w = w;
- rec.h = h;
- rec.s = *stride;
- rec.format = format;
- rec.usage = usage;
- rec.size = h * stride[0] * bpp;
- list.add(*handle, rec);
- }
-
- return err;
-}
-
-status_t GraphicBufferAllocator::free(buffer_handle_t handle)
-{
- ATRACE_CALL();
- status_t err;
-
- err = mAllocDev->free(mAllocDev, handle);
-
- ALOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err));
- if (err == NO_ERROR) {
- Mutex::Autolock _l(sLock);
- KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
- list.removeItem(handle);
- }
-
- return err;
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
deleted file mode 100644
index 967da98..0000000
--- a/libs/ui/GraphicBufferMapper.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "GraphicBufferMapper"
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#include <stdint.h>
-#include <errno.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <utils/Trace.h>
-
-#include <ui/GraphicBufferMapper.h>
-#include <ui/Rect.h>
-
-#include <hardware/gralloc.h>
-
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-ANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferMapper )
-
-GraphicBufferMapper::GraphicBufferMapper()
- : mAllocMod(0)
-{
- hw_module_t const* module;
- int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
- ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
- if (err == 0) {
- mAllocMod = (gralloc_module_t const *)module;
- }
-}
-
-status_t GraphicBufferMapper::registerBuffer(buffer_handle_t handle)
-{
- ATRACE_CALL();
- status_t err;
-
- err = mAllocMod->registerBuffer(mAllocMod, handle);
-
- ALOGW_IF(err, "registerBuffer(%p) failed %d (%s)",
- handle, err, strerror(-err));
- return err;
-}
-
-status_t GraphicBufferMapper::unregisterBuffer(buffer_handle_t handle)
-{
- ATRACE_CALL();
- status_t err;
-
- err = mAllocMod->unregisterBuffer(mAllocMod, handle);
-
- ALOGW_IF(err, "unregisterBuffer(%p) failed %d (%s)",
- handle, err, strerror(-err));
- return err;
-}
-
-status_t GraphicBufferMapper::lock(buffer_handle_t handle,
- int usage, const Rect& bounds, void** vaddr)
-{
- ATRACE_CALL();
- status_t err;
-
- err = mAllocMod->lock(mAllocMod, handle, usage,
- bounds.left, bounds.top, bounds.width(), bounds.height(),
- vaddr);
-
- ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));
- return err;
-}
-
-status_t GraphicBufferMapper::unlock(buffer_handle_t handle)
-{
- ATRACE_CALL();
- status_t err;
-
- err = mAllocMod->unlock(mAllocMod, handle);
-
- ALOGW_IF(err, "unlock(...) failed %d (%s)", err, strerror(-err));
- return err;
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/libs/ui/MODULE_LICENSE_APACHE2 b/libs/ui/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libs/ui/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libs/ui/NOTICE b/libs/ui/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/libs/ui/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/libs/ui/PixelFormat.cpp b/libs/ui/PixelFormat.cpp
deleted file mode 100644
index fc1d3c2..0000000
--- a/libs/ui/PixelFormat.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <ui/PixelFormat.h>
-#include <hardware/hardware.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-static const int COMPONENT_YUV = 0xFF;
-
-struct Info {
- size_t size;
- size_t bitsPerPixel;
- struct {
- uint8_t ah;
- uint8_t al;
- uint8_t rh;
- uint8_t rl;
- uint8_t gh;
- uint8_t gl;
- uint8_t bh;
- uint8_t bl;
- };
- uint8_t components;
-};
-
-static Info const sPixelFormatInfos[] = {
- { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0 },
- { 4, 32, {32,24, 8, 0, 16, 8, 24,16 }, PixelFormatInfo::RGBA },
- { 4, 24, { 0, 0, 8, 0, 16, 8, 24,16 }, PixelFormatInfo::RGB },
- { 3, 24, { 0, 0, 8, 0, 16, 8, 24,16 }, PixelFormatInfo::RGB },
- { 2, 16, { 0, 0, 16,11, 11, 5, 5, 0 }, PixelFormatInfo::RGB },
- { 4, 32, {32,24, 24,16, 16, 8, 8, 0 }, PixelFormatInfo::RGBA },
- { 2, 16, { 1, 0, 16,11, 11, 6, 6, 1 }, PixelFormatInfo::RGBA },
- { 2, 16, { 4, 0, 16,12, 12, 8, 8, 4 }, PixelFormatInfo::RGBA },
- { 1, 8, { 8, 0, 0, 0, 0, 0, 0, 0 }, PixelFormatInfo::ALPHA},
- { 1, 8, { 0, 0, 8, 0, 8, 0, 8, 0 }, PixelFormatInfo::L },
- { 2, 16, {16, 8, 8, 0, 8, 0, 8, 0 }, PixelFormatInfo::LA },
- { 1, 8, { 0, 0, 8, 5, 5, 2, 2, 0 }, PixelFormatInfo::RGB },
-};
-
-static const Info* gGetPixelFormatTable(size_t* numEntries) {
- if (numEntries) {
- *numEntries = sizeof(sPixelFormatInfos)/sizeof(Info);
- }
- return sPixelFormatInfos;
-}
-
-// ----------------------------------------------------------------------------
-
-size_t PixelFormatInfo::getScanlineSize(unsigned int width) const
-{
- size_t size;
- if (components == COMPONENT_YUV) {
- // YCbCr formats are different.
- size = (width * bitsPerPixel)>>3;
- } else {
- size = width * bytesPerPixel;
- }
- return size;
-}
-
-ssize_t bytesPerPixel(PixelFormat format)
-{
- PixelFormatInfo info;
- status_t err = getPixelFormatInfo(format, &info);
- return (err < 0) ? err : info.bytesPerPixel;
-}
-
-ssize_t bitsPerPixel(PixelFormat format)
-{
- PixelFormatInfo info;
- status_t err = getPixelFormatInfo(format, &info);
- return (err < 0) ? err : info.bitsPerPixel;
-}
-
-status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info)
-{
- if (format < 0)
- return BAD_VALUE;
-
- if (info->version != sizeof(PixelFormatInfo))
- return INVALID_OPERATION;
-
- // YUV format from the HAL are handled here
- switch (format) {
- case HAL_PIXEL_FORMAT_YCbCr_422_SP:
- case HAL_PIXEL_FORMAT_YCbCr_422_I:
- info->bitsPerPixel = 16;
- goto done;
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- case HAL_PIXEL_FORMAT_YV12:
- info->bitsPerPixel = 12;
- done:
- info->format = format;
- info->components = COMPONENT_YUV;
- info->bytesPerPixel = 1;
- info->h_alpha = 0;
- info->l_alpha = 0;
- info->h_red = info->h_green = info->h_blue = 8;
- info->l_red = info->l_green = info->l_blue = 0;
- return NO_ERROR;
- }
-
- size_t numEntries;
- const Info *i = gGetPixelFormatTable(&numEntries) + format;
- bool valid = uint32_t(format) < numEntries;
- if (!valid) {
- return BAD_INDEX;
- }
-
- info->format = format;
- info->bytesPerPixel = i->size;
- info->bitsPerPixel = i->bitsPerPixel;
- info->h_alpha = i->ah;
- info->l_alpha = i->al;
- info->h_red = i->rh;
- info->l_red = i->rl;
- info->h_green = i->gh;
- info->l_green = i->gl;
- info->h_blue = i->bh;
- info->l_blue = i->bl;
- info->components = i->components;
-
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
diff --git a/libs/ui/Rect.cpp b/libs/ui/Rect.cpp
deleted file mode 100644
index 5694e00..0000000
--- a/libs/ui/Rect.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#include <ui/Rect.h>
-
-namespace android {
-
-static inline int32_t min(int32_t a, int32_t b) {
- return (a<b) ? a : b;
-}
-
-static inline int32_t max(int32_t a, int32_t b) {
- return (a>b) ? a : b;
-}
-
-void Rect::makeInvalid() {
- left = 0;
- top = 0;
- right = -1;
- bottom = -1;
-}
-
-bool Rect::operator < (const Rect& rhs) const
-{
- if (top<rhs.top) {
- return true;
- } else if (top == rhs.top) {
- if (left < rhs.left) {
- return true;
- } else if (left == rhs.left) {
- if (bottom<rhs.bottom) {
- return true;
- } else if (bottom == rhs.bottom) {
- if (right<rhs.right) {
- return true;
- }
- }
- }
- }
- return false;
-}
-
-Rect& Rect::offsetTo(int32_t x, int32_t y)
-{
- right -= left - x;
- bottom -= top - y;
- left = x;
- top = y;
- return *this;
-}
-
-Rect& Rect::offsetBy(int32_t x, int32_t y)
-{
- left += x;
- top += y;
- right+= x;
- bottom+=y;
- return *this;
-}
-
-const Rect Rect::operator + (const Point& rhs) const
-{
- const Rect result(left+rhs.x, top+rhs.y, right+rhs.x, bottom+rhs.y);
- return result;
-}
-
-const Rect Rect::operator - (const Point& rhs) const
-{
- const Rect result(left-rhs.x, top-rhs.y, right-rhs.x, bottom-rhs.y);
- return result;
-}
-
-bool Rect::intersect(const Rect& with, Rect* result) const
-{
- result->left = max(left, with.left);
- result->top = max(top, with.top);
- result->right = min(right, with.right);
- result->bottom = min(bottom, with.bottom);
- return !(result->isEmpty());
-}
-
-}; // namespace android
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
deleted file mode 100644
index 6e2e731..0000000
--- a/libs/ui/Region.cpp
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Region"
-
-#include <limits.h>
-
-#include <utils/Log.h>
-#include <utils/String8.h>
-
-#include <ui/Rect.h>
-#include <ui/Region.h>
-#include <ui/Point.h>
-
-#include <private/ui/RegionHelper.h>
-
-// ----------------------------------------------------------------------------
-#define VALIDATE_REGIONS (false)
-#define VALIDATE_WITH_CORECG (false)
-// ----------------------------------------------------------------------------
-
-#if VALIDATE_WITH_CORECG
-#include <core/SkRegion.h>
-#endif
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-enum {
- op_nand = region_operator<Rect>::op_nand,
- op_and = region_operator<Rect>::op_and,
- op_or = region_operator<Rect>::op_or,
- op_xor = region_operator<Rect>::op_xor
-};
-
-// ----------------------------------------------------------------------------
-
-Region::Region()
- : mBounds(0,0)
-{
-}
-
-Region::Region(const Region& rhs)
- : mBounds(rhs.mBounds), mStorage(rhs.mStorage)
-{
-#if VALIDATE_REGIONS
- validate(rhs, "rhs copy-ctor");
-#endif
-}
-
-Region::Region(const Rect& rhs)
- : mBounds(rhs)
-{
-}
-
-Region::Region(const void* buffer)
-{
- status_t err = read(buffer);
- ALOGE_IF(err<0, "error %s reading Region from buffer", strerror(err));
-}
-
-Region::~Region()
-{
-}
-
-Region& Region::operator = (const Region& rhs)
-{
-#if VALIDATE_REGIONS
- validate(*this, "this->operator=");
- validate(rhs, "rhs.operator=");
-#endif
- mBounds = rhs.mBounds;
- mStorage = rhs.mStorage;
- return *this;
-}
-
-Region& Region::makeBoundsSelf()
-{
- mStorage.clear();
- return *this;
-}
-
-void Region::clear()
-{
- mBounds.clear();
- mStorage.clear();
-}
-
-void Region::set(const Rect& r)
-{
- mBounds = r;
- mStorage.clear();
-}
-
-void Region::set(uint32_t w, uint32_t h)
-{
- mBounds = Rect(int(w), int(h));
- mStorage.clear();
-}
-
-// ----------------------------------------------------------------------------
-
-void Region::addRectUnchecked(int l, int t, int r, int b)
-{
- mStorage.add(Rect(l,t,r,b));
-#if VALIDATE_REGIONS
- validate(*this, "addRectUnchecked");
-#endif
-}
-
-// ----------------------------------------------------------------------------
-
-Region& Region::orSelf(const Rect& r) {
- return operationSelf(r, op_or);
-}
-Region& Region::xorSelf(const Rect& r) {
- return operationSelf(r, op_xor);
-}
-Region& Region::andSelf(const Rect& r) {
- return operationSelf(r, op_and);
-}
-Region& Region::subtractSelf(const Rect& r) {
- return operationSelf(r, op_nand);
-}
-Region& Region::operationSelf(const Rect& r, int op) {
- Region lhs(*this);
- boolean_operation(op, *this, lhs, r);
- return *this;
-}
-
-// ----------------------------------------------------------------------------
-
-Region& Region::orSelf(const Region& rhs) {
- return operationSelf(rhs, op_or);
-}
-Region& Region::xorSelf(const Region& rhs) {
- return operationSelf(rhs, op_xor);
-}
-Region& Region::andSelf(const Region& rhs) {
- return operationSelf(rhs, op_and);
-}
-Region& Region::subtractSelf(const Region& rhs) {
- return operationSelf(rhs, op_nand);
-}
-Region& Region::operationSelf(const Region& rhs, int op) {
- Region lhs(*this);
- boolean_operation(op, *this, lhs, rhs);
- return *this;
-}
-
-Region& Region::translateSelf(int x, int y) {
- if (x|y) translate(*this, x, y);
- return *this;
-}
-
-// ----------------------------------------------------------------------------
-
-const Region Region::merge(const Rect& rhs) const {
- return operation(rhs, op_or);
-}
-const Region Region::mergeExclusive(const Rect& rhs) const {
- return operation(rhs, op_xor);
-}
-const Region Region::intersect(const Rect& rhs) const {
- return operation(rhs, op_and);
-}
-const Region Region::subtract(const Rect& rhs) const {
- return operation(rhs, op_nand);
-}
-const Region Region::operation(const Rect& rhs, int op) const {
- Region result;
- boolean_operation(op, result, *this, rhs);
- return result;
-}
-
-// ----------------------------------------------------------------------------
-
-const Region Region::merge(const Region& rhs) const {
- return operation(rhs, op_or);
-}
-const Region Region::mergeExclusive(const Region& rhs) const {
- return operation(rhs, op_xor);
-}
-const Region Region::intersect(const Region& rhs) const {
- return operation(rhs, op_and);
-}
-const Region Region::subtract(const Region& rhs) const {
- return operation(rhs, op_nand);
-}
-const Region Region::operation(const Region& rhs, int op) const {
- Region result;
- boolean_operation(op, result, *this, rhs);
- return result;
-}
-
-const Region Region::translate(int x, int y) const {
- Region result;
- translate(result, *this, x, y);
- return result;
-}
-
-// ----------------------------------------------------------------------------
-
-Region& Region::orSelf(const Region& rhs, int dx, int dy) {
- return operationSelf(rhs, dx, dy, op_or);
-}
-Region& Region::xorSelf(const Region& rhs, int dx, int dy) {
- return operationSelf(rhs, dx, dy, op_xor);
-}
-Region& Region::andSelf(const Region& rhs, int dx, int dy) {
- return operationSelf(rhs, dx, dy, op_and);
-}
-Region& Region::subtractSelf(const Region& rhs, int dx, int dy) {
- return operationSelf(rhs, dx, dy, op_nand);
-}
-Region& Region::operationSelf(const Region& rhs, int dx, int dy, int op) {
- Region lhs(*this);
- boolean_operation(op, *this, lhs, rhs, dx, dy);
- return *this;
-}
-
-// ----------------------------------------------------------------------------
-
-const Region Region::merge(const Region& rhs, int dx, int dy) const {
- return operation(rhs, dx, dy, op_or);
-}
-const Region Region::mergeExclusive(const Region& rhs, int dx, int dy) const {
- return operation(rhs, dx, dy, op_xor);
-}
-const Region Region::intersect(const Region& rhs, int dx, int dy) const {
- return operation(rhs, dx, dy, op_and);
-}
-const Region Region::subtract(const Region& rhs, int dx, int dy) const {
- return operation(rhs, dx, dy, op_nand);
-}
-const Region Region::operation(const Region& rhs, int dx, int dy, int op) const {
- Region result;
- boolean_operation(op, result, *this, rhs, dx, dy);
- return result;
-}
-
-// ----------------------------------------------------------------------------
-
-// This is our region rasterizer, which merges rects and spans together
-// to obtain an optimal region.
-class Region::rasterizer : public region_operator<Rect>::region_rasterizer
-{
- Rect& bounds;
- Vector<Rect>& storage;
- Rect* head;
- Rect* tail;
- Vector<Rect> span;
- Rect* cur;
-public:
- rasterizer(Region& reg)
- : bounds(reg.mBounds), storage(reg.mStorage), head(), tail(), cur() {
- bounds.top = bounds.bottom = 0;
- bounds.left = INT_MAX;
- bounds.right = INT_MIN;
- storage.clear();
- }
-
- ~rasterizer() {
- if (span.size()) {
- flushSpan();
- }
- if (storage.size()) {
- bounds.top = storage.itemAt(0).top;
- bounds.bottom = storage.top().bottom;
- if (storage.size() == 1) {
- storage.clear();
- }
- } else {
- bounds.left = 0;
- bounds.right = 0;
- }
- }
-
- virtual void operator()(const Rect& rect) {
- //ALOGD(">>> %3d, %3d, %3d, %3d",
- // rect.left, rect.top, rect.right, rect.bottom);
- if (span.size()) {
- if (cur->top != rect.top) {
- flushSpan();
- } else if (cur->right == rect.left) {
- cur->right = rect.right;
- return;
- }
- }
- span.add(rect);
- cur = span.editArray() + (span.size() - 1);
- }
-private:
- template<typename T>
- static inline T min(T rhs, T lhs) { return rhs < lhs ? rhs : lhs; }
- template<typename T>
- static inline T max(T rhs, T lhs) { return rhs > lhs ? rhs : lhs; }
- void flushSpan() {
- bool merge = false;
- if (tail-head == ssize_t(span.size())) {
- Rect const* p = span.editArray();
- Rect const* q = head;
- if (p->top == q->bottom) {
- merge = true;
- while (q != tail) {
- if ((p->left != q->left) || (p->right != q->right)) {
- merge = false;
- break;
- }
- p++, q++;
- }
- }
- }
- if (merge) {
- const int bottom = span[0].bottom;
- Rect* r = head;
- while (r != tail) {
- r->bottom = bottom;
- r++;
- }
- } else {
- bounds.left = min(span.itemAt(0).left, bounds.left);
- bounds.right = max(span.top().right, bounds.right);
- storage.appendVector(span);
- tail = storage.editArray() + storage.size();
- head = tail - span.size();
- }
- span.clear();
- }
-};
-
-bool Region::validate(const Region& reg, const char* name)
-{
- bool result = true;
- const_iterator cur = reg.begin();
- const_iterator const tail = reg.end();
- const_iterator prev = cur++;
- Rect b(*prev);
- while (cur != tail) {
- b.left = b.left < cur->left ? b.left : cur->left;
- b.top = b.top < cur->top ? b.top : cur->top;
- b.right = b.right > cur->right ? b.right : cur->right;
- b.bottom = b.bottom > cur->bottom ? b.bottom : cur->bottom;
- if (cur->top == prev->top) {
- if (cur->bottom != prev->bottom) {
- ALOGE("%s: invalid span %p", name, cur);
- result = false;
- } else if (cur->left < prev->right) {
- ALOGE("%s: spans overlap horizontally prev=%p, cur=%p",
- name, prev, cur);
- result = false;
- }
- } else if (cur->top < prev->bottom) {
- ALOGE("%s: spans overlap vertically prev=%p, cur=%p",
- name, prev, cur);
- result = false;
- }
- prev = cur;
- cur++;
- }
- if (b != reg.getBounds()) {
- result = false;
- ALOGE("%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name,
- b.left, b.top, b.right, b.bottom,
- reg.getBounds().left, reg.getBounds().top,
- reg.getBounds().right, reg.getBounds().bottom);
- }
- if (result == false) {
- reg.dump(name);
- }
- return result;
-}
-
-void Region::boolean_operation(int op, Region& dst,
- const Region& lhs,
- const Region& rhs, int dx, int dy)
-{
-#if VALIDATE_REGIONS
- validate(lhs, "boolean_operation (before): lhs");
- validate(rhs, "boolean_operation (before): rhs");
- validate(dst, "boolean_operation (before): dst");
-#endif
-
- size_t lhs_count;
- Rect const * const lhs_rects = lhs.getArray(&lhs_count);
-
- size_t rhs_count;
- Rect const * const rhs_rects = rhs.getArray(&rhs_count);
-
- region_operator<Rect>::region lhs_region(lhs_rects, lhs_count);
- region_operator<Rect>::region rhs_region(rhs_rects, rhs_count, dx, dy);
- region_operator<Rect> operation(op, lhs_region, rhs_region);
- { // scope for rasterizer (dtor has side effects)
- rasterizer r(dst);
- operation(r);
- }
-
-#if VALIDATE_REGIONS
- validate(lhs, "boolean_operation: lhs");
- validate(rhs, "boolean_operation: rhs");
- validate(dst, "boolean_operation: dst");
-#endif
-
-#if VALIDATE_WITH_CORECG
- SkRegion sk_lhs;
- SkRegion sk_rhs;
- SkRegion sk_dst;
-
- for (size_t i=0 ; i<lhs_count ; i++)
- sk_lhs.op(
- lhs_rects[i].left + dx,
- lhs_rects[i].top + dy,
- lhs_rects[i].right + dx,
- lhs_rects[i].bottom + dy,
- SkRegion::kUnion_Op);
-
- for (size_t i=0 ; i<rhs_count ; i++)
- sk_rhs.op(
- rhs_rects[i].left + dx,
- rhs_rects[i].top + dy,
- rhs_rects[i].right + dx,
- rhs_rects[i].bottom + dy,
- SkRegion::kUnion_Op);
-
- const char* name = "---";
- SkRegion::Op sk_op;
- switch (op) {
- case op_or: sk_op = SkRegion::kUnion_Op; name="OR"; break;
- case op_xor: sk_op = SkRegion::kUnion_XOR; name="XOR"; break;
- case op_and: sk_op = SkRegion::kIntersect_Op; name="AND"; break;
- case op_nand: sk_op = SkRegion::kDifference_Op; name="NAND"; break;
- }
- sk_dst.op(sk_lhs, sk_rhs, sk_op);
-
- if (sk_dst.isEmpty() && dst.isEmpty())
- return;
-
- bool same = true;
- Region::const_iterator head = dst.begin();
- Region::const_iterator const tail = dst.end();
- SkRegion::Iterator it(sk_dst);
- while (!it.done()) {
- if (head != tail) {
- if (
- head->left != it.rect().fLeft ||
- head->top != it.rect().fTop ||
- head->right != it.rect().fRight ||
- head->bottom != it.rect().fBottom
- ) {
- same = false;
- break;
- }
- } else {
- same = false;
- break;
- }
- head++;
- it.next();
- }
-
- if (head != tail) {
- same = false;
- }
-
- if(!same) {
- ALOGD("---\nregion boolean %s failed", name);
- lhs.dump("lhs");
- rhs.dump("rhs");
- dst.dump("dst");
- ALOGD("should be");
- SkRegion::Iterator it(sk_dst);
- while (!it.done()) {
- ALOGD(" [%3d, %3d, %3d, %3d]",
- it.rect().fLeft,
- it.rect().fTop,
- it.rect().fRight,
- it.rect().fBottom);
- it.next();
- }
- }
-#endif
-}
-
-void Region::boolean_operation(int op, Region& dst,
- const Region& lhs,
- const Rect& rhs, int dx, int dy)
-{
- if (!rhs.isValid()) {
- ALOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}",
- op, rhs.left, rhs.top, rhs.right, rhs.bottom);
- return;
- }
-
-#if VALIDATE_WITH_CORECG || VALIDATE_REGIONS
- boolean_operation(op, dst, lhs, Region(rhs), dx, dy);
-#else
- size_t lhs_count;
- Rect const * const lhs_rects = lhs.getArray(&lhs_count);
-
- region_operator<Rect>::region lhs_region(lhs_rects, lhs_count);
- region_operator<Rect>::region rhs_region(&rhs, 1, dx, dy);
- region_operator<Rect> operation(op, lhs_region, rhs_region);
- { // scope for rasterizer (dtor has side effects)
- rasterizer r(dst);
- operation(r);
- }
-
-#endif
-}
-
-void Region::boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs)
-{
- boolean_operation(op, dst, lhs, rhs, 0, 0);
-}
-
-void Region::boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs)
-{
- boolean_operation(op, dst, lhs, rhs, 0, 0);
-}
-
-void Region::translate(Region& reg, int dx, int dy)
-{
- if (!reg.isEmpty()) {
-#if VALIDATE_REGIONS
- validate(reg, "translate (before)");
-#endif
- reg.mBounds.translate(dx, dy);
- size_t count = reg.mStorage.size();
- Rect* rects = reg.mStorage.editArray();
- while (count) {
- rects->translate(dx, dy);
- rects++;
- count--;
- }
-#if VALIDATE_REGIONS
- validate(reg, "translate (after)");
-#endif
- }
-}
-
-void Region::translate(Region& dst, const Region& reg, int dx, int dy)
-{
- dst = reg;
- translate(dst, dx, dy);
-}
-
-// ----------------------------------------------------------------------------
-
-ssize_t Region::write(void* buffer, size_t size) const
-{
-#if VALIDATE_REGIONS
- validate(*this, "write(buffer)");
-#endif
- const size_t count = mStorage.size();
- const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect);
- if (buffer != NULL) {
- if (sizeNeeded > size) return NO_MEMORY;
- int32_t* const p = static_cast<int32_t*>(buffer);
- *p = count;
- memcpy(p+1, &mBounds, sizeof(Rect));
- if (count) {
- memcpy(p+5, mStorage.array(), count*sizeof(Rect));
- }
- }
- return ssize_t(sizeNeeded);
-}
-
-ssize_t Region::read(const void* buffer)
-{
- int32_t const* const p = static_cast<int32_t const*>(buffer);
- const size_t count = *p;
- memcpy(&mBounds, p+1, sizeof(Rect));
- mStorage.clear();
- if (count) {
- mStorage.insertAt(0, count);
- memcpy(mStorage.editArray(), p+5, count*sizeof(Rect));
- }
-#if VALIDATE_REGIONS
- validate(*this, "read(buffer)");
-#endif
- return ssize_t(sizeof(int32_t) + (1+count)*sizeof(Rect));
-}
-
-ssize_t Region::writeEmpty(void* buffer, size_t size)
-{
- const size_t sizeNeeded = sizeof(int32_t) + sizeof(Rect);
- if (sizeNeeded > size) return NO_MEMORY;
- int32_t* const p = static_cast<int32_t*>(buffer);
- memset(p, 0, sizeNeeded);
- return ssize_t(sizeNeeded);
-}
-
-bool Region::isEmpty(void* buffer)
-{
- int32_t const* const p = static_cast<int32_t const*>(buffer);
- Rect const* const b = reinterpret_cast<Rect const *>(p+1);
- return b->isEmpty();
-}
-
-// ----------------------------------------------------------------------------
-
-Region::const_iterator Region::begin() const {
- return isRect() ? &mBounds : mStorage.array();
-}
-
-Region::const_iterator Region::end() const {
- return isRect() ? ((&mBounds) + 1) : (mStorage.array() + mStorage.size());
-}
-
-Rect const* Region::getArray(size_t* count) const {
- const_iterator const b(begin());
- const_iterator const e(end());
- if (count) *count = e-b;
- return b;
-}
-
-size_t Region::getRects(Vector<Rect>& rectList) const
-{
- rectList = mStorage;
- if (rectList.isEmpty()) {
- rectList.clear();
- rectList.add(mBounds);
- }
- return rectList.size();
-}
-
-// ----------------------------------------------------------------------------
-
-void Region::dump(String8& out, const char* what, uint32_t flags) const
-{
- (void)flags;
- const_iterator head = begin();
- const_iterator const tail = end();
-
- size_t SIZE = 256;
- char buffer[SIZE];
-
- snprintf(buffer, SIZE, " Region %s (this=%p, count=%d)\n",
- what, this, tail-head);
- out.append(buffer);
- while (head != tail) {
- snprintf(buffer, SIZE, " [%3d, %3d, %3d, %3d]\n",
- head->left, head->top, head->right, head->bottom);
- out.append(buffer);
- head++;
- }
-}
-
-void Region::dump(const char* what, uint32_t flags) const
-{
- (void)flags;
- const_iterator head = begin();
- const_iterator const tail = end();
- ALOGD(" Region %s (this=%p, count=%d)\n", what, this, tail-head);
- while (head != tail) {
- ALOGD(" [%3d, %3d, %3d, %3d]\n",
- head->left, head->top, head->right, head->bottom);
- head++;
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/libs/ui/tests/Android.mk b/libs/ui/tests/Android.mk
deleted file mode 100644
index 50cad36..0000000
--- a/libs/ui/tests/Android.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-# Build the unit tests.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# Build the manual test programs.
-include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/libs/ui/tests/region/Android.mk b/libs/ui/tests/region/Android.mk
deleted file mode 100644
index 6cc4a5a..0000000
--- a/libs/ui/tests/region/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- region.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui
-
-LOCAL_MODULE:= test-region
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/libs/ui/tests/region/region.cpp b/libs/ui/tests/region/region.cpp
deleted file mode 100644
index 6347294..0000000
--- a/libs/ui/tests/region/region.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Region"
-
-#include <stdio.h>
-#include <utils/Debug.h>
-#include <ui/Rect.h>
-#include <ui/Region.h>
-
-using namespace android;
-
-int main()
-{
- Region empty;
- Region reg0( Rect( 0, 0, 100, 100 ) );
- Region reg1 = reg0;
- Region reg2, reg3;
-
- Region reg4 = empty | reg1;
- Region reg5 = reg1 | empty;
-
- reg4.dump("reg4");
- reg5.dump("reg5");
-
- reg0.dump("reg0");
- reg1.dump("reg1");
-
- reg0 = reg0 | reg0.translate(150, 0);
- reg0.dump("reg0");
- reg1.dump("reg1");
-
- reg0 = reg0 | reg0.translate(300, 0);
- reg0.dump("reg0");
- reg1.dump("reg1");
-
- //reg2 = reg0 | reg0.translate(0, 100);
- //reg0.dump("reg0");
- //reg1.dump("reg1");
- //reg2.dump("reg2");
-
- //reg3 = reg0 | reg0.translate(0, 150);
- //reg0.dump("reg0");
- //reg1.dump("reg1");
- //reg2.dump("reg2");
- //reg3.dump("reg3");
-
- ALOGD("---");
- reg2 = reg0 | reg0.translate(100, 0);
- reg0.dump("reg0");
- reg1.dump("reg1");
- reg2.dump("reg2");
-
- return 0;
-}
-
diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk
deleted file mode 100644
index 57c048a..0000000
--- a/libs/utils/Android.mk
+++ /dev/null
@@ -1,108 +0,0 @@
-# Copyright (C) 2008 The Android Open Source Project
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-# libutils is a little unique: It's built twice, once for the host
-# and once for the device.
-
-commonSources:= \
- BasicHashtable.cpp \
- BlobCache.cpp \
- BufferedTextOutput.cpp \
- CallStack.cpp \
- Debug.cpp \
- FileMap.cpp \
- Flattenable.cpp \
- LinearTransform.cpp \
- PropertyMap.cpp \
- RefBase.cpp \
- SharedBuffer.cpp \
- Static.cpp \
- StopWatch.cpp \
- String8.cpp \
- String16.cpp \
- StringArray.cpp \
- SystemClock.cpp \
- TextOutput.cpp \
- Threads.cpp \
- Timers.cpp \
- Tokenizer.cpp \
- Unicode.cpp \
- VectorImpl.cpp \
- misc.cpp
-
-
-# For the host
-# =====================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= $(commonSources)
-
-LOCAL_MODULE:= libutils
-
-LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
-
-ifeq ($(HOST_OS),windows)
-ifeq ($(strip $(USE_CYGWIN),),)
-# Under MinGW, ctype.h doesn't need multi-byte support
-LOCAL_CFLAGS += -DMB_CUR_MAX=1
-endif
-endif
-
-ifeq ($(TARGET_OS),linux)
-LOCAL_LDLIBS += -lrt -ldl
-endif
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-
-# For the device
-# =====================================================
-include $(CLEAR_VARS)
-
-
-# we have the common sources, plus some device-specific stuff
-LOCAL_SRC_FILES:= \
- $(commonSources) \
- Looper.cpp \
- Trace.cpp
-
-ifeq ($(TARGET_OS),linux)
-LOCAL_LDLIBS += -lrt -ldl
-endif
-
-LOCAL_C_INCLUDES += \
- bionic/libc/private
-
-LOCAL_LDLIBS += -lpthread
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
- libcutils \
- libdl \
- libcorkscrew
-
-LOCAL_MODULE:= libutils
-include $(BUILD_SHARED_LIBRARY)
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/libs/utils/BasicHashtable.cpp b/libs/utils/BasicHashtable.cpp
deleted file mode 100644
index fb8ec9f..0000000
--- a/libs/utils/BasicHashtable.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "BasicHashtable"
-
-#include <math.h>
-
-#include <utils/Log.h>
-#include <utils/BasicHashtable.h>
-#include <utils/misc.h>
-
-namespace android {
-
-BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
- size_t minimumInitialCapacity, float loadFactor) :
- mBucketSize(entrySize + sizeof(Bucket)), mHasTrivialDestructor(hasTrivialDestructor),
- mLoadFactor(loadFactor), mSize(0),
- mFilledBuckets(0), mBuckets(NULL) {
- determineCapacity(minimumInitialCapacity, mLoadFactor, &mBucketCount, &mCapacity);
-}
-
-BasicHashtableImpl::BasicHashtableImpl(const BasicHashtableImpl& other) :
- mBucketSize(other.mBucketSize), mHasTrivialDestructor(other.mHasTrivialDestructor),
- mCapacity(other.mCapacity), mLoadFactor(other.mLoadFactor),
- mSize(other.mSize), mFilledBuckets(other.mFilledBuckets),
- mBucketCount(other.mBucketCount), mBuckets(other.mBuckets) {
- if (mBuckets) {
- SharedBuffer::bufferFromData(mBuckets)->acquire();
- }
-}
-
-void BasicHashtableImpl::dispose() {
- if (mBuckets) {
- releaseBuckets(mBuckets, mBucketCount);
- }
-}
-
-void BasicHashtableImpl::clone() {
- if (mBuckets) {
- void* newBuckets = allocateBuckets(mBucketCount);
- copyBuckets(mBuckets, newBuckets, mBucketCount);
- releaseBuckets(mBuckets, mBucketCount);
- mBuckets = newBuckets;
- }
-}
-
-void BasicHashtableImpl::setTo(const BasicHashtableImpl& other) {
- if (mBuckets) {
- releaseBuckets(mBuckets, mBucketCount);
- }
-
- mCapacity = other.mCapacity;
- mLoadFactor = other.mLoadFactor;
- mSize = other.mSize;
- mFilledBuckets = other.mFilledBuckets;
- mBucketCount = other.mBucketCount;
- mBuckets = other.mBuckets;
-
- if (mBuckets) {
- SharedBuffer::bufferFromData(mBuckets)->acquire();
- }
-}
-
-void BasicHashtableImpl::clear() {
- if (mBuckets) {
- if (mFilledBuckets) {
- SharedBuffer* sb = SharedBuffer::bufferFromData(mBuckets);
- if (sb->onlyOwner()) {
- destroyBuckets(mBuckets, mBucketCount);
- for (size_t i = 0; i < mSize; i++) {
- Bucket& bucket = bucketAt(mBuckets, i);
- bucket.cookie = 0;
- }
- } else {
- releaseBuckets(mBuckets, mBucketCount);
- mBuckets = NULL;
- }
- mFilledBuckets = 0;
- }
- mSize = 0;
- }
-}
-
-ssize_t BasicHashtableImpl::next(ssize_t index) const {
- if (mSize) {
- while (size_t(++index) < mBucketCount) {
- const Bucket& bucket = bucketAt(mBuckets, index);
- if (bucket.cookie & Bucket::PRESENT) {
- return index;
- }
- }
- }
- return -1;
-}
-
-ssize_t BasicHashtableImpl::find(ssize_t index, hash_t hash,
- const void* __restrict__ key) const {
- if (!mSize) {
- return -1;
- }
-
- hash = trimHash(hash);
- if (index < 0) {
- index = chainStart(hash, mBucketCount);
-
- const Bucket& bucket = bucketAt(mBuckets, size_t(index));
- if (bucket.cookie & Bucket::PRESENT) {
- if (compareBucketKey(bucket, key)) {
- return index;
- }
- } else {
- if (!(bucket.cookie & Bucket::COLLISION)) {
- return -1;
- }
- }
- }
-
- size_t inc = chainIncrement(hash, mBucketCount);
- for (;;) {
- index = chainSeek(index, inc, mBucketCount);
-
- const Bucket& bucket = bucketAt(mBuckets, size_t(index));
- if (bucket.cookie & Bucket::PRESENT) {
- if ((bucket.cookie & Bucket::HASH_MASK) == hash
- && compareBucketKey(bucket, key)) {
- return index;
- }
- }
- if (!(bucket.cookie & Bucket::COLLISION)) {
- return -1;
- }
- }
-}
-
-size_t BasicHashtableImpl::add(hash_t hash, const void* entry) {
- if (!mBuckets) {
- mBuckets = allocateBuckets(mBucketCount);
- } else {
- edit();
- }
-
- hash = trimHash(hash);
- for (;;) {
- size_t index = chainStart(hash, mBucketCount);
- Bucket* bucket = &bucketAt(mBuckets, size_t(index));
- if (bucket->cookie & Bucket::PRESENT) {
- size_t inc = chainIncrement(hash, mBucketCount);
- do {
- bucket->cookie |= Bucket::COLLISION;
- index = chainSeek(index, inc, mBucketCount);
- bucket = &bucketAt(mBuckets, size_t(index));
- } while (bucket->cookie & Bucket::PRESENT);
- }
-
- uint32_t collision = bucket->cookie & Bucket::COLLISION;
- if (!collision) {
- if (mFilledBuckets >= mCapacity) {
- rehash(mCapacity * 2, mLoadFactor);
- continue;
- }
- mFilledBuckets += 1;
- }
-
- bucket->cookie = collision | Bucket::PRESENT | hash;
- mSize += 1;
- initializeBucketEntry(*bucket, entry);
- return index;
- }
-}
-
-void BasicHashtableImpl::removeAt(size_t index) {
- edit();
-
- Bucket& bucket = bucketAt(mBuckets, index);
- bucket.cookie &= ~Bucket::PRESENT;
- if (!(bucket.cookie & Bucket::COLLISION)) {
- mFilledBuckets -= 1;
- }
- mSize -= 1;
- if (!mHasTrivialDestructor) {
- destroyBucketEntry(bucket);
- }
-}
-
-void BasicHashtableImpl::rehash(size_t minimumCapacity, float loadFactor) {
- if (minimumCapacity < mSize) {
- minimumCapacity = mSize;
- }
- size_t newBucketCount, newCapacity;
- determineCapacity(minimumCapacity, loadFactor, &newBucketCount, &newCapacity);
-
- if (newBucketCount != mBucketCount || newCapacity != mCapacity) {
- if (mBuckets) {
- void* newBuckets;
- if (mSize) {
- newBuckets = allocateBuckets(newBucketCount);
- for (size_t i = 0; i < mBucketCount; i++) {
- const Bucket& fromBucket = bucketAt(mBuckets, i);
- if (fromBucket.cookie & Bucket::PRESENT) {
- hash_t hash = fromBucket.cookie & Bucket::HASH_MASK;
- size_t index = chainStart(hash, newBucketCount);
- Bucket* toBucket = &bucketAt(newBuckets, size_t(index));
- if (toBucket->cookie & Bucket::PRESENT) {
- size_t inc = chainIncrement(hash, newBucketCount);
- do {
- toBucket->cookie |= Bucket::COLLISION;
- index = chainSeek(index, inc, newBucketCount);
- toBucket = &bucketAt(newBuckets, size_t(index));
- } while (toBucket->cookie & Bucket::PRESENT);
- }
- toBucket->cookie = Bucket::PRESENT | hash;
- initializeBucketEntry(*toBucket, fromBucket.entry);
- }
- }
- } else {
- newBuckets = NULL;
- }
- releaseBuckets(mBuckets, mBucketCount);
- mBuckets = newBuckets;
- mFilledBuckets = mSize;
- }
- mBucketCount = newBucketCount;
- mCapacity = newCapacity;
- }
- mLoadFactor = loadFactor;
-}
-
-void* BasicHashtableImpl::allocateBuckets(size_t count) const {
- size_t bytes = count * mBucketSize;
- SharedBuffer* sb = SharedBuffer::alloc(bytes);
- LOG_ALWAYS_FATAL_IF(!sb, "Could not allocate %u bytes for hashtable with %u buckets.",
- uint32_t(bytes), uint32_t(count));
- void* buckets = sb->data();
- for (size_t i = 0; i < count; i++) {
- Bucket& bucket = bucketAt(buckets, i);
- bucket.cookie = 0;
- }
- return buckets;
-}
-
-void BasicHashtableImpl::releaseBuckets(void* __restrict__ buckets, size_t count) const {
- SharedBuffer* sb = SharedBuffer::bufferFromData(buckets);
- if (sb->release(SharedBuffer::eKeepStorage) == 1) {
- destroyBuckets(buckets, count);
- SharedBuffer::dealloc(sb);
- }
-}
-
-void BasicHashtableImpl::destroyBuckets(void* __restrict__ buckets, size_t count) const {
- if (!mHasTrivialDestructor) {
- for (size_t i = 0; i < count; i++) {
- Bucket& bucket = bucketAt(buckets, i);
- if (bucket.cookie & Bucket::PRESENT) {
- destroyBucketEntry(bucket);
- }
- }
- }
-}
-
-void BasicHashtableImpl::copyBuckets(const void* __restrict__ fromBuckets,
- void* __restrict__ toBuckets, size_t count) const {
- for (size_t i = 0; i < count; i++) {
- const Bucket& fromBucket = bucketAt(fromBuckets, i);
- Bucket& toBucket = bucketAt(toBuckets, i);
- toBucket.cookie = fromBucket.cookie;
- if (fromBucket.cookie & Bucket::PRESENT) {
- initializeBucketEntry(toBucket, fromBucket.entry);
- }
- }
-}
-
-// Table of 31-bit primes where each prime is no less than twice as large
-// as the previous one. Generated by "primes.py".
-static size_t PRIMES[] = {
- 5,
- 11,
- 23,
- 47,
- 97,
- 197,
- 397,
- 797,
- 1597,
- 3203,
- 6421,
- 12853,
- 25717,
- 51437,
- 102877,
- 205759,
- 411527,
- 823117,
- 1646237,
- 3292489,
- 6584983,
- 13169977,
- 26339969,
- 52679969,
- 105359939,
- 210719881,
- 421439783,
- 842879579,
- 1685759167,
- 0,
-};
-
-void BasicHashtableImpl::determineCapacity(size_t minimumCapacity, float loadFactor,
- size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity) {
- LOG_ALWAYS_FATAL_IF(loadFactor <= 0.0f || loadFactor > 1.0f,
- "Invalid load factor %0.3f. Must be in the range (0, 1].", loadFactor);
-
- size_t count = ceilf(minimumCapacity / loadFactor) + 1;
- size_t i = 0;
- while (count > PRIMES[i] && i < NELEM(PRIMES)) {
- i++;
- }
- count = PRIMES[i];
- LOG_ALWAYS_FATAL_IF(!count, "Could not determine required number of buckets for "
- "hashtable with minimum capacity %u and load factor %0.3f.",
- uint32_t(minimumCapacity), loadFactor);
- *outBucketCount = count;
- *outCapacity = ceilf((count - 1) * loadFactor);
-}
-
-}; // namespace android
diff --git a/libs/utils/BlobCache.cpp b/libs/utils/BlobCache.cpp
deleted file mode 100644
index be398ee..0000000
--- a/libs/utils/BlobCache.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#define LOG_TAG "BlobCache"
-//#define LOG_NDEBUG 0
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <utils/BlobCache.h>
-#include <utils/Errors.h>
-#include <utils/Log.h>
-
-namespace android {
-
-// BlobCache::Header::mMagicNumber value
-static const uint32_t blobCacheMagic = '_Bb$';
-
-// BlobCache::Header::mBlobCacheVersion value
-static const uint32_t blobCacheVersion = 1;
-
-// BlobCache::Header::mDeviceVersion value
-static const uint32_t blobCacheDeviceVersion = 1;
-
-BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize):
- mMaxKeySize(maxKeySize),
- mMaxValueSize(maxValueSize),
- mMaxTotalSize(maxTotalSize),
- mTotalSize(0) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
-#ifdef _WIN32
- srand(now);
-#else
- mRandState[0] = (now >> 0) & 0xFFFF;
- mRandState[1] = (now >> 16) & 0xFFFF;
- mRandState[2] = (now >> 32) & 0xFFFF;
-#endif
- ALOGV("initializing random seed using %lld", now);
-}
-
-void BlobCache::set(const void* key, size_t keySize, const void* value,
- size_t valueSize) {
- if (mMaxKeySize < keySize) {
- ALOGV("set: not caching because the key is too large: %d (limit: %d)",
- keySize, mMaxKeySize);
- return;
- }
- if (mMaxValueSize < valueSize) {
- ALOGV("set: not caching because the value is too large: %d (limit: %d)",
- valueSize, mMaxValueSize);
- return;
- }
- if (mMaxTotalSize < keySize + valueSize) {
- ALOGV("set: not caching because the combined key/value size is too "
- "large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize);
- return;
- }
- if (keySize == 0) {
- ALOGW("set: not caching because keySize is 0");
- return;
- }
- if (valueSize <= 0) {
- ALOGW("set: not caching because valueSize is 0");
- return;
- }
-
- sp<Blob> dummyKey(new Blob(key, keySize, false));
- CacheEntry dummyEntry(dummyKey, NULL);
-
- while (true) {
- ssize_t index = mCacheEntries.indexOf(dummyEntry);
- if (index < 0) {
- // Create a new cache entry.
- sp<Blob> keyBlob(new Blob(key, keySize, true));
- sp<Blob> valueBlob(new Blob(value, valueSize, true));
- size_t newTotalSize = mTotalSize + keySize + valueSize;
- if (mMaxTotalSize < newTotalSize) {
- if (isCleanable()) {
- // Clean the cache and try again.
- clean();
- continue;
- } else {
- ALOGV("set: not caching new key/value pair because the "
- "total cache size limit would be exceeded: %d "
- "(limit: %d)",
- keySize + valueSize, mMaxTotalSize);
- break;
- }
- }
- mCacheEntries.add(CacheEntry(keyBlob, valueBlob));
- mTotalSize = newTotalSize;
- ALOGV("set: created new cache entry with %d byte key and %d byte value",
- keySize, valueSize);
- } else {
- // Update the existing cache entry.
- sp<Blob> valueBlob(new Blob(value, valueSize, true));
- sp<Blob> oldValueBlob(mCacheEntries[index].getValue());
- size_t newTotalSize = mTotalSize + valueSize - oldValueBlob->getSize();
- if (mMaxTotalSize < newTotalSize) {
- if (isCleanable()) {
- // Clean the cache and try again.
- clean();
- continue;
- } else {
- ALOGV("set: not caching new value because the total cache "
- "size limit would be exceeded: %d (limit: %d)",
- keySize + valueSize, mMaxTotalSize);
- break;
- }
- }
- mCacheEntries.editItemAt(index).setValue(valueBlob);
- mTotalSize = newTotalSize;
- ALOGV("set: updated existing cache entry with %d byte key and %d byte "
- "value", keySize, valueSize);
- }
- break;
- }
-}
-
-size_t BlobCache::get(const void* key, size_t keySize, void* value,
- size_t valueSize) {
- if (mMaxKeySize < keySize) {
- ALOGV("get: not searching because the key is too large: %d (limit %d)",
- keySize, mMaxKeySize);
- return 0;
- }
- sp<Blob> dummyKey(new Blob(key, keySize, false));
- CacheEntry dummyEntry(dummyKey, NULL);
- ssize_t index = mCacheEntries.indexOf(dummyEntry);
- if (index < 0) {
- ALOGV("get: no cache entry found for key of size %d", keySize);
- return 0;
- }
-
- // The key was found. Return the value if the caller's buffer is large
- // enough.
- sp<Blob> valueBlob(mCacheEntries[index].getValue());
- size_t valueBlobSize = valueBlob->getSize();
- if (valueBlobSize <= valueSize) {
- ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize);
- memcpy(value, valueBlob->getData(), valueBlobSize);
- } else {
- ALOGV("get: caller's buffer is too small for value: %d (needs %d)",
- valueSize, valueBlobSize);
- }
- return valueBlobSize;
-}
-
-static inline size_t align4(size_t size) {
- return (size + 3) & ~3;
-}
-
-size_t BlobCache::getFlattenedSize() const {
- size_t size = sizeof(Header);
- for (size_t i = 0; i < mCacheEntries.size(); i++) {
- const CacheEntry& e(mCacheEntries[i]);
- sp<Blob> keyBlob = e.getKey();
- sp<Blob> valueBlob = e.getValue();
- size = align4(size);
- size += sizeof(EntryHeader) + keyBlob->getSize() +
- valueBlob->getSize();
- }
- return size;
-}
-
-size_t BlobCache::getFdCount() const {
- return 0;
-}
-
-status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count)
- const {
- if (count != 0) {
- ALOGE("flatten: nonzero fd count: %zu", count);
- return BAD_VALUE;
- }
-
- // Write the cache header
- if (size < sizeof(Header)) {
- ALOGE("flatten: not enough room for cache header");
- return BAD_VALUE;
- }
- Header* header = reinterpret_cast<Header*>(buffer);
- header->mMagicNumber = blobCacheMagic;
- header->mBlobCacheVersion = blobCacheVersion;
- header->mDeviceVersion = blobCacheDeviceVersion;
- header->mNumEntries = mCacheEntries.size();
-
- // Write cache entries
- uint8_t* byteBuffer = reinterpret_cast<uint8_t*>(buffer);
- off_t byteOffset = align4(sizeof(Header));
- for (size_t i = 0; i < mCacheEntries.size(); i++) {
- const CacheEntry& e(mCacheEntries[i]);
- sp<Blob> keyBlob = e.getKey();
- sp<Blob> valueBlob = e.getValue();
- size_t keySize = keyBlob->getSize();
- size_t valueSize = valueBlob->getSize();
-
- size_t entrySize = sizeof(EntryHeader) + keySize + valueSize;
- if (byteOffset + entrySize > size) {
- ALOGE("flatten: not enough room for cache entries");
- return BAD_VALUE;
- }
-
- EntryHeader* eheader = reinterpret_cast<EntryHeader*>(
- &byteBuffer[byteOffset]);
- eheader->mKeySize = keySize;
- eheader->mValueSize = valueSize;
-
- memcpy(eheader->mData, keyBlob->getData(), keySize);
- memcpy(eheader->mData + keySize, valueBlob->getData(), valueSize);
-
- byteOffset += align4(entrySize);
- }
-
- return OK;
-}
-
-status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[],
- size_t count) {
- // All errors should result in the BlobCache being in an empty state.
- mCacheEntries.clear();
-
- if (count != 0) {
- ALOGE("unflatten: nonzero fd count: %zu", count);
- return BAD_VALUE;
- }
-
- // Read the cache header
- if (size < sizeof(Header)) {
- ALOGE("unflatten: not enough room for cache header");
- return BAD_VALUE;
- }
- const Header* header = reinterpret_cast<const Header*>(buffer);
- if (header->mMagicNumber != blobCacheMagic) {
- ALOGE("unflatten: bad magic number: %d", header->mMagicNumber);
- return BAD_VALUE;
- }
- if (header->mBlobCacheVersion != blobCacheVersion ||
- header->mDeviceVersion != blobCacheDeviceVersion) {
- // We treat version mismatches as an empty cache.
- return OK;
- }
-
- // Read cache entries
- const uint8_t* byteBuffer = reinterpret_cast<const uint8_t*>(buffer);
- off_t byteOffset = align4(sizeof(Header));
- size_t numEntries = header->mNumEntries;
- for (size_t i = 0; i < numEntries; i++) {
- if (byteOffset + sizeof(EntryHeader) > size) {
- mCacheEntries.clear();
- ALOGE("unflatten: not enough room for cache entry headers");
- return BAD_VALUE;
- }
-
- const EntryHeader* eheader = reinterpret_cast<const EntryHeader*>(
- &byteBuffer[byteOffset]);
- size_t keySize = eheader->mKeySize;
- size_t valueSize = eheader->mValueSize;
- size_t entrySize = sizeof(EntryHeader) + keySize + valueSize;
-
- if (byteOffset + entrySize > size) {
- mCacheEntries.clear();
- ALOGE("unflatten: not enough room for cache entry headers");
- return BAD_VALUE;
- }
-
- const uint8_t* data = eheader->mData;
- set(data, keySize, data + keySize, valueSize);
-
- byteOffset += align4(entrySize);
- }
-
- return OK;
-}
-
-long int BlobCache::blob_random() {
-#ifdef _WIN32
- return rand();
-#else
- return nrand48(mRandState);
-#endif
-}
-
-void BlobCache::clean() {
- // Remove a random cache entry until the total cache size gets below half
- // the maximum total cache size.
- while (mTotalSize > mMaxTotalSize / 2) {
- size_t i = size_t(blob_random() % (mCacheEntries.size()));
- const CacheEntry& entry(mCacheEntries[i]);
- mTotalSize -= entry.getKey()->getSize() + entry.getValue()->getSize();
- mCacheEntries.removeAt(i);
- }
-}
-
-bool BlobCache::isCleanable() const {
- return mTotalSize > mMaxTotalSize / 2;
-}
-
-BlobCache::Blob::Blob(const void* data, size_t size, bool copyData):
- mData(copyData ? malloc(size) : data),
- mSize(size),
- mOwnsData(copyData) {
- if (data != NULL && copyData) {
- memcpy(const_cast<void*>(mData), data, size);
- }
-}
-
-BlobCache::Blob::~Blob() {
- if (mOwnsData) {
- free(const_cast<void*>(mData));
- }
-}
-
-bool BlobCache::Blob::operator<(const Blob& rhs) const {
- if (mSize == rhs.mSize) {
- return memcmp(mData, rhs.mData, mSize) < 0;
- } else {
- return mSize < rhs.mSize;
- }
-}
-
-const void* BlobCache::Blob::getData() const {
- return mData;
-}
-
-size_t BlobCache::Blob::getSize() const {
- return mSize;
-}
-
-BlobCache::CacheEntry::CacheEntry() {
-}
-
-BlobCache::CacheEntry::CacheEntry(const sp<Blob>& key, const sp<Blob>& value):
- mKey(key),
- mValue(value) {
-}
-
-BlobCache::CacheEntry::CacheEntry(const CacheEntry& ce):
- mKey(ce.mKey),
- mValue(ce.mValue) {
-}
-
-bool BlobCache::CacheEntry::operator<(const CacheEntry& rhs) const {
- return *mKey < *rhs.mKey;
-}
-
-const BlobCache::CacheEntry& BlobCache::CacheEntry::operator=(const CacheEntry& rhs) {
- mKey = rhs.mKey;
- mValue = rhs.mValue;
- return *this;
-}
-
-sp<BlobCache::Blob> BlobCache::CacheEntry::getKey() const {
- return mKey;
-}
-
-sp<BlobCache::Blob> BlobCache::CacheEntry::getValue() const {
- return mValue;
-}
-
-void BlobCache::CacheEntry::setValue(const sp<Blob>& value) {
- mValue = value;
-}
-
-} // namespace android
diff --git a/libs/utils/BufferedTextOutput.cpp b/libs/utils/BufferedTextOutput.cpp
deleted file mode 100644
index 989662e..0000000
--- a/libs/utils/BufferedTextOutput.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/BufferedTextOutput.h>
-
-#include <utils/Atomic.h>
-#include <utils/Debug.h>
-#include <utils/Log.h>
-#include <utils/RefBase.h>
-#include <utils/Vector.h>
-#include <cutils/threads.h>
-
-#include <private/utils/Static.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-struct BufferedTextOutput::BufferState : public RefBase
-{
- BufferState(int32_t _seq)
- : seq(_seq)
- , buffer(NULL)
- , bufferPos(0)
- , bufferSize(0)
- , atFront(true)
- , indent(0)
- , bundle(0) {
- }
- ~BufferState() {
- free(buffer);
- }
-
- status_t append(const char* txt, size_t len) {
- if ((len+bufferPos) > bufferSize) {
- void* b = realloc(buffer, ((len+bufferPos)*3)/2);
- if (!b) return NO_MEMORY;
- buffer = (char*)b;
- }
- memcpy(buffer+bufferPos, txt, len);
- bufferPos += len;
- return NO_ERROR;
- }
-
- void restart() {
- bufferPos = 0;
- atFront = true;
- if (bufferSize > 256) {
- void* b = realloc(buffer, 256);
- if (b) {
- buffer = (char*)b;
- bufferSize = 256;
- }
- }
- }
-
- const int32_t seq;
- char* buffer;
- size_t bufferPos;
- size_t bufferSize;
- bool atFront;
- int32_t indent;
- int32_t bundle;
-};
-
-struct BufferedTextOutput::ThreadState
-{
- Vector<sp<BufferedTextOutput::BufferState> > states;
-};
-
-static mutex_t gMutex;
-
-static thread_store_t tls;
-
-BufferedTextOutput::ThreadState* BufferedTextOutput::getThreadState()
-{
- ThreadState* ts = (ThreadState*) thread_store_get( &tls );
- if (ts) return ts;
- ts = new ThreadState;
- thread_store_set( &tls, ts, threadDestructor );
- return ts;
-}
-
-void BufferedTextOutput::threadDestructor(void *st)
-{
- delete ((ThreadState*)st);
-}
-
-static volatile int32_t gSequence = 0;
-
-static volatile int32_t gFreeBufferIndex = -1;
-
-static int32_t allocBufferIndex()
-{
- int32_t res = -1;
-
- mutex_lock(&gMutex);
-
- if (gFreeBufferIndex >= 0) {
- res = gFreeBufferIndex;
- gFreeBufferIndex = gTextBuffers[res];
- gTextBuffers.editItemAt(res) = -1;
-
- } else {
- res = gTextBuffers.size();
- gTextBuffers.add(-1);
- }
-
- mutex_unlock(&gMutex);
-
- return res;
-}
-
-static void freeBufferIndex(int32_t idx)
-{
- mutex_lock(&gMutex);
- gTextBuffers.editItemAt(idx) = gFreeBufferIndex;
- gFreeBufferIndex = idx;
- mutex_unlock(&gMutex);
-}
-
-// ---------------------------------------------------------------------------
-
-BufferedTextOutput::BufferedTextOutput(uint32_t flags)
- : mFlags(flags)
- , mSeq(android_atomic_inc(&gSequence))
- , mIndex(allocBufferIndex())
-{
- mGlobalState = new BufferState(mSeq);
- if (mGlobalState) mGlobalState->incStrong(this);
-}
-
-BufferedTextOutput::~BufferedTextOutput()
-{
- if (mGlobalState) mGlobalState->decStrong(this);
- freeBufferIndex(mIndex);
-}
-
-status_t BufferedTextOutput::print(const char* txt, size_t len)
-{
- //printf("BufferedTextOutput: printing %d\n", len);
-
- AutoMutex _l(mLock);
- BufferState* b = getBuffer();
-
- const char* const end = txt+len;
-
- status_t err;
-
- while (txt < end) {
- // Find the next line.
- const char* first = txt;
- while (txt < end && *txt != '\n') txt++;
-
- // Include this and all following empty lines.
- while (txt < end && *txt == '\n') txt++;
-
- // Special cases for first data on a line.
- if (b->atFront) {
- if (b->indent > 0) {
- // If this is the start of a line, add the indent.
- const char* prefix = stringForIndent(b->indent);
- err = b->append(prefix, strlen(prefix));
- if (err != NO_ERROR) return err;
-
- } else if (*(txt-1) == '\n' && !b->bundle) {
- // Fast path: if we are not indenting or bundling, and
- // have been given one or more complete lines, just write
- // them out without going through the buffer.
-
- // Slurp up all of the lines.
- const char* lastLine = txt+1;
- while (txt < end) {
- if (*txt++ == '\n') lastLine = txt;
- }
- struct iovec vec;
- vec.iov_base = (void*)first;
- vec.iov_len = lastLine-first;
- //printf("Writing %d bytes of data!\n", vec.iov_len);
- writeLines(vec, 1);
- txt = lastLine;
- continue;
- }
- }
-
- // Append the new text to the buffer.
- err = b->append(first, txt-first);
- if (err != NO_ERROR) return err;
- b->atFront = *(txt-1) == '\n';
-
- // If we have finished a line and are not bundling, write
- // it out.
- //printf("Buffer is now %d bytes\n", b->bufferPos);
- if (b->atFront && !b->bundle) {
- struct iovec vec;
- vec.iov_base = b->buffer;
- vec.iov_len = b->bufferPos;
- //printf("Writing %d bytes of data!\n", vec.iov_len);
- writeLines(vec, 1);
- b->restart();
- }
- }
-
- return NO_ERROR;
-}
-
-void BufferedTextOutput::moveIndent(int delta)
-{
- AutoMutex _l(mLock);
- BufferState* b = getBuffer();
- b->indent += delta;
- if (b->indent < 0) b->indent = 0;
-}
-
-void BufferedTextOutput::pushBundle()
-{
- AutoMutex _l(mLock);
- BufferState* b = getBuffer();
- b->bundle++;
-}
-
-void BufferedTextOutput::popBundle()
-{
- AutoMutex _l(mLock);
- BufferState* b = getBuffer();
- b->bundle--;
- LOG_FATAL_IF(b->bundle < 0,
- "TextOutput::popBundle() called more times than pushBundle()");
- if (b->bundle < 0) b->bundle = 0;
-
- if (b->bundle == 0) {
- // Last bundle, write out data if it is complete. If it is not
- // complete, don't write until the last line is done... this may
- // or may not be the write thing to do, but it's the easiest.
- if (b->bufferPos > 0 && b->atFront) {
- struct iovec vec;
- vec.iov_base = b->buffer;
- vec.iov_len = b->bufferPos;
- writeLines(vec, 1);
- b->restart();
- }
- }
-}
-
-BufferedTextOutput::BufferState* BufferedTextOutput::getBuffer() const
-{
- if ((mFlags&MULTITHREADED) != 0) {
- ThreadState* ts = getThreadState();
- if (ts) {
- while (ts->states.size() <= (size_t)mIndex) ts->states.add(NULL);
- BufferState* bs = ts->states[mIndex].get();
- if (bs != NULL && bs->seq == mSeq) return bs;
-
- ts->states.editItemAt(mIndex) = new BufferState(mIndex);
- bs = ts->states[mIndex].get();
- if (bs != NULL) return bs;
- }
- }
-
- return mGlobalState;
-}
-
-}; // namespace android
diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp
deleted file mode 100644
index 18fd84f..0000000
--- a/libs/utils/CallStack.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "CallStack"
-
-#include <string.h>
-
-#include <utils/Log.h>
-#include <utils/Errors.h>
-#include <utils/CallStack.h>
-#include <corkscrew/backtrace.h>
-
-/*****************************************************************************/
-namespace android {
-
-CallStack::CallStack() :
- mCount(0) {
-}
-
-CallStack::CallStack(const CallStack& rhs) :
- mCount(rhs.mCount) {
- if (mCount) {
- memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t));
- }
-}
-
-CallStack::~CallStack() {
-}
-
-CallStack& CallStack::operator = (const CallStack& rhs) {
- mCount = rhs.mCount;
- if (mCount) {
- memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t));
- }
- return *this;
-}
-
-bool CallStack::operator == (const CallStack& rhs) const {
- if (mCount != rhs.mCount)
- return false;
- return !mCount || memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) == 0;
-}
-
-bool CallStack::operator != (const CallStack& rhs) const {
- return !operator == (rhs);
-}
-
-bool CallStack::operator < (const CallStack& rhs) const {
- if (mCount != rhs.mCount)
- return mCount < rhs.mCount;
- return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) < 0;
-}
-
-bool CallStack::operator >= (const CallStack& rhs) const {
- return !operator < (rhs);
-}
-
-bool CallStack::operator > (const CallStack& rhs) const {
- if (mCount != rhs.mCount)
- return mCount > rhs.mCount;
- return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) > 0;
-}
-
-bool CallStack::operator <= (const CallStack& rhs) const {
- return !operator > (rhs);
-}
-
-const void* CallStack::operator [] (int index) const {
- if (index >= int(mCount))
- return 0;
- return reinterpret_cast<const void*>(mStack[index].absolute_pc);
-}
-
-void CallStack::clear() {
- mCount = 0;
-}
-
-void CallStack::update(int32_t ignoreDepth, int32_t maxDepth) {
- if (maxDepth > MAX_DEPTH) {
- maxDepth = MAX_DEPTH;
- }
- ssize_t count = unwind_backtrace(mStack, ignoreDepth + 1, maxDepth);
- mCount = count > 0 ? count : 0;
-}
-
-void CallStack::dump(const char* prefix) const {
- backtrace_symbol_t symbols[mCount];
-
- get_backtrace_symbols(mStack, mCount, symbols);
- for (size_t i = 0; i < mCount; i++) {
- char line[MAX_BACKTRACE_LINE_LENGTH];
- format_backtrace_line(i, &mStack[i], &symbols[i],
- line, MAX_BACKTRACE_LINE_LENGTH);
- ALOGD("%s%s", prefix, line);
- }
- free_backtrace_symbols(symbols, mCount);
-}
-
-String8 CallStack::toString(const char* prefix) const {
- String8 str;
- backtrace_symbol_t symbols[mCount];
-
- get_backtrace_symbols(mStack, mCount, symbols);
- for (size_t i = 0; i < mCount; i++) {
- char line[MAX_BACKTRACE_LINE_LENGTH];
- format_backtrace_line(i, &mStack[i], &symbols[i],
- line, MAX_BACKTRACE_LINE_LENGTH);
- str.append(prefix);
- str.append(line);
- str.append("\n");
- }
- free_backtrace_symbols(symbols, mCount);
- return str;
-}
-
-}; // namespace android
diff --git a/libs/utils/Debug.cpp b/libs/utils/Debug.cpp
deleted file mode 100644
index e8ac983..0000000
--- a/libs/utils/Debug.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/Debug.h>
-
-#include <utils/misc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-namespace android {
-
-// ---------------------------------------------------------------------
-
-static const char indentStr[] =
-" "
-" ";
-
-const char* stringForIndent(int32_t indentLevel)
-{
- ssize_t off = sizeof(indentStr)-1-(indentLevel*2);
- return indentStr + (off < 0 ? 0 : off);
-}
-
-// ---------------------------------------------------------------------
-
-static void defaultPrintFunc(void* cookie, const char* txt)
-{
- printf("%s", txt);
-}
-
-// ---------------------------------------------------------------------
-
-static inline int isident(int c)
-{
- return isalnum(c) || c == '_';
-}
-
-static inline bool isasciitype(char c)
-{
- if( c >= ' ' && c < 127 && c != '\'' && c != '\\' ) return true;
- return false;
-}
-
-static inline char makehexdigit(uint32_t val)
-{
- return "0123456789abcdef"[val&0xF];
-}
-
-static char* appendhexnum(uint32_t val, char* out)
-{
- for( int32_t i=28; i>=0; i-=4 ) {
- *out++ = makehexdigit( val>>i );
- }
- *out = 0;
- return out;
-}
-
-static inline char makeupperhexdigit(uint32_t val)
-{
- return "0123456789ABCDEF"[val&0xF];
-}
-
-static char* appendupperhexnum(uint32_t val, char* out)
-{
- for( int32_t i=28; i>=0; i-=4 ) {
- *out++ = makeupperhexdigit( val>>i );
- }
- *out = 0;
- return out;
-}
-
-static char* appendcharornum(char c, char* out, bool skipzero = true)
-{
- if (skipzero && c == 0) return out;
-
- if (isasciitype(c)) {
- *out++ = c;
- return out;
- }
-
- *out++ = '\\';
- *out++ = 'x';
- *out++ = makehexdigit(c>>4);
- *out++ = makehexdigit(c);
- return out;
-}
-
-static char* typetostring(uint32_t type, char* out,
- bool fullContext = true,
- bool strict = false)
-{
- char* pos = out;
- char c[4];
- c[0] = (char)((type>>24)&0xFF);
- c[1] = (char)((type>>16)&0xFF);
- c[2] = (char)((type>>8)&0xFF);
- c[3] = (char)(type&0xFF);
- bool valid;
- if( !strict ) {
- // now even less strict!
- // valid = isasciitype(c[3]);
- valid = true;
- int32_t i = 0;
- bool zero = true;
- while (valid && i<3) {
- if (c[i] == 0) {
- if (!zero) valid = false;
- } else {
- zero = false;
- //if (!isasciitype(c[i])) valid = false;
- }
- i++;
- }
- // if all zeros, not a valid type code.
- if (zero) valid = false;
- } else {
- valid = isident(c[3]) ? true : false;
- int32_t i = 0;
- bool zero = true;
- while (valid && i<3) {
- if (c[i] == 0) {
- if (!zero) valid = false;
- } else {
- zero = false;
- if (!isident(c[i])) valid = false;
- }
- i++;
- }
- }
- if( valid && (!fullContext || c[0] != '0' || c[1] != 'x') ) {
- if( fullContext ) *pos++ = '\'';
- pos = appendcharornum(c[0], pos);
- pos = appendcharornum(c[1], pos);
- pos = appendcharornum(c[2], pos);
- pos = appendcharornum(c[3], pos);
- if( fullContext ) *pos++ = '\'';
- *pos = 0;
- return pos;
- }
-
- if( fullContext ) {
- *pos++ = '0';
- *pos++ = 'x';
- }
- return appendhexnum(type, pos);
-}
-
-void printTypeCode(uint32_t typeCode, debugPrintFunc func, void* cookie)
-{
- char buffer[32];
- char* end = typetostring(typeCode, buffer);
- *end = 0;
- func ? (*func)(cookie, buffer) : defaultPrintFunc(cookie, buffer);
-}
-
-void printHexData(int32_t indent, const void *buf, size_t length,
- size_t bytesPerLine, int32_t singleLineBytesCutoff,
- size_t alignment, bool cStyle,
- debugPrintFunc func, void* cookie)
-{
- if (alignment == 0) {
- if (bytesPerLine >= 16) alignment = 4;
- else if (bytesPerLine >= 8) alignment = 2;
- else alignment = 1;
- }
- if (func == NULL) func = defaultPrintFunc;
-
- size_t offset;
-
- unsigned char *pos = (unsigned char *)buf;
-
- if (pos == NULL) {
- if (singleLineBytesCutoff < 0) func(cookie, "\n");
- func(cookie, "(NULL)");
- return;
- }
-
- if (length == 0) {
- if (singleLineBytesCutoff < 0) func(cookie, "\n");
- func(cookie, "(empty)");
- return;
- }
-
- if ((int32_t)length < 0) {
- if (singleLineBytesCutoff < 0) func(cookie, "\n");
- char buf[64];
- sprintf(buf, "(bad length: %zu)", length);
- func(cookie, buf);
- return;
- }
-
- char buffer[256];
- static const size_t maxBytesPerLine = (sizeof(buffer)-1-11-4)/(3+1);
-
- if (bytesPerLine > maxBytesPerLine) bytesPerLine = maxBytesPerLine;
-
- const bool oneLine = (int32_t)length <= singleLineBytesCutoff;
- bool newLine = false;
- if (cStyle) {
- indent++;
- func(cookie, "{\n");
- newLine = true;
- } else if (!oneLine) {
- func(cookie, "\n");
- newLine = true;
- }
-
- for (offset = 0; ; offset += bytesPerLine, pos += bytesPerLine) {
- long remain = length;
-
- char* c = buffer;
- if (!oneLine && !cStyle) {
- sprintf(c, "0x%08x: ", (int)offset);
- c += 12;
- }
-
- size_t index;
- size_t word;
-
- for (word = 0; word < bytesPerLine; ) {
-
-#ifdef HAVE_LITTLE_ENDIAN
- const size_t startIndex = word+(alignment-(alignment?1:0));
- const ssize_t dir = -1;
-#else
- const size_t startIndex = word;
- const ssize_t dir = 1;
-#endif
-
- for (index = 0; index < alignment || (alignment == 0 && index < bytesPerLine); index++) {
-
- if (!cStyle) {
- if (index == 0 && word > 0 && alignment > 0) {
- *c++ = ' ';
- }
-
- if (remain-- > 0) {
- const unsigned char val = *(pos+startIndex+(index*dir));
- *c++ = makehexdigit(val>>4);
- *c++ = makehexdigit(val);
- } else if (!oneLine) {
- *c++ = ' ';
- *c++ = ' ';
- }
- } else {
- if (remain > 0) {
- if (index == 0 && word > 0) {
- *c++ = ',';
- *c++ = ' ';
- }
- if (index == 0) {
- *c++ = '0';
- *c++ = 'x';
- }
- const unsigned char val = *(pos+startIndex+(index*dir));
- *c++ = makehexdigit(val>>4);
- *c++ = makehexdigit(val);
- remain--;
- }
- }
- }
-
- word += index;
- }
-
- if (!cStyle) {
- remain = length;
- *c++ = ' ';
- *c++ = '\'';
- for (index = 0; index < bytesPerLine; index++) {
-
- if (remain-- > 0) {
- const unsigned char val = pos[index];
- *c++ = (val >= ' ' && val < 127) ? val : '.';
- } else if (!oneLine) {
- *c++ = ' ';
- }
- }
-
- *c++ = '\'';
- if (length > bytesPerLine) *c++ = '\n';
- } else {
- if (remain > 0) *c++ = ',';
- *c++ = '\n';
- }
-
- if (newLine && indent) func(cookie, stringForIndent(indent));
- *c = 0;
- func(cookie, buffer);
- newLine = true;
-
- if (length <= bytesPerLine) break;
- length -= bytesPerLine;
- }
-
- if (cStyle) {
- if (indent > 0) func(cookie, stringForIndent(indent-1));
- func(cookie, "};");
- }
-}
-
-}; // namespace android
-
diff --git a/libs/utils/FileMap.cpp b/libs/utils/FileMap.cpp
deleted file mode 100644
index 9ce370e..0000000
--- a/libs/utils/FileMap.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Shared file mapping class.
-//
-
-#define LOG_TAG "filemap"
-
-#include <utils/FileMap.h>
-#include <utils/Log.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_POSIX_FILEMAP
-#include <sys/mman.h>
-#endif
-
-#include <string.h>
-#include <memory.h>
-#include <errno.h>
-#include <assert.h>
-
-using namespace android;
-
-/*static*/ long FileMap::mPageSize = -1;
-
-
-/*
- * Constructor. Create an empty object.
- */
-FileMap::FileMap(void)
- : mRefCount(1), mFileName(NULL), mBasePtr(NULL), mBaseLength(0),
- mDataPtr(NULL), mDataLength(0)
-{
-}
-
-/*
- * Destructor.
- */
-FileMap::~FileMap(void)
-{
- assert(mRefCount == 0);
-
- //printf("+++ removing FileMap %p %u\n", mDataPtr, mDataLength);
-
- mRefCount = -100; // help catch double-free
- if (mFileName != NULL) {
- free(mFileName);
- }
-#ifdef HAVE_POSIX_FILEMAP
- if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) {
- ALOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength);
- }
-#endif
-#ifdef HAVE_WIN32_FILEMAP
- if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) {
- ALOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr,
- GetLastError() );
- }
- if (mFileMapping != INVALID_HANDLE_VALUE) {
- CloseHandle(mFileMapping);
- }
- CloseHandle(mFileHandle);
-#endif
-}
-
-
-/*
- * Create a new mapping on an open file.
- *
- * Closing the file descriptor does not unmap the pages, so we don't
- * claim ownership of the fd.
- *
- * Returns "false" on failure.
- */
-bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length,
- bool readOnly)
-{
-#ifdef HAVE_WIN32_FILEMAP
- int adjust;
- off64_t adjOffset;
- size_t adjLength;
-
- if (mPageSize == -1) {
- SYSTEM_INFO si;
-
- GetSystemInfo( &si );
- mPageSize = si.dwAllocationGranularity;
- }
-
- DWORD protect = readOnly ? PAGE_READONLY : PAGE_READWRITE;
-
- mFileHandle = (HANDLE) _get_osfhandle(fd);
- mFileMapping = CreateFileMapping( mFileHandle, NULL, protect, 0, 0, NULL);
- if (mFileMapping == NULL) {
- ALOGE("CreateFileMapping(%p, %lx) failed with error %ld\n",
- mFileHandle, protect, GetLastError() );
- return false;
- }
-
- adjust = offset % mPageSize;
- adjOffset = offset - adjust;
- adjLength = length + adjust;
-
- mBasePtr = MapViewOfFile( mFileMapping,
- readOnly ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS,
- 0,
- (DWORD)(adjOffset),
- adjLength );
- if (mBasePtr == NULL) {
- ALOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n",
- adjOffset, adjLength, GetLastError() );
- CloseHandle(mFileMapping);
- mFileMapping = INVALID_HANDLE_VALUE;
- return false;
- }
-#endif
-#ifdef HAVE_POSIX_FILEMAP
- int prot, flags, adjust;
- off64_t adjOffset;
- size_t adjLength;
-
- void* ptr;
-
- assert(mRefCount == 1);
- assert(fd >= 0);
- assert(offset >= 0);
- assert(length > 0);
-
- /* init on first use */
- if (mPageSize == -1) {
-#if NOT_USING_KLIBC
- mPageSize = sysconf(_SC_PAGESIZE);
- if (mPageSize == -1) {
- ALOGE("could not get _SC_PAGESIZE\n");
- return false;
- }
-#else
- /* this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM */
- mPageSize = 4096;
-#endif
- }
-
- adjust = offset % mPageSize;
-try_again:
- adjOffset = offset - adjust;
- adjLength = length + adjust;
-
- flags = MAP_SHARED;
- prot = PROT_READ;
- if (!readOnly)
- prot |= PROT_WRITE;
-
- ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset);
- if (ptr == MAP_FAILED) {
- // Cygwin does not seem to like file mapping files from an offset.
- // So if we fail, try again with offset zero
- if (adjOffset > 0) {
- adjust = offset;
- goto try_again;
- }
-
- ALOGE("mmap(%ld,%ld) failed: %s\n",
- (long) adjOffset, (long) adjLength, strerror(errno));
- return false;
- }
- mBasePtr = ptr;
-#endif /* HAVE_POSIX_FILEMAP */
-
- mFileName = origFileName != NULL ? strdup(origFileName) : NULL;
- mBaseLength = adjLength;
- mDataOffset = offset;
- mDataPtr = (char*) mBasePtr + adjust;
- mDataLength = length;
-
- assert(mBasePtr != NULL);
-
- ALOGV("MAP: base %p/%d data %p/%d\n",
- mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength);
-
- return true;
-}
-
-/*
- * Provide guidance to the system.
- */
-int FileMap::advise(MapAdvice advice)
-{
-#if HAVE_MADVISE
- int cc, sysAdvice;
-
- switch (advice) {
- case NORMAL: sysAdvice = MADV_NORMAL; break;
- case RANDOM: sysAdvice = MADV_RANDOM; break;
- case SEQUENTIAL: sysAdvice = MADV_SEQUENTIAL; break;
- case WILLNEED: sysAdvice = MADV_WILLNEED; break;
- case DONTNEED: sysAdvice = MADV_DONTNEED; break;
- default:
- assert(false);
- return -1;
- }
-
- cc = madvise(mBasePtr, mBaseLength, sysAdvice);
- if (cc != 0)
- ALOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno));
- return cc;
-#else
- return -1;
-#endif // HAVE_MADVISE
-}
diff --git a/libs/utils/Flattenable.cpp b/libs/utils/Flattenable.cpp
deleted file mode 100644
index 1f2ffaa..0000000
--- a/libs/utils/Flattenable.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/Flattenable.h>
-
-namespace android {
-
-Flattenable::~Flattenable() {
-}
-
-}; // namespace android
diff --git a/libs/utils/LinearTransform.cpp b/libs/utils/LinearTransform.cpp
deleted file mode 100644
index d752415..0000000
--- a/libs/utils/LinearTransform.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#define __STDC_LIMIT_MACROS
-
-#include <assert.h>
-#include <stdint.h>
-
-#include <utils/LinearTransform.h>
-
-namespace android {
-
-template<class T> static inline T ABS(T x) { return (x < 0) ? -x : x; }
-
-// Static math methods involving linear transformations
-static bool scale_u64_to_u64(
- uint64_t val,
- uint32_t N,
- uint32_t D,
- uint64_t* res,
- bool round_up_not_down) {
- uint64_t tmp1, tmp2;
- uint32_t r;
-
- assert(res);
- assert(D);
-
- // Let U32(X) denote a uint32_t containing the upper 32 bits of a 64 bit
- // integer X.
- // Let L32(X) denote a uint32_t containing the lower 32 bits of a 64 bit
- // integer X.
- // Let X[A, B] with A <= B denote bits A through B of the integer X.
- // Let (A | B) denote the concatination of two 32 bit ints, A and B.
- // IOW X = (A | B) => U32(X) == A && L32(X) == B
- //
- // compute M = val * N (a 96 bit int)
- // ---------------------------------
- // tmp2 = U32(val) * N (a 64 bit int)
- // tmp1 = L32(val) * N (a 64 bit int)
- // which means
- // M = val * N = (tmp2 << 32) + tmp1
- tmp2 = (val >> 32) * N;
- tmp1 = (val & UINT32_MAX) * N;
-
- // compute M[32, 95]
- // tmp2 = tmp2 + U32(tmp1)
- // = (U32(val) * N) + U32(L32(val) * N)
- // = M[32, 95]
- tmp2 += tmp1 >> 32;
-
- // if M[64, 95] >= D, then M/D has bits > 63 set and we have
- // an overflow.
- if ((tmp2 >> 32) >= D) {
- *res = UINT64_MAX;
- return false;
- }
-
- // Divide. Going in we know
- // tmp2 = M[32, 95]
- // U32(tmp2) < D
- r = tmp2 % D;
- tmp2 /= D;
-
- // At this point
- // tmp1 = L32(val) * N
- // tmp2 = M[32, 95] / D
- // = (M / D)[32, 95]
- // r = M[32, 95] % D
- // U32(tmp2) = 0
- //
- // compute tmp1 = (r | M[0, 31])
- tmp1 = (tmp1 & UINT32_MAX) | ((uint64_t)r << 32);
-
- // Divide again. Keep the remainder around in order to round properly.
- r = tmp1 % D;
- tmp1 /= D;
-
- // At this point
- // tmp2 = (M / D)[32, 95]
- // tmp1 = (M / D)[ 0, 31]
- // r = M % D
- // U32(tmp1) = 0
- // U32(tmp2) = 0
-
- // Pack the result and deal with the round-up case (As well as the
- // remote possiblility over overflow in such a case).
- *res = (tmp2 << 32) | tmp1;
- if (r && round_up_not_down) {
- ++(*res);
- if (!(*res)) {
- *res = UINT64_MAX;
- return false;
- }
- }
-
- return true;
-}
-
-static bool linear_transform_s64_to_s64(
- int64_t val,
- int64_t basis1,
- int32_t N,
- uint32_t D,
- int64_t basis2,
- int64_t* out) {
- uint64_t scaled, res;
- uint64_t abs_val;
- bool is_neg;
-
- if (!out)
- return false;
-
- // Compute abs(val - basis_64). Keep track of whether or not this delta
- // will be negative after the scale opertaion.
- if (val < basis1) {
- is_neg = true;
- abs_val = basis1 - val;
- } else {
- is_neg = false;
- abs_val = val - basis1;
- }
-
- if (N < 0)
- is_neg = !is_neg;
-
- if (!scale_u64_to_u64(abs_val,
- ABS(N),
- D,
- &scaled,
- is_neg))
- return false; // overflow/undeflow
-
- // if scaled is >= 0x8000<etc>, then we are going to overflow or
- // underflow unless ABS(basis2) is large enough to pull us back into the
- // non-overflow/underflow region.
- if (scaled & INT64_MIN) {
- if (is_neg && (basis2 < 0))
- return false; // certain underflow
-
- if (!is_neg && (basis2 >= 0))
- return false; // certain overflow
-
- if (ABS(basis2) <= static_cast<int64_t>(scaled & INT64_MAX))
- return false; // not enough
-
- // Looks like we are OK
- *out = (is_neg ? (-scaled) : scaled) + basis2;
- } else {
- // Scaled fits within signed bounds, so we just need to check for
- // over/underflow for two signed integers. Basically, if both scaled
- // and basis2 have the same sign bit, and the result has a different
- // sign bit, then we have under/overflow. An easy way to compute this
- // is
- // (scaled_signbit XNOR basis_signbit) &&
- // (scaled_signbit XOR res_signbit)
- // ==
- // (scaled_signbit XOR basis_signbit XOR 1) &&
- // (scaled_signbit XOR res_signbit)
-
- if (is_neg)
- scaled = -scaled;
- res = scaled + basis2;
-
- if ((scaled ^ basis2 ^ INT64_MIN) & (scaled ^ res) & INT64_MIN)
- return false;
-
- *out = res;
- }
-
- return true;
-}
-
-bool LinearTransform::doForwardTransform(int64_t a_in, int64_t* b_out) const {
- if (0 == a_to_b_denom)
- return false;
-
- return linear_transform_s64_to_s64(a_in,
- a_zero,
- a_to_b_numer,
- a_to_b_denom,
- b_zero,
- b_out);
-}
-
-bool LinearTransform::doReverseTransform(int64_t b_in, int64_t* a_out) const {
- if (0 == a_to_b_numer)
- return false;
-
- return linear_transform_s64_to_s64(b_in,
- b_zero,
- a_to_b_denom,
- a_to_b_numer,
- a_zero,
- a_out);
-}
-
-template <class T> void LinearTransform::reduce(T* N, T* D) {
- T a, b;
- if (!N || !D || !(*D)) {
- assert(false);
- return;
- }
-
- a = *N;
- b = *D;
-
- if (a == 0) {
- *D = 1;
- return;
- }
-
- // This implements Euclid's method to find GCD.
- if (a < b) {
- T tmp = a;
- a = b;
- b = tmp;
- }
-
- while (1) {
- // a is now the greater of the two.
- const T remainder = a % b;
- if (remainder == 0) {
- *N /= b;
- *D /= b;
- return;
- }
- // by swapping remainder and b, we are guaranteeing that a is
- // still the greater of the two upon entrance to the loop.
- a = b;
- b = remainder;
- }
-};
-
-template void LinearTransform::reduce<uint64_t>(uint64_t* N, uint64_t* D);
-template void LinearTransform::reduce<uint32_t>(uint32_t* N, uint32_t* D);
-
-void LinearTransform::reduce(int32_t* N, uint32_t* D) {
- if (N && D && *D) {
- if (*N < 0) {
- *N = -(*N);
- reduce(reinterpret_cast<uint32_t*>(N), D);
- *N = -(*N);
- } else {
- reduce(reinterpret_cast<uint32_t*>(N), D);
- }
- }
-}
-
-} // namespace android
diff --git a/libs/utils/Looper.cpp b/libs/utils/Looper.cpp
deleted file mode 100644
index d1aa664..0000000
--- a/libs/utils/Looper.cpp
+++ /dev/null
@@ -1,744 +0,0 @@
-//
-// Copyright 2010 The Android Open Source Project
-//
-// A looper implementation based on epoll().
-//
-#define LOG_TAG "Looper"
-
-//#define LOG_NDEBUG 0
-
-// Debugs poll and wake interactions.
-#define DEBUG_POLL_AND_WAKE 0
-
-// Debugs callback registration and invocation.
-#define DEBUG_CALLBACKS 0
-
-#include <cutils/log.h>
-#include <utils/Looper.h>
-#include <utils/Timers.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
-
-
-namespace android {
-
-// --- WeakMessageHandler ---
-
-WeakMessageHandler::WeakMessageHandler(const wp<MessageHandler>& handler) :
- mHandler(handler) {
-}
-
-void WeakMessageHandler::handleMessage(const Message& message) {
- sp<MessageHandler> handler = mHandler.promote();
- if (handler != NULL) {
- handler->handleMessage(message);
- }
-}
-
-
-// --- Looper ---
-
-#ifdef LOOPER_USES_EPOLL
-// Hint for number of file descriptors to be associated with the epoll instance.
-static const int EPOLL_SIZE_HINT = 8;
-
-// Maximum number of file descriptors for which to retrieve poll events each iteration.
-static const int EPOLL_MAX_EVENTS = 16;
-#endif
-
-static pthread_once_t gTLSOnce = PTHREAD_ONCE_INIT;
-static pthread_key_t gTLSKey = 0;
-
-Looper::Looper(bool allowNonCallbacks) :
- mAllowNonCallbacks(allowNonCallbacks), mSendingMessage(false),
- mResponseIndex(0), mNextMessageUptime(LLONG_MAX) {
- int wakeFds[2];
- int result = pipe(wakeFds);
- LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe. errno=%d", errno);
-
- mWakeReadPipeFd = wakeFds[0];
- mWakeWritePipeFd = wakeFds[1];
-
- result = fcntl(mWakeReadPipeFd, F_SETFL, O_NONBLOCK);
- LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake read pipe non-blocking. errno=%d",
- errno);
-
- result = fcntl(mWakeWritePipeFd, F_SETFL, O_NONBLOCK);
- LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake write pipe non-blocking. errno=%d",
- errno);
-
-#ifdef LOOPER_USES_EPOLL
- // Allocate the epoll instance and register the wake pipe.
- mEpollFd = epoll_create(EPOLL_SIZE_HINT);
- LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
-
- struct epoll_event eventItem;
- memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union
- eventItem.events = EPOLLIN;
- eventItem.data.fd = mWakeReadPipeFd;
- result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, & eventItem);
- LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance. errno=%d",
- errno);
-#else
- // Add the wake pipe to the head of the request list with a null callback.
- struct pollfd requestedFd;
- requestedFd.fd = mWakeReadPipeFd;
- requestedFd.events = POLLIN;
- mRequestedFds.push(requestedFd);
-
- Request request;
- request.fd = mWakeReadPipeFd;
- request.callback = NULL;
- request.ident = 0;
- request.data = NULL;
- mRequests.push(request);
-
- mPolling = false;
- mWaiters = 0;
-#endif
-
-#ifdef LOOPER_STATISTICS
- mPendingWakeTime = -1;
- mPendingWakeCount = 0;
- mSampledWakeCycles = 0;
- mSampledWakeCountSum = 0;
- mSampledWakeLatencySum = 0;
-
- mSampledPolls = 0;
- mSampledZeroPollCount = 0;
- mSampledZeroPollLatencySum = 0;
- mSampledTimeoutPollCount = 0;
- mSampledTimeoutPollLatencySum = 0;
-#endif
-}
-
-Looper::~Looper() {
- close(mWakeReadPipeFd);
- close(mWakeWritePipeFd);
-#ifdef LOOPER_USES_EPOLL
- close(mEpollFd);
-#endif
-}
-
-void Looper::initTLSKey() {
- int result = pthread_key_create(& gTLSKey, threadDestructor);
- LOG_ALWAYS_FATAL_IF(result != 0, "Could not allocate TLS key.");
-}
-
-void Looper::threadDestructor(void *st) {
- Looper* const self = static_cast<Looper*>(st);
- if (self != NULL) {
- self->decStrong((void*)threadDestructor);
- }
-}
-
-void Looper::setForThread(const sp<Looper>& looper) {
- sp<Looper> old = getForThread(); // also has side-effect of initializing TLS
-
- if (looper != NULL) {
- looper->incStrong((void*)threadDestructor);
- }
-
- pthread_setspecific(gTLSKey, looper.get());
-
- if (old != NULL) {
- old->decStrong((void*)threadDestructor);
- }
-}
-
-sp<Looper> Looper::getForThread() {
- int result = pthread_once(& gTLSOnce, initTLSKey);
- LOG_ALWAYS_FATAL_IF(result != 0, "pthread_once failed");
-
- return (Looper*)pthread_getspecific(gTLSKey);
-}
-
-sp<Looper> Looper::prepare(int opts) {
- bool allowNonCallbacks = opts & ALOOPER_PREPARE_ALLOW_NON_CALLBACKS;
- sp<Looper> looper = Looper::getForThread();
- if (looper == NULL) {
- looper = new Looper(allowNonCallbacks);
- Looper::setForThread(looper);
- }
- if (looper->getAllowNonCallbacks() != allowNonCallbacks) {
- ALOGW("Looper already prepared for this thread with a different value for the "
- "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option.");
- }
- return looper;
-}
-
-bool Looper::getAllowNonCallbacks() const {
- return mAllowNonCallbacks;
-}
-
-int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData) {
- int result = 0;
- for (;;) {
- while (mResponseIndex < mResponses.size()) {
- const Response& response = mResponses.itemAt(mResponseIndex++);
- ALooper_callbackFunc callback = response.request.callback;
- if (!callback) {
- int ident = response.request.ident;
- int fd = response.request.fd;
- int events = response.events;
- void* data = response.request.data;
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ pollOnce - returning signalled identifier %d: "
- "fd=%d, events=0x%x, data=%p",
- this, ident, fd, events, data);
-#endif
- if (outFd != NULL) *outFd = fd;
- if (outEvents != NULL) *outEvents = events;
- if (outData != NULL) *outData = data;
- return ident;
- }
- }
-
- if (result != 0) {
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ pollOnce - returning result %d", this, result);
-#endif
- if (outFd != NULL) *outFd = 0;
- if (outEvents != NULL) *outEvents = NULL;
- if (outData != NULL) *outData = NULL;
- return result;
- }
-
- result = pollInner(timeoutMillis);
- }
-}
-
-int Looper::pollInner(int timeoutMillis) {
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis);
-#endif
-
- // Adjust the timeout based on when the next message is due.
- if (timeoutMillis != 0 && mNextMessageUptime != LLONG_MAX) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- int messageTimeoutMillis = toMillisecondTimeoutDelay(now, mNextMessageUptime);
- if (messageTimeoutMillis >= 0
- && (timeoutMillis < 0 || messageTimeoutMillis < timeoutMillis)) {
- timeoutMillis = messageTimeoutMillis;
- }
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d",
- this, mNextMessageUptime - now, timeoutMillis);
-#endif
- }
-
- // Poll.
- int result = ALOOPER_POLL_WAKE;
- mResponses.clear();
- mResponseIndex = 0;
-
-#ifdef LOOPER_STATISTICS
- nsecs_t pollStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
-#endif
-
-#ifdef LOOPER_USES_EPOLL
- struct epoll_event eventItems[EPOLL_MAX_EVENTS];
- int eventCount = epoll_wait(mEpollFd, eventItems, EPOLL_MAX_EVENTS, timeoutMillis);
-#else
- // Wait for wakeAndLock() waiters to run then set mPolling to true.
- mLock.lock();
- while (mWaiters != 0) {
- mResume.wait(mLock);
- }
- mPolling = true;
- mLock.unlock();
-
- size_t requestedCount = mRequestedFds.size();
- int eventCount = poll(mRequestedFds.editArray(), requestedCount, timeoutMillis);
-#endif
-
- // Acquire lock.
- mLock.lock();
-
- // Check for poll error.
- if (eventCount < 0) {
- if (errno == EINTR) {
- goto Done;
- }
- ALOGW("Poll failed with an unexpected error, errno=%d", errno);
- result = ALOOPER_POLL_ERROR;
- goto Done;
- }
-
- // Check for poll timeout.
- if (eventCount == 0) {
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ pollOnce - timeout", this);
-#endif
- result = ALOOPER_POLL_TIMEOUT;
- goto Done;
- }
-
- // Handle all events.
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount);
-#endif
-
-#ifdef LOOPER_USES_EPOLL
- for (int i = 0; i < eventCount; i++) {
- int fd = eventItems[i].data.fd;
- uint32_t epollEvents = eventItems[i].events;
- if (fd == mWakeReadPipeFd) {
- if (epollEvents & EPOLLIN) {
- awoken();
- } else {
- ALOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents);
- }
- } else {
- ssize_t requestIndex = mRequests.indexOfKey(fd);
- if (requestIndex >= 0) {
- int events = 0;
- if (epollEvents & EPOLLIN) events |= ALOOPER_EVENT_INPUT;
- if (epollEvents & EPOLLOUT) events |= ALOOPER_EVENT_OUTPUT;
- if (epollEvents & EPOLLERR) events |= ALOOPER_EVENT_ERROR;
- if (epollEvents & EPOLLHUP) events |= ALOOPER_EVENT_HANGUP;
- pushResponse(events, mRequests.valueAt(requestIndex));
- } else {
- ALOGW("Ignoring unexpected epoll events 0x%x on fd %d that is "
- "no longer registered.", epollEvents, fd);
- }
- }
- }
-Done: ;
-#else
- for (size_t i = 0; i < requestedCount; i++) {
- const struct pollfd& requestedFd = mRequestedFds.itemAt(i);
-
- short pollEvents = requestedFd.revents;
- if (pollEvents) {
- if (requestedFd.fd == mWakeReadPipeFd) {
- if (pollEvents & POLLIN) {
- awoken();
- } else {
- ALOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents);
- }
- } else {
- int events = 0;
- if (pollEvents & POLLIN) events |= ALOOPER_EVENT_INPUT;
- if (pollEvents & POLLOUT) events |= ALOOPER_EVENT_OUTPUT;
- if (pollEvents & POLLERR) events |= ALOOPER_EVENT_ERROR;
- if (pollEvents & POLLHUP) events |= ALOOPER_EVENT_HANGUP;
- if (pollEvents & POLLNVAL) events |= ALOOPER_EVENT_INVALID;
- pushResponse(events, mRequests.itemAt(i));
- }
- if (--eventCount == 0) {
- break;
- }
- }
- }
-Done:
- // Set mPolling to false and wake up the wakeAndLock() waiters.
- mPolling = false;
- if (mWaiters != 0) {
- mAwake.broadcast();
- }
-#endif
-
-#ifdef LOOPER_STATISTICS
- nsecs_t pollEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
- mSampledPolls += 1;
- if (timeoutMillis == 0) {
- mSampledZeroPollCount += 1;
- mSampledZeroPollLatencySum += pollEndTime - pollStartTime;
- } else if (timeoutMillis > 0 && result == ALOOPER_POLL_TIMEOUT) {
- mSampledTimeoutPollCount += 1;
- mSampledTimeoutPollLatencySum += pollEndTime - pollStartTime
- - milliseconds_to_nanoseconds(timeoutMillis);
- }
- if (mSampledPolls == SAMPLED_POLLS_TO_AGGREGATE) {
- ALOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this,
- 0.000001f * float(mSampledZeroPollLatencySum) / mSampledZeroPollCount,
- 0.000001f * float(mSampledTimeoutPollLatencySum) / mSampledTimeoutPollCount);
- mSampledPolls = 0;
- mSampledZeroPollCount = 0;
- mSampledZeroPollLatencySum = 0;
- mSampledTimeoutPollCount = 0;
- mSampledTimeoutPollLatencySum = 0;
- }
-#endif
-
- // Invoke pending message callbacks.
- mNextMessageUptime = LLONG_MAX;
- while (mMessageEnvelopes.size() != 0) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(0);
- if (messageEnvelope.uptime <= now) {
- // Remove the envelope from the list.
- // We keep a strong reference to the handler until the call to handleMessage
- // finishes. Then we drop it so that the handler can be deleted *before*
- // we reacquire our lock.
- { // obtain handler
- sp<MessageHandler> handler = messageEnvelope.handler;
- Message message = messageEnvelope.message;
- mMessageEnvelopes.removeAt(0);
- mSendingMessage = true;
- mLock.unlock();
-
-#if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS
- ALOGD("%p ~ pollOnce - sending message: handler=%p, what=%d",
- this, handler.get(), message.what);
-#endif
- handler->handleMessage(message);
- } // release handler
-
- mLock.lock();
- mSendingMessage = false;
- result = ALOOPER_POLL_CALLBACK;
- } else {
- // The last message left at the head of the queue determines the next wakeup time.
- mNextMessageUptime = messageEnvelope.uptime;
- break;
- }
- }
-
- // Release lock.
- mLock.unlock();
-
- // Invoke all response callbacks.
- for (size_t i = 0; i < mResponses.size(); i++) {
- const Response& response = mResponses.itemAt(i);
- ALooper_callbackFunc callback = response.request.callback;
- if (callback) {
- int fd = response.request.fd;
- int events = response.events;
- void* data = response.request.data;
-#if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS
- ALOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p",
- this, callback, fd, events, data);
-#endif
- int callbackResult = callback(fd, events, data);
- if (callbackResult == 0) {
- removeFd(fd);
- }
- result = ALOOPER_POLL_CALLBACK;
- }
- }
- return result;
-}
-
-int Looper::pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData) {
- if (timeoutMillis <= 0) {
- int result;
- do {
- result = pollOnce(timeoutMillis, outFd, outEvents, outData);
- } while (result == ALOOPER_POLL_CALLBACK);
- return result;
- } else {
- nsecs_t endTime = systemTime(SYSTEM_TIME_MONOTONIC)
- + milliseconds_to_nanoseconds(timeoutMillis);
-
- for (;;) {
- int result = pollOnce(timeoutMillis, outFd, outEvents, outData);
- if (result != ALOOPER_POLL_CALLBACK) {
- return result;
- }
-
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- timeoutMillis = toMillisecondTimeoutDelay(now, endTime);
- if (timeoutMillis == 0) {
- return ALOOPER_POLL_TIMEOUT;
- }
- }
- }
-}
-
-void Looper::wake() {
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ wake", this);
-#endif
-
-#ifdef LOOPER_STATISTICS
- // FIXME: Possible race with awoken() but this code is for testing only and is rarely enabled.
- if (mPendingWakeCount++ == 0) {
- mPendingWakeTime = systemTime(SYSTEM_TIME_MONOTONIC);
- }
-#endif
-
- ssize_t nWrite;
- do {
- nWrite = write(mWakeWritePipeFd, "W", 1);
- } while (nWrite == -1 && errno == EINTR);
-
- if (nWrite != 1) {
- if (errno != EAGAIN) {
- ALOGW("Could not write wake signal, errno=%d", errno);
- }
- }
-}
-
-void Looper::awoken() {
-#if DEBUG_POLL_AND_WAKE
- ALOGD("%p ~ awoken", this);
-#endif
-
-#ifdef LOOPER_STATISTICS
- if (mPendingWakeCount == 0) {
- ALOGD("%p ~ awoken: spurious!", this);
- } else {
- mSampledWakeCycles += 1;
- mSampledWakeCountSum += mPendingWakeCount;
- mSampledWakeLatencySum += systemTime(SYSTEM_TIME_MONOTONIC) - mPendingWakeTime;
- mPendingWakeCount = 0;
- mPendingWakeTime = -1;
- if (mSampledWakeCycles == SAMPLED_WAKE_CYCLES_TO_AGGREGATE) {
- ALOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this,
- 0.000001f * float(mSampledWakeLatencySum) / mSampledWakeCycles,
- float(mSampledWakeCountSum) / mSampledWakeCycles);
- mSampledWakeCycles = 0;
- mSampledWakeCountSum = 0;
- mSampledWakeLatencySum = 0;
- }
- }
-#endif
-
- char buffer[16];
- ssize_t nRead;
- do {
- nRead = read(mWakeReadPipeFd, buffer, sizeof(buffer));
- } while ((nRead == -1 && errno == EINTR) || nRead == sizeof(buffer));
-}
-
-void Looper::pushResponse(int events, const Request& request) {
- Response response;
- response.events = events;
- response.request = request;
- mResponses.push(response);
-}
-
-int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data) {
-#if DEBUG_CALLBACKS
- ALOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident,
- events, callback, data);
-#endif
-
- if (! callback) {
- if (! mAllowNonCallbacks) {
- ALOGE("Invalid attempt to set NULL callback but not allowed for this looper.");
- return -1;
- }
-
- if (ident < 0) {
- ALOGE("Invalid attempt to set NULL callback with ident <= 0.");
- return -1;
- }
- }
-
-#ifdef LOOPER_USES_EPOLL
- int epollEvents = 0;
- if (events & ALOOPER_EVENT_INPUT) epollEvents |= EPOLLIN;
- if (events & ALOOPER_EVENT_OUTPUT) epollEvents |= EPOLLOUT;
-
- { // acquire lock
- AutoMutex _l(mLock);
-
- Request request;
- request.fd = fd;
- request.ident = ident;
- request.callback = callback;
- request.data = data;
-
- struct epoll_event eventItem;
- memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union
- eventItem.events = epollEvents;
- eventItem.data.fd = fd;
-
- ssize_t requestIndex = mRequests.indexOfKey(fd);
- if (requestIndex < 0) {
- int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, & eventItem);
- if (epollResult < 0) {
- ALOGE("Error adding epoll events for fd %d, errno=%d", fd, errno);
- return -1;
- }
- mRequests.add(fd, request);
- } else {
- int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_MOD, fd, & eventItem);
- if (epollResult < 0) {
- ALOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno);
- return -1;
- }
- mRequests.replaceValueAt(requestIndex, request);
- }
- } // release lock
-#else
- int pollEvents = 0;
- if (events & ALOOPER_EVENT_INPUT) pollEvents |= POLLIN;
- if (events & ALOOPER_EVENT_OUTPUT) pollEvents |= POLLOUT;
-
- wakeAndLock(); // acquire lock
-
- struct pollfd requestedFd;
- requestedFd.fd = fd;
- requestedFd.events = pollEvents;
-
- Request request;
- request.fd = fd;
- request.ident = ident;
- request.callback = callback;
- request.data = data;
- ssize_t index = getRequestIndexLocked(fd);
- if (index < 0) {
- mRequestedFds.push(requestedFd);
- mRequests.push(request);
- } else {
- mRequestedFds.replaceAt(requestedFd, size_t(index));
- mRequests.replaceAt(request, size_t(index));
- }
-
- mLock.unlock(); // release lock
-#endif
- return 1;
-}
-
-int Looper::removeFd(int fd) {
-#if DEBUG_CALLBACKS
- ALOGD("%p ~ removeFd - fd=%d", this, fd);
-#endif
-
-#ifdef LOOPER_USES_EPOLL
- { // acquire lock
- AutoMutex _l(mLock);
- ssize_t requestIndex = mRequests.indexOfKey(fd);
- if (requestIndex < 0) {
- return 0;
- }
-
- int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_DEL, fd, NULL);
- if (epollResult < 0) {
- ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno);
- return -1;
- }
-
- mRequests.removeItemsAt(requestIndex);
- } // release lock
- return 1;
-#else
- wakeAndLock(); // acquire lock
-
- ssize_t index = getRequestIndexLocked(fd);
- if (index >= 0) {
- mRequestedFds.removeAt(size_t(index));
- mRequests.removeAt(size_t(index));
- }
-
- mLock.unlock(); // release lock
- return index >= 0;
-#endif
-}
-
-#ifndef LOOPER_USES_EPOLL
-ssize_t Looper::getRequestIndexLocked(int fd) {
- size_t requestCount = mRequestedFds.size();
-
- for (size_t i = 0; i < requestCount; i++) {
- if (mRequestedFds.itemAt(i).fd == fd) {
- return i;
- }
- }
-
- return -1;
-}
-
-void Looper::wakeAndLock() {
- mLock.lock();
-
- mWaiters += 1;
- while (mPolling) {
- wake();
- mAwake.wait(mLock);
- }
-
- mWaiters -= 1;
- if (mWaiters == 0) {
- mResume.signal();
- }
-}
-#endif
-
-void Looper::sendMessage(const sp<MessageHandler>& handler, const Message& message) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- sendMessageAtTime(now, handler, message);
-}
-
-void Looper::sendMessageDelayed(nsecs_t uptimeDelay, const sp<MessageHandler>& handler,
- const Message& message) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- sendMessageAtTime(now + uptimeDelay, handler, message);
-}
-
-void Looper::sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler,
- const Message& message) {
-#if DEBUG_CALLBACKS
- ALOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d",
- this, uptime, handler.get(), message.what);
-#endif
-
- size_t i = 0;
- { // acquire lock
- AutoMutex _l(mLock);
-
- size_t messageCount = mMessageEnvelopes.size();
- while (i < messageCount && uptime >= mMessageEnvelopes.itemAt(i).uptime) {
- i += 1;
- }
-
- MessageEnvelope messageEnvelope(uptime, handler, message);
- mMessageEnvelopes.insertAt(messageEnvelope, i, 1);
-
- // Optimization: If the Looper is currently sending a message, then we can skip
- // the call to wake() because the next thing the Looper will do after processing
- // messages is to decide when the next wakeup time should be. In fact, it does
- // not even matter whether this code is running on the Looper thread.
- if (mSendingMessage) {
- return;
- }
- } // release lock
-
- // Wake the poll loop only when we enqueue a new message at the head.
- if (i == 0) {
- wake();
- }
-}
-
-void Looper::removeMessages(const sp<MessageHandler>& handler) {
-#if DEBUG_CALLBACKS
- ALOGD("%p ~ removeMessages - handler=%p", this, handler.get());
-#endif
-
- { // acquire lock
- AutoMutex _l(mLock);
-
- for (size_t i = mMessageEnvelopes.size(); i != 0; ) {
- const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(--i);
- if (messageEnvelope.handler == handler) {
- mMessageEnvelopes.removeAt(i);
- }
- }
- } // release lock
-}
-
-void Looper::removeMessages(const sp<MessageHandler>& handler, int what) {
-#if DEBUG_CALLBACKS
- ALOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what);
-#endif
-
- { // acquire lock
- AutoMutex _l(mLock);
-
- for (size_t i = mMessageEnvelopes.size(); i != 0; ) {
- const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(--i);
- if (messageEnvelope.handler == handler
- && messageEnvelope.message.what == what) {
- mMessageEnvelopes.removeAt(i);
- }
- }
- } // release lock
-}
-
-} // namespace android
diff --git a/libs/utils/MODULE_LICENSE_APACHE2 b/libs/utils/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libs/utils/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libs/utils/NOTICE b/libs/utils/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/libs/utils/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/libs/utils/PropertyMap.cpp b/libs/utils/PropertyMap.cpp
deleted file mode 100644
index 5520702..0000000
--- a/libs/utils/PropertyMap.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "PropertyMap"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <utils/PropertyMap.h>
-#include <utils/Log.h>
-
-// Enables debug output for the parser.
-#define DEBUG_PARSER 0
-
-// Enables debug output for parser performance.
-#define DEBUG_PARSER_PERFORMANCE 0
-
-
-namespace android {
-
-static const char* WHITESPACE = " \t\r";
-static const char* WHITESPACE_OR_PROPERTY_DELIMITER = " \t\r=";
-
-
-// --- PropertyMap ---
-
-PropertyMap::PropertyMap() {
-}
-
-PropertyMap::~PropertyMap() {
-}
-
-void PropertyMap::clear() {
- mProperties.clear();
-}
-
-void PropertyMap::addProperty(const String8& key, const String8& value) {
- mProperties.add(key, value);
-}
-
-bool PropertyMap::hasProperty(const String8& key) const {
- return mProperties.indexOfKey(key) >= 0;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, String8& outValue) const {
- ssize_t index = mProperties.indexOfKey(key);
- if (index < 0) {
- return false;
- }
-
- outValue = mProperties.valueAt(index);
- return true;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, bool& outValue) const {
- int32_t intValue;
- if (!tryGetProperty(key, intValue)) {
- return false;
- }
-
- outValue = intValue;
- return true;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, int32_t& outValue) const {
- String8 stringValue;
- if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) {
- return false;
- }
-
- char* end;
- int value = strtol(stringValue.string(), & end, 10);
- if (*end != '\0') {
- ALOGW("Property key '%s' has invalid value '%s'. Expected an integer.",
- key.string(), stringValue.string());
- return false;
- }
- outValue = value;
- return true;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, float& outValue) const {
- String8 stringValue;
- if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) {
- return false;
- }
-
- char* end;
- float value = strtof(stringValue.string(), & end);
- if (*end != '\0') {
- ALOGW("Property key '%s' has invalid value '%s'. Expected a float.",
- key.string(), stringValue.string());
- return false;
- }
- outValue = value;
- return true;
-}
-
-void PropertyMap::addAll(const PropertyMap* map) {
- for (size_t i = 0; i < map->mProperties.size(); i++) {
- mProperties.add(map->mProperties.keyAt(i), map->mProperties.valueAt(i));
- }
-}
-
-status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) {
- *outMap = NULL;
-
- Tokenizer* tokenizer;
- status_t status = Tokenizer::open(filename, &tokenizer);
- if (status) {
- ALOGE("Error %d opening property file %s.", status, filename.string());
- } else {
- PropertyMap* map = new PropertyMap();
- if (!map) {
- ALOGE("Error allocating property map.");
- status = NO_MEMORY;
- } else {
-#if DEBUG_PARSER_PERFORMANCE
- nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC);
-#endif
- Parser parser(map, tokenizer);
- status = parser.parse();
-#if DEBUG_PARSER_PERFORMANCE
- nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime;
- ALOGD("Parsed property file '%s' %d lines in %0.3fms.",
- tokenizer->getFilename().string(), tokenizer->getLineNumber(),
- elapsedTime / 1000000.0);
-#endif
- if (status) {
- delete map;
- } else {
- *outMap = map;
- }
- }
- delete tokenizer;
- }
- return status;
-}
-
-
-// --- PropertyMap::Parser ---
-
-PropertyMap::Parser::Parser(PropertyMap* map, Tokenizer* tokenizer) :
- mMap(map), mTokenizer(tokenizer) {
-}
-
-PropertyMap::Parser::~Parser() {
-}
-
-status_t PropertyMap::Parser::parse() {
- while (!mTokenizer->isEof()) {
-#if DEBUG_PARSER
- ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
- mTokenizer->peekRemainderOfLine().string());
-#endif
-
- mTokenizer->skipDelimiters(WHITESPACE);
-
- if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') {
- String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER);
- if (keyToken.isEmpty()) {
- ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string());
- return BAD_VALUE;
- }
-
- mTokenizer->skipDelimiters(WHITESPACE);
-
- if (mTokenizer->nextChar() != '=') {
- ALOGE("%s: Expected '=' between property key and value.",
- mTokenizer->getLocation().string());
- return BAD_VALUE;
- }
-
- mTokenizer->skipDelimiters(WHITESPACE);
-
- String8 valueToken = mTokenizer->nextToken(WHITESPACE);
- if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) {
- ALOGE("%s: Found reserved character '\\' or '\"' in property value.",
- mTokenizer->getLocation().string());
- return BAD_VALUE;
- }
-
- mTokenizer->skipDelimiters(WHITESPACE);
- if (!mTokenizer->isEol()) {
- ALOGE("%s: Expected end of line, got '%s'.",
- mTokenizer->getLocation().string(),
- mTokenizer->peekRemainderOfLine().string());
- return BAD_VALUE;
- }
-
- if (mMap->hasProperty(keyToken)) {
- ALOGE("%s: Duplicate property value for key '%s'.",
- mTokenizer->getLocation().string(), keyToken.string());
- return BAD_VALUE;
- }
-
- mMap->addProperty(keyToken, valueToken);
- }
-
- mTokenizer->nextLine();
- }
- return NO_ERROR;
-}
-
-} // namespace android
diff --git a/libs/utils/README b/libs/utils/README
deleted file mode 100644
index 01741e0..0000000
--- a/libs/utils/README
+++ /dev/null
@@ -1,289 +0,0 @@
-Android Utility Function Library
-================================
-
-
-If you need a feature that is native to Linux but not present on other
-platforms, construct a platform-dependent implementation that shares
-the Linux interface. That way the actual device runs as "light" as
-possible.
-
-If that isn't feasible, create a system-independent interface and hide
-the details.
-
-The ultimate goal is *not* to create a super-duper platform abstraction
-layer. The goal is to provide an optimized solution for Linux with
-reasonable implementations for other platforms.
-
-
-
-Resource overlay
-================
-
-
-Introduction
-------------
-
-Overlay packages are special .apk files which provide no code but
-additional resource values (and possibly new configurations) for
-resources in other packages. When an application requests resources,
-the system will return values from either the application's original
-package or any associated overlay package. Any redirection is completely
-transparent to the calling application.
-
-Resource values have the following precedence table, listed in
-descending precedence.
-
- * overlay package, matching config (eg res/values-en-land)
-
- * original package, matching config
-
- * overlay package, no config (eg res/values)
-
- * original package, no config
-
-During compilation, overlay packages are differentiated from regular
-packages by passing the -o flag to aapt.
-
-
-Background
-----------
-
-This section provides generic background material on resources in
-Android.
-
-
-How resources are bundled in .apk files
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Android .apk files are .zip files, usually housing .dex code,
-certificates and resources, though packages containing resources but
-no code are possible. Resources can be divided into the following
-categories; a `configuration' indicates a set of phone language, display
-density, network operator, etc.
-
- * assets: uncompressed, raw files packaged as part of an .apk and
- explicitly referenced by filename. These files are
- independent of configuration.
-
- * res/drawable: bitmap or xml graphics. Each file may have different
- values depending on configuration.
-
- * res/values: integers, strings, etc. Each resource may have different
- values depending on configuration.
-
-Resource meta information and information proper is stored in a binary
-format in a named file resources.arsc, bundled as part of the .apk.
-
-Resource IDs and lookup
-~~~~~~~~~~~~~~~~~~~~~~~
-During compilation, the aapt tool gathers application resources and
-generates a resources.arsc file. Each resource name is assigned an
-integer ID 0xppttiii (translated to a symbolic name via R.java), where
-
- * pp: corresponds to the package namespace (details below).
-
- * tt: corresponds to the resource type (string, int, etc). Every
- resource of the same type within the same package has the same
- tt value, but depending on available types, the actual numerical
- value may be different between packages.
-
- * iiii: sequential number, assigned in the order resources are found.
-
-Resource values are specified paired with a set of configuration
-constraints (the default being the empty set), eg res/values-sv-port
-which imposes restrictions on language (Swedish) and display orientation
-(portrait). During lookup, every constraint set is matched against the
-current configuration, and the value corresponding to the best matching
-constraint set is returned (ResourceTypes.{h,cpp}).
-
-Parsing of resources.arsc is handled by ResourceTypes.cpp; this utility
-is governed by AssetManager.cpp, which tracks loaded resources per
-process.
-
-Assets are looked up by path and filename in AssetManager.cpp. The path
-to resources in res/drawable are located by ResourceTypes.cpp and then
-handled like assets by AssetManager.cpp. Other resources are handled
-solely by ResourceTypes.cpp.
-
-Package ID as namespace
-~~~~~~~~~~~~~~~~~~~~~~~
-The pp part of a resource ID defines a namespace. Android currently
-defines two namespaces:
-
- * 0x01: system resources (pre-installed in framework-res.apk)
-
- * 0x7f: application resources (bundled in the application .apk)
-
-ResourceTypes.cpp supports package IDs between 0x01 and 0x7f
-(inclusive); values outside this range are invalid.
-
-Each running (Dalvik) process is assigned a unique instance of
-AssetManager, which in turn keeps a forest structure of loaded
-resource.arsc files. Normally, this forest is structured as follows,
-where mPackageMap is the internal vector employed in ResourceTypes.cpp.
-
-mPackageMap[0x00] -> system package
-mPackageMap[0x01] -> NULL
-mPackageMap[0x02] -> NULL
-...
-mPackageMap[0x7f - 2] -> NULL
-mPackageMap[0x7f - 1] -> application package
-
-
-
-The resource overlay extension
-------------------------------
-
-The resource overlay mechanism aims to (partly) shadow and extend
-existing resources with new values for defined and new configurations.
-Technically, this is achieved by adding resource-only packages (called
-overlay packages) to existing resource namespaces, like so:
-
-mPackageMap[0x00] -> system package -> system overlay package
-mPackageMap[0x01] -> NULL
-mPackageMap[0x02] -> NULL
-...
-mPackageMap[0x7f - 2] -> NULL
-mPackageMap[0x7f - 1] -> application package -> overlay 1 -> overlay 2
-
-The use of overlay resources is completely transparent to
-applications; no additional resource identifiers are introduced, only
-configuration/value pairs. Any number of overlay packages may be loaded
-at a time; overlay packages are agnostic to what they target -- both
-system and application resources are fair game.
-
-The package targeted by an overlay package is called the target or
-original package.
-
-Resource overlay operates on symbolic resources names. Hence, to
-override the string/str1 resources in a package, the overlay package
-would include a resource also named string/str1. The end user does not
-have to worry about the numeric resources IDs assigned by aapt, as this
-is resolved automatically by the system.
-
-As of this writing, the use of resource overlay has not been fully
-explored. Until it has, only OEMs are trusted to use resource overlay.
-For this reason, overlay packages must reside in /system/overlay.
-
-
-Resource ID mapping
-~~~~~~~~~~~~~~~~~~~
-Resource identifiers must be coherent within the same namespace (ie
-PackageGroup in ResourceTypes.cpp). Calling applications will refer to
-resources using the IDs defined in the original package, but there is no
-guarantee aapt has assigned the same ID to the corresponding resource in
-an overlay package. To translate between the two, a resource ID mapping
-{original ID -> overlay ID} is created during package installation
-(PackageManagerService.java) and used during resource lookup. The
-mapping is stored in /data/resource-cache, with a @idmap file name
-suffix.
-
-The idmap file format is documented in a separate section, below.
-
-
-Package management
-~~~~~~~~~~~~~~~~~~
-Packages are managed by the PackageManagerService. Addition and removal
-of packages are monitored via the inotify framework, exposed via
-android.os.FileObserver.
-
-During initialization of a Dalvik process, ActivityThread.java requests
-the process' AssetManager (by proxy, via AssetManager.java and JNI)
-to load a list of packages. This list includes overlay packages, if
-present.
-
-When a target package or a corresponding overlay package is installed,
-the target package's process is stopped and a new idmap is generated.
-This is similar to how applications are stopped when their packages are
-upgraded.
-
-
-Creating overlay packages
--------------------------
-
-Overlay packages should contain no code, define (some) resources with
-the same type and name as in the original package, and be compiled with
-the -o flag passed to aapt.
-
-The aapt -o flag instructs aapt to create an overlay package.
-Technically, this means the package will be assigned package id 0x00.
-
-There are no restrictions on overlay packages names, though the naming
-convention <original.package.name>.overlay.<name> is recommended.
-
-
-Example overlay package
-~~~~~~~~~~~~~~~~~~~~~~~
-
-To overlay the resource bool/b in package com.foo.bar, to be applied
-when the display is in landscape mode, create a new package with
-no source code and a single .xml file under res/values-land, with
-an entry for bool/b. Compile with aapt -o and place the results in
-/system/overlay by adding the following to Android.mk:
-
-LOCAL_AAPT_FLAGS := -o com.foo.bar
-LOCAL_MODULE_PATH := $(TARGET_OUT)/overlay
-
-
-The ID map (idmap) file format
-------------------------------
-
-The idmap format is designed for lookup performance. However, leading
-and trailing undefined overlay values are discarded to reduce the memory
-footprint.
-
-
-idmap grammar
-~~~~~~~~~~~~~
-All atoms (names in square brackets) are uint32_t integers. The
-idmap-magic constant spells "idmp" in ASCII. Offsets are given relative
-to the data_header, not to the beginning of the file.
-
-map := header data
-header := idmap-magic <crc32-original-pkg> <crc32-overlay-pkg>
-idmap-magic := <0x706d6469>
-data := data_header type_block+
-data_header := <m> header_block{m}
-header_block := <0> | <type_block_offset>
-type_block := <n> <id_offset> entry{n}
-entry := <resource_id_in_target_package>
-
-
-idmap example
-~~~~~~~~~~~~~
-Given a pair of target and overlay packages with CRC sums 0x216a8fe2
-and 0x6b9beaec, each defining the following resources
-
-Name Target package Overlay package
-string/str0 0x7f010000 -
-string/str1 0x7f010001 0x7f010000
-string/str2 0x7f010002 -
-string/str3 0x7f010003 0x7f010001
-string/str4 0x7f010004 -
-bool/bool0 0x7f020000 -
-integer/int0 0x7f030000 0x7f020000
-integer/int1 0x7f030001 -
-
-the corresponding resource map is
-
-0x706d6469 0x216a8fe2 0x6b9beaec 0x00000003 \
-0x00000004 0x00000000 0x00000009 0x00000003 \
-0x00000001 0x7f010000 0x00000000 0x7f010001 \
-0x00000001 0x00000000 0x7f020000
-
-or, formatted differently
-
-0x706d6469 # magic: all idmap files begin with this constant
-0x216a8fe2 # CRC32 of the resources.arsc file in the original package
-0x6b9beaec # CRC32 of the resources.arsc file in the overlay package
-0x00000003 # header; three types (string, bool, integer) in the target package
-0x00000004 # header_block for type 0 (string) is located at offset 4
-0x00000000 # no bool type exists in overlay package -> no header_block
-0x00000009 # header_block for type 2 (integer) is located at offset 9
-0x00000003 # header_block for string; overlay IDs span 3 elements
-0x00000001 # the first string in target package is entry 1 == offset
-0x7f010000 # target 0x7f01001 -> overlay 0x7f010000
-0x00000000 # str2 not defined in overlay package
-0x7f010001 # target 0x7f010003 -> overlay 0x7f010001
-0x00000001 # header_block for integer; overlay IDs span 1 element
-0x00000000 # offset == 0
-0x7f020000 # target 0x7f030000 -> overlay 0x7f020000
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
deleted file mode 100644
index e80a795..0000000
--- a/libs/utils/RefBase.cpp
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "RefBase"
-
-#include <utils/RefBase.h>
-
-#include <utils/Atomic.h>
-#include <utils/CallStack.h>
-#include <utils/Log.h>
-#include <utils/threads.h>
-#include <utils/TextOutput.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <typeinfo>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-// compile with refcounting debugging enabled
-#define DEBUG_REFS 0
-#define DEBUG_REFS_FATAL_SANITY_CHECKS 0
-#define DEBUG_REFS_ENABLED_BY_DEFAULT 1
-#define DEBUG_REFS_CALLSTACK_ENABLED 1
-
-// log all reference counting operations
-#define PRINT_REFS 0
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-#define INITIAL_STRONG_VALUE (1<<28)
-
-// ---------------------------------------------------------------------------
-
-class RefBase::weakref_impl : public RefBase::weakref_type
-{
-public:
- volatile int32_t mStrong;
- volatile int32_t mWeak;
- RefBase* const mBase;
- volatile int32_t mFlags;
-
-#if !DEBUG_REFS
-
- weakref_impl(RefBase* base)
- : mStrong(INITIAL_STRONG_VALUE)
- , mWeak(0)
- , mBase(base)
- , mFlags(0)
- {
- }
-
- void addStrongRef(const void* /*id*/) { }
- void removeStrongRef(const void* /*id*/) { }
- void renameStrongRefId(const void* /*old_id*/, const void* /*new_id*/) { }
- void addWeakRef(const void* /*id*/) { }
- void removeWeakRef(const void* /*id*/) { }
- void renameWeakRefId(const void* /*old_id*/, const void* /*new_id*/) { }
- void printRefs() const { }
- void trackMe(bool, bool) { }
-
-#else
-
- weakref_impl(RefBase* base)
- : mStrong(INITIAL_STRONG_VALUE)
- , mWeak(0)
- , mBase(base)
- , mFlags(0)
- , mStrongRefs(NULL)
- , mWeakRefs(NULL)
- , mTrackEnabled(!!DEBUG_REFS_ENABLED_BY_DEFAULT)
- , mRetain(false)
- {
- }
-
- ~weakref_impl()
- {
- bool dumpStack = false;
- if (!mRetain && mStrongRefs != NULL) {
- dumpStack = true;
-#if DEBUG_REFS_FATAL_SANITY_CHECKS
- LOG_ALWAYS_FATAL("Strong references remain!");
-#else
- ALOGE("Strong references remain:");
-#endif
- ref_entry* refs = mStrongRefs;
- while (refs) {
- char inc = refs->ref >= 0 ? '+' : '-';
- ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
-#if DEBUG_REFS_CALLSTACK_ENABLED
- refs->stack.dump();
-#endif
- refs = refs->next;
- }
- }
-
- if (!mRetain && mWeakRefs != NULL) {
- dumpStack = true;
-#if DEBUG_REFS_FATAL_SANITY_CHECKS
- LOG_ALWAYS_FATAL("Weak references remain:");
-#else
- ALOGE("Weak references remain!");
-#endif
- ref_entry* refs = mWeakRefs;
- while (refs) {
- char inc = refs->ref >= 0 ? '+' : '-';
- ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
-#if DEBUG_REFS_CALLSTACK_ENABLED
- refs->stack.dump();
-#endif
- refs = refs->next;
- }
- }
- if (dumpStack) {
- ALOGE("above errors at:");
- CallStack stack;
- stack.update();
- stack.dump();
- }
- }
-
- void addStrongRef(const void* id) {
- //ALOGD_IF(mTrackEnabled,
- // "addStrongRef: RefBase=%p, id=%p", mBase, id);
- addRef(&mStrongRefs, id, mStrong);
- }
-
- void removeStrongRef(const void* id) {
- //ALOGD_IF(mTrackEnabled,
- // "removeStrongRef: RefBase=%p, id=%p", mBase, id);
- if (!mRetain) {
- removeRef(&mStrongRefs, id);
- } else {
- addRef(&mStrongRefs, id, -mStrong);
- }
- }
-
- void renameStrongRefId(const void* old_id, const void* new_id) {
- //ALOGD_IF(mTrackEnabled,
- // "renameStrongRefId: RefBase=%p, oid=%p, nid=%p",
- // mBase, old_id, new_id);
- renameRefsId(mStrongRefs, old_id, new_id);
- }
-
- void addWeakRef(const void* id) {
- addRef(&mWeakRefs, id, mWeak);
- }
-
- void removeWeakRef(const void* id) {
- if (!mRetain) {
- removeRef(&mWeakRefs, id);
- } else {
- addRef(&mWeakRefs, id, -mWeak);
- }
- }
-
- void renameWeakRefId(const void* old_id, const void* new_id) {
- renameRefsId(mWeakRefs, old_id, new_id);
- }
-
- void trackMe(bool track, bool retain)
- {
- mTrackEnabled = track;
- mRetain = retain;
- }
-
- void printRefs() const
- {
- String8 text;
-
- {
- Mutex::Autolock _l(mMutex);
- char buf[128];
- sprintf(buf, "Strong references on RefBase %p (weakref_type %p):\n", mBase, this);
- text.append(buf);
- printRefsLocked(&text, mStrongRefs);
- sprintf(buf, "Weak references on RefBase %p (weakref_type %p):\n", mBase, this);
- text.append(buf);
- printRefsLocked(&text, mWeakRefs);
- }
-
- {
- char name[100];
- snprintf(name, 100, "/data/%p.stack", this);
- int rc = open(name, O_RDWR | O_CREAT | O_APPEND);
- if (rc >= 0) {
- write(rc, text.string(), text.length());
- close(rc);
- ALOGD("STACK TRACE for %p saved in %s", this, name);
- }
- else ALOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this,
- name, strerror(errno));
- }
- }
-
-private:
- struct ref_entry
- {
- ref_entry* next;
- const void* id;
-#if DEBUG_REFS_CALLSTACK_ENABLED
- CallStack stack;
-#endif
- int32_t ref;
- };
-
- void addRef(ref_entry** refs, const void* id, int32_t mRef)
- {
- if (mTrackEnabled) {
- AutoMutex _l(mMutex);
-
- ref_entry* ref = new ref_entry;
- // Reference count at the time of the snapshot, but before the
- // update. Positive value means we increment, negative--we
- // decrement the reference count.
- ref->ref = mRef;
- ref->id = id;
-#if DEBUG_REFS_CALLSTACK_ENABLED
- ref->stack.update(2);
-#endif
- ref->next = *refs;
- *refs = ref;
- }
- }
-
- void removeRef(ref_entry** refs, const void* id)
- {
- if (mTrackEnabled) {
- AutoMutex _l(mMutex);
-
- ref_entry* const head = *refs;
- ref_entry* ref = head;
- while (ref != NULL) {
- if (ref->id == id) {
- *refs = ref->next;
- delete ref;
- return;
- }
- refs = &ref->next;
- ref = *refs;
- }
-
-#if DEBUG_REFS_FATAL_SANITY_CHECKS
- LOG_ALWAYS_FATAL("RefBase: removing id %p on RefBase %p"
- "(weakref_type %p) that doesn't exist!",
- id, mBase, this);
-#endif
-
- ALOGE("RefBase: removing id %p on RefBase %p"
- "(weakref_type %p) that doesn't exist!",
- id, mBase, this);
-
- ref = head;
- while (ref) {
- char inc = ref->ref >= 0 ? '+' : '-';
- ALOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref);
- ref = ref->next;
- }
-
- CallStack stack;
- stack.update();
- stack.dump();
- }
- }
-
- void renameRefsId(ref_entry* r, const void* old_id, const void* new_id)
- {
- if (mTrackEnabled) {
- AutoMutex _l(mMutex);
- ref_entry* ref = r;
- while (ref != NULL) {
- if (ref->id == old_id) {
- ref->id = new_id;
- }
- ref = ref->next;
- }
- }
- }
-
- void printRefsLocked(String8* out, const ref_entry* refs) const
- {
- char buf[128];
- while (refs) {
- char inc = refs->ref >= 0 ? '+' : '-';
- sprintf(buf, "\t%c ID %p (ref %d):\n",
- inc, refs->id, refs->ref);
- out->append(buf);
-#if DEBUG_REFS_CALLSTACK_ENABLED
- out->append(refs->stack.toString("\t\t"));
-#else
- out->append("\t\t(call stacks disabled)");
-#endif
- refs = refs->next;
- }
- }
-
- mutable Mutex mMutex;
- ref_entry* mStrongRefs;
- ref_entry* mWeakRefs;
-
- bool mTrackEnabled;
- // Collect stack traces on addref and removeref, instead of deleting the stack references
- // on removeref that match the address ones.
- bool mRetain;
-
-#endif
-};
-
-// ---------------------------------------------------------------------------
-
-void RefBase::incStrong(const void* id) const
-{
- weakref_impl* const refs = mRefs;
- refs->incWeak(id);
-
- refs->addStrongRef(id);
- const int32_t c = android_atomic_inc(&refs->mStrong);
- ALOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs);
-#if PRINT_REFS
- ALOGD("incStrong of %p from %p: cnt=%d\n", this, id, c);
-#endif
- if (c != INITIAL_STRONG_VALUE) {
- return;
- }
-
- android_atomic_add(-INITIAL_STRONG_VALUE, &refs->mStrong);
- refs->mBase->onFirstRef();
-}
-
-void RefBase::decStrong(const void* id) const
-{
- weakref_impl* const refs = mRefs;
- refs->removeStrongRef(id);
- const int32_t c = android_atomic_dec(&refs->mStrong);
-#if PRINT_REFS
- ALOGD("decStrong of %p from %p: cnt=%d\n", this, id, c);
-#endif
- ALOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs);
- if (c == 1) {
- refs->mBase->onLastStrongRef(id);
- if ((refs->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_STRONG) {
- delete this;
- }
- }
- refs->decWeak(id);
-}
-
-void RefBase::forceIncStrong(const void* id) const
-{
- weakref_impl* const refs = mRefs;
- refs->incWeak(id);
-
- refs->addStrongRef(id);
- const int32_t c = android_atomic_inc(&refs->mStrong);
- ALOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow",
- refs);
-#if PRINT_REFS
- ALOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c);
-#endif
-
- switch (c) {
- case INITIAL_STRONG_VALUE:
- android_atomic_add(-INITIAL_STRONG_VALUE, &refs->mStrong);
- // fall through...
- case 0:
- refs->mBase->onFirstRef();
- }
-}
-
-int32_t RefBase::getStrongCount() const
-{
- return mRefs->mStrong;
-}
-
-RefBase* RefBase::weakref_type::refBase() const
-{
- return static_cast<const weakref_impl*>(this)->mBase;
-}
-
-void RefBase::weakref_type::incWeak(const void* id)
-{
- weakref_impl* const impl = static_cast<weakref_impl*>(this);
- impl->addWeakRef(id);
- const int32_t c = android_atomic_inc(&impl->mWeak);
- ALOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this);
-}
-
-
-void RefBase::weakref_type::decWeak(const void* id)
-{
- weakref_impl* const impl = static_cast<weakref_impl*>(this);
- impl->removeWeakRef(id);
- const int32_t c = android_atomic_dec(&impl->mWeak);
- ALOG_ASSERT(c >= 1, "decWeak called on %p too many times", this);
- if (c != 1) return;
-
- if ((impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_STRONG) {
- // This is the regular lifetime case. The object is destroyed
- // when the last strong reference goes away. Since weakref_impl
- // outlive the object, it is not destroyed in the dtor, and
- // we'll have to do it here.
- if (impl->mStrong == INITIAL_STRONG_VALUE) {
- // Special case: we never had a strong reference, so we need to
- // destroy the object now.
- delete impl->mBase;
- } else {
- // ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
- delete impl;
- }
- } else {
- // less common case: lifetime is OBJECT_LIFETIME_{WEAK|FOREVER}
- impl->mBase->onLastWeakRef(id);
- if ((impl->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_WEAK) {
- // this is the OBJECT_LIFETIME_WEAK case. The last weak-reference
- // is gone, we can destroy the object.
- delete impl->mBase;
- }
- }
-}
-
-bool RefBase::weakref_type::attemptIncStrong(const void* id)
-{
- incWeak(id);
-
- weakref_impl* const impl = static_cast<weakref_impl*>(this);
-
- int32_t curCount = impl->mStrong;
- ALOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow",
- this);
- while (curCount > 0 && curCount != INITIAL_STRONG_VALUE) {
- if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mStrong) == 0) {
- break;
- }
- curCount = impl->mStrong;
- }
-
- if (curCount <= 0 || curCount == INITIAL_STRONG_VALUE) {
- bool allow;
- if (curCount == INITIAL_STRONG_VALUE) {
- // Attempting to acquire first strong reference... this is allowed
- // if the object does NOT have a longer lifetime (meaning the
- // implementation doesn't need to see this), or if the implementation
- // allows it to happen.
- allow = (impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK
- || impl->mBase->onIncStrongAttempted(FIRST_INC_STRONG, id);
- } else {
- // Attempting to revive the object... this is allowed
- // if the object DOES have a longer lifetime (so we can safely
- // call the object with only a weak ref) and the implementation
- // allows it to happen.
- allow = (impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_WEAK
- && impl->mBase->onIncStrongAttempted(FIRST_INC_STRONG, id);
- }
- if (!allow) {
- decWeak(id);
- return false;
- }
- curCount = android_atomic_inc(&impl->mStrong);
-
- // If the strong reference count has already been incremented by
- // someone else, the implementor of onIncStrongAttempted() is holding
- // an unneeded reference. So call onLastStrongRef() here to remove it.
- // (No, this is not pretty.) Note that we MUST NOT do this if we
- // are in fact acquiring the first reference.
- if (curCount > 0 && curCount < INITIAL_STRONG_VALUE) {
- impl->mBase->onLastStrongRef(id);
- }
- }
-
- impl->addStrongRef(id);
-
-#if PRINT_REFS
- ALOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount);
-#endif
-
- if (curCount == INITIAL_STRONG_VALUE) {
- android_atomic_add(-INITIAL_STRONG_VALUE, &impl->mStrong);
- impl->mBase->onFirstRef();
- }
-
- return true;
-}
-
-bool RefBase::weakref_type::attemptIncWeak(const void* id)
-{
- weakref_impl* const impl = static_cast<weakref_impl*>(this);
-
- int32_t curCount = impl->mWeak;
- ALOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow",
- this);
- while (curCount > 0) {
- if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mWeak) == 0) {
- break;
- }
- curCount = impl->mWeak;
- }
-
- if (curCount > 0) {
- impl->addWeakRef(id);
- }
-
- return curCount > 0;
-}
-
-int32_t RefBase::weakref_type::getWeakCount() const
-{
- return static_cast<const weakref_impl*>(this)->mWeak;
-}
-
-void RefBase::weakref_type::printRefs() const
-{
- static_cast<const weakref_impl*>(this)->printRefs();
-}
-
-void RefBase::weakref_type::trackMe(bool enable, bool retain)
-{
- static_cast<weakref_impl*>(this)->trackMe(enable, retain);
-}
-
-RefBase::weakref_type* RefBase::createWeak(const void* id) const
-{
- mRefs->incWeak(id);
- return mRefs;
-}
-
-RefBase::weakref_type* RefBase::getWeakRefs() const
-{
- return mRefs;
-}
-
-RefBase::RefBase()
- : mRefs(new weakref_impl(this))
-{
-}
-
-RefBase::~RefBase()
-{
- if (mRefs->mStrong == INITIAL_STRONG_VALUE) {
- // we never acquired a strong (and/or weak) reference on this object.
- delete mRefs;
- } else {
- // life-time of this object is extended to WEAK or FOREVER, in
- // which case weakref_impl doesn't out-live the object and we
- // can free it now.
- if ((mRefs->mFlags & OBJECT_LIFETIME_MASK) != OBJECT_LIFETIME_STRONG) {
- // It's possible that the weak count is not 0 if the object
- // re-acquired a weak reference in its destructor
- if (mRefs->mWeak == 0) {
- delete mRefs;
- }
- }
- }
- // for debugging purposes, clear this.
- const_cast<weakref_impl*&>(mRefs) = NULL;
-}
-
-void RefBase::extendObjectLifetime(int32_t mode)
-{
- android_atomic_or(mode, &mRefs->mFlags);
-}
-
-void RefBase::onFirstRef()
-{
-}
-
-void RefBase::onLastStrongRef(const void* /*id*/)
-{
-}
-
-bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id)
-{
- return (flags&FIRST_INC_STRONG) ? true : false;
-}
-
-void RefBase::onLastWeakRef(const void* /*id*/)
-{
-}
-
-// ---------------------------------------------------------------------------
-
-void RefBase::moveReferences(void* dst, void const* src, size_t n,
- const ReferenceConverterBase& caster)
-{
-#if DEBUG_REFS
- const size_t itemSize = caster.getReferenceTypeSize();
- for (size_t i=0 ; i<n ; i++) {
- void* d = reinterpret_cast<void *>(intptr_t(dst) + i*itemSize);
- void const* s = reinterpret_cast<void const*>(intptr_t(src) + i*itemSize);
- RefBase* ref(reinterpret_cast<RefBase*>(caster.getReferenceBase(d)));
- ref->mRefs->renameStrongRefId(s, d);
- ref->mRefs->renameWeakRefId(s, d);
- }
-#endif
-}
-
-// ---------------------------------------------------------------------------
-
-TextOutput& printStrongPointer(TextOutput& to, const void* val)
-{
- to << "sp<>(" << val << ")";
- return to;
-}
-
-TextOutput& printWeakPointer(TextOutput& to, const void* val)
-{
- to << "wp<>(" << val << ")";
- return to;
-}
-
-
-}; // namespace android
diff --git a/libs/utils/SharedBuffer.cpp b/libs/utils/SharedBuffer.cpp
deleted file mode 100644
index 3555fb7..0000000
--- a/libs/utils/SharedBuffer.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <utils/SharedBuffer.h>
-#include <utils/Atomic.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-SharedBuffer* SharedBuffer::alloc(size_t size)
-{
- SharedBuffer* sb = static_cast<SharedBuffer *>(malloc(sizeof(SharedBuffer) + size));
- if (sb) {
- sb->mRefs = 1;
- sb->mSize = size;
- }
- return sb;
-}
-
-
-ssize_t SharedBuffer::dealloc(const SharedBuffer* released)
-{
- if (released->mRefs != 0) return -1; // XXX: invalid operation
- free(const_cast<SharedBuffer*>(released));
- return 0;
-}
-
-SharedBuffer* SharedBuffer::edit() const
-{
- if (onlyOwner()) {
- return const_cast<SharedBuffer*>(this);
- }
- SharedBuffer* sb = alloc(mSize);
- if (sb) {
- memcpy(sb->data(), data(), size());
- release();
- }
- return sb;
-}
-
-SharedBuffer* SharedBuffer::editResize(size_t newSize) const
-{
- if (onlyOwner()) {
- SharedBuffer* buf = const_cast<SharedBuffer*>(this);
- if (buf->mSize == newSize) return buf;
- buf = (SharedBuffer*)realloc(buf, sizeof(SharedBuffer) + newSize);
- if (buf != NULL) {
- buf->mSize = newSize;
- return buf;
- }
- }
- SharedBuffer* sb = alloc(newSize);
- if (sb) {
- const size_t mySize = mSize;
- memcpy(sb->data(), data(), newSize < mySize ? newSize : mySize);
- release();
- }
- return sb;
-}
-
-SharedBuffer* SharedBuffer::attemptEdit() const
-{
- if (onlyOwner()) {
- return const_cast<SharedBuffer*>(this);
- }
- return 0;
-}
-
-SharedBuffer* SharedBuffer::reset(size_t new_size) const
-{
- // cheap-o-reset.
- SharedBuffer* sb = alloc(new_size);
- if (sb) {
- release();
- }
- return sb;
-}
-
-void SharedBuffer::acquire() const {
- android_atomic_inc(&mRefs);
-}
-
-int32_t SharedBuffer::release(uint32_t flags) const
-{
- int32_t prev = 1;
- if (onlyOwner() || ((prev = android_atomic_dec(&mRefs)) == 1)) {
- mRefs = 0;
- if ((flags & eKeepStorage) == 0) {
- free(const_cast<SharedBuffer*>(this));
- }
- }
- return prev;
-}
-
-
-}; // namespace android
diff --git a/libs/utils/Static.cpp b/libs/utils/Static.cpp
deleted file mode 100644
index 624e917..0000000
--- a/libs/utils/Static.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-// All static variables go here, to control initialization and
-// destruction order in the library.
-
-#include <private/utils/Static.h>
-
-#include <utils/BufferedTextOutput.h>
-#include <utils/Log.h>
-
-namespace android {
-
-class LibUtilsFirstStatics
-{
-public:
- LibUtilsFirstStatics()
- {
- initialize_string8();
- initialize_string16();
- }
-
- ~LibUtilsFirstStatics()
- {
- terminate_string16();
- terminate_string8();
- }
-};
-
-static LibUtilsFirstStatics gFirstStatics;
-int gDarwinCantLoadAllObjects = 1;
-
-// ------------ Text output streams
-
-Vector<int32_t> gTextBuffers;
-
-class LogTextOutput : public BufferedTextOutput
-{
-public:
- LogTextOutput() : BufferedTextOutput(MULTITHREADED) { }
- virtual ~LogTextOutput() { };
-
-protected:
- virtual status_t writeLines(const struct iovec& vec, size_t N)
- {
- //android_writevLog(&vec, N); <-- this is now a no-op
- if (N != 1) ALOGI("WARNING: writeLines N=%zu\n", N);
- ALOGI("%.*s", (int)vec.iov_len, (const char*) vec.iov_base);
- return NO_ERROR;
- }
-};
-
-class FdTextOutput : public BufferedTextOutput
-{
-public:
- FdTextOutput(int fd) : BufferedTextOutput(MULTITHREADED), mFD(fd) { }
- virtual ~FdTextOutput() { };
-
-protected:
- virtual status_t writeLines(const struct iovec& vec, size_t N)
- {
- writev(mFD, &vec, N);
- return NO_ERROR;
- }
-
-private:
- int mFD;
-};
-
-static LogTextOutput gLogTextOutput;
-static FdTextOutput gStdoutTextOutput(STDOUT_FILENO);
-static FdTextOutput gStderrTextOutput(STDERR_FILENO);
-
-TextOutput& alog(gLogTextOutput);
-TextOutput& aout(gStdoutTextOutput);
-TextOutput& aerr(gStderrTextOutput);
-
-} // namespace android
diff --git a/libs/utils/StopWatch.cpp b/libs/utils/StopWatch.cpp
deleted file mode 100644
index b1708d62..0000000
--- a/libs/utils/StopWatch.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "StopWatch"
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* for PRId64 */
-#define __STDC_FORMAT_MACROS 1
-#include <inttypes.h>
-
-#include <utils/Log.h>
-#include <utils/Errors.h>
-#include <utils/StopWatch.h>
-
-/*****************************************************************************/
-
-namespace android {
-
-
-StopWatch::StopWatch(const char *name, int clock, uint32_t flags)
- : mName(name), mClock(clock), mFlags(flags)
-{
- reset();
-}
-
-StopWatch::~StopWatch()
-{
- nsecs_t elapsed = elapsedTime();
- const int n = mNumLaps;
- ALOGD("StopWatch %s (us): %" PRId64 " ", mName, ns2us(elapsed));
- for (int i=0 ; i<n ; i++) {
- const nsecs_t soFar = mLaps[i].soFar;
- const nsecs_t thisLap = mLaps[i].thisLap;
- ALOGD(" [%d: %" PRId64 ", %" PRId64, i, ns2us(soFar), ns2us(thisLap));
- }
-}
-
-const char* StopWatch::name() const
-{
- return mName;
-}
-
-nsecs_t StopWatch::lap()
-{
- nsecs_t elapsed = elapsedTime();
- if (mNumLaps >= 8) {
- elapsed = 0;
- } else {
- const int n = mNumLaps;
- mLaps[n].soFar = elapsed;
- mLaps[n].thisLap = n ? (elapsed - mLaps[n-1].soFar) : elapsed;
- mNumLaps = n+1;
- }
- return elapsed;
-}
-
-nsecs_t StopWatch::elapsedTime() const
-{
- return systemTime(mClock) - mStartTime;
-}
-
-void StopWatch::reset()
-{
- mNumLaps = 0;
- mStartTime = systemTime(mClock);
-}
-
-
-/*****************************************************************************/
-
-}; // namespace android
-
diff --git a/libs/utils/String16.cpp b/libs/utils/String16.cpp
deleted file mode 100644
index 94e072f..0000000
--- a/libs/utils/String16.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/String16.h>
-
-#include <utils/Debug.h>
-#include <utils/Log.h>
-#include <utils/Unicode.h>
-#include <utils/String8.h>
-#include <utils/TextOutput.h>
-#include <utils/threads.h>
-
-#include <private/utils/Static.h>
-
-#include <memory.h>
-#include <stdio.h>
-#include <ctype.h>
-
-
-namespace android {
-
-static SharedBuffer* gEmptyStringBuf = NULL;
-static char16_t* gEmptyString = NULL;
-
-static inline char16_t* getEmptyString()
-{
- gEmptyStringBuf->acquire();
- return gEmptyString;
-}
-
-void initialize_string16()
-{
- SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t));
- char16_t* str = (char16_t*)buf->data();
- *str = 0;
- gEmptyStringBuf = buf;
- gEmptyString = str;
-}
-
-void terminate_string16()
-{
- SharedBuffer::bufferFromData(gEmptyString)->release();
- gEmptyStringBuf = NULL;
- gEmptyString = NULL;
-}
-
-// ---------------------------------------------------------------------------
-
-static char16_t* allocFromUTF8(const char* u8str, size_t u8len)
-{
- if (u8len == 0) return getEmptyString();
-
- const uint8_t* u8cur = (const uint8_t*) u8str;
-
- const ssize_t u16len = utf8_to_utf16_length(u8cur, u8len);
- if (u16len < 0) {
- return getEmptyString();
- }
-
- const uint8_t* const u8end = u8cur + u8len;
-
- SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)*(u16len+1));
- if (buf) {
- u8cur = (const uint8_t*) u8str;
- char16_t* u16str = (char16_t*)buf->data();
-
- utf8_to_utf16(u8cur, u8len, u16str);
-
- //printf("Created UTF-16 string from UTF-8 \"%s\":", in);
- //printHexData(1, str, buf->size(), 16, 1);
- //printf("\n");
-
- return u16str;
- }
-
- return getEmptyString();
-}
-
-// ---------------------------------------------------------------------------
-
-String16::String16()
- : mString(getEmptyString())
-{
-}
-
-String16::String16(const String16& o)
- : mString(o.mString)
-{
- SharedBuffer::bufferFromData(mString)->acquire();
-}
-
-String16::String16(const String16& o, size_t len, size_t begin)
- : mString(getEmptyString())
-{
- setTo(o, len, begin);
-}
-
-String16::String16(const char16_t* o)
-{
- size_t len = strlen16(o);
- SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t));
- ALOG_ASSERT(buf, "Unable to allocate shared buffer");
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- strcpy16(str, o);
- mString = str;
- return;
- }
-
- mString = getEmptyString();
-}
-
-String16::String16(const char16_t* o, size_t len)
-{
- SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t));
- ALOG_ASSERT(buf, "Unable to allocate shared buffer");
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- memcpy(str, o, len*sizeof(char16_t));
- str[len] = 0;
- mString = str;
- return;
- }
-
- mString = getEmptyString();
-}
-
-String16::String16(const String8& o)
- : mString(allocFromUTF8(o.string(), o.size()))
-{
-}
-
-String16::String16(const char* o)
- : mString(allocFromUTF8(o, strlen(o)))
-{
-}
-
-String16::String16(const char* o, size_t len)
- : mString(allocFromUTF8(o, len))
-{
-}
-
-String16::~String16()
-{
- SharedBuffer::bufferFromData(mString)->release();
-}
-
-void String16::setTo(const String16& other)
-{
- SharedBuffer::bufferFromData(other.mString)->acquire();
- SharedBuffer::bufferFromData(mString)->release();
- mString = other.mString;
-}
-
-status_t String16::setTo(const String16& other, size_t len, size_t begin)
-{
- const size_t N = other.size();
- if (begin >= N) {
- SharedBuffer::bufferFromData(mString)->release();
- mString = getEmptyString();
- return NO_ERROR;
- }
- if ((begin+len) > N) len = N-begin;
- if (begin == 0 && len == N) {
- setTo(other);
- return NO_ERROR;
- }
-
- if (&other == this) {
- LOG_ALWAYS_FATAL("Not implemented");
- }
-
- return setTo(other.string()+begin, len);
-}
-
-status_t String16::setTo(const char16_t* other)
-{
- return setTo(other, strlen16(other));
-}
-
-status_t String16::setTo(const char16_t* other, size_t len)
-{
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize((len+1)*sizeof(char16_t));
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- memmove(str, other, len*sizeof(char16_t));
- str[len] = 0;
- mString = str;
- return NO_ERROR;
- }
- return NO_MEMORY;
-}
-
-status_t String16::append(const String16& other)
-{
- const size_t myLen = size();
- const size_t otherLen = other.size();
- if (myLen == 0) {
- setTo(other);
- return NO_ERROR;
- } else if (otherLen == 0) {
- return NO_ERROR;
- }
-
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize((myLen+otherLen+1)*sizeof(char16_t));
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- memcpy(str+myLen, other, (otherLen+1)*sizeof(char16_t));
- mString = str;
- return NO_ERROR;
- }
- return NO_MEMORY;
-}
-
-status_t String16::append(const char16_t* chrs, size_t otherLen)
-{
- const size_t myLen = size();
- if (myLen == 0) {
- setTo(chrs, otherLen);
- return NO_ERROR;
- } else if (otherLen == 0) {
- return NO_ERROR;
- }
-
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize((myLen+otherLen+1)*sizeof(char16_t));
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- memcpy(str+myLen, chrs, otherLen*sizeof(char16_t));
- str[myLen+otherLen] = 0;
- mString = str;
- return NO_ERROR;
- }
- return NO_MEMORY;
-}
-
-status_t String16::insert(size_t pos, const char16_t* chrs)
-{
- return insert(pos, chrs, strlen16(chrs));
-}
-
-status_t String16::insert(size_t pos, const char16_t* chrs, size_t len)
-{
- const size_t myLen = size();
- if (myLen == 0) {
- return setTo(chrs, len);
- return NO_ERROR;
- } else if (len == 0) {
- return NO_ERROR;
- }
-
- if (pos > myLen) pos = myLen;
-
- #if 0
- printf("Insert in to %s: pos=%d, len=%d, myLen=%d, chrs=%s\n",
- String8(*this).string(), pos,
- len, myLen, String8(chrs, len).string());
- #endif
-
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize((myLen+len+1)*sizeof(char16_t));
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- if (pos < myLen) {
- memmove(str+pos+len, str+pos, (myLen-pos)*sizeof(char16_t));
- }
- memcpy(str+pos, chrs, len*sizeof(char16_t));
- str[myLen+len] = 0;
- mString = str;
- #if 0
- printf("Result (%d chrs): %s\n", size(), String8(*this).string());
- #endif
- return NO_ERROR;
- }
- return NO_MEMORY;
-}
-
-ssize_t String16::findFirst(char16_t c) const
-{
- const char16_t* str = string();
- const char16_t* p = str;
- const char16_t* e = p + size();
- while (p < e) {
- if (*p == c) {
- return p-str;
- }
- p++;
- }
- return -1;
-}
-
-ssize_t String16::findLast(char16_t c) const
-{
- const char16_t* str = string();
- const char16_t* p = str;
- const char16_t* e = p + size();
- while (p < e) {
- e--;
- if (*e == c) {
- return e-str;
- }
- }
- return -1;
-}
-
-bool String16::startsWith(const String16& prefix) const
-{
- const size_t ps = prefix.size();
- if (ps > size()) return false;
- return strzcmp16(mString, ps, prefix.string(), ps) == 0;
-}
-
-bool String16::startsWith(const char16_t* prefix) const
-{
- const size_t ps = strlen16(prefix);
- if (ps > size()) return false;
- return strncmp16(mString, prefix, ps) == 0;
-}
-
-status_t String16::makeLower()
-{
- const size_t N = size();
- const char16_t* str = string();
- char16_t* edit = NULL;
- for (size_t i=0; i<N; i++) {
- const char16_t v = str[i];
- if (v >= 'A' && v <= 'Z') {
- if (!edit) {
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)->edit();
- if (!buf) {
- return NO_MEMORY;
- }
- edit = (char16_t*)buf->data();
- mString = str = edit;
- }
- edit[i] = tolower((char)v);
- }
- }
- return NO_ERROR;
-}
-
-status_t String16::replaceAll(char16_t replaceThis, char16_t withThis)
-{
- const size_t N = size();
- const char16_t* str = string();
- char16_t* edit = NULL;
- for (size_t i=0; i<N; i++) {
- if (str[i] == replaceThis) {
- if (!edit) {
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)->edit();
- if (!buf) {
- return NO_MEMORY;
- }
- edit = (char16_t*)buf->data();
- mString = str = edit;
- }
- edit[i] = withThis;
- }
- }
- return NO_ERROR;
-}
-
-status_t String16::remove(size_t len, size_t begin)
-{
- const size_t N = size();
- if (begin >= N) {
- SharedBuffer::bufferFromData(mString)->release();
- mString = getEmptyString();
- return NO_ERROR;
- }
- if ((begin+len) > N) len = N-begin;
- if (begin == 0 && len == N) {
- return NO_ERROR;
- }
-
- if (begin > 0) {
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize((N+1)*sizeof(char16_t));
- if (!buf) {
- return NO_MEMORY;
- }
- char16_t* str = (char16_t*)buf->data();
- memmove(str, str+begin, (N-begin+1)*sizeof(char16_t));
- mString = str;
- }
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize((len+1)*sizeof(char16_t));
- if (buf) {
- char16_t* str = (char16_t*)buf->data();
- str[len] = 0;
- mString = str;
- return NO_ERROR;
- }
- return NO_MEMORY;
-}
-
-TextOutput& operator<<(TextOutput& to, const String16& val)
-{
- to << String8(val).string();
- return to;
-}
-
-}; // namespace android
diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp
deleted file mode 100644
index 562f026..0000000
--- a/libs/utils/String8.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/String8.h>
-
-#include <utils/Log.h>
-#include <utils/Unicode.h>
-#include <utils/SharedBuffer.h>
-#include <utils/String16.h>
-#include <utils/TextOutput.h>
-#include <utils/threads.h>
-
-#include <private/utils/Static.h>
-
-#include <ctype.h>
-
-/*
- * Functions outside android is below the namespace android, since they use
- * functions and constants in android namespace.
- */
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// Separator used by resource paths. This is not platform dependent contrary
-// to OS_PATH_SEPARATOR.
-#define RES_PATH_SEPARATOR '/'
-
-static SharedBuffer* gEmptyStringBuf = NULL;
-static char* gEmptyString = NULL;
-
-extern int gDarwinCantLoadAllObjects;
-int gDarwinIsReallyAnnoying;
-
-static inline char* getEmptyString()
-{
- gEmptyStringBuf->acquire();
- return gEmptyString;
-}
-
-void initialize_string8()
-{
- // HACK: This dummy dependency forces linking libutils Static.cpp,
- // which is needed to initialize String8/String16 classes.
- // These variables are named for Darwin, but are needed elsewhere too,
- // including static linking on any platform.
- gDarwinIsReallyAnnoying = gDarwinCantLoadAllObjects;
-
- SharedBuffer* buf = SharedBuffer::alloc(1);
- char* str = (char*)buf->data();
- *str = 0;
- gEmptyStringBuf = buf;
- gEmptyString = str;
-}
-
-void terminate_string8()
-{
- SharedBuffer::bufferFromData(gEmptyString)->release();
- gEmptyStringBuf = NULL;
- gEmptyString = NULL;
-}
-
-// ---------------------------------------------------------------------------
-
-static char* allocFromUTF8(const char* in, size_t len)
-{
- if (len > 0) {
- SharedBuffer* buf = SharedBuffer::alloc(len+1);
- ALOG_ASSERT(buf, "Unable to allocate shared buffer");
- if (buf) {
- char* str = (char*)buf->data();
- memcpy(str, in, len);
- str[len] = 0;
- return str;
- }
- return NULL;
- }
-
- return getEmptyString();
-}
-
-static char* allocFromUTF16(const char16_t* in, size_t len)
-{
- if (len == 0) return getEmptyString();
-
- const ssize_t bytes = utf16_to_utf8_length(in, len);
- if (bytes < 0) {
- return getEmptyString();
- }
-
- SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
- ALOG_ASSERT(buf, "Unable to allocate shared buffer");
- if (!buf) {
- return getEmptyString();
- }
-
- char* str = (char*)buf->data();
- utf16_to_utf8(in, len, str);
- return str;
-}
-
-static char* allocFromUTF32(const char32_t* in, size_t len)
-{
- if (len == 0) {
- return getEmptyString();
- }
-
- const ssize_t bytes = utf32_to_utf8_length(in, len);
- if (bytes < 0) {
- return getEmptyString();
- }
-
- SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
- ALOG_ASSERT(buf, "Unable to allocate shared buffer");
- if (!buf) {
- return getEmptyString();
- }
-
- char* str = (char*) buf->data();
- utf32_to_utf8(in, len, str);
-
- return str;
-}
-
-// ---------------------------------------------------------------------------
-
-String8::String8()
- : mString(getEmptyString())
-{
-}
-
-String8::String8(const String8& o)
- : mString(o.mString)
-{
- SharedBuffer::bufferFromData(mString)->acquire();
-}
-
-String8::String8(const char* o)
- : mString(allocFromUTF8(o, strlen(o)))
-{
- if (mString == NULL) {
- mString = getEmptyString();
- }
-}
-
-String8::String8(const char* o, size_t len)
- : mString(allocFromUTF8(o, len))
-{
- if (mString == NULL) {
- mString = getEmptyString();
- }
-}
-
-String8::String8(const String16& o)
- : mString(allocFromUTF16(o.string(), o.size()))
-{
-}
-
-String8::String8(const char16_t* o)
- : mString(allocFromUTF16(o, strlen16(o)))
-{
-}
-
-String8::String8(const char16_t* o, size_t len)
- : mString(allocFromUTF16(o, len))
-{
-}
-
-String8::String8(const char32_t* o)
- : mString(allocFromUTF32(o, strlen32(o)))
-{
-}
-
-String8::String8(const char32_t* o, size_t len)
- : mString(allocFromUTF32(o, len))
-{
-}
-
-String8::~String8()
-{
- SharedBuffer::bufferFromData(mString)->release();
-}
-
-String8 String8::format(const char* fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
-
- String8 result(formatV(fmt, args));
-
- va_end(args);
- return result;
-}
-
-String8 String8::formatV(const char* fmt, va_list args)
-{
- String8 result;
- result.appendFormatV(fmt, args);
- return result;
-}
-
-void String8::clear() {
- SharedBuffer::bufferFromData(mString)->release();
- mString = getEmptyString();
-}
-
-void String8::setTo(const String8& other)
-{
- SharedBuffer::bufferFromData(other.mString)->acquire();
- SharedBuffer::bufferFromData(mString)->release();
- mString = other.mString;
-}
-
-status_t String8::setTo(const char* other)
-{
- const char *newString = allocFromUTF8(other, strlen(other));
- SharedBuffer::bufferFromData(mString)->release();
- mString = newString;
- if (mString) return NO_ERROR;
-
- mString = getEmptyString();
- return NO_MEMORY;
-}
-
-status_t String8::setTo(const char* other, size_t len)
-{
- const char *newString = allocFromUTF8(other, len);
- SharedBuffer::bufferFromData(mString)->release();
- mString = newString;
- if (mString) return NO_ERROR;
-
- mString = getEmptyString();
- return NO_MEMORY;
-}
-
-status_t String8::setTo(const char16_t* other, size_t len)
-{
- const char *newString = allocFromUTF16(other, len);
- SharedBuffer::bufferFromData(mString)->release();
- mString = newString;
- if (mString) return NO_ERROR;
-
- mString = getEmptyString();
- return NO_MEMORY;
-}
-
-status_t String8::setTo(const char32_t* other, size_t len)
-{
- const char *newString = allocFromUTF32(other, len);
- SharedBuffer::bufferFromData(mString)->release();
- mString = newString;
- if (mString) return NO_ERROR;
-
- mString = getEmptyString();
- return NO_MEMORY;
-}
-
-status_t String8::append(const String8& other)
-{
- const size_t otherLen = other.bytes();
- if (bytes() == 0) {
- setTo(other);
- return NO_ERROR;
- } else if (otherLen == 0) {
- return NO_ERROR;
- }
-
- return real_append(other.string(), otherLen);
-}
-
-status_t String8::append(const char* other)
-{
- return append(other, strlen(other));
-}
-
-status_t String8::append(const char* other, size_t otherLen)
-{
- if (bytes() == 0) {
- return setTo(other, otherLen);
- } else if (otherLen == 0) {
- return NO_ERROR;
- }
-
- return real_append(other, otherLen);
-}
-
-status_t String8::appendFormat(const char* fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
-
- status_t result = appendFormatV(fmt, args);
-
- va_end(args);
- return result;
-}
-
-status_t String8::appendFormatV(const char* fmt, va_list args)
-{
- int result = NO_ERROR;
- int n = vsnprintf(NULL, 0, fmt, args);
- if (n != 0) {
- size_t oldLength = length();
- char* buf = lockBuffer(oldLength + n);
- if (buf) {
- vsnprintf(buf + oldLength, n + 1, fmt, args);
- } else {
- result = NO_MEMORY;
- }
- }
- return result;
-}
-
-status_t String8::real_append(const char* other, size_t otherLen)
-{
- const size_t myLen = bytes();
-
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize(myLen+otherLen+1);
- if (buf) {
- char* str = (char*)buf->data();
- mString = str;
- str += myLen;
- memcpy(str, other, otherLen);
- str[otherLen] = '\0';
- return NO_ERROR;
- }
- return NO_MEMORY;
-}
-
-char* String8::lockBuffer(size_t size)
-{
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize(size+1);
- if (buf) {
- char* str = (char*)buf->data();
- mString = str;
- return str;
- }
- return NULL;
-}
-
-void String8::unlockBuffer()
-{
- unlockBuffer(strlen(mString));
-}
-
-status_t String8::unlockBuffer(size_t size)
-{
- if (size != this->size()) {
- SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
- ->editResize(size+1);
- if (! buf) {
- return NO_MEMORY;
- }
-
- char* str = (char*)buf->data();
- str[size] = 0;
- mString = str;
- }
-
- return NO_ERROR;
-}
-
-ssize_t String8::find(const char* other, size_t start) const
-{
- size_t len = size();
- if (start >= len) {
- return -1;
- }
- const char* s = mString+start;
- const char* p = strstr(s, other);
- return p ? p-mString : -1;
-}
-
-void String8::toLower()
-{
- toLower(0, size());
-}
-
-void String8::toLower(size_t start, size_t length)
-{
- const size_t len = size();
- if (start >= len) {
- return;
- }
- if (start+length > len) {
- length = len-start;
- }
- char* buf = lockBuffer(len);
- buf += start;
- while (length > 0) {
- *buf = tolower(*buf);
- buf++;
- length--;
- }
- unlockBuffer(len);
-}
-
-void String8::toUpper()
-{
- toUpper(0, size());
-}
-
-void String8::toUpper(size_t start, size_t length)
-{
- const size_t len = size();
- if (start >= len) {
- return;
- }
- if (start+length > len) {
- length = len-start;
- }
- char* buf = lockBuffer(len);
- buf += start;
- while (length > 0) {
- *buf = toupper(*buf);
- buf++;
- length--;
- }
- unlockBuffer(len);
-}
-
-size_t String8::getUtf32Length() const
-{
- return utf8_to_utf32_length(mString, length());
-}
-
-int32_t String8::getUtf32At(size_t index, size_t *next_index) const
-{
- return utf32_from_utf8_at(mString, length(), index, next_index);
-}
-
-void String8::getUtf32(char32_t* dst) const
-{
- utf8_to_utf32(mString, length(), dst);
-}
-
-TextOutput& operator<<(TextOutput& to, const String8& val)
-{
- to << val.string();
- return to;
-}
-
-// ---------------------------------------------------------------------------
-// Path functions
-
-void String8::setPathName(const char* name)
-{
- setPathName(name, strlen(name));
-}
-
-void String8::setPathName(const char* name, size_t len)
-{
- char* buf = lockBuffer(len);
-
- memcpy(buf, name, len);
-
- // remove trailing path separator, if present
- if (len > 0 && buf[len-1] == OS_PATH_SEPARATOR)
- len--;
-
- buf[len] = '\0';
-
- unlockBuffer(len);
-}
-
-String8 String8::getPathLeaf(void) const
-{
- const char* cp;
- const char*const buf = mString;
-
- cp = strrchr(buf, OS_PATH_SEPARATOR);
- if (cp == NULL)
- return String8(*this);
- else
- return String8(cp+1);
-}
-
-String8 String8::getPathDir(void) const
-{
- const char* cp;
- const char*const str = mString;
-
- cp = strrchr(str, OS_PATH_SEPARATOR);
- if (cp == NULL)
- return String8("");
- else
- return String8(str, cp - str);
-}
-
-String8 String8::walkPath(String8* outRemains) const
-{
- const char* cp;
- const char*const str = mString;
- const char* buf = str;
-
- cp = strchr(buf, OS_PATH_SEPARATOR);
- if (cp == buf) {
- // don't include a leading '/'.
- buf = buf+1;
- cp = strchr(buf, OS_PATH_SEPARATOR);
- }
-
- if (cp == NULL) {
- String8 res = buf != str ? String8(buf) : *this;
- if (outRemains) *outRemains = String8("");
- return res;
- }
-
- String8 res(buf, cp-buf);
- if (outRemains) *outRemains = String8(cp+1);
- return res;
-}
-
-/*
- * Helper function for finding the start of an extension in a pathname.
- *
- * Returns a pointer inside mString, or NULL if no extension was found.
- */
-char* String8::find_extension(void) const
-{
- const char* lastSlash;
- const char* lastDot;
- int extLen;
- const char* const str = mString;
-
- // only look at the filename
- lastSlash = strrchr(str, OS_PATH_SEPARATOR);
- if (lastSlash == NULL)
- lastSlash = str;
- else
- lastSlash++;
-
- // find the last dot
- lastDot = strrchr(lastSlash, '.');
- if (lastDot == NULL)
- return NULL;
-
- // looks good, ship it
- return const_cast<char*>(lastDot);
-}
-
-String8 String8::getPathExtension(void) const
-{
- char* ext;
-
- ext = find_extension();
- if (ext != NULL)
- return String8(ext);
- else
- return String8("");
-}
-
-String8 String8::getBasePath(void) const
-{
- char* ext;
- const char* const str = mString;
-
- ext = find_extension();
- if (ext == NULL)
- return String8(*this);
- else
- return String8(str, ext - str);
-}
-
-String8& String8::appendPath(const char* name)
-{
- // TODO: The test below will fail for Win32 paths. Fix later or ignore.
- if (name[0] != OS_PATH_SEPARATOR) {
- if (*name == '\0') {
- // nothing to do
- return *this;
- }
-
- size_t len = length();
- if (len == 0) {
- // no existing filename, just use the new one
- setPathName(name);
- return *this;
- }
-
- // make room for oldPath + '/' + newPath
- int newlen = strlen(name);
-
- char* buf = lockBuffer(len+1+newlen);
-
- // insert a '/' if needed
- if (buf[len-1] != OS_PATH_SEPARATOR)
- buf[len++] = OS_PATH_SEPARATOR;
-
- memcpy(buf+len, name, newlen+1);
- len += newlen;
-
- unlockBuffer(len);
-
- return *this;
- } else {
- setPathName(name);
- return *this;
- }
-}
-
-String8& String8::convertToResPath()
-{
-#if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR
- size_t len = length();
- if (len > 0) {
- char * buf = lockBuffer(len);
- for (char * end = buf + len; buf < end; ++buf) {
- if (*buf == OS_PATH_SEPARATOR)
- *buf = RES_PATH_SEPARATOR;
- }
- unlockBuffer(len);
- }
-#endif
- return *this;
-}
-
-}; // namespace android
diff --git a/libs/utils/StringArray.cpp b/libs/utils/StringArray.cpp
deleted file mode 100644
index aa42d68..0000000
--- a/libs/utils/StringArray.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Sortable array of strings. STL-ish, but STL-free.
-//
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <utils/StringArray.h>
-
-namespace android {
-
-//
-// An expanding array of strings. Add, get, sort, delete.
-//
-StringArray::StringArray()
- : mMax(0), mCurrent(0), mArray(NULL)
-{
-}
-
-StringArray:: ~StringArray() {
- for (int i = 0; i < mCurrent; i++)
- delete[] mArray[i];
- delete[] mArray;
-}
-
-//
-// Add a string. A copy of the string is made.
-//
-bool StringArray::push_back(const char* str) {
- if (mCurrent >= mMax) {
- char** tmp;
-
- if (mMax == 0)
- mMax = 16; // initial storage
- else
- mMax *= 2;
-
- tmp = new char*[mMax];
- if (tmp == NULL)
- return false;
-
- memcpy(tmp, mArray, mCurrent * sizeof(char*));
- delete[] mArray;
- mArray = tmp;
- }
-
- int len = strlen(str);
- mArray[mCurrent] = new char[len+1];
- memcpy(mArray[mCurrent], str, len+1);
- mCurrent++;
-
- return true;
-}
-
-//
-// Delete an entry.
-//
-void StringArray::erase(int idx) {
- if (idx < 0 || idx >= mCurrent)
- return;
- delete[] mArray[idx];
- if (idx < mCurrent-1) {
- memmove(&mArray[idx], &mArray[idx+1],
- (mCurrent-1 - idx) * sizeof(char*));
- }
- mCurrent--;
-}
-
-//
-// Sort the array.
-//
-void StringArray::sort(int (*compare)(const void*, const void*)) {
- qsort(mArray, mCurrent, sizeof(char*), compare);
-}
-
-//
-// Pass this to the sort routine to do an ascending alphabetical sort.
-//
-int StringArray::cmpAscendingAlpha(const void* pstr1, const void* pstr2) {
- return strcmp(*(const char**)pstr1, *(const char**)pstr2);
-}
-
-//
-// Set entry N to specified string.
-// [should use operator[] here]
-//
-void StringArray::setEntry(int idx, const char* str) {
- if (idx < 0 || idx >= mCurrent)
- return;
- delete[] mArray[idx];
- int len = strlen(str);
- mArray[idx] = new char[len+1];
- memcpy(mArray[idx], str, len+1);
-}
-
-
-}; // namespace android
diff --git a/libs/utils/SystemClock.cpp b/libs/utils/SystemClock.cpp
deleted file mode 100644
index 8b8ac10..0000000
--- a/libs/utils/SystemClock.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-/*
- * System clock functions.
- */
-
-#ifdef HAVE_ANDROID_OS
-#include <linux/ioctl.h>
-#include <linux/rtc.h>
-#include <utils/Atomic.h>
-#include <linux/android_alarm.h>
-#endif
-
-#include <sys/time.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <utils/SystemClock.h>
-#include <utils/Timers.h>
-
-#define LOG_TAG "SystemClock"
-#include "utils/Log.h"
-
-namespace android {
-
-/*
- * Set the current time. This only works when running as root.
- */
-int setCurrentTimeMillis(int64_t millis)
-{
-#if WIN32
- // not implemented
- return -1;
-#else
- struct timeval tv;
-#ifdef HAVE_ANDROID_OS
- struct timespec ts;
- int fd;
- int res;
-#endif
- int ret = 0;
-
- if (millis <= 0 || millis / 1000LL >= INT_MAX) {
- return -1;
- }
-
- tv.tv_sec = (time_t) (millis / 1000LL);
- tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL);
-
- ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec);
-
-#ifdef HAVE_ANDROID_OS
- fd = open("/dev/alarm", O_RDWR);
- if(fd < 0) {
- ALOGW("Unable to open alarm driver: %s\n", strerror(errno));
- return -1;
- }
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
- res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts);
- if(res < 0) {
- ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno));
- ret = -1;
- }
- close(fd);
-#else
- if (settimeofday(&tv, NULL) != 0) {
- ALOGW("Unable to set clock to %d.%d: %s\n",
- (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno));
- ret = -1;
- }
-#endif
-
- return ret;
-#endif // WIN32
-}
-
-/*
- * native public static long uptimeMillis();
- */
-int64_t uptimeMillis()
-{
- int64_t when = systemTime(SYSTEM_TIME_MONOTONIC);
- return (int64_t) nanoseconds_to_milliseconds(when);
-}
-
-/*
- * native public static long elapsedRealtime();
- */
-int64_t elapsedRealtime()
-{
-#ifdef HAVE_ANDROID_OS
- static int s_fd = -1;
-
- if (s_fd == -1) {
- int fd = open("/dev/alarm", O_RDONLY);
- if (android_atomic_cmpxchg(-1, fd, &s_fd)) {
- close(fd);
- }
- }
-
- struct timespec ts;
- int result = ioctl(s_fd,
- ANDROID_ALARM_GET_TIME(ANDROID_ALARM_ELAPSED_REALTIME), &ts);
-
- if (result == 0) {
- int64_t when = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec;
- return (int64_t) nanoseconds_to_milliseconds(when);
- } else {
- // XXX: there was an error, probably because the driver didn't
- // exist ... this should return
- // a real error, like an exception!
- int64_t when = systemTime(SYSTEM_TIME_MONOTONIC);
- return (int64_t) nanoseconds_to_milliseconds(when);
- }
-#else
- int64_t when = systemTime(SYSTEM_TIME_MONOTONIC);
- return (int64_t) nanoseconds_to_milliseconds(when);
-#endif
-}
-
-}; // namespace android
diff --git a/libs/utils/TextOutput.cpp b/libs/utils/TextOutput.cpp
deleted file mode 100644
index e04823d..0000000
--- a/libs/utils/TextOutput.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/TextOutput.h>
-
-#include <utils/Debug.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-TextOutput::TextOutput() {
-}
-
-TextOutput::~TextOutput() {
-}
-
-// ---------------------------------------------------------------------------
-
-TextOutput& operator<<(TextOutput& to, bool val)
-{
- if (val) to.print("true", 4);
- else to.print("false", 5);
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, int val)
-{
- char buf[16];
- sprintf(buf, "%d", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, long val)
-{
- char buf[16];
- sprintf(buf, "%ld", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, unsigned int val)
-{
- char buf[16];
- sprintf(buf, "%u", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, unsigned long val)
-{
- char buf[16];
- sprintf(buf, "%lu", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, long long val)
-{
- char buf[32];
- sprintf(buf, "%Ld", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, unsigned long long val)
-{
- char buf[32];
- sprintf(buf, "%Lu", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-static TextOutput& print_float(TextOutput& to, double value)
-{
- char buf[64];
- sprintf(buf, "%g", value);
- if( !strchr(buf, '.') && !strchr(buf, 'e') &&
- !strchr(buf, 'E') ) {
- strncat(buf, ".0", sizeof(buf)-1);
- }
- to.print(buf, strlen(buf));
- return to;
-}
-
-TextOutput& operator<<(TextOutput& to, float val)
-{
- return print_float(to,val);
-}
-
-TextOutput& operator<<(TextOutput& to, double val)
-{
- return print_float(to,val);
-}
-
-TextOutput& operator<<(TextOutput& to, const void* val)
-{
- char buf[16];
- sprintf(buf, "%p", val);
- to.print(buf, strlen(buf));
- return to;
-}
-
-static void textOutputPrinter(void* cookie, const char* txt)
-{
- ((TextOutput*)cookie)->print(txt, strlen(txt));
-}
-
-TextOutput& operator<<(TextOutput& to, const TypeCode& val)
-{
- printTypeCode(val.typeCode(), textOutputPrinter, (void*)&to);
- return to;
-}
-
-HexDump::HexDump(const void *buf, size_t size, size_t bytesPerLine)
- : mBuffer(buf)
- , mSize(size)
- , mBytesPerLine(bytesPerLine)
- , mSingleLineCutoff(16)
- , mAlignment(4)
- , mCArrayStyle(false)
-{
- if (bytesPerLine >= 16) mAlignment = 4;
- else if (bytesPerLine >= 8) mAlignment = 2;
- else mAlignment = 1;
-}
-
-TextOutput& operator<<(TextOutput& to, const HexDump& val)
-{
- printHexData(0, val.buffer(), val.size(), val.bytesPerLine(),
- val.singleLineCutoff(), val.alignment(), val.carrayStyle(),
- textOutputPrinter, (void*)&to);
- return to;
-}
-
-}; // namespace android
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
deleted file mode 100644
index ab207f5..0000000
--- a/libs/utils/Threads.cpp
+++ /dev/null
@@ -1,952 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-// #define LOG_NDEBUG 0
-#define LOG_TAG "libutils.threads"
-
-#include <utils/threads.h>
-#include <utils/Log.h>
-
-#include <cutils/sched_policy.h>
-#include <cutils/properties.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <errno.h>
-#include <assert.h>
-#include <unistd.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-# include <sched.h>
-# include <sys/resource.h>
-#ifdef HAVE_ANDROID_OS
-# include <bionic_pthread.h>
-#endif
-#elif defined(HAVE_WIN32_THREADS)
-# include <windows.h>
-# include <stdint.h>
-# include <process.h>
-# define HAVE_CREATETHREAD // Cygwin, vs. HAVE__BEGINTHREADEX for MinGW
-#endif
-
-#if defined(HAVE_PRCTL)
-#include <sys/prctl.h>
-#endif
-
-/*
- * ===========================================================================
- * Thread wrappers
- * ===========================================================================
- */
-
-using namespace android;
-
-// ----------------------------------------------------------------------------
-#if defined(HAVE_PTHREADS)
-// ----------------------------------------------------------------------------
-
-/*
- * Create and run a new thread.
- *
- * We create it "detached", so it cleans up after itself.
- */
-
-typedef void* (*android_pthread_entry)(void*);
-
-static pthread_once_t gDoSchedulingGroupOnce = PTHREAD_ONCE_INIT;
-static bool gDoSchedulingGroup = true;
-
-static void checkDoSchedulingGroup(void) {
- char buf[PROPERTY_VALUE_MAX];
- int len = property_get("debug.sys.noschedgroups", buf, "");
- if (len > 0) {
- int temp;
- if (sscanf(buf, "%d", &temp) == 1) {
- gDoSchedulingGroup = temp == 0;
- }
- }
-}
-
-struct thread_data_t {
- thread_func_t entryFunction;
- void* userData;
- int priority;
- char * threadName;
-
- // we use this trampoline when we need to set the priority with
- // nice/setpriority, and name with prctl.
- static int trampoline(const thread_data_t* t) {
- thread_func_t f = t->entryFunction;
- void* u = t->userData;
- int prio = t->priority;
- char * name = t->threadName;
- delete t;
- setpriority(PRIO_PROCESS, 0, prio);
- pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
- if (gDoSchedulingGroup) {
- if (prio >= ANDROID_PRIORITY_BACKGROUND) {
- set_sched_policy(androidGetTid(), SP_BACKGROUND);
- } else {
- set_sched_policy(androidGetTid(), SP_FOREGROUND);
- }
- }
-
- if (name) {
-#if defined(HAVE_PRCTL)
- // Mac OS doesn't have this, and we build libutil for the host too
- int hasAt = 0;
- int hasDot = 0;
- char *s = name;
- while (*s) {
- if (*s == '.') hasDot = 1;
- else if (*s == '@') hasAt = 1;
- s++;
- }
- int len = s - name;
- if (len < 15 || hasAt || !hasDot) {
- s = name;
- } else {
- s = name + len - 15;
- }
- prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0);
-#endif
- free(name);
- }
- return f(u);
- }
-};
-
-int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId)
-{
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
-#ifdef HAVE_ANDROID_OS /* valgrind is rejecting RT-priority create reqs */
- if (threadPriority != PRIORITY_DEFAULT || threadName != NULL) {
- // Now that the pthread_t has a method to find the associated
- // android_thread_id_t (pid) from pthread_t, it would be possible to avoid
- // this trampoline in some cases as the parent could set the properties
- // for the child. However, there would be a race condition because the
- // child becomes ready immediately, and it doesn't work for the name.
- // prctl(PR_SET_NAME) only works for self; prctl(PR_SET_THREAD_NAME) was
- // proposed but not yet accepted.
- thread_data_t* t = new thread_data_t;
- t->priority = threadPriority;
- t->threadName = threadName ? strdup(threadName) : NULL;
- t->entryFunction = entryFunction;
- t->userData = userData;
- entryFunction = (android_thread_func_t)&thread_data_t::trampoline;
- userData = t;
- }
-#endif
-
- if (threadStackSize) {
- pthread_attr_setstacksize(&attr, threadStackSize);
- }
-
- errno = 0;
- pthread_t thread;
- int result = pthread_create(&thread, &attr,
- (android_pthread_entry)entryFunction, userData);
- pthread_attr_destroy(&attr);
- if (result != 0) {
- ALOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n"
- "(android threadPriority=%d)",
- entryFunction, result, errno, threadPriority);
- return 0;
- }
-
- // Note that *threadID is directly available to the parent only, as it is
- // assigned after the child starts. Use memory barrier / lock if the child
- // or other threads also need access.
- if (threadId != NULL) {
- *threadId = (android_thread_id_t)thread; // XXX: this is not portable
- }
- return 1;
-}
-
-#ifdef HAVE_ANDROID_OS
-static pthread_t android_thread_id_t_to_pthread(android_thread_id_t thread)
-{
- return (pthread_t) thread;
-}
-#endif
-
-android_thread_id_t androidGetThreadId()
-{
- return (android_thread_id_t)pthread_self();
-}
-
-// ----------------------------------------------------------------------------
-#elif defined(HAVE_WIN32_THREADS)
-// ----------------------------------------------------------------------------
-
-/*
- * Trampoline to make us __stdcall-compliant.
- *
- * We're expected to delete "vDetails" when we're done.
- */
-struct threadDetails {
- int (*func)(void*);
- void* arg;
-};
-static __stdcall unsigned int threadIntermediary(void* vDetails)
-{
- struct threadDetails* pDetails = (struct threadDetails*) vDetails;
- int result;
-
- result = (*(pDetails->func))(pDetails->arg);
-
- delete pDetails;
-
- ALOG(LOG_VERBOSE, "thread", "thread exiting\n");
- return (unsigned int) result;
-}
-
-/*
- * Create and run a new thread.
- */
-static bool doCreateThread(android_thread_func_t fn, void* arg, android_thread_id_t *id)
-{
- HANDLE hThread;
- struct threadDetails* pDetails = new threadDetails; // must be on heap
- unsigned int thrdaddr;
-
- pDetails->func = fn;
- pDetails->arg = arg;
-
-#if defined(HAVE__BEGINTHREADEX)
- hThread = (HANDLE) _beginthreadex(NULL, 0, threadIntermediary, pDetails, 0,
- &thrdaddr);
- if (hThread == 0)
-#elif defined(HAVE_CREATETHREAD)
- hThread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) threadIntermediary,
- (void*) pDetails, 0, (DWORD*) &thrdaddr);
- if (hThread == NULL)
-#endif
- {
- ALOG(LOG_WARN, "thread", "WARNING: thread create failed\n");
- return false;
- }
-
-#if defined(HAVE_CREATETHREAD)
- /* close the management handle */
- CloseHandle(hThread);
-#endif
-
- if (id != NULL) {
- *id = (android_thread_id_t)thrdaddr;
- }
-
- return true;
-}
-
-int androidCreateRawThreadEtc(android_thread_func_t fn,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId)
-{
- return doCreateThread( fn, userData, threadId);
-}
-
-android_thread_id_t androidGetThreadId()
-{
- return (android_thread_id_t)GetCurrentThreadId();
-}
-
-// ----------------------------------------------------------------------------
-#else
-#error "Threads not supported"
-#endif
-
-// ----------------------------------------------------------------------------
-
-int androidCreateThread(android_thread_func_t fn, void* arg)
-{
- return createThreadEtc(fn, arg);
-}
-
-int androidCreateThreadGetID(android_thread_func_t fn, void *arg, android_thread_id_t *id)
-{
- return createThreadEtc(fn, arg, "android:unnamed_thread",
- PRIORITY_DEFAULT, 0, id);
-}
-
-static android_create_thread_fn gCreateThreadFn = androidCreateRawThreadEtc;
-
-int androidCreateThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId)
-{
- return gCreateThreadFn(entryFunction, userData, threadName,
- threadPriority, threadStackSize, threadId);
-}
-
-void androidSetCreateThreadFunc(android_create_thread_fn func)
-{
- gCreateThreadFn = func;
-}
-
-pid_t androidGetTid()
-{
-#ifdef HAVE_GETTID
- return gettid();
-#else
- return getpid();
-#endif
-}
-
-int androidSetThreadSchedulingGroup(pid_t tid, int grp)
-{
- if (grp > ANDROID_TGROUP_MAX || grp < 0) {
- return BAD_VALUE;
- }
-
-#if defined(HAVE_PTHREADS)
- pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
- if (gDoSchedulingGroup) {
- // set_sched_policy does not support tid == 0
- if (tid == 0) {
- tid = androidGetTid();
- }
- if (set_sched_policy(tid, (grp == ANDROID_TGROUP_BG_NONINTERACT) ?
- SP_BACKGROUND : SP_FOREGROUND)) {
- return PERMISSION_DENIED;
- }
- }
-#endif
-
- return NO_ERROR;
-}
-
-int androidSetThreadPriority(pid_t tid, int pri)
-{
- int rc = 0;
-
-#if defined(HAVE_PTHREADS)
- int lasterr = 0;
-
- pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
- if (gDoSchedulingGroup) {
- // set_sched_policy does not support tid == 0
- int policy_tid;
- if (tid == 0) {
- policy_tid = androidGetTid();
- } else {
- policy_tid = tid;
- }
- if (pri >= ANDROID_PRIORITY_BACKGROUND) {
- rc = set_sched_policy(policy_tid, SP_BACKGROUND);
- } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) {
- rc = set_sched_policy(policy_tid, SP_FOREGROUND);
- }
- }
-
- if (rc) {
- lasterr = errno;
- }
-
- if (setpriority(PRIO_PROCESS, tid, pri) < 0) {
- rc = INVALID_OPERATION;
- } else {
- errno = lasterr;
- }
-#endif
-
- return rc;
-}
-
-int androidGetThreadPriority(pid_t tid) {
-#if defined(HAVE_PTHREADS)
- return getpriority(PRIO_PROCESS, tid);
-#else
- return ANDROID_PRIORITY_NORMAL;
-#endif
-}
-
-int androidGetThreadSchedulingGroup(pid_t tid)
-{
- int ret = ANDROID_TGROUP_DEFAULT;
-
-#if defined(HAVE_PTHREADS)
- // convention is to not call get/set_sched_policy methods if disabled by property
- pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
- if (gDoSchedulingGroup) {
- SchedPolicy policy;
- // get_sched_policy does not support tid == 0
- if (tid == 0) {
- tid = androidGetTid();
- }
- if (get_sched_policy(tid, &policy) < 0) {
- ret = INVALID_OPERATION;
- } else {
- switch (policy) {
- case SP_BACKGROUND:
- ret = ANDROID_TGROUP_BG_NONINTERACT;
- break;
- case SP_FOREGROUND:
- ret = ANDROID_TGROUP_FG_BOOST;
- break;
- default:
- // should not happen, as enum SchedPolicy does not have any other values
- ret = INVALID_OPERATION;
- break;
- }
- }
- }
-#endif
-
- return ret;
-}
-
-namespace android {
-
-/*
- * ===========================================================================
- * Mutex class
- * ===========================================================================
- */
-
-#if defined(HAVE_PTHREADS)
-// implemented as inlines in threads.h
-#elif defined(HAVE_WIN32_THREADS)
-
-Mutex::Mutex()
-{
- HANDLE hMutex;
-
- assert(sizeof(hMutex) == sizeof(mState));
-
- hMutex = CreateMutex(NULL, FALSE, NULL);
- mState = (void*) hMutex;
-}
-
-Mutex::Mutex(const char* name)
-{
- // XXX: name not used for now
- HANDLE hMutex;
-
- assert(sizeof(hMutex) == sizeof(mState));
-
- hMutex = CreateMutex(NULL, FALSE, NULL);
- mState = (void*) hMutex;
-}
-
-Mutex::Mutex(int type, const char* name)
-{
- // XXX: type and name not used for now
- HANDLE hMutex;
-
- assert(sizeof(hMutex) == sizeof(mState));
-
- hMutex = CreateMutex(NULL, FALSE, NULL);
- mState = (void*) hMutex;
-}
-
-Mutex::~Mutex()
-{
- CloseHandle((HANDLE) mState);
-}
-
-status_t Mutex::lock()
-{
- DWORD dwWaitResult;
- dwWaitResult = WaitForSingleObject((HANDLE) mState, INFINITE);
- return dwWaitResult != WAIT_OBJECT_0 ? -1 : NO_ERROR;
-}
-
-void Mutex::unlock()
-{
- if (!ReleaseMutex((HANDLE) mState))
- ALOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n");
-}
-
-status_t Mutex::tryLock()
-{
- DWORD dwWaitResult;
-
- dwWaitResult = WaitForSingleObject((HANDLE) mState, 0);
- if (dwWaitResult != WAIT_OBJECT_0 && dwWaitResult != WAIT_TIMEOUT)
- ALOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n");
- return (dwWaitResult == WAIT_OBJECT_0) ? 0 : -1;
-}
-
-#else
-#error "Somebody forgot to implement threads for this platform."
-#endif
-
-
-/*
- * ===========================================================================
- * Condition class
- * ===========================================================================
- */
-
-#if defined(HAVE_PTHREADS)
-// implemented as inlines in threads.h
-#elif defined(HAVE_WIN32_THREADS)
-
-/*
- * Windows doesn't have a condition variable solution. It's possible
- * to create one, but it's easy to get it wrong. For a discussion, and
- * the origin of this implementation, see:
- *
- * http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
- *
- * The implementation shown on the page does NOT follow POSIX semantics.
- * As an optimization they require acquiring the external mutex before
- * calling signal() and broadcast(), whereas POSIX only requires grabbing
- * it before calling wait(). The implementation here has been un-optimized
- * to have the correct behavior.
- */
-typedef struct WinCondition {
- // Number of waiting threads.
- int waitersCount;
-
- // Serialize access to waitersCount.
- CRITICAL_SECTION waitersCountLock;
-
- // Semaphore used to queue up threads waiting for the condition to
- // become signaled.
- HANDLE sema;
-
- // An auto-reset event used by the broadcast/signal thread to wait
- // for all the waiting thread(s) to wake up and be released from
- // the semaphore.
- HANDLE waitersDone;
-
- // This mutex wouldn't be necessary if we required that the caller
- // lock the external mutex before calling signal() and broadcast().
- // I'm trying to mimic pthread semantics though.
- HANDLE internalMutex;
-
- // Keeps track of whether we were broadcasting or signaling. This
- // allows us to optimize the code if we're just signaling.
- bool wasBroadcast;
-
- status_t wait(WinCondition* condState, HANDLE hMutex, nsecs_t* abstime)
- {
- // Increment the wait count, avoiding race conditions.
- EnterCriticalSection(&condState->waitersCountLock);
- condState->waitersCount++;
- //printf("+++ wait: incr waitersCount to %d (tid=%ld)\n",
- // condState->waitersCount, getThreadId());
- LeaveCriticalSection(&condState->waitersCountLock);
-
- DWORD timeout = INFINITE;
- if (abstime) {
- nsecs_t reltime = *abstime - systemTime();
- if (reltime < 0)
- reltime = 0;
- timeout = reltime/1000000;
- }
-
- // Atomically release the external mutex and wait on the semaphore.
- DWORD res =
- SignalObjectAndWait(hMutex, condState->sema, timeout, FALSE);
-
- //printf("+++ wait: awake (tid=%ld)\n", getThreadId());
-
- // Reacquire lock to avoid race conditions.
- EnterCriticalSection(&condState->waitersCountLock);
-
- // No longer waiting.
- condState->waitersCount--;
-
- // Check to see if we're the last waiter after a broadcast.
- bool lastWaiter = (condState->wasBroadcast && condState->waitersCount == 0);
-
- //printf("+++ wait: lastWaiter=%d (wasBc=%d wc=%d)\n",
- // lastWaiter, condState->wasBroadcast, condState->waitersCount);
-
- LeaveCriticalSection(&condState->waitersCountLock);
-
- // If we're the last waiter thread during this particular broadcast
- // then signal broadcast() that we're all awake. It'll drop the
- // internal mutex.
- if (lastWaiter) {
- // Atomically signal the "waitersDone" event and wait until we
- // can acquire the internal mutex. We want to do this in one step
- // because it ensures that everybody is in the mutex FIFO before
- // any thread has a chance to run. Without it, another thread
- // could wake up, do work, and hop back in ahead of us.
- SignalObjectAndWait(condState->waitersDone, condState->internalMutex,
- INFINITE, FALSE);
- } else {
- // Grab the internal mutex.
- WaitForSingleObject(condState->internalMutex, INFINITE);
- }
-
- // Release the internal and grab the external.
- ReleaseMutex(condState->internalMutex);
- WaitForSingleObject(hMutex, INFINITE);
-
- return res == WAIT_OBJECT_0 ? NO_ERROR : -1;
- }
-} WinCondition;
-
-/*
- * Constructor. Set up the WinCondition stuff.
- */
-Condition::Condition()
-{
- WinCondition* condState = new WinCondition;
-
- condState->waitersCount = 0;
- condState->wasBroadcast = false;
- // semaphore: no security, initial value of 0
- condState->sema = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
- InitializeCriticalSection(&condState->waitersCountLock);
- // auto-reset event, not signaled initially
- condState->waitersDone = CreateEvent(NULL, FALSE, FALSE, NULL);
- // used so we don't have to lock external mutex on signal/broadcast
- condState->internalMutex = CreateMutex(NULL, FALSE, NULL);
-
- mState = condState;
-}
-
-/*
- * Destructor. Free Windows resources as well as our allocated storage.
- */
-Condition::~Condition()
-{
- WinCondition* condState = (WinCondition*) mState;
- if (condState != NULL) {
- CloseHandle(condState->sema);
- CloseHandle(condState->waitersDone);
- delete condState;
- }
-}
-
-
-status_t Condition::wait(Mutex& mutex)
-{
- WinCondition* condState = (WinCondition*) mState;
- HANDLE hMutex = (HANDLE) mutex.mState;
-
- return ((WinCondition*)mState)->wait(condState, hMutex, NULL);
-}
-
-status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime)
-{
- WinCondition* condState = (WinCondition*) mState;
- HANDLE hMutex = (HANDLE) mutex.mState;
- nsecs_t absTime = systemTime()+reltime;
-
- return ((WinCondition*)mState)->wait(condState, hMutex, &absTime);
-}
-
-/*
- * Signal the condition variable, allowing one thread to continue.
- */
-void Condition::signal()
-{
- WinCondition* condState = (WinCondition*) mState;
-
- // Lock the internal mutex. This ensures that we don't clash with
- // broadcast().
- WaitForSingleObject(condState->internalMutex, INFINITE);
-
- EnterCriticalSection(&condState->waitersCountLock);
- bool haveWaiters = (condState->waitersCount > 0);
- LeaveCriticalSection(&condState->waitersCountLock);
-
- // If no waiters, then this is a no-op. Otherwise, knock the semaphore
- // down a notch.
- if (haveWaiters)
- ReleaseSemaphore(condState->sema, 1, 0);
-
- // Release internal mutex.
- ReleaseMutex(condState->internalMutex);
-}
-
-/*
- * Signal the condition variable, allowing all threads to continue.
- *
- * First we have to wake up all threads waiting on the semaphore, then
- * we wait until all of the threads have actually been woken before
- * releasing the internal mutex. This ensures that all threads are woken.
- */
-void Condition::broadcast()
-{
- WinCondition* condState = (WinCondition*) mState;
-
- // Lock the internal mutex. This keeps the guys we're waking up
- // from getting too far.
- WaitForSingleObject(condState->internalMutex, INFINITE);
-
- EnterCriticalSection(&condState->waitersCountLock);
- bool haveWaiters = false;
-
- if (condState->waitersCount > 0) {
- haveWaiters = true;
- condState->wasBroadcast = true;
- }
-
- if (haveWaiters) {
- // Wake up all the waiters.
- ReleaseSemaphore(condState->sema, condState->waitersCount, 0);
-
- LeaveCriticalSection(&condState->waitersCountLock);
-
- // Wait for all awakened threads to acquire the counting semaphore.
- // The last guy who was waiting sets this.
- WaitForSingleObject(condState->waitersDone, INFINITE);
-
- // Reset wasBroadcast. (No crit section needed because nobody
- // else can wake up to poke at it.)
- condState->wasBroadcast = 0;
- } else {
- // nothing to do
- LeaveCriticalSection(&condState->waitersCountLock);
- }
-
- // Release internal mutex.
- ReleaseMutex(condState->internalMutex);
-}
-
-#else
-#error "condition variables not supported on this platform"
-#endif
-
-// ----------------------------------------------------------------------------
-
-/*
- * This is our thread object!
- */
-
-Thread::Thread(bool canCallJava)
- : mCanCallJava(canCallJava),
- mThread(thread_id_t(-1)),
- mLock("Thread::mLock"),
- mStatus(NO_ERROR),
- mExitPending(false), mRunning(false)
-#ifdef HAVE_ANDROID_OS
- , mTid(-1)
-#endif
-{
-}
-
-Thread::~Thread()
-{
-}
-
-status_t Thread::readyToRun()
-{
- return NO_ERROR;
-}
-
-status_t Thread::run(const char* name, int32_t priority, size_t stack)
-{
- Mutex::Autolock _l(mLock);
-
- if (mRunning) {
- // thread already started
- return INVALID_OPERATION;
- }
-
- // reset status and exitPending to their default value, so we can
- // try again after an error happened (either below, or in readyToRun())
- mStatus = NO_ERROR;
- mExitPending = false;
- mThread = thread_id_t(-1);
-
- // hold a strong reference on ourself
- mHoldSelf = this;
-
- mRunning = true;
-
- bool res;
- if (mCanCallJava) {
- res = createThreadEtc(_threadLoop,
- this, name, priority, stack, &mThread);
- } else {
- res = androidCreateRawThreadEtc(_threadLoop,
- this, name, priority, stack, &mThread);
- }
-
- if (res == false) {
- mStatus = UNKNOWN_ERROR; // something happened!
- mRunning = false;
- mThread = thread_id_t(-1);
- mHoldSelf.clear(); // "this" may have gone away after this.
-
- return UNKNOWN_ERROR;
- }
-
- // Do not refer to mStatus here: The thread is already running (may, in fact
- // already have exited with a valid mStatus result). The NO_ERROR indication
- // here merely indicates successfully starting the thread and does not
- // imply successful termination/execution.
- return NO_ERROR;
-
- // Exiting scope of mLock is a memory barrier and allows new thread to run
-}
-
-int Thread::_threadLoop(void* user)
-{
- Thread* const self = static_cast<Thread*>(user);
-
- sp<Thread> strong(self->mHoldSelf);
- wp<Thread> weak(strong);
- self->mHoldSelf.clear();
-
-#ifdef HAVE_ANDROID_OS
- // this is very useful for debugging with gdb
- self->mTid = gettid();
-#endif
-
- bool first = true;
-
- do {
- bool result;
- if (first) {
- first = false;
- self->mStatus = self->readyToRun();
- result = (self->mStatus == NO_ERROR);
-
- if (result && !self->exitPending()) {
- // Binder threads (and maybe others) rely on threadLoop
- // running at least once after a successful ::readyToRun()
- // (unless, of course, the thread has already been asked to exit
- // at that point).
- // This is because threads are essentially used like this:
- // (new ThreadSubclass())->run();
- // The caller therefore does not retain a strong reference to
- // the thread and the thread would simply disappear after the
- // successful ::readyToRun() call instead of entering the
- // threadLoop at least once.
- result = self->threadLoop();
- }
- } else {
- result = self->threadLoop();
- }
-
- // establish a scope for mLock
- {
- Mutex::Autolock _l(self->mLock);
- if (result == false || self->mExitPending) {
- self->mExitPending = true;
- self->mRunning = false;
- // clear thread ID so that requestExitAndWait() does not exit if
- // called by a new thread using the same thread ID as this one.
- self->mThread = thread_id_t(-1);
- // note that interested observers blocked in requestExitAndWait are
- // awoken by broadcast, but blocked on mLock until break exits scope
- self->mThreadExitedCondition.broadcast();
- break;
- }
- }
-
- // Release our strong reference, to let a chance to the thread
- // to die a peaceful death.
- strong.clear();
- // And immediately, re-acquire a strong reference for the next loop
- strong = weak.promote();
- } while(strong != 0);
-
- return 0;
-}
-
-void Thread::requestExit()
-{
- Mutex::Autolock _l(mLock);
- mExitPending = true;
-}
-
-status_t Thread::requestExitAndWait()
-{
- Mutex::Autolock _l(mLock);
- if (mThread == getThreadId()) {
- ALOGW(
- "Thread (this=%p): don't call waitForExit() from this "
- "Thread object's thread. It's a guaranteed deadlock!",
- this);
-
- return WOULD_BLOCK;
- }
-
- mExitPending = true;
-
- while (mRunning == true) {
- mThreadExitedCondition.wait(mLock);
- }
- // This next line is probably not needed any more, but is being left for
- // historical reference. Note that each interested party will clear flag.
- mExitPending = false;
-
- return mStatus;
-}
-
-status_t Thread::join()
-{
- Mutex::Autolock _l(mLock);
- if (mThread == getThreadId()) {
- ALOGW(
- "Thread (this=%p): don't call join() from this "
- "Thread object's thread. It's a guaranteed deadlock!",
- this);
-
- return WOULD_BLOCK;
- }
-
- while (mRunning == true) {
- mThreadExitedCondition.wait(mLock);
- }
-
- return mStatus;
-}
-
-#ifdef HAVE_ANDROID_OS
-pid_t Thread::getTid() const
-{
- // mTid is not defined until the child initializes it, and the caller may need it earlier
- Mutex::Autolock _l(mLock);
- pid_t tid;
- if (mRunning) {
- pthread_t pthread = android_thread_id_t_to_pthread(mThread);
- tid = __pthread_gettid(pthread);
- } else {
- ALOGW("Thread (this=%p): getTid() is undefined before run()", this);
- tid = -1;
- }
- return tid;
-}
-#endif
-
-bool Thread::exitPending() const
-{
- Mutex::Autolock _l(mLock);
- return mExitPending;
-}
-
-
-
-}; // namespace android
diff --git a/libs/utils/Timers.cpp b/libs/utils/Timers.cpp
deleted file mode 100644
index 64b4701..0000000
--- a/libs/utils/Timers.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Timer functions.
-//
-#include <utils/Timers.h>
-#include <utils/Log.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <time.h>
-#include <errno.h>
-#include <limits.h>
-
-#ifdef HAVE_WIN32_THREADS
-#include <windows.h>
-#endif
-
-nsecs_t systemTime(int clock)
-{
-#if defined(HAVE_POSIX_CLOCKS)
- static const clockid_t clocks[] = {
- CLOCK_REALTIME,
- CLOCK_MONOTONIC,
- CLOCK_PROCESS_CPUTIME_ID,
- CLOCK_THREAD_CPUTIME_ID
- };
- struct timespec t;
- t.tv_sec = t.tv_nsec = 0;
- clock_gettime(clocks[clock], &t);
- return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec;
-#else
- // we don't support the clocks here.
- struct timeval t;
- t.tv_sec = t.tv_usec = 0;
- gettimeofday(&t, NULL);
- return nsecs_t(t.tv_sec)*1000000000LL + nsecs_t(t.tv_usec)*1000LL;
-#endif
-}
-
-int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime)
-{
- int timeoutDelayMillis;
- if (timeoutTime > referenceTime) {
- uint64_t timeoutDelay = uint64_t(timeoutTime - referenceTime);
- if (timeoutDelay > uint64_t((INT_MAX - 1) * 1000000LL)) {
- timeoutDelayMillis = -1;
- } else {
- timeoutDelayMillis = (timeoutDelay + 999999LL) / 1000000LL;
- }
- } else {
- timeoutDelayMillis = 0;
- }
- return timeoutDelayMillis;
-}
-
-
-/*
- * ===========================================================================
- * DurationTimer
- * ===========================================================================
- */
-
-using namespace android;
-
-// Start the timer.
-void DurationTimer::start(void)
-{
- gettimeofday(&mStartWhen, NULL);
-}
-
-// Stop the timer.
-void DurationTimer::stop(void)
-{
- gettimeofday(&mStopWhen, NULL);
-}
-
-// Get the duration in microseconds.
-long long DurationTimer::durationUsecs(void) const
-{
- return (long) subtractTimevals(&mStopWhen, &mStartWhen);
-}
-
-// Subtract two timevals. Returns the difference (ptv1-ptv2) in
-// microseconds.
-/*static*/ long long DurationTimer::subtractTimevals(const struct timeval* ptv1,
- const struct timeval* ptv2)
-{
- long long stop = ((long long) ptv1->tv_sec) * 1000000LL +
- ((long long) ptv1->tv_usec);
- long long start = ((long long) ptv2->tv_sec) * 1000000LL +
- ((long long) ptv2->tv_usec);
- return stop - start;
-}
-
-// Add the specified amount of time to the timeval.
-/*static*/ void DurationTimer::addToTimeval(struct timeval* ptv, long usec)
-{
- if (usec < 0) {
- ALOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n");
- return;
- }
-
- // normalize tv_usec if necessary
- if (ptv->tv_usec >= 1000000) {
- ptv->tv_sec += ptv->tv_usec / 1000000;
- ptv->tv_usec %= 1000000;
- }
-
- ptv->tv_usec += usec % 1000000;
- if (ptv->tv_usec >= 1000000) {
- ptv->tv_usec -= 1000000;
- ptv->tv_sec++;
- }
- ptv->tv_sec += usec / 1000000;
-}
-
diff --git a/libs/utils/Tokenizer.cpp b/libs/utils/Tokenizer.cpp
deleted file mode 100644
index efda2bf..0000000
--- a/libs/utils/Tokenizer.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Tokenizer"
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <utils/Log.h>
-#include <utils/Tokenizer.h>
-
-// Enables debug output for the tokenizer.
-#define DEBUG_TOKENIZER 0
-
-
-namespace android {
-
-static inline bool isDelimiter(char ch, const char* delimiters) {
- return strchr(delimiters, ch) != NULL;
-}
-
-Tokenizer::Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, size_t length) :
- mFilename(filename), mFileMap(fileMap),
- mBuffer(buffer), mLength(length), mCurrent(buffer), mLineNumber(1) {
-}
-
-Tokenizer::~Tokenizer() {
- if (mFileMap) {
- mFileMap->release();
- } else {
- delete[] mBuffer;
- }
-}
-
-status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) {
- *outTokenizer = NULL;
-
- int result = NO_ERROR;
- int fd = ::open(filename.string(), O_RDONLY);
- if (fd < 0) {
- result = -errno;
- ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno));
- } else {
- struct stat stat;
- if (fstat(fd, &stat)) {
- result = -errno;
- ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno));
- } else {
- size_t length = size_t(stat.st_size);
-
- FileMap* fileMap = new FileMap();
- char* buffer;
- if (fileMap->create(NULL, fd, 0, length, true)) {
- fileMap->advise(FileMap::SEQUENTIAL);
- buffer = static_cast<char*>(fileMap->getDataPtr());
- } else {
- fileMap->release();
- fileMap = NULL;
-
- // Fall back to reading into a buffer since we can't mmap files in sysfs.
- // The length we obtained from stat is wrong too (it will always be 4096)
- // so we must trust that read will read the entire file.
- buffer = new char[length];
- ssize_t nrd = read(fd, buffer, length);
- if (nrd < 0) {
- result = -errno;
- ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno));
- delete[] buffer;
- buffer = NULL;
- } else {
- length = size_t(nrd);
- }
- }
-
- if (!result) {
- *outTokenizer = new Tokenizer(filename, fileMap, buffer, length);
- }
- }
- close(fd);
- }
- return result;
-}
-
-String8 Tokenizer::getLocation() const {
- String8 result;
- result.appendFormat("%s:%d", mFilename.string(), mLineNumber);
- return result;
-}
-
-String8 Tokenizer::peekRemainderOfLine() const {
- const char* end = getEnd();
- const char* eol = mCurrent;
- while (eol != end) {
- char ch = *eol;
- if (ch == '\n') {
- break;
- }
- eol += 1;
- }
- return String8(mCurrent, eol - mCurrent);
-}
-
-String8 Tokenizer::nextToken(const char* delimiters) {
-#if DEBUG_TOKENIZER
- ALOGD("nextToken");
-#endif
- const char* end = getEnd();
- const char* tokenStart = mCurrent;
- while (mCurrent != end) {
- char ch = *mCurrent;
- if (ch == '\n' || isDelimiter(ch, delimiters)) {
- break;
- }
- mCurrent += 1;
- }
- return String8(tokenStart, mCurrent - tokenStart);
-}
-
-void Tokenizer::nextLine() {
-#if DEBUG_TOKENIZER
- ALOGD("nextLine");
-#endif
- const char* end = getEnd();
- while (mCurrent != end) {
- char ch = *(mCurrent++);
- if (ch == '\n') {
- mLineNumber += 1;
- break;
- }
- }
-}
-
-void Tokenizer::skipDelimiters(const char* delimiters) {
-#if DEBUG_TOKENIZER
- ALOGD("skipDelimiters");
-#endif
- const char* end = getEnd();
- while (mCurrent != end) {
- char ch = *mCurrent;
- if (ch == '\n' || !isDelimiter(ch, delimiters)) {
- break;
- }
- mCurrent += 1;
- }
-}
-
-} // namespace android
diff --git a/libs/utils/Trace.cpp b/libs/utils/Trace.cpp
deleted file mode 100644
index c49278a..0000000
--- a/libs/utils/Trace.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-#include <cutils/properties.h>
-#include <utils/Log.h>
-#include <utils/Trace.h>
-
-namespace android {
-
-volatile int32_t Tracer::sIsReady = 0;
-int Tracer::sTraceFD = -1;
-uint64_t Tracer::sEnabledTags = 0;
-Mutex Tracer::sMutex;
-
-void Tracer::init() {
- Mutex::Autolock lock(sMutex);
-
- if (!sIsReady) {
- const char* const traceFileName =
- "/sys/kernel/debug/tracing/trace_marker";
- sTraceFD = open(traceFileName, O_WRONLY);
- if (sTraceFD == -1) {
- ALOGE("error opening trace file: %s (%d)", strerror(errno), errno);
- } else {
- char value[PROPERTY_VALUE_MAX];
- property_get("atrace.tags.enableflags", value, "0");
- sEnabledTags = strtoll(value, NULL, 0) | ATRACE_TAG_ALWAYS;
- }
-
- android_atomic_release_store(1, &sIsReady);
- }
-}
-
-} // namespace andoid
diff --git a/libs/utils/Unicode.cpp b/libs/utils/Unicode.cpp
deleted file mode 100644
index 41cbf03..0000000
--- a/libs/utils/Unicode.cpp
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/Unicode.h>
-
-#include <stddef.h>
-
-#ifdef HAVE_WINSOCK
-# undef nhtol
-# undef htonl
-# undef nhtos
-# undef htons
-
-# ifdef HAVE_LITTLE_ENDIAN
-# define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) )
-# define htonl(x) ntohl(x)
-# define ntohs(x) ( (((x) << 8) & 0xff00) | (((x) >> 8) & 255) )
-# define htons(x) ntohs(x)
-# else
-# define ntohl(x) (x)
-# define htonl(x) (x)
-# define ntohs(x) (x)
-# define htons(x) (x)
-# endif
-#else
-# include <netinet/in.h>
-#endif
-
-extern "C" {
-
-static const char32_t kByteMask = 0x000000BF;
-static const char32_t kByteMark = 0x00000080;
-
-// Surrogates aren't valid for UTF-32 characters, so define some
-// constants that will let us screen them out.
-static const char32_t kUnicodeSurrogateHighStart = 0x0000D800;
-static const char32_t kUnicodeSurrogateHighEnd = 0x0000DBFF;
-static const char32_t kUnicodeSurrogateLowStart = 0x0000DC00;
-static const char32_t kUnicodeSurrogateLowEnd = 0x0000DFFF;
-static const char32_t kUnicodeSurrogateStart = kUnicodeSurrogateHighStart;
-static const char32_t kUnicodeSurrogateEnd = kUnicodeSurrogateLowEnd;
-static const char32_t kUnicodeMaxCodepoint = 0x0010FFFF;
-
-// Mask used to set appropriate bits in first byte of UTF-8 sequence,
-// indexed by number of bytes in the sequence.
-// 0xxxxxxx
-// -> (00-7f) 7bit. Bit mask for the first byte is 0x00000000
-// 110yyyyx 10xxxxxx
-// -> (c0-df)(80-bf) 11bit. Bit mask is 0x000000C0
-// 1110yyyy 10yxxxxx 10xxxxxx
-// -> (e0-ef)(80-bf)(80-bf) 16bit. Bit mask is 0x000000E0
-// 11110yyy 10yyxxxx 10xxxxxx 10xxxxxx
-// -> (f0-f7)(80-bf)(80-bf)(80-bf) 21bit. Bit mask is 0x000000F0
-static const char32_t kFirstByteMark[] = {
- 0x00000000, 0x00000000, 0x000000C0, 0x000000E0, 0x000000F0
-};
-
-// --------------------------------------------------------------------------
-// UTF-32
-// --------------------------------------------------------------------------
-
-/**
- * Return number of UTF-8 bytes required for the character. If the character
- * is invalid, return size of 0.
- */
-static inline size_t utf32_codepoint_utf8_length(char32_t srcChar)
-{
- // Figure out how many bytes the result will require.
- if (srcChar < 0x00000080) {
- return 1;
- } else if (srcChar < 0x00000800) {
- return 2;
- } else if (srcChar < 0x00010000) {
- if ((srcChar < kUnicodeSurrogateStart) || (srcChar > kUnicodeSurrogateEnd)) {
- return 3;
- } else {
- // Surrogates are invalid UTF-32 characters.
- return 0;
- }
- }
- // Max code point for Unicode is 0x0010FFFF.
- else if (srcChar <= kUnicodeMaxCodepoint) {
- return 4;
- } else {
- // Invalid UTF-32 character.
- return 0;
- }
-}
-
-// Write out the source character to <dstP>.
-
-static inline void utf32_codepoint_to_utf8(uint8_t* dstP, char32_t srcChar, size_t bytes)
-{
- dstP += bytes;
- switch (bytes)
- { /* note: everything falls through. */
- case 4: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6;
- case 3: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6;
- case 2: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6;
- case 1: *--dstP = (uint8_t)(srcChar | kFirstByteMark[bytes]);
- }
-}
-
-size_t strlen32(const char32_t *s)
-{
- const char32_t *ss = s;
- while ( *ss )
- ss++;
- return ss-s;
-}
-
-size_t strnlen32(const char32_t *s, size_t maxlen)
-{
- const char32_t *ss = s;
- while ((maxlen > 0) && *ss) {
- ss++;
- maxlen--;
- }
- return ss-s;
-}
-
-static inline int32_t utf32_at_internal(const char* cur, size_t *num_read)
-{
- const char first_char = *cur;
- if ((first_char & 0x80) == 0) { // ASCII
- *num_read = 1;
- return *cur;
- }
- cur++;
- char32_t mask, to_ignore_mask;
- size_t num_to_read = 0;
- char32_t utf32 = first_char;
- for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0xFFFFFF80;
- (first_char & mask);
- num_to_read++, to_ignore_mask |= mask, mask >>= 1) {
- // 0x3F == 00111111
- utf32 = (utf32 << 6) + (*cur++ & 0x3F);
- }
- to_ignore_mask |= mask;
- utf32 &= ~(to_ignore_mask << (6 * (num_to_read - 1)));
-
- *num_read = num_to_read;
- return static_cast<int32_t>(utf32);
-}
-
-int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index)
-{
- if (index >= src_len) {
- return -1;
- }
- size_t dummy_index;
- if (next_index == NULL) {
- next_index = &dummy_index;
- }
- size_t num_read;
- int32_t ret = utf32_at_internal(src + index, &num_read);
- if (ret >= 0) {
- *next_index = index + num_read;
- }
-
- return ret;
-}
-
-ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len)
-{
- if (src == NULL || src_len == 0) {
- return -1;
- }
-
- size_t ret = 0;
- const char32_t *end = src + src_len;
- while (src < end) {
- ret += utf32_codepoint_utf8_length(*src++);
- }
- return ret;
-}
-
-void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst)
-{
- if (src == NULL || src_len == 0 || dst == NULL) {
- return;
- }
-
- const char32_t *cur_utf32 = src;
- const char32_t *end_utf32 = src + src_len;
- char *cur = dst;
- while (cur_utf32 < end_utf32) {
- size_t len = utf32_codepoint_utf8_length(*cur_utf32);
- utf32_codepoint_to_utf8((uint8_t *)cur, *cur_utf32++, len);
- cur += len;
- }
- *cur = '\0';
-}
-
-// --------------------------------------------------------------------------
-// UTF-16
-// --------------------------------------------------------------------------
-
-int strcmp16(const char16_t *s1, const char16_t *s2)
-{
- char16_t ch;
- int d = 0;
-
- while ( 1 ) {
- d = (int)(ch = *s1++) - (int)*s2++;
- if ( d || !ch )
- break;
- }
-
- return d;
-}
-
-int strncmp16(const char16_t *s1, const char16_t *s2, size_t n)
-{
- char16_t ch;
- int d = 0;
-
- while ( n-- ) {
- d = (int)(ch = *s1++) - (int)*s2++;
- if ( d || !ch )
- break;
- }
-
- return d;
-}
-
-char16_t *strcpy16(char16_t *dst, const char16_t *src)
-{
- char16_t *q = dst;
- const char16_t *p = src;
- char16_t ch;
-
- do {
- *q++ = ch = *p++;
- } while ( ch );
-
- return dst;
-}
-
-size_t strlen16(const char16_t *s)
-{
- const char16_t *ss = s;
- while ( *ss )
- ss++;
- return ss-s;
-}
-
-
-char16_t *strncpy16(char16_t *dst, const char16_t *src, size_t n)
-{
- char16_t *q = dst;
- const char16_t *p = src;
- char ch;
-
- while (n) {
- n--;
- *q++ = ch = *p++;
- if ( !ch )
- break;
- }
-
- *q = 0;
-
- return dst;
-}
-
-size_t strnlen16(const char16_t *s, size_t maxlen)
-{
- const char16_t *ss = s;
-
- /* Important: the maxlen test must precede the reference through ss;
- since the byte beyond the maximum may segfault */
- while ((maxlen > 0) && *ss) {
- ss++;
- maxlen--;
- }
- return ss-s;
-}
-
-int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2)
-{
- const char16_t* e1 = s1+n1;
- const char16_t* e2 = s2+n2;
-
- while (s1 < e1 && s2 < e2) {
- const int d = (int)*s1++ - (int)*s2++;
- if (d) {
- return d;
- }
- }
-
- return n1 < n2
- ? (0 - (int)*s2)
- : (n1 > n2
- ? ((int)*s1 - 0)
- : 0);
-}
-
-int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2)
-{
- const char16_t* e1 = s1H+n1;
- const char16_t* e2 = s2N+n2;
-
- while (s1H < e1 && s2N < e2) {
- const char16_t c2 = ntohs(*s2N);
- const int d = (int)*s1H++ - (int)c2;
- s2N++;
- if (d) {
- return d;
- }
- }
-
- return n1 < n2
- ? (0 - (int)ntohs(*s2N))
- : (n1 > n2
- ? ((int)*s1H - 0)
- : 0);
-}
-
-void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst)
-{
- if (src == NULL || src_len == 0 || dst == NULL) {
- return;
- }
-
- const char16_t* cur_utf16 = src;
- const char16_t* const end_utf16 = src + src_len;
- char *cur = dst;
- while (cur_utf16 < end_utf16) {
- char32_t utf32;
- // surrogate pairs
- if ((*cur_utf16 & 0xFC00) == 0xD800) {
- utf32 = (*cur_utf16++ - 0xD800) << 10;
- utf32 |= *cur_utf16++ - 0xDC00;
- utf32 += 0x10000;
- } else {
- utf32 = (char32_t) *cur_utf16++;
- }
- const size_t len = utf32_codepoint_utf8_length(utf32);
- utf32_codepoint_to_utf8((uint8_t*)cur, utf32, len);
- cur += len;
- }
- *cur = '\0';
-}
-
-// --------------------------------------------------------------------------
-// UTF-8
-// --------------------------------------------------------------------------
-
-ssize_t utf8_length(const char *src)
-{
- const char *cur = src;
- size_t ret = 0;
- while (*cur != '\0') {
- const char first_char = *cur++;
- if ((first_char & 0x80) == 0) { // ASCII
- ret += 1;
- continue;
- }
- // (UTF-8's character must not be like 10xxxxxx,
- // but 110xxxxx, 1110xxxx, ... or 1111110x)
- if ((first_char & 0x40) == 0) {
- return -1;
- }
-
- int32_t mask, to_ignore_mask;
- size_t num_to_read = 0;
- char32_t utf32 = 0;
- for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0x80;
- num_to_read < 5 && (first_char & mask);
- num_to_read++, to_ignore_mask |= mask, mask >>= 1) {
- if ((*cur & 0xC0) != 0x80) { // must be 10xxxxxx
- return -1;
- }
- // 0x3F == 00111111
- utf32 = (utf32 << 6) + (*cur++ & 0x3F);
- }
- // "first_char" must be (110xxxxx - 11110xxx)
- if (num_to_read == 5) {
- return -1;
- }
- to_ignore_mask |= mask;
- utf32 |= ((~to_ignore_mask) & first_char) << (6 * (num_to_read - 1));
- if (utf32 > kUnicodeMaxCodepoint) {
- return -1;
- }
-
- ret += num_to_read;
- }
- return ret;
-}
-
-ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len)
-{
- if (src == NULL || src_len == 0) {
- return -1;
- }
-
- size_t ret = 0;
- const char16_t* const end = src + src_len;
- while (src < end) {
- if ((*src & 0xFC00) == 0xD800 && (src + 1) < end
- && (*++src & 0xFC00) == 0xDC00) {
- // surrogate pairs are always 4 bytes.
- ret += 4;
- src++;
- } else {
- ret += utf32_codepoint_utf8_length((char32_t) *src++);
- }
- }
- return ret;
-}
-
-/**
- * Returns 1-4 based on the number of leading bits.
- *
- * 1111 -> 4
- * 1110 -> 3
- * 110x -> 2
- * 10xx -> 1
- * 0xxx -> 1
- */
-static inline size_t utf8_codepoint_len(uint8_t ch)
-{
- return ((0xe5000000 >> ((ch >> 3) & 0x1e)) & 3) + 1;
-}
-
-static inline void utf8_shift_and_mask(uint32_t* codePoint, const uint8_t byte)
-{
- *codePoint <<= 6;
- *codePoint |= 0x3F & byte;
-}
-
-size_t utf8_to_utf32_length(const char *src, size_t src_len)
-{
- if (src == NULL || src_len == 0) {
- return 0;
- }
- size_t ret = 0;
- const char* cur;
- const char* end;
- size_t num_to_skip;
- for (cur = src, end = src + src_len, num_to_skip = 1;
- cur < end;
- cur += num_to_skip, ret++) {
- const char first_char = *cur;
- num_to_skip = 1;
- if ((first_char & 0x80) == 0) { // ASCII
- continue;
- }
- int32_t mask;
-
- for (mask = 0x40; (first_char & mask); num_to_skip++, mask >>= 1) {
- }
- }
- return ret;
-}
-
-void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst)
-{
- if (src == NULL || src_len == 0 || dst == NULL) {
- return;
- }
-
- const char* cur = src;
- const char* const end = src + src_len;
- char32_t* cur_utf32 = dst;
- while (cur < end) {
- size_t num_read;
- *cur_utf32++ = static_cast<char32_t>(utf32_at_internal(cur, &num_read));
- cur += num_read;
- }
- *cur_utf32 = 0;
-}
-
-static inline uint32_t utf8_to_utf32_codepoint(const uint8_t *src, size_t length)
-{
- uint32_t unicode;
-
- switch (length)
- {
- case 1:
- return src[0];
- case 2:
- unicode = src[0] & 0x1f;
- utf8_shift_and_mask(&unicode, src[1]);
- return unicode;
- case 3:
- unicode = src[0] & 0x0f;
- utf8_shift_and_mask(&unicode, src[1]);
- utf8_shift_and_mask(&unicode, src[2]);
- return unicode;
- case 4:
- unicode = src[0] & 0x07;
- utf8_shift_and_mask(&unicode, src[1]);
- utf8_shift_and_mask(&unicode, src[2]);
- utf8_shift_and_mask(&unicode, src[3]);
- return unicode;
- default:
- return 0xffff;
- }
-
- //printf("Char at %p: len=%d, utf-16=%p\n", src, length, (void*)result);
-}
-
-ssize_t utf8_to_utf16_length(const uint8_t* u8str, size_t u8len)
-{
- const uint8_t* const u8end = u8str + u8len;
- const uint8_t* u8cur = u8str;
-
- /* Validate that the UTF-8 is the correct len */
- size_t u16measuredLen = 0;
- while (u8cur < u8end) {
- u16measuredLen++;
- int u8charLen = utf8_codepoint_len(*u8cur);
- uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8charLen);
- if (codepoint > 0xFFFF) u16measuredLen++; // this will be a surrogate pair in utf16
- u8cur += u8charLen;
- }
-
- /**
- * Make sure that we ended where we thought we would and the output UTF-16
- * will be exactly how long we were told it would be.
- */
- if (u8cur != u8end) {
- return -1;
- }
-
- return u16measuredLen;
-}
-
-char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* u8str, size_t u8len, char16_t* u16str)
-{
- const uint8_t* const u8end = u8str + u8len;
- const uint8_t* u8cur = u8str;
- char16_t* u16cur = u16str;
-
- while (u8cur < u8end) {
- size_t u8len = utf8_codepoint_len(*u8cur);
- uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8len);
-
- // Convert the UTF32 codepoint to one or more UTF16 codepoints
- if (codepoint <= 0xFFFF) {
- // Single UTF16 character
- *u16cur++ = (char16_t) codepoint;
- } else {
- // Multiple UTF16 characters with surrogates
- codepoint = codepoint - 0x10000;
- *u16cur++ = (char16_t) ((codepoint >> 10) + 0xD800);
- *u16cur++ = (char16_t) ((codepoint & 0x3FF) + 0xDC00);
- }
-
- u8cur += u8len;
- }
- return u16cur;
-}
-
-void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) {
- char16_t* end = utf8_to_utf16_no_null_terminator(u8str, u8len, u16str);
- *end = 0;
-}
-
-}
diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp
deleted file mode 100644
index 220ae3e..0000000
--- a/libs/utils/VectorImpl.cpp
+++ /dev/null
@@ -1,624 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Vector"
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <utils/Log.h>
-#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
-#include <utils/VectorImpl.h>
-
-/*****************************************************************************/
-
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-const size_t kMinVectorCapacity = 4;
-
-static inline size_t max(size_t a, size_t b) {
- return a>b ? a : b;
-}
-
-// ----------------------------------------------------------------------------
-
-VectorImpl::VectorImpl(size_t itemSize, uint32_t flags)
- : mStorage(0), mCount(0), mFlags(flags), mItemSize(itemSize)
-{
-}
-
-VectorImpl::VectorImpl(const VectorImpl& rhs)
- : mStorage(rhs.mStorage), mCount(rhs.mCount),
- mFlags(rhs.mFlags), mItemSize(rhs.mItemSize)
-{
- if (mStorage) {
- SharedBuffer::sharedBuffer(mStorage)->acquire();
- }
-}
-
-VectorImpl::~VectorImpl()
-{
- ALOG_ASSERT(!mCount,
- "[%p] "
- "subclasses of VectorImpl must call finish_vector()"
- " in their destructor. Leaking %d bytes.",
- this, (int)(mCount*mItemSize));
- // We can't call _do_destroy() here because the vtable is already gone.
-}
-
-VectorImpl& VectorImpl::operator = (const VectorImpl& rhs)
-{
- ALOG_ASSERT(mItemSize == rhs.mItemSize,
- "Vector<> have different types (this=%p, rhs=%p)", this, &rhs);
- if (this != &rhs) {
- release_storage();
- if (rhs.mCount) {
- mStorage = rhs.mStorage;
- mCount = rhs.mCount;
- SharedBuffer::sharedBuffer(mStorage)->acquire();
- } else {
- mStorage = 0;
- mCount = 0;
- }
- }
- return *this;
-}
-
-void* VectorImpl::editArrayImpl()
-{
- if (mStorage) {
- SharedBuffer* sb = SharedBuffer::sharedBuffer(mStorage)->attemptEdit();
- if (sb == 0) {
- sb = SharedBuffer::alloc(capacity() * mItemSize);
- if (sb) {
- _do_copy(sb->data(), mStorage, mCount);
- release_storage();
- mStorage = sb->data();
- }
- }
- }
- return mStorage;
-}
-
-size_t VectorImpl::capacity() const
-{
- if (mStorage) {
- return SharedBuffer::sharedBuffer(mStorage)->size() / mItemSize;
- }
- return 0;
-}
-
-ssize_t VectorImpl::insertVectorAt(const VectorImpl& vector, size_t index)
-{
- return insertArrayAt(vector.arrayImpl(), index, vector.size());
-}
-
-ssize_t VectorImpl::appendVector(const VectorImpl& vector)
-{
- return insertVectorAt(vector, size());
-}
-
-ssize_t VectorImpl::insertArrayAt(const void* array, size_t index, size_t length)
-{
- if (index > size())
- return BAD_INDEX;
- void* where = _grow(index, length);
- if (where) {
- _do_copy(where, array, length);
- }
- return where ? index : (ssize_t)NO_MEMORY;
-}
-
-ssize_t VectorImpl::appendArray(const void* array, size_t length)
-{
- return insertArrayAt(array, size(), length);
-}
-
-ssize_t VectorImpl::insertAt(size_t index, size_t numItems)
-{
- return insertAt(0, index, numItems);
-}
-
-ssize_t VectorImpl::insertAt(const void* item, size_t index, size_t numItems)
-{
- if (index > size())
- return BAD_INDEX;
- void* where = _grow(index, numItems);
- if (where) {
- if (item) {
- _do_splat(where, item, numItems);
- } else {
- _do_construct(where, numItems);
- }
- }
- return where ? index : (ssize_t)NO_MEMORY;
-}
-
-static int sortProxy(const void* lhs, const void* rhs, void* func)
-{
- return (*(VectorImpl::compar_t)func)(lhs, rhs);
-}
-
-status_t VectorImpl::sort(VectorImpl::compar_t cmp)
-{
- return sort(sortProxy, (void*)cmp);
-}
-
-status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state)
-{
- // the sort must be stable. we're using insertion sort which
- // is well suited for small and already sorted arrays
- // for big arrays, it could be better to use mergesort
- const ssize_t count = size();
- if (count > 1) {
- void* array = const_cast<void*>(arrayImpl());
- void* temp = 0;
- ssize_t i = 1;
- while (i < count) {
- void* item = reinterpret_cast<char*>(array) + mItemSize*(i);
- void* curr = reinterpret_cast<char*>(array) + mItemSize*(i-1);
- if (cmp(curr, item, state) > 0) {
-
- if (!temp) {
- // we're going to have to modify the array...
- array = editArrayImpl();
- if (!array) return NO_MEMORY;
- temp = malloc(mItemSize);
- if (!temp) return NO_MEMORY;
- item = reinterpret_cast<char*>(array) + mItemSize*(i);
- curr = reinterpret_cast<char*>(array) + mItemSize*(i-1);
- } else {
- _do_destroy(temp, 1);
- }
-
- _do_copy(temp, item, 1);
-
- ssize_t j = i-1;
- void* next = reinterpret_cast<char*>(array) + mItemSize*(i);
- do {
- _do_destroy(next, 1);
- _do_copy(next, curr, 1);
- next = curr;
- --j;
- curr = reinterpret_cast<char*>(array) + mItemSize*(j);
- } while (j>=0 && (cmp(curr, temp, state) > 0));
-
- _do_destroy(next, 1);
- _do_copy(next, temp, 1);
- }
- i++;
- }
-
- if (temp) {
- _do_destroy(temp, 1);
- free(temp);
- }
- }
- return NO_ERROR;
-}
-
-void VectorImpl::pop()
-{
- if (size())
- removeItemsAt(size()-1, 1);
-}
-
-void VectorImpl::push()
-{
- push(0);
-}
-
-void VectorImpl::push(const void* item)
-{
- insertAt(item, size());
-}
-
-ssize_t VectorImpl::add()
-{
- return add(0);
-}
-
-ssize_t VectorImpl::add(const void* item)
-{
- return insertAt(item, size());
-}
-
-ssize_t VectorImpl::replaceAt(size_t index)
-{
- return replaceAt(0, index);
-}
-
-ssize_t VectorImpl::replaceAt(const void* prototype, size_t index)
-{
- ALOG_ASSERT(index<size(),
- "[%p] replace: index=%d, size=%d", this, (int)index, (int)size());
-
- void* item = editItemLocation(index);
- if (item != prototype) {
- if (item == 0)
- return NO_MEMORY;
- _do_destroy(item, 1);
- if (prototype == 0) {
- _do_construct(item, 1);
- } else {
- _do_copy(item, prototype, 1);
- }
- }
- return ssize_t(index);
-}
-
-ssize_t VectorImpl::removeItemsAt(size_t index, size_t count)
-{
- ALOG_ASSERT((index+count)<=size(),
- "[%p] remove: index=%d, count=%d, size=%d",
- this, (int)index, (int)count, (int)size());
-
- if ((index+count) > size())
- return BAD_VALUE;
- _shrink(index, count);
- return index;
-}
-
-void VectorImpl::finish_vector()
-{
- release_storage();
- mStorage = 0;
- mCount = 0;
-}
-
-void VectorImpl::clear()
-{
- _shrink(0, mCount);
-}
-
-void* VectorImpl::editItemLocation(size_t index)
-{
- ALOG_ASSERT(index<capacity(),
- "[%p] editItemLocation: index=%d, capacity=%d, count=%d",
- this, (int)index, (int)capacity(), (int)mCount);
-
- void* buffer = editArrayImpl();
- if (buffer)
- return reinterpret_cast<char*>(buffer) + index*mItemSize;
- return 0;
-}
-
-const void* VectorImpl::itemLocation(size_t index) const
-{
- ALOG_ASSERT(index<capacity(),
- "[%p] itemLocation: index=%d, capacity=%d, count=%d",
- this, (int)index, (int)capacity(), (int)mCount);
-
- const void* buffer = arrayImpl();
- if (buffer)
- return reinterpret_cast<const char*>(buffer) + index*mItemSize;
- return 0;
-}
-
-ssize_t VectorImpl::setCapacity(size_t new_capacity)
-{
- size_t current_capacity = capacity();
- ssize_t amount = new_capacity - size();
- if (amount <= 0) {
- // we can't reduce the capacity
- return current_capacity;
- }
- SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize);
- if (sb) {
- void* array = sb->data();
- _do_copy(array, mStorage, size());
- release_storage();
- mStorage = const_cast<void*>(array);
- } else {
- return NO_MEMORY;
- }
- return new_capacity;
-}
-
-void VectorImpl::release_storage()
-{
- if (mStorage) {
- const SharedBuffer* sb = SharedBuffer::sharedBuffer(mStorage);
- if (sb->release(SharedBuffer::eKeepStorage) == 1) {
- _do_destroy(mStorage, mCount);
- SharedBuffer::dealloc(sb);
- }
- }
-}
-
-void* VectorImpl::_grow(size_t where, size_t amount)
-{
-// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
-// this, (int)where, (int)amount, (int)mCount, (int)capacity());
-
- ALOG_ASSERT(where <= mCount,
- "[%p] _grow: where=%d, amount=%d, count=%d",
- this, (int)where, (int)amount, (int)mCount); // caller already checked
-
- const size_t new_size = mCount + amount;
- if (capacity() < new_size) {
- const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2);
-// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
- if ((mStorage) &&
- (mCount==where) &&
- (mFlags & HAS_TRIVIAL_COPY) &&
- (mFlags & HAS_TRIVIAL_DTOR))
- {
- const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage);
- SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize);
- mStorage = sb->data();
- } else {
- SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize);
- if (sb) {
- void* array = sb->data();
- if (where != 0) {
- _do_copy(array, mStorage, where);
- }
- if (where != mCount) {
- const void* from = reinterpret_cast<const uint8_t *>(mStorage) + where*mItemSize;
- void* dest = reinterpret_cast<uint8_t *>(array) + (where+amount)*mItemSize;
- _do_copy(dest, from, mCount-where);
- }
- release_storage();
- mStorage = const_cast<void*>(array);
- }
- }
- } else {
- if (where != mCount) {
- void* array = editArrayImpl();
- const void* from = reinterpret_cast<const uint8_t *>(array) + where*mItemSize;
- void* to = reinterpret_cast<uint8_t *>(array) + (where+amount)*mItemSize;
- _do_move_forward(to, from, mCount - where);
- }
- }
- mCount = new_size;
- void* free_space = const_cast<void*>(itemLocation(where));
- return free_space;
-}
-
-void VectorImpl::_shrink(size_t where, size_t amount)
-{
- if (!mStorage)
- return;
-
-// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
-// this, (int)where, (int)amount, (int)mCount, (int)capacity());
-
- ALOG_ASSERT(where + amount <= mCount,
- "[%p] _shrink: where=%d, amount=%d, count=%d",
- this, (int)where, (int)amount, (int)mCount); // caller already checked
-
- const size_t new_size = mCount - amount;
- if (new_size*3 < capacity()) {
- const size_t new_capacity = max(kMinVectorCapacity, new_size*2);
-// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
- if ((where == new_size) &&
- (mFlags & HAS_TRIVIAL_COPY) &&
- (mFlags & HAS_TRIVIAL_DTOR))
- {
- const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage);
- SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize);
- mStorage = sb->data();
- } else {
- SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize);
- if (sb) {
- void* array = sb->data();
- if (where != 0) {
- _do_copy(array, mStorage, where);
- }
- if (where != new_size) {
- const void* from = reinterpret_cast<const uint8_t *>(mStorage) + (where+amount)*mItemSize;
- void* dest = reinterpret_cast<uint8_t *>(array) + where*mItemSize;
- _do_copy(dest, from, new_size - where);
- }
- release_storage();
- mStorage = const_cast<void*>(array);
- }
- }
- } else {
- void* array = editArrayImpl();
- void* to = reinterpret_cast<uint8_t *>(array) + where*mItemSize;
- _do_destroy(to, amount);
- if (where != new_size) {
- const void* from = reinterpret_cast<uint8_t *>(array) + (where+amount)*mItemSize;
- _do_move_backward(to, from, new_size - where);
- }
- }
- mCount = new_size;
-}
-
-size_t VectorImpl::itemSize() const {
- return mItemSize;
-}
-
-void VectorImpl::_do_construct(void* storage, size_t num) const
-{
- if (!(mFlags & HAS_TRIVIAL_CTOR)) {
- do_construct(storage, num);
- }
-}
-
-void VectorImpl::_do_destroy(void* storage, size_t num) const
-{
- if (!(mFlags & HAS_TRIVIAL_DTOR)) {
- do_destroy(storage, num);
- }
-}
-
-void VectorImpl::_do_copy(void* dest, const void* from, size_t num) const
-{
- if (!(mFlags & HAS_TRIVIAL_COPY)) {
- do_copy(dest, from, num);
- } else {
- memcpy(dest, from, num*itemSize());
- }
-}
-
-void VectorImpl::_do_splat(void* dest, const void* item, size_t num) const {
- do_splat(dest, item, num);
-}
-
-void VectorImpl::_do_move_forward(void* dest, const void* from, size_t num) const {
- do_move_forward(dest, from, num);
-}
-
-void VectorImpl::_do_move_backward(void* dest, const void* from, size_t num) const {
- do_move_backward(dest, from, num);
-}
-
-void VectorImpl::reservedVectorImpl1() { }
-void VectorImpl::reservedVectorImpl2() { }
-void VectorImpl::reservedVectorImpl3() { }
-void VectorImpl::reservedVectorImpl4() { }
-void VectorImpl::reservedVectorImpl5() { }
-void VectorImpl::reservedVectorImpl6() { }
-void VectorImpl::reservedVectorImpl7() { }
-void VectorImpl::reservedVectorImpl8() { }
-
-/*****************************************************************************/
-
-SortedVectorImpl::SortedVectorImpl(size_t itemSize, uint32_t flags)
- : VectorImpl(itemSize, flags)
-{
-}
-
-SortedVectorImpl::SortedVectorImpl(const VectorImpl& rhs)
-: VectorImpl(rhs)
-{
-}
-
-SortedVectorImpl::~SortedVectorImpl()
-{
-}
-
-SortedVectorImpl& SortedVectorImpl::operator = (const SortedVectorImpl& rhs)
-{
- return static_cast<SortedVectorImpl&>( VectorImpl::operator = (static_cast<const VectorImpl&>(rhs)) );
-}
-
-ssize_t SortedVectorImpl::indexOf(const void* item) const
-{
- return _indexOrderOf(item);
-}
-
-size_t SortedVectorImpl::orderOf(const void* item) const
-{
- size_t o;
- _indexOrderOf(item, &o);
- return o;
-}
-
-ssize_t SortedVectorImpl::_indexOrderOf(const void* item, size_t* order) const
-{
- // binary search
- ssize_t err = NAME_NOT_FOUND;
- ssize_t l = 0;
- ssize_t h = size()-1;
- ssize_t mid;
- const void* a = arrayImpl();
- const size_t s = itemSize();
- while (l <= h) {
- mid = l + (h - l)/2;
- const void* const curr = reinterpret_cast<const char *>(a) + (mid*s);
- const int c = do_compare(curr, item);
- if (c == 0) {
- err = l = mid;
- break;
- } else if (c < 0) {
- l = mid + 1;
- } else {
- h = mid - 1;
- }
- }
- if (order) *order = l;
- return err;
-}
-
-ssize_t SortedVectorImpl::add(const void* item)
-{
- size_t order;
- ssize_t index = _indexOrderOf(item, &order);
- if (index < 0) {
- index = VectorImpl::insertAt(item, order, 1);
- } else {
- index = VectorImpl::replaceAt(item, index);
- }
- return index;
-}
-
-ssize_t SortedVectorImpl::merge(const VectorImpl& vector)
-{
- // naive merge...
- if (!vector.isEmpty()) {
- const void* buffer = vector.arrayImpl();
- const size_t is = itemSize();
- size_t s = vector.size();
- for (size_t i=0 ; i<s ; i++) {
- ssize_t err = add( reinterpret_cast<const char*>(buffer) + i*is );
- if (err<0) {
- return err;
- }
- }
- }
- return NO_ERROR;
-}
-
-ssize_t SortedVectorImpl::merge(const SortedVectorImpl& vector)
-{
- // we've merging a sorted vector... nice!
- ssize_t err = NO_ERROR;
- if (!vector.isEmpty()) {
- // first take care of the case where the vectors are sorted together
- if (do_compare(vector.itemLocation(vector.size()-1), arrayImpl()) <= 0) {
- err = VectorImpl::insertVectorAt(static_cast<const VectorImpl&>(vector), 0);
- } else if (do_compare(vector.arrayImpl(), itemLocation(size()-1)) >= 0) {
- err = VectorImpl::appendVector(static_cast<const VectorImpl&>(vector));
- } else {
- // this could be made a little better
- err = merge(static_cast<const VectorImpl&>(vector));
- }
- }
- return err;
-}
-
-ssize_t SortedVectorImpl::remove(const void* item)
-{
- ssize_t i = indexOf(item);
- if (i>=0) {
- VectorImpl::removeItemsAt(i, 1);
- }
- return i;
-}
-
-void SortedVectorImpl::reservedSortedVectorImpl1() { };
-void SortedVectorImpl::reservedSortedVectorImpl2() { };
-void SortedVectorImpl::reservedSortedVectorImpl3() { };
-void SortedVectorImpl::reservedSortedVectorImpl4() { };
-void SortedVectorImpl::reservedSortedVectorImpl5() { };
-void SortedVectorImpl::reservedSortedVectorImpl6() { };
-void SortedVectorImpl::reservedSortedVectorImpl7() { };
-void SortedVectorImpl::reservedSortedVectorImpl8() { };
-
-
-/*****************************************************************************/
-
-}; // namespace android
-
diff --git a/libs/utils/misc.cpp b/libs/utils/misc.cpp
deleted file mode 100644
index dc89d15..0000000
--- a/libs/utils/misc.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * 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.
- */
-
-//
-// Miscellaneous utility functions.
-//
-#include <utils/misc.h>
-
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdio.h>
-
-using namespace android;
-
-namespace android {
-
-/*
- * Like strdup(), but uses C++ "new" operator instead of malloc.
- */
-char* strdupNew(const char* str)
-{
- char* newStr;
- int len;
-
- if (str == NULL)
- return NULL;
-
- len = strlen(str);
- newStr = new char[len+1];
- memcpy(newStr, str, len+1);
-
- return newStr;
-}
-
-/*
- * Concatenate an argument vector.
- */
-char* concatArgv(int argc, const char* const argv[])
-{
- char* newStr = NULL;
- int len, totalLen, posn, idx;
-
- /*
- * First, figure out the total length.
- */
- totalLen = idx = 0;
- while (1) {
- if (idx == argc || argv[idx] == NULL)
- break;
- if (idx)
- totalLen++; // leave a space between args
- totalLen += strlen(argv[idx]);
- idx++;
- }
-
- /*
- * Alloc the string.
- */
- newStr = new char[totalLen +1];
- if (newStr == NULL)
- return NULL;
-
- /*
- * Finally, allocate the string and copy data over.
- */
- idx = posn = 0;
- while (1) {
- if (idx == argc || argv[idx] == NULL)
- break;
- if (idx)
- newStr[posn++] = ' ';
-
- len = strlen(argv[idx]);
- memcpy(&newStr[posn], argv[idx], len);
- posn += len;
-
- idx++;
- }
-
- assert(posn == totalLen);
- newStr[posn] = '\0';
-
- return newStr;
-}
-
-/*
- * Count the #of args in an argument vector. Don't count the final NULL.
- */
-int countArgv(const char* const argv[])
-{
- int count = 0;
-
- while (argv[count] != NULL)
- count++;
-
- return count;
-}
-
-
-#include <stdio.h>
-/*
- * Get a file's type.
- */
-FileType getFileType(const char* fileName)
-{
- struct stat sb;
-
- if (stat(fileName, &sb) < 0) {
- if (errno == ENOENT || errno == ENOTDIR)
- return kFileTypeNonexistent;
- else {
- fprintf(stderr, "getFileType got errno=%d on '%s'\n",
- errno, fileName);
- return kFileTypeUnknown;
- }
- } else {
- if (S_ISREG(sb.st_mode))
- return kFileTypeRegular;
- else if (S_ISDIR(sb.st_mode))
- return kFileTypeDirectory;
- else if (S_ISCHR(sb.st_mode))
- return kFileTypeCharDev;
- else if (S_ISBLK(sb.st_mode))
- return kFileTypeBlockDev;
- else if (S_ISFIFO(sb.st_mode))
- return kFileTypeFifo;
-#ifdef HAVE_SYMLINKS
- else if (S_ISLNK(sb.st_mode))
- return kFileTypeSymlink;
- else if (S_ISSOCK(sb.st_mode))
- return kFileTypeSocket;
-#endif
- else
- return kFileTypeUnknown;
- }
-}
-
-/*
- * Get a file's modification date.
- */
-time_t getFileModDate(const char* fileName)
-{
- struct stat sb;
-
- if (stat(fileName, &sb) < 0)
- return (time_t) -1;
-
- return sb.st_mtime;
-}
-
-/*
- * Round up to the next highest power of 2.
- *
- * Found on http://graphics.stanford.edu/~seander/bithacks.html.
- */
-unsigned int roundUpPower2(unsigned int val)
-{
- val--;
- val |= val >> 1;
- val |= val >> 2;
- val |= val >> 4;
- val |= val >> 8;
- val |= val >> 16;
- val++;
-
- return val;
-}
-
-}; // namespace android
-
diff --git a/libs/utils/primes.py b/libs/utils/primes.py
deleted file mode 100755
index e161dd8..0000000
--- a/libs/utils/primes.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python2.6
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# 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.
-#
-
-#
-# Generates a table of prime numbers for use in BasicHashtable.cpp.
-#
-# Each prime is chosen such that it is a little more than twice as large as
-# the previous prime in the table. This makes it easier to choose a new
-# hashtable size when the underlying array is grown by as nominal factor
-# of two each time.
-#
-
-def is_odd_prime(n):
- limit = (n - 1) / 2
- d = 3
- while d <= limit:
- if n % d == 0:
- return False
- d += 2
- return True
-
-print "static size_t PRIMES[] = {"
-
-n = 5
-max = 2**31 - 1
-while n < max:
- print " %d," % (n)
- n = n * 2 + 1
- while not is_odd_prime(n):
- n += 2
-
-print " 0,"
-print "};"
diff --git a/libs/utils/tests/Android.mk b/libs/utils/tests/Android.mk
deleted file mode 100644
index a6811fc..0000000
--- a/libs/utils/tests/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Build the unit tests.
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Build the unit tests.
-test_src_files := \
- BasicHashtable_test.cpp \
- BlobCache_test.cpp \
- Looper_test.cpp \
- String8_test.cpp \
- Unicode_test.cpp \
-
-shared_libraries := \
- libz \
- liblog \
- libcutils \
- libutils \
- libstlport
-
-static_libraries := \
- libgtest \
- libgtest_main
-
-c_includes := \
- external/zlib \
- external/icu4c/common \
- bionic \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport
-
-module_tags := eng tests
-
-$(foreach file,$(test_src_files), \
- $(eval include $(CLEAR_VARS)) \
- $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
- $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
- $(eval LOCAL_C_INCLUDES := $(c_includes)) \
- $(eval LOCAL_SRC_FILES := $(file)) \
- $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
- $(eval LOCAL_MODULE_TAGS := $(module_tags)) \
- $(eval include $(BUILD_EXECUTABLE)) \
-)
diff --git a/libs/utils/tests/BasicHashtable_test.cpp b/libs/utils/tests/BasicHashtable_test.cpp
deleted file mode 100644
index 7dcf750..0000000
--- a/libs/utils/tests/BasicHashtable_test.cpp
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "BasicHashtable_test"
-
-#include <utils/BasicHashtable.h>
-#include <cutils/log.h>
-#include <gtest/gtest.h>
-#include <unistd.h>
-
-namespace android {
-
-typedef int SimpleKey;
-typedef int SimpleValue;
-typedef key_value_pair_t<SimpleKey, SimpleValue> SimpleEntry;
-typedef BasicHashtable<SimpleKey, SimpleEntry> SimpleHashtable;
-
-struct ComplexKey {
- int k;
-
- explicit ComplexKey(int k) : k(k) {
- instanceCount += 1;
- }
-
- ComplexKey(const ComplexKey& other) : k(other.k) {
- instanceCount += 1;
- }
-
- ~ComplexKey() {
- instanceCount -= 1;
- }
-
- bool operator ==(const ComplexKey& other) const {
- return k == other.k;
- }
-
- bool operator !=(const ComplexKey& other) const {
- return k != other.k;
- }
-
- static ssize_t instanceCount;
-};
-
-ssize_t ComplexKey::instanceCount = 0;
-
-template<> inline hash_t hash_type(const ComplexKey& value) {
- return hash_type(value.k);
-}
-
-struct ComplexValue {
- int v;
-
- explicit ComplexValue(int v) : v(v) {
- instanceCount += 1;
- }
-
- ComplexValue(const ComplexValue& other) : v(other.v) {
- instanceCount += 1;
- }
-
- ~ComplexValue() {
- instanceCount -= 1;
- }
-
- static ssize_t instanceCount;
-};
-
-ssize_t ComplexValue::instanceCount = 0;
-
-typedef key_value_pair_t<ComplexKey, ComplexValue> ComplexEntry;
-typedef BasicHashtable<ComplexKey, ComplexEntry> ComplexHashtable;
-
-class BasicHashtableTest : public testing::Test {
-protected:
- virtual void SetUp() {
- ComplexKey::instanceCount = 0;
- ComplexValue::instanceCount = 0;
- }
-
- virtual void TearDown() {
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
- }
-
- void assertInstanceCount(ssize_t keys, ssize_t values) {
- if (keys != ComplexKey::instanceCount || values != ComplexValue::instanceCount) {
- FAIL() << "Expected " << keys << " keys and " << values << " values "
- "but there were actually " << ComplexKey::instanceCount << " keys and "
- << ComplexValue::instanceCount << " values";
- }
- }
-
-public:
- template <typename TKey, typename TEntry>
- static void cookieAt(const BasicHashtable<TKey, TEntry>& h, size_t index,
- bool* collision, bool* present, hash_t* hash) {
- uint32_t cookie = h.cookieAt(index);
- *collision = cookie & BasicHashtable<TKey, TEntry>::Bucket::COLLISION;
- *present = cookie & BasicHashtable<TKey, TEntry>::Bucket::PRESENT;
- *hash = cookie & BasicHashtable<TKey, TEntry>::Bucket::HASH_MASK;
- }
-
- template <typename TKey, typename TEntry>
- static const void* getBuckets(const BasicHashtable<TKey, TEntry>& h) {
- return h.mBuckets;
- }
-};
-
-template <typename TKey, typename TValue>
-static size_t add(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h,
- const TKey& key, const TValue& value) {
- return h.add(hash_type(key), key_value_pair_t<TKey, TValue>(key, value));
-}
-
-template <typename TKey, typename TValue>
-static ssize_t find(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h,
- ssize_t index, const TKey& key) {
- return h.find(index, hash_type(key), key);
-}
-
-template <typename TKey, typename TValue>
-static bool remove(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h,
- const TKey& key) {
- ssize_t index = find(h, -1, key);
- if (index >= 0) {
- h.removeAt(index);
- return true;
- }
- return false;
-}
-
-template <typename TEntry>
-static void getKeyValue(const TEntry& entry, int* key, int* value);
-
-template <> void getKeyValue(const SimpleEntry& entry, int* key, int* value) {
- *key = entry.key;
- *value = entry.value;
-}
-
-template <> void getKeyValue(const ComplexEntry& entry, int* key, int* value) {
- *key = entry.key.k;
- *value = entry.value.v;
-}
-
-template <typename TKey, typename TValue>
-static void dump(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h) {
- ALOGD("hashtable %p, size=%u, capacity=%u, bucketCount=%u",
- &h, h.size(), h.capacity(), h.bucketCount());
- for (size_t i = 0; i < h.bucketCount(); i++) {
- bool collision, present;
- hash_t hash;
- BasicHashtableTest::cookieAt(h, i, &collision, &present, &hash);
- if (present) {
- int key, value;
- getKeyValue(h.entryAt(i), &key, &value);
- ALOGD(" [%3u] = collision=%d, present=%d, hash=0x%08x, key=%3d, value=%3d, "
- "hash_type(key)=0x%08x",
- i, collision, present, hash, key, value, hash_type(key));
- } else {
- ALOGD(" [%3u] = collision=%d, present=%d",
- i, collision, present);
- }
- }
-}
-
-TEST_F(BasicHashtableTest, DefaultConstructor_WithDefaultProperties) {
- SimpleHashtable h;
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Constructor_WithNonUnityLoadFactor) {
- SimpleHashtable h(52, 0.8f);
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(77U, h.capacity());
- EXPECT_EQ(97U, h.bucketCount());
- EXPECT_EQ(0.8f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Constructor_WithUnityLoadFactorAndExactCapacity) {
- SimpleHashtable h(46, 1.0f);
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(46U, h.capacity()); // must be one less than bucketCount because loadFactor == 1.0f
- EXPECT_EQ(47U, h.bucketCount());
- EXPECT_EQ(1.0f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Constructor_WithUnityLoadFactorAndInexactCapacity) {
- SimpleHashtable h(42, 1.0f);
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(46U, h.capacity()); // must be one less than bucketCount because loadFactor == 1.0f
- EXPECT_EQ(47U, h.bucketCount());
- EXPECT_EQ(1.0f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, FindAddFindRemoveFind_OneEntry) {
- SimpleHashtable h;
- ssize_t index = find(h, -1, 8);
- ASSERT_EQ(-1, index);
-
- index = add(h, 8, 1);
- ASSERT_EQ(1U, h.size());
-
- ASSERT_EQ(index, find(h, -1, 8));
- ASSERT_EQ(8, h.entryAt(index).key);
- ASSERT_EQ(1, h.entryAt(index).value);
-
- index = find(h, index, 8);
- ASSERT_EQ(-1, index);
-
- ASSERT_TRUE(remove(h, 8));
- ASSERT_EQ(0U, h.size());
-
- index = find(h, -1, 8);
- ASSERT_EQ(-1, index);
-}
-
-TEST_F(BasicHashtableTest, FindAddFindRemoveFind_MultipleEntryWithUniqueKey) {
- const size_t N = 11;
-
- SimpleHashtable h;
- for (size_t i = 0; i < N; i++) {
- ssize_t index = find(h, -1, int(i));
- ASSERT_EQ(-1, index);
-
- index = add(h, int(i), int(i * 10));
- ASSERT_EQ(i + 1, h.size());
-
- ASSERT_EQ(index, find(h, -1, int(i)));
- ASSERT_EQ(int(i), h.entryAt(index).key);
- ASSERT_EQ(int(i * 10), h.entryAt(index).value);
-
- index = find(h, index, int(i));
- ASSERT_EQ(-1, index);
- }
-
- for (size_t i = N; --i > 0; ) {
- ASSERT_TRUE(remove(h, int(i))) << "i = " << i;
- ASSERT_EQ(i, h.size());
-
- ssize_t index = find(h, -1, int(i));
- ASSERT_EQ(-1, index);
- }
-}
-
-TEST_F(BasicHashtableTest, FindAddFindRemoveFind_MultipleEntryWithDuplicateKey) {
- const size_t N = 11;
- const int K = 1;
-
- SimpleHashtable h;
- for (size_t i = 0; i < N; i++) {
- ssize_t index = find(h, -1, K);
- if (i == 0) {
- ASSERT_EQ(-1, index);
- } else {
- ASSERT_NE(-1, index);
- }
-
- add(h, K, int(i));
- ASSERT_EQ(i + 1, h.size());
-
- index = -1;
- int values = 0;
- for (size_t j = 0; j <= i; j++) {
- index = find(h, index, K);
- ASSERT_GE(index, 0);
- ASSERT_EQ(K, h.entryAt(index).key);
- values |= 1 << h.entryAt(index).value;
- }
- ASSERT_EQ(values, (1 << (i + 1)) - 1);
-
- index = find(h, index, K);
- ASSERT_EQ(-1, index);
- }
-
- for (size_t i = N; --i > 0; ) {
- ASSERT_TRUE(remove(h, K)) << "i = " << i;
- ASSERT_EQ(i, h.size());
-
- ssize_t index = -1;
- for (size_t j = 0; j < i; j++) {
- index = find(h, index, K);
- ASSERT_GE(index, 0);
- ASSERT_EQ(K, h.entryAt(index).key);
- }
-
- index = find(h, index, K);
- ASSERT_EQ(-1, index);
- }
-}
-
-TEST_F(BasicHashtableTest, Clear_WhenAlreadyEmpty_DoesNothing) {
- SimpleHashtable h;
- h.clear();
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Clear_AfterElementsAdded_RemovesThem) {
- SimpleHashtable h;
- add(h, 0, 0);
- add(h, 1, 0);
- h.clear();
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Clear_AfterElementsAdded_DestroysThem) {
- ComplexHashtable h;
- add(h, ComplexKey(0), ComplexValue(0));
- add(h, ComplexKey(1), ComplexValue(0));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
-
- h.clear();
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Remove_AfterElementsAdded_DestroysThem) {
- ComplexHashtable h;
- add(h, ComplexKey(0), ComplexValue(0));
- add(h, ComplexKey(1), ComplexValue(0));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
-
- ASSERT_TRUE(remove(h, ComplexKey(0)));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1));
-
- ASSERT_TRUE(remove(h, ComplexKey(1)));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
-}
-
-TEST_F(BasicHashtableTest, Destructor_AfterElementsAdded_DestroysThem) {
- {
- ComplexHashtable h;
- add(h, ComplexKey(0), ComplexValue(0));
- add(h, ComplexKey(1), ComplexValue(0));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- } // h is destroyed here
-
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-}
-
-TEST_F(BasicHashtableTest, Next_WhenEmpty_ReturnsMinusOne) {
- SimpleHashtable h;
-
- ASSERT_EQ(-1, h.next(-1));
-}
-
-TEST_F(BasicHashtableTest, Next_WhenNonEmpty_IteratesOverAllEntries) {
- const int N = 88;
-
- SimpleHashtable h;
- for (int i = 0; i < N; i++) {
- add(h, i, i * 10);
- }
-
- bool set[N];
- memset(set, 0, sizeof(bool) * N);
- int count = 0;
- for (ssize_t index = -1; (index = h.next(index)) != -1; ) {
- ASSERT_GE(index, 0);
- ASSERT_LT(size_t(index), h.bucketCount());
-
- const SimpleEntry& entry = h.entryAt(index);
- ASSERT_GE(entry.key, 0);
- ASSERT_LT(entry.key, N);
- ASSERT_EQ(false, set[entry.key]);
- ASSERT_EQ(entry.key * 10, entry.value);
-
- set[entry.key] = true;
- count += 1;
- }
- ASSERT_EQ(N, count);
-}
-
-TEST_F(BasicHashtableTest, Add_RehashesOnDemand) {
- SimpleHashtable h;
- size_t initialCapacity = h.capacity();
- size_t initialBucketCount = h.bucketCount();
-
- for (size_t i = 0; i < initialCapacity; i++) {
- add(h, int(i), 0);
- }
-
- EXPECT_EQ(initialCapacity, h.size());
- EXPECT_EQ(initialCapacity, h.capacity());
- EXPECT_EQ(initialBucketCount, h.bucketCount());
-
- add(h, -1, -1);
-
- EXPECT_EQ(initialCapacity + 1, h.size());
- EXPECT_GT(h.capacity(), initialCapacity);
- EXPECT_GT(h.bucketCount(), initialBucketCount);
- EXPECT_GT(h.bucketCount(), h.capacity());
-}
-
-TEST_F(BasicHashtableTest, Rehash_WhenCapacityAndBucketCountUnchanged_DoesNothing) {
- ComplexHashtable h;
- add(h, ComplexKey(0), ComplexValue(0));
- const void* oldBuckets = getBuckets(h);
- ASSERT_NE((void*)NULL, oldBuckets);
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1));
-
- h.rehash(h.capacity(), h.loadFactor());
-
- ASSERT_EQ(oldBuckets, getBuckets(h));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1));
-}
-
-TEST_F(BasicHashtableTest, Rehash_WhenEmptyAndHasNoBuckets_ButDoesNotAllocateBuckets) {
- ComplexHashtable h;
- ASSERT_EQ((void*)NULL, getBuckets(h));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-
- h.rehash(9, 1.0f);
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(10U, h.capacity());
- EXPECT_EQ(11U, h.bucketCount());
- EXPECT_EQ(1.0f, h.loadFactor());
- EXPECT_EQ((void*)NULL, getBuckets(h));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-}
-
-TEST_F(BasicHashtableTest, Rehash_WhenEmptyAndHasBuckets_ReleasesBucketsAndSetsCapacity) {
- ComplexHashtable h(10);
- add(h, ComplexKey(0), ComplexValue(0));
- ASSERT_TRUE(remove(h, ComplexKey(0)));
- ASSERT_NE((void*)NULL, getBuckets(h));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-
- h.rehash(0, 0.75f);
-
- EXPECT_EQ(0U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
- EXPECT_EQ((void*)NULL, getBuckets(h));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0));
-}
-
-TEST_F(BasicHashtableTest, Rehash_WhenLessThanCurrentCapacity_ShrinksBuckets) {
- ComplexHashtable h(10);
- add(h, ComplexKey(0), ComplexValue(0));
- add(h, ComplexKey(1), ComplexValue(1));
- const void* oldBuckets = getBuckets(h);
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
-
- h.rehash(0, 0.75f);
-
- EXPECT_EQ(2U, h.size());
- EXPECT_EQ(3U, h.capacity());
- EXPECT_EQ(5U, h.bucketCount());
- EXPECT_EQ(0.75f, h.loadFactor());
- EXPECT_NE(oldBuckets, getBuckets(h));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
-}
-
-TEST_F(BasicHashtableTest, CopyOnWrite) {
- ComplexHashtable h1;
- add(h1, ComplexKey(0), ComplexValue(0));
- add(h1, ComplexKey(1), ComplexValue(1));
- const void* originalBuckets = getBuckets(h1);
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- ssize_t index0 = find(h1, -1, ComplexKey(0));
- EXPECT_GE(index0, 0);
-
- // copy constructor acquires shared reference
- ComplexHashtable h2(h1);
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- ASSERT_EQ(originalBuckets, getBuckets(h2));
- EXPECT_EQ(h1.size(), h2.size());
- EXPECT_EQ(h1.capacity(), h2.capacity());
- EXPECT_EQ(h1.bucketCount(), h2.bucketCount());
- EXPECT_EQ(h1.loadFactor(), h2.loadFactor());
- EXPECT_EQ(index0, find(h2, -1, ComplexKey(0)));
-
- // operator= acquires shared reference
- ComplexHashtable h3;
- h3 = h2;
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- ASSERT_EQ(originalBuckets, getBuckets(h3));
- EXPECT_EQ(h1.size(), h3.size());
- EXPECT_EQ(h1.capacity(), h3.capacity());
- EXPECT_EQ(h1.bucketCount(), h3.bucketCount());
- EXPECT_EQ(h1.loadFactor(), h3.loadFactor());
- EXPECT_EQ(index0, find(h3, -1, ComplexKey(0)));
-
- // editEntryAt copies shared contents
- h1.editEntryAt(index0).value.v = 42;
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4));
- ASSERT_NE(originalBuckets, getBuckets(h1));
- EXPECT_EQ(42, h1.entryAt(index0).value.v);
- EXPECT_EQ(0, h2.entryAt(index0).value.v);
- EXPECT_EQ(0, h3.entryAt(index0).value.v);
-
- // clear releases reference to shared contents
- h2.clear();
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4));
- EXPECT_EQ(0U, h2.size());
- ASSERT_NE(originalBuckets, getBuckets(h2));
-
- // operator= acquires shared reference, destroys unshared contents
- h1 = h3;
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- ASSERT_EQ(originalBuckets, getBuckets(h1));
- EXPECT_EQ(h3.size(), h1.size());
- EXPECT_EQ(h3.capacity(), h1.capacity());
- EXPECT_EQ(h3.bucketCount(), h1.bucketCount());
- EXPECT_EQ(h3.loadFactor(), h1.loadFactor());
- EXPECT_EQ(index0, find(h1, -1, ComplexKey(0)));
-
- // add copies shared contents
- add(h1, ComplexKey(2), ComplexValue(2));
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(5, 5));
- ASSERT_NE(originalBuckets, getBuckets(h1));
- EXPECT_EQ(3U, h1.size());
- EXPECT_EQ(0U, h2.size());
- EXPECT_EQ(2U, h3.size());
-
- // remove copies shared contents
- h1 = h3;
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- ASSERT_EQ(originalBuckets, getBuckets(h1));
- h1.removeAt(index0);
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(3, 3));
- ASSERT_NE(originalBuckets, getBuckets(h1));
- EXPECT_EQ(1U, h1.size());
- EXPECT_EQ(0U, h2.size());
- EXPECT_EQ(2U, h3.size());
-
- // rehash copies shared contents
- h1 = h3;
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2));
- ASSERT_EQ(originalBuckets, getBuckets(h1));
- h1.rehash(10, 1.0f);
- ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4));
- ASSERT_NE(originalBuckets, getBuckets(h1));
- EXPECT_EQ(2U, h1.size());
- EXPECT_EQ(0U, h2.size());
- EXPECT_EQ(2U, h3.size());
-}
-
-} // namespace android
diff --git a/libs/utils/tests/BlobCache_test.cpp b/libs/utils/tests/BlobCache_test.cpp
deleted file mode 100644
index b64cc39..0000000
--- a/libs/utils/tests/BlobCache_test.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <fcntl.h>
-#include <stdio.h>
-
-#include <gtest/gtest.h>
-
-#include <utils/BlobCache.h>
-#include <utils/Errors.h>
-
-namespace android {
-
-class BlobCacheTest : public ::testing::Test {
-protected:
- enum {
- MAX_KEY_SIZE = 6,
- MAX_VALUE_SIZE = 8,
- MAX_TOTAL_SIZE = 13,
- };
-
- virtual void SetUp() {
- mBC = new BlobCache(MAX_KEY_SIZE, MAX_VALUE_SIZE, MAX_TOTAL_SIZE);
- }
-
- virtual void TearDown() {
- mBC.clear();
- }
-
- sp<BlobCache> mBC;
-};
-
-TEST_F(BlobCacheTest, CacheSingleValueSucceeds) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4));
- ASSERT_EQ('e', buf[0]);
- ASSERT_EQ('f', buf[1]);
- ASSERT_EQ('g', buf[2]);
- ASSERT_EQ('h', buf[3]);
-}
-
-TEST_F(BlobCacheTest, CacheTwoValuesSucceeds) {
- char buf[2] = { 0xee, 0xee };
- mBC->set("ab", 2, "cd", 2);
- mBC->set("ef", 2, "gh", 2);
- ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2));
- ASSERT_EQ('c', buf[0]);
- ASSERT_EQ('d', buf[1]);
- ASSERT_EQ(size_t(2), mBC->get("ef", 2, buf, 2));
- ASSERT_EQ('g', buf[0]);
- ASSERT_EQ('h', buf[1]);
-}
-
-TEST_F(BlobCacheTest, GetOnlyWritesInsideBounds) {
- char buf[6] = { 0xee, 0xee, 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf+1, 4));
- ASSERT_EQ(0xee, buf[0]);
- ASSERT_EQ('e', buf[1]);
- ASSERT_EQ('f', buf[2]);
- ASSERT_EQ('g', buf[3]);
- ASSERT_EQ('h', buf[4]);
- ASSERT_EQ(0xee, buf[5]);
-}
-
-TEST_F(BlobCacheTest, GetOnlyWritesIfBufferIsLargeEnough) {
- char buf[3] = { 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 3));
- ASSERT_EQ(0xee, buf[0]);
- ASSERT_EQ(0xee, buf[1]);
- ASSERT_EQ(0xee, buf[2]);
-}
-
-TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) {
- mBC->set("abcd", 4, "efgh", 4);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, NULL, 0));
-}
-
-TEST_F(BlobCacheTest, MultipleSetsCacheLatestValue) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
- mBC->set("abcd", 4, "ijkl", 4);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4));
- ASSERT_EQ('i', buf[0]);
- ASSERT_EQ('j', buf[1]);
- ASSERT_EQ('k', buf[2]);
- ASSERT_EQ('l', buf[3]);
-}
-
-TEST_F(BlobCacheTest, SecondSetKeepsFirstValueIfTooLarge) {
- char buf[MAX_VALUE_SIZE+1] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
- mBC->set("abcd", 4, buf, MAX_VALUE_SIZE+1);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4));
- ASSERT_EQ('e', buf[0]);
- ASSERT_EQ('f', buf[1]);
- ASSERT_EQ('g', buf[2]);
- ASSERT_EQ('h', buf[3]);
-}
-
-TEST_F(BlobCacheTest, DoesntCacheIfKeyIsTooBig) {
- char key[MAX_KEY_SIZE+1];
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- for (int i = 0; i < MAX_KEY_SIZE+1; i++) {
- key[i] = 'a';
- }
- mBC->set(key, MAX_KEY_SIZE+1, "bbbb", 4);
- ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE+1, buf, 4));
- ASSERT_EQ(0xee, buf[0]);
- ASSERT_EQ(0xee, buf[1]);
- ASSERT_EQ(0xee, buf[2]);
- ASSERT_EQ(0xee, buf[3]);
-}
-
-TEST_F(BlobCacheTest, DoesntCacheIfValueIsTooBig) {
- char buf[MAX_VALUE_SIZE+1];
- for (int i = 0; i < MAX_VALUE_SIZE+1; i++) {
- buf[i] = 'b';
- }
- mBC->set("abcd", 4, buf, MAX_VALUE_SIZE+1);
- for (int i = 0; i < MAX_VALUE_SIZE+1; i++) {
- buf[i] = 0xee;
- }
- ASSERT_EQ(size_t(0), mBC->get("abcd", 4, buf, MAX_VALUE_SIZE+1));
- for (int i = 0; i < MAX_VALUE_SIZE+1; i++) {
- SCOPED_TRACE(i);
- ASSERT_EQ(0xee, buf[i]);
- }
-}
-
-TEST_F(BlobCacheTest, DoesntCacheIfKeyValuePairIsTooBig) {
- // Check a testing assumptions
- ASSERT_TRUE(MAX_TOTAL_SIZE < MAX_KEY_SIZE + MAX_VALUE_SIZE);
- ASSERT_TRUE(MAX_KEY_SIZE < MAX_TOTAL_SIZE);
-
- enum { bufSize = MAX_TOTAL_SIZE - MAX_KEY_SIZE + 1 };
-
- char key[MAX_KEY_SIZE];
- char buf[bufSize];
- for (int i = 0; i < MAX_KEY_SIZE; i++) {
- key[i] = 'a';
- }
- for (int i = 0; i < bufSize; i++) {
- buf[i] = 'b';
- }
-
- mBC->set(key, MAX_KEY_SIZE, buf, MAX_VALUE_SIZE);
- ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE, NULL, 0));
-}
-
-TEST_F(BlobCacheTest, CacheMaxKeySizeSucceeds) {
- char key[MAX_KEY_SIZE];
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- for (int i = 0; i < MAX_KEY_SIZE; i++) {
- key[i] = 'a';
- }
- mBC->set(key, MAX_KEY_SIZE, "wxyz", 4);
- ASSERT_EQ(size_t(4), mBC->get(key, MAX_KEY_SIZE, buf, 4));
- ASSERT_EQ('w', buf[0]);
- ASSERT_EQ('x', buf[1]);
- ASSERT_EQ('y', buf[2]);
- ASSERT_EQ('z', buf[3]);
-}
-
-TEST_F(BlobCacheTest, CacheMaxValueSizeSucceeds) {
- char buf[MAX_VALUE_SIZE];
- for (int i = 0; i < MAX_VALUE_SIZE; i++) {
- buf[i] = 'b';
- }
- mBC->set("abcd", 4, buf, MAX_VALUE_SIZE);
- for (int i = 0; i < MAX_VALUE_SIZE; i++) {
- buf[i] = 0xee;
- }
- ASSERT_EQ(size_t(MAX_VALUE_SIZE), mBC->get("abcd", 4, buf,
- MAX_VALUE_SIZE));
- for (int i = 0; i < MAX_VALUE_SIZE; i++) {
- SCOPED_TRACE(i);
- ASSERT_EQ('b', buf[i]);
- }
-}
-
-TEST_F(BlobCacheTest, CacheMaxKeyValuePairSizeSucceeds) {
- // Check a testing assumption
- ASSERT_TRUE(MAX_KEY_SIZE < MAX_TOTAL_SIZE);
-
- enum { bufSize = MAX_TOTAL_SIZE - MAX_KEY_SIZE };
-
- char key[MAX_KEY_SIZE];
- char buf[bufSize];
- for (int i = 0; i < MAX_KEY_SIZE; i++) {
- key[i] = 'a';
- }
- for (int i = 0; i < bufSize; i++) {
- buf[i] = 'b';
- }
-
- mBC->set(key, MAX_KEY_SIZE, buf, bufSize);
- ASSERT_EQ(size_t(bufSize), mBC->get(key, MAX_KEY_SIZE, NULL, 0));
-}
-
-TEST_F(BlobCacheTest, CacheMinKeyAndValueSizeSucceeds) {
- char buf[1] = { 0xee };
- mBC->set("x", 1, "y", 1);
- ASSERT_EQ(size_t(1), mBC->get("x", 1, buf, 1));
- ASSERT_EQ('y', buf[0]);
-}
-
-TEST_F(BlobCacheTest, CacheSizeDoesntExceedTotalLimit) {
- for (int i = 0; i < 256; i++) {
- uint8_t k = i;
- mBC->set(&k, 1, "x", 1);
- }
- int numCached = 0;
- for (int i = 0; i < 256; i++) {
- uint8_t k = i;
- if (mBC->get(&k, 1, NULL, 0) == 1) {
- numCached++;
- }
- }
- ASSERT_GE(MAX_TOTAL_SIZE / 2, numCached);
-}
-
-TEST_F(BlobCacheTest, ExceedingTotalLimitHalvesCacheSize) {
- // Fill up the entire cache with 1 char key/value pairs.
- const int maxEntries = MAX_TOTAL_SIZE / 2;
- for (int i = 0; i < maxEntries; i++) {
- uint8_t k = i;
- mBC->set(&k, 1, "x", 1);
- }
- // Insert one more entry, causing a cache overflow.
- {
- uint8_t k = maxEntries;
- mBC->set(&k, 1, "x", 1);
- }
- // Count the number of entries in the cache.
- int numCached = 0;
- for (int i = 0; i < maxEntries+1; i++) {
- uint8_t k = i;
- if (mBC->get(&k, 1, NULL, 0) == 1) {
- numCached++;
- }
- }
- ASSERT_EQ(maxEntries/2 + 1, numCached);
-}
-
-class BlobCacheFlattenTest : public BlobCacheTest {
-protected:
- virtual void SetUp() {
- BlobCacheTest::SetUp();
- mBC2 = new BlobCache(MAX_KEY_SIZE, MAX_VALUE_SIZE, MAX_TOTAL_SIZE);
- }
-
- virtual void TearDown() {
- mBC2.clear();
- BlobCacheTest::TearDown();
- }
-
- void roundTrip() {
- size_t size = mBC->getFlattenedSize();
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0));
- ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0));
- delete[] flat;
- }
-
- sp<BlobCache> mBC2;
-};
-
-TEST_F(BlobCacheFlattenTest, FlattenOneValue) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
- roundTrip();
- ASSERT_EQ(size_t(4), mBC2->get("abcd", 4, buf, 4));
- ASSERT_EQ('e', buf[0]);
- ASSERT_EQ('f', buf[1]);
- ASSERT_EQ('g', buf[2]);
- ASSERT_EQ('h', buf[3]);
-}
-
-TEST_F(BlobCacheFlattenTest, FlattenFullCache) {
- // Fill up the entire cache with 1 char key/value pairs.
- const int maxEntries = MAX_TOTAL_SIZE / 2;
- for (int i = 0; i < maxEntries; i++) {
- uint8_t k = i;
- mBC->set(&k, 1, &k, 1);
- }
-
- roundTrip();
-
- // Verify the deserialized cache
- for (int i = 0; i < maxEntries; i++) {
- uint8_t k = i;
- uint8_t v = 0xee;
- ASSERT_EQ(size_t(1), mBC2->get(&k, 1, &v, 1));
- ASSERT_EQ(k, v);
- }
-}
-
-TEST_F(BlobCacheFlattenTest, FlattenDoesntChangeCache) {
- // Fill up the entire cache with 1 char key/value pairs.
- const int maxEntries = MAX_TOTAL_SIZE / 2;
- for (int i = 0; i < maxEntries; i++) {
- uint8_t k = i;
- mBC->set(&k, 1, &k, 1);
- }
-
- size_t size = mBC->getFlattenedSize();
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0));
- delete[] flat;
-
- // Verify the cache that we just serialized
- for (int i = 0; i < maxEntries; i++) {
- uint8_t k = i;
- uint8_t v = 0xee;
- ASSERT_EQ(size_t(1), mBC->get(&k, 1, &v, 1));
- ASSERT_EQ(k, v);
- }
-}
-
-TEST_F(BlobCacheFlattenTest, FlattenCatchesBufferTooSmall) {
- // Fill up the entire cache with 1 char key/value pairs.
- const int maxEntries = MAX_TOTAL_SIZE / 2;
- for (int i = 0; i < maxEntries; i++) {
- uint8_t k = i;
- mBC->set(&k, 1, &k, 1);
- }
-
- size_t size = mBC->getFlattenedSize() - 1;
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(BAD_VALUE, mBC->flatten(flat, size, NULL, 0));
- delete[] flat;
-}
-
-TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadMagic) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
-
- size_t size = mBC->getFlattenedSize();
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0));
- flat[1] = ~flat[1];
-
- // Bad magic should cause an error.
- ASSERT_EQ(BAD_VALUE, mBC2->unflatten(flat, size, NULL, 0));
- delete[] flat;
-
- // The error should cause the unflatten to result in an empty cache
- ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4));
-}
-
-TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadBlobCacheVersion) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
-
- size_t size = mBC->getFlattenedSize();
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0));
- flat[5] = ~flat[5];
-
- // Version mismatches shouldn't cause errors, but should not use the
- // serialized entries
- ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0));
- delete[] flat;
-
- // The version mismatch should cause the unflatten to result in an empty
- // cache
- ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4));
-}
-
-TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadBlobCacheDeviceVersion) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
-
- size_t size = mBC->getFlattenedSize();
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0));
- flat[10] = ~flat[10];
-
- // Version mismatches shouldn't cause errors, but should not use the
- // serialized entries
- ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0));
- delete[] flat;
-
- // The version mismatch should cause the unflatten to result in an empty
- // cache
- ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4));
-}
-
-TEST_F(BlobCacheFlattenTest, UnflattenCatchesBufferTooSmall) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mBC->set("abcd", 4, "efgh", 4);
-
- size_t size = mBC->getFlattenedSize();
- uint8_t* flat = new uint8_t[size];
- ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0));
-
- // A buffer truncation shouldt cause an error
- ASSERT_EQ(BAD_VALUE, mBC2->unflatten(flat, size-1, NULL, 0));
- delete[] flat;
-
- // The error should cause the unflatten to result in an empty cache
- ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4));
-}
-
-} // namespace android
diff --git a/libs/utils/tests/Looper_test.cpp b/libs/utils/tests/Looper_test.cpp
deleted file mode 100644
index 8bf2ba2..0000000
--- a/libs/utils/tests/Looper_test.cpp
+++ /dev/null
@@ -1,693 +0,0 @@
-//
-// Copyright 2010 The Android Open Source Project
-//
-
-#include <utils/Looper.h>
-#include <utils/Timers.h>
-#include <utils/StopWatch.h>
-#include <gtest/gtest.h>
-#include <unistd.h>
-#include <time.h>
-
-#include "TestHelpers.h"
-
-// # of milliseconds to fudge stopwatch measurements
-#define TIMING_TOLERANCE_MS 25
-
-namespace android {
-
-enum {
- MSG_TEST1 = 1,
- MSG_TEST2 = 2,
- MSG_TEST3 = 3,
- MSG_TEST4 = 4,
-};
-
-class DelayedWake : public DelayedTask {
- sp<Looper> mLooper;
-
-public:
- DelayedWake(int delayMillis, const sp<Looper> looper) :
- DelayedTask(delayMillis), mLooper(looper) {
- }
-
-protected:
- virtual void doTask() {
- mLooper->wake();
- }
-};
-
-class DelayedWriteSignal : public DelayedTask {
- Pipe* mPipe;
-
-public:
- DelayedWriteSignal(int delayMillis, Pipe* pipe) :
- DelayedTask(delayMillis), mPipe(pipe) {
- }
-
-protected:
- virtual void doTask() {
- mPipe->writeSignal();
- }
-};
-
-class CallbackHandler {
-public:
- void setCallback(const sp<Looper>& looper, int fd, int events) {
- looper->addFd(fd, 0, events, staticHandler, this);
- }
-
-protected:
- virtual ~CallbackHandler() { }
-
- virtual int handler(int fd, int events) = 0;
-
-private:
- static int staticHandler(int fd, int events, void* data) {
- return static_cast<CallbackHandler*>(data)->handler(fd, events);
- }
-};
-
-class StubCallbackHandler : public CallbackHandler {
-public:
- int nextResult;
- int callbackCount;
-
- int fd;
- int events;
-
- StubCallbackHandler(int nextResult) : nextResult(nextResult),
- callbackCount(0), fd(-1), events(-1) {
- }
-
-protected:
- virtual int handler(int fd, int events) {
- callbackCount += 1;
- this->fd = fd;
- this->events = events;
- return nextResult;
- }
-};
-
-class StubMessageHandler : public MessageHandler {
-public:
- Vector<Message> messages;
-
- virtual void handleMessage(const Message& message) {
- messages.push(message);
- }
-};
-
-class LooperTest : public testing::Test {
-protected:
- sp<Looper> mLooper;
-
- virtual void SetUp() {
- mLooper = new Looper(true);
- }
-
- virtual void TearDown() {
- mLooper.clear();
- }
-};
-
-
-TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndNotAwoken_WaitsForTimeout) {
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal timeout";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT";
-}
-
-TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenBeforeWaiting_ImmediatelyReturns) {
- mLooper->wake();
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(1000);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because wake() was called before waiting";
- EXPECT_EQ(ALOOPER_POLL_WAKE, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because loop was awoken";
-}
-
-TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) {
- sp<DelayedWake> delayedWake = new DelayedWake(100, mLooper);
- delayedWake->run();
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(1000);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal wake delay";
- EXPECT_EQ(ALOOPER_POLL_WAKE, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because loop was awoken";
-}
-
-TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndNoRegisteredFDs_ImmediatelyReturns) {
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(0);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should be approx. zero";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT";
-}
-
-TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndNoSignalledFDs_ImmediatelyReturns) {
- Pipe pipe;
- StubCallbackHandler handler(true);
-
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(0);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should be approx. zero";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT";
- EXPECT_EQ(0, handler.callbackCount)
- << "callback should not have been invoked because FD was not signalled";
-}
-
-TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndSignalledFD_ImmediatelyInvokesCallbackAndReturns) {
- Pipe pipe;
- StubCallbackHandler handler(true);
-
- ASSERT_EQ(OK, pipe.writeSignal());
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(0);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should be approx. zero";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled";
- EXPECT_EQ(1, handler.callbackCount)
- << "callback should be invoked exactly once";
- EXPECT_EQ(pipe.receiveFd, handler.fd)
- << "callback should have received pipe fd as parameter";
- EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events)
- << "callback should have received ALOOPER_EVENT_INPUT as events";
-}
-
-TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndNoSignalledFDs_WaitsForTimeoutAndReturns) {
- Pipe pipe;
- StubCallbackHandler handler(true);
-
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal timeout";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT";
- EXPECT_EQ(0, handler.callbackCount)
- << "callback should not have been invoked because FD was not signalled";
-}
-
-TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDBeforeWaiting_ImmediatelyInvokesCallbackAndReturns) {
- Pipe pipe;
- StubCallbackHandler handler(true);
-
- pipe.writeSignal();
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should be approx. zero";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled";
- EXPECT_EQ(1, handler.callbackCount)
- << "callback should be invoked exactly once";
- EXPECT_EQ(pipe.receiveFd, handler.fd)
- << "callback should have received pipe fd as parameter";
- EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events)
- << "callback should have received ALOOPER_EVENT_INPUT as events";
-}
-
-TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDWhileWaiting_PromptlyInvokesCallbackAndReturns) {
- Pipe pipe;
- StubCallbackHandler handler(true);
- sp<DelayedWriteSignal> delayedWriteSignal = new DelayedWriteSignal(100, & pipe);
-
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
- delayedWriteSignal->run();
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(1000);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal signal delay";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled";
- EXPECT_EQ(1, handler.callbackCount)
- << "callback should be invoked exactly once";
- EXPECT_EQ(pipe.receiveFd, handler.fd)
- << "callback should have received pipe fd as parameter";
- EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events)
- << "callback should have received ALOOPER_EVENT_INPUT as events";
-}
-
-TEST_F(LooperTest, PollOnce_WhenCallbackAddedThenRemoved_CallbackShouldNotBeInvoked) {
- Pipe pipe;
- StubCallbackHandler handler(true);
-
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
- pipe.writeSignal(); // would cause FD to be considered signalled
- mLooper->removeFd(pipe.receiveFd);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal timeout because FD was no longer registered";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT";
- EXPECT_EQ(0, handler.callbackCount)
- << "callback should not be invoked";
-}
-
-TEST_F(LooperTest, PollOnce_WhenCallbackReturnsFalse_CallbackShouldNotBeInvokedAgainLater) {
- Pipe pipe;
- StubCallbackHandler handler(false);
-
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
-
- // First loop: Callback is registered and FD is signalled.
- pipe.writeSignal();
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(0);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal zero because FD was already signalled";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled";
- EXPECT_EQ(1, handler.callbackCount)
- << "callback should be invoked";
-
- // Second loop: Callback is no longer registered and FD is signalled.
- pipe.writeSignal();
-
- stopWatch.reset();
- result = mLooper->pollOnce(0);
- elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. equal zero because timeout was zero";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT";
- EXPECT_EQ(1, handler.callbackCount)
- << "callback should not be invoked this time";
-}
-
-TEST_F(LooperTest, PollOnce_WhenNonCallbackFdIsSignalled_ReturnsIdent) {
- const int expectedIdent = 5;
- void* expectedData = this;
-
- Pipe pipe;
-
- pipe.writeSignal();
- mLooper->addFd(pipe.receiveFd, expectedIdent, ALOOPER_EVENT_INPUT, NULL, expectedData);
-
- StopWatch stopWatch("pollOnce");
- int fd;
- int events;
- void* data;
- int result = mLooper->pollOnce(100, &fd, &events, &data);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should be approx. zero";
- EXPECT_EQ(expectedIdent, result)
- << "pollOnce result should be the ident of the FD that was signalled";
- EXPECT_EQ(pipe.receiveFd, fd)
- << "pollOnce should have returned the received pipe fd";
- EXPECT_EQ(ALOOPER_EVENT_INPUT, events)
- << "pollOnce should have returned ALOOPER_EVENT_INPUT as events";
- EXPECT_EQ(expectedData, data)
- << "pollOnce should have returned the data";
-}
-
-TEST_F(LooperTest, AddFd_WhenCallbackAdded_ReturnsOne) {
- Pipe pipe;
- int result = mLooper->addFd(pipe.receiveFd, 0, ALOOPER_EVENT_INPUT, NULL, NULL);
-
- EXPECT_EQ(1, result)
- << "addFd should return 1 because FD was added";
-}
-
-TEST_F(LooperTest, AddFd_WhenIdentIsNegativeAndCallbackIsNull_ReturnsError) {
- Pipe pipe;
- int result = mLooper->addFd(pipe.receiveFd, -1, ALOOPER_EVENT_INPUT, NULL, NULL);
-
- EXPECT_EQ(-1, result)
- << "addFd should return -1 because arguments were invalid";
-}
-
-TEST_F(LooperTest, AddFd_WhenNoCallbackAndAllowNonCallbacksIsFalse_ReturnsError) {
- Pipe pipe;
- sp<Looper> looper = new Looper(false /*allowNonCallbacks*/);
- int result = looper->addFd(pipe.receiveFd, 0, 0, NULL, NULL);
-
- EXPECT_EQ(-1, result)
- << "addFd should return -1 because arguments were invalid";
-}
-
-TEST_F(LooperTest, RemoveFd_WhenCallbackNotAdded_ReturnsZero) {
- int result = mLooper->removeFd(1);
-
- EXPECT_EQ(0, result)
- << "removeFd should return 0 because FD not registered";
-}
-
-TEST_F(LooperTest, RemoveFd_WhenCallbackAddedThenRemovedTwice_ReturnsOnceFirstTimeAndReturnsZeroSecondTime) {
- Pipe pipe;
- StubCallbackHandler handler(false);
- handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
-
- // First time.
- int result = mLooper->removeFd(pipe.receiveFd);
-
- EXPECT_EQ(1, result)
- << "removeFd should return 1 first time because FD was registered";
-
- // Second time.
- result = mLooper->removeFd(pipe.receiveFd);
-
- EXPECT_EQ(0, result)
- << "removeFd should return 0 second time because FD was no longer registered";
-}
-
-TEST_F(LooperTest, PollOnce_WhenCallbackAddedTwice_OnlySecondCallbackShouldBeInvoked) {
- Pipe pipe;
- StubCallbackHandler handler1(true);
- StubCallbackHandler handler2(true);
-
- handler1.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT);
- handler2.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); // replace it
- pipe.writeSignal(); // would cause FD to be considered signalled
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- ASSERT_EQ(OK, pipe.readSignal())
- << "signal should actually have been written";
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because FD was already signalled";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled";
- EXPECT_EQ(0, handler1.callbackCount)
- << "original handler callback should not be invoked because it was replaced";
- EXPECT_EQ(1, handler2.callbackCount)
- << "replacement handler callback should be invoked";
-}
-
-TEST_F(LooperTest, SendMessage_WhenOneMessageIsEnqueue_ShouldInvokeHandlerDuringNextPoll) {
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessage(handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was already sent";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
-}
-
-TEST_F(LooperTest, SendMessage_WhenMultipleMessagesAreEnqueued_ShouldInvokeHandlersInOrderDuringNextPoll) {
- sp<StubMessageHandler> handler1 = new StubMessageHandler();
- sp<StubMessageHandler> handler2 = new StubMessageHandler();
- mLooper->sendMessage(handler1, Message(MSG_TEST1));
- mLooper->sendMessage(handler2, Message(MSG_TEST2));
- mLooper->sendMessage(handler1, Message(MSG_TEST3));
- mLooper->sendMessage(handler1, Message(MSG_TEST4));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(1000);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was already sent";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
- EXPECT_EQ(size_t(3), handler1->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler1->messages[0].what)
- << "handled message";
- EXPECT_EQ(MSG_TEST3, handler1->messages[1].what)
- << "handled message";
- EXPECT_EQ(MSG_TEST4, handler1->messages[2].what)
- << "handled message";
- EXPECT_EQ(size_t(1), handler2->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST2, handler2->messages[0].what)
- << "handled message";
-}
-
-TEST_F(LooperTest, SendMessageDelayed_WhenSentToTheFuture_ShouldInvokeHandlerAfterDelayTime) {
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessageDelayed(ms2ns(100), handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(1000);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "first poll should end quickly because next message timeout was computed";
- EXPECT_EQ(ALOOPER_POLL_WAKE, result)
- << "pollOnce result should be ALOOPER_POLL_WAKE due to wakeup";
- EXPECT_EQ(size_t(0), handler->messages.size())
- << "no message handled yet";
-
- result = mLooper->pollOnce(1000);
- elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "second poll should end around the time of the delayed message dispatch";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
-
- result = mLooper->pollOnce(100);
- elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(100 + 100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "third poll should timeout";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there were no messages left";
-}
-
-TEST_F(LooperTest, SendMessageDelayed_WhenSentToThePast_ShouldInvokeHandlerDuringNextPoll) {
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessageDelayed(ms2ns(-1000), handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was already sent";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
-}
-
-TEST_F(LooperTest, SendMessageDelayed_WhenSentToThePresent_ShouldInvokeHandlerDuringNextPoll) {
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessageDelayed(0, handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was already sent";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
-}
-
-TEST_F(LooperTest, SendMessageAtTime_WhenSentToTheFuture_ShouldInvokeHandlerAfterDelayTime) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessageAtTime(now + ms2ns(100), handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(1000);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "first poll should end quickly because next message timeout was computed";
- EXPECT_EQ(ALOOPER_POLL_WAKE, result)
- << "pollOnce result should be ALOOPER_POLL_WAKE due to wakeup";
- EXPECT_EQ(size_t(0), handler->messages.size())
- << "no message handled yet";
-
- result = mLooper->pollOnce(1000);
- elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
- EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "second poll should end around the time of the delayed message dispatch";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
-
- result = mLooper->pollOnce(100);
- elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(100 + 100, elapsedMillis, TIMING_TOLERANCE_MS)
- << "third poll should timeout";
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there were no messages left";
-}
-
-TEST_F(LooperTest, SendMessageAtTime_WhenSentToThePast_ShouldInvokeHandlerDuringNextPoll) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessageAtTime(now - ms2ns(1000), handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was already sent";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
-}
-
-TEST_F(LooperTest, SendMessageAtTime_WhenSentToThePresent_ShouldInvokeHandlerDuringNextPoll) {
- nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessageAtTime(now, handler, Message(MSG_TEST1));
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(100);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was already sent";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent";
- EXPECT_EQ(size_t(1), handler->messages.size())
- << "handled message";
- EXPECT_EQ(MSG_TEST1, handler->messages[0].what)
- << "handled message";
-}
-
-TEST_F(LooperTest, RemoveMessage_WhenRemovingAllMessagesForHandler_ShouldRemoveThoseMessage) {
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessage(handler, Message(MSG_TEST1));
- mLooper->sendMessage(handler, Message(MSG_TEST2));
- mLooper->sendMessage(handler, Message(MSG_TEST3));
- mLooper->removeMessages(handler);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(0);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was sent so looper was awoken";
- EXPECT_EQ(ALOOPER_POLL_WAKE, result)
- << "pollOnce result should be ALOOPER_POLL_WAKE because looper was awoken";
- EXPECT_EQ(size_t(0), handler->messages.size())
- << "no messages to handle";
-
- result = mLooper->pollOnce(0);
-
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there was nothing to do";
- EXPECT_EQ(size_t(0), handler->messages.size())
- << "no messages to handle";
-}
-
-TEST_F(LooperTest, RemoveMessage_WhenRemovingSomeMessagesForHandler_ShouldRemoveThoseMessage) {
- sp<StubMessageHandler> handler = new StubMessageHandler();
- mLooper->sendMessage(handler, Message(MSG_TEST1));
- mLooper->sendMessage(handler, Message(MSG_TEST2));
- mLooper->sendMessage(handler, Message(MSG_TEST3));
- mLooper->sendMessage(handler, Message(MSG_TEST4));
- mLooper->removeMessages(handler, MSG_TEST3);
- mLooper->removeMessages(handler, MSG_TEST1);
-
- StopWatch stopWatch("pollOnce");
- int result = mLooper->pollOnce(0);
- int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime());
-
- EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS)
- << "elapsed time should approx. zero because message was sent so looper was awoken";
- EXPECT_EQ(ALOOPER_POLL_CALLBACK, result)
- << "pollOnce result should be ALOOPER_POLL_CALLBACK because two messages were sent";
- EXPECT_EQ(size_t(2), handler->messages.size())
- << "no messages to handle";
- EXPECT_EQ(MSG_TEST2, handler->messages[0].what)
- << "handled message";
- EXPECT_EQ(MSG_TEST4, handler->messages[1].what)
- << "handled message";
-
- result = mLooper->pollOnce(0);
-
- EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result)
- << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there was nothing to do";
- EXPECT_EQ(size_t(2), handler->messages.size())
- << "no more messages to handle";
-}
-
-} // namespace android
diff --git a/libs/utils/tests/String8_test.cpp b/libs/utils/tests/String8_test.cpp
deleted file mode 100644
index c42c68d..0000000
--- a/libs/utils/tests/String8_test.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "String8_test"
-#include <utils/Log.h>
-#include <utils/String8.h>
-
-#include <gtest/gtest.h>
-
-namespace android {
-
-class String8Test : public testing::Test {
-protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-TEST_F(String8Test, Cstr) {
- String8 tmp("Hello, world!");
-
- EXPECT_STREQ(tmp.string(), "Hello, world!");
-}
-
-TEST_F(String8Test, OperatorPlus) {
- String8 src1("Hello, ");
-
- // Test adding String8 + const char*
- const char* ccsrc2 = "world!";
- String8 dst1 = src1 + ccsrc2;
- EXPECT_STREQ(dst1.string(), "Hello, world!");
- EXPECT_STREQ(src1.string(), "Hello, ");
- EXPECT_STREQ(ccsrc2, "world!");
-
- // Test adding String8 + String8
- String8 ssrc2("world!");
- String8 dst2 = src1 + ssrc2;
- EXPECT_STREQ(dst2.string(), "Hello, world!");
- EXPECT_STREQ(src1.string(), "Hello, ");
- EXPECT_STREQ(ssrc2.string(), "world!");
-}
-
-TEST_F(String8Test, OperatorPlusEquals) {
- String8 src1("My voice");
-
- // Testing String8 += String8
- String8 src2(" is my passport.");
- src1 += src2;
- EXPECT_STREQ(src1.string(), "My voice is my passport.");
- EXPECT_STREQ(src2.string(), " is my passport.");
-
- // Adding const char* to the previous string.
- const char* src3 = " Verify me.";
- src1 += src3;
- EXPECT_STREQ(src1.string(), "My voice is my passport. Verify me.");
- EXPECT_STREQ(src2.string(), " is my passport.");
- EXPECT_STREQ(src3, " Verify me.");
-}
-
-}
diff --git a/libs/utils/tests/Unicode_test.cpp b/libs/utils/tests/Unicode_test.cpp
deleted file mode 100644
index 18c130c..0000000
--- a/libs/utils/tests/Unicode_test.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "Unicode_test"
-#include <utils/Log.h>
-#include <utils/Unicode.h>
-
-#include <gtest/gtest.h>
-
-namespace android {
-
-class UnicodeTest : public testing::Test {
-protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-TEST_F(UnicodeTest, UTF8toUTF16ZeroLength) {
- ssize_t measured;
-
- const uint8_t str[] = { };
-
- measured = utf8_to_utf16_length(str, 0);
- EXPECT_EQ(0, measured)
- << "Zero length input should return zero length output.";
-}
-
-TEST_F(UnicodeTest, UTF8toUTF16ASCIILength) {
- ssize_t measured;
-
- // U+0030 or ASCII '0'
- const uint8_t str[] = { 0x30 };
-
- measured = utf8_to_utf16_length(str, sizeof(str));
- EXPECT_EQ(1, measured)
- << "ASCII glyphs should have a length of 1 char16_t";
-}
-
-TEST_F(UnicodeTest, UTF8toUTF16Plane1Length) {
- ssize_t measured;
-
- // U+2323 SMILE
- const uint8_t str[] = { 0xE2, 0x8C, 0xA3 };
-
- measured = utf8_to_utf16_length(str, sizeof(str));
- EXPECT_EQ(1, measured)
- << "Plane 1 glyphs should have a length of 1 char16_t";
-}
-
-TEST_F(UnicodeTest, UTF8toUTF16SurrogateLength) {
- ssize_t measured;
-
- // U+10000
- const uint8_t str[] = { 0xF0, 0x90, 0x80, 0x80 };
-
- measured = utf8_to_utf16_length(str, sizeof(str));
- EXPECT_EQ(2, measured)
- << "Surrogate pairs should have a length of 2 char16_t";
-}
-
-TEST_F(UnicodeTest, UTF8toUTF16TruncatedUTF8) {
- ssize_t measured;
-
- // Truncated U+2323 SMILE
- // U+2323 SMILE
- const uint8_t str[] = { 0xE2, 0x8C };
-
- measured = utf8_to_utf16_length(str, sizeof(str));
- EXPECT_EQ(-1, measured)
- << "Truncated UTF-8 should return -1 to indicate invalid";
-}
-
-TEST_F(UnicodeTest, UTF8toUTF16Normal) {
- const uint8_t str[] = {
- 0x30, // U+0030, 1 UTF-16 character
- 0xC4, 0x80, // U+0100, 1 UTF-16 character
- 0xE2, 0x8C, 0xA3, // U+2323, 1 UTF-16 character
- 0xF0, 0x90, 0x80, 0x80, // U+10000, 2 UTF-16 character
- };
-
- char16_t output[1 + 1 + 1 + 2 + 1]; // Room for NULL
-
- utf8_to_utf16(str, sizeof(str), output);
-
- EXPECT_EQ(0x0030, output[0])
- << "should be U+0030";
- EXPECT_EQ(0x0100, output[1])
- << "should be U+0100";
- EXPECT_EQ(0x2323, output[2])
- << "should be U+2323";
- EXPECT_EQ(0xD800, output[3])
- << "should be first half of surrogate U+10000";
- EXPECT_EQ(0xDC00, output[4])
- << "should be second half of surrogate U+10000";
- EXPECT_EQ(NULL, output[5])
- << "should be NULL terminated";
-}
-
-}
diff --git a/media/java/android/media/MediaActionSound.java b/media/java/android/media/MediaActionSound.java
index d0e6910..7a520fe 100644
--- a/media/java/android/media/MediaActionSound.java
+++ b/media/java/android/media/MediaActionSound.java
@@ -185,10 +185,14 @@
};
/**
- * Free up all audio resources used by this MediaActionSound instance
+ * Free up all audio resources used by this MediaActionSound instance. Do
+ * not call any other methods on a MediaActionSound instance after calling
+ * release().
*/
public void release() {
- mSoundPool.release();
- mSoundPool = null;
+ if (mSoundPool != null) {
+ mSoundPool.release();
+ mSoundPool = null;
+ }
}
}
diff --git a/opengl/include/EGL/egl.h b/opengl/include/EGL/egl.h
deleted file mode 100644
index 99ea342..0000000
--- a/opengl/include/EGL/egl.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/* -*- mode: c; tab-width: 8; -*- */
-/* vi: set sw=4 ts=8: */
-/* Reference version of egl.h for EGL 1.4.
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
- */
-
-/*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#ifndef __egl_h_
-#define __egl_h_
-
-/* All platform-dependent types and macro boilerplate (such as EGLAPI
- * and EGLAPIENTRY) should go in eglplatform.h.
- */
-#include <EGL/eglplatform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* EGL Types */
-/* EGLint is defined in eglplatform.h */
-typedef unsigned int EGLBoolean;
-typedef unsigned int EGLenum;
-typedef void *EGLConfig;
-typedef void *EGLContext;
-typedef void *EGLDisplay;
-typedef void *EGLSurface;
-typedef void *EGLClientBuffer;
-
-/* EGL Versioning */
-#define EGL_VERSION_1_0 1
-#define EGL_VERSION_1_1 1
-#define EGL_VERSION_1_2 1
-#define EGL_VERSION_1_3 1
-#define EGL_VERSION_1_4 1
-
-/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
- * enums are assigned unique values starting at 0x3000.
- */
-
-/* EGL aliases */
-#define EGL_FALSE 0
-#define EGL_TRUE 1
-
-/* Out-of-band handle values */
-#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
-
-/* Out-of-band attribute value */
-#define EGL_DONT_CARE ((EGLint)-1)
-
-/* Errors / GetError return values */
-#define EGL_SUCCESS 0x3000
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
-
-/* Reserved 0x300F-0x301F for additional errors */
-
-/* Config attributes */
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE 0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-#define EGL_NONE 0x3038 /* Attrib list terminator */
-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
-#define EGL_MIN_SWAP_INTERVAL 0x303B
-#define EGL_MAX_SWAP_INTERVAL 0x303C
-#define EGL_LUMINANCE_SIZE 0x303D
-#define EGL_ALPHA_MASK_SIZE 0x303E
-#define EGL_COLOR_BUFFER_TYPE 0x303F
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
-#define EGL_CONFORMANT 0x3042
-
-/* Reserved 0x3041-0x304F for additional config attributes */
-
-/* Config attribute values */
-#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
-#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
-#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
-#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
-#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
-
-/* More config attribute values, for EGL_TEXTURE_FORMAT */
-#define EGL_NO_TEXTURE 0x305C
-#define EGL_TEXTURE_RGB 0x305D
-#define EGL_TEXTURE_RGBA 0x305E
-#define EGL_TEXTURE_2D 0x305F
-
-/* Config attribute mask bits */
-#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
-
-#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
-
-/* QueryString targets */
-#define EGL_VENDOR 0x3053
-#define EGL_VERSION 0x3054
-#define EGL_EXTENSIONS 0x3055
-#define EGL_CLIENT_APIS 0x308D
-
-/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
-#define EGL_HEIGHT 0x3056
-#define EGL_WIDTH 0x3057
-#define EGL_LARGEST_PBUFFER 0x3058
-#define EGL_TEXTURE_FORMAT 0x3080
-#define EGL_TEXTURE_TARGET 0x3081
-#define EGL_MIPMAP_TEXTURE 0x3082
-#define EGL_MIPMAP_LEVEL 0x3083
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_VG_COLORSPACE 0x3087
-#define EGL_VG_ALPHA_FORMAT 0x3088
-#define EGL_HORIZONTAL_RESOLUTION 0x3090
-#define EGL_VERTICAL_RESOLUTION 0x3091
-#define EGL_PIXEL_ASPECT_RATIO 0x3092
-#define EGL_SWAP_BEHAVIOR 0x3093
-#define EGL_MULTISAMPLE_RESOLVE 0x3099
-
-/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
-#define EGL_BACK_BUFFER 0x3084
-#define EGL_SINGLE_BUFFER 0x3085
-
-/* OpenVG color spaces */
-#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
-#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
-
-/* OpenVG alpha formats */
-#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
-#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
-
-/* Constant scale factor by which fractional display resolutions &
- * aspect ratio are scaled when queried as integer values.
- */
-#define EGL_DISPLAY_SCALING 10000
-
-/* Unknown display resolution/aspect ratio */
-#define EGL_UNKNOWN ((EGLint)-1)
-
-/* Back buffer swap behaviors */
-#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
-#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
-
-/* CreatePbufferFromClientBuffer buffer types */
-#define EGL_OPENVG_IMAGE 0x3096
-
-/* QueryContext targets */
-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
-
-/* CreateContext attributes */
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
-
-/* Multisample resolution behaviors */
-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
-#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
-
-/* BindAPI/QueryAPI targets */
-#define EGL_OPENGL_ES_API 0x30A0
-#define EGL_OPENVG_API 0x30A1
-#define EGL_OPENGL_API 0x30A2
-
-/* GetCurrentSurface targets */
-#define EGL_DRAW 0x3059
-#define EGL_READ 0x305A
-
-/* WaitNative engines */
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-
-/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
-#define EGL_COLORSPACE EGL_VG_COLORSPACE
-#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
-#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
-#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
-#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
-#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
-
-/* EGL extensions must request enum blocks from the Khronos
- * API Registrar, who maintains the enumerant registry. Submit
- * a bug in Khronos Bugzilla against task "Registry".
- */
-
-
-
-/* EGL Functions */
-
-EGLAPI EGLint EGLAPIENTRY eglGetError(void);
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
-
-EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
- EGLint config_size, EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value);
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
- EGLNativeWindowType win,
- const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
- EGLNativePixmapType pixmap,
- const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint *value);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
- EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
-
-
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
- EGLContext share_context,
- const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext ctx);
-
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
- EGLNativePixmapType target);
-
-/* This is a generic function pointer type, whose name indicates it must
- * be cast to the proper type *and calling convention* before use.
- */
-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
-
-/* Now, define eglGetProcAddress using the generic function ptr. type */
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
- eglGetProcAddress(const char *procname);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __egl_h_ */
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
deleted file mode 100644
index ca11863..0000000
--- a/opengl/include/EGL/eglext.h
+++ /dev/null
@@ -1,270 +0,0 @@
-#ifndef __eglext_h_
-#define __eglext_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2007-2010 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#include <EGL/eglplatform.h>
-
-/*************************************************************/
-
-/* Header file version number */
-/* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision: 11249 $ on $Date: 2010-05-05 09:54:28 -0700 (Wed, 05 May 2010) $ */
-#define EGL_EGLEXT_VERSION 5
-
-#ifndef EGL_KHR_config_attribs
-#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
-#endif
-
-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
-#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
-#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
-#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
-#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
-#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
-#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
-#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
-#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
-#endif
-
-#ifndef EGL_KHR_image
-#define EGL_KHR_image 1
-#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
-typedef void *EGLImageKHR;
-#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
-#endif
-
-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_KHR_gl_texture_2D_image
-#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_KHR_gl_texture_3D_image
-#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_KHR_reusable_sync
-#define EGL_KHR_reusable_sync 1
-
-typedef void* EGLSyncKHR;
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-
-#define EGL_SYNC_STATUS_KHR 0x30F1
-#define EGL_SIGNALED_KHR 0x30F2
-#define EGL_UNSIGNALED_KHR 0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
-#define EGL_SYNC_TYPE_KHR 0x30F7
-#define EGL_SYNC_REUSABLE_KHR 0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif
-
-#ifndef EGL_KHR_image_base
-#define EGL_KHR_image_base 1
-/* Most interfaces defined by EGL_KHR_image_pixmap above */
-#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_image_pixmap
-#define EGL_KHR_image_pixmap 1
-/* Interfaces defined by EGL_KHR_image above */
-#endif
-
-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
-#endif
-
-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
-#endif
-
-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
-#endif
-
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
-#define EGL_SYNC_STATUS_NV 0x30E7
-#define EGL_SIGNALED_NV 0x30E8
-#define EGL_UNSIGNALED_NV 0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
-#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV 0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
-#define EGL_CONDITION_SATISFIED_NV 0x30EC
-#define EGL_SYNC_TYPE_NV 0x30ED
-#define EGL_SYNC_CONDITION_NV 0x30EE
-#define EGL_SYNC_FENCE_NV 0x30EF
-#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
-typedef void* EGLSyncNV;
-typedef unsigned long long EGLTimeNV;
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
-EGLBoolean eglFenceNV (EGLSyncNV sync);
-EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif
-
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
-#define EGL_SYNC_CONDITION_KHR 0x30F8
-#define EGL_SYNC_FENCE_KHR 0x30F9
-#endif
-
-#ifndef EGL_ANDROID_image_native_buffer
-#define EGL_ANDROID_image_native_buffer 1
-struct ANativeWindowBuffer;
-#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_ANDROID_recordable
-#define EGL_ANDROID_recordable 1
-#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */
-#endif
-
-/* EGL_NV_system_time
- */
-#ifndef EGL_NV_system_time
-#define EGL_NV_system_time 1
-typedef khronos_int64_t EGLint64NV;
-typedef khronos_uint64_t EGLuint64NV;
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
-#endif
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)(void);
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void);
-#endif
-
-
-/* EGL_ANDROID_blob_cache
- */
-#ifndef EGL_ANDROID_blob_cache
-#define EGL_ANDROID_blob_cache 1
-typedef khronos_ssize_t EGLsizeiANDROID;
-typedef void (*EGLSetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize);
-typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy,
- EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/opengl/include/EGL/eglplatform.h b/opengl/include/EGL/eglplatform.h
deleted file mode 100644
index bfac71b..0000000
--- a/opengl/include/EGL/eglplatform.h
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifndef __eglplatform_h_
-#define __eglplatform_h_
-
-/*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Platform-specific types and definitions for egl.h
- * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * You are encouraged to submit all modifications to the Khronos group so that
- * they can be included in future versions of this file. Please submit changes
- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
- * by filing a bug against product "EGL" component "Registry".
- */
-
-#include <KHR/khrplatform.h>
-
-/* Macros used in EGL function prototype declarations.
- *
- * EGL functions should be prototyped as:
- *
- * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
- * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
- *
- * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
- */
-
-#ifndef EGLAPI
-#define EGLAPI KHRONOS_APICALL
-#endif
-
-#ifndef EGLAPIENTRY
-#define EGLAPIENTRY KHRONOS_APIENTRY
-#endif
-#define EGLAPIENTRYP EGLAPIENTRY*
-
-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
- * are aliases of window-system-dependent types, such as X Display * or
- * Windows Device Context. They must be defined in platform-specific
- * code below. The EGL-prefixed versions of Native*Type are the same
- * types, renamed in EGL 1.3 so all types in the API start with "EGL".
- */
-
-#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-
-typedef HDC EGLNativeDisplayType;
-typedef HBITMAP EGLNativePixmapType;
-typedef HWND EGLNativeWindowType;
-
-#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
-
-typedef int EGLNativeDisplayType;
-typedef void *EGLNativeWindowType;
-typedef void *EGLNativePixmapType;
-
-#elif defined(__ANDROID__) || defined(ANDROID)
-
-#include <android/native_window.h>
-
-struct egl_native_pixmap_t;
-
-typedef struct ANativeWindow* EGLNativeWindowType;
-typedef struct egl_native_pixmap_t* EGLNativePixmapType;
-typedef void* EGLNativeDisplayType;
-
-#elif defined(__unix__)
-
-/* X11 (tentative) */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap EGLNativePixmapType;
-typedef Window EGLNativeWindowType;
-
-#else
-#error "Platform not recognized"
-#endif
-
-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
-typedef EGLNativeDisplayType NativeDisplayType;
-typedef EGLNativePixmapType NativePixmapType;
-typedef EGLNativeWindowType NativeWindowType;
-
-
-/* Define EGLint. This must be a signed integral type large enough to contain
- * all legal attribute names and values passed into and out of EGL, whether
- * their type is boolean, bitmask, enumerant (symbolic constant), integer,
- * handle, or other. While in general a 32-bit integer will suffice, if
- * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
- * integer type.
- */
-typedef khronos_int32_t EGLint;
-
-#endif /* __eglplatform_h */
diff --git a/opengl/include/ETC1/etc1.h b/opengl/include/ETC1/etc1.h
deleted file mode 100644
index 0d38905..0000000
--- a/opengl/include/ETC1/etc1.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2009 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.
-
-#ifndef __etc1_h__
-#define __etc1_h__
-
-#define ETC1_ENCODED_BLOCK_SIZE 8
-#define ETC1_DECODED_BLOCK_SIZE 48
-
-#ifndef ETC1_RGB8_OES
-#define ETC1_RGB8_OES 0x8D64
-#endif
-
-typedef unsigned char etc1_byte;
-typedef int etc1_bool;
-typedef unsigned int etc1_uint32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Encode a block of pixels.
-//
-// pIn is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
-// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
-// value of pixel (x, y).
-//
-// validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether
-// the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
-//
-// pOut is an ETC1 compressed version of the data.
-
-void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 validPixelMask, etc1_byte* pOut);
-
-// Decode a block of pixels.
-//
-// pIn is an ETC1 compressed version of the data.
-//
-// pOut is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
-// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
-// value of pixel (x, y).
-
-void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut);
-
-// Return the size of the encoded image data (does not include size of PKM header).
-
-etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height);
-
-// Encode an entire image.
-// pIn - pointer to the image data. Formatted such that
-// pixel (x,y) is at pIn + pixelSize * x + stride * y;
-// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
-// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
-// returns non-zero if there is an error.
-
-int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut);
-
-// Decode an entire image.
-// pIn - pointer to encoded data.
-// pOut - pointer to the image data. Will be written such that
-// pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
-// large enough to store entire image.
-// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
-// returns non-zero if there is an error.
-
-int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
- etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride);
-
-// Size of a PKM header, in bytes.
-
-#define ETC_PKM_HEADER_SIZE 16
-
-// Format a PKM header
-
-void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height);
-
-// Check if a PKM header is correctly formatted.
-
-etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader);
-
-// Read the image width from a PKM header
-
-etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader);
-
-// Read the image height from a PKM header
-
-etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/opengl/include/GLES/egl.h b/opengl/include/GLES/egl.h
deleted file mode 100644
index 5778e00..0000000
--- a/opengl/include/GLES/egl.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Skeleton egl.h to provide compatibility for early GLES 1.0
- * applications. Several early implementations included gl.h
- * in egl.h leading applications to include only egl.h
- *
- * $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$
- */
-
-#ifndef __legacy_egl_h_
-#define __legacy_egl_h_
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-#endif /* __legacy_egl_h_ */
diff --git a/opengl/include/GLES/gl.h b/opengl/include/GLES/gl.h
deleted file mode 100644
index 5b8d85a..0000000
--- a/opengl/include/GLES/gl.h
+++ /dev/null
@@ -1,770 +0,0 @@
-#ifndef __gl_h_
-#define __gl_h_
-
-/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
-
-#include <GLES/glplatform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-typedef void GLvoid;
-typedef char GLchar;
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef khronos_int8_t GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef khronos_float_t GLfloat;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef khronos_int32_t GLclampx;
-
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t GLsizeiptr;
-
-
-/*************************************************************/
-
-/* OpenGL ES core versions */
-#define GL_VERSION_ES_CM_1_0 1
-#define GL_VERSION_ES_CL_1_0 1
-#define GL_VERSION_ES_CM_1_1 1
-#define GL_VERSION_ES_CL_1_1 1
-
-/* ClearBufferMask */
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-
-/* Boolean */
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/* BeginMode */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-
-/* AlphaFunction */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-
-/* BlendingFactorDest */
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-
-/* BlendingFactorSrc */
-/* GL_ZERO */
-/* GL_ONE */
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-/* GL_SRC_ALPHA */
-/* GL_ONE_MINUS_SRC_ALPHA */
-/* GL_DST_ALPHA */
-/* GL_ONE_MINUS_DST_ALPHA */
-
-/* ClipPlaneName */
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-
-/* ColorMaterialFace */
-/* GL_FRONT_AND_BACK */
-
-/* ColorMaterialParameter */
-/* GL_AMBIENT_AND_DIFFUSE */
-
-/* ColorPointerType */
-/* GL_UNSIGNED_BYTE */
-/* GL_FLOAT */
-/* GL_FIXED */
-
-/* CullFaceMode */
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-
-/* DepthFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* EnableCap */
-#define GL_FOG 0x0B60
-#define GL_LIGHTING 0x0B50
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_BLEND 0x0BE2
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-/* GL_LIGHT0 */
-/* GL_LIGHT1 */
-/* GL_LIGHT2 */
-/* GL_LIGHT3 */
-/* GL_LIGHT4 */
-/* GL_LIGHT5 */
-/* GL_LIGHT6 */
-/* GL_LIGHT7 */
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_NORMALIZE 0x0BA1
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-
-/* ErrorCode */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* FogMode */
-/* GL_LINEAR */
-#define GL_EXP 0x0800
-#define GL_EXP2 0x0801
-
-/* FogParameter */
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_COLOR 0x0B66
-
-/* FrontFaceDirection */
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-
-/* GetPName */
-#define GL_CURRENT_COLOR 0x0B00
-#define GL_CURRENT_NORMAL 0x0B02
-#define GL_CURRENT_TEXTURE_COORDS 0x0B03
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_LINE_WIDTH 0x0B21
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_SHADE_MODEL 0x0B54
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_MATRIX_MODE 0x0BA0
-#define GL_VIEWPORT 0x0BA2
-#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
-#define GL_PROJECTION_STACK_DEPTH 0x0BA4
-#define GL_TEXTURE_STACK_DEPTH 0x0BA5
-#define GL_MODELVIEW_MATRIX 0x0BA6
-#define GL_PROJECTION_MATRIX 0x0BA7
-#define GL_TEXTURE_MATRIX 0x0BA8
-#define GL_ALPHA_TEST_FUNC 0x0BC1
-#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_BLEND_DST 0x0BE0
-#define GL_BLEND_SRC 0x0BE1
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-
-/* GetTextureParameter */
-/* GL_TEXTURE_MAG_FILTER */
-/* GL_TEXTURE_MIN_FILTER */
-/* GL_TEXTURE_WRAP_S */
-/* GL_TEXTURE_WRAP_T */
-
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-
-/* HintMode */
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* HintTarget */
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_FOG_HINT 0x0C54
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-
-/* LightModelParameter */
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-
-/* LightParameter */
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-
-/* DataType */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-
-/* LogicOp */
-#define GL_CLEAR 0x1500
-#define GL_AND 0x1501
-#define GL_AND_REVERSE 0x1502
-#define GL_COPY 0x1503
-#define GL_AND_INVERTED 0x1504
-#define GL_NOOP 0x1505
-#define GL_XOR 0x1506
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_EQUIV 0x1509
-#define GL_INVERT 0x150A
-#define GL_OR_REVERSE 0x150B
-#define GL_COPY_INVERTED 0x150C
-#define GL_OR_INVERTED 0x150D
-#define GL_NAND 0x150E
-#define GL_SET 0x150F
-
-/* MaterialFace */
-/* GL_FRONT_AND_BACK */
-
-/* MaterialParameter */
-#define GL_EMISSION 0x1600
-#define GL_SHININESS 0x1601
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-/* GL_AMBIENT */
-/* GL_DIFFUSE */
-/* GL_SPECULAR */
-
-/* MatrixMode */
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-
-/* NormalPointerType */
-/* GL_BYTE */
-/* GL_SHORT */
-/* GL_FLOAT */
-/* GL_FIXED */
-
-/* PixelFormat */
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-
-/* PixelStoreParameter */
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-
-/* PixelType */
-/* GL_UNSIGNED_BYTE */
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-
-/* ShadingModel */
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-
-/* StencilFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* StencilOp */
-/* GL_ZERO */
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-/* GL_INVERT */
-
-/* StringName */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* TexCoordPointerType */
-/* GL_SHORT */
-/* GL_FLOAT */
-/* GL_FIXED */
-/* GL_BYTE */
-
-/* TextureEnvMode */
-#define GL_MODULATE 0x2100
-#define GL_DECAL 0x2101
-/* GL_BLEND */
-#define GL_ADD 0x0104
-/* GL_REPLACE */
-
-/* TextureEnvParameter */
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_ENV_COLOR 0x2201
-
-/* TextureEnvTarget */
-#define GL_TEXTURE_ENV 0x2300
-
-/* TextureMagFilter */
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-
-/* TextureMinFilter */
-/* GL_NEAREST */
-/* GL_LINEAR */
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-
-/* TextureParameterName */
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_GENERATE_MIPMAP 0x8191
-
-/* TextureTarget */
-/* GL_TEXTURE_2D */
-
-/* TextureUnit */
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-
-/* TextureWrapMode */
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-
-/* VertexPointerType */
-/* GL_SHORT */
-/* GL_FLOAT */
-/* GL_FIXED */
-/* GL_BYTE */
-
-/* LightName */
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-
-/* Buffer Objects */
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-
-/* Texture combine + dot3 */
-#define GL_SUBTRACT 0x84E7
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-
-#define GL_ALPHA_SCALE 0x0D1C
-
-#define GL_SRC0_RGB 0x8580
-#define GL_SRC1_RGB 0x8581
-#define GL_SRC2_RGB 0x8582
-#define GL_SRC0_ALPHA 0x8588
-#define GL_SRC1_ALPHA 0x8589
-#define GL_SRC2_ALPHA 0x858A
-
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-
-/*------------------------------------------------------------------------*
- * required OES extension tokens
- *------------------------------------------------------------------------*/
-
-/* OES_read_format */
-#ifndef GL_OES_read_format
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-#endif
-
-/* GL_OES_compressed_paletted_texture */
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-#endif
-
-/* OES_point_size_array */
-#ifndef GL_OES_point_size_array
-#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
-#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
-#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
-#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
-#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
-#endif
-
-/* GL_OES_point_sprite */
-#ifndef GL_OES_point_sprite
-#define GL_POINT_SPRITE_OES 0x8861
-#define GL_COORD_REPLACE_OES 0x8862
-#endif
-
-/*************************************************************/
-
-/* Available only in Common profile */
-GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
-GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
-GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
-GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
-GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
-GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glLineWidth (GLfloat width);
-GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
-GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
-GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
-GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glPointSize (GLfloat size);
-GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
-
-/* Available in both Common and Common-Lite profiles */
-GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
-GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
-GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
-GL_API void GL_APIENTRY glClear (GLbitfield mask);
-GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
-GL_API void GL_APIENTRY glClearStencil (GLint s);
-GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
-GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
-GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glCullFace (GLenum mode);
-GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GL_API void GL_APIENTRY glDepthFunc (GLenum func);
-GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
-GL_API void GL_APIENTRY glDisable (GLenum cap);
-GL_API void GL_APIENTRY glDisableClientState (GLenum array);
-GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-GL_API void GL_APIENTRY glEnable (GLenum cap);
-GL_API void GL_APIENTRY glEnableClientState (GLenum array);
-GL_API void GL_APIENTRY glFinish (void);
-GL_API void GL_APIENTRY glFlush (void);
-GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glFrontFace (GLenum mode);
-GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
-GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
-GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GL_API GLenum GL_APIENTRY glGetError (void);
-GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params);
-GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
-GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
-GL_API void GL_APIENTRY glLoadIdentity (void);
-GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
-GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
-GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
-GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
-GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
-GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glPointSizex (GLfixed size);
-GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
-GL_API void GL_APIENTRY glPopMatrix (void);
-GL_API void GL_APIENTRY glPushMatrix (void);
-GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
-GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
-GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
-GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glShadeModel (GLenum mode);
-GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_API void GL_APIENTRY glStencilMask (GLuint mask);
-GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-
-/*------------------------------------------------------------------------*
- * Required OES extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_OES_read_format */
-#ifndef GL_OES_read_format
-#define GL_OES_read_format 1
-#endif
-
-/* GL_OES_compressed_paletted_texture */
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#endif
-
-/* GL_OES_point_size_array */
-#ifndef GL_OES_point_size_array
-#define GL_OES_point_size_array 1
-GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-/* GL_OES_point_sprite */
-#ifndef GL_OES_point_sprite
-#define GL_OES_point_sprite 1
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl_h_ */
-
diff --git a/opengl/include/GLES/glext.h b/opengl/include/GLES/glext.h
deleted file mode 100644
index 54afaab..0000000
--- a/opengl/include/GLES/glext.h
+++ /dev/null
@@ -1,1183 +0,0 @@
-#ifndef __glext_h_
-#define __glext_h_
-
-/* $Revision: 16481 $ on $Date:: 2012-01-04 10:43:56 -0800 #$ */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-#ifndef GL_APIENTRYP
-# define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/*------------------------------------------------------------------------*
- * OES extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_OES_blend_equation_separate */
-#ifndef GL_OES_blend_equation_separate
-/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */
-#define GL_BLEND_EQUATION_RGB_OES 0x8009
-#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
-#endif
-
-/* GL_OES_blend_func_separate */
-#ifndef GL_OES_blend_func_separate
-#define GL_BLEND_DST_RGB_OES 0x80C8
-#define GL_BLEND_SRC_RGB_OES 0x80C9
-#define GL_BLEND_DST_ALPHA_OES 0x80CA
-#define GL_BLEND_SRC_ALPHA_OES 0x80CB
-#endif
-
-/* GL_OES_blend_subtract */
-#ifndef GL_OES_blend_subtract
-#define GL_BLEND_EQUATION_OES 0x8009
-#define GL_FUNC_ADD_OES 0x8006
-#define GL_FUNC_SUBTRACT_OES 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
-#endif
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_ETC1_RGB8_OES 0x8D64
-#endif
-
-/* GL_OES_depth24 */
-#ifndef GL_OES_depth24
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif
-
-/* GL_OES_depth32 */
-#ifndef GL_OES_depth32
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#endif
-
-/* GL_OES_draw_texture */
-#ifndef GL_OES_draw_texture
-#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
-#endif
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-typedef void* GLeglImageOES;
-#endif
-
-/* GL_OES_EGL_image_external */
-#ifndef GL_OES_EGL_image_external
-/* GLeglImageOES defined in GL_OES_EGL_image already. */
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
-#endif
-
-/* GL_OES_element_index_uint */
-#ifndef GL_OES_element_index_uint
-#define GL_UNSIGNED_INT 0x1405
-#endif
-
-/* GL_OES_fixed_point */
-#ifndef GL_OES_fixed_point
-#define GL_FIXED_OES 0x140C
-#endif
-
-/* GL_OES_framebuffer_object */
-#ifndef GL_OES_framebuffer_object
-#define GL_NONE_OES 0
-#define GL_FRAMEBUFFER_OES 0x8D40
-#define GL_RENDERBUFFER_OES 0x8D41
-#define GL_RGBA4_OES 0x8056
-#define GL_RGB5_A1_OES 0x8057
-#define GL_RGB565_OES 0x8D62
-#define GL_DEPTH_COMPONENT16_OES 0x81A5
-#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
-#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
-#define GL_DEPTH_ATTACHMENT_OES 0x8D00
-#define GL_STENCIL_ATTACHMENT_OES 0x8D20
-#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
-#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
-#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
-#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
-#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_WRITE_ONLY_OES 0x88B9
-#define GL_BUFFER_ACCESS_OES 0x88BB
-#define GL_BUFFER_MAPPED_OES 0x88BC
-#define GL_BUFFER_MAP_POINTER_OES 0x88BD
-#endif
-
-/* GL_OES_matrix_get */
-#ifndef GL_OES_matrix_get
-#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
-#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
-#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
-#endif
-
-/* GL_OES_matrix_palette */
-#ifndef GL_OES_matrix_palette
-#define GL_MAX_VERTEX_UNITS_OES 0x86A4
-#define GL_MAX_PALETTE_MATRICES_OES 0x8842
-#define GL_MATRIX_PALETTE_OES 0x8840
-#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
-#define GL_WEIGHT_ARRAY_OES 0x86AD
-#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
-#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
-#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
-#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
-#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
-#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
-#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
-#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
-#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
-#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_RGB8_OES 0x8051
-#define GL_RGBA8_OES 0x8058
-#endif
-
-/* GL_OES_stencil1 */
-#ifndef GL_OES_stencil1
-#define GL_STENCIL_INDEX1_OES 0x8D46
-#endif
-
-/* GL_OES_stencil4 */
-#ifndef GL_OES_stencil4
-#define GL_STENCIL_INDEX4_OES 0x8D47
-#endif
-
-/* GL_OES_stencil8 */
-#ifndef GL_OES_stencil8
-#define GL_STENCIL_INDEX8_OES 0x8D48
-#endif
-
-/* GL_OES_stencil_wrap */
-#ifndef GL_OES_stencil_wrap
-#define GL_INCR_WRAP_OES 0x8507
-#define GL_DECR_WRAP_OES 0x8508
-#endif
-
-/* GL_OES_texture_cube_map */
-#ifndef GL_OES_texture_cube_map
-#define GL_NORMAL_MAP_OES 0x8511
-#define GL_REFLECTION_MAP_OES 0x8512
-#define GL_TEXTURE_CUBE_MAP_OES 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
-#define GL_TEXTURE_GEN_MODE_OES 0x2500
-#define GL_TEXTURE_GEN_STR_OES 0x8D60
-#endif
-
-/* GL_OES_texture_mirrored_repeat */
-#ifndef GL_OES_texture_mirrored_repeat
-#define GL_MIRRORED_REPEAT_OES 0x8370
-#endif
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-#endif
-
-/*------------------------------------------------------------------------*
- * AMD extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_AMD_compressed_3DC_texture */
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_3DC_X_AMD 0x87F9
-#define GL_3DC_XY_AMD 0x87FA
-#endif
-
-/* GL_AMD_compressed_ATC_texture */
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_ATC_RGB_AMD 0x8C92
-#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
-#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
-#endif
-
-/*------------------------------------------------------------------------*
- * APPLE extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_texture_2D_limited_npot */
-/* No new tokens introduced by this extension. */
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
-#define GL_MAX_SAMPLES_APPLE 0x8D57
-#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
-#endif
-
-/* GL_APPLE_texture_format_BGRA8888 */
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-/* GL_APPLE_texture_max_level */
-#ifndef GL_APPLE_texture_max_level
-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
-#endif
-
-/*------------------------------------------------------------------------*
- * ARM extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_ARM_rgba8 */
-/* No new tokens introduced by this extension. */
-
-/*------------------------------------------------------------------------*
- * EXT extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_EXT_blend_minmax */
-#ifndef GL_EXT_blend_minmax
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#endif
-
-/* GL_EXT_discard_framebuffer */
-#ifndef GL_EXT_discard_framebuffer
-#define GL_COLOR_EXT 0x1800
-#define GL_DEPTH_EXT 0x1801
-#define GL_STENCIL_EXT 0x1802
-#endif
-
-/* GL_EXT_multisampled_render_to_texture */
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134
-#define GL_MAX_SAMPLES_EXT 0x9135
-#endif
-
-/* GL_EXT_multi_draw_arrays */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_read_format_bgra */
-#ifndef GL_EXT_read_format_bgra
-#define GL_BGRA_EXT 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-/* reuse GL_NO_ERROR */
-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
-#endif
-
-/* GL_EXT_sRGB */
-#ifndef GL_EXT_sRGB
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#endif
-
-/* GL_EXT_texture_filter_anisotropic */
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif
-
-/* GL_EXT_texture_format_BGRA8888 */
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-/* GL_EXT_texture_lod_bias */
-#ifndef GL_EXT_texture_lod_bias
-#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
-#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
-#define GL_ALPHA8_EXT 0x803C
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_RGBA32F_EXT 0x8814
-#define GL_RGB32F_EXT 0x8815
-#define GL_ALPHA32F_EXT 0x8816
-#define GL_LUMINANCE32F_EXT 0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
-/* reuse GL_RGBA16F_EXT */
-#define GL_RGB16F_EXT 0x881B
-#define GL_ALPHA16F_EXT 0x881C
-#define GL_LUMINANCE16F_EXT 0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
-#define GL_RGB10_A2_EXT 0x8059
-#define GL_RGB10_EXT 0x8052
-#define GL_BGRA8_EXT 0x93A1
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_BGRA_IMG 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
-#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
-#endif
-
-/* GL_IMG_texture_env_enhanced_fixed_function */
-#ifndef GL_IMG_texture_env_enhanced_fixed_function
-#define GL_MODULATE_COLOR_IMG 0x8C04
-#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05
-#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06
-#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07
-#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08
-#define GL_ADD_BLEND_IMG 0x8C09
-#define GL_DOT3_RGBA_IMG 0x86AF
-#endif
-
-/* GL_IMG_user_clip_plane */
-#ifndef GL_IMG_user_clip_plane
-#define GL_CLIP_PLANE0_IMG 0x3000
-#define GL_CLIP_PLANE1_IMG 0x3001
-#define GL_CLIP_PLANE2_IMG 0x3002
-#define GL_CLIP_PLANE3_IMG 0x3003
-#define GL_CLIP_PLANE4_IMG 0x3004
-#define GL_CLIP_PLANE5_IMG 0x3005
-#define GL_MAX_CLIP_PLANES_IMG 0x0D32
-#endif
-
-/* GL_IMG_multisampled_render_to_texture */
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
-#define GL_MAX_SAMPLES_IMG 0x9135
-#define GL_TEXTURE_SAMPLES_IMG 0x9136
-#endif
-
-/*------------------------------------------------------------------------*
- * NV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_NV_fence */
-#ifndef GL_NV_fence
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-#endif
-
-/*------------------------------------------------------------------------*
- * QCOM extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_driver_control */
-/* No new tokens introduced by this extension. */
-
-/* GL_QCOM_extended_get */
-#ifndef GL_QCOM_extended_get
-#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
-#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
-#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
-#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
-#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
-#define GL_TEXTURE_TYPE_QCOM 0x8BD7
-#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
-#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
-#define GL_TEXTURE_TARGET_QCOM 0x8BDA
-#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
-#define GL_STATE_RESTORE 0x8BDC
-#endif
-
-/* GL_QCOM_extended_get2 */
-/* No new tokens introduced by this extension. */
-
-/* GL_QCOM_perfmon_global_mode */
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
-#endif
-
-/* GL_QCOM_writeonly_rendering */
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
-#endif
-
-/* GL_QCOM_tiled_rendering */
-#ifndef GL_QCOM_tiled_rendering
-#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
-#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
-#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
-#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
-#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
-#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
-#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
-#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
-#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
-#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
-#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
-#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
-#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
-#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
-#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
-#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
-#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
-#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
-#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
-#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
-#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
-#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
-#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
-#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
-#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
-#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
-#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
-#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
-#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
-#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
-#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
-#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
-#endif
-
-/*------------------------------------------------------------------------*
- * End of extension tokens, start of corresponding extension functions
- *------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------*
- * OES extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_OES_blend_equation_separate */
-#ifndef GL_OES_blend_equation_separate
-#define GL_OES_blend_equation_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
-#endif
-
-/* GL_OES_blend_func_separate */
-#ifndef GL_OES_blend_func_separate
-#define GL_OES_blend_func_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-
-/* GL_OES_blend_subtract */
-#ifndef GL_OES_blend_subtract
-#define GL_OES_blend_subtract 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
-#endif
-
-/* GL_OES_byte_coordinates */
-#ifndef GL_OES_byte_coordinates
-#define GL_OES_byte_coordinates 1
-#endif
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_texture 1
-#endif
-
-/* GL_OES_depth24 */
-#ifndef GL_OES_depth24
-#define GL_OES_depth24 1
-#endif
-
-/* GL_OES_depth32 */
-#ifndef GL_OES_depth32
-#define GL_OES_depth32 1
-#endif
-
-/* GL_OES_draw_texture */
-#ifndef GL_OES_draw_texture
-#define GL_OES_draw_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
-GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
-GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
-GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
-GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
-#endif
-typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
-#endif
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#endif
-
-/* GL_OES_EGL_image_external */
-#ifndef GL_OES_EGL_image_external
-#define GL_OES_EGL_image_external 1
-/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
-#endif
-
-/* GL_OES_element_index_uint */
-#ifndef GL_OES_element_index_uint
-#define GL_OES_element_index_uint 1
-#endif
-
-/* GL_OES_extended_matrix_palette */
-#ifndef GL_OES_extended_matrix_palette
-#define GL_OES_extended_matrix_palette 1
-#endif
-
-/* GL_OES_fbo_render_mipmap */
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif
-
-/* GL_OES_fixed_point */
-#ifndef GL_OES_fixed_point
-#define GL_OES_fixed_point 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref);
-GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth);
-GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
-GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar);
-GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]);
-GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
-GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
-GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
-GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
-GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
-GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
-GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
-GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
-#endif
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref);
-typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
-typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar);
-typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]);
-typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
-typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
-typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
-typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
-typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
-typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
-typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
-typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-#endif
-
-/* GL_OES_framebuffer_object */
-#ifndef GL_OES_framebuffer_object
-#define GL_OES_framebuffer_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
-GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
-GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers);
-GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers);
-GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params);
-GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
-GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
-GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers);
-GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers);
-GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
-GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
-#endif
-typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
-typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
-typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
-typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
-GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
-GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid ** params);
-#endif
-typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid ** params);
-#endif
-
-/* GL_OES_matrix_get */
-#ifndef GL_OES_matrix_get
-#define GL_OES_matrix_get 1
-#endif
-
-/* GL_OES_matrix_palette */
-#ifndef GL_OES_matrix_palette
-#define GL_OES_matrix_palette 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
-GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
-GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
-typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
-typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#endif
-
-/* GL_OES_query_matrix */
-#ifndef GL_OES_query_matrix
-#define GL_OES_query_matrix 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]);
-#endif
-typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]);
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif
-
-/* GL_OES_single_precision */
-#ifndef GL_OES_single_precision
-#define GL_OES_single_precision 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar);
-GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
-GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]);
-GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
-#endif
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar);
-typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
-typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
-#endif
-
-/* GL_OES_stencil1 */
-#ifndef GL_OES_stencil1
-#define GL_OES_stencil1 1
-#endif
-
-/* GL_OES_stencil4 */
-#ifndef GL_OES_stencil4
-#define GL_OES_stencil4 1
-#endif
-
-/* GL_OES_stencil8 */
-#ifndef GL_OES_stencil8
-#define GL_OES_stencil8 1
-#endif
-
-/* GL_OES_stencil_wrap */
-#ifndef GL_OES_stencil_wrap
-#define GL_OES_stencil_wrap 1
-#endif
-
-/* GL_OES_texture_cube_map */
-#ifndef GL_OES_texture_cube_map
-#define GL_OES_texture_cube_map 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
-typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
-#endif
-
-/* GL_OES_texture_env_crossbar */
-#ifndef GL_OES_texture_env_crossbar
-#define GL_OES_texture_env_crossbar 1
-#endif
-
-/* GL_OES_texture_mirrored_repeat */
-#ifndef GL_OES_texture_mirrored_repeat
-#define GL_OES_texture_mirrored_repeat 1
-#endif
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_OES_vertex_array_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBindVertexArrayOES (GLuint array);
-GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
-GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
-GL_API GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
-#endif
-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
-#endif
-
-/*------------------------------------------------------------------------*
- * AMD extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_AMD_compressed_3DC_texture */
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_AMD_compressed_3DC_texture 1
-#endif
-
-/* GL_AMD_compressed_ATC_texture */
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_AMD_compressed_ATC_texture 1
-#endif
-
-/*------------------------------------------------------------------------*
- * APPLE extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_texture_2D_limited_npot */
-#ifndef GL_APPLE_texture_2D_limited_npot
-#define GL_APPLE_texture_2D_limited_npot 1
-#endif
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
-#endif
-
-/* GL_APPLE_texture_format_BGRA8888 */
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_APPLE_texture_format_BGRA8888 1
-#endif
-
-/* GL_APPLE_texture_max_level */
-#ifndef GL_APPLE_texture_max_level
-#define GL_APPLE_texture_max_level 1
-#endif
-
-/*------------------------------------------------------------------------*
- * ARM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_ARM_rgba8 */
-#ifndef GL_ARM_rgba8
-#define GL_ARM_rgba8 1
-#endif
-
-/*------------------------------------------------------------------------*
- * EXT extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_EXT_blend_minmax */
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#endif
-
-/* GL_EXT_discard_framebuffer */
-#ifndef GL_EXT_discard_framebuffer
-#define GL_EXT_discard_framebuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-
-/* GL_EXT_multisampled_render_to_texture */
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_EXT_multisampled_render_to_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-
-/* GL_EXT_multi_draw_arrays */
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-#endif
-
-/* GL_EXT_read_format_bgra */
-#ifndef GL_EXT_read_format_bgra
-#define GL_EXT_read_format_bgra 1
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_API void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_API void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
-GL_API void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-
-/* GL_EXT_sRGB */
-#ifndef GL_EXT_sRGB
-#define GL_EXT_sRGB 1
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#endif
-
-/* GL_EXT_texture_filter_anisotropic */
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#endif
-
-/* GL_EXT_texture_format_BGRA8888 */
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_EXT_texture_format_BGRA8888 1
-#endif
-
-/* GL_EXT_texture_lod_bias */
-#ifndef GL_EXT_texture_lod_bias
-#define GL_EXT_texture_lod_bias 1
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_EXT_texture_storage 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_API void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_API void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_API void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#endif
-
-/* GL_IMG_texture_env_enhanced_fixed_function */
-#ifndef GL_IMG_texture_env_enhanced_fixed_function
-#define GL_IMG_texture_env_enhanced_fixed_function 1
-#endif
-
-/* GL_IMG_user_clip_plane */
-#ifndef GL_IMG_user_clip_plane
-#define GL_IMG_user_clip_plane 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glClipPlanefIMG (GLenum p, const GLfloat *eqn);
-GL_API void GL_APIENTRY glClipPlanexIMG (GLenum p, const GLfixed *eqn);
-#endif
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn);
-#endif
-
-/* GL_IMG_multisampled_render_to_texture */
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_IMG_multisampled_render_to_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-
-/*------------------------------------------------------------------------*
- * NV extension functions
- *------------------------------------------------------------------------*/
-
-/* NV_fence */
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
-GL_API void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
-GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
-GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
-GL_API void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glFinishFenceNV (GLuint fence);
-GL_API void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
-#endif
-typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#endif
-
-/*------------------------------------------------------------------------*
- * QCOM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_driver_control */
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
-GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
-GL_API void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-#endif
-
-/* GL_QCOM_extended_get */
-#ifndef GL_QCOM_extended_get
-#define GL_QCOM_extended_get 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
-GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-GL_API void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
-#endif
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
-#endif
-
-/* GL_QCOM_extended_get2 */
-#ifndef GL_QCOM_extended_get2
-#define GL_QCOM_extended_get2 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
-GL_API void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-
-/* GL_QCOM_perfmon_global_mode */
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_QCOM_perfmon_global_mode 1
-#endif
-
-/* GL_QCOM_writeonly_rendering */
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_QCOM_writeonly_rendering 1
-#endif
-
-/* GL_QCOM_tiled_rendering */
-#ifndef GL_QCOM_tiled_rendering
-#define GL_QCOM_tiled_rendering 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-GL_API void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
-#endif
-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __glext_h_ */
-
diff --git a/opengl/include/GLES/glplatform.h b/opengl/include/GLES/glplatform.h
deleted file mode 100644
index 2db6ee2..0000000
--- a/opengl/include/GLES/glplatform.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __glplatform_h_
-#define __glplatform_h_
-
-/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * You are encouraged to submit all modifications to the Khronos group so that
- * they can be included in future versions of this file. Please submit changes
- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
- * by filing a bug against product "OpenGL-ES" component "Registry".
- */
-
-#include <KHR/khrplatform.h>
-
-#ifndef GL_API
-#define GL_API KHRONOS_APICALL
-#endif
-
-#ifndef GL_APIENTRY
-#define GL_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#endif /* __glplatform_h_ */
diff --git a/opengl/include/GLES2/gl2.h b/opengl/include/GLES2/gl2.h
deleted file mode 100644
index e1d3b87..0000000
--- a/opengl/include/GLES2/gl2.h
+++ /dev/null
@@ -1,621 +0,0 @@
-#ifndef __gl2_h_
-#define __gl2_h_
-
-/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
-
-#include <GLES2/gl2platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/*-------------------------------------------------------------------------
- * Data type definitions
- *-----------------------------------------------------------------------*/
-
-typedef void GLvoid;
-typedef char GLchar;
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef khronos_int8_t GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef khronos_float_t GLfloat;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-
-/* GL types for handling large vertex buffer objects */
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t GLsizeiptr;
-
-/* OpenGL ES core versions */
-#define GL_ES_VERSION_2_0 1
-
-/* ClearBufferMask */
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-
-/* Boolean */
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/* BeginMode */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-
-/* AlphaFunction (not supported in ES20) */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* BlendingFactorDest */
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-
-/* BlendingFactorSrc */
-/* GL_ZERO */
-/* GL_ONE */
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-/* GL_SRC_ALPHA */
-/* GL_ONE_MINUS_SRC_ALPHA */
-/* GL_DST_ALPHA */
-/* GL_ONE_MINUS_DST_ALPHA */
-
-/* BlendEquationSeparate */
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-
-/* BlendSubtract */
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-
-/* Separate Blend Functions */
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-
-/* Buffer Objects */
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-
-/* CullFaceMode */
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-
-/* DepthFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* EnableCap */
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_BLEND 0x0BE2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_COVERAGE 0x80A0
-
-/* ErrorCode */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* FrontFaceDirection */
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-
-/* GetPName */
-#define GL_LINE_WIDTH 0x0B21
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-/* GL_SCISSOR_TEST */
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-/* GL_POLYGON_OFFSET_FILL */
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-
-/* GetTextureParameter */
-/* GL_TEXTURE_MAG_FILTER */
-/* GL_TEXTURE_MIN_FILTER */
-/* GL_TEXTURE_WRAP_S */
-/* GL_TEXTURE_WRAP_T */
-
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-
-/* HintMode */
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* HintTarget */
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-
-/* DataType */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-
-/* PixelFormat */
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-
-/* PixelType */
-/* GL_UNSIGNED_BYTE */
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-
-/* Shaders */
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_DELETE_STATUS 0x8B80
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-
-/* StencilFunction */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-
-/* StencilOp */
-/* GL_ZERO */
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_INVERT 0x150A
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-
-/* StringName */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* TextureMagFilter */
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-
-/* TextureMinFilter */
-/* GL_NEAREST */
-/* GL_LINEAR */
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-
-/* TextureParameterName */
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-
-/* TextureTarget */
-/* GL_TEXTURE_2D */
-#define GL_TEXTURE 0x1702
-
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-
-/* TextureUnit */
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-
-/* TextureWrapMode */
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-
-/* Uniform Types */
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_CUBE 0x8B60
-
-/* Vertex Arrays */
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-
-/* Read Format */
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-
-/* Shader Source */
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-
-/* Shader Binary */
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-
-/* Shader Precision-Specified Types */
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-
-/* Framebuffer Object. */
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGB565 0x8D62
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_STENCIL_INDEX 0x1901
-#define GL_STENCIL_INDEX8 0x8D48
-
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-
-#define GL_NONE 0
-
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-
-/*-------------------------------------------------------------------------
- * GL core functions.
- *-----------------------------------------------------------------------*/
-
-GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
-GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
-GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
-GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
-GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
-GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
-GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
-GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
-GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
-GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
-GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
-GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
-GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
-GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glFinish (void);
-GL_APICALL void GL_APIENTRY glFlush (void);
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
-GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
-GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
-GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
-GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
-GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL GLenum GL_APIENTRY glGetError (void);
-GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
-GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
-GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
-GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
-GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
-GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
-GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
-GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
-GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
-GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl2_h_ */
diff --git a/opengl/include/GLES2/gl2ext.h b/opengl/include/GLES2/gl2ext.h
deleted file mode 100644
index 8f8d80a1..0000000
--- a/opengl/include/GLES2/gl2ext.h
+++ /dev/null
@@ -1,1422 +0,0 @@
-#ifndef __gl2ext_h_
-#define __gl2ext_h_
-
-/* $Revision: 16619 $ on $Date:: 2012-01-18 10:00:14 -0800 #$ */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-#ifndef GL_APIENTRYP
-# define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/*------------------------------------------------------------------------*
- * OES extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_ETC1_RGB8_OES 0x8D64
-#endif
-
-/* GL_OES_compressed_paletted_texture */
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-#endif
-
-/* GL_OES_depth24 */
-#ifndef GL_OES_depth24
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif
-
-/* GL_OES_depth32 */
-#ifndef GL_OES_depth32
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#endif
-
-/* GL_OES_depth_texture */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-typedef void* GLeglImageOES;
-#endif
-
-/* GL_OES_EGL_image_external */
-#ifndef GL_OES_EGL_image_external
-/* GLeglImageOES defined in GL_OES_EGL_image already. */
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define GL_SAMPLER_EXTERNAL_OES 0x8D66
-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
-#endif
-
-/* GL_OES_element_index_uint */
-#ifndef GL_OES_element_index_uint
-#define GL_UNSIGNED_INT 0x1405
-#endif
-
-/* GL_OES_get_program_binary */
-#ifndef GL_OES_get_program_binary
-#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_WRITE_ONLY_OES 0x88B9
-#define GL_BUFFER_ACCESS_OES 0x88BB
-#define GL_BUFFER_MAPPED_OES 0x88BC
-#define GL_BUFFER_MAP_POINTER_OES 0x88BD
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_RGB8_OES 0x8051
-#define GL_RGBA8_OES 0x8058
-#endif
-
-/* GL_OES_standard_derivatives */
-#ifndef GL_OES_standard_derivatives
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
-#endif
-
-/* GL_OES_stencil1 */
-#ifndef GL_OES_stencil1
-#define GL_STENCIL_INDEX1_OES 0x8D46
-#endif
-
-/* GL_OES_stencil4 */
-#ifndef GL_OES_stencil4
-#define GL_STENCIL_INDEX4_OES 0x8D47
-#endif
-
-/* GL_OES_texture_3D */
-#ifndef GL_OES_texture_3D
-#define GL_TEXTURE_WRAP_R_OES 0x8072
-#define GL_TEXTURE_3D_OES 0x806F
-#define GL_TEXTURE_BINDING_3D_OES 0x806A
-#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
-#define GL_SAMPLER_3D_OES 0x8B5F
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
-#endif
-
-/* GL_OES_texture_float */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_texture_float_linear */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_texture_half_float */
-#ifndef GL_OES_texture_half_float
-#define GL_HALF_FLOAT_OES 0x8D61
-#endif
-
-/* GL_OES_texture_half_float_linear */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_texture_npot */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-#endif
-
-/* GL_OES_vertex_half_float */
-/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
-
-/* GL_OES_vertex_type_10_10_10_2 */
-#ifndef GL_OES_vertex_type_10_10_10_2
-#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
-#define GL_INT_10_10_10_2_OES 0x8DF7
-#endif
-
-/*------------------------------------------------------------------------*
- * AMD extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_AMD_compressed_3DC_texture */
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_3DC_X_AMD 0x87F9
-#define GL_3DC_XY_AMD 0x87FA
-#endif
-
-/* GL_AMD_compressed_ATC_texture */
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_ATC_RGB_AMD 0x8C92
-#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
-#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
-#endif
-
-/* GL_AMD_performance_monitor */
-#ifndef GL_AMD_performance_monitor
-#define GL_COUNTER_TYPE_AMD 0x8BC0
-#define GL_COUNTER_RANGE_AMD 0x8BC1
-#define GL_UNSIGNED_INT64_AMD 0x8BC2
-#define GL_PERCENTAGE_AMD 0x8BC3
-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
-#define GL_PERFMON_RESULT_AMD 0x8BC6
-#endif
-
-/* GL_AMD_program_binary_Z400 */
-#ifndef GL_AMD_program_binary_Z400
-#define GL_Z400_BINARY_AMD 0x8740
-#endif
-
-/*------------------------------------------------------------------------*
- * ANGLE extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_ANGLE_framebuffer_blit */
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
-#endif
-
-/* GL_ANGLE_framebuffer_multisample */
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
-#define GL_MAX_SAMPLES_ANGLE 0x8D57
-#endif
-
-/*------------------------------------------------------------------------*
- * APPLE extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#endif
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
-#define GL_MAX_SAMPLES_APPLE 0x8D57
-#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
-#endif
-
-/* GL_APPLE_texture_format_BGRA8888 */
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-/* GL_APPLE_texture_max_level */
-#ifndef GL_APPLE_texture_max_level
-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
-#endif
-
-/*------------------------------------------------------------------------*
- * ARM extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_ARM_mali_shader_binary */
-#ifndef GL_ARM_mali_shader_binary
-#define GL_MALI_SHADER_BINARY_ARM 0x8F60
-#endif
-
-/* GL_ARM_rgba8 */
-/* No new tokens introduced by this extension. */
-
-/*------------------------------------------------------------------------*
- * EXT extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_EXT_blend_minmax */
-#ifndef GL_EXT_blend_minmax
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#endif
-
-/* GL_EXT_color_buffer_half_float */
-#ifndef GL_EXT_color_buffer_half_float
-#define GL_RGBA16F_EXT 0x881A
-#define GL_RGB16F_EXT 0x881B
-#define GL_RG16F_EXT 0x822F
-#define GL_R16F_EXT 0x822D
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
-#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
-#endif
-
-/* GL_EXT_debug_label */
-#ifndef GL_EXT_debug_label
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-#endif
-
-/* GL_EXT_debug_marker */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_discard_framebuffer */
-#ifndef GL_EXT_discard_framebuffer
-#define GL_COLOR_EXT 0x1800
-#define GL_DEPTH_EXT 0x1801
-#define GL_STENCIL_EXT 0x1802
-#endif
-
-/* GL_EXT_multisampled_render_to_texture */
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134
-#define GL_MAX_SAMPLES_EXT 0x9135
-#endif
-
-/* GL_EXT_multi_draw_arrays */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_occlusion_query_boolean */
-#ifndef GL_EXT_occlusion_query_boolean
-#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
-#define GL_CURRENT_QUERY_EXT 0x8865
-#define GL_QUERY_RESULT_EXT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
-#endif
-
-/* GL_EXT_read_format_bgra */
-#ifndef GL_EXT_read_format_bgra
-#define GL_BGRA_EXT 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-/* reuse GL_NO_ERROR */
-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
-#endif
-
-/* GL_EXT_separate_shader_objects */
-#ifndef GL_EXT_separate_shader_objects
-#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
-#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE_EXT 0x8258
-#define GL_ACTIVE_PROGRAM_EXT 0x8259
-#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
-#endif
-
-/* GL_EXT_shader_texture_lod */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_shadow_samplers */
-#ifndef GL_EXT_shadow_samplers
-#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
-#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
-#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
-#endif
-
-/* GL_EXT_sRGB */
-#ifndef GL_EXT_sRGB
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#endif
-
-/* GL_EXT_texture_filter_anisotropic */
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif
-
-/* GL_EXT_texture_format_BGRA8888 */
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-/* GL_EXT_texture_rg */
-#ifndef GL_EXT_texture_rg
-#define GL_RED_EXT 0x1903
-#define GL_RG_EXT 0x8227
-#define GL_R8_EXT 0x8229
-#define GL_RG8_EXT 0x822B
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
-#define GL_ALPHA8_EXT 0x803C
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_RGBA32F_EXT 0x8814
-#define GL_RGB32F_EXT 0x8815
-#define GL_ALPHA32F_EXT 0x8816
-#define GL_LUMINANCE32F_EXT 0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
-/* reuse GL_RGBA16F_EXT */
-#define GL_RGB16F_EXT 0x881B
-#define GL_ALPHA16F_EXT 0x881C
-#define GL_LUMINANCE16F_EXT 0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
-#define GL_RGB10_A2_EXT 0x8059
-#define GL_RGB10_EXT 0x8052
-#define GL_BGRA8_EXT 0x93A1
-#endif
-
-/* GL_EXT_texture_type_2_10_10_10_REV */
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
-#endif
-
-/* GL_EXT_unpack_subimage */
-#ifndef GL_EXT_unpack_subimage
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#endif
-
-/*------------------------------------------------------------------------*
- * DMP extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_DMP_shader_binary */
-#ifndef GL_DMP_shader_binary
-#define GL_SHADER_BINARY_DMP 0x9250
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_program_binary */
-#ifndef GL_IMG_program_binary
-#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
-#endif
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_BGRA_IMG 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
-#endif
-
-/* GL_IMG_shader_binary */
-#ifndef GL_IMG_shader_binary
-#define GL_SGX_BINARY_IMG 0x8C0A
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
-#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
-#endif
-
-/* GL_IMG_multisampled_render_to_texture */
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
-#define GL_MAX_SAMPLES_IMG 0x9135
-#define GL_TEXTURE_SAMPLES_IMG 0x9136
-#endif
-
-/*------------------------------------------------------------------------*
- * NV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_NV_coverage_sample */
-#ifndef GL_NV_coverage_sample
-#define GL_COVERAGE_COMPONENT_NV 0x8ED0
-#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
-#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
-#define GL_COVERAGE_BUFFERS_NV 0x8ED3
-#define GL_COVERAGE_SAMPLES_NV 0x8ED4
-#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
-#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
-#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
-#define GL_COVERAGE_BUFFER_BIT_NV 0x8000
-#endif
-
-/* GL_NV_depth_nonlinear */
-#ifndef GL_NV_depth_nonlinear
-#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
-#endif
-
-/* GL_NV_draw_buffers */
-#ifndef GL_NV_draw_buffers
-#define GL_MAX_DRAW_BUFFERS_NV 0x8824
-#define GL_DRAW_BUFFER0_NV 0x8825
-#define GL_DRAW_BUFFER1_NV 0x8826
-#define GL_DRAW_BUFFER2_NV 0x8827
-#define GL_DRAW_BUFFER3_NV 0x8828
-#define GL_DRAW_BUFFER4_NV 0x8829
-#define GL_DRAW_BUFFER5_NV 0x882A
-#define GL_DRAW_BUFFER6_NV 0x882B
-#define GL_DRAW_BUFFER7_NV 0x882C
-#define GL_DRAW_BUFFER8_NV 0x882D
-#define GL_DRAW_BUFFER9_NV 0x882E
-#define GL_DRAW_BUFFER10_NV 0x882F
-#define GL_DRAW_BUFFER11_NV 0x8830
-#define GL_DRAW_BUFFER12_NV 0x8831
-#define GL_DRAW_BUFFER13_NV 0x8832
-#define GL_DRAW_BUFFER14_NV 0x8833
-#define GL_DRAW_BUFFER15_NV 0x8834
-#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
-#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
-#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
-#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
-#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
-#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
-#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
-#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
-#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
-#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
-#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
-#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
-#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
-#define GL_COLOR_ATTACHMENT13_NV 0x8CED
-#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
-#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
-#endif
-
-/* GL_NV_fbo_color_attachments */
-#ifndef GL_NV_fbo_color_attachments
-#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
-/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */
-#endif
-
-/* GL_NV_fence */
-#ifndef GL_NV_fence
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-#endif
-
-/* GL_NV_read_buffer */
-#ifndef GL_NV_read_buffer
-#define GL_READ_BUFFER_NV 0x0C02
-#endif
-
-/* GL_NV_read_buffer_front */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_read_depth */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_read_depth_stencil */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_read_stencil */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_texture_compression_s3tc_update */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_texture_npot_2D_mipmap */
-/* No new tokens introduced by this extension. */
-
-/*------------------------------------------------------------------------*
- * QCOM extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_alpha_test */
-#ifndef GL_QCOM_alpha_test
-#define GL_ALPHA_TEST_QCOM 0x0BC0
-#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
-#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
-#endif
-
-/* GL_QCOM_driver_control */
-/* No new tokens introduced by this extension. */
-
-/* GL_QCOM_extended_get */
-#ifndef GL_QCOM_extended_get
-#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
-#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
-#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
-#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
-#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
-#define GL_TEXTURE_TYPE_QCOM 0x8BD7
-#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
-#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
-#define GL_TEXTURE_TARGET_QCOM 0x8BDA
-#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
-#define GL_STATE_RESTORE 0x8BDC
-#endif
-
-/* GL_QCOM_extended_get2 */
-/* No new tokens introduced by this extension. */
-
-/* GL_QCOM_perfmon_global_mode */
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
-#endif
-
-/* GL_QCOM_writeonly_rendering */
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
-#endif
-
-/* GL_QCOM_tiled_rendering */
-#ifndef GL_QCOM_tiled_rendering
-#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
-#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
-#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
-#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
-#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
-#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
-#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
-#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
-#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
-#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
-#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
-#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
-#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
-#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
-#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
-#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
-#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
-#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
-#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
-#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
-#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
-#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
-#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
-#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
-#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
-#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
-#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
-#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
-#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
-#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
-#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
-#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
-#endif
-
-/*------------------------------------------------------------------------*
- * VIV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_VIV_shader_binary */
-#ifndef GL_VIV_shader_binary
-#define GL_SHADER_BINARY_VIV 0x8FC4
-#endif
-
-/*------------------------------------------------------------------------*
- * End of extension tokens, start of corresponding extension functions
- *------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------*
- * OES extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_texture 1
-#endif
-
-/* GL_OES_compressed_paletted_texture */
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#endif
-
-/* GL_OES_depth24 */
-#ifndef GL_OES_depth24
-#define GL_OES_depth24 1
-#endif
-
-/* GL_OES_depth32 */
-#ifndef GL_OES_depth32
-#define GL_OES_depth32 1
-#endif
-
-/* GL_OES_depth_texture */
-#ifndef GL_OES_depth_texture
-#define GL_OES_depth_texture 1
-#endif
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#endif
-
-/* GL_OES_EGL_image_external */
-#ifndef GL_OES_EGL_image_external
-#define GL_OES_EGL_image_external 1
-/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
-#endif
-
-/* GL_OES_element_index_uint */
-#ifndef GL_OES_element_index_uint
-#define GL_OES_element_index_uint 1
-#endif
-
-/* GL_OES_fbo_render_mipmap */
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif
-
-/* GL_OES_fragment_precision_high */
-#ifndef GL_OES_fragment_precision_high
-#define GL_OES_fragment_precision_high 1
-#endif
-
-/* GL_OES_get_program_binary */
-#ifndef GL_OES_get_program_binary
-#define GL_OES_get_program_binary 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
-GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
-typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
-GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
-GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
-#endif
-typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif
-
-/* GL_OES_standard_derivatives */
-#ifndef GL_OES_standard_derivatives
-#define GL_OES_standard_derivatives 1
-#endif
-
-/* GL_OES_stencil1 */
-#ifndef GL_OES_stencil1
-#define GL_OES_stencil1 1
-#endif
-
-/* GL_OES_stencil4 */
-#ifndef GL_OES_stencil4
-#define GL_OES_stencil4 1
-#endif
-
-/* GL_OES_texture_3D */
-#ifndef GL_OES_texture_3D
-#define GL_OES_texture_3D 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#endif
-
-/* GL_OES_texture_float */
-#ifndef GL_OES_texture_float
-#define GL_OES_texture_float 1
-#endif
-
-/* GL_OES_texture_float_linear */
-#ifndef GL_OES_texture_float_linear
-#define GL_OES_texture_float_linear 1
-#endif
-
-/* GL_OES_texture_half_float */
-#ifndef GL_OES_texture_half_float
-#define GL_OES_texture_half_float 1
-#endif
-
-/* GL_OES_texture_half_float_linear */
-#ifndef GL_OES_texture_half_float_linear
-#define GL_OES_texture_half_float_linear 1
-#endif
-
-/* GL_OES_texture_npot */
-#ifndef GL_OES_texture_npot
-#define GL_OES_texture_npot 1
-#endif
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_OES_vertex_array_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
-GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
-GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
-#endif
-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
-#endif
-
-/* GL_OES_vertex_half_float */
-#ifndef GL_OES_vertex_half_float
-#define GL_OES_vertex_half_float 1
-#endif
-
-/* GL_OES_vertex_type_10_10_10_2 */
-#ifndef GL_OES_vertex_type_10_10_10_2
-#define GL_OES_vertex_type_10_10_10_2 1
-#endif
-
-/*------------------------------------------------------------------------*
- * AMD extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_AMD_compressed_3DC_texture */
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_AMD_compressed_3DC_texture 1
-#endif
-
-/* GL_AMD_compressed_ATC_texture */
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_AMD_compressed_ATC_texture 1
-#endif
-
-/* AMD_performance_monitor */
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
-GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
-GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
-GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
-typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
-typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-
-/* GL_AMD_program_binary_Z400 */
-#ifndef GL_AMD_program_binary_Z400
-#define GL_AMD_program_binary_Z400 1
-#endif
-
-/*------------------------------------------------------------------------*
- * ANGLE extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_ANGLE_framebuffer_blit */
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_ANGLE_framebuffer_blit 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-
-/* GL_ANGLE_framebuffer_multisample */
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_ANGLE_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-
-/*------------------------------------------------------------------------*
- * APPLE extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-#endif
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
-#endif
-
-/* GL_APPLE_texture_format_BGRA8888 */
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_APPLE_texture_format_BGRA8888 1
-#endif
-
-/* GL_APPLE_texture_max_level */
-#ifndef GL_APPLE_texture_max_level
-#define GL_APPLE_texture_max_level 1
-#endif
-
-/*------------------------------------------------------------------------*
- * ARM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_ARM_mali_shader_binary */
-#ifndef GL_ARM_mali_shader_binary
-#define GL_ARM_mali_shader_binary 1
-#endif
-
-/* GL_ARM_rgba8 */
-#ifndef GL_ARM_rgba8
-#define GL_ARM_rgba8 1
-#endif
-
-/*------------------------------------------------------------------------*
- * EXT extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_EXT_blend_minmax */
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#endif
-
-/* GL_EXT_color_buffer_half_float */
-#ifndef GL_EXT_color_buffer_half_float
-#define GL_EXT_color_buffer_half_float 1
-#endif
-
-/* GL_EXT_debug_label */
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-
-/* GL_EXT_debug_marker */
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
-#endif
-typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#endif
-
-/* GL_EXT_discard_framebuffer */
-#ifndef GL_EXT_discard_framebuffer
-#define GL_EXT_discard_framebuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-
-/* GL_EXT_multisampled_render_to_texture */
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_EXT_multisampled_render_to_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-#endif
-
-/* GL_EXT_occlusion_query_boolean */
-#ifndef GL_EXT_occlusion_query_boolean
-#define GL_EXT_occlusion_query_boolean 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
-#endif
-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
-#endif
-
-/* GL_EXT_read_format_bgra */
-#ifndef GL_EXT_read_format_bgra
-#define GL_EXT_read_format_bgra 1
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
-GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-
-/* GL_EXT_separate_shader_objects */
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
-GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
-GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
-GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
-GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x);
-GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y);
-GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z);
-GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x);
-GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-#endif
-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
-typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
-typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-#endif
-
-/* GL_EXT_shader_texture_lod */
-#ifndef GL_EXT_shader_texture_lod
-#define GL_EXT_shader_texture_lod 1
-#endif
-
-/* GL_EXT_shadow_samplers */
-#ifndef GL_EXT_shadow_samplers
-#define GL_EXT_shadow_samplers 1
-#endif
-
-/* GL_EXT_sRGB */
-#ifndef GL_EXT_sRGB
-#define GL_EXT_sRGB 1
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#endif
-
-/* GL_EXT_texture_filter_anisotropic */
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#endif
-
-/* GL_EXT_texture_format_BGRA8888 */
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_EXT_texture_format_BGRA8888 1
-#endif
-
-/* GL_EXT_texture_rg */
-#ifndef GL_EXT_texture_rg
-#define GL_EXT_texture_rg 1
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_EXT_texture_storage 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-
-/* GL_EXT_texture_type_2_10_10_10_REV */
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_EXT_texture_type_2_10_10_10_REV 1
-#endif
-
-/* GL_EXT_unpack_subimage */
-#ifndef GL_EXT_unpack_subimage
-#define GL_EXT_unpack_subimage 1
-#endif
-
-/*------------------------------------------------------------------------*
- * DMP extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_DMP_shader_binary */
-#ifndef GL_DMP_shader_binary
-#define GL_DMP_shader_binary 1
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_program_binary */
-#ifndef GL_IMG_program_binary
-#define GL_IMG_program_binary 1
-#endif
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#endif
-
-/* GL_IMG_shader_binary */
-#ifndef GL_IMG_shader_binary
-#define GL_IMG_shader_binary 1
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#endif
-
-/* GL_IMG_multisampled_render_to_texture */
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_IMG_multisampled_render_to_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-
-/*------------------------------------------------------------------------*
- * NV extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_NV_coverage_sample */
-#ifndef GL_NV_coverage_sample
-#define GL_NV_coverage_sample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
-GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
-#endif
-typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
-typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
-#endif
-
-/* GL_NV_depth_nonlinear */
-#ifndef GL_NV_depth_nonlinear
-#define GL_NV_depth_nonlinear 1
-#endif
-
-/* GL_NV_draw_buffers */
-#ifndef GL_NV_draw_buffers
-#define GL_NV_draw_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
-#endif
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
-#endif
-
-/* GL_NV_fbo_color_attachments */
-#ifndef GL_NV_fbo_color_attachments
-#define GL_NV_fbo_color_attachments 1
-#endif
-
-/* GL_NV_fence */
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
-GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
-GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
-GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
-GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
-GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
-#endif
-typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#endif
-
-/* GL_NV_read_buffer */
-#ifndef GL_NV_read_buffer
-#define GL_NV_read_buffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
-#endif
-typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
-#endif
-
-/* GL_NV_read_buffer_front */
-#ifndef GL_NV_read_buffer_front
-#define GL_NV_read_buffer_front 1
-#endif
-
-/* GL_NV_read_depth */
-#ifndef GL_NV_read_depth
-#define GL_NV_read_depth 1
-#endif
-
-/* GL_NV_read_depth_stencil */
-#ifndef GL_NV_read_depth_stencil
-#define GL_NV_read_depth_stencil 1
-#endif
-
-/* GL_NV_read_stencil */
-#ifndef GL_NV_read_stencil
-#define GL_NV_read_stencil 1
-#endif
-
-/* GL_NV_texture_compression_s3tc_update */
-#ifndef GL_NV_texture_compression_s3tc_update
-#define GL_NV_texture_compression_s3tc_update 1
-#endif
-
-/* GL_NV_texture_npot_2D_mipmap */
-#ifndef GL_NV_texture_npot_2D_mipmap
-#define GL_NV_texture_npot_2D_mipmap 1
-#endif
-
-/*------------------------------------------------------------------------*
- * QCOM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_alpha_test */
-#ifndef GL_QCOM_alpha_test
-#define GL_QCOM_alpha_test 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
-#endif
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
-#endif
-
-/* GL_QCOM_driver_control */
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
-GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
-GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-#endif
-
-/* GL_QCOM_extended_get */
-#ifndef GL_QCOM_extended_get
-#define GL_QCOM_extended_get 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
-GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
-#endif
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
-#endif
-
-/* GL_QCOM_extended_get2 */
-#ifndef GL_QCOM_extended_get2
-#define GL_QCOM_extended_get2 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
-GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-
-/* GL_QCOM_perfmon_global_mode */
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_QCOM_perfmon_global_mode 1
-#endif
-
-/* GL_QCOM_writeonly_rendering */
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_QCOM_writeonly_rendering 1
-#endif
-
-/* GL_QCOM_tiled_rendering */
-#ifndef GL_QCOM_tiled_rendering
-#define GL_QCOM_tiled_rendering 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
-#endif
-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
-#endif
-
-/*------------------------------------------------------------------------*
- * VIV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_VIV_shader_binary */
-#ifndef GL_VIV_shader_binary
-#define GL_VIV_shader_binary 1
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl2ext_h_ */
diff --git a/opengl/include/GLES2/gl2platform.h b/opengl/include/GLES2/gl2platform.h
deleted file mode 100644
index c9fa3c4..0000000
--- a/opengl/include/GLES2/gl2platform.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __gl2platform_h_
-#define __gl2platform_h_
-
-/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * You are encouraged to submit all modifications to the Khronos group so that
- * they can be included in future versions of this file. Please submit changes
- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
- * by filing a bug against product "OpenGL-ES" component "Registry".
- */
-
-#include <KHR/khrplatform.h>
-
-#ifndef GL_APICALL
-#define GL_APICALL KHRONOS_APICALL
-#endif
-
-#ifndef GL_APIENTRY
-#define GL_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#endif /* __gl2platform_h_ */
diff --git a/opengl/include/KHR/khrplatform.h b/opengl/include/KHR/khrplatform.h
deleted file mode 100644
index 1660bd7..0000000
--- a/opengl/include/KHR/khrplatform.h
+++ /dev/null
@@ -1,243 +0,0 @@
-#ifndef __khrplatform_h_
-#define __khrplatform_h_
-
-/*
-** Copyright (c) 2008-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Platform-specific types and definitions.
- * $Revision: 7244 $ on $Date: 2009-01-20 17:06:59 -0800 (Tue, 20 Jan 2009) $
- *
- * Adopters may modify this file to suit their platform. Adopters are
- * encouraged to submit platform specific modifications to the Khronos
- * group so that they can be included in future versions of this file.
- * Please submit changes by sending them to the public Khronos Bugzilla
- * (http://khronos.org/bugzilla) by filing a bug against product
- * "Khronos (general)" component "Registry".
- *
- * A predefined template which fills in some of the bug fields can be
- * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
- * must create a Bugzilla login first.
- *
- *
- * See the Implementer's Guidelines for information about where this file
- * should be located on your system.
- * http://www.khronos.org/registry/implementers_guide.pdf
- *
- *
- * This file should be included as
- * #include <KHR/khrplatform.h>
- * by the Khronos API header file that uses its types and defines.
- *
- * The types in this file should only be used to define API-specific types.
- * Types defined in this file:
- * khronos_int8_t signed 8 bit
- * khronos_uint8_t unsigned 8 bit
- * khronos_int16_t signed 16 bit
- * khronos_uint16_t unsigned 16 bit
- * khronos_int32_t signed 32 bit
- * khronos_uint32_t unsigned 32 bit
- * khronos_int64_t signed 64 bit
- * khronos_uint64_t unsigned 64 bit
- * khronos_intptr_t signed same number of bits as a pointer
- * khronos_uintptr_t unsigned same number of bits as a pointer
- * khronos_ssize_t signed size
- * khronos_usize_t unsigned size
- * khronos_float_t signed 32 bit floating point
- * khronos_time_ns_t unsigned 64 bit time in nanoseconds
- * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
- * nanoseconds
- * khronos_stime_nanoseconds_t signed time interval in nanoseconds
- *
- * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
- * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
- *
- *
- * Macros defined in this file:
- * KHRONOS_APICALL
- * KHRONOS_APIENTRY
- * KHRONOS_APIATTRIBUTES
- * These may be used in function prototypes as:
- * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
- * int arg1,
- * int arg2) KHRONOS_APIATTRIBUTES;
- */
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APICALL
- *-------------------------------------------------------------------------
- * This precedes the return type of the function in the function prototype.
- */
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
-# define KHRONOS_APICALL __declspec(dllimport)
-#elif defined (__SYMBIAN32__)
-# define KHRONOS_APICALL IMPORT_C
-#elif defined(ANDROID)
-# define KHRONOS_APICALL __attribute__((visibility("default")))
-#else
-# define KHRONOS_APICALL
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIENTRY
- *-------------------------------------------------------------------------
- * This follows the return type of the function and precedes the function
- * name in the function prototype.
- */
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
- /* Win32 but not WinCE */
-# define KHRONOS_APIENTRY __stdcall
-#else
-# define KHRONOS_APIENTRY
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIATTRIBUTES
- *-------------------------------------------------------------------------
- * This follows the closing parenthesis of the function prototype arguments.
- */
-#if defined (__ARMCC_2__)
-#define KHRONOS_APIATTRIBUTES __softfp
-#else
-#define KHRONOS_APIATTRIBUTES
-#endif
-
-/*-------------------------------------------------------------------------
- * basic type definitions
- *-----------------------------------------------------------------------*/
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
-
-
-/*
- * Using <stdint.h>
- */
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__VMS ) || defined(__sgi)
-
-/*
- * Using <inttypes.h>
- */
-#include <inttypes.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
-
-/*
- * Win32
- */
-typedef __int32 khronos_int32_t;
-typedef unsigned __int32 khronos_uint32_t;
-typedef __int64 khronos_int64_t;
-typedef unsigned __int64 khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__sun__) || defined(__digital__)
-
-/*
- * Sun or Digital
- */
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#if defined(__arch64__) || defined(_LP64)
-typedef long int khronos_int64_t;
-typedef unsigned long int khronos_uint64_t;
-#else
-typedef long long int khronos_int64_t;
-typedef unsigned long long int khronos_uint64_t;
-#endif /* __arch64__ */
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif 0
-
-/*
- * Hypothetical platform with no float or int64 support
- */
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#define KHRONOS_SUPPORT_INT64 0
-#define KHRONOS_SUPPORT_FLOAT 0
-
-#else
-
-/*
- * Generic fallback
- */
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#endif
-
-
-/*
- * Types that are (so far) the same on all platforms
- */
-typedef signed char khronos_int8_t;
-typedef unsigned char khronos_uint8_t;
-typedef signed short int khronos_int16_t;
-typedef unsigned short int khronos_uint16_t;
-typedef signed long int khronos_intptr_t;
-typedef unsigned long int khronos_uintptr_t;
-typedef signed long int khronos_ssize_t;
-typedef unsigned long int khronos_usize_t;
-
-#if KHRONOS_SUPPORT_FLOAT
-/*
- * Float type
- */
-typedef float khronos_float_t;
-#endif
-
-#if KHRONOS_SUPPORT_INT64
-/* Time types
- *
- * These types can be used to represent a time interval in nanoseconds or
- * an absolute Unadjusted System Time. Unadjusted System Time is the number
- * of nanoseconds since some arbitrary system event (e.g. since the last
- * time the system booted). The Unadjusted System Time is an unsigned
- * 64 bit value that wraps back to 0 every 584 years. Time intervals
- * may be either signed or unsigned.
- */
-typedef khronos_uint64_t khronos_utime_nanoseconds_t;
-typedef khronos_int64_t khronos_stime_nanoseconds_t;
-#endif
-
-
-#endif /* __khrplatform_h_ */
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
deleted file mode 100644
index 15e58f2..0000000
--- a/opengl/libagl/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-#
-# Build the software OpenGL ES library
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- egl.cpp \
- state.cpp \
- texture.cpp \
- Tokenizer.cpp \
- TokenManager.cpp \
- TextureObjectManager.cpp \
- BufferObjectManager.cpp \
- array.cpp.arm \
- fp.cpp.arm \
- light.cpp.arm \
- matrix.cpp.arm \
- mipmap.cpp.arm \
- primitives.cpp.arm \
- vertex.cpp.arm
-
-LOCAL_CFLAGS += -DLOG_TAG=\"libagl\"
-LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-LOCAL_CFLAGS += -fvisibility=hidden
-
-LOCAL_SHARED_LIBRARIES := libcutils libhardware libutils libpixelflinger libETC1
-LOCAL_LDLIBS := -lpthread -ldl
-
-ifeq ($(TARGET_ARCH),arm)
- LOCAL_SRC_FILES += fixed_asm.S iterators.S
- LOCAL_CFLAGS += -fstrict-aliasing
-endif
-
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
-# we need to access the private Bionic header <bionic_tls.h>
-# on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER
-# behavior from the bionic Android.mk file
-ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-LOCAL_C_INCLUDES += bionic/libc/private
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
-LOCAL_MODULE:= libGLES_android
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/libagl/BufferObjectManager.cpp b/opengl/libagl/BufferObjectManager.cpp
deleted file mode 100644
index 6bf28ee..0000000
--- a/opengl/libagl/BufferObjectManager.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- ** Copyright 2008, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-#include <utils/Atomic.h>
-#include <utils/RefBase.h>
-#include <utils/KeyedVector.h>
-#include <utils/Errors.h>
-
-#include <GLES/gl.h>
-
-#include "BufferObjectManager.h"
-
-
-namespace android {
-
-using namespace gl;
-
-// ----------------------------------------------------------------------------
-
-EGLBufferObjectManager::EGLBufferObjectManager()
-: TokenManager(), mCount(0)
-{
-}
-
-EGLBufferObjectManager::~EGLBufferObjectManager()
-{
- // destroy all the buffer objects and their storage
- GLsizei n = mBuffers.size();
- for (GLsizei i=0 ; i<n ; i++) {
- buffer_t* bo = mBuffers.valueAt(i);
- free(bo->data);
- delete bo;
- }
-}
-
-buffer_t const* EGLBufferObjectManager::bind(GLuint buffer)
-{
- Mutex::Autolock _l(mLock);
- int32_t i = mBuffers.indexOfKey(buffer);
- if (i >= 0) {
- return mBuffers.valueAt(i);
- }
- buffer_t* bo = new buffer_t;
- bo->data = 0;
- bo->usage = GL_STATIC_DRAW;
- bo->size = 0;
- bo->name = buffer;
- mBuffers.add(buffer, bo);
- return bo;
-}
-
-int EGLBufferObjectManager::allocateStore(buffer_t* bo,
- GLsizeiptr size, GLenum usage)
-{
- Mutex::Autolock _l(mLock);
- if (size != bo->size) {
- uint8_t* data = (uint8_t*)malloc(size);
- if (data == 0)
- return -1;
- free(bo->data);
- bo->data = data;
- bo->size = size;
- }
- bo->usage = usage;
- return 0;
-}
-
-void EGLBufferObjectManager::deleteBuffers(GLsizei n, const GLuint* buffers)
-{
- Mutex::Autolock _l(mLock);
- while (n--) {
- const GLuint t = *buffers++;
- if (t) {
- int32_t index = mBuffers.indexOfKey(t);
- if (index >= 0) {
- buffer_t* bo = mBuffers.valueAt(index);
- free(bo->data);
- mBuffers.removeItemsAt(index);
- delete bo;
- }
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/opengl/libagl/BufferObjectManager.h b/opengl/libagl/BufferObjectManager.h
deleted file mode 100644
index 9e9340a..0000000
--- a/opengl/libagl/BufferObjectManager.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- **
- ** Copyright 2006, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_OPENGLES_BUFFER_OBJECT_MANAGER_H
-#define ANDROID_OPENGLES_BUFFER_OBJECT_MANAGER_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-#include <utils/Atomic.h>
-#include <utils/RefBase.h>
-#include <utils/KeyedVector.h>
-#include <utils/Errors.h>
-
-#include <GLES/gl.h>
-
-#include "Tokenizer.h"
-#include "TokenManager.h"
-
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-namespace gl {
-
-struct buffer_t {
- GLsizeiptr size;
- GLenum usage;
- uint8_t* data;
- uint32_t name;
-};
-
-};
-
-class EGLBufferObjectManager : public TokenManager
-{
-public:
- EGLBufferObjectManager();
- ~EGLBufferObjectManager();
-
- // protocol for sp<>
- inline void incStrong(const void* id) const;
- inline void decStrong(const void* id) const;
- typedef void weakref_type;
-
- gl::buffer_t const* bind(GLuint buffer);
- int allocateStore(gl::buffer_t* bo, GLsizeiptr size, GLenum usage);
- void deleteBuffers(GLsizei n, const GLuint* buffers);
-
-private:
- mutable volatile int32_t mCount;
- mutable Mutex mLock;
- KeyedVector<GLuint, gl::buffer_t*> mBuffers;
-};
-
-void EGLBufferObjectManager::incStrong(const void* id) const {
- android_atomic_inc(&mCount);
-}
-void EGLBufferObjectManager::decStrong(const void* id) const {
- if (android_atomic_dec(&mCount) == 1) {
- delete this;
- }
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_BUFFER_OBJECT_MANAGER_H
-
diff --git a/opengl/libagl/TextureObjectManager.cpp b/opengl/libagl/TextureObjectManager.cpp
deleted file mode 100644
index 06d45cc..0000000
--- a/opengl/libagl/TextureObjectManager.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- ** Copyright 2006, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "context.h"
-#include "TextureObjectManager.h"
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-EGLTextureObject::EGLTextureObject()
- : mSize(0)
-{
- init();
-}
-
-EGLTextureObject::~EGLTextureObject()
-{
- if (!direct) {
- if (mSize && surface.data)
- free(surface.data);
- if (mMipmaps)
- freeMipmaps();
- }
-}
-
-void EGLTextureObject::init()
-{
- memset(&surface, 0, sizeof(surface));
- surface.version = sizeof(surface);
- mMipmaps = 0;
- mNumExtraLod = 0;
- mIsComplete = false;
- wraps = GL_REPEAT;
- wrapt = GL_REPEAT;
- min_filter = GL_LINEAR;
- mag_filter = GL_LINEAR;
- internalformat = 0;
- memset(crop_rect, 0, sizeof(crop_rect));
- generate_mipmap = GL_FALSE;
- direct = GL_FALSE;
- buffer = 0;
-}
-
-void EGLTextureObject::copyParameters(const sp<EGLTextureObject>& old)
-{
- wraps = old->wraps;
- wrapt = old->wrapt;
- min_filter = old->min_filter;
- mag_filter = old->mag_filter;
- memcpy(crop_rect, old->crop_rect, sizeof(crop_rect));
- generate_mipmap = old->generate_mipmap;
- direct = old->direct;
-}
-
-status_t EGLTextureObject::allocateMipmaps()
-{
- // here, by construction, mMipmaps=0 && mNumExtraLod=0
-
- if (!surface.data)
- return NO_INIT;
-
- int w = surface.width;
- int h = surface.height;
- const int numLods = 31 - gglClz(max(w,h));
- if (numLods <= 0)
- return NO_ERROR;
-
- mMipmaps = (GGLSurface*)malloc(numLods * sizeof(GGLSurface));
- if (!mMipmaps)
- return NO_MEMORY;
-
- memset(mMipmaps, 0, numLods * sizeof(GGLSurface));
- mNumExtraLod = numLods;
- return NO_ERROR;
-}
-
-void EGLTextureObject::freeMipmaps()
-{
- if (mMipmaps) {
- for (int i=0 ; i<mNumExtraLod ; i++) {
- if (mMipmaps[i].data) {
- free(mMipmaps[i].data);
- }
- }
- free(mMipmaps);
- mMipmaps = 0;
- mNumExtraLod = 0;
- }
-}
-
-const GGLSurface& EGLTextureObject::mip(int lod) const
-{
- if (lod<=0 || !mMipmaps)
- return surface;
- lod = min(lod-1, mNumExtraLod-1);
- return mMipmaps[lod];
-}
-
-GGLSurface& EGLTextureObject::editMip(int lod)
-{
- return const_cast<GGLSurface&>(mip(lod));
-}
-
-status_t EGLTextureObject::setSurface(GGLSurface const* s)
-{
- // XXX: glFlush() on 's'
- if (mSize && surface.data) {
- free(surface.data);
- }
- surface = *s;
- internalformat = 0;
- buffer = 0;
-
- // we should keep the crop_rect, but it's delicate because
- // the new size of the surface could make it invalid.
- // so for now, we just loose it.
- memset(crop_rect, 0, sizeof(crop_rect));
-
- // it would be nice if we could keep the generate_mipmap flag,
- // we would have to generate them right now though.
- generate_mipmap = GL_FALSE;
-
- direct = GL_TRUE;
- mSize = 0; // we don't own this surface
- if (mMipmaps)
- freeMipmaps();
- mIsComplete = true;
- return NO_ERROR;
-}
-
-status_t EGLTextureObject::setImage(ANativeWindowBuffer* native_buffer)
-{
- GGLSurface sur;
- sur.version = sizeof(GGLSurface);
- sur.width = native_buffer->width;
- sur.height= native_buffer->height;
- sur.stride= native_buffer->stride;
- sur.format= native_buffer->format;
- sur.data = 0;
- setSurface(&sur);
- buffer = native_buffer;
- return NO_ERROR;
-}
-
-status_t EGLTextureObject::reallocate(
- GLint level, int w, int h, int s,
- int format, int compressedFormat, int bpr)
-{
- const size_t size = h * bpr;
- if (level == 0)
- {
- if (size!=mSize || !surface.data) {
- if (mSize && surface.data) {
- free(surface.data);
- }
- surface.data = (GGLubyte*)malloc(size);
- if (!surface.data) {
- mSize = 0;
- mIsComplete = false;
- return NO_MEMORY;
- }
- mSize = size;
- }
- surface.version = sizeof(GGLSurface);
- surface.width = w;
- surface.height = h;
- surface.stride = s;
- surface.format = format;
- surface.compressedFormat = compressedFormat;
- if (mMipmaps)
- freeMipmaps();
- mIsComplete = true;
- }
- else
- {
- if (!mMipmaps) {
- if (allocateMipmaps() != NO_ERROR)
- return NO_MEMORY;
- }
-
- ALOGW_IF(level-1 >= mNumExtraLod,
- "specifying mipmap level %d, but # of level is %d",
- level, mNumExtraLod+1);
-
- GGLSurface& mipmap = editMip(level);
- if (mipmap.data)
- free(mipmap.data);
-
- mipmap.data = (GGLubyte*)malloc(size);
- if (!mipmap.data) {
- memset(&mipmap, 0, sizeof(GGLSurface));
- mIsComplete = false;
- return NO_MEMORY;
- }
-
- mipmap.version = sizeof(GGLSurface);
- mipmap.width = w;
- mipmap.height = h;
- mipmap.stride = s;
- mipmap.format = format;
- mipmap.compressedFormat = compressedFormat;
-
- // check if the texture is complete
- mIsComplete = true;
- const GGLSurface* prev = &surface;
- for (int i=0 ; i<mNumExtraLod ; i++) {
- const GGLSurface* curr = mMipmaps + i;
- if (curr->format != surface.format) {
- mIsComplete = false;
- break;
- }
-
- uint32_t w = (prev->width >> 1) ? : 1;
- uint32_t h = (prev->height >> 1) ? : 1;
- if (w != curr->width || h != curr->height) {
- mIsComplete = false;
- break;
- }
- prev = curr;
- }
- }
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-EGLSurfaceManager::EGLSurfaceManager()
- : TokenManager()
-{
-}
-
-EGLSurfaceManager::~EGLSurfaceManager()
-{
- // everything gets freed automatically here...
-}
-
-sp<EGLTextureObject> EGLSurfaceManager::createTexture(GLuint name)
-{
- sp<EGLTextureObject> result;
-
- Mutex::Autolock _l(mLock);
- if (mTextures.indexOfKey(name) >= 0)
- return result; // already exists!
-
- result = new EGLTextureObject();
-
- status_t err = mTextures.add(name, result);
- if (err < 0)
- result.clear();
-
- return result;
-}
-
-sp<EGLTextureObject> EGLSurfaceManager::removeTexture(GLuint name)
-{
- Mutex::Autolock _l(mLock);
- const ssize_t index = mTextures.indexOfKey(name);
- if (index >= 0) {
- sp<EGLTextureObject> result(mTextures.valueAt(index));
- mTextures.removeItemsAt(index);
- return result;
- }
- return 0;
-}
-
-sp<EGLTextureObject> EGLSurfaceManager::replaceTexture(GLuint name)
-{
- sp<EGLTextureObject> tex;
- Mutex::Autolock _l(mLock);
- const ssize_t index = mTextures.indexOfKey(name);
- if (index >= 0) {
- const sp<EGLTextureObject>& old = mTextures.valueAt(index);
- const uint32_t refs = old->getStrongCount();
- if (ggl_likely(refs == 1)) {
- // we're the only owner
- tex = old;
- } else {
- // keep the texture's parameters
- tex = new EGLTextureObject();
- tex->copyParameters(old);
- mTextures.removeItemsAt(index);
- mTextures.add(name, tex);
- }
- }
- return tex;
-}
-
-void EGLSurfaceManager::deleteTextures(GLsizei n, const GLuint *tokens)
-{
- // free all textures
- Mutex::Autolock _l(mLock);
- for (GLsizei i=0 ; i<n ; i++) {
- const GLuint t(*tokens++);
- if (t) {
- mTextures.removeItem(t);
- }
- }
-}
-
-sp<EGLTextureObject> EGLSurfaceManager::texture(GLuint name)
-{
- Mutex::Autolock _l(mLock);
- const ssize_t index = mTextures.indexOfKey(name);
- if (index >= 0)
- return mTextures.valueAt(index);
- return 0;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/opengl/libagl/TextureObjectManager.h b/opengl/libagl/TextureObjectManager.h
deleted file mode 100644
index de9e03e..0000000
--- a/opengl/libagl/TextureObjectManager.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_SURFACE_H
-#define ANDROID_OPENGLES_SURFACE_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-#include <utils/Atomic.h>
-#include <utils/threads.h>
-#include <utils/RefBase.h>
-#include <utils/KeyedVector.h>
-#include <utils/Errors.h>
-
-#include <private/pixelflinger/ggl_context.h>
-
-#include <GLES/gl.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "Tokenizer.h"
-#include "TokenManager.h"
-
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-class EGLTextureObject : public LightRefBase<EGLTextureObject>
-{
-public:
- EGLTextureObject();
- ~EGLTextureObject();
-
- status_t setSurface(GGLSurface const* s);
- status_t setImage(ANativeWindowBuffer* buffer);
- void setImageBits(void* vaddr) { surface.data = (GGLubyte*)vaddr; }
-
- status_t reallocate(GLint level,
- int w, int h, int s,
- int format, int compressedFormat, int bpr);
- inline size_t size() const { return mSize; }
- const GGLSurface& mip(int lod) const;
- GGLSurface& editMip(int lod);
- bool hasMipmaps() const { return mMipmaps!=0; }
- bool isComplete() const { return mIsComplete; }
- void copyParameters(const sp<EGLTextureObject>& old);
-
-private:
- status_t allocateMipmaps();
- void freeMipmaps();
- void init();
- size_t mSize;
- GGLSurface *mMipmaps;
- int mNumExtraLod;
- bool mIsComplete;
-
-public:
- GGLSurface surface;
- GLenum wraps;
- GLenum wrapt;
- GLenum min_filter;
- GLenum mag_filter;
- GLenum internalformat;
- GLint crop_rect[4];
- GLint generate_mipmap;
- GLint direct;
- ANativeWindowBuffer* buffer;
-};
-
-// ----------------------------------------------------------------------------
-
-class EGLSurfaceManager :
- public LightRefBase<EGLSurfaceManager>,
- public TokenManager
-{
-public:
- EGLSurfaceManager();
- ~EGLSurfaceManager();
-
- sp<EGLTextureObject> createTexture(GLuint name);
- sp<EGLTextureObject> removeTexture(GLuint name);
- sp<EGLTextureObject> replaceTexture(GLuint name);
- void deleteTextures(GLsizei n, const GLuint *tokens);
- sp<EGLTextureObject> texture(GLuint name);
-
-private:
- mutable Mutex mLock;
- KeyedVector< GLuint, sp<EGLTextureObject> > mTextures;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_SURFACE_H
-
diff --git a/opengl/libagl/TokenManager.cpp b/opengl/libagl/TokenManager.cpp
deleted file mode 100644
index eea6025..0000000
--- a/opengl/libagl/TokenManager.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/* libs/opengles/surface.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "TokenManager.h"
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-TokenManager::TokenManager()
-{
- // token 0 is always reserved
- mTokenizer.reserve(0);
-}
-
-TokenManager::~TokenManager()
-{
-}
-
-status_t TokenManager::getToken(GLsizei n, GLuint *tokens)
-{
- Mutex::Autolock _l(mLock);
- for (GLsizei i=0 ; i<n ; i++)
- *tokens++ = mTokenizer.acquire();
- return NO_ERROR;
-}
-
-void TokenManager::recycleTokens(GLsizei n, const GLuint *tokens)
-{
- Mutex::Autolock _l(mLock);
- for (int i=0 ; i<n ; i++) {
- const GLuint token = *tokens++;
- if (token) {
- mTokenizer.release(token);
- }
- }
-}
-
-bool TokenManager::isTokenValid(GLuint token) const
-{
- Mutex::Autolock _l(mLock);
- return mTokenizer.isAcquired(token);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
diff --git a/opengl/libagl/TokenManager.h b/opengl/libagl/TokenManager.h
deleted file mode 100644
index 49c1469..0000000
--- a/opengl/libagl/TokenManager.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_TOKEN_MANAGER_H
-#define ANDROID_OPENGLES_TOKEN_MANAGER_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-#include <utils/threads.h>
-
-#include <GLES/gl.h>
-
-#include "Tokenizer.h"
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-class TokenManager
-{
-public:
- TokenManager();
- ~TokenManager();
-
- status_t getToken(GLsizei n, GLuint *tokens);
- void recycleTokens(GLsizei n, const GLuint *tokens);
- bool isTokenValid(GLuint token) const;
-
-private:
- mutable Mutex mLock;
- Tokenizer mTokenizer;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_TOKEN_MANAGER_H
-
diff --git a/opengl/libagl/Tokenizer.cpp b/opengl/libagl/Tokenizer.cpp
deleted file mode 100644
index eac8d6d..0000000
--- a/opengl/libagl/Tokenizer.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/* libs/opengles/Tokenizer.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-
-#include "Tokenizer.h"
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-ANDROID_BASIC_TYPES_TRAITS(Tokenizer::run_t)
-
-Tokenizer::Tokenizer()
-{
-}
-
-Tokenizer::Tokenizer(const Tokenizer& other)
- : mRanges(other.mRanges)
-{
-}
-
-Tokenizer::~Tokenizer()
-{
-}
-
-uint32_t Tokenizer::acquire()
-{
- if (!mRanges.size() || mRanges[0].first) {
- _insertTokenAt(0,0);
- return 0;
- }
-
- // just extend the first run
- const run_t& run = mRanges[0];
- uint32_t token = run.first + run.length;
- _insertTokenAt(token, 1);
- return token;
-}
-
-bool Tokenizer::isAcquired(uint32_t token) const
-{
- return (_indexOrderOf(token) >= 0);
-}
-
-status_t Tokenizer::reserve(uint32_t token)
-{
- size_t o;
- const ssize_t i = _indexOrderOf(token, &o);
- if (i >= 0) {
- return BAD_VALUE; // this token is already taken
- }
- ssize_t err = _insertTokenAt(token, o);
- return (err<0) ? err : status_t(NO_ERROR);
-}
-
-status_t Tokenizer::release(uint32_t token)
-{
- const ssize_t i = _indexOrderOf(token);
- if (i >= 0) {
- const run_t& run = mRanges[i];
- if ((token >= run.first) && (token < run.first+run.length)) {
- // token in this range, we need to split
- run_t& run = mRanges.editItemAt(i);
- if ((token == run.first) || (token == run.first+run.length-1)) {
- if (token == run.first) {
- run.first += 1;
- }
- run.length -= 1;
- if (run.length == 0) {
- // XXX: should we systematically remove a run that's empty?
- mRanges.removeItemsAt(i);
- }
- } else {
- // split the run
- run_t new_run;
- new_run.first = token+1;
- new_run.length = run.first+run.length - new_run.first;
- run.length = token - run.first;
- mRanges.insertAt(new_run, i+1);
- }
- return NO_ERROR;
- }
- }
- return NAME_NOT_FOUND;
-}
-
-ssize_t Tokenizer::_indexOrderOf(uint32_t token, size_t* order) const
-{
- // binary search
- ssize_t err = NAME_NOT_FOUND;
- ssize_t l = 0;
- ssize_t h = mRanges.size()-1;
- ssize_t mid;
- const run_t* a = mRanges.array();
- while (l <= h) {
- mid = l + (h - l)/2;
- const run_t* const curr = a + mid;
- int c = 0;
- if (token < curr->first) c = 1;
- else if (token >= curr->first+curr->length) c = -1;
- if (c == 0) {
- err = l = mid;
- break;
- } else if (c < 0) {
- l = mid + 1;
- } else {
- h = mid - 1;
- }
- }
- if (order) *order = l;
- return err;
-}
-
-ssize_t Tokenizer::_insertTokenAt(uint32_t token, size_t index)
-{
- const size_t c = mRanges.size();
-
- if (index >= 1) {
- // do we need to merge with the previous run?
- run_t& p = mRanges.editItemAt(index-1);
- if (p.first+p.length == token) {
- p.length += 1;
- if (index < c) {
- const run_t& n = mRanges[index];
- if (token+1 == n.first) {
- p.length += n.length;
- mRanges.removeItemsAt(index);
- }
- }
- return index;
- }
- }
-
- if (index < c) {
- // do we need to merge with the next run?
- run_t& n = mRanges.editItemAt(index);
- if (token+1 == n.first) {
- n.first -= 1;
- n.length += 1;
- return index;
- }
- }
-
- return mRanges.insertAt(run_t(token,1), index);
-}
-
-void Tokenizer::dump() const
-{
- const run_t* ranges = mRanges.array();
- const size_t c = mRanges.size();
- ALOGD("Tokenizer (%p, size = %u)\n", this, c);
- for (size_t i=0 ; i<c ; i++) {
- ALOGD("%u: (%u, %u)\n", i, ranges[i].first, ranges[i].length);
- }
-}
-
-}; // namespace android
-
diff --git a/opengl/libagl/Tokenizer.h b/opengl/libagl/Tokenizer.h
deleted file mode 100644
index ac555cb..0000000
--- a/opengl/libagl/Tokenizer.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* libs/opengles/Tokenizer.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-
-#ifndef ANDROID_OPENGLES_TOKENIZER_H
-#define ANDROID_OPENGLES_TOKENIZER_H
-
-#include <utils/Vector.h>
-#include <utils/Errors.h>
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-class Tokenizer
-{
-public:
- Tokenizer();
- Tokenizer(const Tokenizer& other);
- ~Tokenizer();
-
- uint32_t acquire();
- status_t reserve(uint32_t token);
- status_t release(uint32_t token);
- bool isAcquired(uint32_t token) const;
-
- void dump() const;
-
- struct run_t {
- run_t() {};
- run_t(uint32_t f, uint32_t l) : first(f), length(l) {}
- uint32_t first;
- uint32_t length;
- };
-private:
- ssize_t _indexOrderOf(uint32_t token, size_t* order=0) const;
- ssize_t _insertTokenAt(uint32_t token, size_t index);
- Vector<run_t> mRanges;
-};
-
-}; // namespace android
-
-// ----------------------------------------------------------------------------
-
-#endif // ANDROID_OPENGLES_TOKENIZER_H
diff --git a/opengl/libagl/array.cpp b/opengl/libagl/array.cpp
deleted file mode 100644
index 7fbe9b5..0000000
--- a/opengl/libagl/array.cpp
+++ /dev/null
@@ -1,1588 +0,0 @@
-/*
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "context.h"
-#include "fp.h"
-#include "state.h"
-#include "matrix.h"
-#include "vertex.h"
-#include "light.h"
-#include "primitives.h"
-#include "texture.h"
-#include "BufferObjectManager.h"
-
-// ----------------------------------------------------------------------------
-
-#define VC_CACHE_STATISTICS 0
-#define VC_CACHE_TYPE_NONE 0
-#define VC_CACHE_TYPE_INDEXED 1
-#define VC_CACHE_TYPE_LRU 2
-#define VC_CACHE_TYPE VC_CACHE_TYPE_INDEXED
-
-#if VC_CACHE_STATISTICS
-#include <utils/Timers.h>
-#endif
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-static void validate_arrays(ogles_context_t* c, GLenum mode);
-
-static void compileElements__generic(ogles_context_t*,
- vertex_t*, GLint, GLsizei);
-static void compileElement__generic(ogles_context_t*,
- vertex_t*, GLint);
-
-static void drawPrimitivesPoints(ogles_context_t*, GLint, GLsizei);
-static void drawPrimitivesLineStrip(ogles_context_t*, GLint, GLsizei);
-static void drawPrimitivesLineLoop(ogles_context_t*, GLint, GLsizei);
-static void drawPrimitivesLines(ogles_context_t*, GLint, GLsizei);
-static void drawPrimitivesTriangleStrip(ogles_context_t*, GLint, GLsizei);
-static void drawPrimitivesTriangleFan(ogles_context_t*, GLint, GLsizei);
-static void drawPrimitivesTriangles(ogles_context_t*, GLint, GLsizei);
-
-static void drawIndexedPrimitivesPoints(ogles_context_t*,
- GLsizei, const GLvoid*);
-static void drawIndexedPrimitivesLineStrip(ogles_context_t*,
- GLsizei, const GLvoid*);
-static void drawIndexedPrimitivesLineLoop(ogles_context_t*,
- GLsizei, const GLvoid*);
-static void drawIndexedPrimitivesLines(ogles_context_t*,
- GLsizei, const GLvoid*);
-static void drawIndexedPrimitivesTriangleStrip(ogles_context_t*,
- GLsizei, const GLvoid*);
-static void drawIndexedPrimitivesTriangleFan(ogles_context_t*,
- GLsizei, const GLvoid*);
-static void drawIndexedPrimitivesTriangles(ogles_context_t*,
- GLsizei, const GLvoid*);
-
-// ----------------------------------------------------------------------------
-
-typedef void (*arrays_prims_fct_t)(ogles_context_t*, GLint, GLsizei);
-static const arrays_prims_fct_t drawArraysPrims[] = {
- drawPrimitivesPoints,
- drawPrimitivesLines,
- drawPrimitivesLineLoop,
- drawPrimitivesLineStrip,
- drawPrimitivesTriangles,
- drawPrimitivesTriangleStrip,
- drawPrimitivesTriangleFan
-};
-
-typedef void (*elements_prims_fct_t)(ogles_context_t*, GLsizei, const GLvoid*);
-static const elements_prims_fct_t drawElementsPrims[] = {
- drawIndexedPrimitivesPoints,
- drawIndexedPrimitivesLines,
- drawIndexedPrimitivesLineLoop,
- drawIndexedPrimitivesLineStrip,
- drawIndexedPrimitivesTriangles,
- drawIndexedPrimitivesTriangleStrip,
- drawIndexedPrimitivesTriangleFan
-};
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-void ogles_init_array(ogles_context_t* c)
-{
- c->arrays.vertex.size = 4;
- c->arrays.vertex.type = GL_FLOAT;
- c->arrays.color.size = 4;
- c->arrays.color.type = GL_FLOAT;
- c->arrays.normal.size = 4;
- c->arrays.normal.type = GL_FLOAT;
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- c->arrays.texture[i].size = 4;
- c->arrays.texture[i].type = GL_FLOAT;
- }
- c->vc.init();
-
- if (!c->vc.vBuffer) {
- // this could have failed
- ogles_error(c, GL_OUT_OF_MEMORY);
- }
-}
-
-void ogles_uninit_array(ogles_context_t* c)
-{
- c->vc.uninit();
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Array fetchers
-#endif
-
-static void currentColor(ogles_context_t* c, GLfixed* v, const GLvoid*) {
- memcpy(v, c->current.color.v, sizeof(vec4_t));
-}
-static void currentColor_clamp(ogles_context_t* c, GLfixed* v, const GLvoid*) {
- memcpy(v, c->currentColorClamped.v, sizeof(vec4_t));
-}
-static void currentNormal(ogles_context_t* c, GLfixed* v, const GLvoid*) {
- memcpy(v, c->currentNormal.v, sizeof(vec3_t));
-}
-static void currentTexCoord(ogles_context_t* c, GLfixed* v, const GLvoid*) {
- memcpy(v, c->current.texture[c->arrays.tmu].v, sizeof(vec4_t));
-}
-
-
-static void fetchNop(ogles_context_t*, GLfixed*, const GLvoid*) {
-}
-static void fetch2b(ogles_context_t*, GLfixed* v, const GLbyte* p) {
- v[0] = gglIntToFixed(p[0]);
- v[1] = gglIntToFixed(p[1]);
-}
-static void fetch2s(ogles_context_t*, GLfixed* v, const GLshort* p) {
- v[0] = gglIntToFixed(p[0]);
- v[1] = gglIntToFixed(p[1]);
-}
-static void fetch2x(ogles_context_t*, GLfixed* v, const GLfixed* p) {
- memcpy(v, p, 2*sizeof(GLfixed));
-}
-static void fetch2f(ogles_context_t*, GLfixed* v, const GLfloat* p) {
- v[0] = gglFloatToFixed(p[0]);
- v[1] = gglFloatToFixed(p[1]);
-}
-static void fetch3b(ogles_context_t*, GLfixed* v, const GLbyte* p) {
- v[0] = gglIntToFixed(p[0]);
- v[1] = gglIntToFixed(p[1]);
- v[2] = gglIntToFixed(p[2]);
-}
-static void fetch3s(ogles_context_t*, GLfixed* v, const GLshort* p) {
- v[0] = gglIntToFixed(p[0]);
- v[1] = gglIntToFixed(p[1]);
- v[2] = gglIntToFixed(p[2]);
-}
-static void fetch3x(ogles_context_t*, GLfixed* v, const GLfixed* p) {
- memcpy(v, p, 3*sizeof(GLfixed));
-}
-static void fetch3f(ogles_context_t*, GLfixed* v, const GLfloat* p) {
- v[0] = gglFloatToFixed(p[0]);
- v[1] = gglFloatToFixed(p[1]);
- v[2] = gglFloatToFixed(p[2]);
-}
-static void fetch4b(ogles_context_t*, GLfixed* v, const GLbyte* p) {
- v[0] = gglIntToFixed(p[0]);
- v[1] = gglIntToFixed(p[1]);
- v[2] = gglIntToFixed(p[2]);
- v[3] = gglIntToFixed(p[3]);
-}
-static void fetch4s(ogles_context_t*, GLfixed* v, const GLshort* p) {
- v[0] = gglIntToFixed(p[0]);
- v[1] = gglIntToFixed(p[1]);
- v[2] = gglIntToFixed(p[2]);
- v[3] = gglIntToFixed(p[3]);
-}
-static void fetch4x(ogles_context_t*, GLfixed* v, const GLfixed* p) {
- memcpy(v, p, 4*sizeof(GLfixed));
-}
-static void fetch4f(ogles_context_t*, GLfixed* v, const GLfloat* p) {
- v[0] = gglFloatToFixed(p[0]);
- v[1] = gglFloatToFixed(p[1]);
- v[2] = gglFloatToFixed(p[2]);
- v[3] = gglFloatToFixed(p[3]);
-}
-static void fetchExpand4ub(ogles_context_t*, GLfixed* v, const GLubyte* p) {
- v[0] = GGL_UB_TO_X(p[0]);
- v[1] = GGL_UB_TO_X(p[1]);
- v[2] = GGL_UB_TO_X(p[2]);
- v[3] = GGL_UB_TO_X(p[3]);
-}
-static void fetchClamp4x(ogles_context_t*, GLfixed* v, const GLfixed* p) {
- v[0] = gglClampx(p[0]);
- v[1] = gglClampx(p[1]);
- v[2] = gglClampx(p[2]);
- v[3] = gglClampx(p[3]);
-}
-static void fetchClamp4f(ogles_context_t*, GLfixed* v, const GLfloat* p) {
- v[0] = gglClampx(gglFloatToFixed(p[0]));
- v[1] = gglClampx(gglFloatToFixed(p[1]));
- v[2] = gglClampx(gglFloatToFixed(p[2]));
- v[3] = gglClampx(gglFloatToFixed(p[3]));
-}
-static void fetchExpand3ub(ogles_context_t*, GLfixed* v, const GLubyte* p) {
- v[0] = GGL_UB_TO_X(p[0]);
- v[1] = GGL_UB_TO_X(p[1]);
- v[2] = GGL_UB_TO_X(p[2]);
- v[3] = 0x10000;
-}
-static void fetchClamp3x(ogles_context_t*, GLfixed* v, const GLfixed* p) {
- v[0] = gglClampx(p[0]);
- v[1] = gglClampx(p[1]);
- v[2] = gglClampx(p[2]);
- v[3] = 0x10000;
-}
-static void fetchClamp3f(ogles_context_t*, GLfixed* v, const GLfloat* p) {
- v[0] = gglClampx(gglFloatToFixed(p[0]));
- v[1] = gglClampx(gglFloatToFixed(p[1]));
- v[2] = gglClampx(gglFloatToFixed(p[2]));
- v[3] = 0x10000;
-}
-static void fetchExpand3b(ogles_context_t*, GLfixed* v, const GLbyte* p) {
- v[0] = GGL_B_TO_X(p[0]);
- v[1] = GGL_B_TO_X(p[1]);
- v[2] = GGL_B_TO_X(p[2]);
-}
-static void fetchExpand3s(ogles_context_t*, GLfixed* v, const GLshort* p) {
- v[0] = GGL_S_TO_X(p[0]);
- v[1] = GGL_S_TO_X(p[1]);
- v[2] = GGL_S_TO_X(p[2]);
-}
-
-typedef array_t::fetcher_t fn_t;
-
-static const fn_t color_fct[2][16] = { // size={3,4}, type={ub,f,x}
- { 0, (fn_t)fetchExpand3ub, 0, 0, 0, 0,
- (fn_t)fetch3f, 0, 0, 0, 0, 0,
- (fn_t)fetch3x },
- { 0, (fn_t)fetchExpand4ub, 0, 0, 0, 0,
- (fn_t)fetch4f, 0, 0, 0, 0, 0,
- (fn_t)fetch4x },
-};
-static const fn_t color_clamp_fct[2][16] = { // size={3,4}, type={ub,f,x}
- { 0, (fn_t)fetchExpand3ub, 0, 0, 0, 0,
- (fn_t)fetchClamp3f, 0, 0, 0, 0, 0,
- (fn_t)fetchClamp3x },
- { 0, (fn_t)fetchExpand4ub, 0, 0, 0, 0,
- (fn_t)fetchClamp4f, 0, 0, 0, 0, 0,
- (fn_t)fetchClamp4x },
-};
-static const fn_t normal_fct[1][16] = { // size={3}, type={b,s,f,x}
- { (fn_t)fetchExpand3b, 0,
- (fn_t)fetchExpand3s, 0, 0, 0,
- (fn_t)fetch3f, 0, 0, 0, 0, 0,
- (fn_t)fetch3x },
-};
-static const fn_t vertex_fct[3][16] = { // size={2,3,4}, type={b,s,f,x}
- { (fn_t)fetch2b, 0,
- (fn_t)fetch2s, 0, 0, 0,
- (fn_t)fetch2f, 0, 0, 0, 0, 0,
- (fn_t)fetch3x },
- { (fn_t)fetch3b, 0,
- (fn_t)fetch3s, 0, 0, 0,
- (fn_t)fetch3f, 0, 0, 0, 0, 0,
- (fn_t)fetch3x },
- { (fn_t)fetch4b, 0,
- (fn_t)fetch4s, 0, 0, 0,
- (fn_t)fetch4f, 0, 0, 0, 0, 0,
- (fn_t)fetch4x }
-};
-static const fn_t texture_fct[3][16] = { // size={2,3,4}, type={b,s,f,x}
- { (fn_t)fetch2b, 0,
- (fn_t)fetch2s, 0, 0, 0,
- (fn_t)fetch2f, 0, 0, 0, 0, 0,
- (fn_t)fetch2x },
- { (fn_t)fetch3b, 0,
- (fn_t)fetch3s, 0, 0, 0,
- (fn_t)fetch3f, 0, 0, 0, 0, 0,
- (fn_t)fetch3x },
- { (fn_t)fetch4b, 0,
- (fn_t)fetch4s, 0, 0, 0,
- (fn_t)fetch4f, 0, 0, 0, 0, 0,
- (fn_t)fetch4x }
-};
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark array_t
-#endif
-
-void array_t::init(
- GLint size, GLenum type, GLsizei stride,
- const GLvoid *pointer, const buffer_t* bo, GLsizei count)
-{
- if (!stride) {
- stride = size;
- switch (type) {
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- stride *= 2;
- break;
- case GL_FLOAT:
- case GL_FIXED:
- stride *= 4;
- break;
- }
- }
- this->size = size;
- this->type = type;
- this->stride = stride;
- this->pointer = pointer;
- this->bo = bo;
- this->bounds = count;
-}
-
-inline void array_t::resolve()
-{
- physical_pointer = (bo) ? (bo->data + uintptr_t(pointer)) : pointer;
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark vertex_cache_t
-#endif
-
-void vertex_cache_t::init()
-{
- // make sure the size of vertex_t allows cache-line alignment
- CTA<(sizeof(vertex_t) & 0x1F) == 0> assertAlignedSize;
-
- const int align = 32;
- const size_t s = VERTEX_BUFFER_SIZE + VERTEX_CACHE_SIZE;
- const size_t size = s*sizeof(vertex_t) + align;
- base = malloc(size);
- if (base) {
- memset(base, 0, size);
- vBuffer = (vertex_t*)((size_t(base) + align - 1) & ~(align-1));
- vCache = vBuffer + VERTEX_BUFFER_SIZE;
- sequence = 0;
- }
-}
-
-void vertex_cache_t::uninit()
-{
- free(base);
- base = vBuffer = vCache = 0;
-}
-
-void vertex_cache_t::clear()
-{
-#if VC_CACHE_STATISTICS
- startTime = systemTime(SYSTEM_TIME_THREAD);
- total = 0;
- misses = 0;
-#endif
-
-#if VC_CACHE_TYPE == VC_CACHE_TYPE_LRU
- vertex_t* v = vBuffer;
- size_t count = VERTEX_BUFFER_SIZE + VERTEX_CACHE_SIZE;
- do {
- v->mru = 0;
- v++;
- } while (--count);
-#endif
-
- sequence += INDEX_SEQ;
- if (sequence >= 0x80000000LU) {
- sequence = INDEX_SEQ;
- vertex_t* v = vBuffer;
- size_t count = VERTEX_BUFFER_SIZE + VERTEX_CACHE_SIZE;
- do {
- v->index = 0;
- v++;
- } while (--count);
- }
-}
-
-void vertex_cache_t::dump_stats(GLenum mode)
-{
-#if VC_CACHE_STATISTICS
- nsecs_t time = systemTime(SYSTEM_TIME_THREAD) - startTime;
- uint32_t hits = total - misses;
- uint32_t prim_count;
- switch (mode) {
- case GL_POINTS: prim_count = total; break;
- case GL_LINE_STRIP: prim_count = total - 1; break;
- case GL_LINE_LOOP: prim_count = total - 1; break;
- case GL_LINES: prim_count = total / 2; break;
- case GL_TRIANGLE_STRIP: prim_count = total - 2; break;
- case GL_TRIANGLE_FAN: prim_count = total - 2; break;
- case GL_TRIANGLES: prim_count = total / 3; break;
- default: return;
- }
- printf( "total=%5u, hits=%5u, miss=%5u, hitrate=%3u%%,"
- " prims=%5u, time=%6u us, prims/s=%d, v/t=%f\n",
- total, hits, misses, (hits*100)/total,
- prim_count, int(ns2us(time)), int(prim_count*float(seconds(1))/time),
- float(misses) / prim_count);
-#endif
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-static __attribute__((noinline))
-void enableDisableClientState(ogles_context_t* c, GLenum array, bool enable)
-{
- const int tmu = c->arrays.activeTexture;
- array_t* a;
- switch (array) {
- case GL_COLOR_ARRAY: a = &c->arrays.color; break;
- case GL_NORMAL_ARRAY: a = &c->arrays.normal; break;
- case GL_TEXTURE_COORD_ARRAY: a = &c->arrays.texture[tmu]; break;
- case GL_VERTEX_ARRAY: a = &c->arrays.vertex; break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- a->enable = enable ? GL_TRUE : GL_FALSE;
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Vertex Cache
-#endif
-
-static __attribute__((noinline))
-vertex_t* cache_vertex(ogles_context_t* c, vertex_t* v, uint32_t index)
-{
- #if VC_CACHE_STATISTICS
- c->vc.misses++;
- #endif
- if (ggl_unlikely(v->locked)) {
- // we're just looking for an entry in the cache that is not locked.
- // and we know that there cannot be more than 2 locked entries
- // because a triangle needs at most 3 vertices.
- // We never use the first and second entries because they might be in
- // use by the striper or faner. Any other entry will do as long as
- // it's not locked.
- // We compute directly the index of a "free" entry from the locked
- // state of v[2] and v[3].
- v = c->vc.vBuffer + 2;
- v += v[0].locked | (v[1].locked<<1);
- }
- // note: compileElement clears v->flags
- c->arrays.compileElement(c, v, index);
- v->locked = 1;
- return v;
-}
-
-static __attribute__((noinline))
-vertex_t* fetch_vertex(ogles_context_t* c, size_t index)
-{
- index |= c->vc.sequence;
-
-#if VC_CACHE_TYPE == VC_CACHE_TYPE_INDEXED
-
- vertex_t* const v = c->vc.vCache +
- (index & (vertex_cache_t::VERTEX_CACHE_SIZE-1));
-
- if (ggl_likely(v->index == index)) {
- v->locked = 1;
- return v;
- }
- return cache_vertex(c, v, index);
-
-#elif VC_CACHE_TYPE == VC_CACHE_TYPE_LRU
-
- vertex_t* v = c->vc.vCache +
- (index & ((vertex_cache_t::VERTEX_CACHE_SIZE-1)>>1))*2;
-
- // always record LRU in v[0]
- if (ggl_likely(v[0].index == index)) {
- v[0].locked = 1;
- v[0].mru = 0;
- return &v[0];
- }
-
- if (ggl_likely(v[1].index == index)) {
- v[1].locked = 1;
- v[0].mru = 1;
- return &v[1];
- }
-
- const int lru = 1 - v[0].mru;
- v[0].mru = lru;
- return cache_vertex(c, &v[lru], index);
-
-#elif VC_CACHE_TYPE == VC_CACHE_TYPE_NONE
-
- // just for debugging...
- vertex_t* v = c->vc.vBuffer + 2;
- return cache_vertex(c, v, index);
-
-#endif
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Primitive Assembly
-#endif
-
-void drawPrimitivesPoints(ogles_context_t* c, GLint first, GLsizei count)
-{
- if (ggl_unlikely(count < 1))
- return;
-
- // vertex cache size must be multiple of 1
- const GLsizei vcs =
- (vertex_cache_t::VERTEX_BUFFER_SIZE +
- vertex_cache_t::VERTEX_CACHE_SIZE);
- do {
- vertex_t* v = c->vc.vBuffer;
- GLsizei num = count > vcs ? vcs : count;
- c->arrays.cull = vertex_t::CLIP_ALL;
- c->arrays.compileElements(c, v, first, num);
- first += num;
- count -= num;
- if (!c->arrays.cull) {
- // quick/trivial reject of the whole batch
- do {
- const uint32_t cc = v[0].flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderPoint(c, v);
- v++;
- num--;
- } while (num);
- }
- } while (count);
-}
-
-// ----------------------------------------------------------------------------
-
-void drawPrimitivesLineStrip(ogles_context_t* c, GLint first, GLsizei count)
-{
- if (ggl_unlikely(count < 2))
- return;
-
- vertex_t *v, *v0, *v1;
- c->arrays.cull = vertex_t::CLIP_ALL;
- c->arrays.compileElement(c, c->vc.vBuffer, first);
- first += 1;
- count -= 1;
-
- // vertex cache size must be multiple of 1
- const GLsizei vcs =
- (vertex_cache_t::VERTEX_BUFFER_SIZE +
- vertex_cache_t::VERTEX_CACHE_SIZE - 1);
- do {
- v0 = c->vc.vBuffer + 0;
- v = c->vc.vBuffer + 1;
- GLsizei num = count > vcs ? vcs : count;
- c->arrays.compileElements(c, v, first, num);
- first += num;
- count -= num;
- if (!c->arrays.cull) {
- // quick/trivial reject of the whole batch
- do {
- v1 = v++;
- const uint32_t cc = v0->flags & v1->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v0, v1);
- v0 = v1;
- num--;
- } while (num);
- }
- // copy back the last processed vertex
- c->vc.vBuffer[0] = *v0;
- c->arrays.cull = v0->flags & vertex_t::CLIP_ALL;
- } while (count);
-}
-
-void drawPrimitivesLineLoop(ogles_context_t* c, GLint first, GLsizei count)
-{
- if (ggl_unlikely(count < 2))
- return;
- drawPrimitivesLineStrip(c, first, count);
- if (ggl_likely(count >= 3)) {
- vertex_t* v0 = c->vc.vBuffer;
- vertex_t* v1 = c->vc.vBuffer + 1;
- c->arrays.compileElement(c, v1, first);
- const uint32_t cc = v0->flags & v1->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v0, v1);
- }
-}
-
-void drawPrimitivesLines(ogles_context_t* c, GLint first, GLsizei count)
-{
- if (ggl_unlikely(count < 2))
- return;
-
- // vertex cache size must be multiple of 2
- const GLsizei vcs =
- ((vertex_cache_t::VERTEX_BUFFER_SIZE +
- vertex_cache_t::VERTEX_CACHE_SIZE) / 2) * 2;
- do {
- vertex_t* v = c->vc.vBuffer;
- GLsizei num = count > vcs ? vcs : count;
- c->arrays.cull = vertex_t::CLIP_ALL;
- c->arrays.compileElements(c, v, first, num);
- first += num;
- count -= num;
- if (!c->arrays.cull) {
- // quick/trivial reject of the whole batch
- num -= 2;
- do {
- const uint32_t cc = v[0].flags & v[1].flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v, v+1);
- v += 2;
- num -= 2;
- } while (num >= 0);
- }
- } while (count >= 2);
-}
-
-// ----------------------------------------------------------------------------
-
-static void drawPrimitivesTriangleFanOrStrip(ogles_context_t* c,
- GLint first, GLsizei count, int winding)
-{
- // winding == 2 : fan
- // winding == 1 : strip
-
- if (ggl_unlikely(count < 3))
- return;
-
- vertex_t *v, *v0, *v1, *v2;
- c->arrays.cull = vertex_t::CLIP_ALL;
- c->arrays.compileElements(c, c->vc.vBuffer, first, 2);
- first += 2;
- count -= 2;
-
- // vertex cache size must be multiple of 2. This is extremely important
- // because it allows us to preserve the same winding when the whole
- // batch is culled. We also need 2 extra vertices in the array, because
- // we always keep the two first ones.
- const GLsizei vcs =
- ((vertex_cache_t::VERTEX_BUFFER_SIZE +
- vertex_cache_t::VERTEX_CACHE_SIZE - 2) / 2) * 2;
- do {
- v0 = c->vc.vBuffer + 0;
- v1 = c->vc.vBuffer + 1;
- v = c->vc.vBuffer + 2;
- GLsizei num = count > vcs ? vcs : count;
- c->arrays.compileElements(c, v, first, num);
- first += num;
- count -= num;
- if (!c->arrays.cull) {
- // quick/trivial reject of the whole batch
- do {
- v2 = v++;
- const uint32_t cc = v0->flags & v1->flags & v2->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderTriangle(c, v0, v1, v2);
- swap(((winding^=1) ? v1 : v0), v2);
- num--;
- } while (num);
- }
- if (count) {
- v0 = c->vc.vBuffer + 2 + vcs - 2;
- v1 = c->vc.vBuffer + 2 + vcs - 1;
- if ((winding&2) == 0) {
- // for strips copy back the two last compiled vertices
- c->vc.vBuffer[0] = *v0;
- }
- c->vc.vBuffer[1] = *v1;
- c->arrays.cull = v0->flags & v1->flags & vertex_t::CLIP_ALL;
- }
- } while (count > 0);
-}
-
-void drawPrimitivesTriangleStrip(ogles_context_t* c,
- GLint first, GLsizei count) {
- drawPrimitivesTriangleFanOrStrip(c, first, count, 1);
-}
-
-void drawPrimitivesTriangleFan(ogles_context_t* c,
- GLint first, GLsizei count) {
- drawPrimitivesTriangleFanOrStrip(c, first, count, 2);
-}
-
-void drawPrimitivesTriangles(ogles_context_t* c, GLint first, GLsizei count)
-{
- if (ggl_unlikely(count < 3))
- return;
-
- // vertex cache size must be multiple of 3
- const GLsizei vcs =
- ((vertex_cache_t::VERTEX_BUFFER_SIZE +
- vertex_cache_t::VERTEX_CACHE_SIZE) / 3) * 3;
- do {
- vertex_t* v = c->vc.vBuffer;
- GLsizei num = count > vcs ? vcs : count;
- c->arrays.cull = vertex_t::CLIP_ALL;
- c->arrays.compileElements(c, v, first, num);
- first += num;
- count -= num;
- if (!c->arrays.cull) {
- // quick/trivial reject of the whole batch
- num -= 3;
- do {
- const uint32_t cc = v[0].flags & v[1].flags & v[2].flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderTriangle(c, v, v+1, v+2);
- v += 3;
- num -= 3;
- } while (num >= 0);
- }
- } while (count >= 3);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-// this looks goofy, but gcc does a great job with this...
-static inline unsigned int read_index(int type, const GLvoid*& p) {
- unsigned int r;
- if (type) {
- r = *(const GLubyte*)p;
- p = (const GLubyte*)p + 1;
- } else {
- r = *(const GLushort*)p;
- p = (const GLushort*)p + 1;
- }
- return r;
-}
-
-// ----------------------------------------------------------------------------
-
-void drawIndexedPrimitivesPoints(ogles_context_t* c,
- GLsizei count, const GLvoid *indices)
-{
- if (ggl_unlikely(count < 1))
- return;
- const int type = (c->arrays.indicesType == GL_UNSIGNED_BYTE);
- do {
- vertex_t * v = fetch_vertex(c, read_index(type, indices));
- if (ggl_likely(!(v->flags & vertex_t::CLIP_ALL)))
- c->prims.renderPoint(c, v);
- v->locked = 0;
- count--;
- } while(count);
-}
-
-// ----------------------------------------------------------------------------
-
-void drawIndexedPrimitivesLineStrip(ogles_context_t* c,
- GLsizei count, const GLvoid *indices)
-{
- if (ggl_unlikely(count < 2))
- return;
-
- vertex_t * const v = c->vc.vBuffer;
- vertex_t* v0 = v;
- vertex_t* v1;
-
- const int type = (c->arrays.indicesType == GL_UNSIGNED_BYTE);
- c->arrays.compileElement(c, v0, read_index(type, indices));
- count -= 1;
- do {
- v1 = fetch_vertex(c, read_index(type, indices));
- const uint32_t cc = v0->flags & v1->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v0, v1);
- v0->locked = 0;
- v0 = v1;
- count--;
- } while (count);
- v1->locked = 0;
-}
-
-void drawIndexedPrimitivesLineLoop(ogles_context_t* c,
- GLsizei count, const GLvoid *indices)
-{
- if (ggl_unlikely(count <= 2)) {
- drawIndexedPrimitivesLines(c, count, indices);
- return;
- }
-
- vertex_t * const v = c->vc.vBuffer;
- vertex_t* v0 = v;
- vertex_t* v1;
-
- const int type = (c->arrays.indicesType == GL_UNSIGNED_BYTE);
- c->arrays.compileElement(c, v0, read_index(type, indices));
- count -= 1;
- do {
- v1 = fetch_vertex(c, read_index(type, indices));
- const uint32_t cc = v0->flags & v1->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v0, v1);
- v0->locked = 0;
- v0 = v1;
- count--;
- } while (count);
- v1->locked = 0;
-
- v1 = c->vc.vBuffer;
- const uint32_t cc = v0->flags & v1->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v0, v1);
-}
-
-void drawIndexedPrimitivesLines(ogles_context_t* c,
- GLsizei count, const GLvoid *indices)
-{
- if (ggl_unlikely(count < 2))
- return;
-
- count -= 2;
- const int type = (c->arrays.indicesType == GL_UNSIGNED_BYTE);
- do {
- vertex_t* const v0 = fetch_vertex(c, read_index(type, indices));
- vertex_t* const v1 = fetch_vertex(c, read_index(type, indices));
- const uint32_t cc = v0->flags & v1->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderLine(c, v0, v1);
- v0->locked = 0;
- v1->locked = 0;
- count -= 2;
- } while (count >= 0);
-}
-
-// ----------------------------------------------------------------------------
-
-static void drawIndexedPrimitivesTriangleFanOrStrip(ogles_context_t* c,
- GLsizei count, const GLvoid *indices, int winding)
-{
- // winding == 2 : fan
- // winding == 1 : strip
-
- if (ggl_unlikely(count < 3))
- return;
-
- vertex_t * const v = c->vc.vBuffer;
- vertex_t* v0 = v;
- vertex_t* v1 = v+1;
- vertex_t* v2;
-
- const int type = (c->arrays.indicesType == GL_UNSIGNED_BYTE);
- c->arrays.compileElement(c, v0, read_index(type, indices));
- c->arrays.compileElement(c, v1, read_index(type, indices));
- count -= 2;
-
- // note: GCC 4.1.1 here makes a prety interesting optimization
- // where it duplicates the loop below based on c->arrays.indicesType
-
- do {
- v2 = fetch_vertex(c, read_index(type, indices));
- const uint32_t cc = v0->flags & v1->flags & v2->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderTriangle(c, v0, v1, v2);
- vertex_t* & consumed = ((winding^=1) ? v1 : v0);
- consumed->locked = 0;
- consumed = v2;
- count--;
- } while (count);
- v0->locked = v1->locked = 0;
- v2->locked = 0;
-}
-
-void drawIndexedPrimitivesTriangleStrip(ogles_context_t* c,
- GLsizei count, const GLvoid *indices) {
- drawIndexedPrimitivesTriangleFanOrStrip(c, count, indices, 1);
-}
-
-void drawIndexedPrimitivesTriangleFan(ogles_context_t* c,
- GLsizei count, const GLvoid *indices) {
- drawIndexedPrimitivesTriangleFanOrStrip(c, count, indices, 2);
-}
-
-void drawIndexedPrimitivesTriangles(ogles_context_t* c,
- GLsizei count, const GLvoid *indices)
-{
- if (ggl_unlikely(count < 3))
- return;
-
- count -= 3;
- if (ggl_likely(c->arrays.indicesType == GL_UNSIGNED_SHORT)) {
- // This case is probably our most common case...
- uint16_t const * p = (uint16_t const *)indices;
- do {
- vertex_t* const v0 = fetch_vertex(c, *p++);
- vertex_t* const v1 = fetch_vertex(c, *p++);
- vertex_t* const v2 = fetch_vertex(c, *p++);
- const uint32_t cc = v0->flags & v1->flags & v2->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderTriangle(c, v0, v1, v2);
- v0->locked = 0;
- v1->locked = 0;
- v2->locked = 0;
- count -= 3;
- } while (count >= 0);
- } else {
- uint8_t const * p = (uint8_t const *)indices;
- do {
- vertex_t* const v0 = fetch_vertex(c, *p++);
- vertex_t* const v1 = fetch_vertex(c, *p++);
- vertex_t* const v2 = fetch_vertex(c, *p++);
- const uint32_t cc = v0->flags & v1->flags & v2->flags;
- if (ggl_likely(!(cc & vertex_t::CLIP_ALL)))
- c->prims.renderTriangle(c, v0, v1, v2);
- v0->locked = 0;
- v1->locked = 0;
- v2->locked = 0;
- count -= 3;
- } while (count >= 0);
- }
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Array compilers
-#endif
-
-void compileElement__generic(ogles_context_t* c,
- vertex_t* v, GLint first)
-{
- v->flags = 0;
- v->index = first;
- first &= vertex_cache_t::INDEX_MASK;
- const GLubyte* vp = c->arrays.vertex.element(first);
- v->obj.z = 0;
- v->obj.w = 0x10000;
- c->arrays.vertex.fetch(c, v->obj.v, vp);
- c->arrays.mvp_transform(&c->transforms.mvp, &v->clip, &v->obj);
- c->arrays.perspective(c, v);
-}
-
-void compileElements__generic(ogles_context_t* c,
- vertex_t* v, GLint first, GLsizei count)
-{
- const GLubyte* vp = c->arrays.vertex.element(
- first & vertex_cache_t::INDEX_MASK);
- const size_t stride = c->arrays.vertex.stride;
- transform_t const* const mvp = &c->transforms.mvp;
- do {
- v->flags = 0;
- v->index = first++;
- v->obj.z = 0;
- v->obj.w = 0x10000;
- c->arrays.vertex.fetch(c, v->obj.v, vp);
- c->arrays.mvp_transform(mvp, &v->clip, &v->obj);
- c->arrays.perspective(c, v);
- vp += stride;
- v++;
- } while (--count);
-}
-
-/*
-void compileElements__3x_full(ogles_context_t* c,
- vertex_t* v, GLint first, GLsizei count)
-{
- const GLfixed* vp = (const GLfixed*)c->arrays.vertex.element(first);
- const size_t stride = c->arrays.vertex.stride / 4;
-// const GLfixed* const& m = c->transforms.mvp.matrix.m;
-
- GLfixed m[16];
- memcpy(&m, c->transforms.mvp.matrix.m, sizeof(m));
-
- do {
- const GLfixed rx = vp[0];
- const GLfixed ry = vp[1];
- const GLfixed rz = vp[2];
- vp += stride;
- v->index = first++;
- v->clip.x = mla3a(rx, m[ 0], ry, m[ 4], rz, m[ 8], m[12]);
- v->clip.y = mla3a(rx, m[ 1], ry, m[ 5], rz, m[ 9], m[13]);
- v->clip.z = mla3a(rx, m[ 2], ry, m[ 6], rz, m[10], m[14]);
- v->clip.w = mla3a(rx, m[ 3], ry, m[ 7], rz, m[11], m[15]);
-
- const GLfixed w = v->clip.w;
- uint32_t clip = 0;
- if (v->clip.x < -w) clip |= vertex_t::CLIP_L;
- if (v->clip.x > w) clip |= vertex_t::CLIP_R;
- if (v->clip.y < -w) clip |= vertex_t::CLIP_B;
- if (v->clip.y > w) clip |= vertex_t::CLIP_T;
- if (v->clip.z < -w) clip |= vertex_t::CLIP_N;
- if (v->clip.z > w) clip |= vertex_t::CLIP_F;
- v->flags = clip;
- c->arrays.cull &= clip;
-
- //c->arrays.perspective(c, v);
- v++;
- } while (--count);
-}
-*/
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark clippers
-#endif
-
-static void clipVec4(vec4_t& nv,
- GLfixed t, const vec4_t& s, const vec4_t& p)
-{
- for (int i=0; i<4 ; i++)
- nv.v[i] = gglMulAddx(t, s.v[i] - p.v[i], p.v[i], 28);
-}
-
-static void clipVertex(ogles_context_t* c, vertex_t* nv,
- GLfixed t, const vertex_t* s, const vertex_t* p)
-{
- clipVec4(nv->clip, t, s->clip, p->clip);
- nv->fog = gglMulAddx(t, s->fog - p->fog, p->fog, 28);
- ogles_vertex_project(c, nv);
- nv->flags |= vertex_t::LIT | vertex_t::EYE | vertex_t::TT;
- nv->flags &= ~vertex_t::CLIP_ALL;
-}
-
-static void clipVertexC(ogles_context_t* c, vertex_t* nv,
- GLfixed t, const vertex_t* s, const vertex_t* p)
-{
- clipVec4(nv->color, t, s->color, p->color);
- clipVertex(c, nv, t, s, p);
-}
-
-static void clipVertexT(ogles_context_t* c, vertex_t* nv,
- GLfixed t, const vertex_t* s, const vertex_t* p)
-{
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (c->rasterizer.state.texture[i].enable)
- clipVec4(nv->texture[i], t, s->texture[i], p->texture[i]);
- }
- clipVertex(c, nv, t, s, p);
-}
-
-static void clipVertexAll(ogles_context_t* c, vertex_t* nv,
- GLfixed t, const vertex_t* s, const vertex_t* p)
-{
- clipVec4(nv->color, t, s->color, p->color);
- clipVertexT(c, nv, t, s, p);
-}
-
-static void clipEye(ogles_context_t* c, vertex_t* nv,
- GLfixed t, const vertex_t* s, const vertex_t* p)
-{
- nv->clear();
- c->arrays.clipVertex(c, nv, t, p, s);
- clipVec4(nv->eye, t, s->eye, p->eye);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-void validate_arrays(ogles_context_t* c, GLenum mode)
-{
- uint32_t enables = c->rasterizer.state.enables;
-
- // Perspective correction is not need if Ortho transform, but
- // the user can still provide the w coordinate manually, so we can't
- // automatically turn it off (in fact we could when the 4th coordinate
- // is not spcified in the vertex array).
- // W interpolation is never needed for points.
- GLboolean perspective =
- c->perspective && mode!=GL_POINTS && (enables & GGL_ENABLE_TMUS);
- c->rasterizer.procs.enableDisable(c, GGL_W_LERP, perspective);
-
- // set anti-aliasing
- GLboolean smooth = GL_FALSE;
- switch (mode) {
- case GL_POINTS:
- smooth = c->point.smooth;
- break;
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- smooth = c->line.smooth;
- break;
- }
- if (((enables & GGL_ENABLE_AA)?1:0) != smooth)
- c->rasterizer.procs.enableDisable(c, GGL_AA, smooth);
-
- // set the shade model for this primitive
- c->rasterizer.procs.shadeModel(c,
- (mode == GL_POINTS) ? GL_FLAT : c->lighting.shadeModel);
-
- // compute all the matrices we'll need...
- uint32_t want =
- transform_state_t::MVP |
- transform_state_t::VIEWPORT;
- if (c->lighting.enable) { // needs normal transforms and eye coords
- want |= transform_state_t::MVUI;
- want |= transform_state_t::MODELVIEW;
- }
- if (enables & GGL_ENABLE_TMUS) { // needs texture transforms
- want |= transform_state_t::TEXTURE;
- }
- if (c->clipPlanes.enable || (enables & GGL_ENABLE_FOG)) {
- want |= transform_state_t::MODELVIEW; // needs eye coords
- }
- ogles_validate_transform(c, want);
-
- // textures...
- if (enables & GGL_ENABLE_TMUS)
- ogles_validate_texture(c);
-
- // vertex compilers
- c->arrays.compileElement = compileElement__generic;
- c->arrays.compileElements = compileElements__generic;
-
- // vertex transform
- c->arrays.mvp_transform =
- c->transforms.mvp.pointv[c->arrays.vertex.size - 2];
-
- c->arrays.mv_transform =
- c->transforms.modelview.transform.pointv[c->arrays.vertex.size - 2];
-
- /*
- * ***********************************************************************
- * pick fetchers
- * ***********************************************************************
- */
-
- array_machine_t& am = c->arrays;
- am.vertex.fetch = fetchNop;
- am.normal.fetch = currentNormal;
- am.color.fetch = currentColor;
-
- if (am.vertex.enable) {
- am.vertex.resolve();
- if (am.vertex.bo || am.vertex.pointer) {
- am.vertex.fetch = vertex_fct[am.vertex.size-2][am.vertex.type & 0xF];
- }
- }
-
- if (am.normal.enable) {
- am.normal.resolve();
- if (am.normal.bo || am.normal.pointer) {
- am.normal.fetch = normal_fct[am.normal.size-3][am.normal.type & 0xF];
- }
- }
-
- if (am.color.enable) {
- am.color.resolve();
- if (c->lighting.enable) {
- if (am.color.bo || am.color.pointer) {
- am.color.fetch = color_fct[am.color.size-3][am.color.type & 0xF];
- }
- } else {
- if (am.color.bo || am.color.pointer) {
- am.color.fetch = color_clamp_fct[am.color.size-3][am.color.type & 0xF];
- }
- }
- }
-
- int activeTmuCount = 0;
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- am.texture[i].fetch = currentTexCoord;
- if (c->rasterizer.state.texture[i].enable) {
-
- // texture fetchers...
- if (am.texture[i].enable) {
- am.texture[i].resolve();
- if (am.texture[i].bo || am.texture[i].pointer) {
- am.texture[i].fetch = texture_fct[am.texture[i].size-2][am.texture[i].type & 0xF];
- }
- }
-
- // texture transform...
- const int index = c->arrays.texture[i].size - 2;
- c->arrays.tex_transform[i] =
- c->transforms.texture[i].transform.pointv[index];
-
- am.tmu = i;
- activeTmuCount++;
- }
- }
-
- // pick the vertex-clipper
- uint32_t clipper = 0;
- // we must reload 'enables' here
- enables = c->rasterizer.state.enables;
- if (enables & GGL_ENABLE_SMOOTH)
- clipper |= 1; // we need to interpolate colors
- if (enables & GGL_ENABLE_TMUS)
- clipper |= 2; // we need to interpolate textures
- switch (clipper) {
- case 0: c->arrays.clipVertex = clipVertex; break;
- case 1: c->arrays.clipVertex = clipVertexC; break;
- case 2: c->arrays.clipVertex = clipVertexT; break;
- case 3: c->arrays.clipVertex = clipVertexAll; break;
- }
- c->arrays.clipEye = clipEye;
-
- // pick the primitive rasterizer
- ogles_validate_primitives(c);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-#if 0
-#pragma mark -
-#pragma mark array API
-#endif
-
-void glVertexPointer(
- GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (size<2 || size>4 || stride<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- switch (type) {
- case GL_BYTE:
- case GL_SHORT:
- case GL_FIXED:
- case GL_FLOAT:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->arrays.vertex.init(size, type, stride, pointer, c->arrays.array_buffer, 0);
-}
-
-void glColorPointer(
- GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (size!=4 || stride<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- switch (type) {
- case GL_UNSIGNED_BYTE:
- case GL_FIXED:
- case GL_FLOAT:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->arrays.color.init(size, type, stride, pointer, c->arrays.array_buffer, 0);
-}
-
-void glNormalPointer(
- GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (stride<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- switch (type) {
- case GL_BYTE:
- case GL_SHORT:
- case GL_FIXED:
- case GL_FLOAT:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->arrays.normal.init(3, type, stride, pointer, c->arrays.array_buffer, 0);
-}
-
-void glTexCoordPointer(
- GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (size<2 || size>4 || stride<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- switch (type) {
- case GL_BYTE:
- case GL_SHORT:
- case GL_FIXED:
- case GL_FLOAT:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- const int tmu = c->arrays.activeTexture;
- c->arrays.texture[tmu].init(size, type, stride, pointer,
- c->arrays.array_buffer, 0);
-}
-
-
-void glEnableClientState(GLenum array) {
- ogles_context_t* c = ogles_context_t::get();
- enableDisableClientState(c, array, true);
-}
-
-void glDisableClientState(GLenum array) {
- ogles_context_t* c = ogles_context_t::get();
- enableDisableClientState(c, array, false);
-}
-
-void glClientActiveTexture(GLenum texture)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (texture<GL_TEXTURE0 || texture>=GL_TEXTURE0+GGL_TEXTURE_UNIT_COUNT) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->arrays.activeTexture = texture - GL_TEXTURE0;
-}
-
-void glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (count<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- switch (mode) {
- case GL_POINTS:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- case GL_LINES:
- case GL_TRIANGLE_STRIP:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLES:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- if (count == 0 || !c->arrays.vertex.enable)
- return;
- if ((c->cull.enable) && (c->cull.cullFace == GL_FRONT_AND_BACK))
- return; // all triangles are culled
-
-
- validate_arrays(c, mode);
-
- const uint32_t enables = c->rasterizer.state.enables;
- if (enables & GGL_ENABLE_TMUS)
- ogles_lock_textures(c);
-
- drawArraysPrims[mode](c, first, count);
-
- if (enables & GGL_ENABLE_TMUS)
- ogles_unlock_textures(c);
-
-#if VC_CACHE_STATISTICS
- c->vc.total = count;
- c->vc.dump_stats(mode);
-#endif
-}
-
-void glDrawElements(
- GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (count<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- switch (mode) {
- case GL_POINTS:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- case GL_LINES:
- case GL_TRIANGLE_STRIP:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLES:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- switch (type) {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- c->arrays.indicesType = type;
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (count == 0 || !c->arrays.vertex.enable)
- return;
- if ((c->cull.enable) && (c->cull.cullFace == GL_FRONT_AND_BACK))
- return; // all triangles are culled
-
- // clear the vertex-cache
- c->vc.clear();
- validate_arrays(c, mode);
-
- // if indices are in a buffer object, the pointer is treated as an
- // offset in that buffer.
- if (c->arrays.element_array_buffer) {
- indices = c->arrays.element_array_buffer->data + uintptr_t(indices);
- }
-
- const uint32_t enables = c->rasterizer.state.enables;
- if (enables & GGL_ENABLE_TMUS)
- ogles_lock_textures(c);
-
- drawElementsPrims[mode](c, count, indices);
-
- if (enables & GGL_ENABLE_TMUS)
- ogles_unlock_textures(c);
-
-
-#if VC_CACHE_STATISTICS
- c->vc.total = count;
- c->vc.dump_stats(mode);
-#endif
-}
-
-// ----------------------------------------------------------------------------
-// buffers
-// ----------------------------------------------------------------------------
-
-void glBindBuffer(GLenum target, GLuint buffer)
-{
- ogles_context_t* c = ogles_context_t::get();
- if ((target!=GL_ARRAY_BUFFER) && (target!=GL_ELEMENT_ARRAY_BUFFER)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- // create a buffer object, or bind an existing one
- buffer_t const* bo = 0;
- if (buffer) {
- bo = c->bufferObjectManager->bind(buffer);
- if (!bo) {
- ogles_error(c, GL_OUT_OF_MEMORY);
- return;
- }
- }
- ((target == GL_ARRAY_BUFFER) ?
- c->arrays.array_buffer : c->arrays.element_array_buffer) = bo;
-}
-
-void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- ogles_context_t* c = ogles_context_t::get();
- if ((target!=GL_ARRAY_BUFFER) && (target!=GL_ELEMENT_ARRAY_BUFFER)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (size<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if ((usage!=GL_STATIC_DRAW) && (usage!=GL_DYNAMIC_DRAW)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- buffer_t const* bo = ((target == GL_ARRAY_BUFFER) ?
- c->arrays.array_buffer : c->arrays.element_array_buffer);
-
- if (bo == 0) {
- // can't modify buffer 0
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
-
- buffer_t* edit_bo = const_cast<buffer_t*>(bo);
- if (c->bufferObjectManager->allocateStore(edit_bo, size, usage) != 0) {
- ogles_error(c, GL_OUT_OF_MEMORY);
- return;
- }
- if (data) {
- memcpy(bo->data, data, size);
- }
-}
-
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- ogles_context_t* c = ogles_context_t::get();
- if ((target!=GL_ARRAY_BUFFER) && (target!=GL_ELEMENT_ARRAY_BUFFER)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (offset<0 || size<0 || data==0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- buffer_t const* bo = ((target == GL_ARRAY_BUFFER) ?
- c->arrays.array_buffer : c->arrays.element_array_buffer);
-
- if (bo == 0) {
- // can't modify buffer 0
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
- if (offset+size > bo->size) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- memcpy(bo->data + offset, data, size);
-}
-
-void glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (n<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- for (int i=0 ; i<n ; i++) {
- GLuint name = buffers[i];
- if (name) {
- // unbind bound deleted buffers...
- if (c->arrays.element_array_buffer) {
- if (c->arrays.element_array_buffer->name == name) {
- c->arrays.element_array_buffer = 0;
- }
- }
- if (c->arrays.array_buffer) {
- if (c->arrays.array_buffer->name == name) {
- c->arrays.array_buffer = 0;
- }
- }
- if (c->arrays.vertex.bo) {
- if (c->arrays.vertex.bo->name == name) {
- c->arrays.vertex.bo = 0;
- }
- }
- if (c->arrays.normal.bo) {
- if (c->arrays.normal.bo->name == name) {
- c->arrays.normal.bo = 0;
- }
- }
- if (c->arrays.color.bo) {
- if (c->arrays.color.bo->name == name) {
- c->arrays.color.bo = 0;
- }
- }
- for (int t=0 ; t<GGL_TEXTURE_UNIT_COUNT ; t++) {
- if (c->arrays.texture[t].bo) {
- if (c->arrays.texture[t].bo->name == name) {
- c->arrays.texture[t].bo = 0;
- }
- }
- }
- }
- }
- c->bufferObjectManager->deleteBuffers(n, buffers);
- c->bufferObjectManager->recycleTokens(n, buffers);
-}
-
-void glGenBuffers(GLsizei n, GLuint* buffers)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (n<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- c->bufferObjectManager->getToken(n, buffers);
-}
diff --git a/opengl/libagl/array.h b/opengl/libagl/array.h
deleted file mode 100644
index e156978..0000000
--- a/opengl/libagl/array.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* libs/opengles/array.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_ARRAY_H
-#define ANDROID_OPENGLES_ARRAY_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-namespace android {
-
-namespace gl {
-struct ogles_context_t;
-};
-
-void ogles_init_array(ogles_context_t* c);
-void ogles_uninit_array(ogles_context_t* c);
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_ARRAY_H
-
diff --git a/opengl/libagl/context.h b/opengl/libagl/context.h
deleted file mode 100644
index 7065a30..0000000
--- a/opengl/libagl/context.h
+++ /dev/null
@@ -1,642 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_OPENGLES_CONTEXT_H
-#define ANDROID_OPENGLES_CONTEXT_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-#include <pthread.h>
-#ifdef HAVE_ANDROID_OS
-#include <bionic_tls.h>
-#endif
-
-#include <private/pixelflinger/ggl_context.h>
-#include <hardware/gralloc.h>
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-namespace android {
-
-
-const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10
-#ifdef GL_OES_compressed_ETC1_RGB8_texture
- + 1
-#endif
- ;
-
-class EGLTextureObject;
-class EGLSurfaceManager;
-class EGLBufferObjectManager;
-
-namespace gl {
-
-struct ogles_context_t;
-struct matrixx_t;
-struct transform_t;
-struct buffer_t;
-
-ogles_context_t* getGlContext();
-
-template<typename T>
-static inline void swap(T& a, T& b) {
- T t(a); a = b; b = t;
-}
-template<typename T>
-inline T max(T a, T b) {
- return a<b ? b : a;
-}
-template<typename T>
-inline T max(T a, T b, T c) {
- return max(a, max(b, c));
-}
-template<typename T>
-inline T min(T a, T b) {
- return a<b ? a : b;
-}
-template<typename T>
-inline T min(T a, T b, T c) {
- return min(a, min(b, c));
-}
-template<typename T>
-inline T min(T a, T b, T c, T d) {
- return min(min(a,b), min(c,d));
-}
-
-// ----------------------------------------------------------------------------
-// vertices
-// ----------------------------------------------------------------------------
-
-struct vec3_t {
- union {
- struct { GLfixed x, y, z; };
- struct { GLfixed r, g, b; };
- struct { GLfixed S, T, R; };
- GLfixed v[3];
- };
-};
-
-struct vec4_t {
- union {
- struct { GLfixed x, y, z, w; };
- struct { GLfixed r, g, b, a; };
- struct { GLfixed S, T, R, Q; };
- GLfixed v[4];
- };
-};
-
-struct vertex_t {
- enum {
- // these constant matter for our clipping
- CLIP_L = 0x0001, // clipping flags
- CLIP_R = 0x0002,
- CLIP_B = 0x0004,
- CLIP_T = 0x0008,
- CLIP_N = 0x0010,
- CLIP_F = 0x0020,
-
- EYE = 0x0040,
- RESERVED = 0x0080,
-
- USER_CLIP_0 = 0x0100, // user clipping flags
- USER_CLIP_1 = 0x0200,
- USER_CLIP_2 = 0x0400,
- USER_CLIP_3 = 0x0800,
- USER_CLIP_4 = 0x1000,
- USER_CLIP_5 = 0x2000,
-
- LIT = 0x4000, // lighting has been applied
- TT = 0x8000, // texture coords transformed
-
- FRUSTUM_CLIP_ALL= 0x003F,
- USER_CLIP_ALL = 0x3F00,
- CLIP_ALL = 0x3F3F,
- };
-
- // the fields below are arranged to minimize d-cache usage
- // we group together, by cache-line, the fields most likely to be used
-
- union {
- vec4_t obj;
- vec4_t eye;
- };
- vec4_t clip;
-
- uint32_t flags;
- size_t index; // cache tag, and vertex index
- GLfixed fog;
- uint8_t locked;
- uint8_t mru;
- uint8_t reserved[2];
- vec4_t window;
-
- vec4_t color;
- vec4_t texture[GGL_TEXTURE_UNIT_COUNT];
- uint32_t reserved1[4];
-
- inline void clear() {
- flags = index = locked = mru = 0;
- }
-};
-
-struct point_size_t {
- GGLcoord size;
- GLboolean smooth;
-};
-
-struct line_width_t {
- GGLcoord width;
- GLboolean smooth;
-};
-
-struct polygon_offset_t {
- GLfixed factor;
- GLfixed units;
- GLboolean enable;
-};
-
-// ----------------------------------------------------------------------------
-// arrays
-// ----------------------------------------------------------------------------
-
-struct array_t {
- typedef void (*fetcher_t)(ogles_context_t*, GLfixed*, const GLvoid*);
- fetcher_t fetch;
- GLvoid const* physical_pointer;
- GLint size;
- GLsizei stride;
- GLvoid const* pointer;
- buffer_t const* bo;
- uint16_t type;
- GLboolean enable;
- GLboolean pad;
- GLsizei bounds;
- void init(GLint, GLenum, GLsizei, const GLvoid *, const buffer_t*, GLsizei);
- inline void resolve();
- inline const GLubyte* element(GLint i) const {
- return (const GLubyte*)physical_pointer + i * stride;
- }
-};
-
-struct array_machine_t {
- array_t vertex;
- array_t normal;
- array_t color;
- array_t texture[GGL_TEXTURE_UNIT_COUNT];
- uint8_t activeTexture;
- uint8_t tmu;
- uint16_t cull;
- uint32_t flags;
- GLenum indicesType;
- buffer_t const* array_buffer;
- buffer_t const* element_array_buffer;
-
- void (*compileElements)(ogles_context_t*, vertex_t*, GLint, GLsizei);
- void (*compileElement)(ogles_context_t*, vertex_t*, GLint);
-
- void (*mvp_transform)(transform_t const*, vec4_t*, vec4_t const*);
- void (*mv_transform)(transform_t const*, vec4_t*, vec4_t const*);
- void (*tex_transform[2])(transform_t const*, vec4_t*, vec4_t const*);
- void (*perspective)(ogles_context_t*c, vertex_t* v);
- void (*clipVertex)(ogles_context_t* c, vertex_t* nv,
- GGLfixed t, const vertex_t* s, const vertex_t* p);
- void (*clipEye)(ogles_context_t* c, vertex_t* nv,
- GGLfixed t, const vertex_t* s, const vertex_t* p);
-};
-
-struct vertex_cache_t {
- enum {
- // must be at least 4
- // 3 vertice for triangles
- // or 2 + 2 for indexed triangles w/ cache contention
- VERTEX_BUFFER_SIZE = 8,
- // must be a power of two and at least 3
- VERTEX_CACHE_SIZE = 64, // 8 KB
-
- INDEX_BITS = 16,
- INDEX_MASK = ((1LU<<INDEX_BITS)-1),
- INDEX_SEQ = 1LU<<INDEX_BITS,
- };
- vertex_t* vBuffer;
- vertex_t* vCache;
- uint32_t sequence;
- void* base;
- uint32_t total;
- uint32_t misses;
- int64_t startTime;
- void init();
- void uninit();
- void clear();
- void dump_stats(GLenum mode);
-};
-
-// ----------------------------------------------------------------------------
-// fog
-// ----------------------------------------------------------------------------
-
-struct fog_t {
- GLfixed density;
- GLfixed start;
- GLfixed end;
- GLfixed invEndMinusStart;
- GLenum mode;
- GLfixed (*fog)(ogles_context_t* c, GLfixed z);
-};
-
-// ----------------------------------------------------------------------------
-// user clip planes
-// ----------------------------------------------------------------------------
-
-const unsigned int OGLES_MAX_CLIP_PLANES = 6;
-
-struct clip_plane_t {
- vec4_t equation;
-};
-
-struct user_clip_planes_t {
- clip_plane_t plane[OGLES_MAX_CLIP_PLANES];
- uint32_t enable;
-};
-
-// ----------------------------------------------------------------------------
-// lighting
-// ----------------------------------------------------------------------------
-
-const unsigned int OGLES_MAX_LIGHTS = 8;
-
-struct light_t {
- vec4_t ambient;
- vec4_t diffuse;
- vec4_t specular;
- vec4_t implicitAmbient;
- vec4_t implicitDiffuse;
- vec4_t implicitSpecular;
- vec4_t position; // position in eye space
- vec4_t objPosition;
- vec4_t normalizedObjPosition;
- vec4_t spotDir;
- vec4_t normalizedSpotDir;
- GLfixed spotExp;
- GLfixed spotCutoff;
- GLfixed spotCutoffCosine;
- GLfixed attenuation[3];
- GLfixed rConstAttenuation;
- GLboolean enable;
-};
-
-struct material_t {
- vec4_t ambient;
- vec4_t diffuse;
- vec4_t specular;
- vec4_t emission;
- GLfixed shininess;
-};
-
-struct light_model_t {
- vec4_t ambient;
- GLboolean twoSide;
-};
-
-struct color_material_t {
- GLenum face;
- GLenum mode;
- GLboolean enable;
-};
-
-struct lighting_t {
- light_t lights[OGLES_MAX_LIGHTS];
- material_t front;
- light_model_t lightModel;
- color_material_t colorMaterial;
- vec4_t implicitSceneEmissionAndAmbient;
- vec4_t objViewer;
- uint32_t enabledLights;
- GLboolean enable;
- GLenum shadeModel;
- typedef void (*light_fct_t)(ogles_context_t*, vertex_t*);
- void (*lightVertex)(ogles_context_t* c, vertex_t* v);
- void (*lightTriangle)(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-};
-
-struct culling_t {
- GLenum cullFace;
- GLenum frontFace;
- GLboolean enable;
-};
-
-// ----------------------------------------------------------------------------
-// textures
-// ----------------------------------------------------------------------------
-
-struct texture_unit_t {
- GLuint name;
- EGLTextureObject* texture;
- uint8_t dirty;
-};
-
-struct texture_state_t
-{
- texture_unit_t tmu[GGL_TEXTURE_UNIT_COUNT];
- int active; // active tmu
- EGLTextureObject* defaultTexture;
- GGLContext* ggl;
- uint8_t packAlignment;
- uint8_t unpackAlignment;
-};
-
-// ----------------------------------------------------------------------------
-// transformation and matrices
-// ----------------------------------------------------------------------------
-
-struct matrixf_t;
-
-struct matrixx_t {
- GLfixed m[16];
- void load(const matrixf_t& rhs);
-};
-
-struct matrix_stack_t;
-
-
-struct matrixf_t {
- void loadIdentity();
- void load(const matrixf_t& rhs);
-
- inline GLfloat* editElements() { return m; }
- inline GLfloat const* elements() const { return m; }
-
- void set(const GLfixed* rhs);
- void set(const GLfloat* rhs);
-
- static void multiply(matrixf_t& r,
- const matrixf_t& lhs, const matrixf_t& rhs);
-
- void dump(const char* what);
-
-private:
- friend struct matrix_stack_t;
- GLfloat m[16];
- void load(const GLfixed* rhs);
- void load(const GLfloat* rhs);
- void multiply(const matrixf_t& rhs);
- void translate(GLfloat x, GLfloat y, GLfloat z);
- void scale(GLfloat x, GLfloat y, GLfloat z);
- void rotate(GLfloat a, GLfloat x, GLfloat y, GLfloat z);
-};
-
-enum {
- OP_IDENTITY = 0x00,
- OP_TRANSLATE = 0x01,
- OP_UNIFORM_SCALE = 0x02,
- OP_SCALE = 0x05,
- OP_ROTATE = 0x08,
- OP_SKEW = 0x10,
- OP_ALL = 0x1F
-};
-
-struct transform_t {
- enum {
- FLAGS_2D_PROJECTION = 0x1
- };
- matrixx_t matrix;
- uint32_t flags;
- uint32_t ops;
-
- union {
- struct {
- void (*point2)(transform_t const* t, vec4_t*, vec4_t const*);
- void (*point3)(transform_t const* t, vec4_t*, vec4_t const*);
- void (*point4)(transform_t const* t, vec4_t*, vec4_t const*);
- };
- void (*pointv[3])(transform_t const* t, vec4_t*, vec4_t const*);
- };
-
- void loadIdentity();
- void picker();
- void dump(const char* what);
-};
-
-struct mvui_transform_t : public transform_t
-{
- void picker();
-};
-
-struct matrix_stack_t {
- enum {
- DO_PICKER = 0x1,
- DO_FLOAT_TO_FIXED = 0x2
- };
- transform_t transform;
- uint8_t maxDepth;
- uint8_t depth;
- uint8_t dirty;
- uint8_t reserved;
- matrixf_t *stack;
- uint8_t *ops;
- void init(int depth);
- void uninit();
- void loadIdentity();
- void load(const GLfixed* rhs);
- void load(const GLfloat* rhs);
- void multiply(const matrixf_t& rhs);
- void translate(GLfloat x, GLfloat y, GLfloat z);
- void scale(GLfloat x, GLfloat y, GLfloat z);
- void rotate(GLfloat a, GLfloat x, GLfloat y, GLfloat z);
- GLint push();
- GLint pop();
- void validate();
- matrixf_t& top() { return stack[depth]; }
- const matrixf_t& top() const { return stack[depth]; }
- uint32_t top_ops() const { return ops[depth]; }
- inline bool isRigidBody() const {
- return !(ops[depth] & ~(OP_TRANSLATE|OP_UNIFORM_SCALE|OP_ROTATE));
- }
-};
-
-struct vp_transform_t {
- transform_t transform;
- matrixf_t matrix;
- GLfloat zNear;
- GLfloat zFar;
- void loadIdentity();
-};
-
-struct transform_state_t {
- enum {
- MODELVIEW = 0x01,
- PROJECTION = 0x02,
- VIEWPORT = 0x04,
- TEXTURE = 0x08,
- MVUI = 0x10,
- MVIT = 0x20,
- MVP = 0x40,
- };
- matrix_stack_t *current;
- matrix_stack_t modelview;
- matrix_stack_t projection;
- matrix_stack_t texture[GGL_TEXTURE_UNIT_COUNT];
-
- // modelview * projection
- transform_t mvp __attribute__((aligned(32)));
- // viewport transformation
- vp_transform_t vpt __attribute__((aligned(32)));
- // same for 4-D vertices
- transform_t mvp4;
- // full modelview inverse transpose
- transform_t mvit4;
- // upper 3x3 of mv-inverse-transpose (for normals)
- mvui_transform_t mvui;
-
- GLenum matrixMode;
- GLenum rescaleNormals;
- uint32_t dirty;
- void invalidate();
- void update_mvp();
- void update_mvit();
- void update_mvui();
-};
-
-struct viewport_t {
- GLint x;
- GLint y;
- GLsizei w;
- GLsizei h;
- struct {
- GLint x;
- GLint y;
- } surfaceport;
- struct {
- GLint x;
- GLint y;
- GLsizei w;
- GLsizei h;
- } scissor;
-};
-
-// ----------------------------------------------------------------------------
-// Lerping
-// ----------------------------------------------------------------------------
-
-struct compute_iterators_t
-{
- void initTriangle(
- vertex_t const* v0,
- vertex_t const* v1,
- vertex_t const* v2);
-
- void initLine(
- vertex_t const* v0,
- vertex_t const* v1);
-
- inline void initLerp(vertex_t const* v0, uint32_t enables);
-
- int iteratorsScale(int32_t it[3],
- int32_t c0, int32_t c1, int32_t c2) const;
-
- void iterators1616(GGLfixed it[3],
- GGLfixed c0, GGLfixed c1, GGLfixed c2) const;
-
- void iterators0032(int32_t it[3],
- int32_t c0, int32_t c1, int32_t c2) const;
-
- void iterators0032(int64_t it[3],
- int32_t c0, int32_t c1, int32_t c2) const;
-
- GGLcoord area() const { return m_area; }
-
-private:
- // don't change order of members here -- used by iterators.S
- GGLcoord m_dx01, m_dy10, m_dx20, m_dy02;
- GGLcoord m_x0, m_y0;
- GGLcoord m_area;
- uint8_t m_scale;
- uint8_t m_area_scale;
- uint8_t m_reserved[2];
-
-};
-
-// ----------------------------------------------------------------------------
-// state
-// ----------------------------------------------------------------------------
-
-#ifdef HAVE_ANDROID_OS
- // We have a dedicated TLS slot in bionic
- inline void setGlThreadSpecific(ogles_context_t *value) {
- ((uint32_t *)__get_tls())[TLS_SLOT_OPENGL] = (uint32_t)value;
- }
- inline ogles_context_t* getGlThreadSpecific() {
- return (ogles_context_t *)(((unsigned *)__get_tls())[TLS_SLOT_OPENGL]);
- }
-#else
- extern pthread_key_t gGLKey;
- inline void setGlThreadSpecific(ogles_context_t *value) {
- pthread_setspecific(gGLKey, value);
- }
- inline ogles_context_t* getGlThreadSpecific() {
- return static_cast<ogles_context_t*>(pthread_getspecific(gGLKey));
- }
-#endif
-
-
-struct prims_t {
- typedef ogles_context_t* GL;
- void (*renderPoint)(GL, vertex_t*);
- void (*renderLine)(GL, vertex_t*, vertex_t*);
- void (*renderTriangle)(GL, vertex_t*, vertex_t*, vertex_t*);
-};
-
-struct ogles_context_t {
- context_t rasterizer;
- array_machine_t arrays __attribute__((aligned(32)));
- texture_state_t textures;
- transform_state_t transforms;
- vertex_cache_t vc;
- prims_t prims;
- culling_t cull;
- lighting_t lighting;
- user_clip_planes_t clipPlanes;
- compute_iterators_t lerp; __attribute__((aligned(32)));
- vertex_t current;
- vec4_t currentColorClamped;
- vec3_t currentNormal;
- viewport_t viewport;
- point_size_t point;
- line_width_t line;
- polygon_offset_t polygonOffset;
- fog_t fog;
- uint32_t perspective : 1;
- uint32_t transformTextures : 1;
- EGLSurfaceManager* surfaceManager;
- EGLBufferObjectManager* bufferObjectManager;
-
- GLenum error;
-
- static inline ogles_context_t* get() {
- return getGlThreadSpecific();
- }
-
-};
-
-}; // namespace gl
-}; // namespace android
-
-using namespace android::gl;
-
-#endif // ANDROID_OPENGLES_CONTEXT_H
-
diff --git a/opengl/libagl/dxt.cpp b/opengl/libagl/dxt.cpp
deleted file mode 100644
index 238c81f..0000000
--- a/opengl/libagl/dxt.cpp
+++ /dev/null
@@ -1,636 +0,0 @@
-/* libs/opengles/dxt.cpp
-**
-** Copyright 2007, The Android Open Source Project
-**
-** 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.
-*/
-
-#define TIMING 0
-
-#if TIMING
-#include <sys/time.h> // for optimization timing
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
-#include <GLES/gl.h>
-#include <utils/Endian.h>
-
-#include "context.h"
-
-#define TIMING 0
-
-namespace android {
-
-static uint8_t avg23tab[64*64];
-static volatile int tables_initialized = 0;
-
-// Definitions below are equivalent to these over the valid range of arguments
-// #define div5(x) ((x)/5)
-// #define div7(x) ((x)/7)
-
-// Use fixed-point to divide by 5 and 7
-// 3277 = 2^14/5 + 1
-// 2341 = 2^14/7 + 1
-#define div5(x) (((x)*3277) >> 14)
-#define div7(x) (((x)*2341) >> 14)
-
-// Table with entry [a << 6 | b] = (2*a + b)/3 for 0 <= a,b < 64
-#define avg23(x0,x1) avg23tab[((x0) << 6) | (x1)]
-
-// Extract 5/6/5 RGB
-#define red(x) (((x) >> 11) & 0x1f)
-#define green(x) (((x) >> 5) & 0x3f)
-#define blue(x) ( (x) & 0x1f)
-
-/*
- * Convert 5/6/5 RGB (as 3 ints) to 8/8/8
- *
- * Operation count: 8 <<, 0 &, 5 |
- */
-inline static int rgb565SepTo888(int r, int g, int b)
-
-{
- return ((((r << 3) | (r >> 2)) << 16) |
- (((g << 2) | (g >> 4)) << 8) |
- ((b << 3) | (b >> 2)));
-}
-
-/*
- * Convert 5/6/5 RGB (as a single 16-bit word) to 8/8/8
- *
- * r4r3r2r1 r0g5g4g3 g2g1g0b4 b3b2b1b0 rgb
- * r4r3r2 r1r0g5g4 g3g2g1g0 b4b3b2b1 b0 0 0 0 rgb << 3
- * r4r3r2r1 r0r4r3r2 g5g4g3g2 g1g0g5g4 b4b3b2b1 b0b4b3b2 desired result
- *
- * Construct the 24-bit RGB word as:
- *
- * r4r3r2r1 r0------ -------- -------- -------- -------- (rgb << 8) & 0xf80000
- * r4r3r2 -------- -------- -------- -------- (rgb << 3) & 0x070000
- * g5g4g3g2 g1g0---- -------- -------- (rgb << 5) & 0x00fc00
- * g5g4 -------- -------- (rgb >> 1) & 0x000300
- * b4b3b2b1 b0------ (rgb << 3) & 0x0000f8
- * b4b3b2 (rgb >> 2) & 0x000007
- *
- * Operation count: 5 <<, 6 &, 5 | (n.b. rgb >> 3 is used twice)
- */
-inline static int rgb565To888(int rgb)
-
-{
- int rgb3 = rgb >> 3;
- return (((rgb << 8) & 0xf80000) |
- ( rgb3 & 0x070000) |
- ((rgb << 5) & 0x00fc00) |
- ((rgb >> 1) & 0x000300) |
- ( rgb3 & 0x0000f8) |
- ((rgb >> 2) & 0x000007));
-}
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-static uint32_t swap(uint32_t x) {
- int b0 = (x >> 24) & 0xff;
- int b1 = (x >> 16) & 0xff;
- int b2 = (x >> 8) & 0xff;
- int b3 = (x ) & 0xff;
-
- return (uint32_t)((b3 << 24) | (b2 << 16) | (b1 << 8) | b0);
-}
-#endif
-
-static void
-init_tables()
-{
- if (tables_initialized) {
- return;
- }
-
- for (int i = 0; i < 64; i++) {
- for (int j = 0; j < 64; j++) {
- int avg = (2*i + j)/3;
- avg23tab[(i << 6) | j] = avg;
- }
- }
-
- asm volatile ("" : : : "memory");
- tables_initialized = 1;
-}
-
-/*
- * Utility to scan a DXT1 compressed texture to determine whether it
- * contains a transparent pixel (color0 < color1, code == 3). This
- * may be useful if the application lacks information as to whether
- * the true format is GL_COMPRESSED_RGB_S3TC_DXT1_EXT or
- * GL_COMPRESSED_RGBA_S3TC_DXT1_EXT.
- */
-bool
-DXT1HasAlpha(const GLvoid *data, int width, int height) {
-#if TIMING
- struct timeval start_t, end_t;
- struct timezone tz;
-
- gettimeofday(&start_t, &tz);
-#endif
-
- bool hasAlpha = false;
-
- int xblocks = (width + 3)/4;
- int yblocks = (height + 3)/4;
- int numblocks = xblocks*yblocks;
-
- uint32_t const *d32 = (uint32_t *)data;
- for (int b = 0; b < numblocks; b++) {
- uint32_t colors = *d32++;
-
-#if __BYTE_ORDER == __BIG_ENDIAN
- colors = swap(colors);
-#endif
-
- uint16_t color0 = colors & 0xffff;
- uint16_t color1 = colors >> 16;
-
- if (color0 < color1) {
- // There's no need to endian-swap within 'bits'
- // since we don't care which pixel is the transparent one
- uint32_t bits = *d32++;
-
- // Detect if any (odd, even) pair of bits are '11'
- // bits: b31 b30 b29 ... b3 b2 b1 b0
- // bits >> 1: b31 b31 b30 ... b4 b3 b2 b1
- // &: b31 (b31 & b30) (b29 & b28) ... (b2 & b1) (b1 & b0)
- // & 0x55..: 0 (b31 & b30) 0 ... 0 (b1 & b0)
- if (((bits & (bits >> 1)) & 0x55555555) != 0) {
- hasAlpha = true;
- goto done;
- }
- } else {
- // Skip 4 bytes
- ++d32;
- }
- }
-
- done:
-#if TIMING
- gettimeofday(&end_t, &tz);
- long usec = (end_t.tv_sec - start_t.tv_sec)*1000000 +
- (end_t.tv_usec - start_t.tv_usec);
-
- printf("Scanned w=%d h=%d in %ld usec\n", width, height, usec);
-#endif
-
- return hasAlpha;
-}
-
-static void
-decodeDXT1(const GLvoid *data, int width, int height,
- void *surface, int stride,
- bool hasAlpha)
-
-{
- init_tables();
-
- uint32_t const *d32 = (uint32_t *)data;
-
- // Color table for the current block
- uint16_t c[4];
- c[0] = c[1] = c[2] = c[3] = 0;
-
- // Specified colors from the previous block
- uint16_t prev_color0 = 0x0000;
- uint16_t prev_color1 = 0x0000;
-
- uint16_t* rowPtr = (uint16_t*)surface;
- for (int base_y = 0; base_y < height; base_y += 4, rowPtr += 4*stride) {
- uint16_t *blockPtr = rowPtr;
- for (int base_x = 0; base_x < width; base_x += 4, blockPtr += 4) {
- uint32_t colors = *d32++;
- uint32_t bits = *d32++;
-
-#if __BYTE_ORDER == __BIG_ENDIAN
- colors = swap(colors);
- bits = swap(bits);
-#endif
-
- // Raw colors
- uint16_t color0 = colors & 0xffff;
- uint16_t color1 = colors >> 16;
-
- // If the new block has the same base colors as the
- // previous one, we don't need to recompute the color
- // table c[]
- if (color0 != prev_color0 || color1 != prev_color1) {
- // Store raw colors for comparison with next block
- prev_color0 = color0;
- prev_color1 = color1;
-
- int r0 = red(color0);
- int g0 = green(color0);
- int b0 = blue(color0);
-
- int r1 = red(color1);
- int g1 = green(color1);
- int b1 = blue(color1);
-
- if (hasAlpha) {
- c[0] = (r0 << 11) | ((g0 >> 1) << 6) | (b0 << 1) | 0x1;
- c[1] = (r1 << 11) | ((g1 >> 1) << 6) | (b1 << 1) | 0x1;
- } else {
- c[0] = color0;
- c[1] = color1;
- }
-
- int r2, g2, b2, r3, g3, b3, a3;
-
- int bbits = bits >> 1;
- bool has2 = ((bbits & ~bits) & 0x55555555) != 0;
- bool has3 = ((bbits & bits) & 0x55555555) != 0;
-
- if (has2 || has3) {
- if (color0 > color1) {
- r2 = avg23(r0, r1);
- g2 = avg23(g0, g1);
- b2 = avg23(b0, b1);
-
- r3 = avg23(r1, r0);
- g3 = avg23(g1, g0);
- b3 = avg23(b1, b0);
- a3 = 1;
- } else {
- r2 = (r0 + r1) >> 1;
- g2 = (g0 + g1) >> 1;
- b2 = (b0 + b1) >> 1;
-
- r3 = g3 = b3 = a3 = 0;
- }
- if (hasAlpha) {
- c[2] = (r2 << 11) | ((g2 >> 1) << 6) |
- (b2 << 1) | 0x1;
- c[3] = (r3 << 11) | ((g3 >> 1) << 6) |
- (b3 << 1) | a3;
- } else {
- c[2] = (r2 << 11) | (g2 << 5) | b2;
- c[3] = (r3 << 11) | (g3 << 5) | b3;
- }
- }
- }
-
- uint16_t* blockRowPtr = blockPtr;
- for (int y = 0; y < 4; y++, blockRowPtr += stride) {
- // Don't process rows past the botom
- if (base_y + y >= height) {
- break;
- }
-
- int w = min(width - base_x, 4);
- for (int x = 0; x < w; x++) {
- int code = bits & 0x3;
- bits >>= 2;
-
- blockRowPtr[x] = c[code];
- }
- }
- }
- }
-}
-
-// Output data as internalformat=GL_RGBA, type=GL_UNSIGNED_BYTE
-static void
-decodeDXT3(const GLvoid *data, int width, int height,
- void *surface, int stride)
-
-{
- init_tables();
-
- uint32_t const *d32 = (uint32_t *)data;
-
- // Specified colors from the previous block
- uint16_t prev_color0 = 0x0000;
- uint16_t prev_color1 = 0x0000;
-
- // Color table for the current block
- uint32_t c[4];
- c[0] = c[1] = c[2] = c[3] = 0;
-
- uint32_t* rowPtr = (uint32_t*)surface;
- for (int base_y = 0; base_y < height; base_y += 4, rowPtr += 4*stride) {
- uint32_t *blockPtr = rowPtr;
- for (int base_x = 0; base_x < width; base_x += 4, blockPtr += 4) {
-
-#if __BYTE_ORDER == __BIG_ENDIAN
- uint32_t alphahi = *d32++;
- uint32_t alphalo = *d32++;
- alphahi = swap(alphahi);
- alphalo = swap(alphalo);
-#else
- uint32_t alphalo = *d32++;
- uint32_t alphahi = *d32++;
-#endif
-
- uint32_t colors = *d32++;
- uint32_t bits = *d32++;
-
-#if __BYTE_ORDER == __BIG_ENDIAN
- colors = swap(colors);
- bits = swap(bits);
-#endif
-
- uint64_t alpha = ((uint64_t)alphahi << 32) | alphalo;
-
- // Raw colors
- uint16_t color0 = colors & 0xffff;
- uint16_t color1 = colors >> 16;
-
- // If the new block has the same base colors as the
- // previous one, we don't need to recompute the color
- // table c[]
- if (color0 != prev_color0 || color1 != prev_color1) {
- // Store raw colors for comparison with next block
- prev_color0 = color0;
- prev_color1 = color1;
-
- int bbits = bits >> 1;
- bool has2 = ((bbits & ~bits) & 0x55555555) != 0;
- bool has3 = ((bbits & bits) & 0x55555555) != 0;
-
- if (has2 || has3) {
- int r0 = red(color0);
- int g0 = green(color0);
- int b0 = blue(color0);
-
- int r1 = red(color1);
- int g1 = green(color1);
- int b1 = blue(color1);
-
- int r2 = avg23(r0, r1);
- int g2 = avg23(g0, g1);
- int b2 = avg23(b0, b1);
-
- int r3 = avg23(r1, r0);
- int g3 = avg23(g1, g0);
- int b3 = avg23(b1, b0);
-
- c[0] = rgb565SepTo888(r0, g0, b0);
- c[1] = rgb565SepTo888(r1, g1, b1);
- c[2] = rgb565SepTo888(r2, g2, b2);
- c[3] = rgb565SepTo888(r3, g3, b3);
- } else {
- // Convert to 8 bits
- c[0] = rgb565To888(color0);
- c[1] = rgb565To888(color1);
- }
- }
-
- uint32_t* blockRowPtr = blockPtr;
- for (int y = 0; y < 4; y++, blockRowPtr += stride) {
- // Don't process rows past the botom
- if (base_y + y >= height) {
- break;
- }
-
- int w = min(width - base_x, 4);
- for (int x = 0; x < w; x++) {
- int a = alpha & 0xf;
- alpha >>= 4;
-
- int code = bits & 0x3;
- bits >>= 2;
-
- blockRowPtr[x] = c[code] | (a << 28) | (a << 24);
- }
- }
- }
- }
-}
-
-// Output data as internalformat=GL_RGBA, type=GL_UNSIGNED_BYTE
-static void
-decodeDXT5(const GLvoid *data, int width, int height,
- void *surface, int stride)
-
-{
- init_tables();
-
- uint32_t const *d32 = (uint32_t *)data;
-
- // Specified alphas from the previous block
- uint8_t prev_alpha0 = 0x00;
- uint8_t prev_alpha1 = 0x00;
-
- // Specified colors from the previous block
- uint16_t prev_color0 = 0x0000;
- uint16_t prev_color1 = 0x0000;
-
- // Alpha table for the current block
- uint8_t a[8];
- a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = 0;
-
- // Color table for the current block
- uint32_t c[4];
- c[0] = c[1] = c[2] = c[3] = 0;
-
- int good_a5 = 0;
- int bad_a5 = 0;
- int good_a6 = 0;
- int bad_a6 = 0;
- int good_a7 = 0;
- int bad_a7 = 0;
-
- uint32_t* rowPtr = (uint32_t*)surface;
- for (int base_y = 0; base_y < height; base_y += 4, rowPtr += 4*stride) {
- uint32_t *blockPtr = rowPtr;
- for (int base_x = 0; base_x < width; base_x += 4, blockPtr += 4) {
-
-#if __BYTE_ORDER == __BIG_ENDIAN
- uint32_t alphahi = *d32++;
- uint32_t alphalo = *d32++;
- alphahi = swap(alphahi);
- alphalo = swap(alphalo);
-#else
- uint32_t alphalo = *d32++;
- uint32_t alphahi = *d32++;
-#endif
-
- uint32_t colors = *d32++;
- uint32_t bits = *d32++;
-
-#if __BYTE_ORDER == __BIG_ENDIANx
- colors = swap(colors);
- bits = swap(bits);
-#endif
-
- uint64_t alpha = ((uint64_t)alphahi << 32) | alphalo;
- uint64_t alpha0 = alpha & 0xff;
- alpha >>= 8;
- uint64_t alpha1 = alpha & 0xff;
- alpha >>= 8;
-
- if (alpha0 != prev_alpha0 || alpha1 != prev_alpha1) {
- prev_alpha0 = alpha0;
- prev_alpha1 = alpha1;
-
- a[0] = alpha0;
- a[1] = alpha1;
- int a01 = alpha0 + alpha1 - 1;
- if (alpha0 > alpha1) {
- a[2] = div7(6*alpha0 + alpha1);
- a[4] = div7(4*alpha0 + 3*alpha1);
- a[6] = div7(2*alpha0 + 5*alpha1);
-
- // Use symmetry to derive half of the values
- // A few values will be off by 1 (~.5%)
- // Alternate which values are computed directly
- // and which are derived to try to reduce bias
- a[3] = a01 - a[6];
- a[5] = a01 - a[4];
- a[7] = a01 - a[2];
- } else {
- a[2] = div5(4*alpha0 + alpha1);
- a[4] = div5(2*alpha0 + 3*alpha1);
- a[3] = a01 - a[4];
- a[5] = a01 - a[2];
- a[6] = 0x00;
- a[7] = 0xff;
- }
- }
-
- // Raw colors
- uint16_t color0 = colors & 0xffff;
- uint16_t color1 = colors >> 16;
-
- // If the new block has the same base colors as the
- // previous one, we don't need to recompute the color
- // table c[]
- if (color0 != prev_color0 || color1 != prev_color1) {
- // Store raw colors for comparison with next block
- prev_color0 = color0;
- prev_color1 = color1;
-
- int bbits = bits >> 1;
- bool has2 = ((bbits & ~bits) & 0x55555555) != 0;
- bool has3 = ((bbits & bits) & 0x55555555) != 0;
-
- if (has2 || has3) {
- int r0 = red(color0);
- int g0 = green(color0);
- int b0 = blue(color0);
-
- int r1 = red(color1);
- int g1 = green(color1);
- int b1 = blue(color1);
-
- int r2 = avg23(r0, r1);
- int g2 = avg23(g0, g1);
- int b2 = avg23(b0, b1);
-
- int r3 = avg23(r1, r0);
- int g3 = avg23(g1, g0);
- int b3 = avg23(b1, b0);
-
- c[0] = rgb565SepTo888(r0, g0, b0);
- c[1] = rgb565SepTo888(r1, g1, b1);
- c[2] = rgb565SepTo888(r2, g2, b2);
- c[3] = rgb565SepTo888(r3, g3, b3);
- } else {
- // Convert to 8 bits
- c[0] = rgb565To888(color0);
- c[1] = rgb565To888(color1);
- }
- }
-
- uint32_t* blockRowPtr = blockPtr;
- for (int y = 0; y < 4; y++, blockRowPtr += stride) {
- // Don't process rows past the botom
- if (base_y + y >= height) {
- break;
- }
-
- int w = min(width - base_x, 4);
- for (int x = 0; x < w; x++) {
- int acode = alpha & 0x7;
- alpha >>= 3;
-
- int code = bits & 0x3;
- bits >>= 2;
-
- blockRowPtr[x] = c[code] | (a[acode] << 24);
- }
- }
- }
- }
-}
-
-/*
- * Decode a DXT-compressed texture into memory. DXT textures consist of
- * a series of 4x4 pixel blocks in left-to-right, top-down order.
- * The number of blocks is given by ceil(width/4)*ceil(height/4).
- *
- * 'data' points to the texture data. 'width' and 'height' indicate the
- * dimensions of the texture. We assume width and height are >= 0 but
- * do not require them to be powers of 2 or divisible by any factor.
- *
- * The output is written to 'surface' with each scanline separated by
- * 'stride' 2- or 4-byte words.
- *
- * 'format' indicates the type of compression and must be one of the following:
- *
- * GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- * The output is written as 5/6/5 opaque RGB (16 bit words).
- * 8 bytes are read from 'data' for each block.
- *
- * GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
- * The output is written as 5/5/5/1 RGBA (16 bit words)
- * 8 bytes are read from 'data' for each block.
- *
- * GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
- * GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
- * The output is written as 8/8/8/8 ARGB (32 bit words)
- * 16 bytes are read from 'data' for each block.
- */
-void
-decodeDXT(const GLvoid *data, int width, int height,
- void *surface, int stride, int format)
-{
-#if TIMING
- struct timeval start_t, end_t;
- struct timezone tz;
-
- gettimeofday(&start_t, &tz);
-#endif
-
- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- decodeDXT1(data, width, height, surface, stride, false);
- break;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- decodeDXT1(data, width, height, surface, stride, true);
- break;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- decodeDXT3(data, width, height, surface, stride);
- break;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- decodeDXT5(data, width, height, surface, stride);
- break;
- }
-
-#if TIMING
- gettimeofday(&end_t, &tz);
- long usec = (end_t.tv_sec - start_t.tv_sec)*1000000 +
- (end_t.tv_usec - start_t.tv_usec);
-
- printf("Loaded w=%d h=%d in %ld usec\n", width, height, usec);
-#endif
-}
-
-} // namespace android
diff --git a/opengl/libagl/dxt.h b/opengl/libagl/dxt.h
deleted file mode 100644
index d95a36c..0000000
--- a/opengl/libagl/dxt.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* libs/opengles/dxt.h
-**
-** Copyright 2007, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_TEXTURE_H
-#define ANDROID_OPENGLES_TEXTURE_H
-
-#include <stdlib.h>
-
-#include <GLES/gl.h>
-
-namespace android {
-
- bool DXT1HasAlpha(const GLvoid *data, int width, int height);
- void decodeDXT(const GLvoid *data, int width, int height,
- void *surface, int stride, int format);
-
-} // namespace android
-
-#endif // ANDROID_OPENGLES_TEXTURE_H
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
deleted file mode 100644
index 92d32a2..0000000
--- a/opengl/libagl/egl.cpp
+++ /dev/null
@@ -1,2079 +0,0 @@
-/*
-**
-** Copyright 2007 The Android Open Source Project
-**
-** 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.
-*/
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-
-#include <utils/threads.h>
-#include <ui/ANativeObjectBase.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <pixelflinger/format.h>
-#include <pixelflinger/pixelflinger.h>
-
-#include "context.h"
-#include "state.h"
-#include "texture.h"
-#include "matrix.h"
-
-#undef NELEM
-#define NELEM(x) (sizeof(x)/sizeof(*(x)))
-
-// ----------------------------------------------------------------------------
-
-EGLBoolean EGLAPI eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
- EGLint left, EGLint top, EGLint width, EGLint height);
-
-// ----------------------------------------------------------------------------
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-const unsigned int NUM_DISPLAYS = 1;
-
-static pthread_mutex_t gInitMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t gErrorKeyMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_key_t gEGLErrorKey = -1;
-#ifndef HAVE_ANDROID_OS
-namespace gl {
-pthread_key_t gGLKey = -1;
-}; // namespace gl
-#endif
-
-template<typename T>
-static T setError(GLint error, T returnValue) {
- if (ggl_unlikely(gEGLErrorKey == -1)) {
- pthread_mutex_lock(&gErrorKeyMutex);
- if (gEGLErrorKey == -1)
- pthread_key_create(&gEGLErrorKey, NULL);
- pthread_mutex_unlock(&gErrorKeyMutex);
- }
- pthread_setspecific(gEGLErrorKey, (void*)error);
- return returnValue;
-}
-
-static GLint getError() {
- if (ggl_unlikely(gEGLErrorKey == -1))
- return EGL_SUCCESS;
- GLint error = (GLint)pthread_getspecific(gEGLErrorKey);
- if (error == 0) {
- // The TLS key has been created by another thread, but the value for
- // this thread has not been initialized.
- return EGL_SUCCESS;
- }
- pthread_setspecific(gEGLErrorKey, (void*)EGL_SUCCESS);
- return error;
-}
-
-// ----------------------------------------------------------------------------
-
-struct egl_display_t
-{
- egl_display_t() : type(0), initialized(0) { }
-
- static egl_display_t& get_display(EGLDisplay dpy);
-
- static EGLBoolean is_valid(EGLDisplay dpy) {
- return ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS) ? EGL_FALSE : EGL_TRUE;
- }
-
- NativeDisplayType type;
- volatile int32_t initialized;
-};
-
-static egl_display_t gDisplays[NUM_DISPLAYS];
-
-egl_display_t& egl_display_t::get_display(EGLDisplay dpy) {
- return gDisplays[uintptr_t(dpy)-1U];
-}
-
-struct egl_context_t {
- enum {
- IS_CURRENT = 0x00010000,
- NEVER_CURRENT = 0x00020000
- };
- uint32_t flags;
- EGLDisplay dpy;
- EGLConfig config;
- EGLSurface read;
- EGLSurface draw;
-
- static inline egl_context_t* context(EGLContext ctx) {
- ogles_context_t* const gl = static_cast<ogles_context_t*>(ctx);
- return static_cast<egl_context_t*>(gl->rasterizer.base);
- }
-};
-
-// ----------------------------------------------------------------------------
-
-struct egl_surface_t
-{
- enum {
- PAGE_FLIP = 0x00000001,
- MAGIC = 0x31415265
- };
-
- uint32_t magic;
- EGLDisplay dpy;
- EGLConfig config;
- EGLContext ctx;
-
- egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat);
- virtual ~egl_surface_t();
- bool isValid() const;
- virtual bool initCheck() const = 0;
-
- virtual EGLBoolean bindDrawSurface(ogles_context_t* gl) = 0;
- virtual EGLBoolean bindReadSurface(ogles_context_t* gl) = 0;
- virtual EGLBoolean connect() { return EGL_TRUE; }
- virtual void disconnect() {}
- virtual EGLint getWidth() const = 0;
- virtual EGLint getHeight() const = 0;
-
- virtual EGLint getHorizontalResolution() const;
- virtual EGLint getVerticalResolution() const;
- virtual EGLint getRefreshRate() const;
- virtual EGLint getSwapBehavior() const;
- virtual EGLBoolean swapBuffers();
- virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
-protected:
- GGLSurface depth;
-};
-
-egl_surface_t::egl_surface_t(EGLDisplay dpy,
- EGLConfig config,
- int32_t depthFormat)
- : magic(MAGIC), dpy(dpy), config(config), ctx(0)
-{
- depth.version = sizeof(GGLSurface);
- depth.data = 0;
- depth.format = depthFormat;
-}
-egl_surface_t::~egl_surface_t()
-{
- magic = 0;
- free(depth.data);
-}
-bool egl_surface_t::isValid() const {
- ALOGE_IF(magic != MAGIC, "invalid EGLSurface (%p)", this);
- return magic == MAGIC;
-}
-
-EGLBoolean egl_surface_t::swapBuffers() {
- return EGL_FALSE;
-}
-EGLint egl_surface_t::getHorizontalResolution() const {
- return (0 * EGL_DISPLAY_SCALING) * (1.0f / 25.4f);
-}
-EGLint egl_surface_t::getVerticalResolution() const {
- return (0 * EGL_DISPLAY_SCALING) * (1.0f / 25.4f);
-}
-EGLint egl_surface_t::getRefreshRate() const {
- return (60 * EGL_DISPLAY_SCALING);
-}
-EGLint egl_surface_t::getSwapBehavior() const {
- return EGL_BUFFER_PRESERVED;
-}
-EGLBoolean egl_surface_t::setSwapRectangle(
- EGLint l, EGLint t, EGLint w, EGLint h)
-{
- return EGL_FALSE;
-}
-
-// ----------------------------------------------------------------------------
-
-struct egl_window_surface_v2_t : public egl_surface_t
-{
- egl_window_surface_v2_t(
- EGLDisplay dpy, EGLConfig config,
- int32_t depthFormat,
- ANativeWindow* window);
-
- ~egl_window_surface_v2_t();
-
- virtual bool initCheck() const { return true; } // TODO: report failure if ctor fails
- virtual EGLBoolean swapBuffers();
- virtual EGLBoolean bindDrawSurface(ogles_context_t* gl);
- virtual EGLBoolean bindReadSurface(ogles_context_t* gl);
- virtual EGLBoolean connect();
- virtual void disconnect();
- virtual EGLint getWidth() const { return width; }
- virtual EGLint getHeight() const { return height; }
- virtual EGLint getHorizontalResolution() const;
- virtual EGLint getVerticalResolution() const;
- virtual EGLint getRefreshRate() const;
- virtual EGLint getSwapBehavior() const;
- virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
-
-private:
- status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr);
- status_t unlock(ANativeWindowBuffer* buf);
- ANativeWindow* nativeWindow;
- ANativeWindowBuffer* buffer;
- ANativeWindowBuffer* previousBuffer;
- gralloc_module_t const* module;
- int width;
- int height;
- void* bits;
- GGLFormat const* pixelFormatTable;
-
- struct Rect {
- inline Rect() { };
- inline Rect(int32_t w, int32_t h)
- : left(0), top(0), right(w), bottom(h) { }
- inline Rect(int32_t l, int32_t t, int32_t r, int32_t b)
- : left(l), top(t), right(r), bottom(b) { }
- Rect& andSelf(const Rect& r) {
- left = max(left, r.left);
- top = max(top, r.top);
- right = min(right, r.right);
- bottom = min(bottom, r.bottom);
- return *this;
- }
- bool isEmpty() const {
- return (left>=right || top>=bottom);
- }
- void dump(char const* what) {
- ALOGD("%s { %5d, %5d, w=%5d, h=%5d }",
- what, left, top, right-left, bottom-top);
- }
-
- int32_t left;
- int32_t top;
- int32_t right;
- int32_t bottom;
- };
-
- struct Region {
- inline Region() : count(0) { }
- typedef Rect const* const_iterator;
- const_iterator begin() const { return storage; }
- const_iterator end() const { return storage+count; }
- static Region subtract(const Rect& lhs, const Rect& rhs) {
- Region reg;
- Rect* storage = reg.storage;
- if (!lhs.isEmpty()) {
- if (lhs.top < rhs.top) { // top rect
- storage->left = lhs.left;
- storage->top = lhs.top;
- storage->right = lhs.right;
- storage->bottom = rhs.top;
- storage++;
- }
- const int32_t top = max(lhs.top, rhs.top);
- const int32_t bot = min(lhs.bottom, rhs.bottom);
- if (top < bot) {
- if (lhs.left < rhs.left) { // left-side rect
- storage->left = lhs.left;
- storage->top = top;
- storage->right = rhs.left;
- storage->bottom = bot;
- storage++;
- }
- if (lhs.right > rhs.right) { // right-side rect
- storage->left = rhs.right;
- storage->top = top;
- storage->right = lhs.right;
- storage->bottom = bot;
- storage++;
- }
- }
- if (lhs.bottom > rhs.bottom) { // bottom rect
- storage->left = lhs.left;
- storage->top = rhs.bottom;
- storage->right = lhs.right;
- storage->bottom = lhs.bottom;
- storage++;
- }
- reg.count = storage - reg.storage;
- }
- return reg;
- }
- bool isEmpty() const {
- return count<=0;
- }
- private:
- Rect storage[4];
- ssize_t count;
- };
-
- void copyBlt(
- ANativeWindowBuffer* dst, void* dst_vaddr,
- ANativeWindowBuffer* src, void const* src_vaddr,
- const Region& clip);
-
- Rect dirtyRegion;
- Rect oldDirtyRegion;
-};
-
-egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
- EGLConfig config,
- int32_t depthFormat,
- ANativeWindow* window)
- : egl_surface_t(dpy, config, depthFormat),
- nativeWindow(window), buffer(0), previousBuffer(0), module(0),
- bits(NULL)
-{
- hw_module_t const* pModule;
- hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule);
- module = reinterpret_cast<gralloc_module_t const*>(pModule);
-
- pixelFormatTable = gglGetPixelFormatTable();
-
- // keep a reference on the window
- nativeWindow->common.incRef(&nativeWindow->common);
- nativeWindow->query(nativeWindow, NATIVE_WINDOW_WIDTH, &width);
- nativeWindow->query(nativeWindow, NATIVE_WINDOW_HEIGHT, &height);
-}
-
-egl_window_surface_v2_t::~egl_window_surface_v2_t() {
- if (buffer) {
- buffer->common.decRef(&buffer->common);
- }
- if (previousBuffer) {
- previousBuffer->common.decRef(&previousBuffer->common);
- }
- nativeWindow->common.decRef(&nativeWindow->common);
-}
-
-EGLBoolean egl_window_surface_v2_t::connect()
-{
- // we're intending to do software rendering
- native_window_set_usage(nativeWindow,
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
-
- // dequeue a buffer
- if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) != NO_ERROR) {
- return setError(EGL_BAD_ALLOC, EGL_FALSE);
- }
-
- // allocate a corresponding depth-buffer
- width = buffer->width;
- height = buffer->height;
- if (depth.format) {
- depth.width = width;
- depth.height = height;
- depth.stride = depth.width; // use the width here
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
- if (depth.data == 0) {
- return setError(EGL_BAD_ALLOC, EGL_FALSE);
- }
- }
-
- // keep a reference on the buffer
- buffer->common.incRef(&buffer->common);
-
- // Lock the buffer
- nativeWindow->lockBuffer(nativeWindow, buffer);
- // pin the buffer down
- if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN |
- GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) {
- ALOGE("connect() failed to lock buffer %p (%ux%u)",
- buffer, buffer->width, buffer->height);
- return setError(EGL_BAD_ACCESS, EGL_FALSE);
- // FIXME: we should make sure we're not accessing the buffer anymore
- }
- return EGL_TRUE;
-}
-
-void egl_window_surface_v2_t::disconnect()
-{
- if (buffer && bits) {
- bits = NULL;
- unlock(buffer);
- }
- // enqueue the last frame
- nativeWindow->queueBuffer(nativeWindow, buffer);
- if (buffer) {
- buffer->common.decRef(&buffer->common);
- buffer = 0;
- }
- if (previousBuffer) {
- previousBuffer->common.decRef(&previousBuffer->common);
- previousBuffer = 0;
- }
-}
-
-status_t egl_window_surface_v2_t::lock(
- ANativeWindowBuffer* buf, int usage, void** vaddr)
-{
- int err;
-
- err = module->lock(module, buf->handle,
- usage, 0, 0, buf->width, buf->height, vaddr);
-
- return err;
-}
-
-status_t egl_window_surface_v2_t::unlock(ANativeWindowBuffer* buf)
-{
- if (!buf) return BAD_VALUE;
- int err = NO_ERROR;
-
- err = module->unlock(module, buf->handle);
-
- return err;
-}
-
-void egl_window_surface_v2_t::copyBlt(
- ANativeWindowBuffer* dst, void* dst_vaddr,
- ANativeWindowBuffer* src, void const* src_vaddr,
- const Region& clip)
-{
- // NOTE: dst and src must be the same format
-
- Region::const_iterator cur = clip.begin();
- Region::const_iterator end = clip.end();
-
- const size_t bpp = pixelFormatTable[src->format].size;
- const size_t dbpr = dst->stride * bpp;
- const size_t sbpr = src->stride * bpp;
-
- uint8_t const * const src_bits = (uint8_t const *)src_vaddr;
- uint8_t * const dst_bits = (uint8_t *)dst_vaddr;
-
- while (cur != end) {
- const Rect& r(*cur++);
- ssize_t w = r.right - r.left;
- ssize_t h = r.bottom - r.top;
- if (w <= 0 || h<=0) continue;
- size_t size = w * bpp;
- uint8_t const * s = src_bits + (r.left + src->stride * r.top) * bpp;
- uint8_t * d = dst_bits + (r.left + dst->stride * r.top) * bpp;
- if (dbpr==sbpr && size==sbpr) {
- size *= h;
- h = 1;
- }
- do {
- memcpy(d, s, size);
- d += dbpr;
- s += sbpr;
- } while (--h > 0);
- }
-}
-
-EGLBoolean egl_window_surface_v2_t::swapBuffers()
-{
- if (!buffer) {
- return setError(EGL_BAD_ACCESS, EGL_FALSE);
- }
-
- /*
- * Handle eglSetSwapRectangleANDROID()
- * We copyback from the front buffer
- */
- if (!dirtyRegion.isEmpty()) {
- dirtyRegion.andSelf(Rect(buffer->width, buffer->height));
- if (previousBuffer) {
- // This was const Region copyBack, but that causes an
- // internal compile error on simulator builds
- /*const*/ Region copyBack(Region::subtract(oldDirtyRegion, dirtyRegion));
- if (!copyBack.isEmpty()) {
- void* prevBits;
- if (lock(previousBuffer,
- GRALLOC_USAGE_SW_READ_OFTEN, &prevBits) == NO_ERROR) {
- // copy from previousBuffer to buffer
- copyBlt(buffer, bits, previousBuffer, prevBits, copyBack);
- unlock(previousBuffer);
- }
- }
- }
- oldDirtyRegion = dirtyRegion;
- }
-
- if (previousBuffer) {
- previousBuffer->common.decRef(&previousBuffer->common);
- previousBuffer = 0;
- }
-
- unlock(buffer);
- previousBuffer = buffer;
- nativeWindow->queueBuffer(nativeWindow, buffer);
- buffer = 0;
-
- // dequeue a new buffer
- if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) == NO_ERROR) {
-
- // TODO: lockBuffer should rather be executed when the very first
- // direct rendering occurs.
- nativeWindow->lockBuffer(nativeWindow, buffer);
-
- // reallocate the depth-buffer if needed
- if ((width != buffer->width) || (height != buffer->height)) {
- // TODO: we probably should reset the swap rect here
- // if the window size has changed
- width = buffer->width;
- height = buffer->height;
- if (depth.data) {
- free(depth.data);
- depth.width = width;
- depth.height = height;
- depth.stride = buffer->stride;
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
- if (depth.data == 0) {
- setError(EGL_BAD_ALLOC, EGL_FALSE);
- return EGL_FALSE;
- }
- }
- }
-
- // keep a reference on the buffer
- buffer->common.incRef(&buffer->common);
-
- // finally pin the buffer down
- if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN |
- GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) {
- ALOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)",
- buffer, buffer->width, buffer->height);
- return setError(EGL_BAD_ACCESS, EGL_FALSE);
- // FIXME: we should make sure we're not accessing the buffer anymore
- }
- } else {
- return setError(EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
- }
-
- return EGL_TRUE;
-}
-
-EGLBoolean egl_window_surface_v2_t::setSwapRectangle(
- EGLint l, EGLint t, EGLint w, EGLint h)
-{
- dirtyRegion = Rect(l, t, l+w, t+h);
- return EGL_TRUE;
-}
-
-EGLBoolean egl_window_surface_v2_t::bindDrawSurface(ogles_context_t* gl)
-{
- GGLSurface buffer;
- buffer.version = sizeof(GGLSurface);
- buffer.width = this->buffer->width;
- buffer.height = this->buffer->height;
- buffer.stride = this->buffer->stride;
- buffer.data = (GGLubyte*)bits;
- buffer.format = this->buffer->format;
- gl->rasterizer.procs.colorBuffer(gl, &buffer);
- if (depth.data != gl->rasterizer.state.buffers.depth.data)
- gl->rasterizer.procs.depthBuffer(gl, &depth);
-
- return EGL_TRUE;
-}
-EGLBoolean egl_window_surface_v2_t::bindReadSurface(ogles_context_t* gl)
-{
- GGLSurface buffer;
- buffer.version = sizeof(GGLSurface);
- buffer.width = this->buffer->width;
- buffer.height = this->buffer->height;
- buffer.stride = this->buffer->stride;
- buffer.data = (GGLubyte*)bits; // FIXME: hopefully is is LOCKED!!!
- buffer.format = this->buffer->format;
- gl->rasterizer.procs.readBuffer(gl, &buffer);
- return EGL_TRUE;
-}
-EGLint egl_window_surface_v2_t::getHorizontalResolution() const {
- return (nativeWindow->xdpi * EGL_DISPLAY_SCALING) * (1.0f / 25.4f);
-}
-EGLint egl_window_surface_v2_t::getVerticalResolution() const {
- return (nativeWindow->ydpi * EGL_DISPLAY_SCALING) * (1.0f / 25.4f);
-}
-EGLint egl_window_surface_v2_t::getRefreshRate() const {
- return (60 * EGL_DISPLAY_SCALING); // FIXME
-}
-EGLint egl_window_surface_v2_t::getSwapBehavior() const
-{
- /*
- * EGL_BUFFER_PRESERVED means that eglSwapBuffers() completely preserves
- * the content of the swapped buffer.
- *
- * EGL_BUFFER_DESTROYED means that the content of the buffer is lost.
- *
- * However when ANDROID_swap_retcangle is supported, EGL_BUFFER_DESTROYED
- * only applies to the area specified by eglSetSwapRectangleANDROID(), that
- * is, everything outside of this area is preserved.
- *
- * This implementation of EGL assumes the later case.
- *
- */
-
- return EGL_BUFFER_DESTROYED;
-}
-
-// ----------------------------------------------------------------------------
-
-struct egl_pixmap_surface_t : public egl_surface_t
-{
- egl_pixmap_surface_t(
- EGLDisplay dpy, EGLConfig config,
- int32_t depthFormat,
- egl_native_pixmap_t const * pixmap);
-
- virtual ~egl_pixmap_surface_t() { }
-
- virtual bool initCheck() const { return !depth.format || depth.data!=0; }
- virtual EGLBoolean bindDrawSurface(ogles_context_t* gl);
- virtual EGLBoolean bindReadSurface(ogles_context_t* gl);
- virtual EGLint getWidth() const { return nativePixmap.width; }
- virtual EGLint getHeight() const { return nativePixmap.height; }
-private:
- egl_native_pixmap_t nativePixmap;
-};
-
-egl_pixmap_surface_t::egl_pixmap_surface_t(EGLDisplay dpy,
- EGLConfig config,
- int32_t depthFormat,
- egl_native_pixmap_t const * pixmap)
- : egl_surface_t(dpy, config, depthFormat), nativePixmap(*pixmap)
-{
- if (depthFormat) {
- depth.width = pixmap->width;
- depth.height = pixmap->height;
- depth.stride = depth.width; // use the width here
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
- if (depth.data == 0) {
- setError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
- }
- }
-}
-EGLBoolean egl_pixmap_surface_t::bindDrawSurface(ogles_context_t* gl)
-{
- GGLSurface buffer;
- buffer.version = sizeof(GGLSurface);
- buffer.width = nativePixmap.width;
- buffer.height = nativePixmap.height;
- buffer.stride = nativePixmap.stride;
- buffer.data = nativePixmap.data;
- buffer.format = nativePixmap.format;
-
- gl->rasterizer.procs.colorBuffer(gl, &buffer);
- if (depth.data != gl->rasterizer.state.buffers.depth.data)
- gl->rasterizer.procs.depthBuffer(gl, &depth);
- return EGL_TRUE;
-}
-EGLBoolean egl_pixmap_surface_t::bindReadSurface(ogles_context_t* gl)
-{
- GGLSurface buffer;
- buffer.version = sizeof(GGLSurface);
- buffer.width = nativePixmap.width;
- buffer.height = nativePixmap.height;
- buffer.stride = nativePixmap.stride;
- buffer.data = nativePixmap.data;
- buffer.format = nativePixmap.format;
- gl->rasterizer.procs.readBuffer(gl, &buffer);
- return EGL_TRUE;
-}
-
-// ----------------------------------------------------------------------------
-
-struct egl_pbuffer_surface_t : public egl_surface_t
-{
- egl_pbuffer_surface_t(
- EGLDisplay dpy, EGLConfig config, int32_t depthFormat,
- int32_t w, int32_t h, int32_t f);
-
- virtual ~egl_pbuffer_surface_t();
-
- virtual bool initCheck() const { return pbuffer.data != 0; }
- virtual EGLBoolean bindDrawSurface(ogles_context_t* gl);
- virtual EGLBoolean bindReadSurface(ogles_context_t* gl);
- virtual EGLint getWidth() const { return pbuffer.width; }
- virtual EGLint getHeight() const { return pbuffer.height; }
-private:
- GGLSurface pbuffer;
-};
-
-egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy,
- EGLConfig config, int32_t depthFormat,
- int32_t w, int32_t h, int32_t f)
- : egl_surface_t(dpy, config, depthFormat)
-{
- size_t size = w*h;
- switch (f) {
- case GGL_PIXEL_FORMAT_A_8: size *= 1; break;
- case GGL_PIXEL_FORMAT_RGB_565: size *= 2; break;
- case GGL_PIXEL_FORMAT_RGBA_8888: size *= 4; break;
- case GGL_PIXEL_FORMAT_RGBX_8888: size *= 4; break;
- default:
- ALOGE("incompatible pixel format for pbuffer (format=%d)", f);
- pbuffer.data = 0;
- break;
- }
- pbuffer.version = sizeof(GGLSurface);
- pbuffer.width = w;
- pbuffer.height = h;
- pbuffer.stride = w;
- pbuffer.data = (GGLubyte*)malloc(size);
- pbuffer.format = f;
-
- if (depthFormat) {
- depth.width = pbuffer.width;
- depth.height = pbuffer.height;
- depth.stride = depth.width; // use the width here
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
- if (depth.data == 0) {
- setError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
- return;
- }
- }
-}
-egl_pbuffer_surface_t::~egl_pbuffer_surface_t() {
- free(pbuffer.data);
-}
-EGLBoolean egl_pbuffer_surface_t::bindDrawSurface(ogles_context_t* gl)
-{
- gl->rasterizer.procs.colorBuffer(gl, &pbuffer);
- if (depth.data != gl->rasterizer.state.buffers.depth.data)
- gl->rasterizer.procs.depthBuffer(gl, &depth);
- return EGL_TRUE;
-}
-EGLBoolean egl_pbuffer_surface_t::bindReadSurface(ogles_context_t* gl)
-{
- gl->rasterizer.procs.readBuffer(gl, &pbuffer);
- return EGL_TRUE;
-}
-
-// ----------------------------------------------------------------------------
-
-struct config_pair_t {
- GLint key;
- GLint value;
-};
-
-struct configs_t {
- const config_pair_t* array;
- int size;
-};
-
-struct config_management_t {
- GLint key;
- bool (*match)(GLint reqValue, GLint confValue);
- static bool atLeast(GLint reqValue, GLint confValue) {
- return (reqValue == EGL_DONT_CARE) || (confValue >= reqValue);
- }
- static bool exact(GLint reqValue, GLint confValue) {
- return (reqValue == EGL_DONT_CARE) || (confValue == reqValue);
- }
- static bool mask(GLint reqValue, GLint confValue) {
- return (confValue & reqValue) == reqValue;
- }
- static bool ignore(GLint reqValue, GLint confValue) {
- return true;
- }
-};
-
-// ----------------------------------------------------------------------------
-
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 2
-static char const * const gVendorString = "Google Inc.";
-static char const * const gVersionString = "1.2 Android Driver 1.2.0";
-static char const * const gClientApiString = "OpenGL ES";
-static char const * const gExtensionsString =
- "EGL_KHR_image_base "
- // "KHR_image_pixmap "
- "EGL_ANDROID_image_native_buffer "
- "EGL_ANDROID_swap_rectangle "
- ;
-
-// ----------------------------------------------------------------------------
-
-struct extention_map_t {
- const char * const name;
- __eglMustCastToProperFunctionPointerType address;
-};
-
-static const extention_map_t gExtentionMap[] = {
- { "glDrawTexsOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES },
- { "glDrawTexiOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES },
- { "glDrawTexfOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES },
- { "glDrawTexxOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES },
- { "glDrawTexsvOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES },
- { "glDrawTexivOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES },
- { "glDrawTexfvOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES },
- { "glDrawTexxvOES",
- (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES },
- { "glQueryMatrixxOES",
- (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES },
- { "glEGLImageTargetTexture2DOES",
- (__eglMustCastToProperFunctionPointerType)&glEGLImageTargetTexture2DOES },
- { "glEGLImageTargetRenderbufferStorageOES",
- (__eglMustCastToProperFunctionPointerType)&glEGLImageTargetRenderbufferStorageOES },
- { "glClipPlanef",
- (__eglMustCastToProperFunctionPointerType)&glClipPlanef },
- { "glClipPlanex",
- (__eglMustCastToProperFunctionPointerType)&glClipPlanex },
- { "glBindBuffer",
- (__eglMustCastToProperFunctionPointerType)&glBindBuffer },
- { "glBufferData",
- (__eglMustCastToProperFunctionPointerType)&glBufferData },
- { "glBufferSubData",
- (__eglMustCastToProperFunctionPointerType)&glBufferSubData },
- { "glDeleteBuffers",
- (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers },
- { "glGenBuffers",
- (__eglMustCastToProperFunctionPointerType)&glGenBuffers },
- { "eglCreateImageKHR",
- (__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR },
- { "eglDestroyImageKHR",
- (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
- { "eglSetSwapRectangleANDROID",
- (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
-};
-
-/*
- * In the lists below, attributes names MUST be sorted.
- * Additionally, all configs must be sorted according to
- * the EGL specification.
- */
-
-static config_pair_t const config_base_attribute_list[] = {
- { EGL_STENCIL_SIZE, 0 },
- { EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG },
- { EGL_LEVEL, 0 },
- { EGL_MAX_PBUFFER_HEIGHT, GGL_MAX_VIEWPORT_DIMS },
- { EGL_MAX_PBUFFER_PIXELS,
- GGL_MAX_VIEWPORT_DIMS*GGL_MAX_VIEWPORT_DIMS },
- { EGL_MAX_PBUFFER_WIDTH, GGL_MAX_VIEWPORT_DIMS },
- { EGL_NATIVE_RENDERABLE, EGL_TRUE },
- { EGL_NATIVE_VISUAL_ID, 0 },
- { EGL_NATIVE_VISUAL_TYPE, GGL_PIXEL_FORMAT_RGB_565 },
- { EGL_SAMPLES, 0 },
- { EGL_SAMPLE_BUFFERS, 0 },
- { EGL_TRANSPARENT_TYPE, EGL_NONE },
- { EGL_TRANSPARENT_BLUE_VALUE, 0 },
- { EGL_TRANSPARENT_GREEN_VALUE, 0 },
- { EGL_TRANSPARENT_RED_VALUE, 0 },
- { EGL_BIND_TO_TEXTURE_RGBA, EGL_FALSE },
- { EGL_BIND_TO_TEXTURE_RGB, EGL_FALSE },
- { EGL_MIN_SWAP_INTERVAL, 1 },
- { EGL_MAX_SWAP_INTERVAL, 1 },
- { EGL_LUMINANCE_SIZE, 0 },
- { EGL_ALPHA_MASK_SIZE, 0 },
- { EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER },
- { EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT },
- { EGL_CONFORMANT, 0 }
-};
-
-// These configs can override the base attribute list
-// NOTE: when adding a config here, don't forget to update eglCreate*Surface()
-
-// 565 configs
-static config_pair_t const config_0_attribute_list[] = {
- { EGL_BUFFER_SIZE, 16 },
- { EGL_ALPHA_SIZE, 0 },
- { EGL_BLUE_SIZE, 5 },
- { EGL_GREEN_SIZE, 6 },
- { EGL_RED_SIZE, 5 },
- { EGL_DEPTH_SIZE, 0 },
- { EGL_CONFIG_ID, 0 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_RGB_565 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-static config_pair_t const config_1_attribute_list[] = {
- { EGL_BUFFER_SIZE, 16 },
- { EGL_ALPHA_SIZE, 0 },
- { EGL_BLUE_SIZE, 5 },
- { EGL_GREEN_SIZE, 6 },
- { EGL_RED_SIZE, 5 },
- { EGL_DEPTH_SIZE, 16 },
- { EGL_CONFIG_ID, 1 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_RGB_565 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-// RGB 888 configs
-static config_pair_t const config_2_attribute_list[] = {
- { EGL_BUFFER_SIZE, 32 },
- { EGL_ALPHA_SIZE, 0 },
- { EGL_BLUE_SIZE, 8 },
- { EGL_GREEN_SIZE, 8 },
- { EGL_RED_SIZE, 8 },
- { EGL_DEPTH_SIZE, 0 },
- { EGL_CONFIG_ID, 6 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_RGBX_8888 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-static config_pair_t const config_3_attribute_list[] = {
- { EGL_BUFFER_SIZE, 32 },
- { EGL_ALPHA_SIZE, 0 },
- { EGL_BLUE_SIZE, 8 },
- { EGL_GREEN_SIZE, 8 },
- { EGL_RED_SIZE, 8 },
- { EGL_DEPTH_SIZE, 16 },
- { EGL_CONFIG_ID, 7 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_RGBX_8888 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-// 8888 configs
-static config_pair_t const config_4_attribute_list[] = {
- { EGL_BUFFER_SIZE, 32 },
- { EGL_ALPHA_SIZE, 8 },
- { EGL_BLUE_SIZE, 8 },
- { EGL_GREEN_SIZE, 8 },
- { EGL_RED_SIZE, 8 },
- { EGL_DEPTH_SIZE, 0 },
- { EGL_CONFIG_ID, 2 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_RGBA_8888 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-static config_pair_t const config_5_attribute_list[] = {
- { EGL_BUFFER_SIZE, 32 },
- { EGL_ALPHA_SIZE, 8 },
- { EGL_BLUE_SIZE, 8 },
- { EGL_GREEN_SIZE, 8 },
- { EGL_RED_SIZE, 8 },
- { EGL_DEPTH_SIZE, 16 },
- { EGL_CONFIG_ID, 3 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_RGBA_8888 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-// A8 configs
-static config_pair_t const config_6_attribute_list[] = {
- { EGL_BUFFER_SIZE, 8 },
- { EGL_ALPHA_SIZE, 8 },
- { EGL_BLUE_SIZE, 0 },
- { EGL_GREEN_SIZE, 0 },
- { EGL_RED_SIZE, 0 },
- { EGL_DEPTH_SIZE, 0 },
- { EGL_CONFIG_ID, 4 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_A_8 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-static config_pair_t const config_7_attribute_list[] = {
- { EGL_BUFFER_SIZE, 8 },
- { EGL_ALPHA_SIZE, 8 },
- { EGL_BLUE_SIZE, 0 },
- { EGL_GREEN_SIZE, 0 },
- { EGL_RED_SIZE, 0 },
- { EGL_DEPTH_SIZE, 16 },
- { EGL_CONFIG_ID, 5 },
- { EGL_NATIVE_VISUAL_ID, GGL_PIXEL_FORMAT_A_8 },
- { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
-};
-
-static configs_t const gConfigs[] = {
- { config_0_attribute_list, NELEM(config_0_attribute_list) },
- { config_1_attribute_list, NELEM(config_1_attribute_list) },
- { config_2_attribute_list, NELEM(config_2_attribute_list) },
- { config_3_attribute_list, NELEM(config_3_attribute_list) },
- { config_4_attribute_list, NELEM(config_4_attribute_list) },
- { config_5_attribute_list, NELEM(config_5_attribute_list) },
- { config_6_attribute_list, NELEM(config_6_attribute_list) },
- { config_7_attribute_list, NELEM(config_7_attribute_list) },
-};
-
-static config_management_t const gConfigManagement[] = {
- { EGL_BUFFER_SIZE, config_management_t::atLeast },
- { EGL_ALPHA_SIZE, config_management_t::atLeast },
- { EGL_BLUE_SIZE, config_management_t::atLeast },
- { EGL_GREEN_SIZE, config_management_t::atLeast },
- { EGL_RED_SIZE, config_management_t::atLeast },
- { EGL_DEPTH_SIZE, config_management_t::atLeast },
- { EGL_STENCIL_SIZE, config_management_t::atLeast },
- { EGL_CONFIG_CAVEAT, config_management_t::exact },
- { EGL_CONFIG_ID, config_management_t::exact },
- { EGL_LEVEL, config_management_t::exact },
- { EGL_MAX_PBUFFER_HEIGHT, config_management_t::ignore },
- { EGL_MAX_PBUFFER_PIXELS, config_management_t::ignore },
- { EGL_MAX_PBUFFER_WIDTH, config_management_t::ignore },
- { EGL_NATIVE_RENDERABLE, config_management_t::exact },
- { EGL_NATIVE_VISUAL_ID, config_management_t::ignore },
- { EGL_NATIVE_VISUAL_TYPE, config_management_t::exact },
- { EGL_SAMPLES, config_management_t::exact },
- { EGL_SAMPLE_BUFFERS, config_management_t::exact },
- { EGL_SURFACE_TYPE, config_management_t::mask },
- { EGL_TRANSPARENT_TYPE, config_management_t::exact },
- { EGL_TRANSPARENT_BLUE_VALUE, config_management_t::exact },
- { EGL_TRANSPARENT_GREEN_VALUE, config_management_t::exact },
- { EGL_TRANSPARENT_RED_VALUE, config_management_t::exact },
- { EGL_BIND_TO_TEXTURE_RGBA, config_management_t::exact },
- { EGL_BIND_TO_TEXTURE_RGB, config_management_t::exact },
- { EGL_MIN_SWAP_INTERVAL, config_management_t::exact },
- { EGL_MAX_SWAP_INTERVAL, config_management_t::exact },
- { EGL_LUMINANCE_SIZE, config_management_t::atLeast },
- { EGL_ALPHA_MASK_SIZE, config_management_t::atLeast },
- { EGL_COLOR_BUFFER_TYPE, config_management_t::exact },
- { EGL_RENDERABLE_TYPE, config_management_t::mask },
- { EGL_CONFORMANT, config_management_t::mask }
-};
-
-
-static config_pair_t const config_defaults[] = {
- // attributes that are not specified are simply ignored, if a particular
- // one needs not be ignored, it must be specified here, eg:
- // { EGL_SURFACE_TYPE, EGL_WINDOW_BIT },
-};
-
-// ----------------------------------------------------------------------------
-
-static status_t getConfigFormatInfo(EGLint configID,
- int32_t& pixelFormat, int32_t& depthFormat)
-{
- switch(configID) {
- case 0:
- pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
- depthFormat = 0;
- break;
- case 1:
- pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
- depthFormat = GGL_PIXEL_FORMAT_Z_16;
- break;
- case 2:
- pixelFormat = GGL_PIXEL_FORMAT_RGBX_8888;
- depthFormat = 0;
- break;
- case 3:
- pixelFormat = GGL_PIXEL_FORMAT_RGBX_8888;
- depthFormat = GGL_PIXEL_FORMAT_Z_16;
- break;
- case 4:
- pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
- depthFormat = 0;
- break;
- case 5:
- pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
- depthFormat = GGL_PIXEL_FORMAT_Z_16;
- break;
- case 6:
- pixelFormat = GGL_PIXEL_FORMAT_A_8;
- depthFormat = 0;
- break;
- case 7:
- pixelFormat = GGL_PIXEL_FORMAT_A_8;
- depthFormat = GGL_PIXEL_FORMAT_Z_16;
- break;
- default:
- return NAME_NOT_FOUND;
- }
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-template<typename T>
-static int binarySearch(T const sortedArray[], int first, int last, EGLint key)
-{
- while (first <= last) {
- int mid = (first + last) / 2;
- if (key > sortedArray[mid].key) {
- first = mid + 1;
- } else if (key < sortedArray[mid].key) {
- last = mid - 1;
- } else {
- return mid;
- }
- }
- return -1;
-}
-
-static int isAttributeMatching(int i, EGLint attr, EGLint val)
-{
- // look for the attribute in all of our configs
- config_pair_t const* configFound = gConfigs[i].array;
- int index = binarySearch<config_pair_t>(
- gConfigs[i].array,
- 0, gConfigs[i].size-1,
- attr);
- if (index < 0) {
- configFound = config_base_attribute_list;
- index = binarySearch<config_pair_t>(
- config_base_attribute_list,
- 0, NELEM(config_base_attribute_list)-1,
- attr);
- }
- if (index >= 0) {
- // attribute found, check if this config could match
- int cfgMgtIndex = binarySearch<config_management_t>(
- gConfigManagement,
- 0, NELEM(gConfigManagement)-1,
- attr);
- if (cfgMgtIndex >= 0) {
- bool match = gConfigManagement[cfgMgtIndex].match(
- val, configFound[index].value);
- if (match) {
- // this config matches
- return 1;
- }
- } else {
- // attribute not found. this should NEVER happen.
- }
- } else {
- // error, this attribute doesn't exist
- }
- return 0;
-}
-
-static int makeCurrent(ogles_context_t* gl)
-{
- ogles_context_t* current = (ogles_context_t*)getGlThreadSpecific();
- if (gl) {
- egl_context_t* c = egl_context_t::context(gl);
- if (c->flags & egl_context_t::IS_CURRENT) {
- if (current != gl) {
- // it is an error to set a context current, if it's already
- // current to another thread
- return -1;
- }
- } else {
- if (current) {
- // mark the current context as not current, and flush
- glFlush();
- egl_context_t::context(current)->flags &= ~egl_context_t::IS_CURRENT;
- }
- }
- if (!(c->flags & egl_context_t::IS_CURRENT)) {
- // The context is not current, make it current!
- setGlThreadSpecific(gl);
- c->flags |= egl_context_t::IS_CURRENT;
- }
- } else {
- if (current) {
- // mark the current context as not current, and flush
- glFlush();
- egl_context_t::context(current)->flags &= ~egl_context_t::IS_CURRENT;
- }
- // this thread has no context attached to it
- setGlThreadSpecific(0);
- }
- return 0;
-}
-
-static EGLBoolean getConfigAttrib(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value)
-{
- size_t numConfigs = NELEM(gConfigs);
- int index = (int)config;
- if (uint32_t(index) >= numConfigs)
- return setError(EGL_BAD_CONFIG, EGL_FALSE);
-
- int attrIndex;
- attrIndex = binarySearch<config_pair_t>(
- gConfigs[index].array,
- 0, gConfigs[index].size-1,
- attribute);
- if (attrIndex>=0) {
- *value = gConfigs[index].array[attrIndex].value;
- return EGL_TRUE;
- }
-
- attrIndex = binarySearch<config_pair_t>(
- config_base_attribute_list,
- 0, NELEM(config_base_attribute_list)-1,
- attribute);
- if (attrIndex>=0) {
- *value = config_base_attribute_list[attrIndex].value;
- return EGL_TRUE;
- }
- return setError(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-}
-
-static EGLSurface createWindowSurface(EGLDisplay dpy, EGLConfig config,
- NativeWindowType window, const EGLint *attrib_list)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE);
- if (window == 0)
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- EGLint surfaceType;
- if (getConfigAttrib(dpy, config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE)
- return EGL_FALSE;
-
- if (!(surfaceType & EGL_WINDOW_BIT))
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- if (static_cast<ANativeWindow*>(window)->common.magic !=
- ANDROID_NATIVE_WINDOW_MAGIC) {
- return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
- }
-
- EGLint configID;
- if (getConfigAttrib(dpy, config, EGL_CONFIG_ID, &configID) == EGL_FALSE)
- return EGL_FALSE;
-
- int32_t depthFormat;
- int32_t pixelFormat;
- if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) {
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- // FIXME: we don't have access to the pixelFormat here just yet.
- // (it's possible that the surface is not fully initialized)
- // maybe this should be done after the page-flip
- //if (EGLint(info.format) != pixelFormat)
- // return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- egl_surface_t* surface;
- surface = new egl_window_surface_v2_t(dpy, config, depthFormat,
- static_cast<ANativeWindow*>(window));
-
- if (!surface->initCheck()) {
- // there was a problem in the ctor, the error
- // flag has been set.
- delete surface;
- surface = 0;
- }
- return surface;
-}
-
-static EGLSurface createPixmapSurface(EGLDisplay dpy, EGLConfig config,
- NativePixmapType pixmap, const EGLint *attrib_list)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE);
- if (pixmap == 0)
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- EGLint surfaceType;
- if (getConfigAttrib(dpy, config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE)
- return EGL_FALSE;
-
- if (!(surfaceType & EGL_PIXMAP_BIT))
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- if (static_cast<egl_native_pixmap_t*>(pixmap)->version !=
- sizeof(egl_native_pixmap_t)) {
- return setError(EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
- }
-
- EGLint configID;
- if (getConfigAttrib(dpy, config, EGL_CONFIG_ID, &configID) == EGL_FALSE)
- return EGL_FALSE;
-
- int32_t depthFormat;
- int32_t pixelFormat;
- if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) {
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- if (pixmap->format != pixelFormat)
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- egl_surface_t* surface =
- new egl_pixmap_surface_t(dpy, config, depthFormat,
- static_cast<egl_native_pixmap_t*>(pixmap));
-
- if (!surface->initCheck()) {
- // there was a problem in the ctor, the error
- // flag has been set.
- delete surface;
- surface = 0;
- }
- return surface;
-}
-
-static EGLSurface createPbufferSurface(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE);
-
- EGLint surfaceType;
- if (getConfigAttrib(dpy, config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE)
- return EGL_FALSE;
-
- if (!(surfaceType & EGL_PBUFFER_BIT))
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- EGLint configID;
- if (getConfigAttrib(dpy, config, EGL_CONFIG_ID, &configID) == EGL_FALSE)
- return EGL_FALSE;
-
- int32_t depthFormat;
- int32_t pixelFormat;
- if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) {
- return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- int32_t w = 0;
- int32_t h = 0;
- while (attrib_list[0]) {
- if (attrib_list[0] == EGL_WIDTH) w = attrib_list[1];
- if (attrib_list[0] == EGL_HEIGHT) h = attrib_list[1];
- attrib_list+=2;
- }
-
- egl_surface_t* surface =
- new egl_pbuffer_surface_t(dpy, config, depthFormat, w, h, pixelFormat);
-
- if (!surface->initCheck()) {
- // there was a problem in the ctor, the error
- // flag has been set.
- delete surface;
- surface = 0;
- }
- return surface;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-// ----------------------------------------------------------------------------
-// Initialization
-// ----------------------------------------------------------------------------
-
-EGLDisplay eglGetDisplay(NativeDisplayType display)
-{
-#ifndef HAVE_ANDROID_OS
- // this just needs to be done once
- if (gGLKey == -1) {
- pthread_mutex_lock(&gInitMutex);
- if (gGLKey == -1)
- pthread_key_create(&gGLKey, NULL);
- pthread_mutex_unlock(&gInitMutex);
- }
-#endif
- if (display == EGL_DEFAULT_DISPLAY) {
- EGLDisplay dpy = (EGLDisplay)1;
- egl_display_t& d = egl_display_t::get_display(dpy);
- d.type = display;
- return dpy;
- }
- return EGL_NO_DISPLAY;
-}
-
-EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- EGLBoolean res = EGL_TRUE;
- egl_display_t& d = egl_display_t::get_display(dpy);
-
- if (android_atomic_inc(&d.initialized) == 0) {
- // initialize stuff here if needed
- //pthread_mutex_lock(&gInitMutex);
- //pthread_mutex_unlock(&gInitMutex);
- }
-
- if (res == EGL_TRUE) {
- if (major != NULL) *major = VERSION_MAJOR;
- if (minor != NULL) *minor = VERSION_MINOR;
- }
- return res;
-}
-
-EGLBoolean eglTerminate(EGLDisplay dpy)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- EGLBoolean res = EGL_TRUE;
- egl_display_t& d = egl_display_t::get_display(dpy);
- if (android_atomic_dec(&d.initialized) == 1) {
- // TODO: destroy all resources (surfaces, contexts, etc...)
- //pthread_mutex_lock(&gInitMutex);
- //pthread_mutex_unlock(&gInitMutex);
- }
- return res;
-}
-
-// ----------------------------------------------------------------------------
-// configuration
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglGetConfigs( EGLDisplay dpy,
- EGLConfig *configs,
- EGLint config_size, EGLint *num_config)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- GLint numConfigs = NELEM(gConfigs);
- if (!configs) {
- *num_config = numConfigs;
- return EGL_TRUE;
- }
- GLint i;
- for (i=0 ; i<numConfigs && i<config_size ; i++) {
- *configs++ = (EGLConfig)i;
- }
- *num_config = i;
- return EGL_TRUE;
-}
-
-EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- if (ggl_unlikely(num_config==0)) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- if (ggl_unlikely(attrib_list==0)) {
- /*
- * A NULL attrib_list should be treated as though it was an empty
- * one (terminated with EGL_NONE) as defined in
- * section 3.4.1 "Querying Configurations" in the EGL specification.
- */
- static const EGLint dummy = EGL_NONE;
- attrib_list = &dummy;
- }
-
- int numAttributes = 0;
- int numConfigs = NELEM(gConfigs);
- uint32_t possibleMatch = (1<<numConfigs)-1;
- while(possibleMatch && *attrib_list != EGL_NONE) {
- numAttributes++;
- EGLint attr = *attrib_list++;
- EGLint val = *attrib_list++;
- for (int i=0 ; possibleMatch && i<numConfigs ; i++) {
- if (!(possibleMatch & (1<<i)))
- continue;
- if (isAttributeMatching(i, attr, val) == 0) {
- possibleMatch &= ~(1<<i);
- }
- }
- }
-
- // now, handle the attributes which have a useful default value
- for (size_t j=0 ; possibleMatch && j<NELEM(config_defaults) ; j++) {
- // see if this attribute was specified, if not, apply its
- // default value
- if (binarySearch<config_pair_t>(
- (config_pair_t const*)attrib_list,
- 0, numAttributes-1,
- config_defaults[j].key) < 0)
- {
- for (int i=0 ; possibleMatch && i<numConfigs ; i++) {
- if (!(possibleMatch & (1<<i)))
- continue;
- if (isAttributeMatching(i,
- config_defaults[j].key,
- config_defaults[j].value) == 0)
- {
- possibleMatch &= ~(1<<i);
- }
- }
- }
- }
-
- // return the configurations found
- int n=0;
- if (possibleMatch) {
- if (configs) {
- for (int i=0 ; config_size && i<numConfigs ; i++) {
- if (possibleMatch & (1<<i)) {
- *configs++ = (EGLConfig)i;
- config_size--;
- n++;
- }
- }
- } else {
- for (int i=0 ; i<numConfigs ; i++) {
- if (possibleMatch & (1<<i)) {
- n++;
- }
- }
- }
- }
- *num_config = n;
- return EGL_TRUE;
-}
-
-EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- return getConfigAttrib(dpy, config, attribute, value);
-}
-
-// ----------------------------------------------------------------------------
-// surfaces
-// ----------------------------------------------------------------------------
-
-EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
- NativeWindowType window,
- const EGLint *attrib_list)
-{
- return createWindowSurface(dpy, config, window, attrib_list);
-}
-
-EGLSurface eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config,
- NativePixmapType pixmap,
- const EGLint *attrib_list)
-{
- return createPixmapSurface(dpy, config, pixmap, attrib_list);
-}
-
-EGLSurface eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- return createPbufferSurface(dpy, config, attrib_list);
-}
-
-EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface eglSurface)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (eglSurface != EGL_NO_SURFACE) {
- egl_surface_t* surface( static_cast<egl_surface_t*>(eglSurface) );
- if (!surface->isValid())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (surface->dpy != dpy)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (surface->ctx) {
- // FIXME: this surface is current check what the spec says
- surface->disconnect();
- surface->ctx = 0;
- }
- delete surface;
- }
- return EGL_TRUE;
-}
-
-EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface eglSurface,
- EGLint attribute, EGLint *value)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- egl_surface_t* surface = static_cast<egl_surface_t*>(eglSurface);
- if (!surface->isValid())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (surface->dpy != dpy)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- EGLBoolean ret = EGL_TRUE;
- switch (attribute) {
- case EGL_CONFIG_ID:
- ret = getConfigAttrib(dpy, surface->config, EGL_CONFIG_ID, value);
- break;
- case EGL_WIDTH:
- *value = surface->getWidth();
- break;
- case EGL_HEIGHT:
- *value = surface->getHeight();
- break;
- case EGL_LARGEST_PBUFFER:
- // not modified for a window or pixmap surface
- break;
- case EGL_TEXTURE_FORMAT:
- *value = EGL_NO_TEXTURE;
- break;
- case EGL_TEXTURE_TARGET:
- *value = EGL_NO_TEXTURE;
- break;
- case EGL_MIPMAP_TEXTURE:
- *value = EGL_FALSE;
- break;
- case EGL_MIPMAP_LEVEL:
- *value = 0;
- break;
- case EGL_RENDER_BUFFER:
- // TODO: return the real RENDER_BUFFER here
- *value = EGL_BACK_BUFFER;
- break;
- case EGL_HORIZONTAL_RESOLUTION:
- // pixel/mm * EGL_DISPLAY_SCALING
- *value = surface->getHorizontalResolution();
- break;
- case EGL_VERTICAL_RESOLUTION:
- // pixel/mm * EGL_DISPLAY_SCALING
- *value = surface->getVerticalResolution();
- break;
- case EGL_PIXEL_ASPECT_RATIO: {
- // w/h * EGL_DISPLAY_SCALING
- int wr = surface->getHorizontalResolution();
- int hr = surface->getVerticalResolution();
- *value = (wr * EGL_DISPLAY_SCALING) / hr;
- } break;
- case EGL_SWAP_BEHAVIOR:
- *value = surface->getSwapBehavior();
- break;
- default:
- ret = setError(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
- return ret;
-}
-
-EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
- EGLContext share_list, const EGLint *attrib_list)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE);
-
- ogles_context_t* gl = ogles_init(sizeof(egl_context_t));
- if (!gl) return setError(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
-
- egl_context_t* c = static_cast<egl_context_t*>(gl->rasterizer.base);
- c->flags = egl_context_t::NEVER_CURRENT;
- c->dpy = dpy;
- c->config = config;
- c->read = 0;
- c->draw = 0;
- return (EGLContext)gl;
-}
-
-EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- egl_context_t* c = egl_context_t::context(ctx);
- if (c->flags & egl_context_t::IS_CURRENT)
- setGlThreadSpecific(0);
- ogles_uninit((ogles_context_t*)ctx);
- return EGL_TRUE;
-}
-
-EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext ctx)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- if (draw) {
- egl_surface_t* s = (egl_surface_t*)draw;
- if (!s->isValid())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (s->dpy != dpy)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: check that draw is compatible with the context
- }
- if (read && read!=draw) {
- egl_surface_t* s = (egl_surface_t*)read;
- if (!s->isValid())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (s->dpy != dpy)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: check that read is compatible with the context
- }
-
- EGLContext current_ctx = EGL_NO_CONTEXT;
-
- if ((read == EGL_NO_SURFACE && draw == EGL_NO_SURFACE) && (ctx != EGL_NO_CONTEXT))
- return setError(EGL_BAD_MATCH, EGL_FALSE);
-
- if ((read != EGL_NO_SURFACE || draw != EGL_NO_SURFACE) && (ctx == EGL_NO_CONTEXT))
- return setError(EGL_BAD_MATCH, EGL_FALSE);
-
- if (ctx == EGL_NO_CONTEXT) {
- // if we're detaching, we need the current context
- current_ctx = (EGLContext)getGlThreadSpecific();
- } else {
- egl_context_t* c = egl_context_t::context(ctx);
- egl_surface_t* d = (egl_surface_t*)draw;
- egl_surface_t* r = (egl_surface_t*)read;
- if ((d && d->ctx && d->ctx != ctx) ||
- (r && r->ctx && r->ctx != ctx)) {
- // one of the surface is bound to a context in another thread
- return setError(EGL_BAD_ACCESS, EGL_FALSE);
- }
- }
-
- ogles_context_t* gl = (ogles_context_t*)ctx;
- if (makeCurrent(gl) == 0) {
- if (ctx) {
- egl_context_t* c = egl_context_t::context(ctx);
- egl_surface_t* d = (egl_surface_t*)draw;
- egl_surface_t* r = (egl_surface_t*)read;
-
- if (c->draw) {
- egl_surface_t* s = reinterpret_cast<egl_surface_t*>(c->draw);
- s->disconnect();
- }
- if (c->read) {
- // FIXME: unlock/disconnect the read surface too
- }
-
- c->draw = draw;
- c->read = read;
-
- if (c->flags & egl_context_t::NEVER_CURRENT) {
- c->flags &= ~egl_context_t::NEVER_CURRENT;
- GLint w = 0;
- GLint h = 0;
- if (draw) {
- w = d->getWidth();
- h = d->getHeight();
- }
- ogles_surfaceport(gl, 0, 0);
- ogles_viewport(gl, 0, 0, w, h);
- ogles_scissor(gl, 0, 0, w, h);
- }
- if (d) {
- if (d->connect() == EGL_FALSE) {
- return EGL_FALSE;
- }
- d->ctx = ctx;
- d->bindDrawSurface(gl);
- }
- if (r) {
- // FIXME: lock/connect the read surface too
- r->ctx = ctx;
- r->bindReadSurface(gl);
- }
- } else {
- // if surfaces were bound to the context bound to this thread
- // mark then as unbound.
- if (current_ctx) {
- egl_context_t* c = egl_context_t::context(current_ctx);
- egl_surface_t* d = (egl_surface_t*)c->draw;
- egl_surface_t* r = (egl_surface_t*)c->read;
- if (d) {
- c->draw = 0;
- d->ctx = EGL_NO_CONTEXT;
- d->disconnect();
- }
- if (r) {
- c->read = 0;
- r->ctx = EGL_NO_CONTEXT;
- // FIXME: unlock/disconnect the read surface too
- }
- }
- }
- return EGL_TRUE;
- }
- return setError(EGL_BAD_ACCESS, EGL_FALSE);
-}
-
-EGLContext eglGetCurrentContext(void)
-{
- // eglGetCurrentContext returns the current EGL rendering context,
- // as specified by eglMakeCurrent. If no context is current,
- // EGL_NO_CONTEXT is returned.
- return (EGLContext)getGlThreadSpecific();
-}
-
-EGLSurface eglGetCurrentSurface(EGLint readdraw)
-{
- // eglGetCurrentSurface returns the read or draw surface attached
- // to the current EGL rendering context, as specified by eglMakeCurrent.
- // If no context is current, EGL_NO_SURFACE is returned.
- EGLContext ctx = (EGLContext)getGlThreadSpecific();
- if (ctx == EGL_NO_CONTEXT) return EGL_NO_SURFACE;
- egl_context_t* c = egl_context_t::context(ctx);
- if (readdraw == EGL_READ) {
- return c->read;
- } else if (readdraw == EGL_DRAW) {
- return c->draw;
- }
- return setError(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-}
-
-EGLDisplay eglGetCurrentDisplay(void)
-{
- // eglGetCurrentDisplay returns the current EGL display connection
- // for the current EGL rendering context, as specified by eglMakeCurrent.
- // If no context is current, EGL_NO_DISPLAY is returned.
- EGLContext ctx = (EGLContext)getGlThreadSpecific();
- if (ctx == EGL_NO_CONTEXT) return EGL_NO_DISPLAY;
- egl_context_t* c = egl_context_t::context(ctx);
- return c->dpy;
-}
-
-EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- egl_context_t* c = egl_context_t::context(ctx);
- switch (attribute) {
- case EGL_CONFIG_ID:
- // Returns the ID of the EGL frame buffer configuration with
- // respect to which the context was created
- return getConfigAttrib(dpy, c->config, EGL_CONFIG_ID, value);
- }
- return setError(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-}
-
-EGLBoolean eglWaitGL(void)
-{
- return EGL_TRUE;
-}
-
-EGLBoolean eglWaitNative(EGLint engine)
-{
- return EGL_TRUE;
-}
-
-EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- egl_surface_t* d = static_cast<egl_surface_t*>(draw);
- if (!d->isValid())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (d->dpy != dpy)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- // post the surface
- d->swapBuffers();
-
- // if it's bound to a context, update the buffer
- if (d->ctx != EGL_NO_CONTEXT) {
- d->bindDrawSurface((ogles_context_t*)d->ctx);
- // if this surface is also the read surface of the context
- // it is bound to, make sure to update the read buffer as well.
- // The EGL spec is a little unclear about this.
- egl_context_t* c = egl_context_t::context(d->ctx);
- if (c->read == draw) {
- d->bindReadSurface((ogles_context_t*)d->ctx);
- }
- }
-
- return EGL_TRUE;
-}
-
-EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface,
- NativePixmapType target)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: eglCopyBuffers()
- return EGL_FALSE;
-}
-
-EGLint eglGetError(void)
-{
- return getError();
-}
-
-const char* eglQueryString(EGLDisplay dpy, EGLint name)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, (const char*)0);
-
- switch (name) {
- case EGL_VENDOR:
- return gVendorString;
- case EGL_VERSION:
- return gVersionString;
- case EGL_EXTENSIONS:
- return gExtensionsString;
- case EGL_CLIENT_APIS:
- return gClientApiString;
- }
- return setError(EGL_BAD_PARAMETER, (const char *)0);
-}
-
-// ----------------------------------------------------------------------------
-// EGL 1.1
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglSurfaceAttrib(
- EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: eglSurfaceAttrib()
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
-}
-
-EGLBoolean eglBindTexImage(
- EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: eglBindTexImage()
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
-}
-
-EGLBoolean eglReleaseTexImage(
- EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: eglReleaseTexImage()
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
-}
-
-EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- // TODO: eglSwapInterval()
- return EGL_TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// EGL 1.2
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglBindAPI(EGLenum api)
-{
- if (api != EGL_OPENGL_ES_API)
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- return EGL_TRUE;
-}
-
-EGLenum eglQueryAPI(void)
-{
- return EGL_OPENGL_ES_API;
-}
-
-EGLBoolean eglWaitClient(void)
-{
- glFinish();
- return EGL_TRUE;
-}
-
-EGLBoolean eglReleaseThread(void)
-{
- // TODO: eglReleaseThread()
- return EGL_TRUE;
-}
-
-EGLSurface eglCreatePbufferFromClientBuffer(
- EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE);
- // TODO: eglCreatePbufferFromClientBuffer()
- return setError(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-}
-
-// ----------------------------------------------------------------------------
-// EGL_EGLEXT_VERSION 3
-// ----------------------------------------------------------------------------
-
-void (*eglGetProcAddress (const char *procname))()
-{
- extention_map_t const * const map = gExtentionMap;
- for (uint32_t i=0 ; i<NELEM(gExtentionMap) ; i++) {
- if (!strcmp(procname, map[i].name)) {
- return map[i].address;
- }
- }
- return NULL;
-}
-
-EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
- const EGLint *attrib_list)
-{
- EGLBoolean result = EGL_FALSE;
- return result;
-}
-
-EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
-{
- EGLBoolean result = EGL_FALSE;
- return result;
-}
-
-EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
- EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE) {
- return setError(EGL_BAD_DISPLAY, EGL_NO_IMAGE_KHR);
- }
- if (ctx != EGL_NO_CONTEXT) {
- return setError(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
- }
- if (target != EGL_NATIVE_BUFFER_ANDROID) {
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
-
- ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)buffer;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
-
- if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
-
- switch (native_buffer->format) {
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_RGB_888:
- case HAL_PIXEL_FORMAT_RGB_565:
- case HAL_PIXEL_FORMAT_BGRA_8888:
- case HAL_PIXEL_FORMAT_RGBA_5551:
- case HAL_PIXEL_FORMAT_RGBA_4444:
- break;
- default:
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
-
- native_buffer->common.incRef(&native_buffer->common);
- return (EGLImageKHR)native_buffer;
-}
-
-EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE) {
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)img;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
-
- if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
-
- native_buffer->common.decRef(&native_buffer->common);
-
- return EGL_TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// ANDROID extensions
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
- EGLint left, EGLint top, EGLint width, EGLint height)
-{
- if (egl_display_t::is_valid(dpy) == EGL_FALSE)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- egl_surface_t* d = static_cast<egl_surface_t*>(draw);
- if (!d->isValid())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- if (d->dpy != dpy)
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- // post the surface
- d->setSwapRectangle(left, top, width, height);
-
- return EGL_TRUE;
-}
diff --git a/opengl/libagl/fixed_asm.S b/opengl/libagl/fixed_asm.S
deleted file mode 100644
index 05044f2..0000000
--- a/opengl/libagl/fixed_asm.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* libs/opengles/fixed_asm.S
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-
- .text
- .align
-
- .global gglFloatToFixed
- .type gglFloatToFixed, %function
- .global gglFloatToFixedFast
- .type gglFloatToFixedFast, %function
-
-
-/*
- * Converts a float to a s15.16 fixed-point number.
- * this doesn't handle floats out of the [-32768, +32768[ range
- * and doesn't performs round-to-nearest.
- * however, it's very fast :-)
- */
-
-gglFloatToFixedFast:
- movs r1, r0, lsl #1 /* remove bit sign */
- mov r2, #0x8E /* 127 + 15 */
- sub r1, r2, r1, lsr #24 /* compute shift */
- mov r2, r0, lsl #8 /* mantissa<<8 */
- orr r2, r2, #0x80000000 /* add the missing 1 */
- mov r0, r2, lsr r1 /* scale to 16.16 */
- rsbcs r0, r0, #0 /* negate if needed */
- bx lr
-
-/*
- * this version rounds-to-nearest and saturates numbers
- * outside the range (but not NaNs).
- */
-
-gglFloatToFixed:
- mov r1, r0, lsl #1 /* remove bit sign */
- mov r2, #0x8E /* 127 + 15 */
- subs r1, r2, r1, lsr #24 /* compute shift */
- bls 0f /* too big */
- mov r2, r0, lsl #8 /* mantissa<<8 */
- orr r2, r2, #0x80000000 /* add the missing 1 */
- mov r3, r0
- movs r0, r2, lsr r1 /* scale to 16.16 */
- addcs r0, r0, #1 /* round-to-nearest */
- tst r3, #0x80000000 /* negative? */
- rsbne r0, r0, #0 /* negate if needed */
- bx lr
-
-0: ands r0, r0, #0x80000000 /* keep only the sign bit */
- moveq r0, #0x7fffffff /* positive, maximum value */
- bx lr
-
diff --git a/opengl/libagl/fp.cpp b/opengl/libagl/fp.cpp
deleted file mode 100644
index ae5f1fe..0000000
--- a/opengl/libagl/fp.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/* libs/opengles/fp.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include "fp.h"
-
-// ----------------------------------------------------------------------------
-
-#if !defined(__arm__)
-GGLfixed gglFloatToFixed(float v) {
- return GGLfixed(floorf(v * 65536.0f + 0.5f));
-}
-#endif
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-namespace gl {
-
-GLfloat fixedToFloat(GLfixed x)
-{
-#if DEBUG_USE_FLOATS
- return x / 65536.0f;
-#else
- if (!x) return 0;
- const uint32_t s = x & 0x80000000;
- union {
- uint32_t i;
- float f;
- };
- i = s ? -x : x;
- const int c = gglClz(i) - 8;
- i = (c>=0) ? (i<<c) : (i>>-c);
- const uint32_t e = 134 - c;
- i &= ~0x800000;
- i |= e<<23;
- i |= s;
- return f;
-#endif
-}
-
-float sinef(float x)
-{
- const float A = 1.0f / (2.0f*M_PI);
- const float B = -16.0f;
- const float C = 8.0f;
-
- // scale angle for easy argument reduction
- x *= A;
-
- if (fabsf(x) >= 0.5f) {
- // Argument reduction
- x = x - ceilf(x + 0.5f) + 1.0f;
- }
-
- const float y = B*x*fabsf(x) + C*x;
- return 0.2215f * (y*fabsf(y) - y) + y;
-}
-
-float cosinef(float x)
-{
- return sinef(x + float(M_PI/2));
-}
-
-void sincosf(GLfloat angle, GLfloat* s, GLfloat* c) {
- *s = sinef(angle);
- *c = cosinef(angle);
-}
-
-}; // namespace fp_utils
-
-// ----------------------------------------------------------------------------
-}; // namespace android
diff --git a/opengl/libagl/fp.h b/opengl/libagl/fp.h
deleted file mode 100644
index 6d0c183..0000000
--- a/opengl/libagl/fp.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/* libs/opengles/fp.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_FP_H
-#define ANDROID_OPENGLES_FP_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-#include <math.h>
-
-#include <private/pixelflinger/ggl_context.h>
-
-#include <GLES/gl.h>
-
-#define DEBUG_USE_FLOATS 0
-
-// ----------------------------------------------------------------------------
-
-extern "C" GLfixed gglFloatToFixed(float f) __attribute__((const));
-
-// ----------------------------------------------------------------------------
-namespace android {
-
-namespace gl {
-
- GLfloat fixedToFloat(GLfixed) CONST;
-
- void sincosf(GLfloat angle, GLfloat* s, GLfloat* c);
- float sinef(GLfloat x) CONST;
- float cosinef(GLfloat x) CONST;
-
-inline bool cmpf(GLfloat a, GLfloat b) CONST;
-inline bool isZerof(GLfloat) CONST;
-inline bool isOnef(GLfloat) CONST;
-
-inline int isZeroOrNegativef(GLfloat) CONST;
-
-inline int exponent(GLfloat) CONST;
-inline int32_t mantissa(GLfloat) CONST;
-inline GLfloat clampToZerof(GLfloat) CONST;
-inline GLfloat reciprocalf(GLfloat) CONST;
-inline GLfloat rsqrtf(GLfloat) CONST;
-inline GLfloat sqrf(GLfloat) CONST;
-inline GLfloat addExpf(GLfloat v, int e) CONST;
-inline GLfloat mul2f(GLfloat v) CONST;
-inline GLfloat div2f(GLfloat v) CONST;
-inline GLfloat absf(GLfloat v) CONST;
-
-
-/*
- * float fastexpf(float) : a fast approximation of expf(x)
- * give somewhat accurate results for -88 <= x <= 88
- *
- * exp(x) = 2^(x/ln(2))
- * we use the properties of float encoding
- * to get a fast 2^ and linear interpolation
- *
- */
-
-inline float fastexpf(float y) __attribute__((const));
-
-inline float fastexpf(float y)
-{
- union {
- float r;
- int32_t i;
- } u;
-
- // 127*ln(2) = 88
- if (y < -88.0f) {
- u.r = 0.0f;
- } else if (y > 88.0f) {
- u.r = INFINITY;
- } else {
- const float kOneOverLogTwo = (1L<<23) / M_LN2;
- const int32_t kExponentBias = 127L<<23;
- const int32_t e = int32_t(y*kOneOverLogTwo);
- u.i = e + kExponentBias;
- }
-
- return u.r;
-}
-
-
-bool cmpf(GLfloat a, GLfloat b) {
-#if DEBUG_USE_FLOATS
- return a == b;
-#else
- union {
- float f;
- uint32_t i;
- } ua, ub;
- ua.f = a;
- ub.f = b;
- return ua.i == ub.i;
-#endif
-}
-
-bool isZerof(GLfloat v) {
-#if DEBUG_USE_FLOATS
- return v == 0;
-#else
- union {
- float f;
- int32_t i;
- };
- f = v;
- return (i<<1) == 0;
-#endif
-}
-
-bool isOnef(GLfloat v) {
- return cmpf(v, 1.0f);
-}
-
-int isZeroOrNegativef(GLfloat v) {
-#if DEBUG_USE_FLOATS
- return v <= 0;
-#else
- union {
- float f;
- int32_t i;
- };
- f = v;
- return isZerof(v) | (i>>31);
-#endif
-}
-
-int exponent(GLfloat v) {
- union {
- float f;
- uint32_t i;
- };
- f = v;
- return ((i << 1) >> 24) - 127;
-}
-
-int32_t mantissa(GLfloat v) {
- union {
- float f;
- uint32_t i;
- };
- f = v;
- if (!(i&0x7F800000)) return 0;
- const int s = i >> 31;
- i |= (1L<<23);
- i &= ~0xFF000000;
- return s ? -i : i;
-}
-
-GLfloat clampToZerof(GLfloat v) {
-#if DEBUG_USE_FLOATS
- return v<0 ? 0 : (v>1 ? 1 : v);
-#else
- union {
- float f;
- int32_t i;
- };
- f = v;
- i &= ~(i>>31);
- return f;
-#endif
-}
-
-GLfloat reciprocalf(GLfloat v) {
- // XXX: do better
- return 1.0f / v;
-}
-
-GLfloat rsqrtf(GLfloat v) {
- // XXX: do better
- return 1.0f / sqrtf(v);
-}
-
-GLfloat sqrf(GLfloat v) {
- // XXX: do better
- return v*v;
-}
-
-GLfloat addExpf(GLfloat v, int e) {
- union {
- float f;
- int32_t i;
- };
- f = v;
- if (i<<1) { // XXX: deal with over/underflow
- i += int32_t(e)<<23;
- }
- return f;
-}
-
-GLfloat mul2f(GLfloat v) {
-#if DEBUG_USE_FLOATS
- return v*2;
-#else
- return addExpf(v, 1);
-#endif
-}
-
-GLfloat div2f(GLfloat v) {
-#if DEBUG_USE_FLOATS
- return v*0.5f;
-#else
- return addExpf(v, -1);
-#endif
-}
-
-GLfloat absf(GLfloat v) {
-#if DEBUG_USE_FLOATS
- return v<0 ? -v : v;
-#else
- union {
- float f;
- int32_t i;
- };
- f = v;
- i &= ~0x80000000;
- return f;
-#endif
-}
-
-}; // namespace gl
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_FP_H
-
diff --git a/opengl/libagl/iterators.S b/opengl/libagl/iterators.S
deleted file mode 100644
index 8c86482..0000000
--- a/opengl/libagl/iterators.S
+++ /dev/null
@@ -1,89 +0,0 @@
-/* libs/opengles/iterators.S
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-
- .text
- .align
- .arm
-
- .global iterators0032
- .type iterators0032, %function
-
-/*
- * iterators0032
- *
- * MUST BE CALLED FROM ARM CODE
- *
- * r0: const compute_iterators_t* (this)
- * r0 + 0: m_dx01
- * r0 + 4: m_dy10
- * r0 + 8: m_dx20
- * r0 +12: m_dy02
- * r0 +16: m_x0
- * r0 +20: m_y0
- * r0 +24: m_area
- * r0 +28: m_scale
- * r0 +29: m_area_scale;
- * r1: int32_t* (out)
- * r1 + 0: c
- * r1 + 4: dcdx
- * r1 + 8: dcdy
- * r2: c0
- * r3: c1
- * [sp]: c2
- */
-
-iterators0032:
- stmfd sp!, {r4, r5, r6, r7, r8, lr}
- ldr r4, [sp, #4*6]
-
- ldrb r12, [r0, #29]
- sub r3, r3, r2
- sub r4, r4, r2
- sub r12, r12, #16
- mov r3, r3, asr r12
- mov r4, r4, asr r12
-
- ldr r5, [r0, #0]
- ldr r12, [r0, #4]
- smull r8, lr, r4, r5
- ldr r5, [r0, #8]
- smull r6, r7, r4, r12
- ldr r12, [r0, #12]
- smlal r8, lr, r3, r5
- smlal r6, r7, r3, r12
-
- ldr r3, [r0, #16] // m_x0
- ldr r4, [r0, #20] // m_x1
-
- str r6, [r1, #4]
- str r8, [r1, #8]
-
- umull r6, r5, r3, r6
- umull r8, r0, r4, r8
- mla r7, r3, r7, r5
- mla lr, r4, lr, r0
- adds r6, r6, r8
- adc r7, r7, lr
-
- movs r6, r6, lsr #4
- adc r6, r6, r7, lsl #28
- rsb r6, r6, r2, lsl #16
- str r6, [r1, #0]
-
- ldmfd sp!, {r4, r5, r6, r7, r8, pc}
-
diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp
deleted file mode 100644
index ca715db..0000000
--- a/opengl/libagl/light.cpp
+++ /dev/null
@@ -1,876 +0,0 @@
-/* libs/opengles/light.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-#include "context.h"
-#include "fp.h"
-#include "light.h"
-#include "state.h"
-#include "matrix.h"
-
-
-#if defined(__arm__) && defined(__thumb__)
-#warning "light.cpp should not be compiled in thumb on ARM."
-#endif
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-static void invalidate_lighting(ogles_context_t* c);
-static void lightVertexValidate(ogles_context_t* c, vertex_t* v);
-static void lightVertexNop(ogles_context_t* c, vertex_t* v);
-static void lightVertex(ogles_context_t* c, vertex_t* v);
-static void lightVertexMaterial(ogles_context_t* c, vertex_t* v);
-
-static inline void vscale3(GLfixed* d, const GLfixed* m, GLfixed s);
-
-static __attribute__((noinline))
-void vnorm3(GLfixed* d, const GLfixed* a);
-
-static inline void vsa3(GLfixed* d,
- const GLfixed* m, GLfixed s, const GLfixed* a);
-static inline void vss3(GLfixed* d,
- const GLfixed* m, GLfixed s, const GLfixed* a);
-static inline void vmla3(GLfixed* d,
- const GLfixed* m0, const GLfixed* m1, const GLfixed* a);
-static inline void vmul3(GLfixed* d,
- const GLfixed* m0, const GLfixed* m1);
-
-static GLfixed fog_linear(ogles_context_t* c, GLfixed z);
-static GLfixed fog_exp(ogles_context_t* c, GLfixed z);
-static GLfixed fog_exp2(ogles_context_t* c, GLfixed z);
-
-
-// ----------------------------------------------------------------------------
-
-static void init_white(vec4_t& c) {
- c.r = c.g = c.b = c.a = 0x10000;
-}
-
-void ogles_init_light(ogles_context_t* c)
-{
- for (unsigned int i=0 ; i<OGLES_MAX_LIGHTS ; i++) {
- c->lighting.lights[i].ambient.a = 0x10000;
- c->lighting.lights[i].position.z = 0x10000;
- c->lighting.lights[i].spotDir.z = -0x10000;
- c->lighting.lights[i].spotCutoff = gglIntToFixed(180);
- c->lighting.lights[i].attenuation[0] = 0x10000;
- }
- init_white(c->lighting.lights[0].diffuse);
- init_white(c->lighting.lights[0].specular);
-
- c->lighting.front.ambient.r =
- c->lighting.front.ambient.g =
- c->lighting.front.ambient.b = gglFloatToFixed(0.2f);
- c->lighting.front.ambient.a = 0x10000;
- c->lighting.front.diffuse.r =
- c->lighting.front.diffuse.g =
- c->lighting.front.diffuse.b = gglFloatToFixed(0.8f);
- c->lighting.front.diffuse.a = 0x10000;
- c->lighting.front.specular.a = 0x10000;
- c->lighting.front.emission.a = 0x10000;
-
- c->lighting.lightModel.ambient.r =
- c->lighting.lightModel.ambient.g =
- c->lighting.lightModel.ambient.b = gglFloatToFixed(0.2f);
- c->lighting.lightModel.ambient.a = 0x10000;
-
- c->lighting.colorMaterial.face = GL_FRONT_AND_BACK;
- c->lighting.colorMaterial.mode = GL_AMBIENT_AND_DIFFUSE;
-
- c->fog.mode = GL_EXP;
- c->fog.fog = fog_exp;
- c->fog.density = 0x10000;
- c->fog.end = 0x10000;
- c->fog.invEndMinusStart = 0x10000;
-
- invalidate_lighting(c);
-
- c->rasterizer.procs.shadeModel(c, GL_SMOOTH);
- c->lighting.shadeModel = GL_SMOOTH;
-}
-
-void ogles_uninit_light(ogles_context_t* c)
-{
-}
-
-static inline int32_t clampF(GLfixed f) CONST;
-int32_t clampF(GLfixed f) {
- f = (f & ~(f>>31));
- if (f >= 0x10000)
- f = 0x10000;
- return f;
-}
-
-static GLfixed fog_linear(ogles_context_t* c, GLfixed z) {
- return clampF(gglMulx((c->fog.end - ((z<0)?-z:z)), c->fog.invEndMinusStart));
-}
-
-static GLfixed fog_exp(ogles_context_t* c, GLfixed z) {
- const float e = fixedToFloat(gglMulx(c->fog.density, ((z<0)?-z:z)));
- return clampF(gglFloatToFixed(fastexpf(-e)));
-}
-
-static GLfixed fog_exp2(ogles_context_t* c, GLfixed z) {
- const float e = fixedToFloat(gglMulx(c->fog.density, z));
- return clampF(gglFloatToFixed(fastexpf(-e*e)));
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark math helpers
-#endif
-
-static inline
-void vscale3(GLfixed* d, const GLfixed* m, GLfixed s) {
- d[0] = gglMulx(m[0], s);
- d[1] = gglMulx(m[1], s);
- d[2] = gglMulx(m[2], s);
-}
-
-static inline
-void vsa3(GLfixed* d, const GLfixed* m, GLfixed s, const GLfixed* a) {
- d[0] = gglMulAddx(m[0], s, a[0]);
- d[1] = gglMulAddx(m[1], s, a[1]);
- d[2] = gglMulAddx(m[2], s, a[2]);
-}
-
-static inline
-void vss3(GLfixed* d, const GLfixed* m, GLfixed s, const GLfixed* a) {
- d[0] = gglMulSubx(m[0], s, a[0]);
- d[1] = gglMulSubx(m[1], s, a[1]);
- d[2] = gglMulSubx(m[2], s, a[2]);
-}
-
-static inline
-void vmla3(GLfixed* d,
- const GLfixed* m0, const GLfixed* m1, const GLfixed* a)
-{
- d[0] = gglMulAddx(m0[0], m1[0], a[0]);
- d[1] = gglMulAddx(m0[1], m1[1], a[1]);
- d[2] = gglMulAddx(m0[2], m1[2], a[2]);
-}
-
-static inline
-void vmul3(GLfixed* d, const GLfixed* m0, const GLfixed* m1) {
- d[0] = gglMulx(m0[0], m1[0]);
- d[1] = gglMulx(m0[1], m1[1]);
- d[2] = gglMulx(m0[2], m1[2]);
-}
-
-void vnorm3(GLfixed* d, const GLfixed* a)
-{
- // we must take care of overflows when normalizing a vector
- GLfixed n;
- int32_t x = a[0]; x = x>=0 ? x : -x;
- int32_t y = a[1]; y = y>=0 ? y : -y;
- int32_t z = a[2]; z = z>=0 ? z : -z;
- if (ggl_likely(x<=0x6800 && y<=0x6800 && z<= 0x6800)) {
- // in this case this will all fit on 32 bits
- n = x*x + y*y + z*z;
- n = gglSqrtRecipx(n);
- n <<= 8;
- } else {
- // here norm^2 is at least 0x7EC00000 (>>32 == 0.495117)
- n = vsquare3(x, y, z);
- n = gglSqrtRecipx(n);
- }
- vscale3(d, a, n);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark lighting equations
-#endif
-
-static inline void light_picker(ogles_context_t* c)
-{
- if (ggl_likely(!c->lighting.enable)) {
- c->lighting.lightVertex = lightVertexNop;
- return;
- }
- if (c->lighting.colorMaterial.enable) {
- c->lighting.lightVertex = lightVertexMaterial;
- } else {
- c->lighting.lightVertex = lightVertex;
- }
-}
-
-static inline void validate_light_mvi(ogles_context_t* c)
-{
- uint32_t en = c->lighting.enabledLights;
- // Vector from object to viewer, in eye coordinates
- while (en) {
- const int i = 31 - gglClz(en);
- en &= ~(1<<i);
- light_t& l = c->lighting.lights[i];
-#if OBJECT_SPACE_LIGHTING
- c->transforms.mvui.point4(&c->transforms.mvui,
- &l.objPosition, &l.position);
-#else
- l.objPosition = l.position;
-#endif
- vnorm3(l.normalizedObjPosition.v, l.objPosition.v);
- }
- const vec4_t eyeViewer = { 0, 0, 0x10000, 0 };
-#if OBJECT_SPACE_LIGHTING
- c->transforms.mvui.point3(&c->transforms.mvui,
- &c->lighting.objViewer, &eyeViewer);
- vnorm3(c->lighting.objViewer.v, c->lighting.objViewer.v);
-#else
- c->lighting.objViewer = eyeViewer;
-#endif
-}
-
-static inline void validate_light(ogles_context_t* c)
-{
- // if colorMaterial is enabled, we get the color from the vertex
- if (!c->lighting.colorMaterial.enable) {
- material_t& material = c->lighting.front;
- uint32_t en = c->lighting.enabledLights;
- while (en) {
- const int i = 31 - gglClz(en);
- en &= ~(1<<i);
- light_t& l = c->lighting.lights[i];
- vmul3(l.implicitAmbient.v, material.ambient.v, l.ambient.v);
- vmul3(l.implicitDiffuse.v, material.diffuse.v, l.diffuse.v);
- vmul3(l.implicitSpecular.v, material.specular.v, l.specular.v);
-
- // this is just a flag to tell if we have a specular component
- l.implicitSpecular.v[3] =
- l.implicitSpecular.r |
- l.implicitSpecular.g |
- l.implicitSpecular.b;
-
- l.rConstAttenuation = (l.attenuation[1] | l.attenuation[2])==0;
- if (l.rConstAttenuation)
- l.rConstAttenuation = gglRecipFast(l.attenuation[0]);
- }
- // emission and ambient for the whole scene
- vmla3( c->lighting.implicitSceneEmissionAndAmbient.v,
- c->lighting.lightModel.ambient.v,
- material.ambient.v,
- material.emission.v);
- c->lighting.implicitSceneEmissionAndAmbient.a = material.diffuse.a;
- }
- validate_light_mvi(c);
-}
-
-void invalidate_lighting(ogles_context_t* c)
-{
- // TODO: pick lightVertexValidate or lightVertexValidateMVI
- // instead of systematically the heavier lightVertexValidate()
- c->lighting.lightVertex = lightVertexValidate;
-}
-
-void ogles_invalidate_lighting_mvui(ogles_context_t* c)
-{
- invalidate_lighting(c);
-}
-
-void lightVertexNop(ogles_context_t*, vertex_t* v)
-{
- // we should never end-up here
-}
-
-void lightVertexValidateMVI(ogles_context_t* c, vertex_t* v)
-{
- validate_light_mvi(c);
- light_picker(c);
- c->lighting.lightVertex(c, v);
-}
-
-void lightVertexValidate(ogles_context_t* c, vertex_t* v)
-{
- validate_light(c);
- light_picker(c);
- c->lighting.lightVertex(c, v);
-}
-
-void lightVertexMaterial(ogles_context_t* c, vertex_t* v)
-{
- // fetch the material color
- const GLvoid* cp = c->arrays.color.element(
- v->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v->color.v, cp);
-
- // acquire the color-material from the vertex
- material_t& material = c->lighting.front;
- material.ambient =
- material.diffuse = v->color;
- // implicit arguments need to be computed per/vertex
- uint32_t en = c->lighting.enabledLights;
- while (en) {
- const int i = 31 - gglClz(en);
- en &= ~(1<<i);
- light_t& l = c->lighting.lights[i];
- vmul3(l.implicitAmbient.v, material.ambient.v, l.ambient.v);
- vmul3(l.implicitDiffuse.v, material.diffuse.v, l.diffuse.v);
- vmul3(l.implicitSpecular.v, material.specular.v, l.specular.v);
- // this is just a flag to tell if we have a specular component
- l.implicitSpecular.v[3] =
- l.implicitSpecular.r |
- l.implicitSpecular.g |
- l.implicitSpecular.b;
- }
- // emission and ambient for the whole scene
- vmla3( c->lighting.implicitSceneEmissionAndAmbient.v,
- c->lighting.lightModel.ambient.v,
- material.ambient.v,
- material.emission.v);
- c->lighting.implicitSceneEmissionAndAmbient.a = material.diffuse.a;
-
- // now we can light our vertex as usual
- lightVertex(c, v);
-}
-
-void lightVertex(ogles_context_t* c, vertex_t* v)
-{
- // emission and ambient for the whole scene
- vec4_t r = c->lighting.implicitSceneEmissionAndAmbient;
- const vec4_t objViewer = c->lighting.objViewer;
-
- uint32_t en = c->lighting.enabledLights;
- if (ggl_likely(en)) {
- // since we do the lighting in object-space, we don't need to
- // transform each normal. However, we might still have to normalize
- // it if GL_NORMALIZE is enabled.
- vec4_t n;
- c->arrays.normal.fetch(c, n.v,
- c->arrays.normal.element(v->index & vertex_cache_t::INDEX_MASK));
-
-#if !OBJECT_SPACE_LIGHTING
- c->transforms.mvui.point3(&c->transforms.mvui, &n, &n);
-#endif
-
- // TODO: right now we handle GL_RESCALE_NORMALS as if it were
- // GL_NORMALIZE. We could optimize this by scaling mvui
- // appropriately instead.
- if (c->transforms.rescaleNormals)
- vnorm3(n.v, n.v);
-
- const material_t& material = c->lighting.front;
- const int twoSide = c->lighting.lightModel.twoSide;
-
- while (en) {
- const int i = 31 - gglClz(en);
- en &= ~(1<<i);
- const light_t& l = c->lighting.lights[i];
-
- vec4_t d, t;
- GLfixed s;
- GLfixed sqDist = 0x10000;
-
- // compute vertex-to-light vector
- if (ggl_unlikely(l.position.w)) {
- // lightPos/1.0 - vertex/vertex.w == lightPos*vertex.w - vertex
- vss3(d.v, l.objPosition.v, v->obj.w, v->obj.v);
- sqDist = dot3(d.v, d.v);
- vscale3(d.v, d.v, gglSqrtRecipx(sqDist));
- } else {
- // TODO: avoid copy here
- d = l.normalizedObjPosition;
- }
-
- // ambient & diffuse
- s = dot3(n.v, d.v);
- s = (s<0) ? (twoSide?(-s):0) : s;
- vsa3(t.v, l.implicitDiffuse.v, s, l.implicitAmbient.v);
-
- // specular
- if (ggl_unlikely(s && l.implicitSpecular.v[3])) {
- vec4_t h;
- h.x = d.x + objViewer.x;
- h.y = d.y + objViewer.y;
- h.z = d.z + objViewer.z;
- vnorm3(h.v, h.v);
- s = dot3(n.v, h.v);
- s = (s<0) ? (twoSide?(-s):0) : s;
- if (s > 0) {
- s = gglPowx(s, material.shininess);
- vsa3(t.v, l.implicitSpecular.v, s, t.v);
- }
- }
-
- // spot
- if (ggl_unlikely(l.spotCutoff != gglIntToFixed(180))) {
- GLfixed spotAtt = -dot3(l.normalizedSpotDir.v, d.v);
- if (spotAtt >= l.spotCutoffCosine) {
- vscale3(t.v, t.v, gglPowx(spotAtt, l.spotExp));
- }
- }
-
- // attenuation
- if (ggl_unlikely(l.position.w)) {
- if (l.rConstAttenuation) {
- s = l.rConstAttenuation;
- } else {
- s = gglMulAddx(sqDist, l.attenuation[2], l.attenuation[0]);
- if (l.attenuation[1])
- s = gglMulAddx(gglSqrtx(sqDist), l.attenuation[1], s);
- s = gglRecipFast(s);
- }
- vscale3(t.v, t.v, s);
- }
-
- r.r += t.r;
- r.g += t.g;
- r.b += t.b;
- }
- }
- v->color.r = gglClampx(r.r);
- v->color.g = gglClampx(r.g);
- v->color.b = gglClampx(r.b);
- v->color.a = gglClampx(r.a);
- v->flags |= vertex_t::LIT;
-}
-
-static void lightModelx(GLenum pname, GLfixed param, ogles_context_t* c)
-{
- if (ggl_unlikely(pname != GL_LIGHT_MODEL_TWO_SIDE)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->lighting.lightModel.twoSide = param ? GL_TRUE : GL_FALSE;
- invalidate_lighting(c);
-}
-
-static void lightx(GLenum i, GLenum pname, GLfixed param, ogles_context_t* c)
-{
- if (ggl_unlikely(uint32_t(i-GL_LIGHT0) >= OGLES_MAX_LIGHTS)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- light_t& light = c->lighting.lights[i-GL_LIGHT0];
- const GLfixed kDegToRad = GLfixed((M_PI * gglIntToFixed(1)) / 180.0f);
- switch (pname) {
- case GL_SPOT_EXPONENT:
- if (GGLfixed(param) >= gglIntToFixed(128)) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- light.spotExp = param;
- break;
- case GL_SPOT_CUTOFF:
- if (param!=gglIntToFixed(180) && GGLfixed(param)>=gglIntToFixed(90)) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- light.spotCutoff = param;
- light.spotCutoffCosine =
- gglFloatToFixed(cosinef((M_PI/(180.0f*65536.0f))*param));
- break;
- case GL_CONSTANT_ATTENUATION:
- if (param < 0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- light.attenuation[0] = param;
- break;
- case GL_LINEAR_ATTENUATION:
- if (param < 0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- light.attenuation[1] = param;
- break;
- case GL_QUADRATIC_ATTENUATION:
- if (param < 0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- light.attenuation[2] = param;
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- invalidate_lighting(c);
-}
-
-static void lightxv(GLenum i, GLenum pname, const GLfixed *params, ogles_context_t* c)
-{
- if (ggl_unlikely(uint32_t(i-GL_LIGHT0) >= OGLES_MAX_LIGHTS)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- GLfixed* what;
- light_t& light = c->lighting.lights[i-GL_LIGHT0];
- switch (pname) {
- case GL_AMBIENT:
- what = light.ambient.v;
- break;
- case GL_DIFFUSE:
- what = light.diffuse.v;
- break;
- case GL_SPECULAR:
- what = light.specular.v;
- break;
- case GL_POSITION: {
- ogles_validate_transform(c, transform_state_t::MODELVIEW);
- transform_t& mv = c->transforms.modelview.transform;
- mv.point4(&mv, &light.position, reinterpret_cast<vec4_t const*>(params));
- invalidate_lighting(c);
- return;
- }
- case GL_SPOT_DIRECTION: {
-#if OBJECT_SPACE_LIGHTING
- ogles_validate_transform(c, transform_state_t::MVUI);
- transform_t& mvui = c->transforms.mvui;
- mvui.point3(&mvui, &light.spotDir, reinterpret_cast<vec4_t const*>(params));
-#else
- light.spotDir = *reinterpret_cast<vec4_t const*>(params);
-#endif
- vnorm3(light.normalizedSpotDir.v, light.spotDir.v);
- invalidate_lighting(c);
- return;
- }
- default:
- lightx(i, pname, params[0], c);
- return;
- }
- what[0] = params[0];
- what[1] = params[1];
- what[2] = params[2];
- what[3] = params[3];
- invalidate_lighting(c);
-}
-
-static void materialx(GLenum face, GLenum pname, GLfixed param, ogles_context_t* c)
-{
- if (ggl_unlikely(face != GL_FRONT_AND_BACK)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (ggl_unlikely(pname != GL_SHININESS)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->lighting.front.shininess = param;
- invalidate_lighting(c);
-}
-
-static void fogx(GLenum pname, GLfixed param, ogles_context_t* c)
-{
- switch (pname) {
- case GL_FOG_DENSITY:
- if (param >= 0) {
- c->fog.density = param;
- break;
- }
- ogles_error(c, GL_INVALID_VALUE);
- break;
- case GL_FOG_START:
- c->fog.start = param;
- c->fog.invEndMinusStart = gglRecip(c->fog.end - c->fog.start);
- break;
- case GL_FOG_END:
- c->fog.end = param;
- c->fog.invEndMinusStart = gglRecip(c->fog.end - c->fog.start);
- break;
- case GL_FOG_MODE:
- switch (param) {
- case GL_LINEAR:
- c->fog.mode = param;
- c->fog.fog = fog_linear;
- break;
- case GL_EXP:
- c->fog.mode = param;
- c->fog.fog = fog_exp;
- break;
- case GL_EXP2:
- c->fog.mode = param;
- c->fog.fog = fog_exp2;
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- break;
- }
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- break;
- }
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-#if 0
-#pragma mark -
-#pragma mark lighting APIs
-#endif
-
-void glShadeModel(GLenum mode)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (ggl_unlikely(mode != GL_SMOOTH && mode != GL_FLAT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->lighting.shadeModel = mode;
-}
-
-void glLightModelf(GLenum pname, GLfloat param)
-{
- ogles_context_t* c = ogles_context_t::get();
- lightModelx(pname, gglFloatToFixed(param), c);
-}
-
-void glLightModelx(GLenum pname, GLfixed param)
-{
- ogles_context_t* c = ogles_context_t::get();
- lightModelx(pname, param, c);
-}
-
-void glLightModelfv(GLenum pname, const GLfloat *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (pname == GL_LIGHT_MODEL_TWO_SIDE) {
- lightModelx(pname, gglFloatToFixed(params[0]), c);
- return;
- }
-
- if (ggl_unlikely(pname != GL_LIGHT_MODEL_AMBIENT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- c->lighting.lightModel.ambient.r = gglFloatToFixed(params[0]);
- c->lighting.lightModel.ambient.g = gglFloatToFixed(params[1]);
- c->lighting.lightModel.ambient.b = gglFloatToFixed(params[2]);
- c->lighting.lightModel.ambient.a = gglFloatToFixed(params[3]);
- invalidate_lighting(c);
-}
-
-void glLightModelxv(GLenum pname, const GLfixed *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (pname == GL_LIGHT_MODEL_TWO_SIDE) {
- lightModelx(pname, params[0], c);
- return;
- }
-
- if (ggl_unlikely(pname != GL_LIGHT_MODEL_AMBIENT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- c->lighting.lightModel.ambient.r = params[0];
- c->lighting.lightModel.ambient.g = params[1];
- c->lighting.lightModel.ambient.b = params[2];
- c->lighting.lightModel.ambient.a = params[3];
- invalidate_lighting(c);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-void glLightf(GLenum i, GLenum pname, GLfloat param)
-{
- ogles_context_t* c = ogles_context_t::get();
- lightx(i, pname, gglFloatToFixed(param), c);
-}
-
-void glLightx(GLenum i, GLenum pname, GLfixed param)
-{
- ogles_context_t* c = ogles_context_t::get();
- lightx(i, pname, param, c);
-}
-
-void glLightfv(GLenum i, GLenum pname, const GLfloat *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- switch (pname) {
- case GL_SPOT_EXPONENT:
- case GL_SPOT_CUTOFF:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- lightx(i, pname, gglFloatToFixed(params[0]), c);
- return;
- }
-
- GLfixed paramsx[4];
- paramsx[0] = gglFloatToFixed(params[0]);
- paramsx[1] = gglFloatToFixed(params[1]);
- paramsx[2] = gglFloatToFixed(params[2]);
- if (pname != GL_SPOT_DIRECTION)
- paramsx[3] = gglFloatToFixed(params[3]);
-
- lightxv(i, pname, paramsx, c);
-}
-
-void glLightxv(GLenum i, GLenum pname, const GLfixed *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- lightxv(i, pname, params, c);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-void glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- ogles_context_t* c = ogles_context_t::get();
- materialx(face, pname, gglFloatToFixed(param), c);
-}
-
-void glMaterialx(GLenum face, GLenum pname, GLfixed param)
-{
- ogles_context_t* c = ogles_context_t::get();
- materialx(face, pname, param, c);
-}
-
-void glMaterialfv(
- GLenum face, GLenum pname, const GLfloat *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (ggl_unlikely(face != GL_FRONT_AND_BACK)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- GLfixed* what=0;
- GLfixed* other=0;
- switch (pname) {
- case GL_AMBIENT: what = c->lighting.front.ambient.v; break;
- case GL_DIFFUSE: what = c->lighting.front.diffuse.v; break;
- case GL_SPECULAR: what = c->lighting.front.specular.v; break;
- case GL_EMISSION: what = c->lighting.front.emission.v; break;
- case GL_AMBIENT_AND_DIFFUSE:
- what = c->lighting.front.ambient.v;
- other = c->lighting.front.diffuse.v;
- break;
- case GL_SHININESS:
- c->lighting.front.shininess = gglFloatToFixed(params[0]);
- invalidate_lighting(c);
- return;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- what[0] = gglFloatToFixed(params[0]);
- what[1] = gglFloatToFixed(params[1]);
- what[2] = gglFloatToFixed(params[2]);
- what[3] = gglFloatToFixed(params[3]);
- if (other) {
- other[0] = what[0];
- other[1] = what[1];
- other[2] = what[2];
- other[3] = what[3];
- }
- invalidate_lighting(c);
-}
-
-void glMaterialxv(
- GLenum face, GLenum pname, const GLfixed *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (ggl_unlikely(face != GL_FRONT_AND_BACK)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- GLfixed* what=0;
- GLfixed* other=0;
- switch (pname) {
- case GL_AMBIENT: what = c->lighting.front.ambient.v; break;
- case GL_DIFFUSE: what = c->lighting.front.diffuse.v; break;
- case GL_SPECULAR: what = c->lighting.front.specular.v; break;
- case GL_EMISSION: what = c->lighting.front.emission.v; break;
- case GL_AMBIENT_AND_DIFFUSE:
- what = c->lighting.front.ambient.v;
- other = c->lighting.front.diffuse.v;
- break;
- case GL_SHININESS:
- c->lighting.front.shininess = gglFloatToFixed(params[0]);
- invalidate_lighting(c);
- return;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- what[0] = params[0];
- what[1] = params[1];
- what[2] = params[2];
- what[3] = params[3];
- if (other) {
- other[0] = what[0];
- other[1] = what[1];
- other[2] = what[2];
- other[3] = what[3];
- }
- invalidate_lighting(c);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark fog
-#endif
-
-void glFogf(GLenum pname, GLfloat param) {
- ogles_context_t* c = ogles_context_t::get();
- GLfixed paramx = (GLfixed)param;
- if (pname != GL_FOG_MODE)
- paramx = gglFloatToFixed(param);
- fogx(pname, paramx, c);
-}
-
-void glFogx(GLenum pname, GLfixed param) {
- ogles_context_t* c = ogles_context_t::get();
- fogx(pname, param, c);
-}
-
-void glFogfv(GLenum pname, const GLfloat *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (pname != GL_FOG_COLOR) {
- GLfixed paramx = (GLfixed)params[0];
- if (pname != GL_FOG_MODE)
- paramx = gglFloatToFixed(params[0]);
- fogx(pname, paramx, c);
- return;
- }
- GLfixed paramsx[4];
- paramsx[0] = gglFloatToFixed(params[0]);
- paramsx[1] = gglFloatToFixed(params[1]);
- paramsx[2] = gglFloatToFixed(params[2]);
- paramsx[3] = gglFloatToFixed(params[3]);
- c->rasterizer.procs.fogColor3xv(c, paramsx);
-}
-
-void glFogxv(GLenum pname, const GLfixed *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (pname != GL_FOG_COLOR) {
- fogx(pname, params[0], c);
- return;
- }
- c->rasterizer.procs.fogColor3xv(c, params);
-}
diff --git a/opengl/libagl/light.h b/opengl/libagl/light.h
deleted file mode 100644
index 39e3309..0000000
--- a/opengl/libagl/light.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* libs/opengles/light.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_LIGHT_H
-#define ANDROID_OPENGLES_LIGHT_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-
-// Set to 1 for object-space lighting evaluation.
-// There are still some bugs with object-space lighting,
-// especially visible in the San Angeles demo.
-#define OBJECT_SPACE_LIGHTING 0
-
-
-namespace android {
-
-namespace gl {
-struct ogles_context_t;
-};
-
-void ogles_init_light(ogles_context_t* c);
-void ogles_uninit_light(ogles_context_t* c);
-void ogles_invalidate_lighting_mvui(ogles_context_t* c);
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_LIGHT_H
-
diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp
deleted file mode 100644
index cdeccb3..0000000
--- a/opengl/libagl/matrix.cpp
+++ /dev/null
@@ -1,1134 +0,0 @@
-/* libs/opengles/matrix.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "context.h"
-#include "fp.h"
-#include "state.h"
-#include "matrix.h"
-#include "vertex.h"
-#include "light.h"
-
-#if defined(__arm__) && defined(__thumb__)
-#warning "matrix.cpp should not be compiled in thumb on ARM."
-#endif
-
-#define I(_i, _j) ((_j)+ 4*(_i))
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-static const GLfloat gIdentityf[16] = { 1,0,0,0,
- 0,1,0,0,
- 0,0,1,0,
- 0,0,0,1 };
-
-static const matrixx_t gIdentityx = {
- { 0x10000,0,0,0,
- 0,0x10000,0,0,
- 0,0,0x10000,0,
- 0,0,0,0x10000
- }
- };
-
-static void point2__nop(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point3__nop(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point4__nop(transform_t const*, vec4_t* c, vec4_t const* o);
-static void normal__nop(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point2__generic(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point3__generic(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point4__generic(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point3__mvui(transform_t const*, vec4_t* c, vec4_t const* o);
-static void point4__mvui(transform_t const*, vec4_t* c, vec4_t const* o);
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-void ogles_init_matrix(ogles_context_t* c)
-{
- c->transforms.modelview.init(OGLES_MODELVIEW_STACK_DEPTH);
- c->transforms.projection.init(OGLES_PROJECTION_STACK_DEPTH);
- for (int i=0; i<GGL_TEXTURE_UNIT_COUNT ; i++)
- c->transforms.texture[i].init(OGLES_TEXTURE_STACK_DEPTH);
-
- c->transforms.current = &c->transforms.modelview;
- c->transforms.matrixMode = GL_MODELVIEW;
- c->transforms.dirty = transform_state_t::VIEWPORT |
- transform_state_t::MVUI |
- transform_state_t::MVIT |
- transform_state_t::MVP;
- c->transforms.mvp.loadIdentity();
- c->transforms.mvp4.loadIdentity();
- c->transforms.mvit4.loadIdentity();
- c->transforms.mvui.loadIdentity();
- c->transforms.vpt.loadIdentity();
- c->transforms.vpt.zNear = 0.0f;
- c->transforms.vpt.zFar = 1.0f;
-}
-
-void ogles_uninit_matrix(ogles_context_t* c)
-{
- c->transforms.modelview.uninit();
- c->transforms.projection.uninit();
- for (int i=0; i<GGL_TEXTURE_UNIT_COUNT ; i++)
- c->transforms.texture[i].uninit();
-}
-
-static void validate_perspective(ogles_context_t* c, vertex_t* v)
-{
- const uint32_t enables = c->rasterizer.state.enables;
- c->arrays.perspective = (c->clipPlanes.enable) ?
- ogles_vertex_clipAllPerspective3D : ogles_vertex_perspective3D;
- if (enables & (GGL_ENABLE_DEPTH_TEST|GGL_ENABLE_FOG)) {
- c->arrays.perspective = ogles_vertex_perspective3DZ;
- if (c->clipPlanes.enable || (enables&GGL_ENABLE_FOG))
- c->arrays.perspective = ogles_vertex_clipAllPerspective3DZ;
- }
- if ((c->arrays.vertex.size != 4) &&
- (c->transforms.mvp4.flags & transform_t::FLAGS_2D_PROJECTION)) {
- c->arrays.perspective = ogles_vertex_perspective2D;
- }
- c->arrays.perspective(c, v);
-}
-
-void ogles_invalidate_perspective(ogles_context_t* c)
-{
- c->arrays.perspective = validate_perspective;
-}
-
-void ogles_validate_transform_impl(ogles_context_t* c, uint32_t want)
-{
- int dirty = c->transforms.dirty & want;
-
- // Validate the modelview
- if (dirty & transform_state_t::MODELVIEW) {
- c->transforms.modelview.validate();
- }
-
- // Validate the projection stack (in fact, it's never needed)
- if (dirty & transform_state_t::PROJECTION) {
- c->transforms.projection.validate();
- }
-
- // Validate the viewport transformation
- if (dirty & transform_state_t::VIEWPORT) {
- vp_transform_t& vpt = c->transforms.vpt;
- vpt.transform.matrix.load(vpt.matrix);
- vpt.transform.picker();
- }
-
- // We need to update the mvp (used to transform each vertex)
- if (dirty & transform_state_t::MVP) {
- c->transforms.update_mvp();
- // invalidate perspective (divide by W) and view volume clipping
- ogles_invalidate_perspective(c);
- }
-
- // Validate the mvui (for normal transformation)
- if (dirty & transform_state_t::MVUI) {
- c->transforms.update_mvui();
- ogles_invalidate_lighting_mvui(c);
- }
-
- // Validate the texture stack
- if (dirty & transform_state_t::TEXTURE) {
- for (int i=0; i<GGL_TEXTURE_UNIT_COUNT ; i++)
- c->transforms.texture[i].validate();
- }
-
- // Validate the mvit4 (user-clip planes)
- if (dirty & transform_state_t::MVIT) {
- c->transforms.update_mvit();
- }
-
- c->transforms.dirty &= ~want;
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark transform_t
-#endif
-
-void transform_t::loadIdentity() {
- matrix = gIdentityx;
- flags = 0;
- ops = OP_IDENTITY;
- point2 = point2__nop;
- point3 = point3__nop;
- point4 = point4__nop;
-}
-
-
-static inline
-int notZero(GLfixed v) {
- return abs(v) & ~0x3;
-}
-
-static inline
-int notOne(GLfixed v) {
- return notZero(v - 0x10000);
-}
-
-void transform_t::picker()
-{
- const GLfixed* const m = matrix.m;
-
- // XXX: picker needs to be smarter
- flags = 0;
- ops = OP_ALL;
- point2 = point2__generic;
- point3 = point3__generic;
- point4 = point4__generic;
-
- // find out if this is a 2D projection
- if (!(notZero(m[3]) | notZero(m[7]) | notZero(m[11]) | notOne(m[15]))) {
- flags |= FLAGS_2D_PROJECTION;
- }
-}
-
-void mvui_transform_t::picker()
-{
- flags = 0;
- ops = OP_ALL;
- point3 = point3__mvui;
- point4 = point4__mvui;
-}
-
-void transform_t::dump(const char* what)
-{
- GLfixed const * const m = matrix.m;
- ALOGD("%s:", what);
- for (int i=0 ; i<4 ; i++)
- ALOGD("[%08x %08x %08x %08x] [%f %f %f %f]\n",
- m[I(0,i)], m[I(1,i)], m[I(2,i)], m[I(3,i)],
- fixedToFloat(m[I(0,i)]),
- fixedToFloat(m[I(1,i)]),
- fixedToFloat(m[I(2,i)]),
- fixedToFloat(m[I(3,i)]));
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark matrixx_t
-#endif
-
-void matrixx_t::load(const matrixf_t& rhs) {
- GLfixed* xp = m;
- GLfloat const* fp = rhs.elements();
- unsigned int i = 16;
- do {
- const GLfloat f = *fp++;
- *xp++ = isZerof(f) ? 0 : gglFloatToFixed(f);
- } while (--i);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark matrixf_t
-#endif
-
-void matrixf_t::multiply(matrixf_t& r, const matrixf_t& lhs, const matrixf_t& rhs)
-{
- GLfloat const* const m = lhs.m;
- for (int i=0 ; i<4 ; i++) {
- register const float rhs_i0 = rhs.m[ I(i,0) ];
- register float ri0 = m[ I(0,0) ] * rhs_i0;
- register float ri1 = m[ I(0,1) ] * rhs_i0;
- register float ri2 = m[ I(0,2) ] * rhs_i0;
- register float ri3 = m[ I(0,3) ] * rhs_i0;
- for (int j=1 ; j<4 ; j++) {
- register const float rhs_ij = rhs.m[ I(i,j) ];
- ri0 += m[ I(j,0) ] * rhs_ij;
- ri1 += m[ I(j,1) ] * rhs_ij;
- ri2 += m[ I(j,2) ] * rhs_ij;
- ri3 += m[ I(j,3) ] * rhs_ij;
- }
- r.m[ I(i,0) ] = ri0;
- r.m[ I(i,1) ] = ri1;
- r.m[ I(i,2) ] = ri2;
- r.m[ I(i,3) ] = ri3;
- }
-}
-
-void matrixf_t::dump(const char* what) {
- ALOGD("%s", what);
- ALOGD("[ %9f %9f %9f %9f ]", m[I(0,0)], m[I(1,0)], m[I(2,0)], m[I(3,0)]);
- ALOGD("[ %9f %9f %9f %9f ]", m[I(0,1)], m[I(1,1)], m[I(2,1)], m[I(3,1)]);
- ALOGD("[ %9f %9f %9f %9f ]", m[I(0,2)], m[I(1,2)], m[I(2,2)], m[I(3,2)]);
- ALOGD("[ %9f %9f %9f %9f ]", m[I(0,3)], m[I(1,3)], m[I(2,3)], m[I(3,3)]);
-}
-
-void matrixf_t::loadIdentity() {
- memcpy(m, gIdentityf, sizeof(m));
-}
-
-void matrixf_t::set(const GLfixed* rhs) {
- load(rhs);
-}
-
-void matrixf_t::set(const GLfloat* rhs) {
- load(rhs);
-}
-
-void matrixf_t::load(const GLfixed* rhs) {
- GLfloat* fp = m;
- unsigned int i = 16;
- do {
- *fp++ = fixedToFloat(*rhs++);
- } while (--i);
-}
-
-void matrixf_t::load(const GLfloat* rhs) {
- memcpy(m, rhs, sizeof(m));
-}
-
-void matrixf_t::load(const matrixf_t& rhs) {
- operator = (rhs);
-}
-
-void matrixf_t::multiply(const matrixf_t& rhs) {
- matrixf_t r;
- multiply(r, *this, rhs);
- operator = (r);
-}
-
-void matrixf_t::translate(GLfloat x, GLfloat y, GLfloat z) {
- for (int i=0 ; i<4 ; i++) {
- m[12+i] += m[i]*x + m[4+i]*y + m[8+i]*z;
- }
-}
-
-void matrixf_t::scale(GLfloat x, GLfloat y, GLfloat z) {
- for (int i=0 ; i<4 ; i++) {
- m[ i] *= x;
- m[4+i] *= y;
- m[8+i] *= z;
- }
-}
-
-void matrixf_t::rotate(GLfloat a, GLfloat x, GLfloat y, GLfloat z)
-{
- matrixf_t rotation;
- GLfloat* r = rotation.m;
- GLfloat c, s;
- r[3] = 0; r[7] = 0; r[11]= 0;
- r[12]= 0; r[13]= 0; r[14]= 0; r[15]= 1;
- a *= GLfloat(M_PI / 180.0f);
- sincosf(a, &s, &c);
- if (isOnef(x) && isZerof(y) && isZerof(z)) {
- r[5] = c; r[10]= c;
- r[6] = s; r[9] = -s;
- r[1] = 0; r[2] = 0;
- r[4] = 0; r[8] = 0;
- r[0] = 1;
- } else if (isZerof(x) && isOnef(y) && isZerof(z)) {
- r[0] = c; r[10]= c;
- r[8] = s; r[2] = -s;
- r[1] = 0; r[4] = 0;
- r[6] = 0; r[9] = 0;
- r[5] = 1;
- } else if (isZerof(x) && isZerof(y) && isOnef(z)) {
- r[0] = c; r[5] = c;
- r[1] = s; r[4] = -s;
- r[2] = 0; r[6] = 0;
- r[8] = 0; r[9] = 0;
- r[10]= 1;
- } else {
- const GLfloat len = sqrtf(x*x + y*y + z*z);
- if (!isOnef(len)) {
- const GLfloat recipLen = reciprocalf(len);
- x *= recipLen;
- y *= recipLen;
- z *= recipLen;
- }
- const GLfloat nc = 1.0f - c;
- const GLfloat xy = x * y;
- const GLfloat yz = y * z;
- const GLfloat zx = z * x;
- const GLfloat xs = x * s;
- const GLfloat ys = y * s;
- const GLfloat zs = z * s;
- r[ 0] = x*x*nc + c; r[ 4] = xy*nc - zs; r[ 8] = zx*nc + ys;
- r[ 1] = xy*nc + zs; r[ 5] = y*y*nc + c; r[ 9] = yz*nc - xs;
- r[ 2] = zx*nc - ys; r[ 6] = yz*nc + xs; r[10] = z*z*nc + c;
- }
- multiply(rotation);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark matrix_stack_t
-#endif
-
-void matrix_stack_t::init(int depth) {
- stack = new matrixf_t[depth];
- ops = new uint8_t[depth];
- maxDepth = depth;
- depth = 0;
- dirty = 0;
- loadIdentity();
-}
-
-void matrix_stack_t::uninit() {
- delete [] stack;
- delete [] ops;
-}
-
-void matrix_stack_t::loadIdentity() {
- transform.loadIdentity();
- stack[depth].loadIdentity();
- ops[depth] = OP_IDENTITY;
-}
-
-void matrix_stack_t::load(const GLfixed* rhs)
-{
- memcpy(transform.matrix.m, rhs, sizeof(transform.matrix.m));
- stack[depth].load(rhs);
- ops[depth] = OP_ALL; // TODO: we should look at the matrix
-}
-
-void matrix_stack_t::load(const GLfloat* rhs)
-{
- stack[depth].load(rhs);
- ops[depth] = OP_ALL; // TODO: we should look at the matrix
-}
-
-void matrix_stack_t::multiply(const matrixf_t& rhs)
-{
- stack[depth].multiply(rhs);
- ops[depth] = OP_ALL; // TODO: we should look at the matrix
-}
-
-void matrix_stack_t::translate(GLfloat x, GLfloat y, GLfloat z)
-{
- stack[depth].translate(x,y,z);
- ops[depth] |= OP_TRANSLATE;
-}
-
-void matrix_stack_t::scale(GLfloat x, GLfloat y, GLfloat z)
-{
- stack[depth].scale(x,y,z);
- if (x==y && y==z) {
- ops[depth] |= OP_UNIFORM_SCALE;
- } else {
- ops[depth] |= OP_SCALE;
- }
-}
-
-void matrix_stack_t::rotate(GLfloat a, GLfloat x, GLfloat y, GLfloat z)
-{
- stack[depth].rotate(a,x,y,z);
- ops[depth] |= OP_ROTATE;
-}
-
-void matrix_stack_t::validate()
-{
- if (dirty & DO_FLOAT_TO_FIXED) {
- transform.matrix.load(top());
- }
- if (dirty & DO_PICKER) {
- transform.picker();
- }
- dirty = 0;
-}
-
-GLint matrix_stack_t::push()
-{
- if (depth >= (maxDepth-1)) {
- return GL_STACK_OVERFLOW;
- }
- stack[depth+1] = stack[depth];
- ops[depth+1] = ops[depth];
- depth++;
- return 0;
-}
-
-GLint matrix_stack_t::pop()
-{
- if (depth == 0) {
- return GL_STACK_UNDERFLOW;
- }
- depth--;
- return 0;
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark vp_transform_t
-#endif
-
-void vp_transform_t::loadIdentity() {
- transform.loadIdentity();
- matrix.loadIdentity();
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark transform_state_t
-#endif
-
-void transform_state_t::invalidate()
-{
- switch (matrixMode) {
- case GL_MODELVIEW: dirty |= MODELVIEW | MVP | MVUI | MVIT; break;
- case GL_PROJECTION: dirty |= PROJECTION | MVP; break;
- case GL_TEXTURE: dirty |= TEXTURE | MVP; break;
- }
- current->dirty = matrix_stack_t::DO_PICKER |
- matrix_stack_t::DO_FLOAT_TO_FIXED;
-}
-
-void transform_state_t::update_mvp()
-{
- matrixf_t temp_mvp;
- matrixf_t::multiply(temp_mvp, projection.top(), modelview.top());
- mvp4.matrix.load(temp_mvp);
- mvp4.picker();
-
- if (mvp4.flags & transform_t::FLAGS_2D_PROJECTION) {
- // the mvp matrix doesn't transform W, in this case we can
- // premultiply it with the viewport transformation. In addition to
- // being more efficient, this is also much more accurate and in fact
- // is needed for 2D drawing with a resulting 1:1 mapping.
- matrixf_t mvpv;
- matrixf_t::multiply(mvpv, vpt.matrix, temp_mvp);
- mvp.matrix.load(mvpv);
- mvp.picker();
- } else {
- mvp = mvp4;
- }
-}
-
-static inline
-GLfloat det22(GLfloat a, GLfloat b, GLfloat c, GLfloat d) {
- return a*d - b*c;
-}
-
-static inline
-GLfloat ndet22(GLfloat a, GLfloat b, GLfloat c, GLfloat d) {
- return b*c - a*d;
-}
-
-static __attribute__((noinline))
-void invert(GLfloat* inverse, const GLfloat* src)
-{
- double t;
- int i, j, k, swap;
- GLfloat tmp[4][4];
-
- memcpy(inverse, gIdentityf, sizeof(gIdentityf));
- memcpy(tmp, src, sizeof(GLfloat)*16);
-
- for (i = 0; i < 4; i++) {
- // look for largest element in column
- swap = i;
- for (j = i + 1; j < 4; j++) {
- if (fabs(tmp[j][i]) > fabs(tmp[i][i])) {
- swap = j;
- }
- }
-
- if (swap != i) {
- /* swap rows. */
- for (k = 0; k < 4; k++) {
- t = tmp[i][k];
- tmp[i][k] = tmp[swap][k];
- tmp[swap][k] = t;
-
- t = inverse[i*4+k];
- inverse[i*4+k] = inverse[swap*4+k];
- inverse[swap*4+k] = t;
- }
- }
-
- t = 1.0f / tmp[i][i];
- for (k = 0; k < 4; k++) {
- tmp[i][k] *= t;
- inverse[i*4+k] *= t;
- }
- for (j = 0; j < 4; j++) {
- if (j != i) {
- t = tmp[j][i];
- for (k = 0; k < 4; k++) {
- tmp[j][k] -= tmp[i][k]*t;
- inverse[j*4+k] -= inverse[i*4+k]*t;
- }
- }
- }
- }
-}
-
-void transform_state_t::update_mvit()
-{
- GLfloat r[16];
- const GLfloat* const mv = modelview.top().elements();
- invert(r, mv);
- // convert to fixed-point and transpose
- GLfixed* const x = mvit4.matrix.m;
- for (int i=0 ; i<4 ; i++)
- for (int j=0 ; j<4 ; j++)
- x[I(i,j)] = gglFloatToFixed(r[I(j,i)]);
- mvit4.picker();
-}
-
-void transform_state_t::update_mvui()
-{
- GLfloat r[16];
- const GLfloat* const mv = modelview.top().elements();
-
- /*
- When evaluating the lighting equation in eye-space, normals
- are transformed by the upper 3x3 modelview inverse-transpose.
- http://www.opengl.org/documentation/specs/version1.1/glspec1.1/node26.html
-
- (note that inverse-transpose is distributive).
- Also note that:
- l(obj) = inv(modelview).l(eye) for local light
- l(obj) = tr(modelview).l(eye) for infinite light
- */
-
- invert(r, mv);
-
- GLfixed* const x = mvui.matrix.m;
-
-#if OBJECT_SPACE_LIGHTING
- for (int i=0 ; i<4 ; i++)
- for (int j=0 ; j<4 ; j++)
- x[I(i,j)] = gglFloatToFixed(r[I(i,j)]);
-#else
- for (int i=0 ; i<4 ; i++)
- for (int j=0 ; j<4 ; j++)
- x[I(i,j)] = gglFloatToFixed(r[I(j,i)]);
-#endif
-
- mvui.picker();
-}
-
-
-// ----------------------------------------------------------------------------
-// transformation and matrices API
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark transformation and matrices API
-#endif
-
-int ogles_surfaceport(ogles_context_t* c, GLint x, GLint y)
-{
- c->viewport.surfaceport.x = x;
- c->viewport.surfaceport.y = y;
-
- ogles_viewport(c,
- c->viewport.x,
- c->viewport.y,
- c->viewport.w,
- c->viewport.h);
-
- ogles_scissor(c,
- c->viewport.scissor.x,
- c->viewport.scissor.y,
- c->viewport.scissor.w,
- c->viewport.scissor.h);
-
- return 0;
-}
-
-void ogles_scissor(ogles_context_t* c,
- GLint x, GLint y, GLsizei w, GLsizei h)
-{
- if ((w|h) < 0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- c->viewport.scissor.x = x;
- c->viewport.scissor.y = y;
- c->viewport.scissor.w = w;
- c->viewport.scissor.h = h;
-
- x += c->viewport.surfaceport.x;
- y += c->viewport.surfaceport.y;
-
- y = c->rasterizer.state.buffers.color.height - (y + h);
- c->rasterizer.procs.scissor(c, x, y, w, h);
-}
-
-void ogles_viewport(ogles_context_t* c,
- GLint x, GLint y, GLsizei w, GLsizei h)
-{
- if ((w|h)<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- c->viewport.x = x;
- c->viewport.y = y;
- c->viewport.w = w;
- c->viewport.h = h;
-
- x += c->viewport.surfaceport.x;
- y += c->viewport.surfaceport.y;
-
- GLint H = c->rasterizer.state.buffers.color.height;
- GLfloat sx = div2f(w);
- GLfloat ox = sx + x;
- GLfloat sy = div2f(h);
- GLfloat oy = sy - y + (H - h);
-
- GLfloat near = c->transforms.vpt.zNear;
- GLfloat far = c->transforms.vpt.zFar;
- GLfloat A = div2f(far - near);
- GLfloat B = div2f(far + near);
-
- // compute viewport matrix
- GLfloat* const f = c->transforms.vpt.matrix.editElements();
- f[0] = sx; f[4] = 0; f[ 8] = 0; f[12] = ox;
- f[1] = 0; f[5] =-sy; f[ 9] = 0; f[13] = oy;
- f[2] = 0; f[6] = 0; f[10] = A; f[14] = B;
- f[3] = 0; f[7] = 0; f[11] = 0; f[15] = 1;
- c->transforms.dirty |= transform_state_t::VIEWPORT;
- if (c->transforms.mvp4.flags & transform_t::FLAGS_2D_PROJECTION)
- c->transforms.dirty |= transform_state_t::MVP;
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark matrix * vertex
-#endif
-
-void point2__generic(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) {
- const GLfixed* const m = mx->matrix.m;
- const GLfixed rx = rhs->x;
- const GLfixed ry = rhs->y;
- lhs->x = mla2a(rx, m[ 0], ry, m[ 4], m[12]);
- lhs->y = mla2a(rx, m[ 1], ry, m[ 5], m[13]);
- lhs->z = mla2a(rx, m[ 2], ry, m[ 6], m[14]);
- lhs->w = mla2a(rx, m[ 3], ry, m[ 7], m[15]);
-}
-
-void point3__generic(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) {
- const GLfixed* const m = mx->matrix.m;
- const GLfixed rx = rhs->x;
- const GLfixed ry = rhs->y;
- const GLfixed rz = rhs->z;
- lhs->x = mla3a(rx, m[ 0], ry, m[ 4], rz, m[ 8], m[12]);
- lhs->y = mla3a(rx, m[ 1], ry, m[ 5], rz, m[ 9], m[13]);
- lhs->z = mla3a(rx, m[ 2], ry, m[ 6], rz, m[10], m[14]);
- lhs->w = mla3a(rx, m[ 3], ry, m[ 7], rz, m[11], m[15]);
-}
-
-void point4__generic(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) {
- const GLfixed* const m = mx->matrix.m;
- const GLfixed rx = rhs->x;
- const GLfixed ry = rhs->y;
- const GLfixed rz = rhs->z;
- const GLfixed rw = rhs->w;
- lhs->x = mla4(rx, m[ 0], ry, m[ 4], rz, m[ 8], rw, m[12]);
- lhs->y = mla4(rx, m[ 1], ry, m[ 5], rz, m[ 9], rw, m[13]);
- lhs->z = mla4(rx, m[ 2], ry, m[ 6], rz, m[10], rw, m[14]);
- lhs->w = mla4(rx, m[ 3], ry, m[ 7], rz, m[11], rw, m[15]);
-}
-
-void point3__mvui(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) {
- // this is used for transforming light positions back to object space.
- // w is used as a switch for directional lights, so we need
- // to preserve it.
- const GLfixed* const m = mx->matrix.m;
- const GLfixed rx = rhs->x;
- const GLfixed ry = rhs->y;
- const GLfixed rz = rhs->z;
- lhs->x = mla3(rx, m[ 0], ry, m[ 4], rz, m[ 8]);
- lhs->y = mla3(rx, m[ 1], ry, m[ 5], rz, m[ 9]);
- lhs->z = mla3(rx, m[ 2], ry, m[ 6], rz, m[10]);
- lhs->w = 0;
-}
-
-void point4__mvui(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) {
- // this is used for transforming light positions back to object space.
- // w is used as a switch for directional lights, so we need
- // to preserve it.
- const GLfixed* const m = mx->matrix.m;
- const GLfixed rx = rhs->x;
- const GLfixed ry = rhs->y;
- const GLfixed rz = rhs->z;
- const GLfixed rw = rhs->w;
- lhs->x = mla4(rx, m[ 0], ry, m[ 4], rz, m[ 8], rw, m[12]);
- lhs->y = mla4(rx, m[ 1], ry, m[ 5], rz, m[ 9], rw, m[13]);
- lhs->z = mla4(rx, m[ 2], ry, m[ 6], rz, m[10], rw, m[14]);
- lhs->w = rw;
-}
-
-void point2__nop(transform_t const*, vec4_t* lhs, vec4_t const* rhs) {
- lhs->z = 0;
- lhs->w = 0x10000;
- if (lhs != rhs) {
- lhs->x = rhs->x;
- lhs->y = rhs->y;
- }
-}
-
-void point3__nop(transform_t const*, vec4_t* lhs, vec4_t const* rhs) {
- lhs->w = 0x10000;
- if (lhs != rhs) {
- lhs->x = rhs->x;
- lhs->y = rhs->y;
- lhs->z = rhs->z;
- }
-}
-
-void point4__nop(transform_t const*, vec4_t* lhs, vec4_t const* rhs) {
- if (lhs != rhs)
- *lhs = *rhs;
-}
-
-
-static void frustumf(
- GLfloat left, GLfloat right,
- GLfloat bottom, GLfloat top,
- GLfloat zNear, GLfloat zFar,
- ogles_context_t* c)
- {
- if (cmpf(left,right) ||
- cmpf(top, bottom) ||
- cmpf(zNear, zFar) ||
- isZeroOrNegativef(zNear) ||
- isZeroOrNegativef(zFar))
- {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- const GLfloat r_width = reciprocalf(right - left);
- const GLfloat r_height = reciprocalf(top - bottom);
- const GLfloat r_depth = reciprocalf(zNear - zFar);
- const GLfloat x = mul2f(zNear * r_width);
- const GLfloat y = mul2f(zNear * r_height);
- const GLfloat A = mul2f((right + left) * r_width);
- const GLfloat B = (top + bottom) * r_height;
- const GLfloat C = (zFar + zNear) * r_depth;
- const GLfloat D = mul2f(zFar * zNear * r_depth);
- GLfloat f[16];
- f[ 0] = x;
- f[ 5] = y;
- f[ 8] = A;
- f[ 9] = B;
- f[10] = C;
- f[14] = D;
- f[11] = -1.0f;
- f[ 1] = f[ 2] = f[ 3] =
- f[ 4] = f[ 6] = f[ 7] =
- f[12] = f[13] = f[15] = 0.0f;
-
- matrixf_t rhs;
- rhs.set(f);
- c->transforms.current->multiply(rhs);
- c->transforms.invalidate();
-}
-
-static void orthof(
- GLfloat left, GLfloat right,
- GLfloat bottom, GLfloat top,
- GLfloat zNear, GLfloat zFar,
- ogles_context_t* c)
-{
- if (cmpf(left,right) ||
- cmpf(top, bottom) ||
- cmpf(zNear, zFar))
- {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- const GLfloat r_width = reciprocalf(right - left);
- const GLfloat r_height = reciprocalf(top - bottom);
- const GLfloat r_depth = reciprocalf(zFar - zNear);
- const GLfloat x = mul2f(r_width);
- const GLfloat y = mul2f(r_height);
- const GLfloat z = -mul2f(r_depth);
- const GLfloat tx = -(right + left) * r_width;
- const GLfloat ty = -(top + bottom) * r_height;
- const GLfloat tz = -(zFar + zNear) * r_depth;
- GLfloat f[16];
- f[ 0] = x;
- f[ 5] = y;
- f[10] = z;
- f[12] = tx;
- f[13] = ty;
- f[14] = tz;
- f[15] = 1.0f;
- f[ 1] = f[ 2] = f[ 3] =
- f[ 4] = f[ 6] = f[ 7] =
- f[ 8] = f[ 9] = f[11] = 0.0f;
- matrixf_t rhs;
- rhs.set(f);
- c->transforms.current->multiply(rhs);
- c->transforms.invalidate();
-}
-
-static void depthRangef(GLclampf zNear, GLclampf zFar, ogles_context_t* c)
-{
- zNear = clampToZerof(zNear > 1 ? 1 : zNear);
- zFar = clampToZerof(zFar > 1 ? 1 : zFar);
- GLfloat* const f = c->transforms.vpt.matrix.editElements();
- f[10] = div2f(zFar - zNear);
- f[14] = div2f(zFar + zNear);
- c->transforms.dirty |= transform_state_t::VIEWPORT;
- c->transforms.vpt.zNear = zNear;
- c->transforms.vpt.zFar = zFar;
-}
-
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-using namespace android;
-
-void glMatrixMode(GLenum mode)
-{
- ogles_context_t* c = ogles_context_t::get();
- matrix_stack_t* stack = 0;
- switch (mode) {
- case GL_MODELVIEW:
- stack = &c->transforms.modelview;
- break;
- case GL_PROJECTION:
- stack = &c->transforms.projection;
- break;
- case GL_TEXTURE:
- stack = &c->transforms.texture[c->textures.active];
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->transforms.matrixMode = mode;
- c->transforms.current = stack;
-}
-
-void glLoadIdentity()
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->loadIdentity(); // also loads the GLfixed transform
- c->transforms.invalidate();
- c->transforms.current->dirty = 0;
-}
-
-void glLoadMatrixf(const GLfloat* m)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->load(m);
- c->transforms.invalidate();
-}
-
-void glLoadMatrixx(const GLfixed* m)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->load(m); // also loads the GLfixed transform
- c->transforms.invalidate();
- c->transforms.current->dirty &= ~matrix_stack_t::DO_FLOAT_TO_FIXED;
-}
-
-void glMultMatrixf(const GLfloat* m)
-{
- ogles_context_t* c = ogles_context_t::get();
- matrixf_t rhs;
- rhs.set(m);
- c->transforms.current->multiply(rhs);
- c->transforms.invalidate();
-}
-
-void glMultMatrixx(const GLfixed* m)
-{
- ogles_context_t* c = ogles_context_t::get();
- matrixf_t rhs;
- rhs.set(m);
- c->transforms.current->multiply(rhs);
- c->transforms.invalidate();
-}
-
-void glPopMatrix()
-{
- ogles_context_t* c = ogles_context_t::get();
- GLint err = c->transforms.current->pop();
- if (ggl_unlikely(err)) {
- ogles_error(c, err);
- return;
- }
- c->transforms.invalidate();
-}
-
-void glPushMatrix()
-{
- ogles_context_t* c = ogles_context_t::get();
- GLint err = c->transforms.current->push();
- if (ggl_unlikely(err)) {
- ogles_error(c, err);
- return;
- }
- c->transforms.invalidate();
-}
-
-void glFrustumf(
- GLfloat left, GLfloat right,
- GLfloat bottom, GLfloat top,
- GLfloat zNear, GLfloat zFar)
-{
- ogles_context_t* c = ogles_context_t::get();
- frustumf(left, right, bottom, top, zNear, zFar, c);
-}
-
-void glFrustumx(
- GLfixed left, GLfixed right,
- GLfixed bottom, GLfixed top,
- GLfixed zNear, GLfixed zFar)
-{
- ogles_context_t* c = ogles_context_t::get();
- frustumf( fixedToFloat(left), fixedToFloat(right),
- fixedToFloat(bottom), fixedToFloat(top),
- fixedToFloat(zNear), fixedToFloat(zFar),
- c);
-}
-
-void glOrthof(
- GLfloat left, GLfloat right,
- GLfloat bottom, GLfloat top,
- GLfloat zNear, GLfloat zFar)
-{
- ogles_context_t* c = ogles_context_t::get();
- orthof(left, right, bottom, top, zNear, zFar, c);
-}
-
-void glOrthox(
- GLfixed left, GLfixed right,
- GLfixed bottom, GLfixed top,
- GLfixed zNear, GLfixed zFar)
-{
- ogles_context_t* c = ogles_context_t::get();
- orthof( fixedToFloat(left), fixedToFloat(right),
- fixedToFloat(bottom), fixedToFloat(top),
- fixedToFloat(zNear), fixedToFloat(zFar),
- c);
-}
-
-void glRotatef(GLfloat a, GLfloat x, GLfloat y, GLfloat z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->rotate(a, x, y, z);
- c->transforms.invalidate();
-}
-
-void glRotatex(GLfixed a, GLfixed x, GLfixed y, GLfixed z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->rotate(
- fixedToFloat(a), fixedToFloat(x),
- fixedToFloat(y), fixedToFloat(z));
- c->transforms.invalidate();
-}
-
-void glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->scale(x, y, z);
- c->transforms.invalidate();
-}
-
-void glScalex(GLfixed x, GLfixed y, GLfixed z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->scale(
- fixedToFloat(x), fixedToFloat(y), fixedToFloat(z));
- c->transforms.invalidate();
-}
-
-void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->translate(x, y, z);
- c->transforms.invalidate();
-}
-
-void glTranslatex(GLfixed x, GLfixed y, GLfixed z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->transforms.current->translate(
- fixedToFloat(x), fixedToFloat(y), fixedToFloat(z));
- c->transforms.invalidate();
-}
-
-void glScissor(GLint x, GLint y, GLsizei w, GLsizei h)
-{
- ogles_context_t* c = ogles_context_t::get();
- ogles_scissor(c, x, y, w, h);
-}
-
-void glViewport(GLint x, GLint y, GLsizei w, GLsizei h)
-{
- ogles_context_t* c = ogles_context_t::get();
- ogles_viewport(c, x, y, w, h);
-}
-
-void glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- ogles_context_t* c = ogles_context_t::get();
- depthRangef(zNear, zFar, c);
-}
-
-void glDepthRangex(GLclampx zNear, GLclampx zFar)
-{
- ogles_context_t* c = ogles_context_t::get();
- depthRangef(fixedToFloat(zNear), fixedToFloat(zFar), c);
-}
-
-void glPolygonOffsetx(GLfixed factor, GLfixed units)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->polygonOffset.factor = factor;
- c->polygonOffset.units = units;
-}
-
-void glPolygonOffset(GLfloat factor, GLfloat units)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->polygonOffset.factor = gglFloatToFixed(factor);
- c->polygonOffset.units = gglFloatToFixed(units);
-}
-
-GLbitfield glQueryMatrixxOES(GLfixed* m, GLint* e)
-{
- ogles_context_t* c = ogles_context_t::get();
- GLbitfield status = 0;
- GLfloat const* f = c->transforms.current->top().elements();
- for (int i=0 ; i<16 ; i++) {
- if (isnan(f[i]) || isinf(f[i])) {
- status |= 1<<i;
- continue;
- }
- e[i] = exponent(f[i]) - 7;
- m[i] = mantissa(f[i]);
- }
- return status;
-}
diff --git a/opengl/libagl/matrix.h b/opengl/libagl/matrix.h
deleted file mode 100644
index c9a38a9..0000000
--- a/opengl/libagl/matrix.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/* libs/opengles/matrix.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_MATRIX_H
-#define ANDROID_OPENGLES_MATRIX_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-#include <utils/Log.h>
-
-#include <private/pixelflinger/ggl_context.h>
-
-#include <GLES/gl.h>
-
-namespace android {
-
-const int OGLES_MODELVIEW_STACK_DEPTH = 16;
-const int OGLES_PROJECTION_STACK_DEPTH = 2;
-const int OGLES_TEXTURE_STACK_DEPTH = 2;
-
-void ogles_init_matrix(ogles_context_t*);
-void ogles_uninit_matrix(ogles_context_t*);
-void ogles_invalidate_perspective(ogles_context_t* c);
-void ogles_validate_transform_impl(ogles_context_t* c, uint32_t want);
-
-int ogles_surfaceport(ogles_context_t* c, GLint x, GLint y);
-
-void ogles_scissor(ogles_context_t* c,
- GLint x, GLint y, GLsizei w, GLsizei h);
-
-void ogles_viewport(ogles_context_t* c,
- GLint x, GLint y, GLsizei w, GLsizei h);
-
-inline void ogles_validate_transform(
- ogles_context_t* c, uint32_t want)
-{
- if (c->transforms.dirty & want)
- ogles_validate_transform_impl(c, want);
-}
-
-// ----------------------------------------------------------------------------
-
-inline
-GLfixed vsquare3(GLfixed a, GLfixed b, GLfixed c)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- int32_t t;
- asm(
- "smull %0, %1, %2, %2 \n"
- "smlal %0, %1, %3, %3 \n"
- "smlal %0, %1, %4, %4 \n"
- "movs %0, %0, lsr #16 \n"
- "adc %0, %0, %1, lsl #16 \n"
- : "=&r"(r), "=&r"(t)
- : "%r"(a), "r"(b), "r"(c)
- : "cc"
- );
- return r;
-
-#else
-
- return (( int64_t(a)*a +
- int64_t(b)*b +
- int64_t(c)*c + 0x8000)>>16);
-
-#endif
-}
-
-static inline GLfixed mla2a( GLfixed a0, GLfixed b0,
- GLfixed a1, GLfixed b1,
- GLfixed c)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- int32_t t;
- asm(
- "smull %0, %1, %2, %3 \n"
- "smlal %0, %1, %4, %5 \n"
- "add %0, %6, %0, lsr #16 \n"
- "add %0, %0, %1, lsl #16 \n"
- : "=&r"(r), "=&r"(t)
- : "%r"(a0), "r"(b0),
- "%r"(a1), "r"(b1),
- "r"(c)
- :
- );
- return r;
-
-#else
-
- return (( int64_t(a0)*b0 +
- int64_t(a1)*b1)>>16) + c;
-
-#endif
-}
-
-static inline GLfixed mla3a( GLfixed a0, GLfixed b0,
- GLfixed a1, GLfixed b1,
- GLfixed a2, GLfixed b2,
- GLfixed c)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- int32_t t;
- asm(
- "smull %0, %1, %2, %3 \n"
- "smlal %0, %1, %4, %5 \n"
- "smlal %0, %1, %6, %7 \n"
- "add %0, %8, %0, lsr #16 \n"
- "add %0, %0, %1, lsl #16 \n"
- : "=&r"(r), "=&r"(t)
- : "%r"(a0), "r"(b0),
- "%r"(a1), "r"(b1),
- "%r"(a2), "r"(b2),
- "r"(c)
- :
- );
- return r;
-
-#else
-
- return (( int64_t(a0)*b0 +
- int64_t(a1)*b1 +
- int64_t(a2)*b2)>>16) + c;
-
-#endif
-}
-
-// b0, b1, b2 are signed 16-bit quanities
-// that have been shifted right by 'shift' bits relative to normal
-// S16.16 fixed point
-static inline GLfixed mla3a16( GLfixed a0, int32_t b1b0,
- GLfixed a1,
- GLfixed a2, int32_t b2,
- GLint shift,
- GLfixed c)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- asm(
- "smulwb %0, %1, %2 \n"
- "smlawt %0, %3, %2, %0 \n"
- "smlawb %0, %4, %5, %0 \n"
- "add %0, %7, %0, lsl %6 \n"
- : "=&r"(r)
- : "r"(a0), "r"(b1b0),
- "r"(a1),
- "r"(a2), "r"(b2),
- "r"(shift),
- "r"(c)
- :
- );
- return r;
-
-#else
-
- int32_t accum;
- int16_t b0 = b1b0 & 0xffff;
- int16_t b1 = (b1b0 >> 16) & 0xffff;
- accum = int64_t(a0)*int16_t(b0) >> 16;
- accum += int64_t(a1)*int16_t(b1) >> 16;
- accum += int64_t(a2)*int16_t(b2) >> 16;
- accum = (accum << shift) + c;
- return accum;
-
-#endif
-}
-
-
-static inline GLfixed mla3a16_btb( GLfixed a0,
- GLfixed a1,
- GLfixed a2,
- int32_t b1b0, int32_t xxb2,
- GLint shift,
- GLfixed c)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- asm(
- "smulwb %0, %1, %4 \n"
- "smlawt %0, %2, %4, %0 \n"
- "smlawb %0, %3, %5, %0 \n"
- "add %0, %7, %0, lsl %6 \n"
- : "=&r"(r)
- : "r"(a0),
- "r"(a1),
- "r"(a2),
- "r"(b1b0), "r"(xxb2),
- "r"(shift),
- "r"(c)
- :
- );
- return r;
-
-#else
-
- int32_t accum;
- int16_t b0 = b1b0 & 0xffff;
- int16_t b1 = (b1b0 >> 16) & 0xffff;
- int16_t b2 = xxb2 & 0xffff;
- accum = int64_t(a0)*int16_t(b0) >> 16;
- accum += int64_t(a1)*int16_t(b1) >> 16;
- accum += int64_t(a2)*int16_t(b2) >> 16;
- accum = (accum << shift) + c;
- return accum;
-
-#endif
-}
-
-static inline GLfixed mla3a16_btt( GLfixed a0,
- GLfixed a1,
- GLfixed a2,
- int32_t b1b0, int32_t b2xx,
- GLint shift,
- GLfixed c)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- asm(
- "smulwb %0, %1, %4 \n"
- "smlawt %0, %2, %4, %0 \n"
- "smlawt %0, %3, %5, %0 \n"
- "add %0, %7, %0, lsl %6 \n"
- : "=&r"(r)
- : "r"(a0),
- "r"(a1),
- "r"(a2),
- "r"(b1b0), "r"(b2xx),
- "r"(shift),
- "r"(c)
- :
- );
- return r;
-
-#else
-
- int32_t accum;
- int16_t b0 = b1b0 & 0xffff;
- int16_t b1 = (b1b0 >> 16) & 0xffff;
- int16_t b2 = (b2xx >> 16) & 0xffff;
- accum = int64_t(a0)*int16_t(b0) >> 16;
- accum += int64_t(a1)*int16_t(b1) >> 16;
- accum += int64_t(a2)*int16_t(b2) >> 16;
- accum = (accum << shift) + c;
- return accum;
-
-#endif
-}
-
-static inline GLfixed mla3( GLfixed a0, GLfixed b0,
- GLfixed a1, GLfixed b1,
- GLfixed a2, GLfixed b2)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- int32_t t;
- asm(
- "smull %0, %1, %2, %3 \n"
- "smlal %0, %1, %4, %5 \n"
- "smlal %0, %1, %6, %7 \n"
- "movs %0, %0, lsr #16 \n"
- "adc %0, %0, %1, lsl #16 \n"
- : "=&r"(r), "=&r"(t)
- : "%r"(a0), "r"(b0),
- "%r"(a1), "r"(b1),
- "%r"(a2), "r"(b2)
- : "cc"
- );
- return r;
-
-#else
-
- return (( int64_t(a0)*b0 +
- int64_t(a1)*b1 +
- int64_t(a2)*b2 + 0x8000)>>16);
-
-#endif
-}
-
-static inline GLfixed mla4( GLfixed a0, GLfixed b0,
- GLfixed a1, GLfixed b1,
- GLfixed a2, GLfixed b2,
- GLfixed a3, GLfixed b3)
-{
-#if defined(__arm__) && !defined(__thumb__)
-
- GLfixed r;
- int32_t t;
- asm(
- "smull %0, %1, %2, %3 \n"
- "smlal %0, %1, %4, %5 \n"
- "smlal %0, %1, %6, %7 \n"
- "smlal %0, %1, %8, %9 \n"
- "movs %0, %0, lsr #16 \n"
- "adc %0, %0, %1, lsl #16 \n"
- : "=&r"(r), "=&r"(t)
- : "%r"(a0), "r"(b0),
- "%r"(a1), "r"(b1),
- "%r"(a2), "r"(b2),
- "%r"(a3), "r"(b3)
- : "cc"
- );
- return r;
-
-#else
-
- return (( int64_t(a0)*b0 +
- int64_t(a1)*b1 +
- int64_t(a2)*b2 +
- int64_t(a3)*b3 + 0x8000)>>16);
-
-#endif
-}
-
-inline
-GLfixed dot4(const GLfixed* a, const GLfixed* b)
-{
- return mla4(a[0], b[0], a[1], b[1], a[2], b[2], a[3], b[3]);
-}
-
-
-inline
-GLfixed dot3(const GLfixed* a, const GLfixed* b)
-{
- return mla3(a[0], b[0], a[1], b[1], a[2], b[2]);
-}
-
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_MATRIX_H
-
diff --git a/opengl/libagl/mipmap.cpp b/opengl/libagl/mipmap.cpp
deleted file mode 100644
index e142a58..0000000
--- a/opengl/libagl/mipmap.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/* libs/opengles/mipmap.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "context.h"
-#include "state.h"
-#include "texture.h"
-#include "TextureObjectManager.h"
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-status_t buildAPyramid(ogles_context_t* c, EGLTextureObject* tex)
-{
- int level = 0;
- const GGLSurface* base = &tex->surface;
- const GGLFormat& pixelFormat(c->rasterizer.formats[base->format]);
-
- int w = base->width;
- int h = base->height;
- if ((w&h) == 1)
- return NO_ERROR;
-
- w = (w>>1) ? : 1;
- h = (h>>1) ? : 1;
-
- while(true) {
- ++level;
- const int bpr = w * pixelFormat.size;
- if (tex->reallocate(level, w, h, w,
- base->format, base->compressedFormat, bpr) != NO_ERROR) {
- return NO_MEMORY;
- }
-
- int stride = w;
- int bs = base->stride;
- GGLSurface& cur = tex->editMip(level);
-
- if (base->format == GGL_PIXEL_FORMAT_RGB_565)
- {
- uint16_t const * src = (uint16_t const *)base->data;
- uint16_t* dst = (uint16_t*)cur.data;
- const uint32_t mask = 0x07E0F81F;
- for (int y=0 ; y<h ; y++) {
- size_t offset = (y*2) * bs;
- for (int x=0 ; x<w ; x++) {
- uint32_t p00 = src[offset];
- uint32_t p10 = src[offset+1];
- uint32_t p01 = src[offset+bs];
- uint32_t p11 = src[offset+bs+1];
- p00 = (p00 | (p00 << 16)) & mask;
- p01 = (p01 | (p01 << 16)) & mask;
- p10 = (p10 | (p10 << 16)) & mask;
- p11 = (p11 | (p11 << 16)) & mask;
- uint32_t grb = ((p00 + p10 + p01 + p11) >> 2) & mask;
- uint32_t rgb = (grb & 0xFFFF) | (grb >> 16);
- dst[x + y*stride] = rgb;
- offset += 2;
- }
- }
- }
- else if (base->format == GGL_PIXEL_FORMAT_RGBA_5551)
- {
- uint16_t const * src = (uint16_t const *)base->data;
- uint16_t* dst = (uint16_t*)cur.data;
- for (int y=0 ; y<h ; y++) {
- size_t offset = (y*2) * bs;
- for (int x=0 ; x<w ; x++) {
- uint32_t p00 = src[offset];
- uint32_t p10 = src[offset+1];
- uint32_t p01 = src[offset+bs];
- uint32_t p11 = src[offset+bs+1];
- uint32_t r = ((p00>>11)+(p10>>11)+(p01>>11)+(p11>>11)+2)>>2;
- uint32_t g = (((p00>>6)+(p10>>6)+(p01>>6)+(p11>>6)+2)>>2)&0x3F;
- uint32_t b = ((p00&0x3E)+(p10&0x3E)+(p01&0x3E)+(p11&0x3E)+4)>>3;
- uint32_t a = ((p00&1)+(p10&1)+(p01&1)+(p11&1)+2)>>2;
- dst[x + y*stride] = (r<<11)|(g<<6)|(b<<1)|a;
- offset += 2;
- }
- }
- }
- else if (base->format == GGL_PIXEL_FORMAT_RGBA_8888)
- {
- uint32_t const * src = (uint32_t const *)base->data;
- uint32_t* dst = (uint32_t*)cur.data;
- for (int y=0 ; y<h ; y++) {
- size_t offset = (y*2) * bs;
- for (int x=0 ; x<w ; x++) {
- uint32_t p00 = src[offset];
- uint32_t p10 = src[offset+1];
- uint32_t p01 = src[offset+bs];
- uint32_t p11 = src[offset+bs+1];
- uint32_t rb00 = p00 & 0x00FF00FF;
- uint32_t rb01 = p01 & 0x00FF00FF;
- uint32_t rb10 = p10 & 0x00FF00FF;
- uint32_t rb11 = p11 & 0x00FF00FF;
- uint32_t ga00 = (p00 >> 8) & 0x00FF00FF;
- uint32_t ga01 = (p01 >> 8) & 0x00FF00FF;
- uint32_t ga10 = (p10 >> 8) & 0x00FF00FF;
- uint32_t ga11 = (p11 >> 8) & 0x00FF00FF;
- uint32_t rb = (rb00 + rb01 + rb10 + rb11)>>2;
- uint32_t ga = (ga00 + ga01 + ga10 + ga11)>>2;
- uint32_t rgba = (rb & 0x00FF00FF) | ((ga & 0x00FF00FF)<<8);
- dst[x + y*stride] = rgba;
- offset += 2;
- }
- }
- }
- else if ((base->format == GGL_PIXEL_FORMAT_RGB_888) ||
- (base->format == GGL_PIXEL_FORMAT_LA_88) ||
- (base->format == GGL_PIXEL_FORMAT_A_8) ||
- (base->format == GGL_PIXEL_FORMAT_L_8))
- {
- int skip;
- switch (base->format) {
- case GGL_PIXEL_FORMAT_RGB_888: skip = 3; break;
- case GGL_PIXEL_FORMAT_LA_88: skip = 2; break;
- default: skip = 1; break;
- }
- uint8_t const * src = (uint8_t const *)base->data;
- uint8_t* dst = (uint8_t*)cur.data;
- bs *= skip;
- stride *= skip;
- for (int y=0 ; y<h ; y++) {
- size_t offset = (y*2) * bs;
- for (int x=0 ; x<w ; x++) {
- for (int c=0 ; c<skip ; c++) {
- uint32_t p00 = src[c+offset];
- uint32_t p10 = src[c+offset+skip];
- uint32_t p01 = src[c+offset+bs];
- uint32_t p11 = src[c+offset+bs+skip];
- dst[x + y*stride + c] = (p00 + p10 + p01 + p11) >> 2;
- }
- offset += 2*skip;
- }
- }
- }
- else if (base->format == GGL_PIXEL_FORMAT_RGBA_4444)
- {
- uint16_t const * src = (uint16_t const *)base->data;
- uint16_t* dst = (uint16_t*)cur.data;
- for (int y=0 ; y<h ; y++) {
- size_t offset = (y*2) * bs;
- for (int x=0 ; x<w ; x++) {
- uint32_t p00 = src[offset];
- uint32_t p10 = src[offset+1];
- uint32_t p01 = src[offset+bs];
- uint32_t p11 = src[offset+bs+1];
- p00 = ((p00 << 12) & 0x0F0F0000) | (p00 & 0x0F0F);
- p10 = ((p10 << 12) & 0x0F0F0000) | (p10 & 0x0F0F);
- p01 = ((p01 << 12) & 0x0F0F0000) | (p01 & 0x0F0F);
- p11 = ((p11 << 12) & 0x0F0F0000) | (p11 & 0x0F0F);
- uint32_t rbga = (p00 + p10 + p01 + p11) >> 2;
- uint32_t rgba = (rbga & 0x0F0F) | ((rbga>>12) & 0xF0F0);
- dst[x + y*stride] = rgba;
- offset += 2;
- }
- }
- } else {
- ALOGE("Unsupported format (%d)", base->format);
- return BAD_TYPE;
- }
-
- // exit condition: we just processed the 1x1 LODs
- if ((w&h) == 1)
- break;
-
- base = &cur;
- w = (w>>1) ? : 1;
- h = (h>>1) ? : 1;
- }
- return NO_ERROR;
-}
-
-}; // namespace android
diff --git a/opengl/libagl/primitives.cpp b/opengl/libagl/primitives.cpp
deleted file mode 100644
index 769ec40..0000000
--- a/opengl/libagl/primitives.cpp
+++ /dev/null
@@ -1,1111 +0,0 @@
-/* libs/opengles/primitives.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "context.h"
-#include "primitives.h"
-#include "light.h"
-#include "matrix.h"
-#include "vertex.h"
-#include "fp.h"
-#include "TextureObjectManager.h"
-
-extern "C" void iterators0032(const void* that,
- int32_t* it, int32_t c0, int32_t c1, int32_t c2);
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-static void primitive_point(ogles_context_t* c, vertex_t* v);
-static void primitive_line(ogles_context_t* c, vertex_t* v0, vertex_t* v1);
-static void primitive_clip_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static void primitive_nop_point(ogles_context_t* c, vertex_t* v);
-static void primitive_nop_line(ogles_context_t* c, vertex_t* v0, vertex_t* v1);
-static void primitive_nop_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static inline bool cull_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static void lerp_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static void lerp_texcoords(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static void lerp_texcoords_w(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static void triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static void clip_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2);
-
-static unsigned int clip_line(ogles_context_t* c,
- vertex_t* s, vertex_t* p);
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-static void lightTriangleDarkSmooth(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- if (!(v0->flags & vertex_t::LIT)) {
- v0->flags |= vertex_t::LIT;
- const GLvoid* cp = c->arrays.color.element(
- v0->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v0->color.v, cp);
- }
- if (!(v1->flags & vertex_t::LIT)) {
- v1->flags |= vertex_t::LIT;
- const GLvoid* cp = c->arrays.color.element(
- v1->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v1->color.v, cp);
- }
- if(!(v2->flags & vertex_t::LIT)) {
- v2->flags |= vertex_t::LIT;
- const GLvoid* cp = c->arrays.color.element(
- v2->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v2->color.v, cp);
- }
-}
-
-static void lightTriangleDarkFlat(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- if (!(v2->flags & vertex_t::LIT)) {
- v2->flags |= vertex_t::LIT;
- const GLvoid* cp = c->arrays.color.element(
- v2->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v2->color.v, cp);
- }
- // configure the rasterizer here, before we clip
- c->rasterizer.procs.color4xv(c, v2->color.v);
-}
-
-static void lightTriangleSmooth(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- if (!(v0->flags & vertex_t::LIT))
- c->lighting.lightVertex(c, v0);
- if (!(v1->flags & vertex_t::LIT))
- c->lighting.lightVertex(c, v1);
- if(!(v2->flags & vertex_t::LIT))
- c->lighting.lightVertex(c, v2);
-}
-
-static void lightTriangleFlat(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- if (!(v2->flags & vertex_t::LIT))
- c->lighting.lightVertex(c, v2);
- // configure the rasterizer here, before we clip
- c->rasterizer.procs.color4xv(c, v2->color.v);
-}
-
-// The fog versions...
-
-static inline
-void lightVertexDarkSmoothFog(ogles_context_t* c, vertex_t* v)
-{
- if (!(v->flags & vertex_t::LIT)) {
- v->flags |= vertex_t::LIT;
- v->fog = c->fog.fog(c, v->eye.z);
- const GLvoid* cp = c->arrays.color.element(
- v->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v->color.v, cp);
- }
-}
-static inline
-void lightVertexDarkFlatFog(ogles_context_t* c, vertex_t* v)
-{
- if (!(v->flags & vertex_t::LIT)) {
- v->flags |= vertex_t::LIT;
- v->fog = c->fog.fog(c, v->eye.z);
- }
-}
-static inline
-void lightVertexSmoothFog(ogles_context_t* c, vertex_t* v)
-{
- if (!(v->flags & vertex_t::LIT)) {
- v->fog = c->fog.fog(c, v->eye.z);
- c->lighting.lightVertex(c, v);
- }
-}
-
-static void lightTriangleDarkSmoothFog(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- lightVertexDarkSmoothFog(c, v0);
- lightVertexDarkSmoothFog(c, v1);
- lightVertexDarkSmoothFog(c, v2);
-}
-
-static void lightTriangleDarkFlatFog(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- lightVertexDarkFlatFog(c, v0);
- lightVertexDarkFlatFog(c, v1);
- lightVertexDarkSmoothFog(c, v2);
- // configure the rasterizer here, before we clip
- c->rasterizer.procs.color4xv(c, v2->color.v);
-}
-
-static void lightTriangleSmoothFog(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- lightVertexSmoothFog(c, v0);
- lightVertexSmoothFog(c, v1);
- lightVertexSmoothFog(c, v2);
-}
-
-static void lightTriangleFlatFog(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- lightVertexDarkFlatFog(c, v0);
- lightVertexDarkFlatFog(c, v1);
- lightVertexSmoothFog(c, v2);
- // configure the rasterizer here, before we clip
- c->rasterizer.procs.color4xv(c, v2->color.v);
-}
-
-
-
-typedef void (*light_primitive_t)(ogles_context_t*,
- vertex_t*, vertex_t*, vertex_t*);
-
-// fog 0x4, light 0x2, smooth 0x1
-static const light_primitive_t lightPrimitive[8] = {
- lightTriangleDarkFlat, // no fog | dark | flat
- lightTriangleDarkSmooth, // no fog | dark | smooth
- lightTriangleFlat, // no fog | light | flat
- lightTriangleSmooth, // no fog | light | smooth
- lightTriangleDarkFlatFog, // fog | dark | flat
- lightTriangleDarkSmoothFog, // fog | dark | smooth
- lightTriangleFlatFog, // fog | light | flat
- lightTriangleSmoothFog // fog | light | smooth
-};
-
-void ogles_validate_primitives(ogles_context_t* c)
-{
- const uint32_t enables = c->rasterizer.state.enables;
-
- // set up the lighting/shading/smoothing/fogging function
- int index = enables & GGL_ENABLE_SMOOTH ? 0x1 : 0;
- index |= c->lighting.enable ? 0x2 : 0;
- index |= enables & GGL_ENABLE_FOG ? 0x4 : 0;
- c->lighting.lightTriangle = lightPrimitive[index];
-
- // set up the primitive renderers
- if (ggl_likely(c->arrays.vertex.enable)) {
- c->prims.renderPoint = primitive_point;
- c->prims.renderLine = primitive_line;
- c->prims.renderTriangle = primitive_clip_triangle;
- } else {
- c->prims.renderPoint = primitive_nop_point;
- c->prims.renderLine = primitive_nop_line;
- c->prims.renderTriangle = primitive_nop_triangle;
- }
-}
-
-// ----------------------------------------------------------------------------
-
-void compute_iterators_t::initTriangle(
- vertex_t const* v0, vertex_t const* v1, vertex_t const* v2)
-{
- m_dx01 = v1->window.x - v0->window.x;
- m_dy10 = v0->window.y - v1->window.y;
- m_dx20 = v0->window.x - v2->window.x;
- m_dy02 = v2->window.y - v0->window.y;
- m_area = m_dx01*m_dy02 + (-m_dy10)*m_dx20;
-}
-
-void compute_iterators_t::initLine(
- vertex_t const* v0, vertex_t const* v1)
-{
- m_dx01 = m_dy02 = v1->window.x - v0->window.x;
- m_dy10 = m_dx20 = v0->window.y - v1->window.y;
- m_area = m_dx01*m_dy02 + (-m_dy10)*m_dx20;
-}
-
-void compute_iterators_t::initLerp(vertex_t const* v0, uint32_t enables)
-{
- m_x0 = v0->window.x;
- m_y0 = v0->window.y;
- const GGLcoord area = (m_area + TRI_HALF) >> TRI_FRACTION_BITS;
- const GGLcoord minArea = 2; // cannot be inverted
- // triangles with an area smaller than 1.0 are not smooth-shaded
-
- int q=0, s=0, d=0;
- if (abs(area) >= minArea) {
- // Here we do some voodoo magic, to compute a suitable scale
- // factor for deltas/area:
-
- // First compute the 1/area with full 32-bits precision,
- // gglRecipQNormalized returns a number [-0.5, 0.5[ and an exponent.
- d = gglRecipQNormalized(area, &q);
-
- // Then compute the minimum left-shift to not overflow the muls
- // below.
- s = 32 - gglClz(abs(m_dy02)|abs(m_dy10)|abs(m_dx01)|abs(m_dx20));
-
- // We'll keep 16-bits of precision for deltas/area. So we need
- // to shift everything left an extra 15 bits.
- s += 15;
-
- // make sure all final shifts are not > 32, because gglMulx
- // can't handle it.
- if (s < q) s = q;
- if (s > 32) {
- d >>= 32-s;
- s = 32;
- }
- }
-
- m_dx01 = gglMulx(m_dx01, d, s);
- m_dy10 = gglMulx(m_dy10, d, s);
- m_dx20 = gglMulx(m_dx20, d, s);
- m_dy02 = gglMulx(m_dy02, d, s);
- m_area_scale = 32 + q - s;
- m_scale = 0;
-
- if (enables & GGL_ENABLE_TMUS) {
- const int A = gglClz(abs(m_dy02)|abs(m_dy10)|abs(m_dx01)|abs(m_dx20));
- const int B = gglClz(abs(m_x0)|abs(m_y0));
- m_scale = max(0, 32 - (A + 16)) +
- max(0, 32 - (B + TRI_FRACTION_BITS)) + 1;
- }
-}
-
-int compute_iterators_t::iteratorsScale(GGLfixed* it,
- int32_t c0, int32_t c1, int32_t c2) const
-{
- int32_t dc01 = c1 - c0;
- int32_t dc02 = c2 - c0;
- const int A = gglClz(abs(c0));
- const int B = gglClz(abs(dc01)|abs(dc02));
- const int scale = min(A, B - m_scale) - 2;
- if (scale >= 0) {
- c0 <<= scale;
- dc01 <<= scale;
- dc02 <<= scale;
- } else {
- c0 >>= -scale;
- dc01 >>= -scale;
- dc02 >>= -scale;
- }
- const int s = m_area_scale;
- int32_t dcdx = gglMulAddx(dc01, m_dy02, gglMulx(dc02, m_dy10, s), s);
- int32_t dcdy = gglMulAddx(dc02, m_dx01, gglMulx(dc01, m_dx20, s), s);
- int32_t c = c0 - (gglMulAddx(dcdx, m_x0,
- gglMulx(dcdy, m_y0, TRI_FRACTION_BITS), TRI_FRACTION_BITS));
- it[0] = c;
- it[1] = dcdx;
- it[2] = dcdy;
- return scale;
-}
-
-void compute_iterators_t::iterators1616(GGLfixed* it,
- GGLfixed c0, GGLfixed c1, GGLfixed c2) const
-{
- const GGLfixed dc01 = c1 - c0;
- const GGLfixed dc02 = c2 - c0;
- // 16.16 x 16.16 == 32.32 --> 16.16
- const int s = m_area_scale;
- int32_t dcdx = gglMulAddx(dc01, m_dy02, gglMulx(dc02, m_dy10, s), s);
- int32_t dcdy = gglMulAddx(dc02, m_dx01, gglMulx(dc01, m_dx20, s), s);
- int32_t c = c0 - (gglMulAddx(dcdx, m_x0,
- gglMulx(dcdy, m_y0, TRI_FRACTION_BITS), TRI_FRACTION_BITS));
- it[0] = c;
- it[1] = dcdx;
- it[2] = dcdy;
-}
-
-void compute_iterators_t::iterators0032(int64_t* it,
- int32_t c0, int32_t c1, int32_t c2) const
-{
- const int s = m_area_scale - 16;
- int32_t dc01 = (c1 - c0)>>s;
- int32_t dc02 = (c2 - c0)>>s;
- // 16.16 x 16.16 == 32.32
- int64_t dcdx = gglMulii(dc01, m_dy02) + gglMulii(dc02, m_dy10);
- int64_t dcdy = gglMulii(dc02, m_dx01) + gglMulii(dc01, m_dx20);
- it[ 0] = (c0<<16) - ((dcdx*m_x0 + dcdy*m_y0)>>4);
- it[ 1] = dcdx;
- it[ 2] = dcdy;
-}
-
-#if defined(__arm__) && !defined(__thumb__)
-inline void compute_iterators_t::iterators0032(int32_t* it,
- int32_t c0, int32_t c1, int32_t c2) const
-{
- ::iterators0032(this, it, c0, c1, c2);
-}
-#else
-void compute_iterators_t::iterators0032(int32_t* it,
- int32_t c0, int32_t c1, int32_t c2) const
-{
- int64_t it64[3];
- iterators0032(it64, c0, c1, c2);
- it[0] = it64[0];
- it[1] = it64[1];
- it[2] = it64[2];
-}
-#endif
-
-// ----------------------------------------------------------------------------
-
-static inline int32_t clampZ(GLfixed z) CONST;
-int32_t clampZ(GLfixed z) {
- z = (z & ~(z>>31));
- if (z >= 0x10000)
- z = 0xFFFF;
- return z;
-}
-
-static __attribute__((noinline))
-void fetch_texcoord_impl(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- vertex_t* const vtx[3] = { v0, v1, v2 };
- array_t const * const texcoordArray = c->arrays.texture;
-
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (!(c->rasterizer.state.texture[i].enable))
- continue;
-
- for (int j=0 ; j<3 ; j++) {
- vertex_t* const v = vtx[j];
- if (v->flags & vertex_t::TT)
- continue;
-
- // NOTE: here we could compute automatic texgen
- // such as sphere/cube maps, instead of fetching them
- // from the textcoord array.
-
- vec4_t& coords = v->texture[i];
- const GLubyte* tp = texcoordArray[i].element(
- v->index & vertex_cache_t::INDEX_MASK);
- texcoordArray[i].fetch(c, coords.v, tp);
-
- // transform texture coordinates...
- coords.Q = 0x10000;
- const transform_t& tr = c->transforms.texture[i].transform;
- if (ggl_unlikely(tr.ops)) {
- c->arrays.tex_transform[i](&tr, &coords, &coords);
- }
-
- // divide by Q
- const GGLfixed q = coords.Q;
- if (ggl_unlikely(q != 0x10000)) {
- const int32_t qinv = gglRecip28(q);
- coords.S = gglMulx(coords.S, qinv, 28);
- coords.T = gglMulx(coords.T, qinv, 28);
- }
- }
- }
- v0->flags |= vertex_t::TT;
- v1->flags |= vertex_t::TT;
- v2->flags |= vertex_t::TT;
-}
-
-inline void fetch_texcoord(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- const uint32_t enables = c->rasterizer.state.enables;
- if (!(enables & GGL_ENABLE_TMUS))
- return;
-
- // Fetch & transform texture coordinates...
- if (ggl_likely(v0->flags & v1->flags & v2->flags & vertex_t::TT)) {
- // already done for all three vertices, bail...
- return;
- }
- fetch_texcoord_impl(c, v0, v1, v2);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Point
-#endif
-
-void primitive_nop_point(ogles_context_t*, vertex_t*) {
-}
-
-void primitive_point(ogles_context_t* c, vertex_t* v)
-{
- // lighting & clamping...
- const uint32_t enables = c->rasterizer.state.enables;
-
- if (ggl_unlikely(!(v->flags & vertex_t::LIT))) {
- if (c->lighting.enable) {
- c->lighting.lightVertex(c, v);
- } else {
- v->flags |= vertex_t::LIT;
- const GLvoid* cp = c->arrays.color.element(
- v->index & vertex_cache_t::INDEX_MASK);
- c->arrays.color.fetch(c, v->color.v, cp);
- }
- if (enables & GGL_ENABLE_FOG) {
- v->fog = c->fog.fog(c, v->eye.z);
- }
- }
-
- // XXX: we don't need to do that each-time
- // if color array and lighting not enabled
- c->rasterizer.procs.color4xv(c, v->color.v);
-
- // XXX: look into ES point-sprite extension
- if (enables & GGL_ENABLE_TMUS) {
- fetch_texcoord(c, v,v,v);
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (!c->rasterizer.state.texture[i].enable)
- continue;
- int32_t itt[8];
- itt[1] = itt[2] = itt[4] = itt[5] = 0;
- itt[6] = itt[7] = 16; // XXX: check that
- if (c->rasterizer.state.texture[i].s_wrap == GGL_CLAMP) {
- int width = c->textures.tmu[i].texture->surface.width;
- itt[0] = v->texture[i].S * width;
- itt[6] = 0;
- }
- if (c->rasterizer.state.texture[i].t_wrap == GGL_CLAMP) {
- int height = c->textures.tmu[i].texture->surface.height;
- itt[3] = v->texture[i].T * height;
- itt[7] = 0;
- }
- c->rasterizer.procs.texCoordGradScale8xv(c, i, itt);
- }
- }
-
- if (enables & GGL_ENABLE_DEPTH_TEST) {
- int32_t itz[3];
- itz[0] = clampZ(v->window.z) * 0x00010001;
- itz[1] = itz[2] = 0;
- c->rasterizer.procs.zGrad3xv(c, itz);
- }
-
- if (enables & GGL_ENABLE_FOG) {
- GLfixed itf[3];
- itf[0] = v->fog;
- itf[1] = itf[2] = 0;
- c->rasterizer.procs.fogGrad3xv(c, itf);
- }
-
- // Render our point...
- c->rasterizer.procs.pointx(c, v->window.v, c->point.size);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Line
-#endif
-
-void primitive_nop_line(ogles_context_t*, vertex_t*, vertex_t*) {
-}
-
-void primitive_line(ogles_context_t* c, vertex_t* v0, vertex_t* v1)
-{
- // get texture coordinates
- fetch_texcoord(c, v0, v1, v1);
-
- // light/shade the vertices first (they're copied below)
- c->lighting.lightTriangle(c, v0, v1, v1);
-
- // clip the line if needed
- if (ggl_unlikely((v0->flags | v1->flags) & vertex_t::CLIP_ALL)) {
- unsigned int count = clip_line(c, v0, v1);
- if (ggl_unlikely(count == 0))
- return;
- }
-
- // compute iterators...
- const uint32_t enables = c->rasterizer.state.enables;
- const uint32_t mask = GGL_ENABLE_TMUS |
- GGL_ENABLE_SMOOTH |
- GGL_ENABLE_W |
- GGL_ENABLE_FOG |
- GGL_ENABLE_DEPTH_TEST;
-
- if (ggl_unlikely(enables & mask)) {
- c->lerp.initLine(v0, v1);
- lerp_triangle(c, v0, v1, v0);
- }
-
- // render our line
- c->rasterizer.procs.linex(c, v0->window.v, v1->window.v, c->line.width);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Triangle
-#endif
-
-void primitive_nop_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2) {
-}
-
-void primitive_clip_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- uint32_t cc = (v0->flags | v1->flags | v2->flags) & vertex_t::CLIP_ALL;
- if (ggl_likely(!cc)) {
- // code below must be as optimized as possible, this is the
- // common code path.
-
- // This triangle is not clipped, test if it's culled
- // unclipped triangle...
- c->lerp.initTriangle(v0, v1, v2);
- if (cull_triangle(c, v0, v1, v2))
- return; // culled!
-
- // Fetch all texture coordinates if needed
- fetch_texcoord(c, v0, v1, v2);
-
- // light (or shade) our triangle!
- c->lighting.lightTriangle(c, v0, v1, v2);
-
- triangle(c, v0, v1, v2);
- return;
- }
-
- // The assumption here is that we're not going to clip very often,
- // and even more rarely will we clip a triangle that ends up
- // being culled out. So it's okay to light the vertices here, even though
- // in a few cases we won't render the triangle (if culled).
-
- // Fetch texture coordinates...
- fetch_texcoord(c, v0, v1, v2);
-
- // light (or shade) our triangle!
- c->lighting.lightTriangle(c, v0, v1, v2);
-
- clip_triangle(c, v0, v1, v2);
-}
-
-// -----------------------------------------------------------------------
-
-void triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- // compute iterators...
- const uint32_t enables = c->rasterizer.state.enables;
- const uint32_t mask = GGL_ENABLE_TMUS |
- GGL_ENABLE_SMOOTH |
- GGL_ENABLE_W |
- GGL_ENABLE_FOG |
- GGL_ENABLE_DEPTH_TEST;
-
- if (ggl_likely(enables & mask))
- lerp_triangle(c, v0, v1, v2);
-
- c->rasterizer.procs.trianglex(c, v0->window.v, v1->window.v, v2->window.v);
-}
-
-void lerp_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- const uint32_t enables = c->rasterizer.state.enables;
- c->lerp.initLerp(v0, enables);
-
- // set up texture iterators
- if (enables & GGL_ENABLE_TMUS) {
- if (enables & GGL_ENABLE_W) {
- lerp_texcoords_w(c, v0, v1, v2);
- } else {
- lerp_texcoords(c, v0, v1, v2);
- }
- }
-
- // set up the color iterators
- const compute_iterators_t& lerp = c->lerp;
- if (enables & GGL_ENABLE_SMOOTH) {
- GLfixed itc[12];
- for (int i=0 ; i<4 ; i++) {
- const GGLcolor c0 = v0->color.v[i] * 255;
- const GGLcolor c1 = v1->color.v[i] * 255;
- const GGLcolor c2 = v2->color.v[i] * 255;
- lerp.iterators1616(&itc[i*3], c0, c1, c2);
- }
- c->rasterizer.procs.colorGrad12xv(c, itc);
- }
-
- if (enables & GGL_ENABLE_DEPTH_TEST) {
- int32_t itz[3];
- const int32_t v0z = clampZ(v0->window.z);
- const int32_t v1z = clampZ(v1->window.z);
- const int32_t v2z = clampZ(v2->window.z);
- if (ggl_unlikely(c->polygonOffset.enable)) {
- const int32_t units = (c->polygonOffset.units << 16);
- const GLfixed factor = c->polygonOffset.factor;
- if (factor) {
- int64_t itz64[3];
- lerp.iterators0032(itz64, v0z, v1z, v2z);
- int64_t maxDepthSlope = max(itz64[1], itz64[2]);
- itz[0] = uint32_t(itz64[0])
- + uint32_t((maxDepthSlope*factor)>>16) + units;
- itz[1] = uint32_t(itz64[1]);
- itz[2] = uint32_t(itz64[2]);
- } else {
- lerp.iterators0032(itz, v0z, v1z, v2z);
- itz[0] += units;
- }
- } else {
- lerp.iterators0032(itz, v0z, v1z, v2z);
- }
- c->rasterizer.procs.zGrad3xv(c, itz);
- }
-
- if (ggl_unlikely(enables & GGL_ENABLE_FOG)) {
- GLfixed itf[3];
- lerp.iterators1616(itf, v0->fog, v1->fog, v2->fog);
- c->rasterizer.procs.fogGrad3xv(c, itf);
- }
-}
-
-
-static inline
-int compute_lod(ogles_context_t* c, int i,
- int32_t s0, int32_t t0, int32_t s1, int32_t t1, int32_t s2, int32_t t2)
-{
- // Compute mipmap level / primitive
- // rho = sqrt( texelArea / area )
- // lod = log2( rho )
- // lod = log2( texelArea / area ) / 2
- // lod = (log2( texelArea ) - log2( area )) / 2
- const compute_iterators_t& lerp = c->lerp;
- const GGLcoord area = abs(lerp.area());
- const int w = c->textures.tmu[i].texture->surface.width;
- const int h = c->textures.tmu[i].texture->surface.height;
- const int shift = 16 + (16 - TRI_FRACTION_BITS);
- int32_t texelArea = abs( gglMulx(s1-s0, t2-t0, shift) -
- gglMulx(s2-s0, t1-t0, shift) )*w*h;
- int log2TArea = (32-TRI_FRACTION_BITS -1) - gglClz(texelArea);
- int log2Area = (32-TRI_FRACTION_BITS*2-1) - gglClz(area);
- int lod = (log2TArea - log2Area + 1) >> 1;
- return lod;
-}
-
-void lerp_texcoords(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- const compute_iterators_t& lerp = c->lerp;
- int32_t itt[8] __attribute__((aligned(16)));
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- const texture_t& tmu = c->rasterizer.state.texture[i];
- if (!tmu.enable)
- continue;
-
- // compute the jacobians using block floating-point
- int32_t s0 = v0->texture[i].S;
- int32_t t0 = v0->texture[i].T;
- int32_t s1 = v1->texture[i].S;
- int32_t t1 = v1->texture[i].T;
- int32_t s2 = v2->texture[i].S;
- int32_t t2 = v2->texture[i].T;
-
- const GLenum min_filter = c->textures.tmu[i].texture->min_filter;
- if (ggl_unlikely(min_filter >= GL_NEAREST_MIPMAP_NEAREST)) {
- int lod = compute_lod(c, i, s0, t0, s1, t1, s2, t2);
- c->rasterizer.procs.bindTextureLod(c, i,
- &c->textures.tmu[i].texture->mip(lod));
- }
-
- // premultiply (s,t) when clampling
- if (tmu.s_wrap == GGL_CLAMP) {
- const int width = tmu.surface.width;
- s0 *= width;
- s1 *= width;
- s2 *= width;
- }
- if (tmu.t_wrap == GGL_CLAMP) {
- const int height = tmu.surface.height;
- t0 *= height;
- t1 *= height;
- t2 *= height;
- }
- itt[6] = -lerp.iteratorsScale(itt+0, s0, s1, s2);
- itt[7] = -lerp.iteratorsScale(itt+3, t0, t1, t2);
- c->rasterizer.procs.texCoordGradScale8xv(c, i, itt);
- }
-}
-
-void lerp_texcoords_w(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- const compute_iterators_t& lerp = c->lerp;
- int32_t itt[8] __attribute__((aligned(16)));
- int32_t itw[3];
-
- // compute W's scale to 2.30
- int32_t w0 = v0->window.w;
- int32_t w1 = v1->window.w;
- int32_t w2 = v2->window.w;
- int wscale = 32 - gglClz(w0|w1|w2);
-
- // compute the jacobian using block floating-point
- int sc = lerp.iteratorsScale(itw, w0, w1, w2);
- sc += wscale - 16;
- c->rasterizer.procs.wGrad3xv(c, itw);
-
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- const texture_t& tmu = c->rasterizer.state.texture[i];
- if (!tmu.enable)
- continue;
-
- // compute the jacobians using block floating-point
- int32_t s0 = v0->texture[i].S;
- int32_t t0 = v0->texture[i].T;
- int32_t s1 = v1->texture[i].S;
- int32_t t1 = v1->texture[i].T;
- int32_t s2 = v2->texture[i].S;
- int32_t t2 = v2->texture[i].T;
-
- const GLenum min_filter = c->textures.tmu[i].texture->min_filter;
- if (ggl_unlikely(min_filter >= GL_NEAREST_MIPMAP_NEAREST)) {
- int lod = compute_lod(c, i, s0, t0, s1, t1, s2, t2);
- c->rasterizer.procs.bindTextureLod(c, i,
- &c->textures.tmu[i].texture->mip(lod));
- }
-
- // premultiply (s,t) when clampling
- if (tmu.s_wrap == GGL_CLAMP) {
- const int width = tmu.surface.width;
- s0 *= width;
- s1 *= width;
- s2 *= width;
- }
- if (tmu.t_wrap == GGL_CLAMP) {
- const int height = tmu.surface.height;
- t0 *= height;
- t1 *= height;
- t2 *= height;
- }
-
- s0 = gglMulx(s0, w0, wscale);
- t0 = gglMulx(t0, w0, wscale);
- s1 = gglMulx(s1, w1, wscale);
- t1 = gglMulx(t1, w1, wscale);
- s2 = gglMulx(s2, w2, wscale);
- t2 = gglMulx(t2, w2, wscale);
-
- itt[6] = sc - lerp.iteratorsScale(itt+0, s0, s1, s2);
- itt[7] = sc - lerp.iteratorsScale(itt+3, t0, t1, t2);
- c->rasterizer.procs.texCoordGradScale8xv(c, i, itt);
- }
-}
-
-
-static inline
-bool cull_triangle(ogles_context_t* c, vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- if (ggl_likely(c->cull.enable)) {
- const GLenum winding = (c->lerp.area() > 0) ? GL_CW : GL_CCW;
- const GLenum face = (winding == c->cull.frontFace) ? GL_FRONT : GL_BACK;
- if (face == c->cull.cullFace)
- return true; // culled!
- }
- return false;
-}
-
-static inline
-GLfixed frustumPlaneDist(int plane, const vec4_t& s)
-{
- const GLfixed d = s.v[ plane >> 1 ];
- return ((plane & 1) ? (s.w - d) : (s.w + d));
-}
-
-static inline
-int32_t clipDivide(GLfixed a, GLfixed b) {
- // returns a 4.28 fixed-point
- return gglMulDivi(1LU<<28, a, b);
-}
-
-void clip_triangle(ogles_context_t* c,
- vertex_t* v0, vertex_t* v1, vertex_t* v2)
-{
- uint32_t all_cc = (v0->flags | v1->flags | v2->flags) & vertex_t::CLIP_ALL;
-
- vertex_t *p0, *p1, *p2;
- const int MAX_CLIPPING_PLANES = 6 + OGLES_MAX_CLIP_PLANES;
- const int MAX_VERTICES = 3;
-
- // Temporary buffer to hold the new vertices. Each plane can add up to
- // two new vertices (because the polygon is convex).
- // We need one extra element, to handle an overflow case when
- // the polygon degenerates into something non convex.
- vertex_t buffer[MAX_CLIPPING_PLANES * 2 + 1]; // ~3KB
- vertex_t* buf = buffer;
-
- // original list of vertices (polygon to clip, in fact this
- // function works with an arbitrary polygon).
- vertex_t* in[3] = { v0, v1, v2 };
-
- // output lists (we need 2, which we use back and forth)
- // (maximum outpout list's size is MAX_CLIPPING_PLANES + MAX_VERTICES)
- // 2 more elements for overflow when non convex polygons.
- vertex_t* out[2][MAX_CLIPPING_PLANES + MAX_VERTICES + 2];
- unsigned int outi = 0;
-
- // current input list
- vertex_t** ivl = in;
-
- // 3 input vertices, 0 in the output list, first plane
- unsigned int ic = 3;
-
- // User clip-planes first, the clipping is always done in eye-coordinate
- // this is basically the same algorithm than for the view-volume
- // clipping, except for the computation of the distance (vertex, plane)
- // and the fact that we need to compute the eye-coordinates of each
- // new vertex we create.
-
- if (ggl_unlikely(all_cc & vertex_t::USER_CLIP_ALL))
- {
- unsigned int plane = 0;
- uint32_t cc = (all_cc & vertex_t::USER_CLIP_ALL) >> 8;
- do {
- if (cc & 1) {
- // pointers to our output list (head and current)
- vertex_t** const ovl = &out[outi][0];
- vertex_t** output = ovl;
- unsigned int oc = 0;
- unsigned int sentinel = 0;
- // previous vertex, compute distance to the plane
- vertex_t* s = ivl[ic-1];
- const vec4_t& equation = c->clipPlanes.plane[plane].equation;
- GLfixed sd = dot4(equation.v, s->eye.v);
- // clip each vertex against this plane...
- for (unsigned int i=0 ; i<ic ; i++) {
- vertex_t* p = ivl[i];
- const GLfixed pd = dot4(equation.v, p->eye.v);
- if (sd >= 0) {
- if (pd >= 0) {
- // both inside
- *output++ = p;
- oc++;
- } else {
- // s inside, p outside (exiting)
- const GLfixed t = clipDivide(sd, sd-pd);
- c->arrays.clipEye(c, buf, t, p, s);
- *output++ = buf++;
- oc++;
- if (++sentinel >= 3)
- return; // non-convex polygon!
- }
- } else {
- if (pd >= 0) {
- // s outside (entering)
- if (pd) {
- const GLfixed t = clipDivide(pd, pd-sd);
- c->arrays.clipEye(c, buf, t, s, p);
- *output++ = buf++;
- oc++;
- if (++sentinel >= 3)
- return; // non-convex polygon!
- }
- *output++ = p;
- oc++;
- } else {
- // both outside
- }
- }
- s = p;
- sd = pd;
- }
- // output list become the new input list
- if (oc<3)
- return; // less than 3 vertices left? we're done!
- ivl = ovl;
- ic = oc;
- outi = 1-outi;
- }
- cc >>= 1;
- plane++;
- } while (cc);
- }
-
- // frustum clip-planes
- if (all_cc & vertex_t::FRUSTUM_CLIP_ALL)
- {
- unsigned int plane = 0;
- uint32_t cc = all_cc & vertex_t::FRUSTUM_CLIP_ALL;
- do {
- if (cc & 1) {
- // pointers to our output list (head and current)
- vertex_t** const ovl = &out[outi][0];
- vertex_t** output = ovl;
- unsigned int oc = 0;
- unsigned int sentinel = 0;
- // previous vertex, compute distance to the plane
- vertex_t* s = ivl[ic-1];
- GLfixed sd = frustumPlaneDist(plane, s->clip);
- // clip each vertex against this plane...
- for (unsigned int i=0 ; i<ic ; i++) {
- vertex_t* p = ivl[i];
- const GLfixed pd = frustumPlaneDist(plane, p->clip);
- if (sd >= 0) {
- if (pd >= 0) {
- // both inside
- *output++ = p;
- oc++;
- } else {
- // s inside, p outside (exiting)
- const GLfixed t = clipDivide(sd, sd-pd);
- c->arrays.clipVertex(c, buf, t, p, s);
- *output++ = buf++;
- oc++;
- if (++sentinel >= 3)
- return; // non-convex polygon!
- }
- } else {
- if (pd >= 0) {
- // s outside (entering)
- if (pd) {
- const GLfixed t = clipDivide(pd, pd-sd);
- c->arrays.clipVertex(c, buf, t, s, p);
- *output++ = buf++;
- oc++;
- if (++sentinel >= 3)
- return; // non-convex polygon!
- }
- *output++ = p;
- oc++;
- } else {
- // both outside
- }
- }
- s = p;
- sd = pd;
- }
- // output list become the new input list
- if (oc<3)
- return; // less than 3 vertices left? we're done!
- ivl = ovl;
- ic = oc;
- outi = 1-outi;
- }
- cc >>= 1;
- plane++;
- } while (cc);
- }
-
- // finally we can render our triangles...
- p0 = ivl[0];
- p1 = ivl[1];
- for (unsigned int i=2 ; i<ic ; i++) {
- p2 = ivl[i];
- c->lerp.initTriangle(p0, p1, p2);
- if (cull_triangle(c, p0, p1, p2)) {
- p1 = p2;
- continue; // culled!
- }
- triangle(c, p0, p1, p2);
- p1 = p2;
- }
-}
-
-unsigned int clip_line(ogles_context_t* c, vertex_t* s, vertex_t* p)
-{
- const uint32_t all_cc = (s->flags | p->flags) & vertex_t::CLIP_ALL;
-
- if (ggl_unlikely(all_cc & vertex_t::USER_CLIP_ALL))
- {
- unsigned int plane = 0;
- uint32_t cc = (all_cc & vertex_t::USER_CLIP_ALL) >> 8;
- do {
- if (cc & 1) {
- const vec4_t& equation = c->clipPlanes.plane[plane].equation;
- const GLfixed sd = dot4(equation.v, s->eye.v);
- const GLfixed pd = dot4(equation.v, p->eye.v);
- if (sd >= 0) {
- if (pd >= 0) {
- // both inside
- } else {
- // s inside, p outside (exiting)
- const GLfixed t = clipDivide(sd, sd-pd);
- c->arrays.clipEye(c, p, t, p, s);
- }
- } else {
- if (pd >= 0) {
- // s outside (entering)
- if (pd) {
- const GLfixed t = clipDivide(pd, pd-sd);
- c->arrays.clipEye(c, s, t, s, p);
- }
- } else {
- // both outside
- return 0;
- }
- }
- }
- cc >>= 1;
- plane++;
- } while (cc);
- }
-
- // frustum clip-planes
- if (all_cc & vertex_t::FRUSTUM_CLIP_ALL)
- {
- unsigned int plane = 0;
- uint32_t cc = all_cc & vertex_t::FRUSTUM_CLIP_ALL;
- do {
- if (cc & 1) {
- const GLfixed sd = frustumPlaneDist(plane, s->clip);
- const GLfixed pd = frustumPlaneDist(plane, p->clip);
- if (sd >= 0) {
- if (pd >= 0) {
- // both inside
- } else {
- // s inside, p outside (exiting)
- const GLfixed t = clipDivide(sd, sd-pd);
- c->arrays.clipVertex(c, p, t, p, s);
- }
- } else {
- if (pd >= 0) {
- // s outside (entering)
- if (pd) {
- const GLfixed t = clipDivide(pd, pd-sd);
- c->arrays.clipVertex(c, s, t, s, p);
- }
- } else {
- // both outside
- return 0;
- }
- }
- }
- cc >>= 1;
- plane++;
- } while (cc);
- }
-
- return 2;
-}
-
-
-}; // namespace android
diff --git a/opengl/libagl/primitives.h b/opengl/libagl/primitives.h
deleted file mode 100644
index 1bef604..0000000
--- a/opengl/libagl/primitives.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* libs/opengles/primitives.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_PRIMITIVES_H
-#define ANDROID_OPENGLES_PRIMITIVES_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-
-namespace android {
-
-namespace gl {
-struct ogles_context_t;
-};
-
-void ogles_validate_primitives(ogles_context_t* c);
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_PRIMITIVES_H
-
diff --git a/opengl/libagl/state.cpp b/opengl/libagl/state.cpp
deleted file mode 100644
index 90e9612..0000000
--- a/opengl/libagl/state.cpp
+++ /dev/null
@@ -1,597 +0,0 @@
-/* libs/opengles/state.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdlib.h>
-
-#include "context.h"
-#include "fp.h"
-#include "state.h"
-#include "array.h"
-#include "matrix.h"
-#include "vertex.h"
-#include "light.h"
-#include "texture.h"
-#include "BufferObjectManager.h"
-#include "TextureObjectManager.h"
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-static char const * const gVendorString = "Android";
-static char const * const gRendererString = "Android PixelFlinger 1.4";
-static char const * const gVersionString = "OpenGL ES-CM 1.0";
-static char const * const gExtensionsString =
- "GL_OES_byte_coordinates " // OK
- "GL_OES_fixed_point " // OK
- "GL_OES_single_precision " // OK
- "GL_OES_read_format " // OK
- "GL_OES_compressed_paletted_texture " // OK
- "GL_OES_draw_texture " // OK
- "GL_OES_matrix_get " // OK
- "GL_OES_query_matrix " // OK
- // "GL_OES_point_size_array " // TODO
- // "GL_OES_point_sprite " // TODO
- "GL_OES_EGL_image " // OK
-#ifdef GL_OES_compressed_ETC1_RGB8_texture
- "GL_OES_compressed_ETC1_RGB8_texture " // OK
-#endif
- "GL_ARB_texture_compression " // OK
- "GL_ARB_texture_non_power_of_two " // OK
- "GL_ANDROID_user_clip_plane " // OK
- "GL_ANDROID_vertex_buffer_object " // OK
- "GL_ANDROID_generate_mipmap " // OK
- ;
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-ogles_context_t *ogles_init(size_t extra)
-{
- void* const base = malloc(extra + sizeof(ogles_context_t) + 32);
- if (!base) return 0;
-
- ogles_context_t *c =
- (ogles_context_t *)((ptrdiff_t(base) + extra + 31) & ~0x1FL);
- memset(c, 0, sizeof(ogles_context_t));
- ggl_init_context(&(c->rasterizer));
-
- // XXX: this should be passed as an argument
- sp<EGLSurfaceManager> smgr(new EGLSurfaceManager());
- c->surfaceManager = smgr.get();
- c->surfaceManager->incStrong(c);
-
- sp<EGLBufferObjectManager> bomgr(new EGLBufferObjectManager());
- c->bufferObjectManager = bomgr.get();
- c->bufferObjectManager->incStrong(c);
-
- ogles_init_array(c);
- ogles_init_matrix(c);
- ogles_init_vertex(c);
- ogles_init_light(c);
- ogles_init_texture(c);
-
- c->rasterizer.base = base;
- c->point.size = TRI_ONE;
- c->line.width = TRI_ONE;
-
- // in OpenGL, writing to the depth buffer is enabled by default.
- c->rasterizer.procs.depthMask(c, 1);
-
- // OpenGL enables dithering by default
- c->rasterizer.procs.enable(c, GL_DITHER);
-
- return c;
-}
-
-void ogles_uninit(ogles_context_t* c)
-{
- ogles_uninit_array(c);
- ogles_uninit_matrix(c);
- ogles_uninit_vertex(c);
- ogles_uninit_light(c);
- ogles_uninit_texture(c);
- c->surfaceManager->decStrong(c);
- c->bufferObjectManager->decStrong(c);
- ggl_uninit_context(&(c->rasterizer));
- free(c->rasterizer.base);
-}
-
-void _ogles_error(ogles_context_t* c, GLenum error)
-{
- if (c->error == GL_NO_ERROR)
- c->error = error;
-}
-
-static bool stencilop_valid(GLenum op) {
- switch (op) {
- case GL_KEEP:
- case GL_ZERO:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- return true;
- }
- return false;
-}
-
-static void enable_disable(ogles_context_t* c, GLenum cap, int enabled)
-{
- if ((cap >= GL_LIGHT0) && (cap<GL_LIGHT0+OGLES_MAX_LIGHTS)) {
- c->lighting.lights[cap-GL_LIGHT0].enable = enabled;
- c->lighting.enabledLights &= ~(1<<(cap-GL_LIGHT0));
- c->lighting.enabledLights |= (enabled<<(cap-GL_LIGHT0));
- return;
- }
-
- switch (cap) {
- case GL_POINT_SMOOTH:
- c->point.smooth = enabled;
- break;
- case GL_LINE_SMOOTH:
- c->line.smooth = enabled;
- break;
- case GL_POLYGON_OFFSET_FILL:
- c->polygonOffset.enable = enabled;
- break;
- case GL_CULL_FACE:
- c->cull.enable = enabled;
- break;
- case GL_LIGHTING:
- c->lighting.enable = enabled;
- break;
- case GL_COLOR_MATERIAL:
- c->lighting.colorMaterial.enable = enabled;
- break;
- case GL_NORMALIZE:
- case GL_RESCALE_NORMAL:
- c->transforms.rescaleNormals = enabled ? cap : 0;
- // XXX: invalidate mvit
- break;
-
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- c->clipPlanes.enable &= ~(1<<(cap-GL_CLIP_PLANE0));
- c->clipPlanes.enable |= (enabled<<(cap-GL_CLIP_PLANE0));
- ogles_invalidate_perspective(c);
- break;
-
- case GL_FOG:
- case GL_DEPTH_TEST:
- ogles_invalidate_perspective(c);
- // fall-through...
- case GL_BLEND:
- case GL_SCISSOR_TEST:
- case GL_ALPHA_TEST:
- case GL_COLOR_LOGIC_OP:
- case GL_DITHER:
- case GL_STENCIL_TEST:
- case GL_TEXTURE_2D:
- // these need to fall through into the rasterizer
- c->rasterizer.procs.enableDisable(c, cap, enabled);
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- c->rasterizer.procs.enableDisable(c, GL_TEXTURE_2D, enabled);
- break;
-
- case GL_MULTISAMPLE:
- case GL_SAMPLE_ALPHA_TO_COVERAGE:
- case GL_SAMPLE_ALPHA_TO_ONE:
- case GL_SAMPLE_COVERAGE:
- // not supported in this implementation
- break;
-
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-using namespace android;
-
-#if 0
-#pragma mark -
-#endif
-
-// These ones are super-easy, we're not supporting those features!
-void glSampleCoverage(GLclampf value, GLboolean invert) {
-}
-void glSampleCoveragex(GLclampx value, GLboolean invert) {
-}
-void glStencilFunc(GLenum func, GLint ref, GLuint mask) {
- ogles_context_t* c = ogles_context_t::get();
- if (func < GL_NEVER || func > GL_ALWAYS) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- // from OpenGL|ES 1.0 sepcification:
- // If there is no stencil buffer, no stencil modification can occur
- // and it is as if the stencil test always passes.
-}
-
-void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
- ogles_context_t* c = ogles_context_t::get();
- if ((stencilop_valid(fail) &
- stencilop_valid(zfail) &
- stencilop_valid(zpass)) == 0) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-}
-
-// ----------------------------------------------------------------------------
-
-void glAlphaFunc(GLenum func, GLclampf ref)
-{
- glAlphaFuncx(func, gglFloatToFixed(ref));
-}
-
-void glCullFace(GLenum mode)
-{
- ogles_context_t* c = ogles_context_t::get();
- switch (mode) {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- }
- c->cull.cullFace = mode;
-}
-
-void glFrontFace(GLenum mode)
-{
- ogles_context_t* c = ogles_context_t::get();
- switch (mode) {
- case GL_CW:
- case GL_CCW:
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->cull.frontFace = mode;
-}
-
-void glHint(GLenum target, GLenum mode)
-{
- ogles_context_t* c = ogles_context_t::get();
- switch (target) {
- case GL_FOG_HINT:
- case GL_GENERATE_MIPMAP_HINT:
- case GL_LINE_SMOOTH_HINT:
- break;
- case GL_POINT_SMOOTH_HINT:
- c->rasterizer.procs.enableDisable(c,
- GGL_POINT_SMOOTH_NICE, mode==GL_NICEST);
- break;
- case GL_PERSPECTIVE_CORRECTION_HINT:
- c->perspective = (mode == GL_NICEST) ? 1 : 0;
- break;
- default:
- ogles_error(c, GL_INVALID_ENUM);
- }
-}
-
-void glEnable(GLenum cap) {
- ogles_context_t* c = ogles_context_t::get();
- enable_disable(c, cap, 1);
-}
-void glDisable(GLenum cap) {
- ogles_context_t* c = ogles_context_t::get();
- enable_disable(c, cap, 0);
-}
-
-void glFinish()
-{ // nothing to do for our software implementation
-}
-
-void glFlush()
-{ // nothing to do for our software implementation
-}
-
-GLenum glGetError()
-{
- // From OpenGL|ES 1.0 specification:
- // If more than one flag has recorded an error, glGetError returns
- // and clears an arbitrary error flag value. Thus, glGetError should
- // always be called in a loop, until it returns GL_NO_ERROR,
- // if all error flags are to be reset.
-
- ogles_context_t* c = ogles_context_t::get();
- if (c->error) {
- const GLenum ret(c->error);
- c->error = 0;
- return ret;
- }
-
- if (c->rasterizer.error) {
- const GLenum ret(c->rasterizer.error);
- c->rasterizer.error = 0;
- return ret;
- }
-
- return GL_NO_ERROR;
-}
-
-const GLubyte* glGetString(GLenum string)
-{
- switch (string) {
- case GL_VENDOR: return (const GLubyte*)gVendorString;
- case GL_RENDERER: return (const GLubyte*)gRendererString;
- case GL_VERSION: return (const GLubyte*)gVersionString;
- case GL_EXTENSIONS: return (const GLubyte*)gExtensionsString;
- }
- ogles_context_t* c = ogles_context_t::get();
- ogles_error(c, GL_INVALID_ENUM);
- return 0;
-}
-
-void glGetIntegerv(GLenum pname, GLint *params)
-{
- int i;
- ogles_context_t* c = ogles_context_t::get();
- switch (pname) {
- case GL_ALIASED_POINT_SIZE_RANGE:
- params[0] = 0;
- params[1] = GGL_MAX_ALIASED_POINT_SIZE;
- break;
- case GL_ALIASED_LINE_WIDTH_RANGE:
- params[0] = 0;
- params[1] = GGL_MAX_ALIASED_POINT_SIZE;
- break;
- case GL_ALPHA_BITS: {
- int index = c->rasterizer.state.buffers.color.format;
- GGLFormat const * formats = gglGetPixelFormatTable();
- params[0] = formats[index].ah - formats[index].al;
- break;
- }
- case GL_RED_BITS: {
- int index = c->rasterizer.state.buffers.color.format;
- GGLFormat const * formats = gglGetPixelFormatTable();
- params[0] = formats[index].rh - formats[index].rl;
- break;
- }
- case GL_GREEN_BITS: {
- int index = c->rasterizer.state.buffers.color.format;
- GGLFormat const * formats = gglGetPixelFormatTable();
- params[0] = formats[index].gh - formats[index].gl;
- break;
- }
- case GL_BLUE_BITS: {
- int index = c->rasterizer.state.buffers.color.format;
- GGLFormat const * formats = gglGetPixelFormatTable();
- params[0] = formats[index].bh - formats[index].bl;
- break;
- }
- case GL_COMPRESSED_TEXTURE_FORMATS:
- params[ 0] = GL_PALETTE4_RGB8_OES;
- params[ 1] = GL_PALETTE4_RGBA8_OES;
- params[ 2] = GL_PALETTE4_R5_G6_B5_OES;
- params[ 3] = GL_PALETTE4_RGBA4_OES;
- params[ 4] = GL_PALETTE4_RGB5_A1_OES;
- params[ 5] = GL_PALETTE8_RGB8_OES;
- params[ 6] = GL_PALETTE8_RGBA8_OES;
- params[ 7] = GL_PALETTE8_R5_G6_B5_OES;
- params[ 8] = GL_PALETTE8_RGBA4_OES;
- params[ 9] = GL_PALETTE8_RGB5_A1_OES;
- i = 10;
-#ifdef GL_OES_compressed_ETC1_RGB8_texture
- params[i++] = GL_ETC1_RGB8_OES;
-#endif
- break;
- case GL_DEPTH_BITS:
- params[0] = c->rasterizer.state.buffers.depth.format ? 0 : 16;
- break;
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
- params[0] = GL_RGB;
- break;
- case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
- params[0] = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case GL_MAX_LIGHTS:
- params[0] = OGLES_MAX_LIGHTS;
- break;
- case GL_MAX_CLIP_PLANES:
- params[0] = OGLES_MAX_CLIP_PLANES;
- break;
- case GL_MAX_MODELVIEW_STACK_DEPTH:
- params[0] = OGLES_MODELVIEW_STACK_DEPTH;
- break;
- case GL_MAX_PROJECTION_STACK_DEPTH:
- params[0] = OGLES_PROJECTION_STACK_DEPTH;
- break;
- case GL_MAX_TEXTURE_STACK_DEPTH:
- params[0] = OGLES_TEXTURE_STACK_DEPTH;
- break;
- case GL_MAX_TEXTURE_SIZE:
- params[0] = GGL_MAX_TEXTURE_SIZE;
- break;
- case GL_MAX_TEXTURE_UNITS:
- params[0] = GGL_TEXTURE_UNIT_COUNT;
- break;
- case GL_MAX_VIEWPORT_DIMS:
- params[0] = GGL_MAX_VIEWPORT_DIMS;
- params[1] = GGL_MAX_VIEWPORT_DIMS;
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- params[0] = OGLES_NUM_COMPRESSED_TEXTURE_FORMATS;
- break;
- case GL_SMOOTH_LINE_WIDTH_RANGE:
- params[0] = 0;
- params[1] = GGL_MAX_SMOOTH_LINE_WIDTH;
- break;
- case GL_SMOOTH_POINT_SIZE_RANGE:
- params[0] = 0;
- params[1] = GGL_MAX_SMOOTH_POINT_SIZE;
- break;
- case GL_STENCIL_BITS:
- params[0] = 0;
- break;
- case GL_SUBPIXEL_BITS:
- params[0] = GGL_SUBPIXEL_BITS;
- break;
-
- case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
- memcpy( params,
- c->transforms.modelview.top().elements(),
- 16*sizeof(GLint));
- break;
- case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
- memcpy( params,
- c->transforms.projection.top().elements(),
- 16*sizeof(GLint));
- break;
- case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
- memcpy( params,
- c->transforms.texture[c->textures.active].top().elements(),
- 16*sizeof(GLint));
- break;
-
- default:
- ogles_error(c, GL_INVALID_ENUM);
- break;
- }
-}
-
-// ----------------------------------------------------------------------------
-
-void glPointSize(GLfloat size)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (size <= 0) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->point.size = TRI_FROM_FIXED(gglFloatToFixed(size));
-}
-
-void glPointSizex(GLfixed size)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (size <= 0) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->point.size = TRI_FROM_FIXED(size);
-}
-
-// ----------------------------------------------------------------------------
-
-void glLineWidth(GLfloat width)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (width <= 0) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->line.width = TRI_FROM_FIXED(gglFloatToFixed(width));
-}
-
-void glLineWidthx(GLfixed width)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (width <= 0) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->line.width = TRI_FROM_FIXED(width);
-}
-
-// ----------------------------------------------------------------------------
-
-void glColorMask(GLboolean r, GLboolean g, GLboolean b, GLboolean a) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.colorMask(c, r, g, b, a);
-}
-
-void glDepthMask(GLboolean flag) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.depthMask(c, flag);
-}
-
-void glStencilMask(GLuint mask) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.stencilMask(c, mask);
-}
-
-void glDepthFunc(GLenum func) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.depthFunc(c, func);
-}
-
-void glLogicOp(GLenum opcode) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.logicOp(c, opcode);
-}
-
-void glAlphaFuncx(GLenum func, GLclampx ref) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.alphaFuncx(c, func, ref);
-}
-
-void glBlendFunc(GLenum sfactor, GLenum dfactor) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.blendFunc(c, sfactor, dfactor);
-}
-
-void glClear(GLbitfield mask) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.clear(c, mask);
-}
-
-void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.clearColorx(c, red, green, blue, alpha);
-}
-
-void glClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.clearColorx(c,
- gglFloatToFixed(r),
- gglFloatToFixed(g),
- gglFloatToFixed(b),
- gglFloatToFixed(a));
-}
-
-void glClearDepthx(GLclampx depth) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.clearDepthx(c, depth);
-}
-
-void glClearDepthf(GLclampf depth)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.clearDepthx(c, gglFloatToFixed(depth));
-}
-
-void glClearStencil(GLint s) {
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.clearStencil(c, s);
-}
diff --git a/opengl/libagl/state.h b/opengl/libagl/state.h
deleted file mode 100644
index 55a5ccb..0000000
--- a/opengl/libagl/state.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* libs/opengles/state.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_STATE_H
-#define ANDROID_OPENGLES_STATE_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-#include <private/pixelflinger/ggl_context.h>
-
-#include <GLES/gl.h>
-
-#include <stdio.h>
-
-namespace android {
-
-ogles_context_t *ogles_init(size_t extra);
-void ogles_uninit(ogles_context_t* c);
-void _ogles_error(ogles_context_t* c, GLenum error);
-
-#ifndef TRACE_GL_ERRORS
-#define TRACE_GL_ERRORS 0
-#endif
-
-#if TRACE_GL_ERRORS
-#define ogles_error(c, error) \
-do { \
- printf("ogles_error at file %s line %d\n", __FILE__, __LINE__); \
- _ogles_error(c, error); \
-} while (0)
-#else /* !TRACE_GL_ERRORS */
-#define ogles_error(c, error) _ogles_error((c), (error))
-#endif
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_STATE_H
-
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp
deleted file mode 100644
index 08536df..0000000
--- a/opengl/libagl/texture.cpp
+++ /dev/null
@@ -1,1656 +0,0 @@
-/* libs/opengles/texture.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "context.h"
-#include "fp.h"
-#include "state.h"
-#include "texture.h"
-#include "TextureObjectManager.h"
-
-#include <ETC1/etc1.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-static void bindTextureTmu(
- ogles_context_t* c, int tmu, GLuint texture, const sp<EGLTextureObject>& tex);
-
-static __attribute__((noinline))
-void generateMipmap(ogles_context_t* c, GLint level);
-
-// ----------------------------------------------------------------------------
-
-#if 0
-#pragma mark -
-#pragma mark Init
-#endif
-
-void ogles_init_texture(ogles_context_t* c)
-{
- c->textures.packAlignment = 4;
- c->textures.unpackAlignment = 4;
-
- // each context has a default named (0) texture (not shared)
- c->textures.defaultTexture = new EGLTextureObject();
- c->textures.defaultTexture->incStrong(c);
-
- // bind the default texture to each texture unit
- for (int i=0; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- bindTextureTmu(c, i, 0, c->textures.defaultTexture);
- memset(c->current.texture[i].v, 0, sizeof(vec4_t));
- c->current.texture[i].Q = 0x10000;
- }
-}
-
-void ogles_uninit_texture(ogles_context_t* c)
-{
- if (c->textures.ggl)
- gglUninit(c->textures.ggl);
- c->textures.defaultTexture->decStrong(c);
- for (int i=0; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (c->textures.tmu[i].texture)
- c->textures.tmu[i].texture->decStrong(c);
- }
-}
-
-static __attribute__((noinline))
-void validate_tmu(ogles_context_t* c, int i)
-{
- texture_unit_t& u(c->textures.tmu[i]);
- if (u.dirty) {
- u.dirty = 0;
- c->rasterizer.procs.activeTexture(c, i);
- c->rasterizer.procs.bindTexture(c, &(u.texture->surface));
- c->rasterizer.procs.texGeni(c, GGL_S,
- GGL_TEXTURE_GEN_MODE, GGL_AUTOMATIC);
- c->rasterizer.procs.texGeni(c, GGL_T,
- GGL_TEXTURE_GEN_MODE, GGL_AUTOMATIC);
- c->rasterizer.procs.texParameteri(c, GGL_TEXTURE_2D,
- GGL_TEXTURE_WRAP_S, u.texture->wraps);
- c->rasterizer.procs.texParameteri(c, GGL_TEXTURE_2D,
- GGL_TEXTURE_WRAP_T, u.texture->wrapt);
- c->rasterizer.procs.texParameteri(c, GGL_TEXTURE_2D,
- GGL_TEXTURE_MIN_FILTER, u.texture->min_filter);
- c->rasterizer.procs.texParameteri(c, GGL_TEXTURE_2D,
- GGL_TEXTURE_MAG_FILTER, u.texture->mag_filter);
-
- // disable this texture unit if it's not complete
- if (!u.texture->isComplete()) {
- c->rasterizer.procs.disable(c, GGL_TEXTURE_2D);
- }
- }
-}
-
-void ogles_validate_texture(ogles_context_t* c)
-{
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (c->rasterizer.state.texture[i].enable)
- validate_tmu(c, i);
- }
- c->rasterizer.procs.activeTexture(c, c->textures.active);
-}
-
-static
-void invalidate_texture(ogles_context_t* c, int tmu, uint8_t flags = 0xFF) {
- c->textures.tmu[tmu].dirty = flags;
-}
-
-/*
- * If the active textures are EGLImage, they need to be locked before
- * they can be used.
- *
- * FIXME: code below is far from being optimal
- *
- */
-
-void ogles_lock_textures(ogles_context_t* c)
-{
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (c->rasterizer.state.texture[i].enable) {
- texture_unit_t& u(c->textures.tmu[i]);
- ANativeWindowBuffer* native_buffer = u.texture->buffer;
- if (native_buffer) {
- c->rasterizer.procs.activeTexture(c, i);
- hw_module_t const* pModule;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule))
- continue;
-
- gralloc_module_t const* module =
- reinterpret_cast<gralloc_module_t const*>(pModule);
-
- void* vaddr;
- int err = module->lock(module, native_buffer->handle,
- GRALLOC_USAGE_SW_READ_OFTEN,
- 0, 0, native_buffer->width, native_buffer->height,
- &vaddr);
-
- u.texture->setImageBits(vaddr);
- c->rasterizer.procs.bindTexture(c, &(u.texture->surface));
- }
- }
- }
-}
-
-void ogles_unlock_textures(ogles_context_t* c)
-{
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (c->rasterizer.state.texture[i].enable) {
- texture_unit_t& u(c->textures.tmu[i]);
- ANativeWindowBuffer* native_buffer = u.texture->buffer;
- if (native_buffer) {
- c->rasterizer.procs.activeTexture(c, i);
- hw_module_t const* pModule;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule))
- continue;
-
- gralloc_module_t const* module =
- reinterpret_cast<gralloc_module_t const*>(pModule);
-
- module->unlock(module, native_buffer->handle);
- u.texture->setImageBits(NULL);
- c->rasterizer.procs.bindTexture(c, &(u.texture->surface));
- }
- }
- }
- c->rasterizer.procs.activeTexture(c, c->textures.active);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Format conversion
-#endif
-
-static uint32_t gl2format_table[6][4] = {
- // BYTE, 565, 4444, 5551
- { GGL_PIXEL_FORMAT_A_8,
- 0, 0, 0 }, // GL_ALPHA
- { GGL_PIXEL_FORMAT_RGB_888,
- GGL_PIXEL_FORMAT_RGB_565,
- 0, 0 }, // GL_RGB
- { GGL_PIXEL_FORMAT_RGBA_8888,
- 0,
- GGL_PIXEL_FORMAT_RGBA_4444,
- GGL_PIXEL_FORMAT_RGBA_5551 }, // GL_RGBA
- { GGL_PIXEL_FORMAT_L_8,
- 0, 0, 0 }, // GL_LUMINANCE
- { GGL_PIXEL_FORMAT_LA_88,
- 0, 0, 0 }, // GL_LUMINANCE_ALPHA
-};
-
-static int32_t convertGLPixelFormat(GLint format, GLenum type)
-{
- int32_t fi = -1;
- int32_t ti = -1;
- switch (format) {
- case GL_ALPHA: fi = 0; break;
- case GL_RGB: fi = 1; break;
- case GL_RGBA: fi = 2; break;
- case GL_LUMINANCE: fi = 3; break;
- case GL_LUMINANCE_ALPHA: fi = 4; break;
- }
- switch (type) {
- case GL_UNSIGNED_BYTE: ti = 0; break;
- case GL_UNSIGNED_SHORT_5_6_5: ti = 1; break;
- case GL_UNSIGNED_SHORT_4_4_4_4: ti = 2; break;
- case GL_UNSIGNED_SHORT_5_5_5_1: ti = 3; break;
- }
- if (fi==-1 || ti==-1)
- return 0;
- return gl2format_table[fi][ti];
-}
-
-// ----------------------------------------------------------------------------
-
-static GLenum validFormatType(ogles_context_t* c, GLenum format, GLenum type)
-{
- GLenum error = 0;
- if (format<GL_ALPHA || format>GL_LUMINANCE_ALPHA) {
- error = GL_INVALID_ENUM;
- }
- if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT_4_4_4_4 &&
- type != GL_UNSIGNED_SHORT_5_5_5_1 && type != GL_UNSIGNED_SHORT_5_6_5) {
- error = GL_INVALID_ENUM;
- }
- if (type == GL_UNSIGNED_SHORT_5_6_5 && format != GL_RGB) {
- error = GL_INVALID_OPERATION;
- }
- if ((type == GL_UNSIGNED_SHORT_4_4_4_4 ||
- type == GL_UNSIGNED_SHORT_5_5_5_1) && format != GL_RGBA) {
- error = GL_INVALID_OPERATION;
- }
- if (error) {
- ogles_error(c, error);
- }
- return error;
-}
-
-// ----------------------------------------------------------------------------
-
-GGLContext* getRasterizer(ogles_context_t* c)
-{
- GGLContext* ggl = c->textures.ggl;
- if (ggl_unlikely(!ggl)) {
- // this is quite heavy the first time...
- gglInit(&ggl);
- if (!ggl) {
- return 0;
- }
- GGLfixed colors[4] = { 0, 0, 0, 0x10000 };
- c->textures.ggl = ggl;
- ggl->activeTexture(ggl, 0);
- ggl->enable(ggl, GGL_TEXTURE_2D);
- ggl->texEnvi(ggl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
- ggl->disable(ggl, GGL_DITHER);
- ggl->shadeModel(ggl, GGL_FLAT);
- ggl->color4xv(ggl, colors);
- }
- return ggl;
-}
-
-static __attribute__((noinline))
-int copyPixels(
- ogles_context_t* c,
- const GGLSurface& dst,
- GLint xoffset, GLint yoffset,
- const GGLSurface& src,
- GLint x, GLint y, GLsizei w, GLsizei h)
-{
- if ((dst.format == src.format) &&
- (dst.stride == src.stride) &&
- (dst.width == src.width) &&
- (dst.height == src.height) &&
- (dst.stride > 0) &&
- ((x|y) == 0) &&
- ((xoffset|yoffset) == 0))
- {
- // this is a common case...
- const GGLFormat& pixelFormat(c->rasterizer.formats[src.format]);
- const size_t size = src.height * src.stride * pixelFormat.size;
- memcpy(dst.data, src.data, size);
- return 0;
- }
-
- // use pixel-flinger to handle all the conversions
- GGLContext* ggl = getRasterizer(c);
- if (!ggl) {
- // the only reason this would fail is because we ran out of memory
- return GL_OUT_OF_MEMORY;
- }
-
- ggl->colorBuffer(ggl, &dst);
- ggl->bindTexture(ggl, &src);
- ggl->texCoord2i(ggl, x-xoffset, y-yoffset);
- ggl->recti(ggl, xoffset, yoffset, xoffset+w, yoffset+h);
- return 0;
-}
-
-// ----------------------------------------------------------------------------
-
-static __attribute__((noinline))
-sp<EGLTextureObject> getAndBindActiveTextureObject(ogles_context_t* c)
-{
- sp<EGLTextureObject> tex;
- const int active = c->textures.active;
- const GLuint name = c->textures.tmu[active].name;
-
- // free the reference to the previously bound object
- texture_unit_t& u(c->textures.tmu[active]);
- if (u.texture)
- u.texture->decStrong(c);
-
- if (name == 0) {
- // 0 is our local texture object, not shared with anyone.
- // But it affects all bound TMUs immediately.
- // (we need to invalidate all units bound to this texture object)
- tex = c->textures.defaultTexture;
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (c->textures.tmu[i].texture == tex.get())
- invalidate_texture(c, i);
- }
- } else {
- // get a new texture object for that name
- tex = c->surfaceManager->replaceTexture(name);
- }
-
- // bind this texture to the current active texture unit
- // and add a reference to this texture object
- u.texture = tex.get();
- u.texture->incStrong(c);
- u.name = name;
- invalidate_texture(c, active);
- return tex;
-}
-
-void bindTextureTmu(
- ogles_context_t* c, int tmu, GLuint texture, const sp<EGLTextureObject>& tex)
-{
- if (tex.get() == c->textures.tmu[tmu].texture)
- return;
-
- // free the reference to the previously bound object
- texture_unit_t& u(c->textures.tmu[tmu]);
- if (u.texture)
- u.texture->decStrong(c);
-
- // bind this texture to the current active texture unit
- // and add a reference to this texture object
- u.texture = tex.get();
- u.texture->incStrong(c);
- u.name = texture;
- invalidate_texture(c, tmu);
-}
-
-int createTextureSurface(ogles_context_t* c,
- GGLSurface** outSurface, int32_t* outSize, GLint level,
- GLenum format, GLenum type, GLsizei width, GLsizei height,
- GLenum compressedFormat = 0)
-{
- // find out which texture is bound to the current unit
- const int active = c->textures.active;
- const GLuint name = c->textures.tmu[active].name;
-
- // convert the pixelformat to one we can handle
- const int32_t formatIdx = convertGLPixelFormat(format, type);
- if (formatIdx == 0) { // we don't know what to do with this
- return GL_INVALID_OPERATION;
- }
-
- // figure out the size we need as well as the stride
- const GGLFormat& pixelFormat(c->rasterizer.formats[formatIdx]);
- const int32_t align = c->textures.unpackAlignment-1;
- const int32_t bpr = ((width * pixelFormat.size) + align) & ~align;
- const size_t size = bpr * height;
- const int32_t stride = bpr / pixelFormat.size;
-
- if (level > 0) {
- const int active = c->textures.active;
- EGLTextureObject* tex = c->textures.tmu[active].texture;
- status_t err = tex->reallocate(level,
- width, height, stride, formatIdx, compressedFormat, bpr);
- if (err != NO_ERROR)
- return GL_OUT_OF_MEMORY;
- GGLSurface& surface = tex->editMip(level);
- *outSurface = &surface;
- *outSize = size;
- return 0;
- }
-
- sp<EGLTextureObject> tex = getAndBindActiveTextureObject(c);
- status_t err = tex->reallocate(level,
- width, height, stride, formatIdx, compressedFormat, bpr);
- if (err != NO_ERROR)
- return GL_OUT_OF_MEMORY;
-
- tex->internalformat = format;
- *outSurface = &tex->surface;
- *outSize = size;
- return 0;
-}
-
-static size_t dataSizePalette4(int numLevels, int width, int height, int format)
-{
- int indexBits = 8;
- int entrySize = 0;
- switch (format) {
- case GL_PALETTE4_RGB8_OES:
- indexBits = 4;
- /* FALLTHROUGH */
- case GL_PALETTE8_RGB8_OES:
- entrySize = 3;
- break;
-
- case GL_PALETTE4_RGBA8_OES:
- indexBits = 4;
- /* FALLTHROUGH */
- case GL_PALETTE8_RGBA8_OES:
- entrySize = 4;
- break;
-
- case GL_PALETTE4_R5_G6_B5_OES:
- case GL_PALETTE4_RGBA4_OES:
- case GL_PALETTE4_RGB5_A1_OES:
- indexBits = 4;
- /* FALLTHROUGH */
- case GL_PALETTE8_R5_G6_B5_OES:
- case GL_PALETTE8_RGBA4_OES:
- case GL_PALETTE8_RGB5_A1_OES:
- entrySize = 2;
- break;
- }
-
- size_t size = (1 << indexBits) * entrySize; // palette size
-
- for (int i=0 ; i< numLevels ; i++) {
- int w = (width >> i) ? : 1;
- int h = (height >> i) ? : 1;
- int levelSize = h * ((w * indexBits) / 8) ? : 1;
- size += levelSize;
- }
-
- return size;
-}
-
-static void decodePalette4(const GLvoid *data, int level, int width, int height,
- void *surface, int stride, int format)
-
-{
- int indexBits = 8;
- int entrySize = 0;
- switch (format) {
- case GL_PALETTE4_RGB8_OES:
- indexBits = 4;
- /* FALLTHROUGH */
- case GL_PALETTE8_RGB8_OES:
- entrySize = 3;
- break;
-
- case GL_PALETTE4_RGBA8_OES:
- indexBits = 4;
- /* FALLTHROUGH */
- case GL_PALETTE8_RGBA8_OES:
- entrySize = 4;
- break;
-
- case GL_PALETTE4_R5_G6_B5_OES:
- case GL_PALETTE4_RGBA4_OES:
- case GL_PALETTE4_RGB5_A1_OES:
- indexBits = 4;
- /* FALLTHROUGH */
- case GL_PALETTE8_R5_G6_B5_OES:
- case GL_PALETTE8_RGBA4_OES:
- case GL_PALETTE8_RGB5_A1_OES:
- entrySize = 2;
- break;
- }
-
- const int paletteSize = (1 << indexBits) * entrySize;
-
- uint8_t const* pixels = (uint8_t *)data + paletteSize;
- for (int i=0 ; i<level ; i++) {
- int w = (width >> i) ? : 1;
- int h = (height >> i) ? : 1;
- pixels += h * ((w * indexBits) / 8);
- }
- width = (width >> level) ? : 1;
- height = (height >> level) ? : 1;
-
- if (entrySize == 2) {
- uint8_t const* const palette = (uint8_t*)data;
- for (int y=0 ; y<height ; y++) {
- uint8_t* p = (uint8_t*)surface + y*stride*2;
- if (indexBits == 8) {
- for (int x=0 ; x<width ; x++) {
- int index = 2 * (*pixels++);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- }
- } else {
- for (int x=0 ; x<width ; x+=2) {
- int v = *pixels++;
- int index = 2 * (v >> 4);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- if (x+1 < width) {
- index = 2 * (v & 0xF);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- }
- }
- }
- }
- } else if (entrySize == 3) {
- uint8_t const* const palette = (uint8_t*)data;
- for (int y=0 ; y<height ; y++) {
- uint8_t* p = (uint8_t*)surface + y*stride*3;
- if (indexBits == 8) {
- for (int x=0 ; x<width ; x++) {
- int index = 3 * (*pixels++);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- *p++ = palette[index + 2];
- }
- } else {
- for (int x=0 ; x<width ; x+=2) {
- int v = *pixels++;
- int index = 3 * (v >> 4);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- *p++ = palette[index + 2];
- if (x+1 < width) {
- index = 3 * (v & 0xF);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- *p++ = palette[index + 2];
- }
- }
- }
- }
- } else if (entrySize == 4) {
- uint8_t const* const palette = (uint8_t*)data;
- for (int y=0 ; y<height ; y++) {
- uint8_t* p = (uint8_t*)surface + y*stride*4;
- if (indexBits == 8) {
- for (int x=0 ; x<width ; x++) {
- int index = 4 * (*pixels++);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- *p++ = palette[index + 2];
- *p++ = palette[index + 3];
- }
- } else {
- for (int x=0 ; x<width ; x+=2) {
- int v = *pixels++;
- int index = 4 * (v >> 4);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- *p++ = palette[index + 2];
- *p++ = palette[index + 3];
- if (x+1 < width) {
- index = 4 * (v & 0xF);
- *p++ = palette[index + 0];
- *p++ = palette[index + 1];
- *p++ = palette[index + 2];
- *p++ = palette[index + 3];
- }
- }
- }
- }
- }
-}
-
-
-
-static __attribute__((noinline))
-void set_depth_and_fog(ogles_context_t* c, GGLfixed z)
-{
- const uint32_t enables = c->rasterizer.state.enables;
- // we need to compute Zw
- int32_t iterators[3];
- iterators[1] = iterators[2] = 0;
- GGLfixed Zw;
- GGLfixed n = gglFloatToFixed(c->transforms.vpt.zNear);
- GGLfixed f = gglFloatToFixed(c->transforms.vpt.zFar);
- if (z<=0) Zw = n;
- else if (z>=0x10000) Zw = f;
- else Zw = gglMulAddx(z, (f-n), n);
- if (enables & GGL_ENABLE_FOG) {
- // set up fog if needed...
- iterators[0] = c->fog.fog(c, Zw);
- c->rasterizer.procs.fogGrad3xv(c, iterators);
- }
- if (enables & GGL_ENABLE_DEPTH_TEST) {
- // set up z-test if needed...
- int32_t z = (Zw & ~(Zw>>31));
- if (z >= 0x10000)
- z = 0xFFFF;
- iterators[0] = (z << 16) | z;
- c->rasterizer.procs.zGrad3xv(c, iterators);
- }
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark Generate mimaps
-#endif
-
-extern status_t buildAPyramid(ogles_context_t* c, EGLTextureObject* tex);
-
-void generateMipmap(ogles_context_t* c, GLint level)
-{
- if (level == 0) {
- const int active = c->textures.active;
- EGLTextureObject* tex = c->textures.tmu[active].texture;
- if (tex->generate_mipmap) {
- if (buildAPyramid(c, tex) != NO_ERROR) {
- ogles_error(c, GL_OUT_OF_MEMORY);
- return;
- }
- }
- }
-}
-
-
-static void texParameterx(
- GLenum target, GLenum pname, GLfixed param, ogles_context_t* c)
-{
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- EGLTextureObject* textureObject = c->textures.tmu[c->textures.active].texture;
- switch (pname) {
- case GL_TEXTURE_WRAP_S:
- if ((param == GL_REPEAT) ||
- (param == GL_CLAMP_TO_EDGE)) {
- textureObject->wraps = param;
- } else {
- goto invalid_enum;
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if ((param == GL_REPEAT) ||
- (param == GL_CLAMP_TO_EDGE)) {
- textureObject->wrapt = param;
- } else {
- goto invalid_enum;
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if ((param == GL_NEAREST) ||
- (param == GL_LINEAR) ||
- (param == GL_NEAREST_MIPMAP_NEAREST) ||
- (param == GL_LINEAR_MIPMAP_NEAREST) ||
- (param == GL_NEAREST_MIPMAP_LINEAR) ||
- (param == GL_LINEAR_MIPMAP_LINEAR)) {
- textureObject->min_filter = param;
- } else {
- goto invalid_enum;
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if ((param == GL_NEAREST) ||
- (param == GL_LINEAR)) {
- textureObject->mag_filter = param;
- } else {
- goto invalid_enum;
- }
- break;
- case GL_GENERATE_MIPMAP:
- textureObject->generate_mipmap = param;
- break;
- default:
-invalid_enum:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- invalidate_texture(c, c->textures.active);
-}
-
-
-
-static void drawTexxOESImp(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h,
- ogles_context_t* c)
-{
- ogles_lock_textures(c);
-
- const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s;
- y = gglIntToFixed(cbSurface.height) - (y + h);
- w >>= FIXED_BITS;
- h >>= FIXED_BITS;
-
- // set up all texture units
- for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
- if (!c->rasterizer.state.texture[i].enable)
- continue;
-
- int32_t texcoords[8];
- texture_unit_t& u(c->textures.tmu[i]);
-
- // validate this tmu (bind, wrap, filter)
- validate_tmu(c, i);
- // we CLAMP here, which works with premultiplied (s,t)
- c->rasterizer.procs.texParameteri(c,
- GGL_TEXTURE_2D, GGL_TEXTURE_WRAP_S, GGL_CLAMP);
- c->rasterizer.procs.texParameteri(c,
- GGL_TEXTURE_2D, GGL_TEXTURE_WRAP_T, GGL_CLAMP);
- u.dirty = 0xFF; // XXX: should be more subtle
-
- EGLTextureObject* textureObject = u.texture;
- const GLint Ucr = textureObject->crop_rect[0] << 16;
- const GLint Vcr = textureObject->crop_rect[1] << 16;
- const GLint Wcr = textureObject->crop_rect[2] << 16;
- const GLint Hcr = textureObject->crop_rect[3] << 16;
-
- // computes texture coordinates (pre-multiplied)
- int32_t dsdx = Wcr / w; // dsdx = ((Wcr/w)/Wt)*Wt
- int32_t dtdy =-Hcr / h; // dtdy = -((Hcr/h)/Ht)*Ht
- int32_t s0 = Ucr - gglMulx(dsdx, x); // s0 = Ucr - x * dsdx
- int32_t t0 = (Vcr+Hcr) - gglMulx(dtdy, y); // t0 = (Vcr+Hcr) - y*dtdy
- texcoords[0] = s0;
- texcoords[1] = dsdx;
- texcoords[2] = 0;
- texcoords[3] = t0;
- texcoords[4] = 0;
- texcoords[5] = dtdy;
- texcoords[6] = 0;
- texcoords[7] = 0;
- c->rasterizer.procs.texCoordGradScale8xv(c, i, texcoords);
- }
-
- const uint32_t enables = c->rasterizer.state.enables;
- if (ggl_unlikely(enables & (GGL_ENABLE_DEPTH_TEST|GGL_ENABLE_FOG)))
- set_depth_and_fog(c, z);
-
- c->rasterizer.procs.activeTexture(c, c->textures.active);
- c->rasterizer.procs.color4xv(c, c->currentColorClamped.v);
- c->rasterizer.procs.disable(c, GGL_W_LERP);
- c->rasterizer.procs.disable(c, GGL_AA);
- c->rasterizer.procs.shadeModel(c, GL_FLAT);
- c->rasterizer.procs.recti(c,
- gglFixedToIntRound(x),
- gglFixedToIntRound(y),
- gglFixedToIntRound(x)+w,
- gglFixedToIntRound(y)+h);
-
- ogles_unlock_textures(c);
-}
-
-static void drawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h,
- ogles_context_t* c)
-{
- // quickly reject empty rects
- if ((w|h) <= 0)
- return;
-
- drawTexxOESImp(x, y, z, w, h, c);
-}
-
-static void drawTexiOES(GLint x, GLint y, GLint z, GLint w, GLint h, ogles_context_t* c)
-{
- // All coordinates are integer, so if we have only one
- // texture unit active and no scaling is required
- // THEN, we can use our special 1:1 mapping
- // which is a lot faster.
-
- if (ggl_likely(c->rasterizer.state.enabled_tmu == 1)) {
- const int tmu = 0;
- texture_unit_t& u(c->textures.tmu[tmu]);
- EGLTextureObject* textureObject = u.texture;
- const GLint Wcr = textureObject->crop_rect[2];
- const GLint Hcr = textureObject->crop_rect[3];
-
- if ((w == Wcr) && (h == -Hcr)) {
- if ((w|h) <= 0) return; // quickly reject empty rects
-
- if (u.dirty) {
- c->rasterizer.procs.activeTexture(c, tmu);
- c->rasterizer.procs.bindTexture(c, &(u.texture->surface));
- c->rasterizer.procs.texParameteri(c, GGL_TEXTURE_2D,
- GGL_TEXTURE_MIN_FILTER, u.texture->min_filter);
- c->rasterizer.procs.texParameteri(c, GGL_TEXTURE_2D,
- GGL_TEXTURE_MAG_FILTER, u.texture->mag_filter);
- }
- c->rasterizer.procs.texGeni(c, GGL_S,
- GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
- c->rasterizer.procs.texGeni(c, GGL_T,
- GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
- u.dirty = 0xFF; // XXX: should be more subtle
- c->rasterizer.procs.activeTexture(c, c->textures.active);
-
- const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s;
- y = cbSurface.height - (y + h);
- const GLint Ucr = textureObject->crop_rect[0];
- const GLint Vcr = textureObject->crop_rect[1];
- const GLint s0 = Ucr - x;
- const GLint t0 = (Vcr + Hcr) - y;
-
- const GLuint tw = textureObject->surface.width;
- const GLuint th = textureObject->surface.height;
- if ((uint32_t(s0+x+w) > tw) || (uint32_t(t0+y+h) > th)) {
- // The GL spec is unclear about what should happen
- // in this case, so we just use the slow case, which
- // at least won't crash
- goto slow_case;
- }
-
- ogles_lock_textures(c);
-
- c->rasterizer.procs.texCoord2i(c, s0, t0);
- const uint32_t enables = c->rasterizer.state.enables;
- if (ggl_unlikely(enables & (GGL_ENABLE_DEPTH_TEST|GGL_ENABLE_FOG)))
- set_depth_and_fog(c, gglIntToFixed(z));
-
- c->rasterizer.procs.color4xv(c, c->currentColorClamped.v);
- c->rasterizer.procs.disable(c, GGL_W_LERP);
- c->rasterizer.procs.disable(c, GGL_AA);
- c->rasterizer.procs.shadeModel(c, GL_FLAT);
- c->rasterizer.procs.recti(c, x, y, x+w, y+h);
-
- ogles_unlock_textures(c);
-
- return;
- }
- }
-
-slow_case:
- drawTexxOESImp(
- gglIntToFixed(x), gglIntToFixed(y), gglIntToFixed(z),
- gglIntToFixed(w), gglIntToFixed(h),
- c);
-}
-
-
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-
-#if 0
-#pragma mark -
-#pragma mark Texture API
-#endif
-
-void glActiveTexture(GLenum texture)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (uint32_t(texture-GL_TEXTURE0) > uint32_t(GGL_TEXTURE_UNIT_COUNT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- c->textures.active = texture - GL_TEXTURE0;
- c->rasterizer.procs.activeTexture(c, c->textures.active);
-}
-
-void glBindTexture(GLenum target, GLuint texture)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- // Bind or create a texture
- sp<EGLTextureObject> tex;
- if (texture == 0) {
- // 0 is our local texture object
- tex = c->textures.defaultTexture;
- } else {
- tex = c->surfaceManager->texture(texture);
- if (ggl_unlikely(tex == 0)) {
- tex = c->surfaceManager->createTexture(texture);
- if (tex == 0) {
- ogles_error(c, GL_OUT_OF_MEMORY);
- return;
- }
- }
- }
- bindTextureTmu(c, c->textures.active, texture, tex);
-}
-
-void glGenTextures(GLsizei n, GLuint *textures)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (n<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- // generate unique (shared) texture names
- c->surfaceManager->getToken(n, textures);
-}
-
-void glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (n<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- // If deleting a bound texture, bind this unit to 0
- for (int t=0 ; t<GGL_TEXTURE_UNIT_COUNT ; t++) {
- if (c->textures.tmu[t].name == 0)
- continue;
- for (int i=0 ; i<n ; i++) {
- if (textures[i] && (textures[i] == c->textures.tmu[t].name)) {
- // bind this tmu to texture 0
- sp<EGLTextureObject> tex(c->textures.defaultTexture);
- bindTextureTmu(c, t, 0, tex);
- }
- }
- }
- c->surfaceManager->deleteTextures(n, textures);
- c->surfaceManager->recycleTokens(n, textures);
-}
-
-void glMultiTexCoord4f(
- GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (uint32_t(target-GL_TEXTURE0) > uint32_t(GGL_TEXTURE_UNIT_COUNT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- const int tmu = target-GL_TEXTURE0;
- c->current.texture[tmu].S = gglFloatToFixed(s);
- c->current.texture[tmu].T = gglFloatToFixed(t);
- c->current.texture[tmu].R = gglFloatToFixed(r);
- c->current.texture[tmu].Q = gglFloatToFixed(q);
-}
-
-void glMultiTexCoord4x(
- GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (uint32_t(target-GL_TEXTURE0) > uint32_t(GGL_TEXTURE_UNIT_COUNT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- const int tmu = target-GL_TEXTURE0;
- c->current.texture[tmu].S = s;
- c->current.texture[tmu].T = t;
- c->current.texture[tmu].R = r;
- c->current.texture[tmu].Q = q;
-}
-
-void glPixelStorei(GLenum pname, GLint param)
-{
- ogles_context_t* c = ogles_context_t::get();
- if ((pname != GL_PACK_ALIGNMENT) && (pname != GL_UNPACK_ALIGNMENT)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if ((param<=0 || param>8) || (param & (param-1))) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (pname == GL_PACK_ALIGNMENT)
- c->textures.packAlignment = param;
- if (pname == GL_UNPACK_ALIGNMENT)
- c->textures.unpackAlignment = param;
-}
-
-void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.texEnvi(c, target, pname, GLint(param));
-}
-
-void glTexEnvfv(
- GLenum target, GLenum pname, const GLfloat *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (pname == GL_TEXTURE_ENV_MODE) {
- c->rasterizer.procs.texEnvi(c, target, pname, GLint(*params));
- return;
- }
- if (pname == GL_TEXTURE_ENV_COLOR) {
- GGLfixed fixed[4];
- for (int i=0 ; i<4 ; i++)
- fixed[i] = gglFloatToFixed(params[i]);
- c->rasterizer.procs.texEnvxv(c, target, pname, fixed);
- return;
- }
- ogles_error(c, GL_INVALID_ENUM);
-}
-
-void glTexEnvx(GLenum target, GLenum pname, GLfixed param)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.texEnvi(c, target, pname, param);
-}
-
-void glTexEnvxv(
- GLenum target, GLenum pname, const GLfixed *params)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->rasterizer.procs.texEnvxv(c, target, pname, params);
-}
-
-void glTexParameteriv(
- GLenum target, GLenum pname, const GLint* params)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- EGLTextureObject* textureObject = c->textures.tmu[c->textures.active].texture;
- switch (pname) {
- case GL_TEXTURE_CROP_RECT_OES:
- memcpy(textureObject->crop_rect, params, 4*sizeof(GLint));
- break;
- default:
- texParameterx(target, pname, GLfixed(params[0]), c);
- return;
- }
-}
-
-void glTexParameterf(
- GLenum target, GLenum pname, GLfloat param)
-{
- ogles_context_t* c = ogles_context_t::get();
- texParameterx(target, pname, GLfixed(param), c);
-}
-
-void glTexParameterx(
- GLenum target, GLenum pname, GLfixed param)
-{
- ogles_context_t* c = ogles_context_t::get();
- texParameterx(target, pname, param, c);
-}
-
-void glTexParameteri(
- GLenum target, GLenum pname, GLint param)
-{
- ogles_context_t* c = ogles_context_t::get();
- texParameterx(target, pname, GLfixed(param), c);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#endif
-
-void glCompressedTexImage2D(
- GLenum target, GLint level, GLenum internalformat,
- GLsizei width, GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid *data)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (width<0 || height<0 || border!=0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- // "uncompress" the texture since pixelflinger doesn't support
- // any compressed texture format natively.
- GLenum format;
- GLenum type;
- switch (internalformat) {
- case GL_PALETTE8_RGB8_OES:
- case GL_PALETTE4_RGB8_OES:
- format = GL_RGB;
- type = GL_UNSIGNED_BYTE;
- break;
- case GL_PALETTE8_RGBA8_OES:
- case GL_PALETTE4_RGBA8_OES:
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- break;
- case GL_PALETTE8_R5_G6_B5_OES:
- case GL_PALETTE4_R5_G6_B5_OES:
- format = GL_RGB;
- type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case GL_PALETTE8_RGBA4_OES:
- case GL_PALETTE4_RGBA4_OES:
- format = GL_RGBA;
- type = GL_UNSIGNED_SHORT_4_4_4_4;
- break;
- case GL_PALETTE8_RGB5_A1_OES:
- case GL_PALETTE4_RGB5_A1_OES:
- format = GL_RGBA;
- type = GL_UNSIGNED_SHORT_5_5_5_1;
- break;
-#ifdef GL_OES_compressed_ETC1_RGB8_texture
- case GL_ETC1_RGB8_OES:
- format = GL_RGB;
- type = GL_UNSIGNED_BYTE;
- break;
-#endif
- default:
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- if (!data || !width || !height) {
- // unclear if this is an error or not...
- return;
- }
-
- int32_t size;
- GGLSurface* surface;
-
-#ifdef GL_OES_compressed_ETC1_RGB8_texture
- if (internalformat == GL_ETC1_RGB8_OES) {
- GLsizei compressedSize = etc1_get_encoded_data_size(width, height);
- if (compressedSize > imageSize) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- int error = createTextureSurface(c, &surface, &size,
- level, format, type, width, height);
- if (error) {
- ogles_error(c, error);
- return;
- }
- if (etc1_decode_image(
- (const etc1_byte*)data,
- (etc1_byte*)surface->data,
- width, height, 3, surface->stride*3) != 0) {
- ogles_error(c, GL_INVALID_OPERATION);
- }
- return;
- }
-#endif
-
- // all mipmap levels are specified at once.
- const int numLevels = level<0 ? -level : 1;
-
- if (dataSizePalette4(numLevels, width, height, format) > imageSize) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- for (int i=0 ; i<numLevels ; i++) {
- int lod_w = (width >> i) ? : 1;
- int lod_h = (height >> i) ? : 1;
- int error = createTextureSurface(c, &surface, &size,
- i, format, type, lod_w, lod_h);
- if (error) {
- ogles_error(c, error);
- return;
- }
- decodePalette4(data, i, width, height,
- surface->data, surface->stride, internalformat);
- }
-}
-
-
-void glTexImage2D(
- GLenum target, GLint level, GLint internalformat,
- GLsizei width, GLsizei height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (width<0 || height<0 || border!=0 || level < 0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (format != (GLenum)internalformat) {
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
- if (validFormatType(c, format, type)) {
- return;
- }
-
- int32_t size = 0;
- GGLSurface* surface = 0;
- int error = createTextureSurface(c, &surface, &size,
- level, format, type, width, height);
- if (error) {
- ogles_error(c, error);
- return;
- }
-
- if (pixels) {
- const int32_t formatIdx = convertGLPixelFormat(format, type);
- const GGLFormat& pixelFormat(c->rasterizer.formats[formatIdx]);
- const int32_t align = c->textures.unpackAlignment-1;
- const int32_t bpr = ((width * pixelFormat.size) + align) & ~align;
- const size_t size = bpr * height;
- const int32_t stride = bpr / pixelFormat.size;
-
- GGLSurface userSurface;
- userSurface.version = sizeof(userSurface);
- userSurface.width = width;
- userSurface.height = height;
- userSurface.stride = stride;
- userSurface.format = formatIdx;
- userSurface.compressedFormat = 0;
- userSurface.data = (GLubyte*)pixels;
-
- int err = copyPixels(c, *surface, 0, 0, userSurface, 0, 0, width, height);
- if (err) {
- ogles_error(c, err);
- return;
- }
- generateMipmap(c, level);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-void glCompressedTexSubImage2D(
- GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize,
- const GLvoid *data)
-{
- ogles_context_t* c = ogles_context_t::get();
- ogles_error(c, GL_INVALID_ENUM);
-}
-
-void glTexSubImage2D(
- GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid *pixels)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (xoffset<0 || yoffset<0 || width<0 || height<0 || level<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (validFormatType(c, format, type)) {
- return;
- }
-
- // find out which texture is bound to the current unit
- const int active = c->textures.active;
- EGLTextureObject* tex = c->textures.tmu[active].texture;
- const GGLSurface& surface(tex->mip(level));
-
- if (!tex->internalformat || tex->direct) {
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
-
- if (format != tex->internalformat) {
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
- if ((xoffset + width > GLsizei(surface.width)) ||
- (yoffset + height > GLsizei(surface.height))) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (!width || !height) {
- return; // okay, but no-op.
- }
-
- // figure out the size we need as well as the stride
- const int32_t formatIdx = convertGLPixelFormat(format, type);
- if (formatIdx == 0) { // we don't know what to do with this
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
-
- const GGLFormat& pixelFormat(c->rasterizer.formats[formatIdx]);
- const int32_t align = c->textures.unpackAlignment-1;
- const int32_t bpr = ((width * pixelFormat.size) + align) & ~align;
- const size_t size = bpr * height;
- const int32_t stride = bpr / pixelFormat.size;
- GGLSurface userSurface;
- userSurface.version = sizeof(userSurface);
- userSurface.width = width;
- userSurface.height = height;
- userSurface.stride = stride;
- userSurface.format = formatIdx;
- userSurface.compressedFormat = 0;
- userSurface.data = (GLubyte*)pixels;
-
- int err = copyPixels(c,
- surface, xoffset, yoffset,
- userSurface, 0, 0, width, height);
- if (err) {
- ogles_error(c, err);
- return;
- }
-
- generateMipmap(c, level);
-
- // since we only changed the content of the texture, we don't need
- // to call bindTexture on the main rasterizer.
-}
-
-// ----------------------------------------------------------------------------
-
-void glCopyTexImage2D(
- GLenum target, GLint level, GLenum internalformat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (internalformat<GL_ALPHA || internalformat>GL_LUMINANCE_ALPHA) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (width<0 || height<0 || border!=0 || level<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- GLenum format = 0;
- GLenum type = GL_UNSIGNED_BYTE;
- const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s;
- const int cbFormatIdx = cbSurface.format;
- switch (cbFormatIdx) {
- case GGL_PIXEL_FORMAT_RGB_565:
- type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case GGL_PIXEL_FORMAT_RGBA_5551:
- type = GL_UNSIGNED_SHORT_5_5_5_1;
- break;
- case GGL_PIXEL_FORMAT_RGBA_4444:
- type = GL_UNSIGNED_SHORT_4_4_4_4;
- break;
- }
- switch (internalformat) {
- case GL_ALPHA:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE:
- type = GL_UNSIGNED_BYTE;
- break;
- }
-
- // figure out the format to use for the new texture
- switch (cbFormatIdx) {
- case GGL_PIXEL_FORMAT_RGBA_8888:
- case GGL_PIXEL_FORMAT_A_8:
- case GGL_PIXEL_FORMAT_RGBA_5551:
- case GGL_PIXEL_FORMAT_RGBA_4444:
- format = internalformat;
- break;
- case GGL_PIXEL_FORMAT_RGBX_8888:
- case GGL_PIXEL_FORMAT_RGB_888:
- case GGL_PIXEL_FORMAT_RGB_565:
- case GGL_PIXEL_FORMAT_L_8:
- switch (internalformat) {
- case GL_LUMINANCE:
- case GL_RGB:
- format = internalformat;
- break;
- }
- break;
- }
-
- if (format == 0) {
- // invalid combination
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- // create the new texture...
- int32_t size;
- GGLSurface* surface;
- int error = createTextureSurface(c, &surface, &size,
- level, format, type, width, height);
- if (error) {
- ogles_error(c, error);
- return;
- }
-
- // The bottom row is stored first in textures
- GGLSurface txSurface(*surface);
- txSurface.stride = -txSurface.stride;
-
- // (x,y) is the lower-left corner of colorBuffer
- y = cbSurface.height - (y + height);
-
- /* The GLES spec says:
- * If any of the pixels within the specified rectangle are outside
- * the framebuffer associated with the current rendering context,
- * then the values obtained for those pixels are undefined.
- */
- if (x+width > GLint(cbSurface.width))
- width = cbSurface.width - x;
-
- if (y+height > GLint(cbSurface.height))
- height = cbSurface.height - y;
-
- int err = copyPixels(c,
- txSurface, 0, 0,
- cbSurface, x, y, width, height);
- if (err) {
- ogles_error(c, err);
- }
-
- generateMipmap(c, level);
-}
-
-void glCopyTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (xoffset<0 || yoffset<0 || width<0 || height<0 || level<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (!width || !height) {
- return; // okay, but no-op.
- }
-
- // find out which texture is bound to the current unit
- const int active = c->textures.active;
- EGLTextureObject* tex = c->textures.tmu[active].texture;
- const GGLSurface& surface(tex->mip(level));
-
- if (!tex->internalformat) {
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
- if ((xoffset + width > GLsizei(surface.width)) ||
- (yoffset + height > GLsizei(surface.height))) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- // The bottom row is stored first in textures
- GGLSurface txSurface(surface);
- txSurface.stride = -txSurface.stride;
-
- // (x,y) is the lower-left corner of colorBuffer
- const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s;
- y = cbSurface.height - (y + height);
-
- /* The GLES spec says:
- * If any of the pixels within the specified rectangle are outside
- * the framebuffer associated with the current rendering context,
- * then the values obtained for those pixels are undefined.
- */
- if (x+width > GLint(cbSurface.width))
- width = cbSurface.width - x;
-
- if (y+height > GLint(cbSurface.height))
- height = cbSurface.height - y;
-
- int err = copyPixels(c,
- txSurface, xoffset, yoffset,
- cbSurface, x, y, width, height);
- if (err) {
- ogles_error(c, err);
- return;
- }
-
- generateMipmap(c, level);
-}
-
-void glReadPixels(
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels)
-{
- ogles_context_t* c = ogles_context_t::get();
- if ((format != GL_RGBA) && (format != GL_RGB)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if ((type != GL_UNSIGNED_BYTE) && (type != GL_UNSIGNED_SHORT_5_6_5)) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
- if (width<0 || height<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (x<0 || y<0) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- int32_t formatIdx = GGL_PIXEL_FORMAT_NONE;
- if ((format == GL_RGBA) && (type == GL_UNSIGNED_BYTE)) {
- formatIdx = GGL_PIXEL_FORMAT_RGBA_8888;
- } else if ((format == GL_RGB) && (type == GL_UNSIGNED_SHORT_5_6_5)) {
- formatIdx = GGL_PIXEL_FORMAT_RGB_565;
- } else {
- ogles_error(c, GL_INVALID_OPERATION);
- return;
- }
-
- const GGLSurface& readSurface = c->rasterizer.state.buffers.read.s;
- if ((x+width > GLint(readSurface.width)) ||
- (y+height > GLint(readSurface.height))) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- const GGLFormat& pixelFormat(c->rasterizer.formats[formatIdx]);
- const int32_t align = c->textures.packAlignment-1;
- const int32_t bpr = ((width * pixelFormat.size) + align) & ~align;
- const int32_t stride = bpr / pixelFormat.size;
-
- GGLSurface userSurface;
- userSurface.version = sizeof(userSurface);
- userSurface.width = width;
- userSurface.height = height;
- userSurface.stride = -stride; // bottom row is transfered first
- userSurface.format = formatIdx;
- userSurface.compressedFormat = 0;
- userSurface.data = (GLubyte*)pixels;
-
- // use pixel-flinger to handle all the conversions
- GGLContext* ggl = getRasterizer(c);
- if (!ggl) {
- // the only reason this would fail is because we ran out of memory
- ogles_error(c, GL_OUT_OF_MEMORY);
- return;
- }
-
- ggl->colorBuffer(ggl, &userSurface); // destination is user buffer
- ggl->bindTexture(ggl, &readSurface); // source is read-buffer
- ggl->texCoord2i(ggl, x, readSurface.height - (y + height));
- ggl->recti(ggl, 0, 0, width, height);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark DrawTexture Extension
-#endif
-
-void glDrawTexsvOES(const GLshort* coords) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexiOES(coords[0], coords[1], coords[2], coords[3], coords[4], c);
-}
-void glDrawTexivOES(const GLint* coords) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexiOES(coords[0], coords[1], coords[2], coords[3], coords[4], c);
-}
-void glDrawTexsOES(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexiOES(x, y, z, w, h, c);
-}
-void glDrawTexiOES(GLint x, GLint y, GLint z, GLint w, GLint h) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexiOES(x, y, z, w, h, c);
-}
-
-void glDrawTexfvOES(const GLfloat* coords) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexxOES(
- gglFloatToFixed(coords[0]),
- gglFloatToFixed(coords[1]),
- gglFloatToFixed(coords[2]),
- gglFloatToFixed(coords[3]),
- gglFloatToFixed(coords[4]),
- c);
-}
-void glDrawTexxvOES(const GLfixed* coords) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexxOES(coords[0], coords[1], coords[2], coords[3], coords[4], c);
-}
-void glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h){
- ogles_context_t* c = ogles_context_t::get();
- drawTexxOES(
- gglFloatToFixed(x), gglFloatToFixed(y), gglFloatToFixed(z),
- gglFloatToFixed(w), gglFloatToFixed(h),
- c);
-}
-void glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) {
- ogles_context_t* c = ogles_context_t::get();
- drawTexxOES(x, y, z, w, h, c);
-}
-
-// ----------------------------------------------------------------------------
-#if 0
-#pragma mark -
-#pragma mark EGL Image Extension
-#endif
-
-void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- if (image == EGL_NO_IMAGE_KHR) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)image;
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (native_buffer->common.version != sizeof(ANativeWindowBuffer)) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- // bind it to the texture unit
- sp<EGLTextureObject> tex = getAndBindActiveTextureObject(c);
- tex->setImage(native_buffer);
-}
-
-void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- ogles_context_t* c = ogles_context_t::get();
- if (target != GL_RENDERBUFFER_OES) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- if (image == EGL_NO_IMAGE_KHR) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)image;
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
- if (native_buffer->common.version != sizeof(ANativeWindowBuffer)) {
- ogles_error(c, GL_INVALID_VALUE);
- return;
- }
-
- // well, we're not supporting this extension anyways
-}
diff --git a/opengl/libagl/texture.h b/opengl/libagl/texture.h
deleted file mode 100644
index 98f7550..0000000
--- a/opengl/libagl/texture.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* libs/opengles/texture.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_TEXTURE_H
-#define ANDROID_OPENGLES_TEXTURE_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-#include <private/pixelflinger/ggl_context.h>
-
-#include <GLES/gl.h>
-
-#include "context.h"
-
-namespace android {
-
-void ogles_init_texture(ogles_context_t* c);
-void ogles_uninit_texture(ogles_context_t* c);
-void ogles_validate_texture(ogles_context_t* c);
-void ogles_lock_textures(ogles_context_t* c);
-void ogles_unlock_textures(ogles_context_t* c);
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_TEXTURE_H
diff --git a/opengl/libagl/vertex.cpp b/opengl/libagl/vertex.cpp
deleted file mode 100644
index dad04d6..0000000
--- a/opengl/libagl/vertex.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/* libs/opengles/vertex.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "context.h"
-#include "fp.h"
-#include "vertex.h"
-#include "state.h"
-#include "matrix.h"
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-void ogles_init_vertex(ogles_context_t* c)
-{
- c->cull.enable = GL_FALSE;
- c->cull.cullFace = GL_BACK;
- c->cull.frontFace = GL_CCW;
-
- c->current.color.r = 0x10000;
- c->current.color.g = 0x10000;
- c->current.color.b = 0x10000;
- c->current.color.a = 0x10000;
-
- c->currentNormal.z = 0x10000;
-}
-
-void ogles_uninit_vertex(ogles_context_t* c)
-{
-}
-
-// ----------------------------------------------------------------------------
-// vertex processing
-// ----------------------------------------------------------------------------
-
-// Divides a vertex clip coordinates by W
-static inline
-void perspective(ogles_context_t* c, vertex_t* v, uint32_t enables)
-{
- // [x,y,z]window = vpt * ([x,y,z]clip / clip.w)
- // [w]window = 1/w
-
- // With a regular projection generated by glFrustum(),
- // we have w=-z, therefore, w is in [zNear, zFar].
- // Also, zNear and zFar are stricly positive,
- // and 1/w (window.w) is in [1/zFar, 1/zNear], usually this
- // means ]0, +inf[ -- however, it is always recommended
- // to use as large values as possible for zNear.
- // All in all, w is usually smaller than 1.0 (assuming
- // zNear is at least 1.0); and even if zNear is smaller than 1.0
- // values of w won't be too big.
-
- const int32_t rw = gglRecip28(v->clip.w);
- const GLfixed* const m = c->transforms.vpt.transform.matrix.m;
- v->window.w = rw;
- v->window.x = gglMulAddx(gglMulx(v->clip.x, rw, 16), m[ 0], m[12], 28);
- v->window.y = gglMulAddx(gglMulx(v->clip.y, rw, 16), m[ 5], m[13], 28);
- v->window.x = TRI_FROM_FIXED(v->window.x);
- v->window.y = TRI_FROM_FIXED(v->window.y);
- if (enables & GGL_ENABLE_DEPTH_TEST) {
- v->window.z = gglMulAddx(gglMulx(v->clip.z, rw, 16), m[10], m[14], 28);
- }
-}
-
-// frustum clipping and W-divide
-static inline
-void clipFrustumPerspective(ogles_context_t* c, vertex_t* v, uint32_t enables)
-{
- // ndc = clip / W
- // window = ncd * viewport
-
- // clip to the view-volume
- uint32_t clip = v->flags & vertex_t::CLIP_ALL;
- const GLfixed w = v->clip.w;
- if (v->clip.x < -w) clip |= vertex_t::CLIP_L;
- if (v->clip.x > w) clip |= vertex_t::CLIP_R;
- if (v->clip.y < -w) clip |= vertex_t::CLIP_B;
- if (v->clip.y > w) clip |= vertex_t::CLIP_T;
- if (v->clip.z < -w) clip |= vertex_t::CLIP_N;
- if (v->clip.z > w) clip |= vertex_t::CLIP_F;
-
- v->flags |= clip;
- c->arrays.cull &= clip;
-
- if (ggl_likely(!clip)) {
- // if the vertex is clipped, we don't do the perspective
- // divide, since we don't need its window coordinates.
- perspective(c, v, enables);
- }
-}
-
-// frustum clipping, user clipping and W-divide
-static inline
-void clipAllPerspective(ogles_context_t* c, vertex_t* v, uint32_t enables)
-{
- // compute eye coordinates
- c->arrays.mv_transform(
- &c->transforms.modelview.transform, &v->eye, &v->obj);
- v->flags |= vertex_t::EYE;
-
- // clip this vertex against each user clip plane
- uint32_t clip = 0;
- int planes = c->clipPlanes.enable;
- while (planes) {
- const int i = 31 - gglClz(planes);
- planes &= ~(1<<i);
- // XXX: we should have a special dot() for 2,3,4 coords vertices
- GLfixed d = dot4(c->clipPlanes.plane[i].equation.v, v->eye.v);
- if (d < 0) {
- clip |= 0x100<<i;
- }
- }
- v->flags |= clip;
-
- clipFrustumPerspective(c, v, enables);
-}
-
-// ----------------------------------------------------------------------------
-
-void ogles_vertex_project(ogles_context_t* c, vertex_t* v) {
- perspective(c, v, c->rasterizer.state.enables);
-}
-
-void ogles_vertex_perspective2D(ogles_context_t* c, vertex_t* v)
-{
- // here we assume w=1.0 and the viewport transformation
- // has been applied already.
- c->arrays.cull = 0;
- v->window.x = TRI_FROM_FIXED(v->clip.x);
- v->window.y = TRI_FROM_FIXED(v->clip.y);
- v->window.z = v->clip.z;
- v->window.w = v->clip.w << 12;
-}
-
-void ogles_vertex_perspective3DZ(ogles_context_t* c, vertex_t* v) {
- clipFrustumPerspective(c, v, GGL_ENABLE_DEPTH_TEST);
-}
-void ogles_vertex_perspective3D(ogles_context_t* c, vertex_t* v) {
- clipFrustumPerspective(c, v, 0);
-}
-void ogles_vertex_clipAllPerspective3DZ(ogles_context_t* c, vertex_t* v) {
- clipAllPerspective(c, v, GGL_ENABLE_DEPTH_TEST);
-}
-void ogles_vertex_clipAllPerspective3D(ogles_context_t* c, vertex_t* v) {
- clipAllPerspective(c, v, 0);
-}
-
-static void clipPlanex(GLenum plane, const GLfixed* equ, ogles_context_t* c)
-{
- const int p = plane - GL_CLIP_PLANE0;
- if (ggl_unlikely(uint32_t(p) > (GL_CLIP_PLANE5 - GL_CLIP_PLANE0))) {
- ogles_error(c, GL_INVALID_ENUM);
- return;
- }
-
- vec4_t& equation = c->clipPlanes.plane[p].equation;
- memcpy(equation.v, equ, sizeof(vec4_t));
-
- ogles_validate_transform(c, transform_state_t::MVIT);
- transform_t& mvit = c->transforms.mvit4;
- mvit.point4(&mvit, &equation, &equation);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-
-void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->current.color.r = gglFloatToFixed(r);
- c->currentColorClamped.r = gglClampx(c->current.color.r);
- c->current.color.g = gglFloatToFixed(g);
- c->currentColorClamped.g = gglClampx(c->current.color.g);
- c->current.color.b = gglFloatToFixed(b);
- c->currentColorClamped.b = gglClampx(c->current.color.b);
- c->current.color.a = gglFloatToFixed(a);
- c->currentColorClamped.a = gglClampx(c->current.color.a);
-}
-
-void glColor4x(GLfixed r, GLfixed g, GLfixed b, GLfixed a)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->current.color.r = r;
- c->current.color.g = g;
- c->current.color.b = b;
- c->current.color.a = a;
- c->currentColorClamped.r = gglClampx(r);
- c->currentColorClamped.g = gglClampx(g);
- c->currentColorClamped.b = gglClampx(b);
- c->currentColorClamped.a = gglClampx(a);
-}
-
-void glNormal3f(GLfloat x, GLfloat y, GLfloat z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->currentNormal.x = gglFloatToFixed(x);
- c->currentNormal.y = gglFloatToFixed(y);
- c->currentNormal.z = gglFloatToFixed(z);
-}
-
-void glNormal3x(GLfixed x, GLfixed y, GLfixed z)
-{
- ogles_context_t* c = ogles_context_t::get();
- c->currentNormal.x = x;
- c->currentNormal.y = y;
- c->currentNormal.z = z;
-}
-
-// ----------------------------------------------------------------------------
-
-void glClipPlanef(GLenum plane, const GLfloat* equ)
-{
- const GLfixed equx[4] = {
- gglFloatToFixed(equ[0]),
- gglFloatToFixed(equ[1]),
- gglFloatToFixed(equ[2]),
- gglFloatToFixed(equ[3])
- };
- ogles_context_t* c = ogles_context_t::get();
- clipPlanex(plane, equx, c);
-}
-
-void glClipPlanex(GLenum plane, const GLfixed* equ)
-{
- ogles_context_t* c = ogles_context_t::get();
- clipPlanex(plane, equ, c);
-}
diff --git a/opengl/libagl/vertex.h b/opengl/libagl/vertex.h
deleted file mode 100644
index 55e6213..0000000
--- a/opengl/libagl/vertex.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* libs/opengles/vertex.h
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#ifndef ANDROID_OPENGLES_VERTEX_H
-#define ANDROID_OPENGLES_VERTEX_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-
-namespace android {
-
-namespace gl {
-struct vertex_t;
-struct ogles_context_t;
-};
-
-void ogles_init_vertex(ogles_context_t* c);
-void ogles_uninit_vertex(ogles_context_t* c);
-
-void ogles_vertex_perspective2D(ogles_context_t*, vertex_t*);
-
-void ogles_vertex_perspective3D(ogles_context_t*, vertex_t*);
-void ogles_vertex_perspective3DZ(ogles_context_t*, vertex_t*);
-void ogles_vertex_clipAllPerspective3D(ogles_context_t*, vertex_t*);
-void ogles_vertex_clipAllPerspective3DZ(ogles_context_t*, vertex_t*);
-
-
-void ogles_vertex_project(ogles_context_t* c, vertex_t*);
-
-}; // namespace android
-
-#endif // ANDROID_OPENGLES_VERTEX_H
-
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
deleted file mode 100644
index 66bc64d..0000000
--- a/opengl/libs/Android.mk
+++ /dev/null
@@ -1,167 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-###############################################################################
-# Build META EGL library
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- EGL/egl_tls.cpp \
- EGL/egl_cache.cpp \
- EGL/egl_display.cpp \
- EGL/egl_object.cpp \
- EGL/egl.cpp \
- EGL/eglApi.cpp \
- EGL/trace.cpp \
- EGL/getProcAddress.cpp.arm \
- EGL/Loader.cpp \
-#
-
-LOCAL_SHARED_LIBRARIES += libcutils libutils libGLES_trace
-LOCAL_LDLIBS := -lpthread -ldl
-LOCAL_MODULE:= libEGL
-LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL
-LOCAL_SHARED_LIBRARIES += libdl
-# Bionic's private TLS header relies on the ARCH_ARM_HAVE_TLS_REGISTER to
-# select the appropriate TLS codepath
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-# we need to access the private Bionic header <bionic_tls.h>
-LOCAL_C_INCLUDES += bionic/libc/private
-
-LOCAL_CFLAGS += -DLOG_TAG=\"libEGL\"
-LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-LOCAL_CFLAGS += -fvisibility=hidden
-LOCAL_CFLAGS += -DEGL_TRACE=1
-
-ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
-LOCAL_CFLAGS += -DADRENO130=1
-endif
-
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
-ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),)
- LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE)
-endif
-
-ifneq ($(MAX_EGL_CACHE_SIZE),)
- LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
-endif
-
-include $(BUILD_SHARED_LIBRARY)
-installed_libEGL := $(LOCAL_INSTALLED_MODULE)
-
-# OpenGL drivers config file
-ifneq ($(BOARD_EGL_CFG),)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := egl.cfg
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
-LOCAL_SRC_FILES := ../../../../$(BOARD_EGL_CFG)
-include $(BUILD_PREBUILT)
-
-# make sure we depend on egl.cfg, so it gets installed
-$(installed_libEGL): | egl.cfg
-
-endif
-
-###############################################################################
-# Build the wrapper OpenGL ES 1.x library
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- GLES_CM/gl.cpp.arm \
-#
-
-LOCAL_SHARED_LIBRARIES += libcutils libEGL
-LOCAL_LDLIBS := -lpthread -ldl
-LOCAL_MODULE:= libGLESv1_CM
-
-LOCAL_SHARED_LIBRARIES += libdl
-# we need to access the private Bionic header <bionic_tls.h>
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-LOCAL_C_INCLUDES += bionic/libc/private
-
-LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv1\"
-LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-LOCAL_CFLAGS += -fvisibility=hidden
-
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-###############################################################################
-# Build the wrapper OpenGL ES 2.x library
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- GLES2/gl2.cpp.arm \
-#
-
-LOCAL_SHARED_LIBRARIES += libcutils libEGL
-LOCAL_LDLIBS := -lpthread -ldl
-LOCAL_MODULE:= libGLESv2
-
-LOCAL_SHARED_LIBRARIES += libdl
-# we need to access the private Bionic header <bionic_tls.h>
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-LOCAL_C_INCLUDES += bionic/libc/private
-
-LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv2\"
-LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-LOCAL_CFLAGS += -fvisibility=hidden
-
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
-include $(BUILD_SHARED_LIBRARY)
-
-###############################################################################
-# Build the ETC1 host static library
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- ETC1/etc1.cpp \
-#
-
-LOCAL_LDLIBS := -lpthread -ldl
-LOCAL_MODULE:= libETC1
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-###############################################################################
-# Build the ETC1 device library
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- ETC1/etc1.cpp \
-#
-
-LOCAL_LDLIBS := -lpthread -ldl
-LOCAL_MODULE:= libETC1
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
deleted file mode 100644
index 0b1016c..0000000
--- a/opengl/libs/EGL/Loader.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <dlfcn.h>
-#include <limits.h>
-
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-#include <EGL/egl.h>
-
-#include "egldefs.h"
-#include "glestrace.h"
-#include "hooks.h"
-#include "Loader.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-
-/*
- * EGL drivers are called
- *
- * /system/lib/egl/lib{[EGL|GLESv1_CM|GLESv2] | GLES}_$TAG.so
- *
- */
-
-ANDROID_SINGLETON_STATIC_INSTANCE( Loader )
-
-/* This function is called to check whether we run inside the emulator,
- * and if this is the case whether GLES GPU emulation is supported.
- *
- * Returned values are:
- * -1 -> not running inside the emulator
- * 0 -> running inside the emulator, but GPU emulation not supported
- * 1 -> running inside the emulator, GPU emulation is supported
- * through the "emulation" config.
- */
-static int
-checkGlesEmulationStatus(void)
-{
- /* We're going to check for the following kernel parameters:
- *
- * qemu=1 -> tells us that we run inside the emulator
- * android.qemu.gles=<number> -> tells us the GLES GPU emulation status
- *
- * Note that we will return <number> if we find it. This let us support
- * more additionnal emulation modes in the future.
- */
- char prop[PROPERTY_VALUE_MAX];
- int result = -1;
-
- /* First, check for qemu=1 */
- property_get("ro.kernel.qemu",prop,"0");
- if (atoi(prop) != 1)
- return -1;
-
- /* We are in the emulator, get GPU status value */
- property_get("ro.kernel.qemu.gles",prop,"0");
- return atoi(prop);
-}
-
-// ----------------------------------------------------------------------------
-
-Loader::driver_t::driver_t(void* gles)
-{
- dso[0] = gles;
- for (size_t i=1 ; i<NELEM(dso) ; i++)
- dso[i] = 0;
-}
-
-Loader::driver_t::~driver_t()
-{
- for (size_t i=0 ; i<NELEM(dso) ; i++) {
- if (dso[i]) {
- dlclose(dso[i]);
- dso[i] = 0;
- }
- }
-}
-
-status_t Loader::driver_t::set(void* hnd, int32_t api)
-{
- switch (api) {
- case EGL:
- dso[0] = hnd;
- break;
- case GLESv1_CM:
- dso[1] = hnd;
- break;
- case GLESv2:
- dso[2] = hnd;
- break;
- default:
- return BAD_INDEX;
- }
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-Loader::Loader()
-{
- char line[256];
- char tag[256];
-
- /* Special case for GLES emulation */
- if (checkGlesEmulationStatus() == 0) {
- ALOGD("Emulator without GPU support detected. "
- "Fallback to software renderer.");
- mDriverTag.setTo("android");
- return;
- }
-
- /* Otherwise, use egl.cfg */
- FILE* cfg = fopen("/system/lib/egl/egl.cfg", "r");
- if (cfg == NULL) {
- // default config
- ALOGD("egl.cfg not found, using default config");
- mDriverTag.setTo("android");
- } else {
- while (fgets(line, 256, cfg)) {
- int dpy, impl;
- if (sscanf(line, "%u %u %s", &dpy, &impl, tag) == 3) {
- //ALOGD(">>> %u %u %s", dpy, impl, tag);
- // We only load the h/w accelerated implementation
- if (tag != String8("android")) {
- mDriverTag = tag;
- }
- }
- }
- fclose(cfg);
- }
-}
-
-Loader::~Loader()
-{
- GLTrace_stop();
-}
-
-void* Loader::open(egl_connection_t* cnx)
-{
- void* dso;
- driver_t* hnd = 0;
-
- char const* tag = mDriverTag.string();
- if (tag) {
- dso = load_driver("GLES", tag, cnx, EGL | GLESv1_CM | GLESv2);
- if (dso) {
- hnd = new driver_t(dso);
- } else {
- // Always load EGL first
- dso = load_driver("EGL", tag, cnx, EGL);
- if (dso) {
- hnd = new driver_t(dso);
- // TODO: make this more automated
- hnd->set( load_driver("GLESv1_CM", tag, cnx, GLESv1_CM), GLESv1_CM );
- hnd->set( load_driver("GLESv2", tag, cnx, GLESv2), GLESv2 );
- }
- }
- }
-
- LOG_FATAL_IF(!index && !hnd,
- "couldn't find the default OpenGL ES implementation "
- "for default display");
-
- return (void*)hnd;
-}
-
-status_t Loader::close(void* driver)
-{
- driver_t* hnd = (driver_t*)driver;
- delete hnd;
- return NO_ERROR;
-}
-
-void Loader::init_api(void* dso,
- char const * const * api,
- __eglMustCastToProperFunctionPointerType* curr,
- getProcAddressType getProcAddress)
-{
- const ssize_t SIZE = 256;
- char scrap[SIZE];
- while (*api) {
- char const * name = *api;
- __eglMustCastToProperFunctionPointerType f =
- (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
- if (f == NULL) {
- // couldn't find the entry-point, use eglGetProcAddress()
- f = getProcAddress(name);
- }
- if (f == NULL) {
- // Try without the OES postfix
- ssize_t index = ssize_t(strlen(name)) - 3;
- if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) {
- strncpy(scrap, name, index);
- scrap[index] = 0;
- f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
- //ALOGD_IF(f, "found <%s> instead", scrap);
- }
- }
- if (f == NULL) {
- // Try with the OES postfix
- ssize_t index = ssize_t(strlen(name)) - 3;
- if (index>0 && strcmp(name+index, "OES")) {
- snprintf(scrap, SIZE, "%sOES", name);
- f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
- //ALOGD_IF(f, "found <%s> instead", scrap);
- }
- }
- if (f == NULL) {
- //ALOGD("%s", name);
- f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
-
- /*
- * GL_EXT_debug_label is special, we always report it as
- * supported, it's handled by GLES_trace. If GLES_trace is not
- * enabled, then these are no-ops.
- */
- if (!strcmp(name, "glInsertEventMarkerEXT")) {
- f = (__eglMustCastToProperFunctionPointerType)gl_noop;
- } else if (!strcmp(name, "glPushGroupMarkerEXT")) {
- f = (__eglMustCastToProperFunctionPointerType)gl_noop;
- } else if (!strcmp(name, "glPopGroupMarkerEXT")) {
- f = (__eglMustCastToProperFunctionPointerType)gl_noop;
- }
- }
- *curr++ = f;
- api++;
- }
-}
-
-void *Loader::load_driver(const char* kind, const char *tag,
- egl_connection_t* cnx, uint32_t mask)
-{
- char driver_absolute_path[PATH_MAX];
- const char* const search1 = "/vendor/lib/egl/lib%s_%s.so";
- const char* const search2 = "/system/lib/egl/lib%s_%s.so";
-
- snprintf(driver_absolute_path, PATH_MAX, search1, kind, tag);
- if (access(driver_absolute_path, R_OK)) {
- snprintf(driver_absolute_path, PATH_MAX, search2, kind, tag);
- if (access(driver_absolute_path, R_OK)) {
- // this happens often, we don't want to log an error
- return 0;
- }
- }
-
- void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);
- if (dso == 0) {
- const char* err = dlerror();
- ALOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown");
- return 0;
- }
-
- ALOGD("loaded %s", driver_absolute_path);
-
- if (mask & EGL) {
- getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");
-
- ALOGE_IF(!getProcAddress,
- "can't find eglGetProcAddress() in %s", driver_absolute_path);
-
- egl_t* egl = &cnx->egl;
- __eglMustCastToProperFunctionPointerType* curr =
- (__eglMustCastToProperFunctionPointerType*)egl;
- char const * const * api = egl_names;
- while (*api) {
- char const * name = *api;
- __eglMustCastToProperFunctionPointerType f =
- (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
- if (f == NULL) {
- // couldn't find the entry-point, use eglGetProcAddress()
- f = getProcAddress(name);
- if (f == NULL) {
- f = (__eglMustCastToProperFunctionPointerType)0;
- }
- }
- *curr++ = f;
- api++;
- }
- }
-
- if (mask & GLESv1_CM) {
- init_api(dso, gl_names,
- (__eglMustCastToProperFunctionPointerType*)
- &cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl,
- getProcAddress);
- }
-
- if (mask & GLESv2) {
- init_api(dso, gl_names,
- (__eglMustCastToProperFunctionPointerType*)
- &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
- getProcAddress);
- }
-
- return dso;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/Loader.h b/opengl/libs/EGL/Loader.h
deleted file mode 100644
index 30773cb..0000000
--- a/opengl/libs/EGL/Loader.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- ** Copyright 2009, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGL_LOADER_H
-#define ANDROID_EGL_LOADER_H
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-
-#include <utils/Errors.h>
-#include <utils/Singleton.h>
-#include <utils/String8.h>
-
-#include <EGL/egl.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-struct egl_connection_t;
-
-class Loader : public Singleton<Loader>
-{
- friend class Singleton<Loader>;
-
- typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)(
- const char*);
-
- enum {
- EGL = 0x01,
- GLESv1_CM = 0x02,
- GLESv2 = 0x04
- };
- struct driver_t {
- driver_t(void* gles);
- ~driver_t();
- status_t set(void* hnd, int32_t api);
- void* dso[3];
- };
-
- String8 mDriverTag;
- getProcAddressType getProcAddress;
-
-public:
- ~Loader();
-
- void* open(egl_connection_t* cnx);
- status_t close(void* driver);
-
-private:
- Loader();
- void *load_driver(const char* kind, const char *tag, egl_connection_t* cnx, uint32_t mask);
-
- static __attribute__((noinline))
- void init_api(void* dso,
- char const * const * api,
- __eglMustCastToProperFunctionPointerType* curr,
- getProcAddressType getProcAddress);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_EGL_LOADER_H */
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
deleted file mode 100644
index eec5ce1..0000000
--- a/opengl/libs/EGL/egl.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <hardware/gralloc.h>
-#include <system/window.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <cutils/properties.h>
-#include <cutils/memory.h>
-
-#include <utils/CallStack.h>
-#include <utils/String8.h>
-
-#include "egldefs.h"
-#include "egl_impl.h"
-#include "egl_tls.h"
-#include "glestrace.h"
-#include "hooks.h"
-#include "Loader.h"
-
-#include "egl_display.h"
-#include "egl_object.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-egl_connection_t gEGLImpl;
-gl_hooks_t gHooks[2];
-gl_hooks_t gHooksNoContext;
-pthread_key_t gGLWrapperKey = -1;
-
-// ----------------------------------------------------------------------------
-
-#if EGL_TRACE
-
-EGLAPI pthread_key_t gGLTraceKey = -1;
-
-// ----------------------------------------------------------------------------
-
-int gEGLDebugLevel;
-
-static int sEGLTraceLevel;
-static int sEGLApplicationTraceLevel;
-
-extern gl_hooks_t gHooksTrace;
-
-static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) {
- pthread_setspecific(gGLTraceKey, value);
-}
-
-gl_hooks_t const* getGLTraceThreadSpecific() {
- return static_cast<gl_hooks_t*>(pthread_getspecific(gGLTraceKey));
-}
-
-void initEglTraceLevel() {
- char value[PROPERTY_VALUE_MAX];
- property_get("debug.egl.trace", value, "0");
- int propertyLevel = atoi(value);
- int applicationLevel = sEGLApplicationTraceLevel;
- sEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel;
-
- property_get("debug.egl.debug_proc", value, "");
- if (strlen(value) == 0)
- return;
-
- long pid = getpid();
- char procPath[128] = {};
- sprintf(procPath, "/proc/%ld/cmdline", pid);
- FILE * file = fopen(procPath, "r");
- if (file) {
- char cmdline[256] = {};
- if (fgets(cmdline, sizeof(cmdline) - 1, file)) {
- if (!strncmp(value, cmdline, strlen(value))) {
- // set EGL debug if the "debug.egl.debug_proc" property
- // matches the prefix of this application's command line
- gEGLDebugLevel = 1;
- }
- }
- fclose(file);
- }
-
- if (gEGLDebugLevel > 0) {
- GLTrace_start();
- }
-}
-
-void setGLHooksThreadSpecific(gl_hooks_t const *value) {
- if (sEGLTraceLevel > 0) {
- setGlTraceThreadSpecific(value);
- setGlThreadSpecific(&gHooksTrace);
- } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
- setGlTraceThreadSpecific(value);
- setGlThreadSpecific(GLTrace_getGLHooks());
- } else {
- setGlThreadSpecific(value);
- }
-}
-
-/*
- * Global entry point to allow applications to modify their own trace level.
- * The effective trace level is the max of this level and the value of debug.egl.trace.
- */
-extern "C"
-void setGLTraceLevel(int level) {
- sEGLApplicationTraceLevel = level;
-}
-
-#else
-
-void setGLHooksThreadSpecific(gl_hooks_t const *value) {
- setGlThreadSpecific(value);
-}
-
-#endif
-
-/*****************************************************************************/
-
-static int gl_no_context() {
- if (egl_tls_t::logNoContextCall()) {
- ALOGE("call to OpenGL ES API with no current context "
- "(logged once per thread)");
- char value[PROPERTY_VALUE_MAX];
- property_get("debug.egl.callstack", value, "0");
- if (atoi(value)) {
- CallStack stack;
- stack.update();
- stack.dump();
- }
- }
- return 0;
-}
-
-static void early_egl_init(void)
-{
-#if !USE_FAST_TLS_KEY
- pthread_key_create(&gGLWrapperKey, NULL);
-#endif
-#if EGL_TRACE
- pthread_key_create(&gGLTraceKey, NULL);
- initEglTraceLevel();
-#endif
- uint32_t addr = (uint32_t)((void*)gl_no_context);
- android_memset32(
- (uint32_t*)(void*)&gHooksNoContext,
- addr,
- sizeof(gHooksNoContext));
-
- setGLHooksThreadSpecific(&gHooksNoContext);
-}
-
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-static int sEarlyInitState = pthread_once(&once_control, &early_egl_init);
-
-// ----------------------------------------------------------------------------
-
-egl_display_t* validate_display(EGLDisplay dpy) {
- egl_display_t * const dp = get_display(dpy);
- if (!dp)
- return setError(EGL_BAD_DISPLAY, (egl_display_t*)NULL);
- if (!dp->isReady())
- return setError(EGL_NOT_INITIALIZED, (egl_display_t*)NULL);
-
- return dp;
-}
-
-egl_connection_t* validate_display_config(EGLDisplay dpy, EGLConfig,
- egl_display_t const*& dp) {
- dp = validate_display(dpy);
- if (!dp)
- return (egl_connection_t*) NULL;
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso == 0) {
- return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
- }
- return cnx;
-}
-
-// ----------------------------------------------------------------------------
-
-const GLubyte * egl_get_string_for_current_context(GLenum name) {
- // NOTE: returning NULL here will fall-back to the default
- // implementation.
-
- EGLContext context = egl_tls_t::getContext();
- if (context == EGL_NO_CONTEXT)
- return NULL;
-
- egl_context_t const * const c = get_context(context);
- if (c == NULL) // this should never happen, by construction
- return NULL;
-
- if (name != GL_EXTENSIONS)
- return NULL;
-
- return (const GLubyte *)c->gl_extensions.string();
-}
-
-// ----------------------------------------------------------------------------
-
-// this mutex protects:
-// d->disp[]
-// egl_init_drivers_locked()
-//
-static EGLBoolean egl_init_drivers_locked() {
- if (sEarlyInitState) {
- // initialized by static ctor. should be set here.
- return EGL_FALSE;
- }
-
- // get our driver loader
- Loader& loader(Loader::getInstance());
-
- // dynamically load our EGL implementation
- egl_connection_t* cnx = &gEGLImpl;
- if (cnx->dso == 0) {
- cnx->hooks[egl_connection_t::GLESv1_INDEX] =
- &gHooks[egl_connection_t::GLESv1_INDEX];
- cnx->hooks[egl_connection_t::GLESv2_INDEX] =
- &gHooks[egl_connection_t::GLESv2_INDEX];
- cnx->dso = loader.open(cnx);
- }
-
- return cnx->dso ? EGL_TRUE : EGL_FALSE;
-}
-
-static pthread_mutex_t sInitDriverMutex = PTHREAD_MUTEX_INITIALIZER;
-
-EGLBoolean egl_init_drivers() {
- EGLBoolean res;
- pthread_mutex_lock(&sInitDriverMutex);
- res = egl_init_drivers_locked();
- pthread_mutex_unlock(&sInitDriverMutex);
- return res;
-}
-
-void gl_unimplemented() {
- ALOGE("called unimplemented OpenGL ES API");
-}
-
-void gl_noop() {
-}
-
-// ----------------------------------------------------------------------------
-
-#if USE_FAST_TLS_KEY
-
-// We have a dedicated TLS slot in bionic
-static inline gl_hooks_t const * volatile * get_tls_hooks() {
- volatile void *tls_base = __get_tls();
- gl_hooks_t const * volatile * tls_hooks =
- reinterpret_cast<gl_hooks_t const * volatile *>(tls_base);
- return tls_hooks;
-}
-
-void setGlThreadSpecific(gl_hooks_t const *value) {
- gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
- tls_hooks[TLS_SLOT_OPENGL_API] = value;
-}
-
-gl_hooks_t const* getGlThreadSpecific() {
- gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
- gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API];
- if (hooks) return hooks;
- return &gHooksNoContext;
-}
-
-#else
-
-void setGlThreadSpecific(gl_hooks_t const *value) {
- pthread_setspecific(gGLWrapperKey, value);
-}
-
-gl_hooks_t const* getGlThreadSpecific() {
- gl_hooks_t const* hooks = static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey));
- if (hooks) return hooks;
- return &gHooksNoContext;
-}
-
-#endif
-
-// ----------------------------------------------------------------------------
-// GL / EGL hooks
-// ----------------------------------------------------------------------------
-
-#undef GL_ENTRY
-#undef EGL_ENTRY
-#define GL_ENTRY(_r, _api, ...) #_api,
-#define EGL_ENTRY(_r, _api, ...) #_api,
-
-char const * const gl_names[] = {
- #include "entries.in"
- NULL
-};
-
-char const * const egl_names[] = {
- #include "egl_entries.in"
- NULL
-};
-
-#undef GL_ENTRY
-#undef EGL_ENTRY
-
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
deleted file mode 100644
index a1bd82d..0000000
--- a/opengl/libs/EGL/eglApi.cpp
+++ /dev/null
@@ -1,1139 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <hardware/gralloc.h>
-#include <system/window.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <cutils/properties.h>
-#include <cutils/memory.h>
-
-#include <utils/KeyedVector.h>
-#include <utils/SortedVector.h>
-#include <utils/String8.h>
-#include <utils/Trace.h>
-
-#include "egl_impl.h"
-#include "egl_tls.h"
-#include "glestrace.h"
-#include "hooks.h"
-
-#include "egl_display.h"
-#include "egl_impl.h"
-#include "egl_object.h"
-#include "egl_tls.h"
-#include "egldefs.h"
-
-using namespace android;
-
-// ----------------------------------------------------------------------------
-
-#define EGL_VERSION_HW_ANDROID 0x3143
-
-struct extention_map_t {
- const char* name;
- __eglMustCastToProperFunctionPointerType address;
-};
-
-static const extention_map_t sExtentionMap[] = {
- { "eglLockSurfaceKHR",
- (__eglMustCastToProperFunctionPointerType)&eglLockSurfaceKHR },
- { "eglUnlockSurfaceKHR",
- (__eglMustCastToProperFunctionPointerType)&eglUnlockSurfaceKHR },
- { "eglCreateImageKHR",
- (__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR },
- { "eglDestroyImageKHR",
- (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
- { "eglGetSystemTimeFrequencyNV",
- (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
- { "eglGetSystemTimeNV",
- (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV },
-};
-
-// accesses protected by sExtensionMapMutex
-static DefaultKeyedVector<String8, __eglMustCastToProperFunctionPointerType> sGLExtentionMap;
-static int sGLExtentionSlot = 0;
-static pthread_mutex_t sExtensionMapMutex = PTHREAD_MUTEX_INITIALIZER;
-
-static void(*findProcAddress(const char* name,
- const extention_map_t* map, size_t n))() {
- for (uint32_t i=0 ; i<n ; i++) {
- if (!strcmp(name, map[i].name)) {
- return map[i].address;
- }
- }
- return NULL;
-}
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-extern void setGLHooksThreadSpecific(gl_hooks_t const *value);
-extern EGLBoolean egl_init_drivers();
-extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS];
-extern int gEGLDebugLevel;
-extern gl_hooks_t gHooksTrace;
-} // namespace android;
-
-// ----------------------------------------------------------------------------
-
-static inline void clearError() { egl_tls_t::clearError(); }
-static inline EGLContext getContext() { return egl_tls_t::getContext(); }
-
-// ----------------------------------------------------------------------------
-
-EGLDisplay eglGetDisplay(EGLNativeDisplayType display)
-{
- clearError();
-
- uint32_t index = uint32_t(display);
- if (index >= NUM_DISPLAYS) {
- return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
- }
-
- if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
- }
-
- EGLDisplay dpy = egl_display_t::getFromNativeDisplay(display);
- return dpy;
-}
-
-// ----------------------------------------------------------------------------
-// Initialization
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- clearError();
-
- egl_display_t * const dp = get_display(dpy);
- if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- EGLBoolean res = dp->initialize(major, minor);
-
- return res;
-}
-
-EGLBoolean eglTerminate(EGLDisplay dpy)
-{
- // NOTE: don't unload the drivers b/c some APIs can be called
- // after eglTerminate() has been called. eglTerminate() only
- // terminates an EGLDisplay, not a EGL itself.
-
- clearError();
-
- egl_display_t* const dp = get_display(dpy);
- if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- EGLBoolean res = dp->terminate();
-
- return res;
-}
-
-// ----------------------------------------------------------------------------
-// configuration
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglGetConfigs( EGLDisplay dpy,
- EGLConfig *configs,
- EGLint config_size, EGLint *num_config)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- if (num_config==0) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- EGLBoolean res = EGL_FALSE;
- *num_config = 0;
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso) {
- res = cnx->egl.eglGetConfigs(
- dp->disp.dpy, configs, config_size, num_config);
- }
-
- return res;
-}
-
-EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- if (num_config==0) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- EGLBoolean res = EGL_FALSE;
- *num_config = 0;
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso) {
- res = cnx->egl.eglChooseConfig(
- dp->disp.dpy, attrib_list, configs, config_size, num_config);
- }
- return res;
-}
-
-EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value)
-{
- clearError();
-
- egl_display_t const* dp = 0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp);
- if (!cnx) return EGL_FALSE;
-
- return cnx->egl.eglGetConfigAttrib(
- dp->disp.dpy, config, attribute, value);
-}
-
-// ----------------------------------------------------------------------------
-// surfaces
-// ----------------------------------------------------------------------------
-
-EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
- NativeWindowType window,
- const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const* dp = 0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp);
- if (cnx) {
- EGLDisplay iDpy = dp->disp.dpy;
- EGLint format;
-
- if (native_window_api_connect(window, NATIVE_WINDOW_API_EGL) != OK) {
- ALOGE("EGLNativeWindowType %p already connected to another API",
- window);
- return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
- }
-
- // set the native window's buffers format to match this config
- if (cnx->egl.eglGetConfigAttrib(iDpy,
- config, EGL_NATIVE_VISUAL_ID, &format)) {
- if (format != 0) {
- int err = native_window_set_buffers_format(window, format);
- if (err != 0) {
- ALOGE("error setting native window pixel format: %s (%d)",
- strerror(-err), err);
- native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
- return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
- }
- }
- }
-
- // the EGL spec requires that a new EGLSurface default to swap interval
- // 1, so explicitly set that on the window here.
- ANativeWindow* anw = reinterpret_cast<ANativeWindow*>(window);
- anw->setSwapInterval(anw, 1);
-
- EGLSurface surface = cnx->egl.eglCreateWindowSurface(
- iDpy, config, window, attrib_list);
- if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dpy, config, window, surface, cnx);
- return s;
- }
-
- // EGLSurface creation failed
- native_window_set_buffers_format(window, 0);
- native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
- }
- return EGL_NO_SURFACE;
-}
-
-EGLSurface eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config,
- NativePixmapType pixmap,
- const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const* dp = 0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp);
- if (cnx) {
- EGLSurface surface = cnx->egl.eglCreatePixmapSurface(
- dp->disp.dpy, config, pixmap, attrib_list);
- if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dpy, config, NULL, surface, cnx);
- return s;
- }
- }
- return EGL_NO_SURFACE;
-}
-
-EGLSurface eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const* dp = 0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp);
- if (cnx) {
- EGLSurface surface = cnx->egl.eglCreatePbufferSurface(
- dp->disp.dpy, config, attrib_list);
- if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dpy, config, NULL, surface, cnx);
- return s;
- }
- }
- return EGL_NO_SURFACE;
-}
-
-EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t * const s = get_surface(surface);
- EGLBoolean result = s->cnx->egl.eglDestroySurface(dp->disp.dpy, s->surface);
- if (result == EGL_TRUE) {
- _s.terminate();
- }
- return result;
-}
-
-EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint *value)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- return s->cnx->egl.eglQuerySurface(
- dp->disp.dpy, s->surface, attribute, value);
-}
-
-void EGLAPI eglBeginFrame(EGLDisplay dpy, EGLSurface surface) {
- ATRACE_CALL();
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) {
- return;
- }
-
- SurfaceRef _s(dp, surface);
- if (!_s.get()) {
- setError(EGL_BAD_SURFACE, EGL_FALSE);
- return;
- }
-
- int64_t timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
-
- egl_surface_t const * const s = get_surface(surface);
- native_window_set_buffers_timestamp(s->win.get(), timestamp);
-}
-
-// ----------------------------------------------------------------------------
-// Contexts
-// ----------------------------------------------------------------------------
-
-EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
- EGLContext share_list, const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const* dp = 0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp);
- if (cnx) {
- if (share_list != EGL_NO_CONTEXT) {
- egl_context_t* const c = get_context(share_list);
- share_list = c->context;
- }
- EGLContext context = cnx->egl.eglCreateContext(
- dp->disp.dpy, config, share_list, attrib_list);
- if (context != EGL_NO_CONTEXT) {
- // figure out if it's a GLESv1 or GLESv2
- int version = 0;
- if (attrib_list) {
- while (*attrib_list != EGL_NONE) {
- GLint attr = *attrib_list++;
- GLint value = *attrib_list++;
- if (attr == EGL_CONTEXT_CLIENT_VERSION) {
- if (value == 1) {
- version = egl_connection_t::GLESv1_INDEX;
- } else if (value == 2) {
- version = egl_connection_t::GLESv2_INDEX;
- }
- }
- };
- }
- egl_context_t* c = new egl_context_t(dpy, context, config, cnx, version);
-#if EGL_TRACE
- if (gEGLDebugLevel > 0)
- GLTrace_eglCreateContext(version, c);
-#endif
- return c;
- }
- }
- return EGL_NO_CONTEXT;
-}
-
-EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp)
- return EGL_FALSE;
-
- ContextRef _c(dp, ctx);
- if (!_c.get())
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
-
- egl_context_t * const c = get_context(ctx);
- EGLBoolean result = c->cnx->egl.eglDestroyContext(dp->disp.dpy, c->context);
- if (result == EGL_TRUE) {
- _c.terminate();
- }
- return result;
-}
-
-EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext ctx)
-{
- clearError();
-
- egl_display_t const * const dp = get_display(dpy);
- if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
- // If ctx is not EGL_NO_CONTEXT, read is not EGL_NO_SURFACE, or draw is not
- // EGL_NO_SURFACE, then an EGL_NOT_INITIALIZED error is generated if dpy is
- // a valid but uninitialized display.
- if ( (ctx != EGL_NO_CONTEXT) || (read != EGL_NO_SURFACE) ||
- (draw != EGL_NO_SURFACE) ) {
- if (!dp->isReady()) return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
- }
-
- // get a reference to the object passed in
- ContextRef _c(dp, ctx);
- SurfaceRef _d(dp, draw);
- SurfaceRef _r(dp, read);
-
- // validate the context (if not EGL_NO_CONTEXT)
- if ((ctx != EGL_NO_CONTEXT) && !_c.get()) {
- // EGL_NO_CONTEXT is valid
- return EGL_FALSE;
- }
-
- // these are the underlying implementation's object
- EGLContext impl_ctx = EGL_NO_CONTEXT;
- EGLSurface impl_draw = EGL_NO_SURFACE;
- EGLSurface impl_read = EGL_NO_SURFACE;
-
- // these are our objects structs passed in
- egl_context_t * c = NULL;
- egl_surface_t const * d = NULL;
- egl_surface_t const * r = NULL;
-
- // these are the current objects structs
- egl_context_t * cur_c = get_context(getContext());
-
- if (ctx != EGL_NO_CONTEXT) {
- c = get_context(ctx);
- impl_ctx = c->context;
- } else {
- // no context given, use the implementation of the current context
- if (cur_c == NULL) {
- // no current context
- if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
- // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
- return setError(EGL_BAD_MATCH, EGL_FALSE);
- }
- // not an error, there is just no current context.
- return EGL_TRUE;
- }
- }
-
- // retrieve the underlying implementation's draw EGLSurface
- if (draw != EGL_NO_SURFACE) {
- d = get_surface(draw);
- impl_draw = d->surface;
- }
-
- // retrieve the underlying implementation's read EGLSurface
- if (read != EGL_NO_SURFACE) {
- r = get_surface(read);
- impl_read = r->surface;
- }
-
-
- EGLBoolean result = const_cast<egl_display_t*>(dp)->makeCurrent(c, cur_c,
- draw, read, ctx,
- impl_draw, impl_read, impl_ctx);
-
- if (result == EGL_TRUE) {
- if (c) {
- setGLHooksThreadSpecific(c->cnx->hooks[c->version]);
- egl_tls_t::setContext(ctx);
-#if EGL_TRACE
- if (gEGLDebugLevel > 0)
- GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version], ctx);
-#endif
- _c.acquire();
- _r.acquire();
- _d.acquire();
- } else {
- setGLHooksThreadSpecific(&gHooksNoContext);
- egl_tls_t::setContext(EGL_NO_CONTEXT);
- }
- } else {
- // this will ALOGE the error
- result = setError(c->cnx->egl.eglGetError(), EGL_FALSE);
- }
- return result;
-}
-
-
-EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- ContextRef _c(dp, ctx);
- if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
-
- egl_context_t * const c = get_context(ctx);
- return c->cnx->egl.eglQueryContext(
- dp->disp.dpy, c->context, attribute, value);
-
-}
-
-EGLContext eglGetCurrentContext(void)
-{
- // could be called before eglInitialize(), but we wouldn't have a context
- // then, and this function would correctly return EGL_NO_CONTEXT.
-
- clearError();
-
- EGLContext ctx = getContext();
- return ctx;
-}
-
-EGLSurface eglGetCurrentSurface(EGLint readdraw)
-{
- // could be called before eglInitialize(), but we wouldn't have a context
- // then, and this function would correctly return EGL_NO_SURFACE.
-
- clearError();
-
- EGLContext ctx = getContext();
- if (ctx) {
- egl_context_t const * const c = get_context(ctx);
- if (!c) return setError(EGL_BAD_CONTEXT, EGL_NO_SURFACE);
- switch (readdraw) {
- case EGL_READ: return c->read;
- case EGL_DRAW: return c->draw;
- default: return setError(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
- }
- return EGL_NO_SURFACE;
-}
-
-EGLDisplay eglGetCurrentDisplay(void)
-{
- // could be called before eglInitialize(), but we wouldn't have a context
- // then, and this function would correctly return EGL_NO_DISPLAY.
-
- clearError();
-
- EGLContext ctx = getContext();
- if (ctx) {
- egl_context_t const * const c = get_context(ctx);
- if (!c) return setError(EGL_BAD_CONTEXT, EGL_NO_SURFACE);
- return c->dpy;
- }
- return EGL_NO_DISPLAY;
-}
-
-EGLBoolean eglWaitGL(void)
-{
- clearError();
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (!cnx->dso)
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
-
- return cnx->egl.eglWaitGL();
-}
-
-EGLBoolean eglWaitNative(EGLint engine)
-{
- clearError();
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (!cnx->dso)
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
-
- return cnx->egl.eglWaitNative(engine);
-}
-
-EGLint eglGetError(void)
-{
- EGLint err = EGL_SUCCESS;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso) {
- err = cnx->egl.eglGetError();
- }
- if (err == EGL_SUCCESS) {
- err = egl_tls_t::getError();
- }
- return err;
-}
-
-__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
-{
- // eglGetProcAddress() could be the very first function called
- // in which case we must make sure we've initialized ourselves, this
- // happens the first time egl_get_display() is called.
-
- clearError();
-
- if (egl_init_drivers() == EGL_FALSE) {
- setError(EGL_BAD_PARAMETER, NULL);
- return NULL;
- }
-
- // The EGL_ANDROID_blob_cache extension should not be exposed to
- // applications. It is used internally by the Android EGL layer.
- if (!strcmp(procname, "eglSetBlobCacheFuncsANDROID")) {
- return NULL;
- }
-
- __eglMustCastToProperFunctionPointerType addr;
- addr = findProcAddress(procname, sExtentionMap, NELEM(sExtentionMap));
- if (addr) return addr;
-
-
- // this protects accesses to sGLExtentionMap and sGLExtentionSlot
- pthread_mutex_lock(&sExtensionMapMutex);
-
- /*
- * Since eglGetProcAddress() is not associated to anything, it needs
- * to return a function pointer that "works" regardless of what
- * the current context is.
- *
- * For this reason, we return a "forwarder", a small stub that takes
- * care of calling the function associated with the context
- * currently bound.
- *
- * We first look for extensions we've already resolved, if we're seeing
- * this extension for the first time, we go through all our
- * implementations and call eglGetProcAddress() and record the
- * result in the appropriate implementation hooks and return the
- * address of the forwarder corresponding to that hook set.
- *
- */
-
- const String8 name(procname);
- addr = sGLExtentionMap.valueFor(name);
- const int slot = sGLExtentionSlot;
-
- ALOGE_IF(slot >= MAX_NUMBER_OF_GL_EXTENSIONS,
- "no more slots for eglGetProcAddress(\"%s\")",
- procname);
-
-#if EGL_TRACE
- gl_hooks_t *debugHooks = GLTrace_getGLHooks();
-#endif
-
- if (!addr && (slot < MAX_NUMBER_OF_GL_EXTENSIONS)) {
- bool found = false;
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglGetProcAddress) {
- found = true;
- // Extensions are independent of the bound context
- cnx->hooks[egl_connection_t::GLESv1_INDEX]->ext.extensions[slot] =
- cnx->hooks[egl_connection_t::GLESv2_INDEX]->ext.extensions[slot] =
-#if EGL_TRACE
- debugHooks->ext.extensions[slot] =
- gHooksTrace.ext.extensions[slot] =
-#endif
- cnx->egl.eglGetProcAddress(procname);
- }
-
- if (found) {
- addr = gExtensionForwarders[slot];
- sGLExtentionMap.add(name, addr);
- sGLExtentionSlot++;
- }
- }
-
- pthread_mutex_unlock(&sExtensionMapMutex);
- return addr;
-}
-
-EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
-{
- ATRACE_CALL();
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, draw);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
-#if EGL_TRACE
- if (gEGLDebugLevel > 0)
- GLTrace_eglSwapBuffers(dpy, draw);
-#endif
-
- egl_surface_t const * const s = get_surface(draw);
- return s->cnx->egl.eglSwapBuffers(dp->disp.dpy, s->surface);
-}
-
-EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface,
- NativePixmapType target)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- return s->cnx->egl.eglCopyBuffers(dp->disp.dpy, s->surface, target);
-}
-
-const char* eglQueryString(EGLDisplay dpy, EGLint name)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return (const char *) NULL;
-
- switch (name) {
- case EGL_VENDOR:
- return dp->getVendorString();
- case EGL_VERSION:
- return dp->getVersionString();
- case EGL_EXTENSIONS:
- return dp->getExtensionString();
- case EGL_CLIENT_APIS:
- return dp->getClientApiString();
- case EGL_VERSION_HW_ANDROID:
- return dp->disp.queryString.version;
- }
- return setError(EGL_BAD_PARAMETER, (const char *)0);
-}
-
-
-// ----------------------------------------------------------------------------
-// EGL 1.1
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglSurfaceAttrib(
- EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- if (s->cnx->egl.eglSurfaceAttrib) {
- return s->cnx->egl.eglSurfaceAttrib(
- dp->disp.dpy, s->surface, attribute, value);
- }
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-}
-
-EGLBoolean eglBindTexImage(
- EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- if (s->cnx->egl.eglBindTexImage) {
- return s->cnx->egl.eglBindTexImage(
- dp->disp.dpy, s->surface, buffer);
- }
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-}
-
-EGLBoolean eglReleaseTexImage(
- EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- if (s->cnx->egl.eglReleaseTexImage) {
- return s->cnx->egl.eglReleaseTexImage(
- dp->disp.dpy, s->surface, buffer);
- }
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-}
-
-EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- EGLBoolean res = EGL_TRUE;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglSwapInterval) {
- res = cnx->egl.eglSwapInterval(dp->disp.dpy, interval);
- }
-
- return res;
-}
-
-
-// ----------------------------------------------------------------------------
-// EGL 1.2
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglWaitClient(void)
-{
- clearError();
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (!cnx->dso)
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
-
- EGLBoolean res;
- if (cnx->egl.eglWaitClient) {
- res = cnx->egl.eglWaitClient();
- } else {
- res = cnx->egl.eglWaitGL();
- }
- return res;
-}
-
-EGLBoolean eglBindAPI(EGLenum api)
-{
- clearError();
-
- if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- // bind this API on all EGLs
- EGLBoolean res = EGL_TRUE;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglBindAPI) {
- res = cnx->egl.eglBindAPI(api);
- }
- return res;
-}
-
-EGLenum eglQueryAPI(void)
-{
- clearError();
-
- if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglQueryAPI) {
- return cnx->egl.eglQueryAPI();
- }
-
- // or, it can only be OpenGL ES
- return EGL_OPENGL_ES_API;
-}
-
-EGLBoolean eglReleaseThread(void)
-{
- clearError();
-
- // If there is context bound to the thread, release it
- egl_display_t::loseCurrent(get_context(getContext()));
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglReleaseThread) {
- cnx->egl.eglReleaseThread();
- }
-
- egl_tls_t::clearTLS();
-#if EGL_TRACE
- if (gEGLDebugLevel > 0)
- GLTrace_eglReleaseThread();
-#endif
- return EGL_TRUE;
-}
-
-EGLSurface eglCreatePbufferFromClientBuffer(
- EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const* dp = 0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp);
- if (!cnx) return EGL_FALSE;
- if (cnx->egl.eglCreatePbufferFromClientBuffer) {
- return cnx->egl.eglCreatePbufferFromClientBuffer(
- dp->disp.dpy, buftype, buffer, config, attrib_list);
- }
- return setError(EGL_BAD_CONFIG, EGL_NO_SURFACE);
-}
-
-// ----------------------------------------------------------------------------
-// EGL_EGLEXT_VERSION 3
-// ----------------------------------------------------------------------------
-
-EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
- const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- if (s->cnx->egl.eglLockSurfaceKHR) {
- return s->cnx->egl.eglLockSurfaceKHR(
- dp->disp.dpy, s->surface, attrib_list);
- }
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-}
-
-EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- SurfaceRef _s(dp, surface);
- if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
-
- egl_surface_t const * const s = get_surface(surface);
- if (s->cnx->egl.eglUnlockSurfaceKHR) {
- return s->cnx->egl.eglUnlockSurfaceKHR(dp->disp.dpy, s->surface);
- }
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-}
-
-EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
- EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_NO_IMAGE_KHR;
-
- ContextRef _c(dp, ctx);
- egl_context_t * const c = _c.get();
-
- EGLImageKHR result = EGL_NO_IMAGE_KHR;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglCreateImageKHR) {
- result = cnx->egl.eglCreateImageKHR(
- dp->disp.dpy,
- c ? c->context : EGL_NO_CONTEXT,
- target, buffer, attrib_list);
- }
- return result;
-}
-
-EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglDestroyImageKHR) {
- cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
- }
- return EGL_TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// EGL_EGLEXT_VERSION 5
-// ----------------------------------------------------------------------------
-
-
-EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_NO_SYNC_KHR;
-
- EGLSyncKHR result = EGL_NO_SYNC_KHR;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglCreateSyncKHR) {
- result = cnx->egl.eglCreateSyncKHR(dp->disp.dpy, type, attrib_list);
- }
- return result;
-}
-
-EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- EGLBoolean result = EGL_FALSE;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglDestroySyncKHR) {
- result = cnx->egl.eglDestroySyncKHR(dp->disp.dpy, sync);
- }
- return result;
-}
-
-EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync,
- EGLint flags, EGLTimeKHR timeout)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- EGLBoolean result = EGL_FALSE;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglClientWaitSyncKHR) {
- result = cnx->egl.eglClientWaitSyncKHR(
- dp->disp.dpy, sync, flags, timeout);
- }
- return result;
-}
-
-EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
- EGLint attribute, EGLint *value)
-{
- clearError();
-
- egl_display_t const * const dp = validate_display(dpy);
- if (!dp) return EGL_FALSE;
-
- EGLBoolean result = EGL_FALSE;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->egl.eglGetSyncAttribKHR) {
- result = cnx->egl.eglGetSyncAttribKHR(
- dp->disp.dpy, sync, attribute, value);
- }
- return result;
-}
-
-// ----------------------------------------------------------------------------
-// ANDROID extensions
-// ----------------------------------------------------------------------------
-
-/* ANDROID extensions entry-point go here */
-
-// ----------------------------------------------------------------------------
-// NVIDIA extensions
-// ----------------------------------------------------------------------------
-EGLuint64NV eglGetSystemTimeFrequencyNV()
-{
- clearError();
-
- if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- EGLuint64NV ret = 0;
- egl_connection_t* const cnx = &gEGLImpl;
-
- if (cnx->dso && cnx->egl.eglGetSystemTimeFrequencyNV) {
- return cnx->egl.eglGetSystemTimeFrequencyNV();
- }
-
- return setErrorQuiet(EGL_BAD_DISPLAY, 0);
-}
-
-EGLuint64NV eglGetSystemTimeNV()
-{
- clearError();
-
- if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- EGLuint64NV ret = 0;
- egl_connection_t* const cnx = &gEGLImpl;
-
- if (cnx->dso && cnx->egl.eglGetSystemTimeNV) {
- return cnx->egl.eglGetSystemTimeNV();
- }
-
- return setErrorQuiet(EGL_BAD_DISPLAY, 0);
-}
diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp
deleted file mode 100644
index c79fb5f..0000000
--- a/opengl/libs/EGL/egl_cache.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#include "egl_cache.h"
-#include "egl_display.h"
-#include "egl_impl.h"
-#include "egldefs.h"
-
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#ifndef MAX_EGL_CACHE_ENTRY_SIZE
-#define MAX_EGL_CACHE_ENTRY_SIZE (16 * 1024);
-#endif
-
-#ifndef MAX_EGL_CACHE_SIZE
-#define MAX_EGL_CACHE_SIZE (64 * 1024);
-#endif
-
-// Cache size limits.
-static const size_t maxKeySize = 1024;
-static const size_t maxValueSize = MAX_EGL_CACHE_ENTRY_SIZE;
-static const size_t maxTotalSize = MAX_EGL_CACHE_SIZE;
-
-// Cache file header
-static const char* cacheFileMagic = "EGL$";
-static const size_t cacheFileHeaderSize = 8;
-
-// The time in seconds to wait before saving newly inserted cache entries.
-static const unsigned int deferredSaveDelay = 4;
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-#define BC_EXT_STR "EGL_ANDROID_blob_cache"
-
-//
-// Callback functions passed to EGL.
-//
-static void setBlob(const void* key, EGLsizeiANDROID keySize,
- const void* value, EGLsizeiANDROID valueSize) {
- egl_cache_t::get()->setBlob(key, keySize, value, valueSize);
-}
-
-static EGLsizeiANDROID getBlob(const void* key, EGLsizeiANDROID keySize,
- void* value, EGLsizeiANDROID valueSize) {
- return egl_cache_t::get()->getBlob(key, keySize, value, valueSize);
-}
-
-//
-// egl_cache_t definition
-//
-egl_cache_t::egl_cache_t() :
- mInitialized(false),
- mBlobCache(NULL) {
-}
-
-egl_cache_t::~egl_cache_t() {
-}
-
-egl_cache_t egl_cache_t::sCache;
-
-egl_cache_t* egl_cache_t::get() {
- return &sCache;
-}
-
-void egl_cache_t::initialize(egl_display_t *display) {
- Mutex::Autolock lock(mMutex);
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && cnx->major >= 0 && cnx->minor >= 0) {
- const char* exts = display->disp.queryString.extensions;
- size_t bcExtLen = strlen(BC_EXT_STR);
- size_t extsLen = strlen(exts);
- bool equal = !strcmp(BC_EXT_STR, exts);
- bool atStart = !strncmp(BC_EXT_STR " ", exts, bcExtLen+1);
- bool atEnd = (bcExtLen+1) < extsLen &&
- !strcmp(" " BC_EXT_STR, exts + extsLen - (bcExtLen+1));
- bool inMiddle = strstr(exts, " " BC_EXT_STR " ");
- if (equal || atStart || atEnd || inMiddle) {
- PFNEGLSETBLOBCACHEFUNCSANDROIDPROC eglSetBlobCacheFuncsANDROID;
- eglSetBlobCacheFuncsANDROID =
- reinterpret_cast<PFNEGLSETBLOBCACHEFUNCSANDROIDPROC>(
- cnx->egl.eglGetProcAddress(
- "eglSetBlobCacheFuncsANDROID"));
- if (eglSetBlobCacheFuncsANDROID == NULL) {
- ALOGE("EGL_ANDROID_blob_cache advertised, "
- "but unable to get eglSetBlobCacheFuncsANDROID");
- return;
- }
-
- eglSetBlobCacheFuncsANDROID(display->disp.dpy,
- android::setBlob, android::getBlob);
- EGLint err = cnx->egl.eglGetError();
- if (err != EGL_SUCCESS) {
- ALOGE("eglSetBlobCacheFuncsANDROID resulted in an error: "
- "%#x", err);
- }
- }
- }
-
- mInitialized = true;
-}
-
-void egl_cache_t::terminate() {
- Mutex::Autolock lock(mMutex);
- if (mBlobCache != NULL) {
- saveBlobCacheLocked();
- mBlobCache = NULL;
- }
- mInitialized = false;
-}
-
-void egl_cache_t::setBlob(const void* key, EGLsizeiANDROID keySize,
- const void* value, EGLsizeiANDROID valueSize) {
- Mutex::Autolock lock(mMutex);
-
- if (keySize < 0 || valueSize < 0) {
- ALOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed");
- return;
- }
-
- if (mInitialized) {
- sp<BlobCache> bc = getBlobCacheLocked();
- bc->set(key, keySize, value, valueSize);
-
- if (!mSavePending) {
- class DeferredSaveThread : public Thread {
- public:
- DeferredSaveThread() : Thread(false) {}
-
- virtual bool threadLoop() {
- sleep(deferredSaveDelay);
- egl_cache_t* c = egl_cache_t::get();
- Mutex::Autolock lock(c->mMutex);
- if (c->mInitialized) {
- c->saveBlobCacheLocked();
- }
- c->mSavePending = false;
- return false;
- }
- };
-
- // The thread will hold a strong ref to itself until it has finished
- // running, so there's no need to keep a ref around.
- sp<Thread> deferredSaveThread(new DeferredSaveThread());
- mSavePending = true;
- deferredSaveThread->run();
- }
- }
-}
-
-EGLsizeiANDROID egl_cache_t::getBlob(const void* key, EGLsizeiANDROID keySize,
- void* value, EGLsizeiANDROID valueSize) {
- Mutex::Autolock lock(mMutex);
-
- if (keySize < 0 || valueSize < 0) {
- ALOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed");
- return 0;
- }
-
- if (mInitialized) {
- sp<BlobCache> bc = getBlobCacheLocked();
- return bc->get(key, keySize, value, valueSize);
- }
- return 0;
-}
-
-void egl_cache_t::setCacheFilename(const char* filename) {
- Mutex::Autolock lock(mMutex);
- mFilename = filename;
-}
-
-sp<BlobCache> egl_cache_t::getBlobCacheLocked() {
- if (mBlobCache == NULL) {
- mBlobCache = new BlobCache(maxKeySize, maxValueSize, maxTotalSize);
- loadBlobCacheLocked();
- }
- return mBlobCache;
-}
-
-static uint32_t crc32c(const uint8_t* buf, size_t len) {
- const uint32_t polyBits = 0x82F63B78;
- uint32_t r = 0;
- for (size_t i = 0; i < len; i++) {
- r ^= buf[i];
- for (int j = 0; j < 8; j++) {
- if (r & 1) {
- r = (r >> 1) ^ polyBits;
- } else {
- r >>= 1;
- }
- }
- }
- return r;
-}
-
-void egl_cache_t::saveBlobCacheLocked() {
- if (mFilename.length() > 0) {
- size_t cacheSize = mBlobCache->getFlattenedSize();
- size_t headerSize = cacheFileHeaderSize;
- const char* fname = mFilename.string();
-
- // Try to create the file with no permissions so we can write it
- // without anyone trying to read it.
- int fd = open(fname, O_CREAT | O_EXCL | O_RDWR, 0);
- if (fd == -1) {
- if (errno == EEXIST) {
- // The file exists, delete it and try again.
- if (unlink(fname) == -1) {
- // No point in retrying if the unlink failed.
- ALOGE("error unlinking cache file %s: %s (%d)", fname,
- strerror(errno), errno);
- return;
- }
- // Retry now that we've unlinked the file.
- fd = open(fname, O_CREAT | O_EXCL | O_RDWR, 0);
- }
- if (fd == -1) {
- ALOGE("error creating cache file %s: %s (%d)", fname,
- strerror(errno), errno);
- return;
- }
- }
-
- size_t fileSize = headerSize + cacheSize;
- if (ftruncate(fd, fileSize) == -1) {
- ALOGE("error setting cache file size: %s (%d)", strerror(errno),
- errno);
- close(fd);
- unlink(fname);
- return;
- }
-
- uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize,
- PROT_WRITE, MAP_SHARED, fd, 0));
- if (buf == MAP_FAILED) {
- ALOGE("error mmaping cache file: %s (%d)", strerror(errno),
- errno);
- close(fd);
- unlink(fname);
- return;
- }
-
- status_t err = mBlobCache->flatten(buf + headerSize, cacheSize, NULL,
- 0);
- if (err != OK) {
- ALOGE("error writing cache contents: %s (%d)", strerror(-err),
- -err);
- munmap(buf, fileSize);
- close(fd);
- unlink(fname);
- return;
- }
-
- // Write the file magic and CRC
- memcpy(buf, cacheFileMagic, 4);
- uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4);
- *crc = crc32c(buf + headerSize, cacheSize);
-
- munmap(buf, fileSize);
- fchmod(fd, S_IRUSR);
- close(fd);
- }
-}
-
-void egl_cache_t::loadBlobCacheLocked() {
- if (mFilename.length() > 0) {
- size_t headerSize = cacheFileHeaderSize;
-
- int fd = open(mFilename.string(), O_RDONLY, 0);
- if (fd == -1) {
- if (errno != ENOENT) {
- ALOGE("error opening cache file %s: %s (%d)", mFilename.string(),
- strerror(errno), errno);
- }
- return;
- }
-
- struct stat statBuf;
- if (fstat(fd, &statBuf) == -1) {
- ALOGE("error stat'ing cache file: %s (%d)", strerror(errno), errno);
- close(fd);
- return;
- }
-
- // Sanity check the size before trying to mmap it.
- size_t fileSize = statBuf.st_size;
- if (fileSize > maxTotalSize * 2) {
- ALOGE("cache file is too large: %#llx", statBuf.st_size);
- close(fd);
- return;
- }
-
- uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize,
- PROT_READ, MAP_PRIVATE, fd, 0));
- if (buf == MAP_FAILED) {
- ALOGE("error mmaping cache file: %s (%d)", strerror(errno),
- errno);
- close(fd);
- return;
- }
-
- // Check the file magic and CRC
- size_t cacheSize = fileSize - headerSize;
- if (memcmp(buf, cacheFileMagic, 4) != 0) {
- ALOGE("cache file has bad mojo");
- close(fd);
- return;
- }
- uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4);
- if (crc32c(buf + headerSize, cacheSize) != *crc) {
- ALOGE("cache file failed CRC check");
- close(fd);
- return;
- }
-
- status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL,
- 0);
- if (err != OK) {
- ALOGE("error reading cache contents: %s (%d)", strerror(-err),
- -err);
- munmap(buf, fileSize);
- close(fd);
- return;
- }
-
- munmap(buf, fileSize);
- close(fd);
- }
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_cache.h b/opengl/libs/EGL/egl_cache.h
deleted file mode 100644
index 8760009..0000000
--- a/opengl/libs/EGL/egl_cache.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGL_CACHE_H
-#define ANDROID_EGL_CACHE_H
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <utils/BlobCache.h>
-#include <utils/String8.h>
-#include <utils/StrongPointer.h>
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class egl_display_t;
-
-class EGLAPI egl_cache_t {
-public:
-
- // get returns a pointer to the singleton egl_cache_t object. This
- // singleton object will never be destroyed.
- static egl_cache_t* get();
-
- // initialize puts the egl_cache_t into an initialized state, such that it
- // is able to insert and retrieve entries from the cache. This should be
- // called when EGL is initialized. When not in the initialized state the
- // getBlob and setBlob methods will return without performing any cache
- // operations.
- void initialize(egl_display_t* display);
-
- // terminate puts the egl_cache_t back into the uninitialized state. When
- // in this state the getBlob and setBlob methods will return without
- // performing any cache operations.
- void terminate();
-
- // setBlob attempts to insert a new key/value blob pair into the cache.
- // This will be called by the hardware vendor's EGL implementation via the
- // EGL_ANDROID_blob_cache extension.
- void setBlob(const void* key, EGLsizeiANDROID keySize, const void* value,
- EGLsizeiANDROID valueSize);
-
- // getBlob attempts to retrieve the value blob associated with a given key
- // blob from cache. This will be called by the hardware vendor's EGL
- // implementation via the EGL_ANDROID_blob_cache extension.
- EGLsizeiANDROID getBlob(const void* key, EGLsizeiANDROID keySize,
- void* value, EGLsizeiANDROID valueSize);
-
- // setCacheFilename sets the name of the file that should be used to store
- // cache contents from one program invocation to another.
- void setCacheFilename(const char* filename);
-
-private:
- // Creation and (the lack of) destruction is handled internally.
- egl_cache_t();
- ~egl_cache_t();
-
- // Copying is disallowed.
- egl_cache_t(const egl_cache_t&); // not implemented
- void operator=(const egl_cache_t&); // not implemented
-
- // getBlobCacheLocked returns the BlobCache object being used to store the
- // key/value blob pairs. If the BlobCache object has not yet been created,
- // this will do so, loading the serialized cache contents from disk if
- // possible.
- sp<BlobCache> getBlobCacheLocked();
-
- // saveBlobCache attempts to save the current contents of mBlobCache to
- // disk.
- void saveBlobCacheLocked();
-
- // loadBlobCache attempts to load the saved cache contents from disk into
- // mBlobCache.
- void loadBlobCacheLocked();
-
- // mInitialized indicates whether the egl_cache_t is in the initialized
- // state. It is initialized to false at construction time, and gets set to
- // true when initialize is called. It is set back to false when terminate
- // is called. When in this state, the cache behaves as normal. When not,
- // the getBlob and setBlob methods will return without performing any cache
- // operations.
- bool mInitialized;
-
- // mBlobCache is the cache in which the key/value blob pairs are stored. It
- // is initially NULL, and will be initialized by getBlobCacheLocked the
- // first time it's needed.
- sp<BlobCache> mBlobCache;
-
- // mFilename is the name of the file for storing cache contents in between
- // program invocations. It is initialized to an empty string at
- // construction time, and can be set with the setCacheFilename method. An
- // empty string indicates that the cache should not be saved to or restored
- // from disk.
- String8 mFilename;
-
- // mSavePending indicates whether or not a deferred save operation is
- // pending. Each time a key/value pair is inserted into the cache via
- // setBlob, a deferred save is initiated if one is not already pending.
- // This will wait some amount of time and then trigger a save of the cache
- // contents to disk.
- bool mSavePending;
-
- // mMutex is the mutex used to prevent concurrent access to the member
- // variables. It must be locked whenever the member variables are accessed.
- mutable Mutex mMutex;
-
- // sCache is the singleton egl_cache_t object.
- static egl_cache_t sCache;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif // ANDROID_EGL_CACHE_H
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
deleted file mode 100644
index c85b4ce..0000000
--- a/opengl/libs/EGL/egl_display.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <string.h>
-
-#include "egl_cache.h"
-#include "egl_display.h"
-#include "egl_object.h"
-#include "egl_tls.h"
-#include "egl_impl.h"
-#include "Loader.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-static char const * const sVendorString = "Android";
-static char const * const sVersionString = "1.4 Android META-EGL";
-static char const * const sClientApiString = "OpenGL ES";
-
-// this is the list of EGL extensions that are exposed to applications
-// some of them are mandatory because used by the ANDROID system.
-//
-// mandatory extensions are required per the CDD and not explicitly
-// checked during EGL initialization. the system *assumes* these extensions
-// are present. the system may not function properly if some mandatory
-// extensions are missing.
-//
-// NOTE: sExtensionString MUST be have a single space as the last character.
-//
-static char const * const sExtensionString =
- "EGL_KHR_image " // mandatory
- "EGL_KHR_image_base " // mandatory
- "EGL_KHR_image_pixmap "
- "EGL_KHR_gl_texture_2D_image "
- "EGL_KHR_gl_texture_cubemap_image "
- "EGL_KHR_gl_renderbuffer_image "
- "EGL_KHR_fence_sync "
- "EGL_NV_system_time "
- "EGL_ANDROID_image_native_buffer " // mandatory
- ;
-
-// extensions not exposed to applications but used by the ANDROID system
-// "EGL_ANDROID_recordable " // mandatory
-// "EGL_ANDROID_blob_cache " // strongly recommended
-
-extern void initEglTraceLevel();
-extern void setGLHooksThreadSpecific(gl_hooks_t const *value);
-
-// ----------------------------------------------------------------------------
-
-egl_display_t egl_display_t::sDisplay[NUM_DISPLAYS];
-
-egl_display_t::egl_display_t() :
- magic('_dpy'), refs(0) {
-}
-
-egl_display_t::~egl_display_t() {
- magic = 0;
- egl_cache_t::get()->terminate();
-}
-
-egl_display_t* egl_display_t::get(EGLDisplay dpy) {
- uintptr_t index = uintptr_t(dpy)-1U;
- return (index >= NUM_DISPLAYS) ? NULL : &sDisplay[index];
-}
-
-void egl_display_t::addObject(egl_object_t* object) {
- Mutex::Autolock _l(lock);
- objects.add(object);
-}
-
-void egl_display_t::removeObject(egl_object_t* object) {
- Mutex::Autolock _l(lock);
- objects.remove(object);
-}
-
-bool egl_display_t::getObject(egl_object_t* object) const {
- Mutex::Autolock _l(lock);
- if (objects.indexOf(object) >= 0) {
- if (object->getDisplay() == this) {
- object->incRef();
- return true;
- }
- }
- return false;
-}
-
-EGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) {
- if (uintptr_t(disp) >= NUM_DISPLAYS)
- return NULL;
-
- return sDisplay[uintptr_t(disp)].getDisplay(disp);
-}
-
-EGLDisplay egl_display_t::getDisplay(EGLNativeDisplayType display) {
-
- Mutex::Autolock _l(lock);
-
- // get our driver loader
- Loader& loader(Loader::getInstance());
-
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && disp.dpy == EGL_NO_DISPLAY) {
- EGLDisplay dpy = cnx->egl.eglGetDisplay(display);
- disp.dpy = dpy;
- if (dpy == EGL_NO_DISPLAY) {
- loader.close(cnx->dso);
- cnx->dso = NULL;
- }
- }
-
- return EGLDisplay(uintptr_t(display) + 1U);
-}
-
-EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) {
-
- Mutex::Autolock _l(lock);
-
- if (refs > 0) {
- if (major != NULL)
- *major = VERSION_MAJOR;
- if (minor != NULL)
- *minor = VERSION_MINOR;
- refs++;
- return EGL_TRUE;
- }
-
-#if EGL_TRACE
-
- // Called both at early_init time and at this time. (Early_init is pre-zygote, so
- // the information from that call may be stale.)
- initEglTraceLevel();
-
-#endif
-
- setGLHooksThreadSpecific(&gHooksNoContext);
-
- // initialize each EGL and
- // build our own extension string first, based on the extension we know
- // and the extension supported by our client implementation
-
- egl_connection_t* const cnx = &gEGLImpl;
- cnx->major = -1;
- cnx->minor = -1;
- if (cnx->dso) {
-
-#if defined(ADRENO130)
-#warning "Adreno-130 eglInitialize() workaround"
- /*
- * The ADRENO 130 driver returns a different EGLDisplay each time
- * eglGetDisplay() is called, but also makes the EGLDisplay invalid
- * after eglTerminate() has been called, so that eglInitialize()
- * cannot be called again. Therefore, we need to make sure to call
- * eglGetDisplay() before calling eglInitialize();
- */
- if (i == IMPL_HARDWARE) {
- disp[i].dpy = cnx->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
- }
-#endif
-
- EGLDisplay idpy = disp.dpy;
- if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) {
- //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p",
- // idpy, cnx->major, cnx->minor, cnx);
-
- // display is now initialized
- disp.state = egl_display_t::INITIALIZED;
-
- // get the query-strings for this display for each implementation
- disp.queryString.vendor = cnx->egl.eglQueryString(idpy,
- EGL_VENDOR);
- disp.queryString.version = cnx->egl.eglQueryString(idpy,
- EGL_VERSION);
- disp.queryString.extensions = cnx->egl.eglQueryString(idpy,
- EGL_EXTENSIONS);
- disp.queryString.clientApi = cnx->egl.eglQueryString(idpy,
- EGL_CLIENT_APIS);
-
- } else {
- ALOGW("eglInitialize(%p) failed (%s)", idpy,
- egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
- }
- }
-
- // the query strings are per-display
- mVendorString.setTo(sVendorString);
- mVersionString.setTo(sVersionString);
- mClientApiString.setTo(sClientApiString);
-
- // we only add extensions that exist in the implementation
- char const* start = sExtensionString;
- char const* end;
- do {
- // find the space separating this extension for the next one
- end = strchr(start, ' ');
- if (end) {
- // length of the extension string
- const size_t len = end - start;
- if (len) {
- // NOTE: we could avoid the copy if we had strnstr.
- const String8 ext(start, len);
- // now look for this extension
- if (disp.queryString.extensions) {
- // if we find it, add this extension string to our list
- // (and don't forget the space)
- const char* match = strstr(disp.queryString.extensions, ext.string());
- if (match && (match[len] == ' ' || match[len] == 0)) {
- mExtensionString.append(start, len+1);
- }
- }
- }
- // process the next extension string, and skip the space.
- start = end + 1;
- }
- } while (end);
-
- egl_cache_t::get()->initialize(this);
-
- refs++;
- if (major != NULL)
- *major = VERSION_MAJOR;
- if (minor != NULL)
- *minor = VERSION_MINOR;
- return EGL_TRUE;
-}
-
-EGLBoolean egl_display_t::terminate() {
-
- Mutex::Autolock _l(lock);
-
- if (refs == 0) {
- return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
- }
-
- // this is specific to Android, display termination is ref-counted.
- if (refs > 1) {
- refs--;
- return EGL_TRUE;
- }
-
- EGLBoolean res = EGL_FALSE;
- egl_connection_t* const cnx = &gEGLImpl;
- if (cnx->dso && disp.state == egl_display_t::INITIALIZED) {
- if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) {
- ALOGW("eglTerminate(%p) failed (%s)", disp.dpy,
- egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
- }
- // REVISIT: it's unclear what to do if eglTerminate() fails
- disp.state = egl_display_t::TERMINATED;
- res = EGL_TRUE;
- }
-
- // Mark all objects remaining in the list as terminated, unless
- // there are no reference to them, it which case, we're free to
- // delete them.
- size_t count = objects.size();
- ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count);
- for (size_t i=0 ; i<count ; i++) {
- egl_object_t* o = objects.itemAt(i);
- o->destroy();
- }
-
- // this marks all object handles are "terminated"
- objects.clear();
-
- refs--;
- return res;
-}
-
-void egl_display_t::loseCurrent(egl_context_t * cur_c)
-{
- if (cur_c) {
- egl_display_t* display = cur_c->getDisplay();
- if (display) {
- display->loseCurrentImpl(cur_c);
- }
- }
-}
-
-void egl_display_t::loseCurrentImpl(egl_context_t * cur_c)
-{
- // by construction, these are either 0 or valid (possibly terminated)
- // it should be impossible for these to be invalid
- ContextRef _cur_c(cur_c);
- SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
- SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
-
- { // scope for the lock
- Mutex::Autolock _l(lock);
- cur_c->onLooseCurrent();
-
- }
-
- // This cannot be called with the lock held because it might end-up
- // calling back into EGL (in particular when a surface is destroyed
- // it calls ANativeWindow::disconnect
- _cur_c.release();
- _cur_r.release();
- _cur_d.release();
-}
-
-EGLBoolean egl_display_t::makeCurrent(egl_context_t* c, egl_context_t* cur_c,
- EGLSurface draw, EGLSurface read, EGLContext ctx,
- EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx)
-{
- EGLBoolean result;
-
- // by construction, these are either 0 or valid (possibly terminated)
- // it should be impossible for these to be invalid
- ContextRef _cur_c(cur_c);
- SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
- SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
-
- { // scope for the lock
- Mutex::Autolock _l(lock);
- if (c) {
- result = c->cnx->egl.eglMakeCurrent(
- disp.dpy, impl_draw, impl_read, impl_ctx);
- if (result == EGL_TRUE) {
- c->onMakeCurrent(draw, read);
- }
- } else {
- result = cur_c->cnx->egl.eglMakeCurrent(
- disp.dpy, impl_draw, impl_read, impl_ctx);
- if (result == EGL_TRUE) {
- cur_c->onLooseCurrent();
- }
- }
- }
-
- if (result == EGL_TRUE) {
- // This cannot be called with the lock held because it might end-up
- // calling back into EGL (in particular when a surface is destroyed
- // it calls ANativeWindow::disconnect
- _cur_c.release();
- _cur_r.release();
- _cur_d.release();
- }
-
- return result;
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_display.h b/opengl/libs/EGL/egl_display.h
deleted file mode 100644
index 6348228..0000000
--- a/opengl/libs/EGL/egl_display.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGL_DISPLAY_H
-#define ANDROID_EGL_DISPLAY_H
-
-
-#include <ctype.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/SortedVector.h>
-#include <utils/threads.h>
-#include <utils/String8.h>
-
-#include "egldefs.h"
-#include "hooks.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class egl_object_t;
-class egl_context_t;
-class egl_connection_t;
-
-// ----------------------------------------------------------------------------
-
-class EGLAPI egl_display_t { // marked as EGLAPI for testing purposes
- static egl_display_t sDisplay[NUM_DISPLAYS];
- EGLDisplay getDisplay(EGLNativeDisplayType display);
- void loseCurrentImpl(egl_context_t * cur_c);
-
-public:
- enum {
- NOT_INITIALIZED = 0,
- INITIALIZED = 1,
- TERMINATED = 2
- };
-
- egl_display_t();
- ~egl_display_t();
-
- EGLBoolean initialize(EGLint *major, EGLint *minor);
- EGLBoolean terminate();
-
- // add object to this display's list
- void addObject(egl_object_t* object);
- // remove object from this display's list
- void removeObject(egl_object_t* object);
- // add reference to this object. returns true if this is a valid object.
- bool getObject(egl_object_t* object) const;
-
- static egl_display_t* get(EGLDisplay dpy);
- static EGLDisplay getFromNativeDisplay(EGLNativeDisplayType disp);
-
- EGLBoolean makeCurrent(egl_context_t* c, egl_context_t* cur_c,
- EGLSurface draw, EGLSurface read, EGLContext ctx,
- EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx);
- static void loseCurrent(egl_context_t * cur_c);
-
- inline bool isReady() const { return (refs > 0); }
- inline bool isValid() const { return magic == '_dpy'; }
- inline bool isAlive() const { return isValid(); }
-
- char const * getVendorString() const { return mVendorString.string(); }
- char const * getVersionString() const { return mVersionString.string(); }
- char const * getClientApiString() const { return mClientApiString.string(); }
- char const * getExtensionString() const { return mExtensionString.string(); }
-
- inline uint32_t getRefsCount() const { return refs; }
-
- struct strings_t {
- char const * vendor;
- char const * version;
- char const * clientApi;
- char const * extensions;
- };
-
- struct DisplayImpl {
- DisplayImpl() : dpy(EGL_NO_DISPLAY), state(NOT_INITIALIZED) { }
- EGLDisplay dpy;
- EGLint state;
- strings_t queryString;
- };
-
-private:
- uint32_t magic;
-
-public:
- DisplayImpl disp;
-
-private:
- uint32_t refs;
- mutable Mutex lock;
- SortedVector<egl_object_t*> objects;
- String8 mVendorString;
- String8 mVersionString;
- String8 mClientApiString;
- String8 mExtensionString;
-};
-
-// ----------------------------------------------------------------------------
-
-inline egl_display_t* get_display(EGLDisplay dpy) {
- return egl_display_t::get(dpy);
-}
-
-// ----------------------------------------------------------------------------
-
-egl_display_t* validate_display(EGLDisplay dpy);
-egl_connection_t* validate_display_config(EGLDisplay dpy,
- EGLConfig config, egl_display_t const*& dp);
-EGLBoolean validate_display_context(EGLDisplay dpy, EGLContext ctx);
-EGLBoolean validate_display_surface(EGLDisplay dpy, EGLSurface surface);
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif // ANDROID_EGL_DISPLAY_H
diff --git a/opengl/libs/EGL/egl_entries.in b/opengl/libs/EGL/egl_entries.in
deleted file mode 100644
index bdd2a7e..0000000
--- a/opengl/libs/EGL/egl_entries.in
+++ /dev/null
@@ -1,69 +0,0 @@
-EGL_ENTRY(EGLDisplay, eglGetDisplay, NativeDisplayType)
-EGL_ENTRY(EGLBoolean, eglInitialize, EGLDisplay, EGLint*, EGLint*)
-EGL_ENTRY(EGLBoolean, eglTerminate, EGLDisplay)
-EGL_ENTRY(EGLBoolean, eglGetConfigs, EGLDisplay, EGLConfig*, EGLint, EGLint*)
-EGL_ENTRY(EGLBoolean, eglChooseConfig, EGLDisplay, const EGLint *, EGLConfig *, EGLint, EGLint *)
-
-EGL_ENTRY(EGLBoolean, eglGetConfigAttrib, EGLDisplay, EGLConfig, EGLint, EGLint *)
-EGL_ENTRY(EGLSurface, eglCreateWindowSurface, EGLDisplay, EGLConfig, NativeWindowType, const EGLint *)
-EGL_ENTRY(EGLSurface, eglCreatePixmapSurface, EGLDisplay, EGLConfig, NativePixmapType, const EGLint *)
-EGL_ENTRY(EGLSurface, eglCreatePbufferSurface, EGLDisplay, EGLConfig, const EGLint *)
-EGL_ENTRY(EGLBoolean, eglDestroySurface, EGLDisplay, EGLSurface)
-EGL_ENTRY(EGLBoolean, eglQuerySurface, EGLDisplay, EGLSurface, EGLint, EGLint *)
-EGL_ENTRY(EGLContext, eglCreateContext, EGLDisplay, EGLConfig, EGLContext, const EGLint *)
-EGL_ENTRY(EGLBoolean, eglDestroyContext, EGLDisplay, EGLContext)
-EGL_ENTRY(EGLBoolean, eglMakeCurrent, EGLDisplay, EGLSurface, EGLSurface, EGLContext)
-EGL_ENTRY(EGLContext, eglGetCurrentContext, void)
-EGL_ENTRY(EGLSurface, eglGetCurrentSurface, EGLint)
-EGL_ENTRY(EGLDisplay, eglGetCurrentDisplay, void)
-EGL_ENTRY(EGLBoolean, eglQueryContext, EGLDisplay, EGLContext, EGLint, EGLint *)
-EGL_ENTRY(EGLBoolean, eglWaitGL, void)
-EGL_ENTRY(EGLBoolean, eglWaitNative, EGLint)
-EGL_ENTRY(EGLBoolean, eglSwapBuffers, EGLDisplay, EGLSurface)
-EGL_ENTRY(EGLBoolean, eglCopyBuffers, EGLDisplay, EGLSurface, NativePixmapType)
-EGL_ENTRY(EGLint, eglGetError, void)
-EGL_ENTRY(const char*, eglQueryString, EGLDisplay, EGLint)
-EGL_ENTRY(__eglMustCastToProperFunctionPointerType, eglGetProcAddress, const char *)
-
-/* EGL 1.1 */
-
-EGL_ENTRY(EGLBoolean, eglSurfaceAttrib, EGLDisplay, EGLSurface, EGLint, EGLint)
-EGL_ENTRY(EGLBoolean, eglBindTexImage, EGLDisplay, EGLSurface, EGLint)
-EGL_ENTRY(EGLBoolean, eglReleaseTexImage, EGLDisplay, EGLSurface, EGLint)
-EGL_ENTRY(EGLBoolean, eglSwapInterval, EGLDisplay, EGLint)
-
-/* EGL 1.2 */
-
-EGL_ENTRY(EGLBoolean, eglBindAPI, EGLenum)
-EGL_ENTRY(EGLenum, eglQueryAPI, void)
-EGL_ENTRY(EGLBoolean, eglWaitClient, void)
-EGL_ENTRY(EGLBoolean, eglReleaseThread, void)
-EGL_ENTRY(EGLSurface, eglCreatePbufferFromClientBuffer, EGLDisplay, EGLenum, EGLClientBuffer, EGLConfig, const EGLint *)
-
-/* EGL 1.3 */
-
-/* EGL 1.4 */
-
-/* EGL_EGLEXT_VERSION 3 */
-
-EGL_ENTRY(EGLBoolean, eglLockSurfaceKHR, EGLDisplay, EGLSurface, const EGLint *)
-EGL_ENTRY(EGLBoolean, eglUnlockSurfaceKHR, EGLDisplay, EGLSurface)
-EGL_ENTRY(EGLImageKHR, eglCreateImageKHR, EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *)
-EGL_ENTRY(EGLBoolean, eglDestroyImageKHR, EGLDisplay, EGLImageKHR)
-
-/* EGL_EGLEXT_VERSION 5 */
-
-EGL_ENTRY(EGLSyncKHR, eglCreateSyncKHR, EGLDisplay, EGLenum, const EGLint *)
-EGL_ENTRY(EGLBoolean, eglDestroySyncKHR, EGLDisplay, EGLSyncKHR)
-EGL_ENTRY(EGLint, eglClientWaitSyncKHR, EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR)
-EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint, EGLint *)
-
-/* ANDROID extensions */
-
-EGL_ENTRY(EGLBoolean, eglSetSwapRectangleANDROID, EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint)
-EGL_ENTRY(EGLClientBuffer, eglGetRenderBufferANDROID, EGLDisplay, EGLSurface)
-
-/* NVIDIA extensions */
-
-EGL_ENTRY(EGLuint64NV, eglGetSystemTimeFrequencyNV, void)
-EGL_ENTRY(EGLuint64NV, eglGetSystemTimeNV, void)
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
deleted file mode 100644
index d0cbb31..0000000
--- a/opengl/libs/EGL/egl_object.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <ctype.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/threads.h>
-
-#include "egl_object.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-egl_object_t::egl_object_t(egl_display_t* disp) :
- display(disp), count(1) {
- // NOTE: this does an implicit incRef
- display->addObject(this);
-}
-
-egl_object_t::~egl_object_t() {
-}
-
-void egl_object_t::terminate() {
- // this marks the object as "terminated"
- display->removeObject(this);
- if (decRef() == 1) {
- // shouldn't happen because this is called from LocalRef
- ALOGE("egl_object_t::terminate() removed the last reference!");
- }
-}
-
-void egl_object_t::destroy() {
- if (decRef() == 1) {
- delete this;
- }
-}
-
-bool egl_object_t::get(egl_display_t const* display, egl_object_t* object) {
- // used by LocalRef, this does an incRef() atomically with
- // checking that the object is valid.
- return display->getObject(object);
-}
-
-// ----------------------------------------------------------------------------
-
-egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
- egl_connection_t const* cnx, int version) :
- egl_object_t(get_display(dpy)), dpy(dpy), context(context),
- config(config), read(0), draw(0), cnx(cnx),
- version(version)
-{
-}
-
-void egl_context_t::onLooseCurrent() {
- read = NULL;
- draw = NULL;
-}
-
-void egl_context_t::onMakeCurrent(EGLSurface draw, EGLSurface read) {
- this->read = read;
- this->draw = draw;
-
- /*
- * Here we cache the GL_EXTENSIONS string for this context and we
- * add the extensions always handled by the wrapper
- */
-
- if (gl_extensions.isEmpty()) {
- // call the implementation's glGetString(GL_EXTENSIONS)
- const char* exts = (const char *)gEGLImpl.hooks[version]->gl.glGetString(GL_EXTENSIONS);
- gl_extensions.setTo(exts);
- if (gl_extensions.find("GL_EXT_debug_marker") < 0) {
- String8 temp("GL_EXT_debug_marker ");
- temp.append(gl_extensions);
- gl_extensions.setTo(temp);
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
deleted file mode 100644
index 4d91f54..0000000
--- a/opengl/libs/EGL/egl_object.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGL_OBJECT_H
-#define ANDROID_EGL_OBJECT_H
-
-
-#include <ctype.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/threads.h>
-#include <utils/String8.h>
-
-#include <system/window.h>
-
-#include "egl_display.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-struct egl_display_t;
-
-class egl_object_t {
- egl_display_t *display;
- mutable volatile int32_t count;
-
-protected:
- virtual ~egl_object_t();
-
-public:
- egl_object_t(egl_display_t* display);
- void destroy();
-
- inline int32_t incRef() { return android_atomic_inc(&count); }
- inline int32_t decRef() { return android_atomic_dec(&count); }
- inline egl_display_t* getDisplay() const { return display; }
-
-private:
- void terminate();
- static bool get(egl_display_t const* display, egl_object_t* object);
-
-public:
- template <typename N, typename T>
- class LocalRef {
- egl_object_t* ref;
- LocalRef();
- LocalRef(const LocalRef* rhs);
- public:
- ~LocalRef();
- explicit LocalRef(egl_object_t* rhs);
- explicit LocalRef(egl_display_t const* display, T o) : ref(0) {
- egl_object_t* native = reinterpret_cast<N*>(o);
- if (o && egl_object_t::get(display, native)) {
- ref = native;
- }
- }
- inline N* get() {
- return static_cast<N*>(ref);
- }
- void acquire() const;
- void release() const;
- void terminate();
- };
- template <typename N, typename T>
- friend class LocalRef;
-};
-
-template<typename N, typename T>
-egl_object_t::LocalRef<N, T>::LocalRef(egl_object_t* rhs) : ref(rhs) {
- if (ref) {
- ref->incRef();
- }
-}
-
-template <typename N, typename T>
-egl_object_t::LocalRef<N,T>::~LocalRef() {
- if (ref) {
- ref->destroy();
- }
-}
-
-template <typename N, typename T>
-void egl_object_t::LocalRef<N,T>::acquire() const {
- if (ref) {
- ref->incRef();
- }
-}
-
-template <typename N, typename T>
-void egl_object_t::LocalRef<N,T>::release() const {
- if (ref) {
- if (ref->decRef() == 1) {
- // shouldn't happen because this is called from LocalRef
- ALOGE("LocalRef::release() removed the last reference!");
- }
- }
-}
-
-template <typename N, typename T>
-void egl_object_t::LocalRef<N,T>::terminate() {
- if (ref) {
- ref->terminate();
- }
-}
-
-// ----------------------------------------------------------------------------
-
-class egl_surface_t : public egl_object_t {
-protected:
- ~egl_surface_t() {
- ANativeWindow* const window = win.get();
- if (window != NULL) {
- native_window_set_buffers_format(window, 0);
- if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
- ALOGW("EGLNativeWindowType %p disconnect failed", window);
- }
- }
- }
-public:
- typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref;
-
- egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win,
- EGLSurface surface, egl_connection_t const* cnx) :
- egl_object_t(get_display(dpy)), dpy(dpy), surface(surface),
- config(config), win(win), cnx(cnx) {
- }
- EGLDisplay dpy;
- EGLSurface surface;
- EGLConfig config;
- sp<ANativeWindow> win;
- egl_connection_t const* cnx;
-};
-
-class egl_context_t: public egl_object_t {
-protected:
- ~egl_context_t() {}
-public:
- typedef egl_object_t::LocalRef<egl_context_t, EGLContext> Ref;
-
- egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
- egl_connection_t const* cnx, int version);
-
- void onLooseCurrent();
- void onMakeCurrent(EGLSurface draw, EGLSurface read);
-
- EGLDisplay dpy;
- EGLContext context;
- EGLConfig config;
- EGLSurface read;
- EGLSurface draw;
- egl_connection_t const* cnx;
- int version;
- String8 gl_extensions;
-};
-
-// ----------------------------------------------------------------------------
-
-typedef egl_surface_t::Ref SurfaceRef;
-typedef egl_context_t::Ref ContextRef;
-
-// ----------------------------------------------------------------------------
-
-template<typename NATIVE, typename EGL>
-static inline NATIVE* egl_to_native_cast(EGL arg) {
- return reinterpret_cast<NATIVE*>(arg);
-}
-
-static inline
-egl_surface_t* get_surface(EGLSurface surface) {
- return egl_to_native_cast<egl_surface_t>(surface);
-}
-
-static inline
-egl_context_t* get_context(EGLContext context) {
- return egl_to_native_cast<egl_context_t>(context);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif // ANDROID_EGL_OBJECT_H
diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp
deleted file mode 100644
index 41cfae1..0000000
--- a/opengl/libs/EGL/egl_tls.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-#include <utils/CallStack.h>
-
-#include <EGL/egl.h>
-
-#include "egl_tls.h"
-
-
-namespace android {
-
-pthread_key_t egl_tls_t::sKey = -1;
-pthread_mutex_t egl_tls_t::sLockKey = PTHREAD_MUTEX_INITIALIZER;
-
-egl_tls_t::egl_tls_t()
- : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) {
-}
-
-const char *egl_tls_t::egl_strerror(EGLint err) {
- switch (err) {
- case EGL_SUCCESS: return "EGL_SUCCESS";
- case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
- case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
- case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
- case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
- case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
- case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
- case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
- case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
- case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
- case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
- case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
- case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
- case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
- default: return "UNKNOWN";
- }
-}
-
-void egl_tls_t::validateTLSKey()
-{
- if (sKey == -1) {
- pthread_mutex_lock(&sLockKey);
- if (sKey == -1)
- pthread_key_create(&sKey, NULL);
- pthread_mutex_unlock(&sLockKey);
- }
-}
-
-void egl_tls_t::setErrorEtcImpl(
- const char* caller, int line, EGLint error, bool quiet) {
- validateTLSKey();
- egl_tls_t* tls = getTLS();
- if (tls->error != error) {
- if (!quiet) {
- ALOGE("%s:%d error %x (%s)",
- caller, line, error, egl_strerror(error));
- char value[PROPERTY_VALUE_MAX];
- property_get("debug.egl.callstack", value, "0");
- if (atoi(value)) {
- CallStack stack;
- stack.update();
- stack.dump();
- }
- }
- tls->error = error;
- }
-}
-
-bool egl_tls_t::logNoContextCall() {
- egl_tls_t* tls = getTLS();
- if (tls->logCallWithNoContext == true) {
- tls->logCallWithNoContext = false;
- return true;
- }
- return false;
-}
-
-egl_tls_t* egl_tls_t::getTLS() {
- egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey);
- if (tls == 0) {
- tls = new egl_tls_t;
- pthread_setspecific(sKey, tls);
- }
- return tls;
-}
-
-void egl_tls_t::clearTLS() {
- if (sKey != -1) {
- egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey);
- if (tls) {
- delete tls;
- pthread_setspecific(sKey, 0);
- }
- }
-}
-
-void egl_tls_t::clearError() {
- // This must clear the error from all the underlying EGL implementations as
- // well as the EGL wrapper layer.
- eglGetError();
-}
-
-EGLint egl_tls_t::getError() {
- if (sKey == -1)
- return EGL_SUCCESS;
- egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey);
- if (!tls) return EGL_SUCCESS;
- EGLint error = tls->error;
- tls->error = EGL_SUCCESS;
- return error;
-}
-
-void egl_tls_t::setContext(EGLContext ctx) {
- validateTLSKey();
- getTLS()->ctx = ctx;
-}
-
-EGLContext egl_tls_t::getContext() {
- if (sKey == -1)
- return EGL_NO_CONTEXT;
- egl_tls_t* tls = (egl_tls_t *)pthread_getspecific(sKey);
- if (!tls) return EGL_NO_CONTEXT;
- return tls->ctx;
-}
-
-
-} // namespace android
diff --git a/opengl/libs/EGL/egl_tls.h b/opengl/libs/EGL/egl_tls.h
deleted file mode 100644
index 2442ca0..0000000
--- a/opengl/libs/EGL/egl_tls.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGL_TLS_H
-#define ANDROID_EGL_TLS_H
-
-#include <pthread.h>
-
-#include <EGL/egl.h>
-
-#include "egldefs.h"
-#include "hooks.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class DbgContext;
-
-class egl_tls_t {
- static pthread_key_t sKey;
- static pthread_mutex_t sLockKey;
-
- EGLint error;
- EGLContext ctx;
- EGLBoolean logCallWithNoContext;
-
- egl_tls_t();
- static void validateTLSKey();
- static void setErrorEtcImpl(
- const char* caller, int line, EGLint error, bool quiet);
-
-public:
- static egl_tls_t* getTLS();
- static void clearTLS();
- static void clearError();
- static EGLint getError();
- static void setContext(EGLContext ctx);
- static EGLContext getContext();
- static bool logNoContextCall();
- static const char *egl_strerror(EGLint err);
-
- template<typename T>
- static T setErrorEtc(const char* caller,
- int line, EGLint error, T returnValue, bool quiet = false) {
- setErrorEtcImpl(caller, line, error, quiet);
- return returnValue;
- }
-};
-
-#define setError(_e, _r) \
- egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
-
-#define setErrorQuiet(_e, _r) \
- egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r, true)
-
-// ----------------------------------------------------------------------------
-
-#if EGL_TRACE
-
-extern gl_hooks_t const* getGLTraceThreadSpecific();
-
-#endif
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif // ANDROID_EGL_TLS_H
diff --git a/opengl/libs/EGL/egldefs.h b/opengl/libs/EGL/egldefs.h
deleted file mode 100644
index c900c1c..0000000
--- a/opengl/libs/EGL/egldefs.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGLDEFS_H
-#define ANDROID_EGLDEFS_H
-
-#include "hooks.h"
-
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 4
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-// EGLDisplay are global, not attached to a given thread
-const unsigned int NUM_DISPLAYS = 1;
-
-// ----------------------------------------------------------------------------
-
-struct egl_connection_t {
- enum {
- GLESv1_INDEX = 0,
- GLESv2_INDEX = 1
- };
-
- inline egl_connection_t() : dso(0) { }
- void * dso;
- gl_hooks_t * hooks[2];
- EGLint major;
- EGLint minor;
- egl_t egl;
-};
-
-// ----------------------------------------------------------------------------
-
-extern gl_hooks_t gHooks[2];
-extern gl_hooks_t gHooksNoContext;
-extern pthread_key_t gGLWrapperKey;
-extern "C" void gl_unimplemented();
-extern "C" void gl_noop();
-
-extern char const * const gl_names[];
-extern char const * const egl_names[];
-
-extern egl_connection_t gEGLImpl;
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_EGLDEFS_H */
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
deleted file mode 100644
index 8dcf38d..0000000
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- ** Copyright 2009, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <cutils/log.h>
-
-#include "egldefs.h"
-#include "hooks.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-#undef API_ENTRY
-#undef CALL_GL_EXTENSION_API
-#undef GL_EXTENSION
-#undef GL_EXTENSION_NAME
-#undef GL_EXTENSION_ARRAY
-#undef GL_EXTENSION_LIST
-#undef GET_TLS
-
-#if USE_FAST_TLS_KEY
-
- #ifdef HAVE_ARM_TLS_REGISTER
- #define GET_TLS(reg) \
- "mrc p15, 0, " #reg ", c13, c0, 3 \n"
- #else
- #define GET_TLS(reg) \
- "mov " #reg ", #0xFFFF0FFF \n" \
- "ldr " #reg ", [" #reg ", #-15] \n"
- #endif
-
- #define API_ENTRY(_api) __attribute__((naked)) _api
-
- #define CALL_GL_EXTENSION_API(_api) \
- asm volatile( \
- GET_TLS(r12) \
- "ldr r12, [r12, %[tls]] \n" \
- "cmp r12, #0 \n" \
- "ldrne r12, [r12, %[api]] \n" \
- "cmpne r12, #0 \n" \
- "bxne r12 \n" \
- "bx lr \n" \
- : \
- : [tls] "J"(TLS_SLOT_OPENGL_API*4), \
- [api] "J"(__builtin_offsetof(gl_hooks_t, \
- ext.extensions[_api])) \
- : \
- );
-
- #define GL_EXTENSION_NAME(_n) __glExtFwd##_n
-
- #define GL_EXTENSION(_n) \
- void API_ENTRY(GL_EXTENSION_NAME(_n))() { \
- CALL_GL_EXTENSION_API(_n); \
- }
-
-
-#else
-
- #define GL_EXTENSION_NAME(_n) NULL
-
- #define GL_EXTENSION(_n)
-
- #warning "eglGetProcAddress() partially supported"
-
-#endif
-
-
-#define GL_EXTENSION_LIST(name) \
- name(0) name(1) name(2) name(3) name(4) name(5) name(6) name(7) \
- name(8) name(9) name(10) name(11) name(12) name(13) name(14) name(15) \
- name(16) name(17) name(18) name(19) name(20) name(21) name(22) name(23) \
- name(24) name(25) name(26) name(27) name(28) name(29) name(30) name(31) \
- name(32) name(33) name(34) name(35) name(36) name(37) name(38) name(39) \
- name(40) name(41) name(42) name(43) name(44) name(45) name(46) name(47) \
- name(48) name(49) name(50) name(51) name(52) name(53) name(54) name(55) \
- name(56) name(57) name(58) name(59) name(60) name(61) name(62) name(63) \
- name(64) name(65) name(66) name(67) name(68) name(69) name(70) name(71) \
- name(72) name(73) name(74) name(75) name(76) name(77) name(78) name(79) \
- name(80) name(81) name(82) name(83) name(84) name(85) name(86) name(87) \
- name(88) name(89) name(90) name(91) name(92) name(93) name(94) name(95) \
- name(96) name(97) name(98) name(99) \
- name(100) name(101) name(102) name(103) name(104) name(105) name(106) name(107) \
- name(108) name(109) name(110) name(111) name(112) name(113) name(114) name(115) \
- name(116) name(117) name(118) name(119) name(120) name(121) name(122) name(123) \
- name(124) name(125) name(126) name(127) name(128) name(129) name(130) name(131) \
- name(132) name(133) name(134) name(135) name(136) name(137) name(138) name(139) \
- name(140) name(141) name(142) name(143) name(144) name(145) name(146) name(147) \
- name(148) name(149) name(150) name(151) name(152) name(153) name(154) name(155) \
- name(156) name(157) name(158) name(159) name(160) name(161) name(162) name(163) \
- name(164) name(165) name(166) name(167) name(168) name(169) name(170) name(171) \
- name(172) name(173) name(174) name(175) name(176) name(177) name(178) name(179) \
- name(180) name(181) name(182) name(183) name(184) name(185) name(186) name(187) \
- name(188) name(189) name(190) name(191) name(192) name(193) name(194) name(195) \
- name(196) name(197) name(198) name(199) \
- name(200) name(201) name(202) name(203) name(204) name(205) name(206) name(207) \
- name(208) name(209) name(210) name(211) name(212) name(213) name(214) name(215) \
- name(216) name(217) name(218) name(219) name(220) name(221) name(222) name(223) \
- name(224) name(225) name(226) name(227) name(228) name(229) name(230) name(231) \
- name(232) name(233) name(234) name(235) name(236) name(237) name(238) name(239) \
- name(240) name(241) name(242) name(243) name(244) name(245) name(246) name(247) \
- name(248) name(249) name(250) name(251) name(252) name(253) name(254) name(255)
-
-
-GL_EXTENSION_LIST( GL_EXTENSION )
-
-#define GL_EXTENSION_ARRAY(_n) GL_EXTENSION_NAME(_n),
-
-extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS] = {
- GL_EXTENSION_LIST( GL_EXTENSION_ARRAY )
- };
-
-#undef GET_TLS
-#undef GL_EXTENSION_LIST
-#undef GL_EXTENSION_ARRAY
-#undef GL_EXTENSION_NAME
-#undef GL_EXTENSION
-#undef API_ENTRY
-#undef CALL_GL_EXTENSION_API
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
diff --git a/opengl/libs/EGL/trace.cpp b/opengl/libs/EGL/trace.cpp
deleted file mode 100644
index 52907c1..0000000
--- a/opengl/libs/EGL/trace.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- ** Copyright 2010, The Android Open Source Project
- **
- ** 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.
- */
-
-#if EGL_TRACE
-
-#include <stdarg.h>
-#include <stdlib.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <cutils/log.h>
-
-#include "egl_tls.h"
-#include "hooks.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-struct GLenumString {
- GLenum e;
- const char* s;
-};
-
-#undef GL_ENUM
-#define GL_ENUM(VAL,NAME) {VAL, #NAME},
-
-static GLenumString g_enumnames[] = {
-#include "enums.in"
-};
-#undef GL_ENUM
-
-static int compareGLEnum(const void* a, const void* b) {
- return ((const GLenumString*) a)->e - ((const GLenumString*) b)->e;
-}
-
-static const char* GLEnumToString(GLenum e) {
- GLenumString key = {e, ""};
- const GLenumString* result = (const GLenumString*) bsearch(
- &key, g_enumnames,
- sizeof(g_enumnames) / sizeof(g_enumnames[0]),
- sizeof(g_enumnames[0]), compareGLEnum);
- if (result) {
- return result->s;
- }
- return NULL;
-}
-
-static const char* GLbooleanToString(GLboolean arg) {
- return arg ? "GL_TRUE" : "GL_FALSE";
-}
-
-static GLenumString g_bitfieldNames[] = {
- {0x00004000, "GL_COLOR_BUFFER_BIT"},
- {0x00000400, "GL_STENCIL_BUFFER_BIT"},
- {0x00000100, "GL_DEPTH_BUFFER_BIT"}
-};
-
-class StringBuilder {
- static const int lineSize = 500;
- char line[lineSize];
- int line_index;
-public:
- StringBuilder() {
- line_index = 0;
- line[0] = '\0';
- }
- void append(const char* fmt, ...) {
- va_list argp;
- va_start(argp, fmt);
- line_index += vsnprintf(line + line_index, lineSize-line_index, fmt, argp);
- va_end(argp);
- }
- const char* getString() {
- line_index = 0;
- line[lineSize-1] = '\0';
- return line;
- }
-};
-
-
-static void TraceGLShaderSource(GLuint shader, GLsizei count,
- const GLchar** string, const GLint* length) {
- ALOGD("const char* shaderSrc[] = {");
- for (GLsizei i = 0; i < count; i++) {
- const char* comma = i < count-1 ? "," : "";
- const GLchar* s = string[i];
- if (length) {
- GLint len = length[i];
- ALOGD(" \"%*s\"%s", len, s, comma);
- } else {
- ALOGD(" \"%s\"%s", s, comma);
- }
- }
- ALOGD("};");
- if (length) {
- ALOGD("const GLint* shaderLength[] = {");
- for (GLsizei i = 0; i < count; i++) {
- const char* comma = i < count-1 ? "," : "";
- GLint len = length[i];
- ALOGD(" \"%d\"%s", len, comma);
- }
- ALOGD("};");
- ALOGD("glShaderSource(%u, %u, shaderSrc, shaderLength);",
- shader, count);
- } else {
- ALOGD("glShaderSource(%u, %u, shaderSrc, (const GLint*) 0);",
- shader, count);
- }
-}
-
-static void TraceValue(int elementCount, char type,
- GLsizei chunkCount, GLsizei chunkSize, const void* value) {
- StringBuilder stringBuilder;
- GLsizei count = chunkCount * chunkSize;
- bool isFloat = type == 'f';
- const char* typeString = isFloat ? "GLfloat" : "GLint";
- ALOGD("const %s value[] = {", typeString);
- for (GLsizei i = 0; i < count; i++) {
- StringBuilder builder;
- builder.append(" ");
- for (int e = 0; e < elementCount; e++) {
- const char* comma = ", ";
- if (e == elementCount-1) {
- if (i == count - 1) {
- comma = "";
- } else {
- comma = ",";
- }
- }
- if (isFloat) {
- builder.append("%g%s", * (GLfloat*) value, comma);
- value = (void*) (((GLfloat*) value) + 1);
- } else {
- builder.append("%d%s", * (GLint*) value, comma);
- value = (void*) (((GLint*) value) + 1);
- }
- }
- ALOGD("%s", builder.getString());
- if (chunkSize > 1 && i < count-1
- && (i % chunkSize) == (chunkSize-1)) {
- ALOGD("%s", ""); // Print a blank line.
- }
- }
- ALOGD("};");
-}
-
-static void TraceUniformv(int elementCount, char type,
- GLuint location, GLsizei count, const void* value) {
- TraceValue(elementCount, type, count, 1, value);
- ALOGD("glUniform%d%c(%u, %u, value);", elementCount, type, location, count);
-}
-
-static void TraceUniformMatrix(int matrixSideLength,
- GLuint location, GLsizei count, GLboolean transpose, const void* value) {
- TraceValue(matrixSideLength, 'f', count, matrixSideLength, value);
- ALOGD("glUniformMatrix%dfv(%u, %u, %s, value);", matrixSideLength, location, count,
- GLbooleanToString(transpose));
-}
-
-static void TraceGL(const char* name, int numArgs, ...) {
- va_list argp;
- va_start(argp, numArgs);
- int nameLen = strlen(name);
-
- // glShaderSource
- if (nameLen == 14 && strcmp(name, "glShaderSource") == 0) {
- va_arg(argp, const char*);
- GLuint shader = va_arg(argp, GLuint);
- va_arg(argp, const char*);
- GLsizei count = va_arg(argp, GLsizei);
- va_arg(argp, const char*);
- const GLchar** string = (const GLchar**) va_arg(argp, void*);
- va_arg(argp, const char*);
- const GLint* length = (const GLint*) va_arg(argp, void*);
- va_end(argp);
- TraceGLShaderSource(shader, count, string, length);
- return;
- }
-
- // glUniformXXv
-
- if (nameLen == 12 && strncmp(name, "glUniform", 9) == 0 && name[11] == 'v') {
- int elementCount = name[9] - '0'; // 1..4
- char type = name[10]; // 'f' or 'i'
- va_arg(argp, const char*);
- GLuint location = va_arg(argp, GLuint);
- va_arg(argp, const char*);
- GLsizei count = va_arg(argp, GLsizei);
- va_arg(argp, const char*);
- const void* value = (const void*) va_arg(argp, void*);
- va_end(argp);
- TraceUniformv(elementCount, type, location, count, value);
- return;
- }
-
- // glUniformMatrixXfv
-
- if (nameLen == 18 && strncmp(name, "glUniformMatrix", 15) == 0
- && name[16] == 'f' && name[17] == 'v') {
- int matrixSideLength = name[15] - '0'; // 2..4
- va_arg(argp, const char*);
- GLuint location = va_arg(argp, GLuint);
- va_arg(argp, const char*);
- GLsizei count = va_arg(argp, GLsizei);
- va_arg(argp, const char*);
- GLboolean transpose = (GLboolean) va_arg(argp, int);
- va_arg(argp, const char*);
- const void* value = (const void*) va_arg(argp, void*);
- va_end(argp);
- TraceUniformMatrix(matrixSideLength, location, count, transpose, value);
- return;
- }
-
- StringBuilder builder;
- builder.append("%s(", name);
- for (int i = 0; i < numArgs; i++) {
- if (i > 0) {
- builder.append(", ");
- }
- const char* type = va_arg(argp, const char*);
- bool isPtr = type[strlen(type)-1] == '*'
- || strcmp(type, "GLeglImageOES") == 0;
- if (isPtr) {
- const void* arg = va_arg(argp, const void*);
- builder.append("(%s) 0x%08x", type, (size_t) arg);
- } else if (strcmp(type, "GLbitfield") == 0) {
- size_t arg = va_arg(argp, size_t);
- bool first = true;
- for (size_t i = 0; i < sizeof(g_bitfieldNames) / sizeof(g_bitfieldNames[0]); i++) {
- const GLenumString* b = &g_bitfieldNames[i];
- if (b->e & arg) {
- if (first) {
- first = false;
- } else {
- builder.append(" | ");
- }
- builder.append("%s", b->s);
- arg &= ~b->e;
- }
- }
- if (first || arg != 0) {
- if (!first) {
- builder.append(" | ");
- }
- builder.append("0x%08x", arg);
- }
- } else if (strcmp(type, "GLboolean") == 0) {
- GLboolean arg = va_arg(argp, int);
- builder.append("%s", GLbooleanToString(arg));
- } else if (strcmp(type, "GLclampf") == 0) {
- double arg = va_arg(argp, double);
- builder.append("%g", arg);
- } else if (strcmp(type, "GLenum") == 0) {
- GLenum arg = va_arg(argp, int);
- const char* s = GLEnumToString(arg);
- if (s) {
- builder.append("%s", s);
- } else {
- builder.append("0x%x", arg);
- }
- } else if (strcmp(type, "GLfixed") == 0) {
- int arg = va_arg(argp, int);
- builder.append("0x%08x", arg);
- } else if (strcmp(type, "GLfloat") == 0) {
- double arg = va_arg(argp, double);
- builder.append("%g", arg);
- } else if (strcmp(type, "GLint") == 0) {
- int arg = va_arg(argp, int);
- const char* s = NULL;
- if (strcmp(name, "glTexParameteri") == 0) {
- s = GLEnumToString(arg);
- }
- if (s) {
- builder.append("%s", s);
- } else {
- builder.append("%d", arg);
- }
- } else if (strcmp(type, "GLintptr") == 0) {
- int arg = va_arg(argp, unsigned int);
- builder.append("%u", arg);
- } else if (strcmp(type, "GLsizei") == 0) {
- int arg = va_arg(argp, size_t);
- builder.append("%u", arg);
- } else if (strcmp(type, "GLsizeiptr") == 0) {
- int arg = va_arg(argp, size_t);
- builder.append("%u", arg);
- } else if (strcmp(type, "GLuint") == 0) {
- int arg = va_arg(argp, unsigned int);
- builder.append("%u", arg);
- } else {
- builder.append("/* ??? %s */", type);
- break;
- }
- }
- builder.append(");");
- ALOGD("%s", builder.getString());
- va_end(argp);
-}
-
-#undef TRACE_GL_VOID
-#undef TRACE_GL
-
-#define TRACE_GL_VOID(_api, _args, _argList, ...) \
-static void Tracing_ ## _api _args { \
- TraceGL(#_api, __VA_ARGS__); \
- gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
- _c->_api _argList; \
-}
-
-#define TRACE_GL(_type, _api, _args, _argList, ...) \
-static _type Tracing_ ## _api _args { \
- TraceGL(#_api, __VA_ARGS__); \
- gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
- return _c->_api _argList; \
-}
-
-extern "C" {
-#include "../trace.in"
-}
-
-#undef TRACE_GL_VOID
-#undef TRACE_GL
-
-#define GL_ENTRY(_r, _api, ...) Tracing_ ## _api,
-EGLAPI gl_hooks_t gHooksTrace = {
- {
- #include "entries.in"
- },
- {
- {0}
- }
-};
-#undef GL_ENTRY
-
-
-#undef TRACE_GL_VOID
-#undef TRACE_GL
-
-// define the ES 1.0 Debug_gl* functions as Tracing_gl functions
-#define TRACE_GL_VOID(_api, _args, _argList, ...) \
-static void Debug_ ## _api _args { \
- TraceGL(#_api, __VA_ARGS__); \
- gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
- _c->_api _argList; \
-}
-
-#define TRACE_GL(_type, _api, _args, _argList, ...) \
-static _type Debug_ ## _api _args { \
- TraceGL(#_api, __VA_ARGS__); \
- gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
- return _c->_api _argList; \
-}
-
-extern "C" {
-#include "../debug.in"
-}
-
-#undef TRACE_GL_VOID
-#undef TRACE_GL
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif // EGL_TRACE
diff --git a/opengl/libs/ETC1/etc1.cpp b/opengl/libs/ETC1/etc1.cpp
deleted file mode 100644
index 97d1085..0000000
--- a/opengl/libs/ETC1/etc1.cpp
+++ /dev/null
@@ -1,670 +0,0 @@
-// Copyright 2009 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.
-
-#include <ETC1/etc1.h>
-
-#include <string.h>
-
-/* From http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
-
- The number of bits that represent a 4x4 texel block is 64 bits if
- <internalformat> is given by ETC1_RGB8_OES.
-
- The data for a block is a number of bytes,
-
- {q0, q1, q2, q3, q4, q5, q6, q7}
-
- where byte q0 is located at the lowest memory address and q7 at
- the highest. The 64 bits specifying the block is then represented
- by the following 64 bit integer:
-
- int64bit = 256*(256*(256*(256*(256*(256*(256*q0+q1)+q2)+q3)+q4)+q5)+q6)+q7;
-
- ETC1_RGB8_OES:
-
- a) bit layout in bits 63 through 32 if diffbit = 0
-
- 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
- -----------------------------------------------
- | base col1 | base col2 | base col1 | base col2 |
- | R1 (4bits)| R2 (4bits)| G1 (4bits)| G2 (4bits)|
- -----------------------------------------------
-
- 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
- ---------------------------------------------------
- | base col1 | base col2 | table | table |diff|flip|
- | B1 (4bits)| B2 (4bits)| cw 1 | cw 2 |bit |bit |
- ---------------------------------------------------
-
-
- b) bit layout in bits 63 through 32 if diffbit = 1
-
- 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
- -----------------------------------------------
- | base col1 | dcol 2 | base col1 | dcol 2 |
- | R1' (5 bits) | dR2 | G1' (5 bits) | dG2 |
- -----------------------------------------------
-
- 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
- ---------------------------------------------------
- | base col 1 | dcol 2 | table | table |diff|flip|
- | B1' (5 bits) | dB2 | cw 1 | cw 2 |bit |bit |
- ---------------------------------------------------
-
-
- c) bit layout in bits 31 through 0 (in both cases)
-
- 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
- -----------------------------------------------
- | most significant pixel index bits |
- | p| o| n| m| l| k| j| i| h| g| f| e| d| c| b| a|
- -----------------------------------------------
-
- 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- --------------------------------------------------
- | least significant pixel index bits |
- | p| o| n| m| l| k| j| i| h| g| f| e| d| c | b | a |
- --------------------------------------------------
-
-
- Add table 3.17.2: Intensity modifier sets for ETC1 compressed textures:
-
- table codeword modifier table
- ------------------ ----------------------
- 0 -8 -2 2 8
- 1 -17 -5 5 17
- 2 -29 -9 9 29
- 3 -42 -13 13 42
- 4 -60 -18 18 60
- 5 -80 -24 24 80
- 6 -106 -33 33 106
- 7 -183 -47 47 183
-
-
- Add table 3.17.3 Mapping from pixel index values to modifier values for
- ETC1 compressed textures:
-
- pixel index value
- ---------------
- msb lsb resulting modifier value
- ----- ----- -------------------------
- 1 1 -b (large negative value)
- 1 0 -a (small negative value)
- 0 0 a (small positive value)
- 0 1 b (large positive value)
-
-
- */
-
-static const int kModifierTable[] = {
-/* 0 */2, 8, -2, -8,
-/* 1 */5, 17, -5, -17,
-/* 2 */9, 29, -9, -29,
-/* 3 */13, 42, -13, -42,
-/* 4 */18, 60, -18, -60,
-/* 5 */24, 80, -24, -80,
-/* 6 */33, 106, -33, -106,
-/* 7 */47, 183, -47, -183 };
-
-static const int kLookup[8] = { 0, 1, 2, 3, -4, -3, -2, -1 };
-
-static inline etc1_byte clamp(int x) {
- return (etc1_byte) (x >= 0 ? (x < 255 ? x : 255) : 0);
-}
-
-static
-inline int convert4To8(int b) {
- int c = b & 0xf;
- return (c << 4) | c;
-}
-
-static
-inline int convert5To8(int b) {
- int c = b & 0x1f;
- return (c << 3) | (c >> 2);
-}
-
-static
-inline int convert6To8(int b) {
- int c = b & 0x3f;
- return (c << 2) | (c >> 4);
-}
-
-static
-inline int divideBy255(int d) {
- return (d + 128 + (d >> 8)) >> 8;
-}
-
-static
-inline int convert8To4(int b) {
- int c = b & 0xff;
- return divideBy255(c * 15);
-}
-
-static
-inline int convert8To5(int b) {
- int c = b & 0xff;
- return divideBy255(c * 31);
-}
-
-static
-inline int convertDiff(int base, int diff) {
- return convert5To8((0x1f & base) + kLookup[0x7 & diff]);
-}
-
-static
-void decode_subblock(etc1_byte* pOut, int r, int g, int b, const int* table,
- etc1_uint32 low, bool second, bool flipped) {
- int baseX = 0;
- int baseY = 0;
- if (second) {
- if (flipped) {
- baseY = 2;
- } else {
- baseX = 2;
- }
- }
- for (int i = 0; i < 8; i++) {
- int x, y;
- if (flipped) {
- x = baseX + (i >> 1);
- y = baseY + (i & 1);
- } else {
- x = baseX + (i >> 2);
- y = baseY + (i & 3);
- }
- int k = y + (x * 4);
- int offset = ((low >> k) & 1) | ((low >> (k + 15)) & 2);
- int delta = table[offset];
- etc1_byte* q = pOut + 3 * (x + 4 * y);
- *q++ = clamp(r + delta);
- *q++ = clamp(g + delta);
- *q++ = clamp(b + delta);
- }
-}
-
-// Input is an ETC1 compressed version of the data.
-// Output is a 4 x 4 square of 3-byte pixels in form R, G, B
-
-void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut) {
- etc1_uint32 high = (pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
- etc1_uint32 low = (pIn[4] << 24) | (pIn[5] << 16) | (pIn[6] << 8) | pIn[7];
- int r1, r2, g1, g2, b1, b2;
- if (high & 2) {
- // differential
- int rBase = high >> 27;
- int gBase = high >> 19;
- int bBase = high >> 11;
- r1 = convert5To8(rBase);
- r2 = convertDiff(rBase, high >> 24);
- g1 = convert5To8(gBase);
- g2 = convertDiff(gBase, high >> 16);
- b1 = convert5To8(bBase);
- b2 = convertDiff(bBase, high >> 8);
- } else {
- // not differential
- r1 = convert4To8(high >> 28);
- r2 = convert4To8(high >> 24);
- g1 = convert4To8(high >> 20);
- g2 = convert4To8(high >> 16);
- b1 = convert4To8(high >> 12);
- b2 = convert4To8(high >> 8);
- }
- int tableIndexA = 7 & (high >> 5);
- int tableIndexB = 7 & (high >> 2);
- const int* tableA = kModifierTable + tableIndexA * 4;
- const int* tableB = kModifierTable + tableIndexB * 4;
- bool flipped = (high & 1) != 0;
- decode_subblock(pOut, r1, g1, b1, tableA, low, false, flipped);
- decode_subblock(pOut, r2, g2, b2, tableB, low, true, flipped);
-}
-
-typedef struct {
- etc1_uint32 high;
- etc1_uint32 low;
- etc1_uint32 score; // Lower is more accurate
-} etc_compressed;
-
-static
-inline void take_best(etc_compressed* a, const etc_compressed* b) {
- if (a->score > b->score) {
- *a = *b;
- }
-}
-
-static
-void etc_average_colors_subblock(const etc1_byte* pIn, etc1_uint32 inMask,
- etc1_byte* pColors, bool flipped, bool second) {
- int r = 0;
- int g = 0;
- int b = 0;
-
- if (flipped) {
- int by = 0;
- if (second) {
- by = 2;
- }
- for (int y = 0; y < 2; y++) {
- int yy = by + y;
- for (int x = 0; x < 4; x++) {
- int i = x + 4 * yy;
- if (inMask & (1 << i)) {
- const etc1_byte* p = pIn + i * 3;
- r += *(p++);
- g += *(p++);
- b += *(p++);
- }
- }
- }
- } else {
- int bx = 0;
- if (second) {
- bx = 2;
- }
- for (int y = 0; y < 4; y++) {
- for (int x = 0; x < 2; x++) {
- int xx = bx + x;
- int i = xx + 4 * y;
- if (inMask & (1 << i)) {
- const etc1_byte* p = pIn + i * 3;
- r += *(p++);
- g += *(p++);
- b += *(p++);
- }
- }
- }
- }
- pColors[0] = (etc1_byte)((r + 4) >> 3);
- pColors[1] = (etc1_byte)((g + 4) >> 3);
- pColors[2] = (etc1_byte)((b + 4) >> 3);
-}
-
-static
-inline int square(int x) {
- return x * x;
-}
-
-static etc1_uint32 chooseModifier(const etc1_byte* pBaseColors,
- const etc1_byte* pIn, etc1_uint32 *pLow, int bitIndex,
- const int* pModifierTable) {
- etc1_uint32 bestScore = ~0;
- int bestIndex = 0;
- int pixelR = pIn[0];
- int pixelG = pIn[1];
- int pixelB = pIn[2];
- int r = pBaseColors[0];
- int g = pBaseColors[1];
- int b = pBaseColors[2];
- for (int i = 0; i < 4; i++) {
- int modifier = pModifierTable[i];
- int decodedG = clamp(g + modifier);
- etc1_uint32 score = (etc1_uint32) (6 * square(decodedG - pixelG));
- if (score >= bestScore) {
- continue;
- }
- int decodedR = clamp(r + modifier);
- score += (etc1_uint32) (3 * square(decodedR - pixelR));
- if (score >= bestScore) {
- continue;
- }
- int decodedB = clamp(b + modifier);
- score += (etc1_uint32) square(decodedB - pixelB);
- if (score < bestScore) {
- bestScore = score;
- bestIndex = i;
- }
- }
- etc1_uint32 lowMask = (((bestIndex >> 1) << 16) | (bestIndex & 1))
- << bitIndex;
- *pLow |= lowMask;
- return bestScore;
-}
-
-static
-void etc_encode_subblock_helper(const etc1_byte* pIn, etc1_uint32 inMask,
- etc_compressed* pCompressed, bool flipped, bool second,
- const etc1_byte* pBaseColors, const int* pModifierTable) {
- int score = pCompressed->score;
- if (flipped) {
- int by = 0;
- if (second) {
- by = 2;
- }
- for (int y = 0; y < 2; y++) {
- int yy = by + y;
- for (int x = 0; x < 4; x++) {
- int i = x + 4 * yy;
- if (inMask & (1 << i)) {
- score += chooseModifier(pBaseColors, pIn + i * 3,
- &pCompressed->low, yy + x * 4, pModifierTable);
- }
- }
- }
- } else {
- int bx = 0;
- if (second) {
- bx = 2;
- }
- for (int y = 0; y < 4; y++) {
- for (int x = 0; x < 2; x++) {
- int xx = bx + x;
- int i = xx + 4 * y;
- if (inMask & (1 << i)) {
- score += chooseModifier(pBaseColors, pIn + i * 3,
- &pCompressed->low, y + xx * 4, pModifierTable);
- }
- }
- }
- }
- pCompressed->score = score;
-}
-
-static bool inRange4bitSigned(int color) {
- return color >= -4 && color <= 3;
-}
-
-static void etc_encodeBaseColors(etc1_byte* pBaseColors,
- const etc1_byte* pColors, etc_compressed* pCompressed) {
- int r1, g1, b1, r2, g2, b2; // 8 bit base colors for sub-blocks
- bool differential;
- {
- int r51 = convert8To5(pColors[0]);
- int g51 = convert8To5(pColors[1]);
- int b51 = convert8To5(pColors[2]);
- int r52 = convert8To5(pColors[3]);
- int g52 = convert8To5(pColors[4]);
- int b52 = convert8To5(pColors[5]);
-
- r1 = convert5To8(r51);
- g1 = convert5To8(g51);
- b1 = convert5To8(b51);
-
- int dr = r52 - r51;
- int dg = g52 - g51;
- int db = b52 - b51;
-
- differential = inRange4bitSigned(dr) && inRange4bitSigned(dg)
- && inRange4bitSigned(db);
- if (differential) {
- r2 = convert5To8(r51 + dr);
- g2 = convert5To8(g51 + dg);
- b2 = convert5To8(b51 + db);
- pCompressed->high |= (r51 << 27) | ((7 & dr) << 24) | (g51 << 19)
- | ((7 & dg) << 16) | (b51 << 11) | ((7 & db) << 8) | 2;
- }
- }
-
- if (!differential) {
- int r41 = convert8To4(pColors[0]);
- int g41 = convert8To4(pColors[1]);
- int b41 = convert8To4(pColors[2]);
- int r42 = convert8To4(pColors[3]);
- int g42 = convert8To4(pColors[4]);
- int b42 = convert8To4(pColors[5]);
- r1 = convert4To8(r41);
- g1 = convert4To8(g41);
- b1 = convert4To8(b41);
- r2 = convert4To8(r42);
- g2 = convert4To8(g42);
- b2 = convert4To8(b42);
- pCompressed->high |= (r41 << 28) | (r42 << 24) | (g41 << 20) | (g42
- << 16) | (b41 << 12) | (b42 << 8);
- }
- pBaseColors[0] = r1;
- pBaseColors[1] = g1;
- pBaseColors[2] = b1;
- pBaseColors[3] = r2;
- pBaseColors[4] = g2;
- pBaseColors[5] = b2;
-}
-
-static
-void etc_encode_block_helper(const etc1_byte* pIn, etc1_uint32 inMask,
- const etc1_byte* pColors, etc_compressed* pCompressed, bool flipped) {
- pCompressed->score = ~0;
- pCompressed->high = (flipped ? 1 : 0);
- pCompressed->low = 0;
-
- etc1_byte pBaseColors[6];
-
- etc_encodeBaseColors(pBaseColors, pColors, pCompressed);
-
- int originalHigh = pCompressed->high;
-
- const int* pModifierTable = kModifierTable;
- for (int i = 0; i < 8; i++, pModifierTable += 4) {
- etc_compressed temp;
- temp.score = 0;
- temp.high = originalHigh | (i << 5);
- temp.low = 0;
- etc_encode_subblock_helper(pIn, inMask, &temp, flipped, false,
- pBaseColors, pModifierTable);
- take_best(pCompressed, &temp);
- }
- pModifierTable = kModifierTable;
- etc_compressed firstHalf = *pCompressed;
- for (int i = 0; i < 8; i++, pModifierTable += 4) {
- etc_compressed temp;
- temp.score = firstHalf.score;
- temp.high = firstHalf.high | (i << 2);
- temp.low = firstHalf.low;
- etc_encode_subblock_helper(pIn, inMask, &temp, flipped, true,
- pBaseColors + 3, pModifierTable);
- if (i == 0) {
- *pCompressed = temp;
- } else {
- take_best(pCompressed, &temp);
- }
- }
-}
-
-static void writeBigEndian(etc1_byte* pOut, etc1_uint32 d) {
- pOut[0] = (etc1_byte)(d >> 24);
- pOut[1] = (etc1_byte)(d >> 16);
- pOut[2] = (etc1_byte)(d >> 8);
- pOut[3] = (etc1_byte) d;
-}
-
-// Input is a 4 x 4 square of 3-byte pixels in form R, G, B
-// inmask is a 16-bit mask where bit (1 << (x + y * 4)) tells whether the corresponding (x,y)
-// pixel is valid or not. Invalid pixel color values are ignored when compressing.
-// Output is an ETC1 compressed version of the data.
-
-void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 inMask,
- etc1_byte* pOut) {
- etc1_byte colors[6];
- etc1_byte flippedColors[6];
- etc_average_colors_subblock(pIn, inMask, colors, false, false);
- etc_average_colors_subblock(pIn, inMask, colors + 3, false, true);
- etc_average_colors_subblock(pIn, inMask, flippedColors, true, false);
- etc_average_colors_subblock(pIn, inMask, flippedColors + 3, true, true);
-
- etc_compressed a, b;
- etc_encode_block_helper(pIn, inMask, colors, &a, false);
- etc_encode_block_helper(pIn, inMask, flippedColors, &b, true);
- take_best(&a, &b);
- writeBigEndian(pOut, a.high);
- writeBigEndian(pOut + 4, a.low);
-}
-
-// Return the size of the encoded image data (does not include size of PKM header).
-
-etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height) {
- return (((width + 3) & ~3) * ((height + 3) & ~3)) >> 1;
-}
-
-// Encode an entire image.
-// pIn - pointer to the image data. Formatted such that the Red component of
-// pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset;
-// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
-
-int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut) {
- if (pixelSize < 2 || pixelSize > 3) {
- return -1;
- }
- static const unsigned short kYMask[] = { 0x0, 0xf, 0xff, 0xfff, 0xffff };
- static const unsigned short kXMask[] = { 0x0, 0x1111, 0x3333, 0x7777,
- 0xffff };
- etc1_byte block[ETC1_DECODED_BLOCK_SIZE];
- etc1_byte encoded[ETC1_ENCODED_BLOCK_SIZE];
-
- etc1_uint32 encodedWidth = (width + 3) & ~3;
- etc1_uint32 encodedHeight = (height + 3) & ~3;
-
- for (etc1_uint32 y = 0; y < encodedHeight; y += 4) {
- etc1_uint32 yEnd = height - y;
- if (yEnd > 4) {
- yEnd = 4;
- }
- int ymask = kYMask[yEnd];
- for (etc1_uint32 x = 0; x < encodedWidth; x += 4) {
- etc1_uint32 xEnd = width - x;
- if (xEnd > 4) {
- xEnd = 4;
- }
- int mask = ymask & kXMask[xEnd];
- for (etc1_uint32 cy = 0; cy < yEnd; cy++) {
- etc1_byte* q = block + (cy * 4) * 3;
- const etc1_byte* p = pIn + pixelSize * x + stride * (y + cy);
- if (pixelSize == 3) {
- memcpy(q, p, xEnd * 3);
- } else {
- for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
- int pixel = (p[1] << 8) | p[0];
- *q++ = convert5To8(pixel >> 11);
- *q++ = convert6To8(pixel >> 5);
- *q++ = convert5To8(pixel);
- p += pixelSize;
- }
- }
- }
- etc1_encode_block(block, mask, encoded);
- memcpy(pOut, encoded, sizeof(encoded));
- pOut += sizeof(encoded);
- }
- }
- return 0;
-}
-
-// Decode an entire image.
-// pIn - pointer to encoded data.
-// pOut - pointer to the image data. Will be written such that the Red component of
-// pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset. Must be
-// large enough to store entire image.
-
-
-int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
- etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride) {
- if (pixelSize < 2 || pixelSize > 3) {
- return -1;
- }
- etc1_byte block[ETC1_DECODED_BLOCK_SIZE];
-
- etc1_uint32 encodedWidth = (width + 3) & ~3;
- etc1_uint32 encodedHeight = (height + 3) & ~3;
-
- for (etc1_uint32 y = 0; y < encodedHeight; y += 4) {
- etc1_uint32 yEnd = height - y;
- if (yEnd > 4) {
- yEnd = 4;
- }
- for (etc1_uint32 x = 0; x < encodedWidth; x += 4) {
- etc1_uint32 xEnd = width - x;
- if (xEnd > 4) {
- xEnd = 4;
- }
- etc1_decode_block(pIn, block);
- pIn += ETC1_ENCODED_BLOCK_SIZE;
- for (etc1_uint32 cy = 0; cy < yEnd; cy++) {
- const etc1_byte* q = block + (cy * 4) * 3;
- etc1_byte* p = pOut + pixelSize * x + stride * (y + cy);
- if (pixelSize == 3) {
- memcpy(p, q, xEnd * 3);
- } else {
- for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
- etc1_byte r = *q++;
- etc1_byte g = *q++;
- etc1_byte b = *q++;
- etc1_uint32 pixel = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
- *p++ = (etc1_byte) pixel;
- *p++ = (etc1_byte) (pixel >> 8);
- }
- }
- }
- }
- }
- return 0;
-}
-
-static const char kMagic[] = { 'P', 'K', 'M', ' ', '1', '0' };
-
-static const etc1_uint32 ETC1_PKM_FORMAT_OFFSET = 6;
-static const etc1_uint32 ETC1_PKM_ENCODED_WIDTH_OFFSET = 8;
-static const etc1_uint32 ETC1_PKM_ENCODED_HEIGHT_OFFSET = 10;
-static const etc1_uint32 ETC1_PKM_WIDTH_OFFSET = 12;
-static const etc1_uint32 ETC1_PKM_HEIGHT_OFFSET = 14;
-
-static const etc1_uint32 ETC1_RGB_NO_MIPMAPS = 0;
-
-static void writeBEUint16(etc1_byte* pOut, etc1_uint32 data) {
- pOut[0] = (etc1_byte) (data >> 8);
- pOut[1] = (etc1_byte) data;
-}
-
-static etc1_uint32 readBEUint16(const etc1_byte* pIn) {
- return (pIn[0] << 8) | pIn[1];
-}
-
-// Format a PKM header
-
-void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height) {
- memcpy(pHeader, kMagic, sizeof(kMagic));
- etc1_uint32 encodedWidth = (width + 3) & ~3;
- etc1_uint32 encodedHeight = (height + 3) & ~3;
- writeBEUint16(pHeader + ETC1_PKM_FORMAT_OFFSET, ETC1_RGB_NO_MIPMAPS);
- writeBEUint16(pHeader + ETC1_PKM_ENCODED_WIDTH_OFFSET, encodedWidth);
- writeBEUint16(pHeader + ETC1_PKM_ENCODED_HEIGHT_OFFSET, encodedHeight);
- writeBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET, width);
- writeBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET, height);
-}
-
-// Check if a PKM header is correctly formatted.
-
-etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader) {
- if (memcmp(pHeader, kMagic, sizeof(kMagic))) {
- return false;
- }
- etc1_uint32 format = readBEUint16(pHeader + ETC1_PKM_FORMAT_OFFSET);
- etc1_uint32 encodedWidth = readBEUint16(pHeader + ETC1_PKM_ENCODED_WIDTH_OFFSET);
- etc1_uint32 encodedHeight = readBEUint16(pHeader + ETC1_PKM_ENCODED_HEIGHT_OFFSET);
- etc1_uint32 width = readBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET);
- etc1_uint32 height = readBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET);
- return format == ETC1_RGB_NO_MIPMAPS &&
- encodedWidth >= width && encodedWidth - width < 4 &&
- encodedHeight >= height && encodedHeight - height < 4;
-}
-
-// Read the image width from a PKM header
-
-etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader) {
- return readBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET);
-}
-
-// Read the image height from a PKM header
-
-etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader){
- return readBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET);
-}
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
deleted file mode 100644
index 4345c2b..0000000
--- a/opengl/libs/GLES2/gl2.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-
-#include <sys/ioctl.h>
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-#include "hooks.h"
-#include "egl_impl.h"
-
-using namespace android;
-
-// ----------------------------------------------------------------------------
-// Actual GL entry-points
-// ----------------------------------------------------------------------------
-
-#undef API_ENTRY
-#undef CALL_GL_API
-#undef CALL_GL_API_RETURN
-
-#define DEBUG_CALL_GL_API 0
-
-#if USE_FAST_TLS_KEY
-
- #ifdef HAVE_ARM_TLS_REGISTER
- #define GET_TLS(reg) \
- "mrc p15, 0, " #reg ", c13, c0, 3 \n"
- #else
- #define GET_TLS(reg) \
- "mov " #reg ", #0xFFFF0FFF \n" \
- "ldr " #reg ", [" #reg ", #-15] \n"
- #endif
-
- #define API_ENTRY(_api) __attribute__((naked)) _api
-
- #define CALL_GL_API(_api, ...) \
- asm volatile( \
- GET_TLS(r12) \
- "ldr r12, [r12, %[tls]] \n" \
- "cmp r12, #0 \n" \
- "ldrne pc, [r12, %[api]] \n" \
- "mov r0, #0 \n" \
- "bx lr \n" \
- : \
- : [tls] "J"(TLS_SLOT_OPENGL_API*4), \
- [api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
- : \
- );
-
- #define CALL_GL_API_RETURN(_api, ...) \
- CALL_GL_API(_api, __VA_ARGS__) \
- return 0; // placate gcc's warnings. never reached.
-
-#else
-
- #define API_ENTRY(_api) _api
-
-#if DEBUG_CALL_GL_API
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- _c->_api(__VA_ARGS__); \
- GLenum status = GL_NO_ERROR; \
- while ((status = glGetError()) != GL_NO_ERROR) { \
- ALOGD("[" #_api "] 0x%x", status); \
- }
-
-#else
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- _c->_api(__VA_ARGS__);
-
-#endif
-
- #define CALL_GL_API_RETURN(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- return _c->_api(__VA_ARGS__)
-
-#endif
-
-
-extern "C" {
-#include "gl2_api.in"
-#include "gl2ext_api.in"
-}
-
-#undef API_ENTRY
-#undef CALL_GL_API
-#undef CALL_GL_API_RETURN
-
-/*
- * glGetString() is special because we expose some extensions in the wrapper
- */
-
-extern "C" const GLubyte * __glGetString(GLenum name);
-
-const GLubyte * glGetString(GLenum name)
-{
- const GLubyte * ret = egl_get_string_for_current_context(name);
- if (ret == NULL) {
- ret = __glGetString(name);
- }
- return ret;
-}
diff --git a/opengl/libs/GLES2/gl2_api.in b/opengl/libs/GLES2/gl2_api.in
deleted file mode 100644
index 9a89a52..0000000
--- a/opengl/libs/GLES2/gl2_api.in
+++ /dev/null
@@ -1,426 +0,0 @@
-void API_ENTRY(glActiveTexture)(GLenum texture) {
- CALL_GL_API(glActiveTexture, texture);
-}
-void API_ENTRY(glAttachShader)(GLuint program, GLuint shader) {
- CALL_GL_API(glAttachShader, program, shader);
-}
-void API_ENTRY(glBindAttribLocation)(GLuint program, GLuint index, const GLchar* name) {
- CALL_GL_API(glBindAttribLocation, program, index, name);
-}
-void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
- CALL_GL_API(glBindBuffer, target, buffer);
-}
-void API_ENTRY(glBindFramebuffer)(GLenum target, GLuint framebuffer) {
- CALL_GL_API(glBindFramebuffer, target, framebuffer);
-}
-void API_ENTRY(glBindRenderbuffer)(GLenum target, GLuint renderbuffer) {
- CALL_GL_API(glBindRenderbuffer, target, renderbuffer);
-}
-void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
- CALL_GL_API(glBindTexture, target, texture);
-}
-void API_ENTRY(glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- CALL_GL_API(glBlendColor, red, green, blue, alpha);
-}
-void API_ENTRY(glBlendEquation)( GLenum mode ) {
- CALL_GL_API(glBlendEquation, mode);
-}
-void API_ENTRY(glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha) {
- CALL_GL_API(glBlendEquationSeparate, modeRGB, modeAlpha);
-}
-void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
- CALL_GL_API(glBlendFunc, sfactor, dfactor);
-}
-void API_ENTRY(glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- CALL_GL_API(glBlendFuncSeparate, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
- CALL_GL_API(glBufferData, target, size, data, usage);
-}
-void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
- CALL_GL_API(glBufferSubData, target, offset, size, data);
-}
-GLenum API_ENTRY(glCheckFramebufferStatus)(GLenum target) {
- CALL_GL_API_RETURN(glCheckFramebufferStatus, target);
-}
-void API_ENTRY(glClear)(GLbitfield mask) {
- CALL_GL_API(glClear, mask);
-}
-void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- CALL_GL_API(glClearColor, red, green, blue, alpha);
-}
-void API_ENTRY(glClearDepthf)(GLclampf depth) {
- CALL_GL_API(glClearDepthf, depth);
-}
-void API_ENTRY(glClearStencil)(GLint s) {
- CALL_GL_API(glClearStencil, s);
-}
-void API_ENTRY(glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- CALL_GL_API(glColorMask, red, green, blue, alpha);
-}
-void API_ENTRY(glCompileShader)(GLuint shader) {
- CALL_GL_API(glCompileShader, shader);
-}
-void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) {
- CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, width, height, border, imageSize, data);
-}
-void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) {
- CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-void API_ENTRY(glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
- CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y, width, height, border);
-}
-void API_ENTRY(glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y, width, height);
-}
-GLuint API_ENTRY(glCreateProgram)(void) {
- CALL_GL_API_RETURN(glCreateProgram);
-}
-GLuint API_ENTRY(glCreateShader)(GLenum type) {
- CALL_GL_API_RETURN(glCreateShader, type);
-}
-void API_ENTRY(glCullFace)(GLenum mode) {
- CALL_GL_API(glCullFace, mode);
-}
-void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) {
- CALL_GL_API(glDeleteBuffers, n, buffers);
-}
-void API_ENTRY(glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers) {
- CALL_GL_API(glDeleteFramebuffers, n, framebuffers);
-}
-void API_ENTRY(glDeleteProgram)(GLuint program) {
- CALL_GL_API(glDeleteProgram, program);
-}
-void API_ENTRY(glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers) {
- CALL_GL_API(glDeleteRenderbuffers, n, renderbuffers);
-}
-void API_ENTRY(glDeleteShader)(GLuint shader) {
- CALL_GL_API(glDeleteShader, shader);
-}
-void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint* textures) {
- CALL_GL_API(glDeleteTextures, n, textures);
-}
-void API_ENTRY(glDepthFunc)(GLenum func) {
- CALL_GL_API(glDepthFunc, func);
-}
-void API_ENTRY(glDepthMask)(GLboolean flag) {
- CALL_GL_API(glDepthMask, flag);
-}
-void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
- CALL_GL_API(glDepthRangef, zNear, zFar);
-}
-void API_ENTRY(glDetachShader)(GLuint program, GLuint shader) {
- CALL_GL_API(glDetachShader, program, shader);
-}
-void API_ENTRY(glDisable)(GLenum cap) {
- CALL_GL_API(glDisable, cap);
-}
-void API_ENTRY(glDisableVertexAttribArray)(GLuint index) {
- CALL_GL_API(glDisableVertexAttribArray, index);
-}
-void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
- CALL_GL_API(glDrawArrays, mode, first, count);
-}
-void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) {
- CALL_GL_API(glDrawElements, mode, count, type, indices);
-}
-void API_ENTRY(glEnable)(GLenum cap) {
- CALL_GL_API(glEnable, cap);
-}
-void API_ENTRY(glEnableVertexAttribArray)(GLuint index) {
- CALL_GL_API(glEnableVertexAttribArray, index);
-}
-void API_ENTRY(glFinish)(void) {
- CALL_GL_API(glFinish);
-}
-void API_ENTRY(glFlush)(void) {
- CALL_GL_API(glFlush);
-}
-void API_ENTRY(glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
- CALL_GL_API(glFramebufferRenderbuffer, target, attachment, renderbuffertarget, renderbuffer);
-}
-void API_ENTRY(glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
- CALL_GL_API(glFramebufferTexture2D, target, attachment, textarget, texture, level);
-}
-void API_ENTRY(glFrontFace)(GLenum mode) {
- CALL_GL_API(glFrontFace, mode);
-}
-void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) {
- CALL_GL_API(glGenBuffers, n, buffers);
-}
-void API_ENTRY(glGenerateMipmap)(GLenum target) {
- CALL_GL_API(glGenerateMipmap, target);
-}
-void API_ENTRY(glGenFramebuffers)(GLsizei n, GLuint* framebuffers) {
- CALL_GL_API(glGenFramebuffers, n, framebuffers);
-}
-void API_ENTRY(glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers) {
- CALL_GL_API(glGenRenderbuffers, n, renderbuffers);
-}
-void API_ENTRY(glGenTextures)(GLsizei n, GLuint* textures) {
- CALL_GL_API(glGenTextures, n, textures);
-}
-void API_ENTRY(glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) {
- CALL_GL_API(glGetActiveAttrib, program, index, bufsize, length, size, type, name);
-}
-void API_ENTRY(glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) {
- CALL_GL_API(glGetActiveUniform, program, index, bufsize, length, size, type, name);
-}
-void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
- CALL_GL_API(glGetAttachedShaders, program, maxcount, count, shaders);
-}
-int API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) {
- CALL_GL_API_RETURN(glGetAttribLocation, program, name);
-}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean* params) {
- CALL_GL_API(glGetBooleanv, pname, params);
-}
-void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params) {
- CALL_GL_API(glGetBufferParameteriv, target, pname, params);
-}
-GLenum API_ENTRY(glGetError)(void) {
- CALL_GL_API_RETURN(glGetError);
-}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat* params) {
- CALL_GL_API(glGetFloatv, pname, params);
-}
-void API_ENTRY(glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
- CALL_GL_API(glGetFramebufferAttachmentParameteriv, target, attachment, pname, params);
-}
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint* params) {
- CALL_GL_API(glGetIntegerv, pname, params);
-}
-void API_ENTRY(glGetProgramiv)(GLuint program, GLenum pname, GLint* params) {
- CALL_GL_API(glGetProgramiv, program, pname, params);
-}
-void API_ENTRY(glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) {
- CALL_GL_API(glGetProgramInfoLog, program, bufsize, length, infolog);
-}
-void API_ENTRY(glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params) {
- CALL_GL_API(glGetRenderbufferParameteriv, target, pname, params);
-}
-void API_ENTRY(glGetShaderiv)(GLuint shader, GLenum pname, GLint* params) {
- CALL_GL_API(glGetShaderiv, shader, pname, params);
-}
-void API_ENTRY(glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) {
- CALL_GL_API(glGetShaderInfoLog, shader, bufsize, length, infolog);
-}
-void API_ENTRY(glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
- CALL_GL_API(glGetShaderPrecisionFormat, shadertype, precisiontype, range, precision);
-}
-void API_ENTRY(glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) {
- CALL_GL_API(glGetShaderSource, shader, bufsize, length, source);
-}
-const GLubyte* API_ENTRY(__glGetString)(GLenum name) {
- CALL_GL_API_RETURN(glGetString, name);
-}
-void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params) {
- CALL_GL_API(glGetTexParameterfv, target, pname, params);
-}
-void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params) {
- CALL_GL_API(glGetTexParameteriv, target, pname, params);
-}
-void API_ENTRY(glGetUniformfv)(GLuint program, GLint location, GLfloat* params) {
- CALL_GL_API(glGetUniformfv, program, location, params);
-}
-void API_ENTRY(glGetUniformiv)(GLuint program, GLint location, GLint* params) {
- CALL_GL_API(glGetUniformiv, program, location, params);
-}
-int API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) {
- CALL_GL_API_RETURN(glGetUniformLocation, program, name);
-}
-void API_ENTRY(glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) {
- CALL_GL_API(glGetVertexAttribfv, index, pname, params);
-}
-void API_ENTRY(glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params) {
- CALL_GL_API(glGetVertexAttribiv, index, pname, params);
-}
-void API_ENTRY(glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer) {
- CALL_GL_API(glGetVertexAttribPointerv, index, pname, pointer);
-}
-void API_ENTRY(glHint)(GLenum target, GLenum mode) {
- CALL_GL_API(glHint, target, mode);
-}
-GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) {
- CALL_GL_API_RETURN(glIsBuffer, buffer);
-}
-GLboolean API_ENTRY(glIsEnabled)(GLenum cap) {
- CALL_GL_API_RETURN(glIsEnabled, cap);
-}
-GLboolean API_ENTRY(glIsFramebuffer)(GLuint framebuffer) {
- CALL_GL_API_RETURN(glIsFramebuffer, framebuffer);
-}
-GLboolean API_ENTRY(glIsProgram)(GLuint program) {
- CALL_GL_API_RETURN(glIsProgram, program);
-}
-GLboolean API_ENTRY(glIsRenderbuffer)(GLuint renderbuffer) {
- CALL_GL_API_RETURN(glIsRenderbuffer, renderbuffer);
-}
-GLboolean API_ENTRY(glIsShader)(GLuint shader) {
- CALL_GL_API_RETURN(glIsShader, shader);
-}
-GLboolean API_ENTRY(glIsTexture)(GLuint texture) {
- CALL_GL_API_RETURN(glIsTexture, texture);
-}
-void API_ENTRY(glLineWidth)(GLfloat width) {
- CALL_GL_API(glLineWidth, width);
-}
-void API_ENTRY(glLinkProgram)(GLuint program) {
- CALL_GL_API(glLinkProgram, program);
-}
-void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
- CALL_GL_API(glPixelStorei, pname, param);
-}
-void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
- CALL_GL_API(glPolygonOffset, factor, units);
-}
-void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) {
- CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
-}
-void API_ENTRY(glReleaseShaderCompiler)(void) {
- CALL_GL_API(glReleaseShaderCompiler);
-}
-void API_ENTRY(glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorage, target, internalformat, width, height);
-}
-void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
- CALL_GL_API(glSampleCoverage, value, invert);
-}
-void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glScissor, x, y, width, height);
-}
-void API_ENTRY(glShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) {
- CALL_GL_API(glShaderBinary, n, shaders, binaryformat, binary, length);
-}
-void API_ENTRY(glShaderSource)(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) {
- CALL_GL_API(glShaderSource, shader, count, string, length);
-}
-void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
- CALL_GL_API(glStencilFunc, func, ref, mask);
-}
-void API_ENTRY(glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) {
- CALL_GL_API(glStencilFuncSeparate, face, func, ref, mask);
-}
-void API_ENTRY(glStencilMask)(GLuint mask) {
- CALL_GL_API(glStencilMask, mask);
-}
-void API_ENTRY(glStencilMaskSeparate)(GLenum face, GLuint mask) {
- CALL_GL_API(glStencilMaskSeparate, face, mask);
-}
-void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
- CALL_GL_API(glStencilOp, fail, zfail, zpass);
-}
-void API_ENTRY(glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
- CALL_GL_API(glStencilOpSeparate, face, fail, zfail, zpass);
-}
-void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) {
- CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, border, format, type, pixels);
-}
-void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
- CALL_GL_API(glTexParameterf, target, pname, param);
-}
-void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params) {
- CALL_GL_API(glTexParameterfv, target, pname, params);
-}
-void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) {
- CALL_GL_API(glTexParameteri, target, pname, param);
-}
-void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint* params) {
- CALL_GL_API(glTexParameteriv, target, pname, params);
-}
-void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) {
- CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-void API_ENTRY(glUniform1f)(GLint location, GLfloat x) {
- CALL_GL_API(glUniform1f, location, x);
-}
-void API_ENTRY(glUniform1fv)(GLint location, GLsizei count, const GLfloat* v) {
- CALL_GL_API(glUniform1fv, location, count, v);
-}
-void API_ENTRY(glUniform1i)(GLint location, GLint x) {
- CALL_GL_API(glUniform1i, location, x);
-}
-void API_ENTRY(glUniform1iv)(GLint location, GLsizei count, const GLint* v) {
- CALL_GL_API(glUniform1iv, location, count, v);
-}
-void API_ENTRY(glUniform2f)(GLint location, GLfloat x, GLfloat y) {
- CALL_GL_API(glUniform2f, location, x, y);
-}
-void API_ENTRY(glUniform2fv)(GLint location, GLsizei count, const GLfloat* v) {
- CALL_GL_API(glUniform2fv, location, count, v);
-}
-void API_ENTRY(glUniform2i)(GLint location, GLint x, GLint y) {
- CALL_GL_API(glUniform2i, location, x, y);
-}
-void API_ENTRY(glUniform2iv)(GLint location, GLsizei count, const GLint* v) {
- CALL_GL_API(glUniform2iv, location, count, v);
-}
-void API_ENTRY(glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z) {
- CALL_GL_API(glUniform3f, location, x, y, z);
-}
-void API_ENTRY(glUniform3fv)(GLint location, GLsizei count, const GLfloat* v) {
- CALL_GL_API(glUniform3fv, location, count, v);
-}
-void API_ENTRY(glUniform3i)(GLint location, GLint x, GLint y, GLint z) {
- CALL_GL_API(glUniform3i, location, x, y, z);
-}
-void API_ENTRY(glUniform3iv)(GLint location, GLsizei count, const GLint* v) {
- CALL_GL_API(glUniform3iv, location, count, v);
-}
-void API_ENTRY(glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- CALL_GL_API(glUniform4f, location, x, y, z, w);
-}
-void API_ENTRY(glUniform4fv)(GLint location, GLsizei count, const GLfloat* v) {
- CALL_GL_API(glUniform4fv, location, count, v);
-}
-void API_ENTRY(glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w) {
- CALL_GL_API(glUniform4i, location, x, y, z, w);
-}
-void API_ENTRY(glUniform4iv)(GLint location, GLsizei count, const GLint* v) {
- CALL_GL_API(glUniform4iv, location, count, v);
-}
-void API_ENTRY(glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- CALL_GL_API(glUniformMatrix2fv, location, count, transpose, value);
-}
-void API_ENTRY(glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- CALL_GL_API(glUniformMatrix3fv, location, count, transpose, value);
-}
-void API_ENTRY(glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- CALL_GL_API(glUniformMatrix4fv, location, count, transpose, value);
-}
-void API_ENTRY(glUseProgram)(GLuint program) {
- CALL_GL_API(glUseProgram, program);
-}
-void API_ENTRY(glValidateProgram)(GLuint program) {
- CALL_GL_API(glValidateProgram, program);
-}
-void API_ENTRY(glVertexAttrib1f)(GLuint indx, GLfloat x) {
- CALL_GL_API(glVertexAttrib1f, indx, x);
-}
-void API_ENTRY(glVertexAttrib1fv)(GLuint indx, const GLfloat* values) {
- CALL_GL_API(glVertexAttrib1fv, indx, values);
-}
-void API_ENTRY(glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y) {
- CALL_GL_API(glVertexAttrib2f, indx, x, y);
-}
-void API_ENTRY(glVertexAttrib2fv)(GLuint indx, const GLfloat* values) {
- CALL_GL_API(glVertexAttrib2fv, indx, values);
-}
-void API_ENTRY(glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
- CALL_GL_API(glVertexAttrib3f, indx, x, y, z);
-}
-void API_ENTRY(glVertexAttrib3fv)(GLuint indx, const GLfloat* values) {
- CALL_GL_API(glVertexAttrib3fv, indx, values);
-}
-void API_ENTRY(glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- CALL_GL_API(glVertexAttrib4f, indx, x, y, z, w);
-}
-void API_ENTRY(glVertexAttrib4fv)(GLuint indx, const GLfloat* values) {
- CALL_GL_API(glVertexAttrib4fv, indx, values);
-}
-void API_ENTRY(glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) {
- CALL_GL_API(glVertexAttribPointer, indx, size, type, normalized, stride, ptr);
-}
-void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glViewport, x, y, width, height);
-}
diff --git a/opengl/libs/GLES2/gl2ext_api.in b/opengl/libs/GLES2/gl2ext_api.in
deleted file mode 100644
index c381075..0000000
--- a/opengl/libs/GLES2/gl2ext_api.in
+++ /dev/null
@@ -1,363 +0,0 @@
-void API_ENTRY(glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) {
- CALL_GL_API(glEGLImageTargetTexture2DOES, target, image);
-}
-void API_ENTRY(glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) {
- CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image);
-}
-void API_ENTRY(glGetProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) {
- CALL_GL_API(glGetProgramBinaryOES, program, bufSize, length, binaryFormat, binary);
-}
-void API_ENTRY(glProgramBinaryOES)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) {
- CALL_GL_API(glProgramBinaryOES, program, binaryFormat, binary, length);
-}
-void* API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) {
- CALL_GL_API_RETURN(glMapBufferOES, target, access);
-}
-GLboolean API_ENTRY(glUnmapBufferOES)(GLenum target) {
- CALL_GL_API_RETURN(glUnmapBufferOES, target);
-}
-void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, GLvoid** params) {
- CALL_GL_API(glGetBufferPointervOES, target, pname, params);
-}
-void API_ENTRY(glTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) {
- CALL_GL_API(glTexImage3DOES, target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-void API_ENTRY(glTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) {
- CALL_GL_API(glTexSubImage3DOES, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-void API_ENTRY(glCopyTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glCopyTexSubImage3DOES, target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-void API_ENTRY(glCompressedTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) {
- CALL_GL_API(glCompressedTexImage3DOES, target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-void API_ENTRY(glCompressedTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) {
- CALL_GL_API(glCompressedTexSubImage3DOES, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-void API_ENTRY(glFramebufferTexture3DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) {
- CALL_GL_API(glFramebufferTexture3DOES, target, attachment, textarget, texture, level, zoffset);
-}
-void API_ENTRY(glBindVertexArrayOES)(GLuint array) {
- CALL_GL_API(glBindVertexArrayOES, array);
-}
-void API_ENTRY(glDeleteVertexArraysOES)(GLsizei n, const GLuint *arrays) {
- CALL_GL_API(glDeleteVertexArraysOES, n, arrays);
-}
-void API_ENTRY(glGenVertexArraysOES)(GLsizei n, GLuint *arrays) {
- CALL_GL_API(glGenVertexArraysOES, n, arrays);
-}
-GLboolean API_ENTRY(glIsVertexArrayOES)(GLuint array) {
- CALL_GL_API_RETURN(glIsVertexArrayOES, array);
-}
-void API_ENTRY(glGetPerfMonitorGroupsAMD)(GLint *numGroups, GLsizei groupsSize, GLuint *groups) {
- CALL_GL_API(glGetPerfMonitorGroupsAMD, numGroups, groupsSize, groups);
-}
-void API_ENTRY(glGetPerfMonitorCountersAMD)(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) {
- CALL_GL_API(glGetPerfMonitorCountersAMD, group, numCounters, maxActiveCounters, counterSize, counters);
-}
-void API_ENTRY(glGetPerfMonitorGroupStringAMD)(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) {
- CALL_GL_API(glGetPerfMonitorGroupStringAMD, group, bufSize, length, groupString);
-}
-void API_ENTRY(glGetPerfMonitorCounterStringAMD)(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) {
- CALL_GL_API(glGetPerfMonitorCounterStringAMD, group, counter, bufSize, length, counterString);
-}
-void API_ENTRY(glGetPerfMonitorCounterInfoAMD)(GLuint group, GLuint counter, GLenum pname, GLvoid *data) {
- CALL_GL_API(glGetPerfMonitorCounterInfoAMD, group, counter, pname, data);
-}
-void API_ENTRY(glGenPerfMonitorsAMD)(GLsizei n, GLuint *monitors) {
- CALL_GL_API(glGenPerfMonitorsAMD, n, monitors);
-}
-void API_ENTRY(glDeletePerfMonitorsAMD)(GLsizei n, GLuint *monitors) {
- CALL_GL_API(glDeletePerfMonitorsAMD, n, monitors);
-}
-void API_ENTRY(glSelectPerfMonitorCountersAMD)(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) {
- CALL_GL_API(glSelectPerfMonitorCountersAMD, monitor, enable, group, numCounters, countersList);
-}
-void API_ENTRY(glBeginPerfMonitorAMD)(GLuint monitor) {
- CALL_GL_API(glBeginPerfMonitorAMD, monitor);
-}
-void API_ENTRY(glEndPerfMonitorAMD)(GLuint monitor) {
- CALL_GL_API(glEndPerfMonitorAMD, monitor);
-}
-void API_ENTRY(glGetPerfMonitorCounterDataAMD)(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) {
- CALL_GL_API(glGetPerfMonitorCounterDataAMD, monitor, pname, dataSize, data, bytesWritten);
-}
-void API_ENTRY(glBlitFramebufferANGLE)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) {
- CALL_GL_API(glBlitFramebufferANGLE, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleANGLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleANGLE, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleAPPLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleAPPLE, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glResolveMultisampleFramebufferAPPLE)(void) {
- CALL_GL_API(glResolveMultisampleFramebufferAPPLE);
-}
-void API_ENTRY(glLabelObjectEXT)(GLenum type, GLuint object, GLsizei length, const GLchar *label) {
- CALL_GL_API(glLabelObjectEXT, type, object, length, label);
-}
-void API_ENTRY(glGetObjectLabelEXT)(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label) {
- CALL_GL_API(glGetObjectLabelEXT, type, object, bufSize, length, label);
-}
-void API_ENTRY(glInsertEventMarkerEXT)(GLsizei length, const GLchar *marker) {
- CALL_GL_API(glInsertEventMarkerEXT, length, marker);
-}
-void API_ENTRY(glPushGroupMarkerEXT)(GLsizei length, const GLchar *marker) {
- CALL_GL_API(glPushGroupMarkerEXT, length, marker);
-}
-void API_ENTRY(glPopGroupMarkerEXT)(void) {
- CALL_GL_API(glPopGroupMarkerEXT);
-}
-void API_ENTRY(glDiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum *attachments) {
- CALL_GL_API(glDiscardFramebufferEXT, target, numAttachments, attachments);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleEXT, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glFramebufferTexture2DMultisampleEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) {
- CALL_GL_API(glFramebufferTexture2DMultisampleEXT, target, attachment, textarget, texture, level, samples);
-}
-void API_ENTRY(glMultiDrawArraysEXT)(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) {
- CALL_GL_API(glMultiDrawArraysEXT, mode, first, count, primcount);
-}
-void API_ENTRY(glMultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) {
- CALL_GL_API(glMultiDrawElementsEXT, mode, count, type, indices, primcount);
-}
-void API_ENTRY(glGenQueriesEXT)(GLsizei n, GLuint *ids) {
- CALL_GL_API(glGenQueriesEXT, n, ids);
-}
-void API_ENTRY(glDeleteQueriesEXT)(GLsizei n, const GLuint *ids) {
- CALL_GL_API(glDeleteQueriesEXT, n, ids);
-}
-GLboolean API_ENTRY(glIsQueryEXT)(GLuint id) {
- CALL_GL_API_RETURN(glIsQueryEXT, id);
-}
-void API_ENTRY(glBeginQueryEXT)(GLenum target, GLuint id) {
- CALL_GL_API(glBeginQueryEXT, target, id);
-}
-void API_ENTRY(glEndQueryEXT)(GLenum target) {
- CALL_GL_API(glEndQueryEXT, target);
-}
-void API_ENTRY(glGetQueryivEXT)(GLenum target, GLenum pname, GLint *params) {
- CALL_GL_API(glGetQueryivEXT, target, pname, params);
-}
-void API_ENTRY(glGetQueryObjectuivEXT)(GLuint id, GLenum pname, GLuint *params) {
- CALL_GL_API(glGetQueryObjectuivEXT, id, pname, params);
-}
-GLenum API_ENTRY(glGetGraphicsResetStatusEXT)(void) {
- CALL_GL_API_RETURN(glGetGraphicsResetStatusEXT);
-}
-void API_ENTRY(glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) {
- CALL_GL_API(glReadnPixelsEXT, x, y, width, height, format, type, bufSize, data);
-}
-void API_ENTRY(glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, float *params) {
- CALL_GL_API(glGetnUniformfvEXT, program, location, bufSize, params);
-}
-void API_ENTRY(glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint *params) {
- CALL_GL_API(glGetnUniformivEXT, program, location, bufSize, params);
-}
-void API_ENTRY(glUseProgramStagesEXT)(GLuint pipeline, GLbitfield stages, GLuint program) {
- CALL_GL_API(glUseProgramStagesEXT, pipeline, stages, program);
-}
-void API_ENTRY(glActiveShaderProgramEXT)(GLuint pipeline, GLuint program) {
- CALL_GL_API(glActiveShaderProgramEXT, pipeline, program);
-}
-GLuint API_ENTRY(glCreateShaderProgramvEXT)(GLenum type, GLsizei count, const GLchar **strings) {
- CALL_GL_API_RETURN(glCreateShaderProgramvEXT, type, count, strings);
-}
-void API_ENTRY(glBindProgramPipelineEXT)(GLuint pipeline) {
- CALL_GL_API(glBindProgramPipelineEXT, pipeline);
-}
-void API_ENTRY(glDeleteProgramPipelinesEXT)(GLsizei n, const GLuint *pipelines) {
- CALL_GL_API(glDeleteProgramPipelinesEXT, n, pipelines);
-}
-void API_ENTRY(glGenProgramPipelinesEXT)(GLsizei n, GLuint *pipelines) {
- CALL_GL_API(glGenProgramPipelinesEXT, n, pipelines);
-}
-GLboolean API_ENTRY(glIsProgramPipelineEXT)(GLuint pipeline) {
- CALL_GL_API_RETURN(glIsProgramPipelineEXT, pipeline);
-}
-void API_ENTRY(glProgramParameteriEXT)(GLuint program, GLenum pname, GLint value) {
- CALL_GL_API(glProgramParameteriEXT, program, pname, value);
-}
-void API_ENTRY(glGetProgramPipelineivEXT)(GLuint pipeline, GLenum pname, GLint *params) {
- CALL_GL_API(glGetProgramPipelineivEXT, pipeline, pname, params);
-}
-void API_ENTRY(glProgramUniform1iEXT)(GLuint program, GLint location, GLint x) {
- CALL_GL_API(glProgramUniform1iEXT, program, location, x);
-}
-void API_ENTRY(glProgramUniform2iEXT)(GLuint program, GLint location, GLint x, GLint y) {
- CALL_GL_API(glProgramUniform2iEXT, program, location, x, y);
-}
-void API_ENTRY(glProgramUniform3iEXT)(GLuint program, GLint location, GLint x, GLint y, GLint z) {
- CALL_GL_API(glProgramUniform3iEXT, program, location, x, y, z);
-}
-void API_ENTRY(glProgramUniform4iEXT)(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w) {
- CALL_GL_API(glProgramUniform4iEXT, program, location, x, y, z, w);
-}
-void API_ENTRY(glProgramUniform1fEXT)(GLuint program, GLint location, GLfloat x) {
- CALL_GL_API(glProgramUniform1fEXT, program, location, x);
-}
-void API_ENTRY(glProgramUniform2fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y) {
- CALL_GL_API(glProgramUniform2fEXT, program, location, x, y);
-}
-void API_ENTRY(glProgramUniform3fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z) {
- CALL_GL_API(glProgramUniform3fEXT, program, location, x, y, z);
-}
-void API_ENTRY(glProgramUniform4fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- CALL_GL_API(glProgramUniform4fEXT, program, location, x, y, z, w);
-}
-void API_ENTRY(glProgramUniform1ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) {
- CALL_GL_API(glProgramUniform1ivEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform2ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) {
- CALL_GL_API(glProgramUniform2ivEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform3ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) {
- CALL_GL_API(glProgramUniform3ivEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform4ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) {
- CALL_GL_API(glProgramUniform4ivEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform1fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- CALL_GL_API(glProgramUniform1fvEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform2fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- CALL_GL_API(glProgramUniform2fvEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform3fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- CALL_GL_API(glProgramUniform3fvEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniform4fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- CALL_GL_API(glProgramUniform4fvEXT, program, location, count, value);
-}
-void API_ENTRY(glProgramUniformMatrix2fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
- CALL_GL_API(glProgramUniformMatrix2fvEXT, program, location, count, transpose, value);
-}
-void API_ENTRY(glProgramUniformMatrix3fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
- CALL_GL_API(glProgramUniformMatrix3fvEXT, program, location, count, transpose, value);
-}
-void API_ENTRY(glProgramUniformMatrix4fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
- CALL_GL_API(glProgramUniformMatrix4fvEXT, program, location, count, transpose, value);
-}
-void API_ENTRY(glValidateProgramPipelineEXT)(GLuint pipeline) {
- CALL_GL_API(glValidateProgramPipelineEXT, pipeline);
-}
-void API_ENTRY(glGetProgramPipelineInfoLogEXT)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) {
- CALL_GL_API(glGetProgramPipelineInfoLogEXT, pipeline, bufSize, length, infoLog);
-}
-void API_ENTRY(glTexStorage1DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
- CALL_GL_API(glTexStorage1DEXT, target, levels, internalformat, width);
-}
-void API_ENTRY(glTexStorage2DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glTexStorage2DEXT, target, levels, internalformat, width, height);
-}
-void API_ENTRY(glTexStorage3DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) {
- CALL_GL_API(glTexStorage3DEXT, target, levels, internalformat, width, height, depth);
-}
-void API_ENTRY(glTextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
- CALL_GL_API(glTextureStorage1DEXT, texture, target, levels, internalformat, width);
-}
-void API_ENTRY(glTextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glTextureStorage2DEXT, texture, target, levels, internalformat, width, height);
-}
-void API_ENTRY(glTextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) {
- CALL_GL_API(glTextureStorage3DEXT, texture, target, levels, internalformat, width, height, depth);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleIMG)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleIMG, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glFramebufferTexture2DMultisampleIMG)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) {
- CALL_GL_API(glFramebufferTexture2DMultisampleIMG, target, attachment, textarget, texture, level, samples);
-}
-void API_ENTRY(glCoverageMaskNV)(GLboolean mask) {
- CALL_GL_API(glCoverageMaskNV, mask);
-}
-void API_ENTRY(glCoverageOperationNV)(GLenum operation) {
- CALL_GL_API(glCoverageOperationNV, operation);
-}
-void API_ENTRY(glDrawBuffersNV)(GLsizei n, const GLenum *bufs) {
- CALL_GL_API(glDrawBuffersNV, n, bufs);
-}
-void API_ENTRY(glDeleteFencesNV)(GLsizei n, const GLuint *fences) {
- CALL_GL_API(glDeleteFencesNV, n, fences);
-}
-void API_ENTRY(glGenFencesNV)(GLsizei n, GLuint *fences) {
- CALL_GL_API(glGenFencesNV, n, fences);
-}
-GLboolean API_ENTRY(glIsFenceNV)(GLuint fence) {
- CALL_GL_API_RETURN(glIsFenceNV, fence);
-}
-GLboolean API_ENTRY(glTestFenceNV)(GLuint fence) {
- CALL_GL_API_RETURN(glTestFenceNV, fence);
-}
-void API_ENTRY(glGetFenceivNV)(GLuint fence, GLenum pname, GLint *params) {
- CALL_GL_API(glGetFenceivNV, fence, pname, params);
-}
-void API_ENTRY(glFinishFenceNV)(GLuint fence) {
- CALL_GL_API(glFinishFenceNV, fence);
-}
-void API_ENTRY(glSetFenceNV)(GLuint fence, GLenum condition) {
- CALL_GL_API(glSetFenceNV, fence, condition);
-}
-void API_ENTRY(glReadBufferNV)(GLenum mode) {
- CALL_GL_API(glReadBufferNV, mode);
-}
-void API_ENTRY(glAlphaFuncQCOM)(GLenum func, GLclampf ref) {
- CALL_GL_API(glAlphaFuncQCOM, func, ref);
-}
-void API_ENTRY(glGetDriverControlsQCOM)(GLint *num, GLsizei size, GLuint *driverControls) {
- CALL_GL_API(glGetDriverControlsQCOM, num, size, driverControls);
-}
-void API_ENTRY(glGetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) {
- CALL_GL_API(glGetDriverControlStringQCOM, driverControl, bufSize, length, driverControlString);
-}
-void API_ENTRY(glEnableDriverControlQCOM)(GLuint driverControl) {
- CALL_GL_API(glEnableDriverControlQCOM, driverControl);
-}
-void API_ENTRY(glDisableDriverControlQCOM)(GLuint driverControl) {
- CALL_GL_API(glDisableDriverControlQCOM, driverControl);
-}
-void API_ENTRY(glExtGetTexturesQCOM)(GLuint *textures, GLint maxTextures, GLint *numTextures) {
- CALL_GL_API(glExtGetTexturesQCOM, textures, maxTextures, numTextures);
-}
-void API_ENTRY(glExtGetBuffersQCOM)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) {
- CALL_GL_API(glExtGetBuffersQCOM, buffers, maxBuffers, numBuffers);
-}
-void API_ENTRY(glExtGetRenderbuffersQCOM)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) {
- CALL_GL_API(glExtGetRenderbuffersQCOM, renderbuffers, maxRenderbuffers, numRenderbuffers);
-}
-void API_ENTRY(glExtGetFramebuffersQCOM)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) {
- CALL_GL_API(glExtGetFramebuffersQCOM, framebuffers, maxFramebuffers, numFramebuffers);
-}
-void API_ENTRY(glExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) {
- CALL_GL_API(glExtGetTexLevelParameterivQCOM, texture, face, level, pname, params);
-}
-void API_ENTRY(glExtTexObjectStateOverrideiQCOM)(GLenum target, GLenum pname, GLint param) {
- CALL_GL_API(glExtTexObjectStateOverrideiQCOM, target, pname, param);
-}
-void API_ENTRY(glExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) {
- CALL_GL_API(glExtGetTexSubImageQCOM, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels);
-}
-void API_ENTRY(glExtGetBufferPointervQCOM)(GLenum target, GLvoid **params) {
- CALL_GL_API(glExtGetBufferPointervQCOM, target, params);
-}
-void API_ENTRY(glExtGetShadersQCOM)(GLuint *shaders, GLint maxShaders, GLint *numShaders) {
- CALL_GL_API(glExtGetShadersQCOM, shaders, maxShaders, numShaders);
-}
-void API_ENTRY(glExtGetProgramsQCOM)(GLuint *programs, GLint maxPrograms, GLint *numPrograms) {
- CALL_GL_API(glExtGetProgramsQCOM, programs, maxPrograms, numPrograms);
-}
-GLboolean API_ENTRY(glExtIsProgramBinaryQCOM)(GLuint program) {
- CALL_GL_API_RETURN(glExtIsProgramBinaryQCOM, program);
-}
-void API_ENTRY(glExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar *source, GLint *length) {
- CALL_GL_API(glExtGetProgramBinarySourceQCOM, program, shadertype, source, length);
-}
-void API_ENTRY(glStartTilingQCOM)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) {
- CALL_GL_API(glStartTilingQCOM, x, y, width, height, preserveMask);
-}
-void API_ENTRY(glEndTilingQCOM)(GLbitfield preserveMask) {
- CALL_GL_API(glEndTilingQCOM, preserveMask);
-}
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
deleted file mode 100644
index adcb60d..0000000
--- a/opengl/libs/GLES_CM/gl.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-
-#include <sys/ioctl.h>
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-#include "hooks.h"
-#include "egl_impl.h"
-
-using namespace android;
-
-// set this to 1 for crude GL debugging
-#define CHECK_FOR_GL_ERRORS 0
-
-// ----------------------------------------------------------------------------
-// extensions for the framework
-// ----------------------------------------------------------------------------
-
-extern "C" {
-GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count);
-GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
- const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-}
-
-void glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count) {
- glColorPointer(size, type, stride, ptr);
-}
-void glNormalPointerBounds(GLenum type, GLsizei stride,
- const GLvoid *pointer, GLsizei count) {
- glNormalPointer(type, stride, pointer);
-}
-void glTexCoordPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count) {
- glTexCoordPointer(size, type, stride, pointer);
-}
-void glVertexPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count) {
- glVertexPointer(size, type, stride, pointer);
-}
-
-void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count) {
- glPointSizePointerOES(type, stride, pointer);
-}
-
-GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count) {
- glMatrixIndexPointerOES(size, type, stride, pointer);
-}
-
-GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count) {
- glWeightPointerOES(size, type, stride, pointer);
-}
-
-// ----------------------------------------------------------------------------
-// Actual GL entry-points
-// ----------------------------------------------------------------------------
-
-#undef API_ENTRY
-#undef CALL_GL_API
-#undef CALL_GL_API_RETURN
-
-#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS
-
- #ifdef HAVE_ARM_TLS_REGISTER
- #define GET_TLS(reg) \
- "mrc p15, 0, " #reg ", c13, c0, 3 \n"
- #else
- #define GET_TLS(reg) \
- "mov " #reg ", #0xFFFF0FFF \n" \
- "ldr " #reg ", [" #reg ", #-15] \n"
- #endif
-
- #define API_ENTRY(_api) __attribute__((naked)) _api
-
- #define CALL_GL_API(_api, ...) \
- asm volatile( \
- GET_TLS(r12) \
- "ldr r12, [r12, %[tls]] \n" \
- "cmp r12, #0 \n" \
- "ldrne pc, [r12, %[api]] \n" \
- "mov r0, #0 \n" \
- "bx lr \n" \
- : \
- : [tls] "J"(TLS_SLOT_OPENGL_API*4), \
- [api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
- : \
- );
-
- #define CALL_GL_API_RETURN(_api, ...) \
- CALL_GL_API(_api, __VA_ARGS__) \
- return 0; // placate gcc's warnings. never reached.
-
-#else
-
- #if CHECK_FOR_GL_ERRORS
-
- #define CHECK_GL_ERRORS(_api) \
- do { GLint err = glGetError(); \
- ALOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \
- } while(false);
-
- #else
-
- #define CHECK_GL_ERRORS(_api) do { } while(false);
-
- #endif
-
-
- #define API_ENTRY(_api) _api
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- _c->_api(__VA_ARGS__); \
- CHECK_GL_ERRORS(_api)
-
- #define CALL_GL_API_RETURN(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- return _c->_api(__VA_ARGS__)
-
-#endif
-
-
-extern "C" {
-#include "gl_api.in"
-#include "glext_api.in"
-}
-
-#undef API_ENTRY
-#undef CALL_GL_API
-#undef CALL_GL_API_RETURN
-
-/*
- * glGetString() is special because we expose some extensions in the wrapper
- */
-
-extern "C" const GLubyte * __glGetString(GLenum name);
-
-const GLubyte * glGetString(GLenum name)
-{
- const GLubyte * ret = egl_get_string_for_current_context(name);
- if (ret == NULL) {
- ret = __glGetString(name);
- }
- return ret;
-}
diff --git a/opengl/libs/GLES_CM/gl_api.in b/opengl/libs/GLES_CM/gl_api.in
deleted file mode 100644
index c8f6b0c..0000000
--- a/opengl/libs/GLES_CM/gl_api.in
+++ /dev/null
@@ -1,435 +0,0 @@
-void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) {
- CALL_GL_API(glAlphaFunc, func, ref);
-}
-void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- CALL_GL_API(glClearColor, red, green, blue, alpha);
-}
-void API_ENTRY(glClearDepthf)(GLclampf depth) {
- CALL_GL_API(glClearDepthf, depth);
-}
-void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) {
- CALL_GL_API(glClipPlanef, plane, equation);
-}
-void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
- CALL_GL_API(glColor4f, red, green, blue, alpha);
-}
-void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
- CALL_GL_API(glDepthRangef, zNear, zFar);
-}
-void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
- CALL_GL_API(glFogf, pname, param);
-}
-void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
- CALL_GL_API(glFogfv, pname, params);
-}
-void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) {
- CALL_GL_API(glGetClipPlanef, pname, eqn);
-}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
- CALL_GL_API(glGetFloatv, pname, params);
-}
-void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) {
- CALL_GL_API(glGetLightfv, light, pname, params);
-}
-void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) {
- CALL_GL_API(glGetMaterialfv, face, pname, params);
-}
-void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) {
- CALL_GL_API(glGetTexEnvfv, env, pname, params);
-}
-void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
- CALL_GL_API(glGetTexParameterfv, target, pname, params);
-}
-void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
- CALL_GL_API(glLightModelf, pname, param);
-}
-void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
- CALL_GL_API(glLightModelfv, pname, params);
-}
-void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
- CALL_GL_API(glLightf, light, pname, param);
-}
-void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
- CALL_GL_API(glLightfv, light, pname, params);
-}
-void API_ENTRY(glLineWidth)(GLfloat width) {
- CALL_GL_API(glLineWidth, width);
-}
-void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
- CALL_GL_API(glLoadMatrixf, m);
-}
-void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
- CALL_GL_API(glMaterialf, face, pname, param);
-}
-void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
- CALL_GL_API(glMaterialfv, face, pname, params);
-}
-void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
- CALL_GL_API(glMultMatrixf, m);
-}
-void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
- CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
-}
-void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
- CALL_GL_API(glNormal3f, nx, ny, nz);
-}
-void API_ENTRY(glOrthof)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
- CALL_GL_API(glPointParameterf, pname, param);
-}
-void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
- CALL_GL_API(glPointParameterfv, pname, params);
-}
-void API_ENTRY(glPointSize)(GLfloat size) {
- CALL_GL_API(glPointSize, size);
-}
-void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
- CALL_GL_API(glPolygonOffset, factor, units);
-}
-void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
- CALL_GL_API(glRotatef, angle, x, y, z);
-}
-void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
- CALL_GL_API(glScalef, x, y, z);
-}
-void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
- CALL_GL_API(glTexEnvf, target, pname, param);
-}
-void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
- CALL_GL_API(glTexEnvfv, target, pname, params);
-}
-void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
- CALL_GL_API(glTexParameterf, target, pname, param);
-}
-void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
- CALL_GL_API(glTexParameterfv, target, pname, params);
-}
-void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
- CALL_GL_API(glTranslatef, x, y, z);
-}
-void API_ENTRY(glActiveTexture)(GLenum texture) {
- CALL_GL_API(glActiveTexture, texture);
-}
-void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
- CALL_GL_API(glAlphaFuncx, func, ref);
-}
-void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
- CALL_GL_API(glBindBuffer, target, buffer);
-}
-void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
- CALL_GL_API(glBindTexture, target, texture);
-}
-void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
- CALL_GL_API(glBlendFunc, sfactor, dfactor);
-}
-void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) {
- CALL_GL_API(glBufferData, target, size, data, usage);
-}
-void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) {
- CALL_GL_API(glBufferSubData, target, offset, size, data);
-}
-void API_ENTRY(glClear)(GLbitfield mask) {
- CALL_GL_API(glClear, mask);
-}
-void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
- CALL_GL_API(glClearColorx, red, green, blue, alpha);
-}
-void API_ENTRY(glClearDepthx)(GLclampx depth) {
- CALL_GL_API(glClearDepthx, depth);
-}
-void API_ENTRY(glClearStencil)(GLint s) {
- CALL_GL_API(glClearStencil, s);
-}
-void API_ENTRY(glClientActiveTexture)(GLenum texture) {
- CALL_GL_API(glClientActiveTexture, texture);
-}
-void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
- CALL_GL_API(glClipPlanex, plane, equation);
-}
-void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
- CALL_GL_API(glColor4ub, red, green, blue, alpha);
-}
-void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
- CALL_GL_API(glColor4x, red, green, blue, alpha);
-}
-void API_ENTRY(glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- CALL_GL_API(glColorMask, red, green, blue, alpha);
-}
-void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glColorPointer, size, type, stride, pointer);
-}
-void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) {
- CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, width, height, border, imageSize, data);
-}
-void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) {
- CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-void API_ENTRY(glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
- CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y, width, height, border);
-}
-void API_ENTRY(glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y, width, height);
-}
-void API_ENTRY(glCullFace)(GLenum mode) {
- CALL_GL_API(glCullFace, mode);
-}
-void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint *buffers) {
- CALL_GL_API(glDeleteBuffers, n, buffers);
-}
-void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
- CALL_GL_API(glDeleteTextures, n, textures);
-}
-void API_ENTRY(glDepthFunc)(GLenum func) {
- CALL_GL_API(glDepthFunc, func);
-}
-void API_ENTRY(glDepthMask)(GLboolean flag) {
- CALL_GL_API(glDepthMask, flag);
-}
-void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
- CALL_GL_API(glDepthRangex, zNear, zFar);
-}
-void API_ENTRY(glDisable)(GLenum cap) {
- CALL_GL_API(glDisable, cap);
-}
-void API_ENTRY(glDisableClientState)(GLenum array) {
- CALL_GL_API(glDisableClientState, array);
-}
-void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
- CALL_GL_API(glDrawArrays, mode, first, count);
-}
-void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) {
- CALL_GL_API(glDrawElements, mode, count, type, indices);
-}
-void API_ENTRY(glEnable)(GLenum cap) {
- CALL_GL_API(glEnable, cap);
-}
-void API_ENTRY(glEnableClientState)(GLenum array) {
- CALL_GL_API(glEnableClientState, array);
-}
-void API_ENTRY(glFinish)(void) {
- CALL_GL_API(glFinish);
-}
-void API_ENTRY(glFlush)(void) {
- CALL_GL_API(glFlush);
-}
-void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
- CALL_GL_API(glFogx, pname, param);
-}
-void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
- CALL_GL_API(glFogxv, pname, params);
-}
-void API_ENTRY(glFrontFace)(GLenum mode) {
- CALL_GL_API(glFrontFace, mode);
-}
-void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
- CALL_GL_API(glGetBooleanv, pname, params);
-}
-void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
- CALL_GL_API(glGetBufferParameteriv, target, pname, params);
-}
-void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
- CALL_GL_API(glGetClipPlanex, pname, eqn);
-}
-void API_ENTRY(glGenBuffers)(GLsizei n, GLuint *buffers) {
- CALL_GL_API(glGenBuffers, n, buffers);
-}
-void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
- CALL_GL_API(glGenTextures, n, textures);
-}
-GLenum API_ENTRY(glGetError)(void) {
- CALL_GL_API_RETURN(glGetError);
-}
-void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetFixedv, pname, params);
-}
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
- CALL_GL_API(glGetIntegerv, pname, params);
-}
-void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetLightxv, light, pname, params);
-}
-void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetMaterialxv, face, pname, params);
-}
-void API_ENTRY(glGetPointerv)(GLenum pname, GLvoid **params) {
- CALL_GL_API(glGetPointerv, pname, params);
-}
-const GLubyte * API_ENTRY(__glGetString)(GLenum name) {
- CALL_GL_API_RETURN(glGetString, name);
-}
-void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) {
- CALL_GL_API(glGetTexEnviv, env, pname, params);
-}
-void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetTexEnvxv, env, pname, params);
-}
-void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) {
- CALL_GL_API(glGetTexParameteriv, target, pname, params);
-}
-void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetTexParameterxv, target, pname, params);
-}
-void API_ENTRY(glHint)(GLenum target, GLenum mode) {
- CALL_GL_API(glHint, target, mode);
-}
-GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) {
- CALL_GL_API_RETURN(glIsBuffer, buffer);
-}
-GLboolean API_ENTRY(glIsEnabled)(GLenum cap) {
- CALL_GL_API_RETURN(glIsEnabled, cap);
-}
-GLboolean API_ENTRY(glIsTexture)(GLuint texture) {
- CALL_GL_API_RETURN(glIsTexture, texture);
-}
-void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
- CALL_GL_API(glLightModelx, pname, param);
-}
-void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
- CALL_GL_API(glLightModelxv, pname, params);
-}
-void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
- CALL_GL_API(glLightx, light, pname, param);
-}
-void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glLightxv, light, pname, params);
-}
-void API_ENTRY(glLineWidthx)(GLfixed width) {
- CALL_GL_API(glLineWidthx, width);
-}
-void API_ENTRY(glLoadIdentity)(void) {
- CALL_GL_API(glLoadIdentity);
-}
-void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
- CALL_GL_API(glLoadMatrixx, m);
-}
-void API_ENTRY(glLogicOp)(GLenum opcode) {
- CALL_GL_API(glLogicOp, opcode);
-}
-void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
- CALL_GL_API(glMaterialx, face, pname, param);
-}
-void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glMaterialxv, face, pname, params);
-}
-void API_ENTRY(glMatrixMode)(GLenum mode) {
- CALL_GL_API(glMatrixMode, mode);
-}
-void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
- CALL_GL_API(glMultMatrixx, m);
-}
-void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
- CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
-}
-void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
- CALL_GL_API(glNormal3x, nx, ny, nz);
-}
-void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glNormalPointer, type, stride, pointer);
-}
-void API_ENTRY(glOrthox)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
- CALL_GL_API(glPixelStorei, pname, param);
-}
-void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) {
- CALL_GL_API(glPointParameterx, pname, param);
-}
-void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) {
- CALL_GL_API(glPointParameterxv, pname, params);
-}
-void API_ENTRY(glPointSizex)(GLfixed size) {
- CALL_GL_API(glPointSizex, size);
-}
-void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
- CALL_GL_API(glPolygonOffsetx, factor, units);
-}
-void API_ENTRY(glPopMatrix)(void) {
- CALL_GL_API(glPopMatrix);
-}
-void API_ENTRY(glPushMatrix)(void) {
- CALL_GL_API(glPushMatrix);
-}
-void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
- CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
-}
-void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
- CALL_GL_API(glRotatex, angle, x, y, z);
-}
-void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
- CALL_GL_API(glSampleCoverage, value, invert);
-}
-void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
- CALL_GL_API(glSampleCoveragex, value, invert);
-}
-void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
- CALL_GL_API(glScalex, x, y, z);
-}
-void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glScissor, x, y, width, height);
-}
-void API_ENTRY(glShadeModel)(GLenum mode) {
- CALL_GL_API(glShadeModel, mode);
-}
-void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
- CALL_GL_API(glStencilFunc, func, ref, mask);
-}
-void API_ENTRY(glStencilMask)(GLuint mask) {
- CALL_GL_API(glStencilMask, mask);
-}
-void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
- CALL_GL_API(glStencilOp, fail, zfail, zpass);
-}
-void API_ENTRY(glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
-}
-void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) {
- CALL_GL_API(glTexEnvi, target, pname, param);
-}
-void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
- CALL_GL_API(glTexEnvx, target, pname, param);
-}
-void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) {
- CALL_GL_API(glTexEnviv, target, pname, params);
-}
-void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glTexEnvxv, target, pname, params);
-}
-void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
- CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, border, format, type, pixels);
-}
-void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) {
- CALL_GL_API(glTexParameteri, target, pname, param);
-}
-void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
- CALL_GL_API(glTexParameterx, target, pname, param);
-}
-void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
- CALL_GL_API(glTexParameteriv, target, pname, params);
-}
-void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glTexParameterxv, target, pname, params);
-}
-void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) {
- CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
- CALL_GL_API(glTranslatex, x, y, z);
-}
-void API_ENTRY(glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glVertexPointer, size, type, stride, pointer);
-}
-void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
- CALL_GL_API(glViewport, x, y, width, height);
-}
-void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glPointSizePointerOES, type, stride, pointer);
-}
diff --git a/opengl/libs/GLES_CM/glext_api.in b/opengl/libs/GLES_CM/glext_api.in
deleted file mode 100644
index 7cd6cb5..0000000
--- a/opengl/libs/GLES_CM/glext_api.in
+++ /dev/null
@@ -1,420 +0,0 @@
-void API_ENTRY(glBlendEquationSeparateOES)(GLenum modeRGB, GLenum modeAlpha) {
- CALL_GL_API(glBlendEquationSeparateOES, modeRGB, modeAlpha);
-}
-void API_ENTRY(glBlendFuncSeparateOES)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- CALL_GL_API(glBlendFuncSeparateOES, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-void API_ENTRY(glBlendEquationOES)(GLenum mode) {
- CALL_GL_API(glBlendEquationOES, mode);
-}
-void API_ENTRY(glDrawTexsOES)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) {
- CALL_GL_API(glDrawTexsOES, x, y, z, width, height);
-}
-void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint width, GLint height) {
- CALL_GL_API(glDrawTexiOES, x, y, z, width, height);
-}
-void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) {
- CALL_GL_API(glDrawTexxOES, x, y, z, width, height);
-}
-void API_ENTRY(glDrawTexsvOES)(const GLshort *coords) {
- CALL_GL_API(glDrawTexsvOES, coords);
-}
-void API_ENTRY(glDrawTexivOES)(const GLint *coords) {
- CALL_GL_API(glDrawTexivOES, coords);
-}
-void API_ENTRY(glDrawTexxvOES)(const GLfixed *coords) {
- CALL_GL_API(glDrawTexxvOES, coords);
-}
-void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) {
- CALL_GL_API(glDrawTexfOES, x, y, z, width, height);
-}
-void API_ENTRY(glDrawTexfvOES)(const GLfloat *coords) {
- CALL_GL_API(glDrawTexfvOES, coords);
-}
-void API_ENTRY(glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) {
- CALL_GL_API(glEGLImageTargetTexture2DOES, target, image);
-}
-void API_ENTRY(glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) {
- CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image);
-}
-void API_ENTRY(glAlphaFuncxOES)(GLenum func, GLclampx ref) {
- CALL_GL_API(glAlphaFuncxOES, func, ref);
-}
-void API_ENTRY(glClearColorxOES)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
- CALL_GL_API(glClearColorxOES, red, green, blue, alpha);
-}
-void API_ENTRY(glClearDepthxOES)(GLclampx depth) {
- CALL_GL_API(glClearDepthxOES, depth);
-}
-void API_ENTRY(glClipPlanexOES)(GLenum plane, const GLfixed *equation) {
- CALL_GL_API(glClipPlanexOES, plane, equation);
-}
-void API_ENTRY(glColor4xOES)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
- CALL_GL_API(glColor4xOES, red, green, blue, alpha);
-}
-void API_ENTRY(glDepthRangexOES)(GLclampx zNear, GLclampx zFar) {
- CALL_GL_API(glDepthRangexOES, zNear, zFar);
-}
-void API_ENTRY(glFogxOES)(GLenum pname, GLfixed param) {
- CALL_GL_API(glFogxOES, pname, param);
-}
-void API_ENTRY(glFogxvOES)(GLenum pname, const GLfixed *params) {
- CALL_GL_API(glFogxvOES, pname, params);
-}
-void API_ENTRY(glFrustumxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- CALL_GL_API(glFrustumxOES, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glGetClipPlanexOES)(GLenum pname, GLfixed eqn[4]) {
- CALL_GL_API(glGetClipPlanexOES, pname, eqn);
-}
-void API_ENTRY(glGetFixedvOES)(GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetFixedvOES, pname, params);
-}
-void API_ENTRY(glGetLightxvOES)(GLenum light, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetLightxvOES, light, pname, params);
-}
-void API_ENTRY(glGetMaterialxvOES)(GLenum face, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetMaterialxvOES, face, pname, params);
-}
-void API_ENTRY(glGetTexEnvxvOES)(GLenum env, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetTexEnvxvOES, env, pname, params);
-}
-void API_ENTRY(glGetTexParameterxvOES)(GLenum target, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetTexParameterxvOES, target, pname, params);
-}
-void API_ENTRY(glLightModelxOES)(GLenum pname, GLfixed param) {
- CALL_GL_API(glLightModelxOES, pname, param);
-}
-void API_ENTRY(glLightModelxvOES)(GLenum pname, const GLfixed *params) {
- CALL_GL_API(glLightModelxvOES, pname, params);
-}
-void API_ENTRY(glLightxOES)(GLenum light, GLenum pname, GLfixed param) {
- CALL_GL_API(glLightxOES, light, pname, param);
-}
-void API_ENTRY(glLightxvOES)(GLenum light, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glLightxvOES, light, pname, params);
-}
-void API_ENTRY(glLineWidthxOES)(GLfixed width) {
- CALL_GL_API(glLineWidthxOES, width);
-}
-void API_ENTRY(glLoadMatrixxOES)(const GLfixed *m) {
- CALL_GL_API(glLoadMatrixxOES, m);
-}
-void API_ENTRY(glMaterialxOES)(GLenum face, GLenum pname, GLfixed param) {
- CALL_GL_API(glMaterialxOES, face, pname, param);
-}
-void API_ENTRY(glMaterialxvOES)(GLenum face, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glMaterialxvOES, face, pname, params);
-}
-void API_ENTRY(glMultMatrixxOES)(const GLfixed *m) {
- CALL_GL_API(glMultMatrixxOES, m);
-}
-void API_ENTRY(glMultiTexCoord4xOES)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
- CALL_GL_API(glMultiTexCoord4xOES, target, s, t, r, q);
-}
-void API_ENTRY(glNormal3xOES)(GLfixed nx, GLfixed ny, GLfixed nz) {
- CALL_GL_API(glNormal3xOES, nx, ny, nz);
-}
-void API_ENTRY(glOrthoxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- CALL_GL_API(glOrthoxOES, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glPointParameterxOES)(GLenum pname, GLfixed param) {
- CALL_GL_API(glPointParameterxOES, pname, param);
-}
-void API_ENTRY(glPointParameterxvOES)(GLenum pname, const GLfixed *params) {
- CALL_GL_API(glPointParameterxvOES, pname, params);
-}
-void API_ENTRY(glPointSizexOES)(GLfixed size) {
- CALL_GL_API(glPointSizexOES, size);
-}
-void API_ENTRY(glPolygonOffsetxOES)(GLfixed factor, GLfixed units) {
- CALL_GL_API(glPolygonOffsetxOES, factor, units);
-}
-void API_ENTRY(glRotatexOES)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
- CALL_GL_API(glRotatexOES, angle, x, y, z);
-}
-void API_ENTRY(glSampleCoveragexOES)(GLclampx value, GLboolean invert) {
- CALL_GL_API(glSampleCoveragexOES, value, invert);
-}
-void API_ENTRY(glScalexOES)(GLfixed x, GLfixed y, GLfixed z) {
- CALL_GL_API(glScalexOES, x, y, z);
-}
-void API_ENTRY(glTexEnvxOES)(GLenum target, GLenum pname, GLfixed param) {
- CALL_GL_API(glTexEnvxOES, target, pname, param);
-}
-void API_ENTRY(glTexEnvxvOES)(GLenum target, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glTexEnvxvOES, target, pname, params);
-}
-void API_ENTRY(glTexParameterxOES)(GLenum target, GLenum pname, GLfixed param) {
- CALL_GL_API(glTexParameterxOES, target, pname, param);
-}
-void API_ENTRY(glTexParameterxvOES)(GLenum target, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glTexParameterxvOES, target, pname, params);
-}
-void API_ENTRY(glTranslatexOES)(GLfixed x, GLfixed y, GLfixed z) {
- CALL_GL_API(glTranslatexOES, x, y, z);
-}
-GLboolean API_ENTRY(glIsRenderbufferOES)(GLuint renderbuffer) {
- CALL_GL_API_RETURN(glIsRenderbufferOES, renderbuffer);
-}
-void API_ENTRY(glBindRenderbufferOES)(GLenum target, GLuint renderbuffer) {
- CALL_GL_API(glBindRenderbufferOES, target, renderbuffer);
-}
-void API_ENTRY(glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers) {
- CALL_GL_API(glDeleteRenderbuffersOES, n, renderbuffers);
-}
-void API_ENTRY(glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers) {
- CALL_GL_API(glGenRenderbuffersOES, n, renderbuffers);
-}
-void API_ENTRY(glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageOES, target, internalformat, width, height);
-}
-void API_ENTRY(glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params) {
- CALL_GL_API(glGetRenderbufferParameterivOES, target, pname, params);
-}
-GLboolean API_ENTRY(glIsFramebufferOES)(GLuint framebuffer) {
- CALL_GL_API_RETURN(glIsFramebufferOES, framebuffer);
-}
-void API_ENTRY(glBindFramebufferOES)(GLenum target, GLuint framebuffer) {
- CALL_GL_API(glBindFramebufferOES, target, framebuffer);
-}
-void API_ENTRY(glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers) {
- CALL_GL_API(glDeleteFramebuffersOES, n, framebuffers);
-}
-void API_ENTRY(glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers) {
- CALL_GL_API(glGenFramebuffersOES, n, framebuffers);
-}
-GLenum API_ENTRY(glCheckFramebufferStatusOES)(GLenum target) {
- CALL_GL_API_RETURN(glCheckFramebufferStatusOES, target);
-}
-void API_ENTRY(glFramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
- CALL_GL_API(glFramebufferRenderbufferOES, target, attachment, renderbuffertarget, renderbuffer);
-}
-void API_ENTRY(glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
- CALL_GL_API(glFramebufferTexture2DOES, target, attachment, textarget, texture, level);
-}
-void API_ENTRY(glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
- CALL_GL_API(glGetFramebufferAttachmentParameterivOES, target, attachment, pname, params);
-}
-void API_ENTRY(glGenerateMipmapOES)(GLenum target) {
- CALL_GL_API(glGenerateMipmapOES, target);
-}
-void* API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) {
- CALL_GL_API_RETURN(glMapBufferOES, target, access);
-}
-GLboolean API_ENTRY(glUnmapBufferOES)(GLenum target) {
- CALL_GL_API_RETURN(glUnmapBufferOES, target);
-}
-void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, GLvoid ** params) {
- CALL_GL_API(glGetBufferPointervOES, target, pname, params);
-}
-void API_ENTRY(glCurrentPaletteMatrixOES)(GLuint matrixpaletteindex) {
- CALL_GL_API(glCurrentPaletteMatrixOES, matrixpaletteindex);
-}
-void API_ENTRY(glLoadPaletteFromModelViewMatrixOES)(void) {
- CALL_GL_API(glLoadPaletteFromModelViewMatrixOES);
-}
-void API_ENTRY(glMatrixIndexPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glMatrixIndexPointerOES, size, type, stride, pointer);
-}
-void API_ENTRY(glWeightPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- CALL_GL_API(glWeightPointerOES, size, type, stride, pointer);
-}
-GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed mantissa[16], GLint exponent[16]) {
- CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
-}
-void API_ENTRY(glDepthRangefOES)(GLclampf zNear, GLclampf zFar) {
- CALL_GL_API(glDepthRangefOES, zNear, zFar);
-}
-void API_ENTRY(glFrustumfOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- CALL_GL_API(glFrustumfOES, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glOrthofOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- CALL_GL_API(glOrthofOES, left, right, bottom, top, zNear, zFar);
-}
-void API_ENTRY(glClipPlanefOES)(GLenum plane, const GLfloat *equation) {
- CALL_GL_API(glClipPlanefOES, plane, equation);
-}
-void API_ENTRY(glGetClipPlanefOES)(GLenum pname, GLfloat eqn[4]) {
- CALL_GL_API(glGetClipPlanefOES, pname, eqn);
-}
-void API_ENTRY(glClearDepthfOES)(GLclampf depth) {
- CALL_GL_API(glClearDepthfOES, depth);
-}
-void API_ENTRY(glTexGenfOES)(GLenum coord, GLenum pname, GLfloat param) {
- CALL_GL_API(glTexGenfOES, coord, pname, param);
-}
-void API_ENTRY(glTexGenfvOES)(GLenum coord, GLenum pname, const GLfloat *params) {
- CALL_GL_API(glTexGenfvOES, coord, pname, params);
-}
-void API_ENTRY(glTexGeniOES)(GLenum coord, GLenum pname, GLint param) {
- CALL_GL_API(glTexGeniOES, coord, pname, param);
-}
-void API_ENTRY(glTexGenivOES)(GLenum coord, GLenum pname, const GLint *params) {
- CALL_GL_API(glTexGenivOES, coord, pname, params);
-}
-void API_ENTRY(glTexGenxOES)(GLenum coord, GLenum pname, GLfixed param) {
- CALL_GL_API(glTexGenxOES, coord, pname, param);
-}
-void API_ENTRY(glTexGenxvOES)(GLenum coord, GLenum pname, const GLfixed *params) {
- CALL_GL_API(glTexGenxvOES, coord, pname, params);
-}
-void API_ENTRY(glGetTexGenfvOES)(GLenum coord, GLenum pname, GLfloat *params) {
- CALL_GL_API(glGetTexGenfvOES, coord, pname, params);
-}
-void API_ENTRY(glGetTexGenivOES)(GLenum coord, GLenum pname, GLint *params) {
- CALL_GL_API(glGetTexGenivOES, coord, pname, params);
-}
-void API_ENTRY(glGetTexGenxvOES)(GLenum coord, GLenum pname, GLfixed *params) {
- CALL_GL_API(glGetTexGenxvOES, coord, pname, params);
-}
-void API_ENTRY(glBindVertexArrayOES)(GLuint array) {
- CALL_GL_API(glBindVertexArrayOES, array);
-}
-void API_ENTRY(glDeleteVertexArraysOES)(GLsizei n, const GLuint *arrays) {
- CALL_GL_API(glDeleteVertexArraysOES, n, arrays);
-}
-void API_ENTRY(glGenVertexArraysOES)(GLsizei n, GLuint *arrays) {
- CALL_GL_API(glGenVertexArraysOES, n, arrays);
-}
-GLboolean API_ENTRY(glIsVertexArrayOES)(GLuint array) {
- CALL_GL_API_RETURN(glIsVertexArrayOES, array);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleAPPLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleAPPLE, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glResolveMultisampleFramebufferAPPLE)(void) {
- CALL_GL_API(glResolveMultisampleFramebufferAPPLE);
-}
-void API_ENTRY(glDiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum *attachments) {
- CALL_GL_API(glDiscardFramebufferEXT, target, numAttachments, attachments);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleEXT, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glFramebufferTexture2DMultisampleEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) {
- CALL_GL_API(glFramebufferTexture2DMultisampleEXT, target, attachment, textarget, texture, level, samples);
-}
-void API_ENTRY(glMultiDrawArraysEXT)(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) {
- CALL_GL_API(glMultiDrawArraysEXT, mode, first, count, primcount);
-}
-void API_ENTRY(glMultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) {
- CALL_GL_API(glMultiDrawElementsEXT, mode, count, type, indices, primcount);
-}
-GLenum API_ENTRY(glGetGraphicsResetStatusEXT)(void) {
- CALL_GL_API_RETURN(glGetGraphicsResetStatusEXT);
-}
-void API_ENTRY(glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) {
- CALL_GL_API(glReadnPixelsEXT, x, y, width, height, format, type, bufSize, data);
-}
-void API_ENTRY(glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, float *params) {
- CALL_GL_API(glGetnUniformfvEXT, program, location, bufSize, params);
-}
-void API_ENTRY(glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint *params) {
- CALL_GL_API(glGetnUniformivEXT, program, location, bufSize, params);
-}
-void API_ENTRY(glTexStorage1DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
- CALL_GL_API(glTexStorage1DEXT, target, levels, internalformat, width);
-}
-void API_ENTRY(glTexStorage2DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glTexStorage2DEXT, target, levels, internalformat, width, height);
-}
-void API_ENTRY(glTexStorage3DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) {
- CALL_GL_API(glTexStorage3DEXT, target, levels, internalformat, width, height, depth);
-}
-void API_ENTRY(glTextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
- CALL_GL_API(glTextureStorage1DEXT, texture, target, levels, internalformat, width);
-}
-void API_ENTRY(glTextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glTextureStorage2DEXT, texture, target, levels, internalformat, width, height);
-}
-void API_ENTRY(glTextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) {
- CALL_GL_API(glTextureStorage3DEXT, texture, target, levels, internalformat, width, height, depth);
-}
-void API_ENTRY(glClipPlanefIMG)(GLenum p, const GLfloat *eqn) {
- CALL_GL_API(glClipPlanefIMG, p, eqn);
-}
-void API_ENTRY(glClipPlanexIMG)(GLenum p, const GLfixed *eqn) {
- CALL_GL_API(glClipPlanexIMG, p, eqn);
-}
-void API_ENTRY(glRenderbufferStorageMultisampleIMG)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- CALL_GL_API(glRenderbufferStorageMultisampleIMG, target, samples, internalformat, width, height);
-}
-void API_ENTRY(glFramebufferTexture2DMultisampleIMG)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) {
- CALL_GL_API(glFramebufferTexture2DMultisampleIMG, target, attachment, textarget, texture, level, samples);
-}
-void API_ENTRY(glDeleteFencesNV)(GLsizei n, const GLuint *fences) {
- CALL_GL_API(glDeleteFencesNV, n, fences);
-}
-void API_ENTRY(glGenFencesNV)(GLsizei n, GLuint *fences) {
- CALL_GL_API(glGenFencesNV, n, fences);
-}
-GLboolean API_ENTRY(glIsFenceNV)(GLuint fence) {
- CALL_GL_API_RETURN(glIsFenceNV, fence);
-}
-GLboolean API_ENTRY(glTestFenceNV)(GLuint fence) {
- CALL_GL_API_RETURN(glTestFenceNV, fence);
-}
-void API_ENTRY(glGetFenceivNV)(GLuint fence, GLenum pname, GLint *params) {
- CALL_GL_API(glGetFenceivNV, fence, pname, params);
-}
-void API_ENTRY(glFinishFenceNV)(GLuint fence) {
- CALL_GL_API(glFinishFenceNV, fence);
-}
-void API_ENTRY(glSetFenceNV)(GLuint fence, GLenum condition) {
- CALL_GL_API(glSetFenceNV, fence, condition);
-}
-void API_ENTRY(glGetDriverControlsQCOM)(GLint *num, GLsizei size, GLuint *driverControls) {
- CALL_GL_API(glGetDriverControlsQCOM, num, size, driverControls);
-}
-void API_ENTRY(glGetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) {
- CALL_GL_API(glGetDriverControlStringQCOM, driverControl, bufSize, length, driverControlString);
-}
-void API_ENTRY(glEnableDriverControlQCOM)(GLuint driverControl) {
- CALL_GL_API(glEnableDriverControlQCOM, driverControl);
-}
-void API_ENTRY(glDisableDriverControlQCOM)(GLuint driverControl) {
- CALL_GL_API(glDisableDriverControlQCOM, driverControl);
-}
-void API_ENTRY(glExtGetTexturesQCOM)(GLuint *textures, GLint maxTextures, GLint *numTextures) {
- CALL_GL_API(glExtGetTexturesQCOM, textures, maxTextures, numTextures);
-}
-void API_ENTRY(glExtGetBuffersQCOM)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) {
- CALL_GL_API(glExtGetBuffersQCOM, buffers, maxBuffers, numBuffers);
-}
-void API_ENTRY(glExtGetRenderbuffersQCOM)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) {
- CALL_GL_API(glExtGetRenderbuffersQCOM, renderbuffers, maxRenderbuffers, numRenderbuffers);
-}
-void API_ENTRY(glExtGetFramebuffersQCOM)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) {
- CALL_GL_API(glExtGetFramebuffersQCOM, framebuffers, maxFramebuffers, numFramebuffers);
-}
-void API_ENTRY(glExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) {
- CALL_GL_API(glExtGetTexLevelParameterivQCOM, texture, face, level, pname, params);
-}
-void API_ENTRY(glExtTexObjectStateOverrideiQCOM)(GLenum target, GLenum pname, GLint param) {
- CALL_GL_API(glExtTexObjectStateOverrideiQCOM, target, pname, param);
-}
-void API_ENTRY(glExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) {
- CALL_GL_API(glExtGetTexSubImageQCOM, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels);
-}
-void API_ENTRY(glExtGetBufferPointervQCOM)(GLenum target, GLvoid **params) {
- CALL_GL_API(glExtGetBufferPointervQCOM, target, params);
-}
-void API_ENTRY(glExtGetShadersQCOM)(GLuint *shaders, GLint maxShaders, GLint *numShaders) {
- CALL_GL_API(glExtGetShadersQCOM, shaders, maxShaders, numShaders);
-}
-void API_ENTRY(glExtGetProgramsQCOM)(GLuint *programs, GLint maxPrograms, GLint *numPrograms) {
- CALL_GL_API(glExtGetProgramsQCOM, programs, maxPrograms, numPrograms);
-}
-GLboolean API_ENTRY(glExtIsProgramBinaryQCOM)(GLuint program) {
- CALL_GL_API_RETURN(glExtIsProgramBinaryQCOM, program);
-}
-void API_ENTRY(glExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar *source, GLint *length) {
- CALL_GL_API(glExtGetProgramBinarySourceQCOM, program, shadertype, source, length);
-}
-void API_ENTRY(glStartTilingQCOM)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) {
- CALL_GL_API(glStartTilingQCOM, x, y, width, height, preserveMask);
-}
-void API_ENTRY(glEndTilingQCOM)(GLbitfield preserveMask) {
- CALL_GL_API(glEndTilingQCOM, preserveMask);
-}
diff --git a/opengl/libs/GLES_trace/.gitignore b/opengl/libs/GLES_trace/.gitignore
deleted file mode 100644
index 8df825e..0000000
--- a/opengl/libs/GLES_trace/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-java
-*.pyc
-*.swp
-pyratemp.py
diff --git a/opengl/libs/GLES_trace/Android.mk b/opengl/libs/GLES_trace/Android.mk
deleted file mode 100644
index 465b6b2..0000000
--- a/opengl/libs/GLES_trace/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- src/gltrace_api.cpp \
- src/gltrace_context.cpp \
- src/gltrace_egl.cpp \
- src/gltrace_eglapi.cpp \
- src/gltrace_fixup.cpp \
- src/gltrace_hooks.cpp \
- src/gltrace.pb.cpp \
- src/gltrace_transport.cpp
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH) \
- $(LOCAL_PATH)/../ \
- external/stlport/stlport \
- external/protobuf/src \
- external \
- bionic
-
-LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI
-LOCAL_STATIC_LIBRARIES := libprotobuf-cpp-2.3.0-lite liblzf
-LOCAL_SHARED_LIBRARIES := libcutils libutils libstlport
-
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
-LOCAL_CFLAGS += -DLOG_TAG=\"libGLES_trace\"
-
-# we need to access the private Bionic header <bionic_tls.h>
-# on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER
-# behavior from the bionic Android.mk file
-ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-LOCAL_C_INCLUDES += bionic/libc/private
-
-LOCAL_MODULE:= libGLES_trace
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/libs/GLES_trace/DESIGN.txt b/opengl/libs/GLES_trace/DESIGN.txt
deleted file mode 100644
index a189e1d..0000000
--- a/opengl/libs/GLES_trace/DESIGN.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-Design of the GLES Tracing Library
-
-Code Runtime Behavior:
-
- Initialization:
-
- egl_display_t::initialize() calls initEglTraceLevel() to figure out whether tracing should be
- enabled. Currently, the shell properties "debug.egl.trace" and "debug.egl.debug_proc" together
- control whether tracing should be enabled for a certain process. If tracing is enabled, this
- calls GLTrace_start() to start the trace server.
-
- Note that initEglTraceLevel() is also called from early_egl_init(), but that happens in the
- context of the zygote, so that invocation has no effect.
-
- egl_display_t::initialize() then calls setGLHooksThreadSpecific() where we set the thread
- specific gl_hooks structure to point to the trace implementation. From this point on, every
- GLES call is redirected to the trace implementation.
-
- Application runtime:
-
- While the application is running, all its GLES calls are directly routed to their corresponding
- trace implementation.
-
- For EGL calls, the trace library provides a bunch of functions that must be explicitly called
- from the EGL library. These functions are declared in glestrace.h
-
- Application shutdown:
-
- Currently, the application is killed when the user stops tracing from the frontend GUI. We need
- to explore if a more graceful method of stopping the application, or detaching tracing from the
- application is required.
-
-Code Structure:
-
- glestrace.h declares all the hooks exposed by libglestrace. These are used by EGL/egl.cpp and
- EGL/eglApi.cpp to initialize the trace library, and to inform the library of EGL calls.
-
- All GL calls are present in GLES_Trace/src/gltrace_api.cpp. This file is generated by the
- GLES_Trace/src/genapi.py script. The structure of all the functions looks like this:
-
- void GLTrace_glFunction(args) {
- // declare a protobuf
- // copy arguments into the protobuf
- // call the original GLES function
- // if there is a return value, save it into the protobuf
- // fixup the protobuf if necessary
- // transport the protobuf to the host
- }
-
- The fixupGLMessage() call does any custom processing of the protobuf based on the GLES call.
- This typically amounts to copying the data corresponding to input or output pointers.
diff --git a/opengl/libs/GLES_trace/dev.make b/opengl/libs/GLES_trace/dev.make
deleted file mode 100644
index a46260c..0000000
--- a/opengl/libs/GLES_trace/dev.make
+++ /dev/null
@@ -1,14 +0,0 @@
-## NOTE
-## This file is used for development purposes only. It is not used by the build system.
-
-# generate protocol buffer files
-genproto: gltrace.proto
- aprotoc --cpp_out=src --java_out=java gltrace.proto
- mv src/gltrace.pb.cc src/gltrace.pb.cpp
-
-sync:
- adb root
- adb remount
- adb shell stop
- adb sync
- adb shell start
diff --git a/opengl/libs/GLES_trace/gltrace.proto b/opengl/libs/GLES_trace/gltrace.proto
deleted file mode 100644
index bbf3554..0000000
--- a/opengl/libs/GLES_trace/gltrace.proto
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-package android.gltrace;
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.android.ide.eclipse.gltrace";
-option java_outer_classname = "GLProtoBuf";
-
-message GLMessage {
- enum Function {
- glActiveTexture = 0;
- glAlphaFunc = 1;
- glAlphaFuncx = 2;
- glAlphaFuncxOES = 3;
- glAttachShader = 4;
- glBeginPerfMonitorAMD = 5;
- glBindAttribLocation = 6;
- glBindBuffer = 7;
- glBindFramebuffer = 8;
- glBindFramebufferOES = 9;
- glBindRenderbuffer = 10;
- glBindRenderbufferOES = 11;
- glBindTexture = 12;
- glBindVertexArrayOES = 13;
- glBlendColor = 14;
- glBlendEquation = 15;
- glBlendEquationOES = 16;
- glBlendEquationSeparate = 17;
- glBlendEquationSeparateOES = 18;
- glBlendFunc = 19;
- glBlendFuncSeparate = 20;
- glBlendFuncSeparateOES = 21;
- glBufferData = 22;
- glBufferSubData = 23;
- glCheckFramebufferStatus = 24;
- glCheckFramebufferStatusOES = 25;
- glClearColor = 26;
- glClearColorx = 27;
- glClearColorxOES = 28;
- glClearDepthf = 29;
- glClearDepthfOES = 30;
- glClearDepthx = 31;
- glClearDepthxOES = 32;
- glClear = 33;
- glClearStencil = 34;
- glClientActiveTexture = 35;
- glClipPlanef = 36;
- glClipPlanefIMG = 37;
- glClipPlanefOES = 38;
- glClipPlanex = 39;
- glClipPlanexIMG = 40;
- glClipPlanexOES = 41;
- glColor4f = 42;
- glColor4ub = 43;
- glColor4x = 44;
- glColor4xOES = 45;
- glColorMask = 46;
- glColorPointer = 47;
- glCompileShader = 48;
- glCompressedTexImage2D = 49;
- glCompressedTexImage3DOES = 50;
- glCompressedTexSubImage2D = 51;
- glCompressedTexSubImage3DOES = 52;
- glCopyTexImage2D = 53;
- glCopyTexSubImage2D = 54;
- glCopyTexSubImage3DOES = 55;
- glCoverageMaskNV = 56;
- glCoverageOperationNV = 57;
- glCreateProgram = 58;
- glCreateShader = 59;
- glCullFace = 60;
- glCurrentPaletteMatrixOES = 61;
- glDeleteBuffers = 62;
- glDeleteFencesNV = 63;
- glDeleteFramebuffers = 64;
- glDeleteFramebuffersOES = 65;
- glDeletePerfMonitorsAMD = 66;
- glDeleteProgram = 67;
- glDeleteRenderbuffers = 68;
- glDeleteRenderbuffersOES = 69;
- glDeleteShader = 70;
- glDeleteTextures = 71;
- glDeleteVertexArraysOES = 72;
- glDepthFunc = 73;
- glDepthMask = 74;
- glDepthRangef = 75;
- glDepthRangefOES = 76;
- glDepthRangex = 77;
- glDepthRangexOES = 78;
- glDetachShader = 79;
- glDisableClientState = 80;
- glDisableDriverControlQCOM = 81;
- glDisable = 82;
- glDisableVertexAttribArray = 83;
- glDiscardFramebufferEXT = 84;
- glDrawArrays = 85;
- glDrawElements = 86;
- glDrawTexfOES = 87;
- glDrawTexfvOES = 88;
- glDrawTexiOES = 89;
- glDrawTexivOES = 90;
- glDrawTexsOES = 91;
- glDrawTexsvOES = 92;
- glDrawTexxOES = 93;
- glDrawTexxvOES = 94;
- glEGLImageTargetRenderbufferStorageOES = 95;
- glEGLImageTargetTexture2DOES = 96;
- glEnableClientState = 97;
- glEnableDriverControlQCOM = 98;
- glEnable = 99;
- glEnableVertexAttribArray = 100;
- glEndPerfMonitorAMD = 101;
- glEndTilingQCOM = 102;
- glExtGetBufferPointervQCOM = 103;
- glExtGetBuffersQCOM = 104;
- glExtGetFramebuffersQCOM = 105;
- glExtGetProgramBinarySourceQCOM = 106;
- glExtGetProgramsQCOM = 107;
- glExtGetRenderbuffersQCOM = 108;
- glExtGetShadersQCOM = 109;
- glExtGetTexLevelParameterivQCOM = 110;
- glExtGetTexSubImageQCOM = 111;
- glExtGetTexturesQCOM = 112;
- glExtIsProgramBinaryQCOM = 113;
- glExtTexObjectStateOverrideiQCOM = 114;
- glFinishFenceNV = 115;
- glFinish = 116;
- glFlush = 117;
- glFogf = 118;
- glFogfv = 119;
- glFogx = 120;
- glFogxOES = 121;
- glFogxv = 122;
- glFogxvOES = 123;
- glFramebufferRenderbuffer = 124;
- glFramebufferRenderbufferOES = 125;
- glFramebufferTexture2D = 126;
- glFramebufferTexture2DMultisampleIMG = 127;
- glFramebufferTexture2DOES = 128;
- glFramebufferTexture3DOES = 129;
- glFrontFace = 130;
- glFrustumf = 131;
- glFrustumfOES = 132;
- glFrustumx = 133;
- glFrustumxOES = 134;
- glGenBuffers = 135;
- glGenerateMipmap = 136;
- glGenerateMipmapOES = 137;
- glGenFencesNV = 138;
- glGenFramebuffers = 139;
- glGenFramebuffersOES = 140;
- glGenPerfMonitorsAMD = 141;
- glGenRenderbuffers = 142;
- glGenRenderbuffersOES = 143;
- glGenTextures = 144;
- glGenVertexArraysOES = 145;
- glGetActiveAttrib = 146;
- glGetActiveUniform = 147;
- glGetAttachedShaders = 148;
- glGetAttribLocation = 149;
- glGetBooleanv = 150;
- glGetBufferParameteriv = 151;
- glGetBufferPointervOES = 152;
- glGetClipPlanef = 153;
- glGetClipPlanefOES = 154;
- glGetClipPlanex = 155;
- glGetClipPlanexOES = 156;
- glGetDriverControlsQCOM = 157;
- glGetDriverControlStringQCOM = 158;
- glGetError = 159;
- glGetFenceivNV = 160;
- glGetFixedv = 161;
- glGetFixedvOES = 162;
- glGetFloatv = 163;
- glGetFramebufferAttachmentParameteriv = 164;
- glGetFramebufferAttachmentParameterivOES = 165;
- glGetIntegerv = 166;
- glGetLightfv = 167;
- glGetLightxv = 168;
- glGetLightxvOES = 169;
- glGetMaterialfv = 170;
- glGetMaterialxv = 171;
- glGetMaterialxvOES = 172;
- glGetPerfMonitorCounterDataAMD = 173;
- glGetPerfMonitorCounterInfoAMD = 174;
- glGetPerfMonitorCountersAMD = 175;
- glGetPerfMonitorCounterStringAMD = 176;
- glGetPerfMonitorGroupsAMD = 177;
- glGetPerfMonitorGroupStringAMD = 178;
- glGetPointerv = 179;
- glGetProgramBinaryOES = 180;
- glGetProgramInfoLog = 181;
- glGetProgramiv = 182;
- glGetRenderbufferParameteriv = 183;
- glGetRenderbufferParameterivOES = 184;
- glGetShaderInfoLog = 185;
- glGetShaderiv = 186;
- glGetShaderPrecisionFormat = 187;
- glGetShaderSource = 188;
- glGetString = 189;
- glGetTexEnvfv = 190;
- glGetTexEnviv = 191;
- glGetTexEnvxv = 192;
- glGetTexEnvxvOES = 193;
- glGetTexGenfvOES = 194;
- glGetTexGenivOES = 195;
- glGetTexGenxvOES = 196;
- glGetTexParameterfv = 197;
- glGetTexParameteriv = 198;
- glGetTexParameterxv = 199;
- glGetTexParameterxvOES = 200;
- glGetUniformfv = 201;
- glGetUniformiv = 202;
- glGetUniformLocation = 203;
- glGetVertexAttribfv = 204;
- glGetVertexAttribiv = 205;
- glGetVertexAttribPointerv = 206;
- glHint = 207;
- glIsBuffer = 208;
- glIsEnabled = 209;
- glIsFenceNV = 210;
- glIsFramebuffer = 211;
- glIsFramebufferOES = 212;
- glIsProgram = 213;
- glIsRenderbuffer = 214;
- glIsRenderbufferOES = 215;
- glIsShader = 216;
- glIsTexture = 217;
- glIsVertexArrayOES = 218;
- glLightf = 219;
- glLightfv = 220;
- glLightModelf = 221;
- glLightModelfv = 222;
- glLightModelx = 223;
- glLightModelxOES = 224;
- glLightModelxv = 225;
- glLightModelxvOES = 226;
- glLightx = 227;
- glLightxOES = 228;
- glLightxv = 229;
- glLightxvOES = 230;
- glLineWidth = 231;
- glLineWidthx = 232;
- glLineWidthxOES = 233;
- glLinkProgram = 234;
- glLoadIdentity = 235;
- glLoadMatrixf = 236;
- glLoadMatrixx = 237;
- glLoadMatrixxOES = 238;
- glLoadPaletteFromModelViewMatrixOES = 239;
- glLogicOp = 240;
- glMapBufferOES = 241;
- glMaterialf = 242;
- glMaterialfv = 243;
- glMaterialx = 244;
- glMaterialxOES = 245;
- glMaterialxv = 246;
- glMaterialxvOES = 247;
- glMatrixIndexPointerOES = 248;
- glMatrixMode = 249;
- glMultiDrawArraysEXT = 250;
- glMultiDrawElementsEXT = 251;
- glMultiTexCoord4f = 252;
- glMultiTexCoord4x = 253;
- glMultiTexCoord4xOES = 254;
- glMultMatrixf = 255;
- glMultMatrixx = 256;
- glMultMatrixxOES = 257;
- glNormal3f = 258;
- glNormal3x = 259;
- glNormal3xOES = 260;
- glNormalPointer = 261;
- glOrthof = 262;
- glOrthofOES = 263;
- glOrthox = 264;
- glOrthoxOES = 265;
- glPixelStorei = 266;
- glPointParameterf = 267;
- glPointParameterfv = 268;
- glPointParameterx = 269;
- glPointParameterxOES = 270;
- glPointParameterxv = 271;
- glPointParameterxvOES = 272;
- glPointSize = 273;
- glPointSizePointerOES = 274;
- glPointSizex = 275;
- glPointSizexOES = 276;
- glPolygonOffset = 277;
- glPolygonOffsetx = 278;
- glPolygonOffsetxOES = 279;
- glPopMatrix = 280;
- glProgramBinaryOES = 281;
- glPushMatrix = 282;
- glQueryMatrixxOES = 283;
- glReadPixels = 284;
- glReleaseShaderCompiler = 285;
- glRenderbufferStorage = 286;
- glRenderbufferStorageMultisampleIMG = 287;
- glRenderbufferStorageOES = 288;
- glRotatef = 289;
- glRotatex = 290;
- glRotatexOES = 291;
- glSampleCoverage = 292;
- glSampleCoveragex = 293;
- glSampleCoveragexOES = 294;
- glScalef = 295;
- glScalex = 296;
- glScalexOES = 297;
- glScissor = 298;
- glSelectPerfMonitorCountersAMD = 299;
- glSetFenceNV = 300;
- glShadeModel = 301;
- glShaderBinary = 302;
- glShaderSource = 303;
- glStartTilingQCOM = 304;
- glStencilFunc = 305;
- glStencilFuncSeparate = 306;
- glStencilMask = 307;
- glStencilMaskSeparate = 308;
- glStencilOp = 309;
- glStencilOpSeparate = 310;
- glTestFenceNV = 311;
- glTexCoordPointer = 312;
- glTexEnvf = 313;
- glTexEnvfv = 314;
- glTexEnvi = 315;
- glTexEnviv = 316;
- glTexEnvx = 317;
- glTexEnvxOES = 318;
- glTexEnvxv = 319;
- glTexEnvxvOES = 320;
- glTexGenfOES = 321;
- glTexGenfvOES = 322;
- glTexGeniOES = 323;
- glTexGenivOES = 324;
- glTexGenxOES = 325;
- glTexGenxvOES = 326;
- glTexImage2D = 327;
- glTexImage3DOES = 328;
- glTexParameterf = 329;
- glTexParameterfv = 330;
- glTexParameteri = 331;
- glTexParameteriv = 332;
- glTexParameterx = 333;
- glTexParameterxOES = 334;
- glTexParameterxv = 335;
- glTexParameterxvOES = 336;
- glTexSubImage2D = 337;
- glTexSubImage3DOES = 338;
- glTranslatef = 339;
- glTranslatex = 340;
- glTranslatexOES = 341;
- glUniform1f = 342;
- glUniform1fv = 343;
- glUniform1i = 344;
- glUniform1iv = 345;
- glUniform2f = 346;
- glUniform2fv = 347;
- glUniform2i = 348;
- glUniform2iv = 349;
- glUniform3f = 350;
- glUniform3fv = 351;
- glUniform3i = 352;
- glUniform3iv = 353;
- glUniform4f = 354;
- glUniform4fv = 355;
- glUniform4i = 356;
- glUniform4iv = 357;
- glUniformMatrix2fv = 358;
- glUniformMatrix3fv = 359;
- glUniformMatrix4fv = 360;
- glUnmapBufferOES = 361;
- glUseProgram = 362;
- glValidateProgram = 363;
- glVertexAttrib1f = 364;
- glVertexAttrib1fv = 365;
- glVertexAttrib2f = 366;
- glVertexAttrib2fv = 367;
- glVertexAttrib3f = 368;
- glVertexAttrib3fv = 369;
- glVertexAttrib4f = 370;
- glVertexAttrib4fv = 371;
- glVertexAttribPointer = 372;
- glVertexPointer = 373;
- glViewport = 374;
- glWeightPointerOES = 375;
-
- glActiveShaderProgramEXT = 502;
- glAlphaFuncQCOM = 503;
- glBeginQueryEXT = 504;
- glBindProgramPipelineEXT = 505;
- glBlitFramebufferANGLE = 506;
- glCreateShaderProgramvEXT = 507;
- glDeleteProgramPipelinesEXT = 508;
- glDeleteQueriesEXT = 509;
- glDrawBuffersNV = 510;
- glEndQueryEXT = 511;
- glFramebufferTexture2DMultisampleEXT = 512;
- glGenProgramPipelinesEXT = 513;
- glGenQueriesEXT = 514;
- glGetGraphicsResetStatusEXT = 515;
- glGetObjectLabelEXT = 516;
- glGetProgramPipelineInfoLogEXT = 517;
- glGetProgramPipelineivEXT = 518;
- glGetQueryObjectuivEXT = 519;
- glGetQueryivEXT = 520;
- glGetnUniformfvEXT = 521;
- glGetnUniformivEXT = 521;
- glInsertEventMarkerEXT = 522;
- glIsProgramPipelineEXT = 523;
- glIsQueryEXT = 524;
- glLabelObjectEXT = 525;
- glPopGroupMarkerEXT = 526;
- glProgramParameteriEXT = 527;
- glProgramUniform1fEXT = 528;
- glProgramUniform1fvEXT = 529;
- glProgramUniform1iEXT = 530;
- glProgramUniform1ivEXT = 531;
- glProgramUniform2fEXT = 532;
- glProgramUniform2fvEXT = 533;
- glProgramUniform2iEXT = 534;
- glProgramUniform2ivEXT = 535;
- glProgramUniform3fEXT = 536;
- glProgramUniform3fvEXT = 537;
- glProgramUniform3iEXT = 538;
- glProgramUniform3ivEXT = 539;
- glProgramUniform4fEXT = 540;
- glProgramUniform4fvEXT = 541;
- glProgramUniform4iEXT = 542;
- glProgramUniform4ivEXT = 543;
- glProgramUniformMatrix2fvEXT = 544;
- glProgramUniformMatrix3fvEXT = 545;
- glProgramUniformMatrix4fvEXT = 546;
- glPushGroupMarkerEXT = 547;
- glReadBufferNV = 548;
- glReadnPixelsEXT = 549;
- glRenderbufferStorageMultisampleANGLE = 550;
- glRenderbufferStorageMultisampleAPPLE = 551;
- glRenderbufferStorageMultisampleEXT = 552;
- glResolveMultisampleFramebufferAPPLE = 553;
- glTexStorage1DEXT = 554;
- glTexStorage2DEXT = 555;
- glTexStorage3DEXT = 556;
- glTextureStorage1DEXT = 557;
- glTextureStorage2DEXT = 558;
- glTextureStorage3DEXT = 559;
- glUseProgramStagesEXT = 560;
- glValidateProgramPipelineEXT = 561;
-
- eglGetDisplay = 2000;
- eglInitialize = 2001;
- eglTerminate = 2002;
- eglGetConfigs = 2003;
- eglChooseConfig = 2004;
- eglGetConfigAttrib = 2005;
- eglCreateWindowSurface = 2006;
- eglCreatePixmapSurface = 2007;
- eglCreatePbufferSurface = 2008;
- eglDestroySurface = 2009;
- eglQuerySurface = 2010;
- eglCreateContext = 2011;
- eglDestroyContext = 2012;
- eglMakeCurrent = 2013;
- eglGetCurrentContext = 2014;
- eglGetCurrentSurface = 2015;
- eglGetCurrentDisplay = 2016;
- eglQueryContext = 2017;
- eglWaitGL = 2018;
- eglWaitNative = 2019;
- eglSwapBuffers = 2020;
- eglCopyBuffers = 2021;
- eglGetError = 2022;
- eglQueryString = 2023;
- eglGetProcAddress = 2024;
- eglSurfaceAttrib = 2025;
- eglBindTexImage = 2026;
- eglReleaseTexImage = 2027;
- eglSwapInterval = 2028;
- eglBindAPI = 2029;
- eglQueryAPI = 2030;
- eglWaitClient = 2031;
- eglReleaseThread = 2032;
- eglCreatePbufferFromClientBuffer = 2033;
- eglLockSurfaceKHR = 2034;
- eglUnlockSurfaceKHR = 2035;
- eglCreateImageKHR = 2036;
- eglDestroyImageKHR = 2037;
- eglCreateSyncKHR = 2038;
- eglDestroySyncKHR = 2039;
- eglClientWaitSyncKHR = 2040;
- eglGetSyncAttribKHR = 2041;
- eglSetSwapRectangleANDROID = 2042;
- eglGetRenderBufferANDROID = 2043;
- eglGetSystemTimeFrequencyNV = 2044;
- eglGetSystemTimeNV = 2045;
-
- invalid = 3000;
- glVertexAttribPointerData = 3001;
- }
-
- // A GL call's return data and arguments are formatted into this DataType
- message DataType {
- enum Type {
- VOID = 1; // GLvoid
- CHAR = 2; // GLchar
- BYTE = 3; // GLbyte, GLubyte
- INT = 4; // GLbitfield, GLshort, GLint, GLsizei, GLushort, GLuint, GLfixed
- FLOAT = 5; // GLfloat, GLclampf
- BOOL = 6; // GLboolean
- ENUM = 7; // GLenum
- };
-
- required Type type = 1 [default = VOID];
- required bool isArray = 2 [default = false];
-
- repeated int32 intValue = 3;
- repeated float floatValue = 4;
- repeated bytes charValue = 5;
- repeated bytes rawBytes = 6;
- repeated bool boolValue = 7;
- }
-
- message FrameBuffer {
- required int32 width = 1;
- required int32 height = 2;
- repeated bytes contents = 3;
- }
-
- required int32 context_id = 1; // GL context ID
- required int64 start_time = 2; // time when call was invoked
- required int32 duration = 3; // duration of the call (MONOTONIC TIME)
-
- required Function function = 4 [default = invalid]; // GL function called
- repeated DataType args = 5; // GL function's arguments
- optional DataType returnValue = 6; // GL function's return value
-
- optional FrameBuffer fb = 7; // contents of the framebuffer
-
- optional int32 threadtime = 8; // duration of the call (THREAD TIME)
-};
diff --git a/opengl/libs/GLES_trace/src/gltrace.pb.cpp b/opengl/libs/GLES_trace/src/gltrace.pb.cpp
deleted file mode 100644
index d587c49..0000000
--- a/opengl/libs/GLES_trace/src/gltrace.pb.cpp
+++ /dev/null
@@ -1,2081 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-
-#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
-#include "gltrace.pb.h"
-#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
-// @@protoc_insertion_point(includes)
-
-namespace android {
-namespace gltrace {
-
-void protobuf_ShutdownFile_gltrace_2eproto() {
- delete GLMessage::default_instance_;
- delete GLMessage_DataType::default_instance_;
- delete GLMessage_FrameBuffer::default_instance_;
-}
-
-void protobuf_AddDesc_gltrace_2eproto() {
- static bool already_here = false;
- if (already_here) return;
- already_here = true;
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- GLMessage::default_instance_ = new GLMessage();
- GLMessage_DataType::default_instance_ = new GLMessage_DataType();
- GLMessage_FrameBuffer::default_instance_ = new GLMessage_FrameBuffer();
- GLMessage::default_instance_->InitAsDefaultInstance();
- GLMessage_DataType::default_instance_->InitAsDefaultInstance();
- GLMessage_FrameBuffer::default_instance_->InitAsDefaultInstance();
- ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_gltrace_2eproto);
-}
-
-// Force AddDescriptors() to be called at static initialization time.
-struct StaticDescriptorInitializer_gltrace_2eproto {
- StaticDescriptorInitializer_gltrace_2eproto() {
- protobuf_AddDesc_gltrace_2eproto();
- }
-} static_descriptor_initializer_gltrace_2eproto_;
-
-
-// ===================================================================
-
-bool GLMessage_Function_IsValid(int value) {
- switch(value) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- case 29:
- case 30:
- case 31:
- case 32:
- case 33:
- case 34:
- case 35:
- case 36:
- case 37:
- case 38:
- case 39:
- case 40:
- case 41:
- case 42:
- case 43:
- case 44:
- case 45:
- case 46:
- case 47:
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case 68:
- case 69:
- case 70:
- case 71:
- case 72:
- case 73:
- case 74:
- case 75:
- case 76:
- case 77:
- case 78:
- case 79:
- case 80:
- case 81:
- case 82:
- case 83:
- case 84:
- case 85:
- case 86:
- case 87:
- case 88:
- case 89:
- case 90:
- case 91:
- case 92:
- case 93:
- case 94:
- case 95:
- case 96:
- case 97:
- case 98:
- case 99:
- case 100:
- case 101:
- case 102:
- case 103:
- case 104:
- case 105:
- case 106:
- case 107:
- case 108:
- case 109:
- case 110:
- case 111:
- case 112:
- case 113:
- case 114:
- case 115:
- case 116:
- case 117:
- case 118:
- case 119:
- case 120:
- case 121:
- case 122:
- case 123:
- case 124:
- case 125:
- case 126:
- case 127:
- case 128:
- case 129:
- case 130:
- case 131:
- case 132:
- case 133:
- case 134:
- case 135:
- case 136:
- case 137:
- case 138:
- case 139:
- case 140:
- case 141:
- case 142:
- case 143:
- case 144:
- case 145:
- case 146:
- case 147:
- case 148:
- case 149:
- case 150:
- case 151:
- case 152:
- case 153:
- case 154:
- case 155:
- case 156:
- case 157:
- case 158:
- case 159:
- case 160:
- case 161:
- case 162:
- case 163:
- case 164:
- case 165:
- case 166:
- case 167:
- case 168:
- case 169:
- case 170:
- case 171:
- case 172:
- case 173:
- case 174:
- case 175:
- case 176:
- case 177:
- case 178:
- case 179:
- case 180:
- case 181:
- case 182:
- case 183:
- case 184:
- case 185:
- case 186:
- case 187:
- case 188:
- case 189:
- case 190:
- case 191:
- case 192:
- case 193:
- case 194:
- case 195:
- case 196:
- case 197:
- case 198:
- case 199:
- case 200:
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206:
- case 207:
- case 208:
- case 209:
- case 210:
- case 211:
- case 212:
- case 213:
- case 214:
- case 215:
- case 216:
- case 217:
- case 218:
- case 219:
- case 220:
- case 221:
- case 222:
- case 223:
- case 224:
- case 225:
- case 226:
- case 227:
- case 228:
- case 229:
- case 230:
- case 231:
- case 232:
- case 233:
- case 234:
- case 235:
- case 236:
- case 237:
- case 238:
- case 239:
- case 240:
- case 241:
- case 242:
- case 243:
- case 244:
- case 245:
- case 246:
- case 247:
- case 248:
- case 249:
- case 250:
- case 251:
- case 252:
- case 253:
- case 254:
- case 255:
- case 256:
- case 257:
- case 258:
- case 259:
- case 260:
- case 261:
- case 262:
- case 263:
- case 264:
- case 265:
- case 266:
- case 267:
- case 268:
- case 269:
- case 270:
- case 271:
- case 272:
- case 273:
- case 274:
- case 275:
- case 276:
- case 277:
- case 278:
- case 279:
- case 280:
- case 281:
- case 282:
- case 283:
- case 284:
- case 285:
- case 286:
- case 287:
- case 288:
- case 289:
- case 290:
- case 291:
- case 292:
- case 293:
- case 294:
- case 295:
- case 296:
- case 297:
- case 298:
- case 299:
- case 300:
- case 301:
- case 302:
- case 303:
- case 304:
- case 305:
- case 306:
- case 307:
- case 308:
- case 309:
- case 310:
- case 311:
- case 312:
- case 313:
- case 314:
- case 315:
- case 316:
- case 317:
- case 318:
- case 319:
- case 320:
- case 321:
- case 322:
- case 323:
- case 324:
- case 325:
- case 326:
- case 327:
- case 328:
- case 329:
- case 330:
- case 331:
- case 332:
- case 333:
- case 334:
- case 335:
- case 336:
- case 337:
- case 338:
- case 339:
- case 340:
- case 341:
- case 342:
- case 343:
- case 344:
- case 345:
- case 346:
- case 347:
- case 348:
- case 349:
- case 350:
- case 351:
- case 352:
- case 353:
- case 354:
- case 355:
- case 356:
- case 357:
- case 358:
- case 359:
- case 360:
- case 361:
- case 362:
- case 363:
- case 364:
- case 365:
- case 366:
- case 367:
- case 368:
- case 369:
- case 370:
- case 371:
- case 372:
- case 373:
- case 374:
- case 375:
- case 502:
- case 503:
- case 504:
- case 505:
- case 506:
- case 507:
- case 508:
- case 509:
- case 510:
- case 511:
- case 512:
- case 513:
- case 514:
- case 515:
- case 516:
- case 517:
- case 518:
- case 519:
- case 520:
- case 521:
- case 522:
- case 523:
- case 524:
- case 525:
- case 526:
- case 527:
- case 528:
- case 529:
- case 530:
- case 531:
- case 532:
- case 533:
- case 534:
- case 535:
- case 536:
- case 537:
- case 538:
- case 539:
- case 540:
- case 541:
- case 542:
- case 543:
- case 544:
- case 545:
- case 546:
- case 547:
- case 548:
- case 549:
- case 550:
- case 551:
- case 552:
- case 553:
- case 554:
- case 555:
- case 556:
- case 557:
- case 558:
- case 559:
- case 560:
- case 561:
- case 2000:
- case 2001:
- case 2002:
- case 2003:
- case 2004:
- case 2005:
- case 2006:
- case 2007:
- case 2008:
- case 2009:
- case 2010:
- case 2011:
- case 2012:
- case 2013:
- case 2014:
- case 2015:
- case 2016:
- case 2017:
- case 2018:
- case 2019:
- case 2020:
- case 2021:
- case 2022:
- case 2023:
- case 2024:
- case 2025:
- case 2026:
- case 2027:
- case 2028:
- case 2029:
- case 2030:
- case 2031:
- case 2032:
- case 2033:
- case 2034:
- case 2035:
- case 2036:
- case 2037:
- case 2038:
- case 2039:
- case 2040:
- case 2041:
- case 2042:
- case 2043:
- case 2044:
- case 2045:
- case 3000:
- case 3001:
- return true;
- default:
- return false;
- }
-}
-
-#ifndef _MSC_VER
-const GLMessage_Function GLMessage::glActiveTexture;
-const GLMessage_Function GLMessage::glAlphaFunc;
-const GLMessage_Function GLMessage::glAlphaFuncx;
-const GLMessage_Function GLMessage::glAlphaFuncxOES;
-const GLMessage_Function GLMessage::glAttachShader;
-const GLMessage_Function GLMessage::glBeginPerfMonitorAMD;
-const GLMessage_Function GLMessage::glBindAttribLocation;
-const GLMessage_Function GLMessage::glBindBuffer;
-const GLMessage_Function GLMessage::glBindFramebuffer;
-const GLMessage_Function GLMessage::glBindFramebufferOES;
-const GLMessage_Function GLMessage::glBindRenderbuffer;
-const GLMessage_Function GLMessage::glBindRenderbufferOES;
-const GLMessage_Function GLMessage::glBindTexture;
-const GLMessage_Function GLMessage::glBindVertexArrayOES;
-const GLMessage_Function GLMessage::glBlendColor;
-const GLMessage_Function GLMessage::glBlendEquation;
-const GLMessage_Function GLMessage::glBlendEquationOES;
-const GLMessage_Function GLMessage::glBlendEquationSeparate;
-const GLMessage_Function GLMessage::glBlendEquationSeparateOES;
-const GLMessage_Function GLMessage::glBlendFunc;
-const GLMessage_Function GLMessage::glBlendFuncSeparate;
-const GLMessage_Function GLMessage::glBlendFuncSeparateOES;
-const GLMessage_Function GLMessage::glBufferData;
-const GLMessage_Function GLMessage::glBufferSubData;
-const GLMessage_Function GLMessage::glCheckFramebufferStatus;
-const GLMessage_Function GLMessage::glCheckFramebufferStatusOES;
-const GLMessage_Function GLMessage::glClearColor;
-const GLMessage_Function GLMessage::glClearColorx;
-const GLMessage_Function GLMessage::glClearColorxOES;
-const GLMessage_Function GLMessage::glClearDepthf;
-const GLMessage_Function GLMessage::glClearDepthfOES;
-const GLMessage_Function GLMessage::glClearDepthx;
-const GLMessage_Function GLMessage::glClearDepthxOES;
-const GLMessage_Function GLMessage::glClear;
-const GLMessage_Function GLMessage::glClearStencil;
-const GLMessage_Function GLMessage::glClientActiveTexture;
-const GLMessage_Function GLMessage::glClipPlanef;
-const GLMessage_Function GLMessage::glClipPlanefIMG;
-const GLMessage_Function GLMessage::glClipPlanefOES;
-const GLMessage_Function GLMessage::glClipPlanex;
-const GLMessage_Function GLMessage::glClipPlanexIMG;
-const GLMessage_Function GLMessage::glClipPlanexOES;
-const GLMessage_Function GLMessage::glColor4f;
-const GLMessage_Function GLMessage::glColor4ub;
-const GLMessage_Function GLMessage::glColor4x;
-const GLMessage_Function GLMessage::glColor4xOES;
-const GLMessage_Function GLMessage::glColorMask;
-const GLMessage_Function GLMessage::glColorPointer;
-const GLMessage_Function GLMessage::glCompileShader;
-const GLMessage_Function GLMessage::glCompressedTexImage2D;
-const GLMessage_Function GLMessage::glCompressedTexImage3DOES;
-const GLMessage_Function GLMessage::glCompressedTexSubImage2D;
-const GLMessage_Function GLMessage::glCompressedTexSubImage3DOES;
-const GLMessage_Function GLMessage::glCopyTexImage2D;
-const GLMessage_Function GLMessage::glCopyTexSubImage2D;
-const GLMessage_Function GLMessage::glCopyTexSubImage3DOES;
-const GLMessage_Function GLMessage::glCoverageMaskNV;
-const GLMessage_Function GLMessage::glCoverageOperationNV;
-const GLMessage_Function GLMessage::glCreateProgram;
-const GLMessage_Function GLMessage::glCreateShader;
-const GLMessage_Function GLMessage::glCullFace;
-const GLMessage_Function GLMessage::glCurrentPaletteMatrixOES;
-const GLMessage_Function GLMessage::glDeleteBuffers;
-const GLMessage_Function GLMessage::glDeleteFencesNV;
-const GLMessage_Function GLMessage::glDeleteFramebuffers;
-const GLMessage_Function GLMessage::glDeleteFramebuffersOES;
-const GLMessage_Function GLMessage::glDeletePerfMonitorsAMD;
-const GLMessage_Function GLMessage::glDeleteProgram;
-const GLMessage_Function GLMessage::glDeleteRenderbuffers;
-const GLMessage_Function GLMessage::glDeleteRenderbuffersOES;
-const GLMessage_Function GLMessage::glDeleteShader;
-const GLMessage_Function GLMessage::glDeleteTextures;
-const GLMessage_Function GLMessage::glDeleteVertexArraysOES;
-const GLMessage_Function GLMessage::glDepthFunc;
-const GLMessage_Function GLMessage::glDepthMask;
-const GLMessage_Function GLMessage::glDepthRangef;
-const GLMessage_Function GLMessage::glDepthRangefOES;
-const GLMessage_Function GLMessage::glDepthRangex;
-const GLMessage_Function GLMessage::glDepthRangexOES;
-const GLMessage_Function GLMessage::glDetachShader;
-const GLMessage_Function GLMessage::glDisableClientState;
-const GLMessage_Function GLMessage::glDisableDriverControlQCOM;
-const GLMessage_Function GLMessage::glDisable;
-const GLMessage_Function GLMessage::glDisableVertexAttribArray;
-const GLMessage_Function GLMessage::glDiscardFramebufferEXT;
-const GLMessage_Function GLMessage::glDrawArrays;
-const GLMessage_Function GLMessage::glDrawElements;
-const GLMessage_Function GLMessage::glDrawTexfOES;
-const GLMessage_Function GLMessage::glDrawTexfvOES;
-const GLMessage_Function GLMessage::glDrawTexiOES;
-const GLMessage_Function GLMessage::glDrawTexivOES;
-const GLMessage_Function GLMessage::glDrawTexsOES;
-const GLMessage_Function GLMessage::glDrawTexsvOES;
-const GLMessage_Function GLMessage::glDrawTexxOES;
-const GLMessage_Function GLMessage::glDrawTexxvOES;
-const GLMessage_Function GLMessage::glEGLImageTargetRenderbufferStorageOES;
-const GLMessage_Function GLMessage::glEGLImageTargetTexture2DOES;
-const GLMessage_Function GLMessage::glEnableClientState;
-const GLMessage_Function GLMessage::glEnableDriverControlQCOM;
-const GLMessage_Function GLMessage::glEnable;
-const GLMessage_Function GLMessage::glEnableVertexAttribArray;
-const GLMessage_Function GLMessage::glEndPerfMonitorAMD;
-const GLMessage_Function GLMessage::glEndTilingQCOM;
-const GLMessage_Function GLMessage::glExtGetBufferPointervQCOM;
-const GLMessage_Function GLMessage::glExtGetBuffersQCOM;
-const GLMessage_Function GLMessage::glExtGetFramebuffersQCOM;
-const GLMessage_Function GLMessage::glExtGetProgramBinarySourceQCOM;
-const GLMessage_Function GLMessage::glExtGetProgramsQCOM;
-const GLMessage_Function GLMessage::glExtGetRenderbuffersQCOM;
-const GLMessage_Function GLMessage::glExtGetShadersQCOM;
-const GLMessage_Function GLMessage::glExtGetTexLevelParameterivQCOM;
-const GLMessage_Function GLMessage::glExtGetTexSubImageQCOM;
-const GLMessage_Function GLMessage::glExtGetTexturesQCOM;
-const GLMessage_Function GLMessage::glExtIsProgramBinaryQCOM;
-const GLMessage_Function GLMessage::glExtTexObjectStateOverrideiQCOM;
-const GLMessage_Function GLMessage::glFinishFenceNV;
-const GLMessage_Function GLMessage::glFinish;
-const GLMessage_Function GLMessage::glFlush;
-const GLMessage_Function GLMessage::glFogf;
-const GLMessage_Function GLMessage::glFogfv;
-const GLMessage_Function GLMessage::glFogx;
-const GLMessage_Function GLMessage::glFogxOES;
-const GLMessage_Function GLMessage::glFogxv;
-const GLMessage_Function GLMessage::glFogxvOES;
-const GLMessage_Function GLMessage::glFramebufferRenderbuffer;
-const GLMessage_Function GLMessage::glFramebufferRenderbufferOES;
-const GLMessage_Function GLMessage::glFramebufferTexture2D;
-const GLMessage_Function GLMessage::glFramebufferTexture2DMultisampleIMG;
-const GLMessage_Function GLMessage::glFramebufferTexture2DOES;
-const GLMessage_Function GLMessage::glFramebufferTexture3DOES;
-const GLMessage_Function GLMessage::glFrontFace;
-const GLMessage_Function GLMessage::glFrustumf;
-const GLMessage_Function GLMessage::glFrustumfOES;
-const GLMessage_Function GLMessage::glFrustumx;
-const GLMessage_Function GLMessage::glFrustumxOES;
-const GLMessage_Function GLMessage::glGenBuffers;
-const GLMessage_Function GLMessage::glGenerateMipmap;
-const GLMessage_Function GLMessage::glGenerateMipmapOES;
-const GLMessage_Function GLMessage::glGenFencesNV;
-const GLMessage_Function GLMessage::glGenFramebuffers;
-const GLMessage_Function GLMessage::glGenFramebuffersOES;
-const GLMessage_Function GLMessage::glGenPerfMonitorsAMD;
-const GLMessage_Function GLMessage::glGenRenderbuffers;
-const GLMessage_Function GLMessage::glGenRenderbuffersOES;
-const GLMessage_Function GLMessage::glGenTextures;
-const GLMessage_Function GLMessage::glGenVertexArraysOES;
-const GLMessage_Function GLMessage::glGetActiveAttrib;
-const GLMessage_Function GLMessage::glGetActiveUniform;
-const GLMessage_Function GLMessage::glGetAttachedShaders;
-const GLMessage_Function GLMessage::glGetAttribLocation;
-const GLMessage_Function GLMessage::glGetBooleanv;
-const GLMessage_Function GLMessage::glGetBufferParameteriv;
-const GLMessage_Function GLMessage::glGetBufferPointervOES;
-const GLMessage_Function GLMessage::glGetClipPlanef;
-const GLMessage_Function GLMessage::glGetClipPlanefOES;
-const GLMessage_Function GLMessage::glGetClipPlanex;
-const GLMessage_Function GLMessage::glGetClipPlanexOES;
-const GLMessage_Function GLMessage::glGetDriverControlsQCOM;
-const GLMessage_Function GLMessage::glGetDriverControlStringQCOM;
-const GLMessage_Function GLMessage::glGetError;
-const GLMessage_Function GLMessage::glGetFenceivNV;
-const GLMessage_Function GLMessage::glGetFixedv;
-const GLMessage_Function GLMessage::glGetFixedvOES;
-const GLMessage_Function GLMessage::glGetFloatv;
-const GLMessage_Function GLMessage::glGetFramebufferAttachmentParameteriv;
-const GLMessage_Function GLMessage::glGetFramebufferAttachmentParameterivOES;
-const GLMessage_Function GLMessage::glGetIntegerv;
-const GLMessage_Function GLMessage::glGetLightfv;
-const GLMessage_Function GLMessage::glGetLightxv;
-const GLMessage_Function GLMessage::glGetLightxvOES;
-const GLMessage_Function GLMessage::glGetMaterialfv;
-const GLMessage_Function GLMessage::glGetMaterialxv;
-const GLMessage_Function GLMessage::glGetMaterialxvOES;
-const GLMessage_Function GLMessage::glGetPerfMonitorCounterDataAMD;
-const GLMessage_Function GLMessage::glGetPerfMonitorCounterInfoAMD;
-const GLMessage_Function GLMessage::glGetPerfMonitorCountersAMD;
-const GLMessage_Function GLMessage::glGetPerfMonitorCounterStringAMD;
-const GLMessage_Function GLMessage::glGetPerfMonitorGroupsAMD;
-const GLMessage_Function GLMessage::glGetPerfMonitorGroupStringAMD;
-const GLMessage_Function GLMessage::glGetPointerv;
-const GLMessage_Function GLMessage::glGetProgramBinaryOES;
-const GLMessage_Function GLMessage::glGetProgramInfoLog;
-const GLMessage_Function GLMessage::glGetProgramiv;
-const GLMessage_Function GLMessage::glGetRenderbufferParameteriv;
-const GLMessage_Function GLMessage::glGetRenderbufferParameterivOES;
-const GLMessage_Function GLMessage::glGetShaderInfoLog;
-const GLMessage_Function GLMessage::glGetShaderiv;
-const GLMessage_Function GLMessage::glGetShaderPrecisionFormat;
-const GLMessage_Function GLMessage::glGetShaderSource;
-const GLMessage_Function GLMessage::glGetString;
-const GLMessage_Function GLMessage::glGetTexEnvfv;
-const GLMessage_Function GLMessage::glGetTexEnviv;
-const GLMessage_Function GLMessage::glGetTexEnvxv;
-const GLMessage_Function GLMessage::glGetTexEnvxvOES;
-const GLMessage_Function GLMessage::glGetTexGenfvOES;
-const GLMessage_Function GLMessage::glGetTexGenivOES;
-const GLMessage_Function GLMessage::glGetTexGenxvOES;
-const GLMessage_Function GLMessage::glGetTexParameterfv;
-const GLMessage_Function GLMessage::glGetTexParameteriv;
-const GLMessage_Function GLMessage::glGetTexParameterxv;
-const GLMessage_Function GLMessage::glGetTexParameterxvOES;
-const GLMessage_Function GLMessage::glGetUniformfv;
-const GLMessage_Function GLMessage::glGetUniformiv;
-const GLMessage_Function GLMessage::glGetUniformLocation;
-const GLMessage_Function GLMessage::glGetVertexAttribfv;
-const GLMessage_Function GLMessage::glGetVertexAttribiv;
-const GLMessage_Function GLMessage::glGetVertexAttribPointerv;
-const GLMessage_Function GLMessage::glHint;
-const GLMessage_Function GLMessage::glIsBuffer;
-const GLMessage_Function GLMessage::glIsEnabled;
-const GLMessage_Function GLMessage::glIsFenceNV;
-const GLMessage_Function GLMessage::glIsFramebuffer;
-const GLMessage_Function GLMessage::glIsFramebufferOES;
-const GLMessage_Function GLMessage::glIsProgram;
-const GLMessage_Function GLMessage::glIsRenderbuffer;
-const GLMessage_Function GLMessage::glIsRenderbufferOES;
-const GLMessage_Function GLMessage::glIsShader;
-const GLMessage_Function GLMessage::glIsTexture;
-const GLMessage_Function GLMessage::glIsVertexArrayOES;
-const GLMessage_Function GLMessage::glLightf;
-const GLMessage_Function GLMessage::glLightfv;
-const GLMessage_Function GLMessage::glLightModelf;
-const GLMessage_Function GLMessage::glLightModelfv;
-const GLMessage_Function GLMessage::glLightModelx;
-const GLMessage_Function GLMessage::glLightModelxOES;
-const GLMessage_Function GLMessage::glLightModelxv;
-const GLMessage_Function GLMessage::glLightModelxvOES;
-const GLMessage_Function GLMessage::glLightx;
-const GLMessage_Function GLMessage::glLightxOES;
-const GLMessage_Function GLMessage::glLightxv;
-const GLMessage_Function GLMessage::glLightxvOES;
-const GLMessage_Function GLMessage::glLineWidth;
-const GLMessage_Function GLMessage::glLineWidthx;
-const GLMessage_Function GLMessage::glLineWidthxOES;
-const GLMessage_Function GLMessage::glLinkProgram;
-const GLMessage_Function GLMessage::glLoadIdentity;
-const GLMessage_Function GLMessage::glLoadMatrixf;
-const GLMessage_Function GLMessage::glLoadMatrixx;
-const GLMessage_Function GLMessage::glLoadMatrixxOES;
-const GLMessage_Function GLMessage::glLoadPaletteFromModelViewMatrixOES;
-const GLMessage_Function GLMessage::glLogicOp;
-const GLMessage_Function GLMessage::glMapBufferOES;
-const GLMessage_Function GLMessage::glMaterialf;
-const GLMessage_Function GLMessage::glMaterialfv;
-const GLMessage_Function GLMessage::glMaterialx;
-const GLMessage_Function GLMessage::glMaterialxOES;
-const GLMessage_Function GLMessage::glMaterialxv;
-const GLMessage_Function GLMessage::glMaterialxvOES;
-const GLMessage_Function GLMessage::glMatrixIndexPointerOES;
-const GLMessage_Function GLMessage::glMatrixMode;
-const GLMessage_Function GLMessage::glMultiDrawArraysEXT;
-const GLMessage_Function GLMessage::glMultiDrawElementsEXT;
-const GLMessage_Function GLMessage::glMultiTexCoord4f;
-const GLMessage_Function GLMessage::glMultiTexCoord4x;
-const GLMessage_Function GLMessage::glMultiTexCoord4xOES;
-const GLMessage_Function GLMessage::glMultMatrixf;
-const GLMessage_Function GLMessage::glMultMatrixx;
-const GLMessage_Function GLMessage::glMultMatrixxOES;
-const GLMessage_Function GLMessage::glNormal3f;
-const GLMessage_Function GLMessage::glNormal3x;
-const GLMessage_Function GLMessage::glNormal3xOES;
-const GLMessage_Function GLMessage::glNormalPointer;
-const GLMessage_Function GLMessage::glOrthof;
-const GLMessage_Function GLMessage::glOrthofOES;
-const GLMessage_Function GLMessage::glOrthox;
-const GLMessage_Function GLMessage::glOrthoxOES;
-const GLMessage_Function GLMessage::glPixelStorei;
-const GLMessage_Function GLMessage::glPointParameterf;
-const GLMessage_Function GLMessage::glPointParameterfv;
-const GLMessage_Function GLMessage::glPointParameterx;
-const GLMessage_Function GLMessage::glPointParameterxOES;
-const GLMessage_Function GLMessage::glPointParameterxv;
-const GLMessage_Function GLMessage::glPointParameterxvOES;
-const GLMessage_Function GLMessage::glPointSize;
-const GLMessage_Function GLMessage::glPointSizePointerOES;
-const GLMessage_Function GLMessage::glPointSizex;
-const GLMessage_Function GLMessage::glPointSizexOES;
-const GLMessage_Function GLMessage::glPolygonOffset;
-const GLMessage_Function GLMessage::glPolygonOffsetx;
-const GLMessage_Function GLMessage::glPolygonOffsetxOES;
-const GLMessage_Function GLMessage::glPopMatrix;
-const GLMessage_Function GLMessage::glProgramBinaryOES;
-const GLMessage_Function GLMessage::glPushMatrix;
-const GLMessage_Function GLMessage::glQueryMatrixxOES;
-const GLMessage_Function GLMessage::glReadPixels;
-const GLMessage_Function GLMessage::glReleaseShaderCompiler;
-const GLMessage_Function GLMessage::glRenderbufferStorage;
-const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleIMG;
-const GLMessage_Function GLMessage::glRenderbufferStorageOES;
-const GLMessage_Function GLMessage::glRotatef;
-const GLMessage_Function GLMessage::glRotatex;
-const GLMessage_Function GLMessage::glRotatexOES;
-const GLMessage_Function GLMessage::glSampleCoverage;
-const GLMessage_Function GLMessage::glSampleCoveragex;
-const GLMessage_Function GLMessage::glSampleCoveragexOES;
-const GLMessage_Function GLMessage::glScalef;
-const GLMessage_Function GLMessage::glScalex;
-const GLMessage_Function GLMessage::glScalexOES;
-const GLMessage_Function GLMessage::glScissor;
-const GLMessage_Function GLMessage::glSelectPerfMonitorCountersAMD;
-const GLMessage_Function GLMessage::glSetFenceNV;
-const GLMessage_Function GLMessage::glShadeModel;
-const GLMessage_Function GLMessage::glShaderBinary;
-const GLMessage_Function GLMessage::glShaderSource;
-const GLMessage_Function GLMessage::glStartTilingQCOM;
-const GLMessage_Function GLMessage::glStencilFunc;
-const GLMessage_Function GLMessage::glStencilFuncSeparate;
-const GLMessage_Function GLMessage::glStencilMask;
-const GLMessage_Function GLMessage::glStencilMaskSeparate;
-const GLMessage_Function GLMessage::glStencilOp;
-const GLMessage_Function GLMessage::glStencilOpSeparate;
-const GLMessage_Function GLMessage::glTestFenceNV;
-const GLMessage_Function GLMessage::glTexCoordPointer;
-const GLMessage_Function GLMessage::glTexEnvf;
-const GLMessage_Function GLMessage::glTexEnvfv;
-const GLMessage_Function GLMessage::glTexEnvi;
-const GLMessage_Function GLMessage::glTexEnviv;
-const GLMessage_Function GLMessage::glTexEnvx;
-const GLMessage_Function GLMessage::glTexEnvxOES;
-const GLMessage_Function GLMessage::glTexEnvxv;
-const GLMessage_Function GLMessage::glTexEnvxvOES;
-const GLMessage_Function GLMessage::glTexGenfOES;
-const GLMessage_Function GLMessage::glTexGenfvOES;
-const GLMessage_Function GLMessage::glTexGeniOES;
-const GLMessage_Function GLMessage::glTexGenivOES;
-const GLMessage_Function GLMessage::glTexGenxOES;
-const GLMessage_Function GLMessage::glTexGenxvOES;
-const GLMessage_Function GLMessage::glTexImage2D;
-const GLMessage_Function GLMessage::glTexImage3DOES;
-const GLMessage_Function GLMessage::glTexParameterf;
-const GLMessage_Function GLMessage::glTexParameterfv;
-const GLMessage_Function GLMessage::glTexParameteri;
-const GLMessage_Function GLMessage::glTexParameteriv;
-const GLMessage_Function GLMessage::glTexParameterx;
-const GLMessage_Function GLMessage::glTexParameterxOES;
-const GLMessage_Function GLMessage::glTexParameterxv;
-const GLMessage_Function GLMessage::glTexParameterxvOES;
-const GLMessage_Function GLMessage::glTexSubImage2D;
-const GLMessage_Function GLMessage::glTexSubImage3DOES;
-const GLMessage_Function GLMessage::glTranslatef;
-const GLMessage_Function GLMessage::glTranslatex;
-const GLMessage_Function GLMessage::glTranslatexOES;
-const GLMessage_Function GLMessage::glUniform1f;
-const GLMessage_Function GLMessage::glUniform1fv;
-const GLMessage_Function GLMessage::glUniform1i;
-const GLMessage_Function GLMessage::glUniform1iv;
-const GLMessage_Function GLMessage::glUniform2f;
-const GLMessage_Function GLMessage::glUniform2fv;
-const GLMessage_Function GLMessage::glUniform2i;
-const GLMessage_Function GLMessage::glUniform2iv;
-const GLMessage_Function GLMessage::glUniform3f;
-const GLMessage_Function GLMessage::glUniform3fv;
-const GLMessage_Function GLMessage::glUniform3i;
-const GLMessage_Function GLMessage::glUniform3iv;
-const GLMessage_Function GLMessage::glUniform4f;
-const GLMessage_Function GLMessage::glUniform4fv;
-const GLMessage_Function GLMessage::glUniform4i;
-const GLMessage_Function GLMessage::glUniform4iv;
-const GLMessage_Function GLMessage::glUniformMatrix2fv;
-const GLMessage_Function GLMessage::glUniformMatrix3fv;
-const GLMessage_Function GLMessage::glUniformMatrix4fv;
-const GLMessage_Function GLMessage::glUnmapBufferOES;
-const GLMessage_Function GLMessage::glUseProgram;
-const GLMessage_Function GLMessage::glValidateProgram;
-const GLMessage_Function GLMessage::glVertexAttrib1f;
-const GLMessage_Function GLMessage::glVertexAttrib1fv;
-const GLMessage_Function GLMessage::glVertexAttrib2f;
-const GLMessage_Function GLMessage::glVertexAttrib2fv;
-const GLMessage_Function GLMessage::glVertexAttrib3f;
-const GLMessage_Function GLMessage::glVertexAttrib3fv;
-const GLMessage_Function GLMessage::glVertexAttrib4f;
-const GLMessage_Function GLMessage::glVertexAttrib4fv;
-const GLMessage_Function GLMessage::glVertexAttribPointer;
-const GLMessage_Function GLMessage::glVertexPointer;
-const GLMessage_Function GLMessage::glViewport;
-const GLMessage_Function GLMessage::glWeightPointerOES;
-const GLMessage_Function GLMessage::glActiveShaderProgramEXT;
-const GLMessage_Function GLMessage::glAlphaFuncQCOM;
-const GLMessage_Function GLMessage::glBeginQueryEXT;
-const GLMessage_Function GLMessage::glBindProgramPipelineEXT;
-const GLMessage_Function GLMessage::glBlitFramebufferANGLE;
-const GLMessage_Function GLMessage::glCreateShaderProgramvEXT;
-const GLMessage_Function GLMessage::glDeleteProgramPipelinesEXT;
-const GLMessage_Function GLMessage::glDeleteQueriesEXT;
-const GLMessage_Function GLMessage::glDrawBuffersNV;
-const GLMessage_Function GLMessage::glEndQueryEXT;
-const GLMessage_Function GLMessage::glFramebufferTexture2DMultisampleEXT;
-const GLMessage_Function GLMessage::glGenProgramPipelinesEXT;
-const GLMessage_Function GLMessage::glGenQueriesEXT;
-const GLMessage_Function GLMessage::glGetGraphicsResetStatusEXT;
-const GLMessage_Function GLMessage::glGetObjectLabelEXT;
-const GLMessage_Function GLMessage::glGetProgramPipelineInfoLogEXT;
-const GLMessage_Function GLMessage::glGetProgramPipelineivEXT;
-const GLMessage_Function GLMessage::glGetQueryObjectuivEXT;
-const GLMessage_Function GLMessage::glGetQueryivEXT;
-const GLMessage_Function GLMessage::glGetnUniformfvEXT;
-const GLMessage_Function GLMessage::glGetnUniformivEXT;
-const GLMessage_Function GLMessage::glInsertEventMarkerEXT;
-const GLMessage_Function GLMessage::glIsProgramPipelineEXT;
-const GLMessage_Function GLMessage::glIsQueryEXT;
-const GLMessage_Function GLMessage::glLabelObjectEXT;
-const GLMessage_Function GLMessage::glPopGroupMarkerEXT;
-const GLMessage_Function GLMessage::glProgramParameteriEXT;
-const GLMessage_Function GLMessage::glProgramUniform1fEXT;
-const GLMessage_Function GLMessage::glProgramUniform1fvEXT;
-const GLMessage_Function GLMessage::glProgramUniform1iEXT;
-const GLMessage_Function GLMessage::glProgramUniform1ivEXT;
-const GLMessage_Function GLMessage::glProgramUniform2fEXT;
-const GLMessage_Function GLMessage::glProgramUniform2fvEXT;
-const GLMessage_Function GLMessage::glProgramUniform2iEXT;
-const GLMessage_Function GLMessage::glProgramUniform2ivEXT;
-const GLMessage_Function GLMessage::glProgramUniform3fEXT;
-const GLMessage_Function GLMessage::glProgramUniform3fvEXT;
-const GLMessage_Function GLMessage::glProgramUniform3iEXT;
-const GLMessage_Function GLMessage::glProgramUniform3ivEXT;
-const GLMessage_Function GLMessage::glProgramUniform4fEXT;
-const GLMessage_Function GLMessage::glProgramUniform4fvEXT;
-const GLMessage_Function GLMessage::glProgramUniform4iEXT;
-const GLMessage_Function GLMessage::glProgramUniform4ivEXT;
-const GLMessage_Function GLMessage::glProgramUniformMatrix2fvEXT;
-const GLMessage_Function GLMessage::glProgramUniformMatrix3fvEXT;
-const GLMessage_Function GLMessage::glProgramUniformMatrix4fvEXT;
-const GLMessage_Function GLMessage::glPushGroupMarkerEXT;
-const GLMessage_Function GLMessage::glReadBufferNV;
-const GLMessage_Function GLMessage::glReadnPixelsEXT;
-const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleANGLE;
-const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleAPPLE;
-const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleEXT;
-const GLMessage_Function GLMessage::glResolveMultisampleFramebufferAPPLE;
-const GLMessage_Function GLMessage::glTexStorage1DEXT;
-const GLMessage_Function GLMessage::glTexStorage2DEXT;
-const GLMessage_Function GLMessage::glTexStorage3DEXT;
-const GLMessage_Function GLMessage::glTextureStorage1DEXT;
-const GLMessage_Function GLMessage::glTextureStorage2DEXT;
-const GLMessage_Function GLMessage::glTextureStorage3DEXT;
-const GLMessage_Function GLMessage::glUseProgramStagesEXT;
-const GLMessage_Function GLMessage::glValidateProgramPipelineEXT;
-const GLMessage_Function GLMessage::eglGetDisplay;
-const GLMessage_Function GLMessage::eglInitialize;
-const GLMessage_Function GLMessage::eglTerminate;
-const GLMessage_Function GLMessage::eglGetConfigs;
-const GLMessage_Function GLMessage::eglChooseConfig;
-const GLMessage_Function GLMessage::eglGetConfigAttrib;
-const GLMessage_Function GLMessage::eglCreateWindowSurface;
-const GLMessage_Function GLMessage::eglCreatePixmapSurface;
-const GLMessage_Function GLMessage::eglCreatePbufferSurface;
-const GLMessage_Function GLMessage::eglDestroySurface;
-const GLMessage_Function GLMessage::eglQuerySurface;
-const GLMessage_Function GLMessage::eglCreateContext;
-const GLMessage_Function GLMessage::eglDestroyContext;
-const GLMessage_Function GLMessage::eglMakeCurrent;
-const GLMessage_Function GLMessage::eglGetCurrentContext;
-const GLMessage_Function GLMessage::eglGetCurrentSurface;
-const GLMessage_Function GLMessage::eglGetCurrentDisplay;
-const GLMessage_Function GLMessage::eglQueryContext;
-const GLMessage_Function GLMessage::eglWaitGL;
-const GLMessage_Function GLMessage::eglWaitNative;
-const GLMessage_Function GLMessage::eglSwapBuffers;
-const GLMessage_Function GLMessage::eglCopyBuffers;
-const GLMessage_Function GLMessage::eglGetError;
-const GLMessage_Function GLMessage::eglQueryString;
-const GLMessage_Function GLMessage::eglGetProcAddress;
-const GLMessage_Function GLMessage::eglSurfaceAttrib;
-const GLMessage_Function GLMessage::eglBindTexImage;
-const GLMessage_Function GLMessage::eglReleaseTexImage;
-const GLMessage_Function GLMessage::eglSwapInterval;
-const GLMessage_Function GLMessage::eglBindAPI;
-const GLMessage_Function GLMessage::eglQueryAPI;
-const GLMessage_Function GLMessage::eglWaitClient;
-const GLMessage_Function GLMessage::eglReleaseThread;
-const GLMessage_Function GLMessage::eglCreatePbufferFromClientBuffer;
-const GLMessage_Function GLMessage::eglLockSurfaceKHR;
-const GLMessage_Function GLMessage::eglUnlockSurfaceKHR;
-const GLMessage_Function GLMessage::eglCreateImageKHR;
-const GLMessage_Function GLMessage::eglDestroyImageKHR;
-const GLMessage_Function GLMessage::eglCreateSyncKHR;
-const GLMessage_Function GLMessage::eglDestroySyncKHR;
-const GLMessage_Function GLMessage::eglClientWaitSyncKHR;
-const GLMessage_Function GLMessage::eglGetSyncAttribKHR;
-const GLMessage_Function GLMessage::eglSetSwapRectangleANDROID;
-const GLMessage_Function GLMessage::eglGetRenderBufferANDROID;
-const GLMessage_Function GLMessage::eglGetSystemTimeFrequencyNV;
-const GLMessage_Function GLMessage::eglGetSystemTimeNV;
-const GLMessage_Function GLMessage::invalid;
-const GLMessage_Function GLMessage::glVertexAttribPointerData;
-const GLMessage_Function GLMessage::Function_MIN;
-const GLMessage_Function GLMessage::Function_MAX;
-const int GLMessage::Function_ARRAYSIZE;
-#endif // _MSC_VER
-bool GLMessage_DataType_Type_IsValid(int value) {
- switch(value) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- return true;
- default:
- return false;
- }
-}
-
-#ifndef _MSC_VER
-const GLMessage_DataType_Type GLMessage_DataType::VOID;
-const GLMessage_DataType_Type GLMessage_DataType::CHAR;
-const GLMessage_DataType_Type GLMessage_DataType::BYTE;
-const GLMessage_DataType_Type GLMessage_DataType::INT;
-const GLMessage_DataType_Type GLMessage_DataType::FLOAT;
-const GLMessage_DataType_Type GLMessage_DataType::BOOL;
-const GLMessage_DataType_Type GLMessage_DataType::ENUM;
-const GLMessage_DataType_Type GLMessage_DataType::Type_MIN;
-const GLMessage_DataType_Type GLMessage_DataType::Type_MAX;
-const int GLMessage_DataType::Type_ARRAYSIZE;
-#endif // _MSC_VER
-#ifndef _MSC_VER
-const int GLMessage_DataType::kTypeFieldNumber;
-const int GLMessage_DataType::kIsArrayFieldNumber;
-const int GLMessage_DataType::kIntValueFieldNumber;
-const int GLMessage_DataType::kFloatValueFieldNumber;
-const int GLMessage_DataType::kCharValueFieldNumber;
-const int GLMessage_DataType::kRawBytesFieldNumber;
-const int GLMessage_DataType::kBoolValueFieldNumber;
-#endif // !_MSC_VER
-
-GLMessage_DataType::GLMessage_DataType()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void GLMessage_DataType::InitAsDefaultInstance() {
-}
-
-GLMessage_DataType::GLMessage_DataType(const GLMessage_DataType& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void GLMessage_DataType::SharedCtor() {
- _cached_size_ = 0;
- type_ = 1;
- isarray_ = false;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-GLMessage_DataType::~GLMessage_DataType() {
- SharedDtor();
-}
-
-void GLMessage_DataType::SharedDtor() {
- if (this != default_instance_) {
- }
-}
-
-void GLMessage_DataType::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const GLMessage_DataType& GLMessage_DataType::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_;
-}
-
-GLMessage_DataType* GLMessage_DataType::default_instance_ = NULL;
-
-GLMessage_DataType* GLMessage_DataType::New() const {
- return new GLMessage_DataType;
-}
-
-void GLMessage_DataType::Clear() {
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- type_ = 1;
- isarray_ = false;
- }
- intvalue_.Clear();
- floatvalue_.Clear();
- charvalue_.Clear();
- rawbytes_.Clear();
- boolvalue_.Clear();
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool GLMessage_DataType::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- int value;
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
- input, &value)));
- if (::android::gltrace::GLMessage_DataType_Type_IsValid(value)) {
- set_type(static_cast< ::android::gltrace::GLMessage_DataType_Type >(value));
- }
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(16)) goto parse_isArray;
- break;
- }
-
- // required bool isArray = 2 [default = false];
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_isArray:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
- input, &isarray_)));
- _set_bit(1);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(24)) goto parse_intValue;
- break;
- }
-
- // repeated int32 intValue = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_intValue:
- DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- 1, 24, input, this->mutable_intvalue())));
- } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
- == ::google::protobuf::internal::WireFormatLite::
- WIRETYPE_LENGTH_DELIMITED) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, this->mutable_intvalue())));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(24)) goto parse_intValue;
- if (input->ExpectTag(37)) goto parse_floatValue;
- break;
- }
-
- // repeated float floatValue = 4;
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
- parse_floatValue:
- DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
- float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
- 1, 37, input, this->mutable_floatvalue())));
- } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
- == ::google::protobuf::internal::WireFormatLite::
- WIRETYPE_LENGTH_DELIMITED) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
- float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
- input, this->mutable_floatvalue())));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(37)) goto parse_floatValue;
- if (input->ExpectTag(42)) goto parse_charValue;
- break;
- }
-
- // repeated bytes charValue = 5;
- case 5: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_charValue:
- DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
- input, this->add_charvalue()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(42)) goto parse_charValue;
- if (input->ExpectTag(50)) goto parse_rawBytes;
- break;
- }
-
- // repeated bytes rawBytes = 6;
- case 6: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_rawBytes:
- DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
- input, this->add_rawbytes()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(50)) goto parse_rawBytes;
- if (input->ExpectTag(56)) goto parse_boolValue;
- break;
- }
-
- // repeated bool boolValue = 7;
- case 7: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_boolValue:
- DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
- bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
- 1, 56, input, this->mutable_boolvalue())));
- } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
- == ::google::protobuf::internal::WireFormatLite::
- WIRETYPE_LENGTH_DELIMITED) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
- bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
- input, this->mutable_boolvalue())));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(56)) goto parse_boolValue;
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void GLMessage_DataType::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
- if (_has_bit(0)) {
- ::google::protobuf::internal::WireFormatLite::WriteEnum(
- 1, this->type(), output);
- }
-
- // required bool isArray = 2 [default = false];
- if (_has_bit(1)) {
- ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->isarray(), output);
- }
-
- // repeated int32 intValue = 3;
- for (int i = 0; i < this->intvalue_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(
- 3, this->intvalue(i), output);
- }
-
- // repeated float floatValue = 4;
- for (int i = 0; i < this->floatvalue_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteFloat(
- 4, this->floatvalue(i), output);
- }
-
- // repeated bytes charValue = 5;
- for (int i = 0; i < this->charvalue_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteBytes(
- 5, this->charvalue(i), output);
- }
-
- // repeated bytes rawBytes = 6;
- for (int i = 0; i < this->rawbytes_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteBytes(
- 6, this->rawbytes(i), output);
- }
-
- // repeated bool boolValue = 7;
- for (int i = 0; i < this->boolvalue_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteBool(
- 7, this->boolvalue(i), output);
- }
-
-}
-
-int GLMessage_DataType::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
- if (has_type()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::EnumSize(this->type());
- }
-
- // required bool isArray = 2 [default = false];
- if (has_isarray()) {
- total_size += 1 + 1;
- }
-
- }
- // repeated int32 intValue = 3;
- {
- int data_size = 0;
- for (int i = 0; i < this->intvalue_size(); i++) {
- data_size += ::google::protobuf::internal::WireFormatLite::
- Int32Size(this->intvalue(i));
- }
- total_size += 1 * this->intvalue_size() + data_size;
- }
-
- // repeated float floatValue = 4;
- {
- int data_size = 0;
- data_size = 4 * this->floatvalue_size();
- total_size += 1 * this->floatvalue_size() + data_size;
- }
-
- // repeated bytes charValue = 5;
- total_size += 1 * this->charvalue_size();
- for (int i = 0; i < this->charvalue_size(); i++) {
- total_size += ::google::protobuf::internal::WireFormatLite::BytesSize(
- this->charvalue(i));
- }
-
- // repeated bytes rawBytes = 6;
- total_size += 1 * this->rawbytes_size();
- for (int i = 0; i < this->rawbytes_size(); i++) {
- total_size += ::google::protobuf::internal::WireFormatLite::BytesSize(
- this->rawbytes(i));
- }
-
- // repeated bool boolValue = 7;
- {
- int data_size = 0;
- data_size = 1 * this->boolvalue_size();
- total_size += 1 * this->boolvalue_size() + data_size;
- }
-
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void GLMessage_DataType::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const GLMessage_DataType*>(&from));
-}
-
-void GLMessage_DataType::MergeFrom(const GLMessage_DataType& from) {
- GOOGLE_CHECK_NE(&from, this);
- intvalue_.MergeFrom(from.intvalue_);
- floatvalue_.MergeFrom(from.floatvalue_);
- charvalue_.MergeFrom(from.charvalue_);
- rawbytes_.MergeFrom(from.rawbytes_);
- boolvalue_.MergeFrom(from.boolvalue_);
- if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (from._has_bit(0)) {
- set_type(from.type());
- }
- if (from._has_bit(1)) {
- set_isarray(from.isarray());
- }
- }
-}
-
-void GLMessage_DataType::CopyFrom(const GLMessage_DataType& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool GLMessage_DataType::IsInitialized() const {
- if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
-
- return true;
-}
-
-void GLMessage_DataType::Swap(GLMessage_DataType* other) {
- if (other != this) {
- std::swap(type_, other->type_);
- std::swap(isarray_, other->isarray_);
- intvalue_.Swap(&other->intvalue_);
- floatvalue_.Swap(&other->floatvalue_);
- charvalue_.Swap(&other->charvalue_);
- rawbytes_.Swap(&other->rawbytes_);
- boolvalue_.Swap(&other->boolvalue_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string GLMessage_DataType::GetTypeName() const {
- return "android.gltrace.GLMessage.DataType";
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int GLMessage_FrameBuffer::kWidthFieldNumber;
-const int GLMessage_FrameBuffer::kHeightFieldNumber;
-const int GLMessage_FrameBuffer::kContentsFieldNumber;
-#endif // !_MSC_VER
-
-GLMessage_FrameBuffer::GLMessage_FrameBuffer()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void GLMessage_FrameBuffer::InitAsDefaultInstance() {
-}
-
-GLMessage_FrameBuffer::GLMessage_FrameBuffer(const GLMessage_FrameBuffer& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void GLMessage_FrameBuffer::SharedCtor() {
- _cached_size_ = 0;
- width_ = 0;
- height_ = 0;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-GLMessage_FrameBuffer::~GLMessage_FrameBuffer() {
- SharedDtor();
-}
-
-void GLMessage_FrameBuffer::SharedDtor() {
- if (this != default_instance_) {
- }
-}
-
-void GLMessage_FrameBuffer::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const GLMessage_FrameBuffer& GLMessage_FrameBuffer::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_;
-}
-
-GLMessage_FrameBuffer* GLMessage_FrameBuffer::default_instance_ = NULL;
-
-GLMessage_FrameBuffer* GLMessage_FrameBuffer::New() const {
- return new GLMessage_FrameBuffer;
-}
-
-void GLMessage_FrameBuffer::Clear() {
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- width_ = 0;
- height_ = 0;
- }
- contents_.Clear();
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool GLMessage_FrameBuffer::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // required int32 width = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &width_)));
- _set_bit(0);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(16)) goto parse_height;
- break;
- }
-
- // required int32 height = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_height:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &height_)));
- _set_bit(1);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(26)) goto parse_contents;
- break;
- }
-
- // repeated bytes contents = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_contents:
- DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
- input, this->add_contents()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(26)) goto parse_contents;
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void GLMessage_FrameBuffer::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // required int32 width = 1;
- if (_has_bit(0)) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->width(), output);
- }
-
- // required int32 height = 2;
- if (_has_bit(1)) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->height(), output);
- }
-
- // repeated bytes contents = 3;
- for (int i = 0; i < this->contents_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteBytes(
- 3, this->contents(i), output);
- }
-
-}
-
-int GLMessage_FrameBuffer::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- // required int32 width = 1;
- if (has_width()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->width());
- }
-
- // required int32 height = 2;
- if (has_height()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->height());
- }
-
- }
- // repeated bytes contents = 3;
- total_size += 1 * this->contents_size();
- for (int i = 0; i < this->contents_size(); i++) {
- total_size += ::google::protobuf::internal::WireFormatLite::BytesSize(
- this->contents(i));
- }
-
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void GLMessage_FrameBuffer::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const GLMessage_FrameBuffer*>(&from));
-}
-
-void GLMessage_FrameBuffer::MergeFrom(const GLMessage_FrameBuffer& from) {
- GOOGLE_CHECK_NE(&from, this);
- contents_.MergeFrom(from.contents_);
- if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (from._has_bit(0)) {
- set_width(from.width());
- }
- if (from._has_bit(1)) {
- set_height(from.height());
- }
- }
-}
-
-void GLMessage_FrameBuffer::CopyFrom(const GLMessage_FrameBuffer& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool GLMessage_FrameBuffer::IsInitialized() const {
- if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
-
- return true;
-}
-
-void GLMessage_FrameBuffer::Swap(GLMessage_FrameBuffer* other) {
- if (other != this) {
- std::swap(width_, other->width_);
- std::swap(height_, other->height_);
- contents_.Swap(&other->contents_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string GLMessage_FrameBuffer::GetTypeName() const {
- return "android.gltrace.GLMessage.FrameBuffer";
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int GLMessage::kContextIdFieldNumber;
-const int GLMessage::kStartTimeFieldNumber;
-const int GLMessage::kDurationFieldNumber;
-const int GLMessage::kFunctionFieldNumber;
-const int GLMessage::kArgsFieldNumber;
-const int GLMessage::kReturnValueFieldNumber;
-const int GLMessage::kFbFieldNumber;
-const int GLMessage::kThreadtimeFieldNumber;
-#endif // !_MSC_VER
-
-GLMessage::GLMessage()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void GLMessage::InitAsDefaultInstance() {
- returnvalue_ = const_cast< ::android::gltrace::GLMessage_DataType*>(&::android::gltrace::GLMessage_DataType::default_instance());
- fb_ = const_cast< ::android::gltrace::GLMessage_FrameBuffer*>(&::android::gltrace::GLMessage_FrameBuffer::default_instance());
-}
-
-GLMessage::GLMessage(const GLMessage& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void GLMessage::SharedCtor() {
- _cached_size_ = 0;
- context_id_ = 0;
- start_time_ = GOOGLE_LONGLONG(0);
- duration_ = 0;
- function_ = 3000;
- returnvalue_ = NULL;
- fb_ = NULL;
- threadtime_ = 0;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-GLMessage::~GLMessage() {
- SharedDtor();
-}
-
-void GLMessage::SharedDtor() {
- if (this != default_instance_) {
- delete returnvalue_;
- delete fb_;
- }
-}
-
-void GLMessage::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const GLMessage& GLMessage::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_;
-}
-
-GLMessage* GLMessage::default_instance_ = NULL;
-
-GLMessage* GLMessage::New() const {
- return new GLMessage;
-}
-
-void GLMessage::Clear() {
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- context_id_ = 0;
- start_time_ = GOOGLE_LONGLONG(0);
- duration_ = 0;
- function_ = 3000;
- if (_has_bit(5)) {
- if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear();
- }
- if (_has_bit(6)) {
- if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear();
- }
- threadtime_ = 0;
- }
- args_.Clear();
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool GLMessage::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // required int32 context_id = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &context_id_)));
- _set_bit(0);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(16)) goto parse_start_time;
- break;
- }
-
- // required int64 start_time = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_start_time:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
- input, &start_time_)));
- _set_bit(1);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(24)) goto parse_duration;
- break;
- }
-
- // required int32 duration = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_duration:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &duration_)));
- _set_bit(2);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(32)) goto parse_function;
- break;
- }
-
- // required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_function:
- int value;
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
- input, &value)));
- if (::android::gltrace::GLMessage_Function_IsValid(value)) {
- set_function(static_cast< ::android::gltrace::GLMessage_Function >(value));
- }
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(42)) goto parse_args;
- break;
- }
-
- // repeated .android.gltrace.GLMessage.DataType args = 5;
- case 5: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_args:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, add_args()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(42)) goto parse_args;
- if (input->ExpectTag(50)) goto parse_returnValue;
- break;
- }
-
- // optional .android.gltrace.GLMessage.DataType returnValue = 6;
- case 6: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_returnValue:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_returnvalue()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(58)) goto parse_fb;
- break;
- }
-
- // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
- case 7: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_fb:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_fb()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(64)) goto parse_threadtime;
- break;
- }
-
- // optional int32 threadtime = 8;
- case 8: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_threadtime:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &threadtime_)));
- _set_bit(7);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void GLMessage::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // required int32 context_id = 1;
- if (_has_bit(0)) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->context_id(), output);
- }
-
- // required int64 start_time = 2;
- if (_has_bit(1)) {
- ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->start_time(), output);
- }
-
- // required int32 duration = 3;
- if (_has_bit(2)) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->duration(), output);
- }
-
- // required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
- if (_has_bit(3)) {
- ::google::protobuf::internal::WireFormatLite::WriteEnum(
- 4, this->function(), output);
- }
-
- // repeated .android.gltrace.GLMessage.DataType args = 5;
- for (int i = 0; i < this->args_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 5, this->args(i), output);
- }
-
- // optional .android.gltrace.GLMessage.DataType returnValue = 6;
- if (_has_bit(5)) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 6, this->returnvalue(), output);
- }
-
- // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
- if (_has_bit(6)) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 7, this->fb(), output);
- }
-
- // optional int32 threadtime = 8;
- if (_has_bit(7)) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->threadtime(), output);
- }
-
-}
-
-int GLMessage::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- // required int32 context_id = 1;
- if (has_context_id()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->context_id());
- }
-
- // required int64 start_time = 2;
- if (has_start_time()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int64Size(
- this->start_time());
- }
-
- // required int32 duration = 3;
- if (has_duration()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->duration());
- }
-
- // required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
- if (has_function()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::EnumSize(this->function());
- }
-
- // optional .android.gltrace.GLMessage.DataType returnValue = 6;
- if (has_returnvalue()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->returnvalue());
- }
-
- // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
- if (has_fb()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->fb());
- }
-
- // optional int32 threadtime = 8;
- if (has_threadtime()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->threadtime());
- }
-
- }
- // repeated .android.gltrace.GLMessage.DataType args = 5;
- total_size += 1 * this->args_size();
- for (int i = 0; i < this->args_size(); i++) {
- total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->args(i));
- }
-
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void GLMessage::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const GLMessage*>(&from));
-}
-
-void GLMessage::MergeFrom(const GLMessage& from) {
- GOOGLE_CHECK_NE(&from, this);
- args_.MergeFrom(from.args_);
- if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (from._has_bit(0)) {
- set_context_id(from.context_id());
- }
- if (from._has_bit(1)) {
- set_start_time(from.start_time());
- }
- if (from._has_bit(2)) {
- set_duration(from.duration());
- }
- if (from._has_bit(3)) {
- set_function(from.function());
- }
- if (from._has_bit(5)) {
- mutable_returnvalue()->::android::gltrace::GLMessage_DataType::MergeFrom(from.returnvalue());
- }
- if (from._has_bit(6)) {
- mutable_fb()->::android::gltrace::GLMessage_FrameBuffer::MergeFrom(from.fb());
- }
- if (from._has_bit(7)) {
- set_threadtime(from.threadtime());
- }
- }
-}
-
-void GLMessage::CopyFrom(const GLMessage& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool GLMessage::IsInitialized() const {
- if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false;
-
- for (int i = 0; i < args_size(); i++) {
- if (!this->args(i).IsInitialized()) return false;
- }
- if (has_returnvalue()) {
- if (!this->returnvalue().IsInitialized()) return false;
- }
- if (has_fb()) {
- if (!this->fb().IsInitialized()) return false;
- }
- return true;
-}
-
-void GLMessage::Swap(GLMessage* other) {
- if (other != this) {
- std::swap(context_id_, other->context_id_);
- std::swap(start_time_, other->start_time_);
- std::swap(duration_, other->duration_);
- std::swap(function_, other->function_);
- args_.Swap(&other->args_);
- std::swap(returnvalue_, other->returnvalue_);
- std::swap(fb_, other->fb_);
- std::swap(threadtime_, other->threadtime_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string GLMessage::GetTypeName() const {
- return "android.gltrace.GLMessage";
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-} // namespace gltrace
-} // namespace android
-
-// @@protoc_insertion_point(global_scope)
diff --git a/opengl/libs/GLES_trace/src/gltrace.pb.h b/opengl/libs/GLES_trace/src/gltrace.pb.h
deleted file mode 100644
index 0901be7..0000000
--- a/opengl/libs/GLES_trace/src/gltrace.pb.h
+++ /dev/null
@@ -1,1895 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: gltrace.proto
-
-#ifndef PROTOBUF_gltrace_2eproto__INCLUDED
-#define PROTOBUF_gltrace_2eproto__INCLUDED
-
-#include <string>
-
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 2003000
-#error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers. Please update
-#error your headers.
-#endif
-#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
-#error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers. Please
-#error regenerate this file with a newer version of protoc.
-#endif
-
-#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/repeated_field.h>
-#include <google/protobuf/extension_set.h>
-// @@protoc_insertion_point(includes)
-
-namespace android {
-namespace gltrace {
-
-// Internal implementation detail -- do not call these.
-void protobuf_AddDesc_gltrace_2eproto();
-void protobuf_AssignDesc_gltrace_2eproto();
-void protobuf_ShutdownFile_gltrace_2eproto();
-
-class GLMessage;
-class GLMessage_DataType;
-class GLMessage_FrameBuffer;
-
-enum GLMessage_DataType_Type {
- GLMessage_DataType_Type_VOID = 1,
- GLMessage_DataType_Type_CHAR = 2,
- GLMessage_DataType_Type_BYTE = 3,
- GLMessage_DataType_Type_INT = 4,
- GLMessage_DataType_Type_FLOAT = 5,
- GLMessage_DataType_Type_BOOL = 6,
- GLMessage_DataType_Type_ENUM = 7
-};
-bool GLMessage_DataType_Type_IsValid(int value);
-const GLMessage_DataType_Type GLMessage_DataType_Type_Type_MIN = GLMessage_DataType_Type_VOID;
-const GLMessage_DataType_Type GLMessage_DataType_Type_Type_MAX = GLMessage_DataType_Type_ENUM;
-const int GLMessage_DataType_Type_Type_ARRAYSIZE = GLMessage_DataType_Type_Type_MAX + 1;
-
-enum GLMessage_Function {
- GLMessage_Function_glActiveTexture = 0,
- GLMessage_Function_glAlphaFunc = 1,
- GLMessage_Function_glAlphaFuncx = 2,
- GLMessage_Function_glAlphaFuncxOES = 3,
- GLMessage_Function_glAttachShader = 4,
- GLMessage_Function_glBeginPerfMonitorAMD = 5,
- GLMessage_Function_glBindAttribLocation = 6,
- GLMessage_Function_glBindBuffer = 7,
- GLMessage_Function_glBindFramebuffer = 8,
- GLMessage_Function_glBindFramebufferOES = 9,
- GLMessage_Function_glBindRenderbuffer = 10,
- GLMessage_Function_glBindRenderbufferOES = 11,
- GLMessage_Function_glBindTexture = 12,
- GLMessage_Function_glBindVertexArrayOES = 13,
- GLMessage_Function_glBlendColor = 14,
- GLMessage_Function_glBlendEquation = 15,
- GLMessage_Function_glBlendEquationOES = 16,
- GLMessage_Function_glBlendEquationSeparate = 17,
- GLMessage_Function_glBlendEquationSeparateOES = 18,
- GLMessage_Function_glBlendFunc = 19,
- GLMessage_Function_glBlendFuncSeparate = 20,
- GLMessage_Function_glBlendFuncSeparateOES = 21,
- GLMessage_Function_glBufferData = 22,
- GLMessage_Function_glBufferSubData = 23,
- GLMessage_Function_glCheckFramebufferStatus = 24,
- GLMessage_Function_glCheckFramebufferStatusOES = 25,
- GLMessage_Function_glClearColor = 26,
- GLMessage_Function_glClearColorx = 27,
- GLMessage_Function_glClearColorxOES = 28,
- GLMessage_Function_glClearDepthf = 29,
- GLMessage_Function_glClearDepthfOES = 30,
- GLMessage_Function_glClearDepthx = 31,
- GLMessage_Function_glClearDepthxOES = 32,
- GLMessage_Function_glClear = 33,
- GLMessage_Function_glClearStencil = 34,
- GLMessage_Function_glClientActiveTexture = 35,
- GLMessage_Function_glClipPlanef = 36,
- GLMessage_Function_glClipPlanefIMG = 37,
- GLMessage_Function_glClipPlanefOES = 38,
- GLMessage_Function_glClipPlanex = 39,
- GLMessage_Function_glClipPlanexIMG = 40,
- GLMessage_Function_glClipPlanexOES = 41,
- GLMessage_Function_glColor4f = 42,
- GLMessage_Function_glColor4ub = 43,
- GLMessage_Function_glColor4x = 44,
- GLMessage_Function_glColor4xOES = 45,
- GLMessage_Function_glColorMask = 46,
- GLMessage_Function_glColorPointer = 47,
- GLMessage_Function_glCompileShader = 48,
- GLMessage_Function_glCompressedTexImage2D = 49,
- GLMessage_Function_glCompressedTexImage3DOES = 50,
- GLMessage_Function_glCompressedTexSubImage2D = 51,
- GLMessage_Function_glCompressedTexSubImage3DOES = 52,
- GLMessage_Function_glCopyTexImage2D = 53,
- GLMessage_Function_glCopyTexSubImage2D = 54,
- GLMessage_Function_glCopyTexSubImage3DOES = 55,
- GLMessage_Function_glCoverageMaskNV = 56,
- GLMessage_Function_glCoverageOperationNV = 57,
- GLMessage_Function_glCreateProgram = 58,
- GLMessage_Function_glCreateShader = 59,
- GLMessage_Function_glCullFace = 60,
- GLMessage_Function_glCurrentPaletteMatrixOES = 61,
- GLMessage_Function_glDeleteBuffers = 62,
- GLMessage_Function_glDeleteFencesNV = 63,
- GLMessage_Function_glDeleteFramebuffers = 64,
- GLMessage_Function_glDeleteFramebuffersOES = 65,
- GLMessage_Function_glDeletePerfMonitorsAMD = 66,
- GLMessage_Function_glDeleteProgram = 67,
- GLMessage_Function_glDeleteRenderbuffers = 68,
- GLMessage_Function_glDeleteRenderbuffersOES = 69,
- GLMessage_Function_glDeleteShader = 70,
- GLMessage_Function_glDeleteTextures = 71,
- GLMessage_Function_glDeleteVertexArraysOES = 72,
- GLMessage_Function_glDepthFunc = 73,
- GLMessage_Function_glDepthMask = 74,
- GLMessage_Function_glDepthRangef = 75,
- GLMessage_Function_glDepthRangefOES = 76,
- GLMessage_Function_glDepthRangex = 77,
- GLMessage_Function_glDepthRangexOES = 78,
- GLMessage_Function_glDetachShader = 79,
- GLMessage_Function_glDisableClientState = 80,
- GLMessage_Function_glDisableDriverControlQCOM = 81,
- GLMessage_Function_glDisable = 82,
- GLMessage_Function_glDisableVertexAttribArray = 83,
- GLMessage_Function_glDiscardFramebufferEXT = 84,
- GLMessage_Function_glDrawArrays = 85,
- GLMessage_Function_glDrawElements = 86,
- GLMessage_Function_glDrawTexfOES = 87,
- GLMessage_Function_glDrawTexfvOES = 88,
- GLMessage_Function_glDrawTexiOES = 89,
- GLMessage_Function_glDrawTexivOES = 90,
- GLMessage_Function_glDrawTexsOES = 91,
- GLMessage_Function_glDrawTexsvOES = 92,
- GLMessage_Function_glDrawTexxOES = 93,
- GLMessage_Function_glDrawTexxvOES = 94,
- GLMessage_Function_glEGLImageTargetRenderbufferStorageOES = 95,
- GLMessage_Function_glEGLImageTargetTexture2DOES = 96,
- GLMessage_Function_glEnableClientState = 97,
- GLMessage_Function_glEnableDriverControlQCOM = 98,
- GLMessage_Function_glEnable = 99,
- GLMessage_Function_glEnableVertexAttribArray = 100,
- GLMessage_Function_glEndPerfMonitorAMD = 101,
- GLMessage_Function_glEndTilingQCOM = 102,
- GLMessage_Function_glExtGetBufferPointervQCOM = 103,
- GLMessage_Function_glExtGetBuffersQCOM = 104,
- GLMessage_Function_glExtGetFramebuffersQCOM = 105,
- GLMessage_Function_glExtGetProgramBinarySourceQCOM = 106,
- GLMessage_Function_glExtGetProgramsQCOM = 107,
- GLMessage_Function_glExtGetRenderbuffersQCOM = 108,
- GLMessage_Function_glExtGetShadersQCOM = 109,
- GLMessage_Function_glExtGetTexLevelParameterivQCOM = 110,
- GLMessage_Function_glExtGetTexSubImageQCOM = 111,
- GLMessage_Function_glExtGetTexturesQCOM = 112,
- GLMessage_Function_glExtIsProgramBinaryQCOM = 113,
- GLMessage_Function_glExtTexObjectStateOverrideiQCOM = 114,
- GLMessage_Function_glFinishFenceNV = 115,
- GLMessage_Function_glFinish = 116,
- GLMessage_Function_glFlush = 117,
- GLMessage_Function_glFogf = 118,
- GLMessage_Function_glFogfv = 119,
- GLMessage_Function_glFogx = 120,
- GLMessage_Function_glFogxOES = 121,
- GLMessage_Function_glFogxv = 122,
- GLMessage_Function_glFogxvOES = 123,
- GLMessage_Function_glFramebufferRenderbuffer = 124,
- GLMessage_Function_glFramebufferRenderbufferOES = 125,
- GLMessage_Function_glFramebufferTexture2D = 126,
- GLMessage_Function_glFramebufferTexture2DMultisampleIMG = 127,
- GLMessage_Function_glFramebufferTexture2DOES = 128,
- GLMessage_Function_glFramebufferTexture3DOES = 129,
- GLMessage_Function_glFrontFace = 130,
- GLMessage_Function_glFrustumf = 131,
- GLMessage_Function_glFrustumfOES = 132,
- GLMessage_Function_glFrustumx = 133,
- GLMessage_Function_glFrustumxOES = 134,
- GLMessage_Function_glGenBuffers = 135,
- GLMessage_Function_glGenerateMipmap = 136,
- GLMessage_Function_glGenerateMipmapOES = 137,
- GLMessage_Function_glGenFencesNV = 138,
- GLMessage_Function_glGenFramebuffers = 139,
- GLMessage_Function_glGenFramebuffersOES = 140,
- GLMessage_Function_glGenPerfMonitorsAMD = 141,
- GLMessage_Function_glGenRenderbuffers = 142,
- GLMessage_Function_glGenRenderbuffersOES = 143,
- GLMessage_Function_glGenTextures = 144,
- GLMessage_Function_glGenVertexArraysOES = 145,
- GLMessage_Function_glGetActiveAttrib = 146,
- GLMessage_Function_glGetActiveUniform = 147,
- GLMessage_Function_glGetAttachedShaders = 148,
- GLMessage_Function_glGetAttribLocation = 149,
- GLMessage_Function_glGetBooleanv = 150,
- GLMessage_Function_glGetBufferParameteriv = 151,
- GLMessage_Function_glGetBufferPointervOES = 152,
- GLMessage_Function_glGetClipPlanef = 153,
- GLMessage_Function_glGetClipPlanefOES = 154,
- GLMessage_Function_glGetClipPlanex = 155,
- GLMessage_Function_glGetClipPlanexOES = 156,
- GLMessage_Function_glGetDriverControlsQCOM = 157,
- GLMessage_Function_glGetDriverControlStringQCOM = 158,
- GLMessage_Function_glGetError = 159,
- GLMessage_Function_glGetFenceivNV = 160,
- GLMessage_Function_glGetFixedv = 161,
- GLMessage_Function_glGetFixedvOES = 162,
- GLMessage_Function_glGetFloatv = 163,
- GLMessage_Function_glGetFramebufferAttachmentParameteriv = 164,
- GLMessage_Function_glGetFramebufferAttachmentParameterivOES = 165,
- GLMessage_Function_glGetIntegerv = 166,
- GLMessage_Function_glGetLightfv = 167,
- GLMessage_Function_glGetLightxv = 168,
- GLMessage_Function_glGetLightxvOES = 169,
- GLMessage_Function_glGetMaterialfv = 170,
- GLMessage_Function_glGetMaterialxv = 171,
- GLMessage_Function_glGetMaterialxvOES = 172,
- GLMessage_Function_glGetPerfMonitorCounterDataAMD = 173,
- GLMessage_Function_glGetPerfMonitorCounterInfoAMD = 174,
- GLMessage_Function_glGetPerfMonitorCountersAMD = 175,
- GLMessage_Function_glGetPerfMonitorCounterStringAMD = 176,
- GLMessage_Function_glGetPerfMonitorGroupsAMD = 177,
- GLMessage_Function_glGetPerfMonitorGroupStringAMD = 178,
- GLMessage_Function_glGetPointerv = 179,
- GLMessage_Function_glGetProgramBinaryOES = 180,
- GLMessage_Function_glGetProgramInfoLog = 181,
- GLMessage_Function_glGetProgramiv = 182,
- GLMessage_Function_glGetRenderbufferParameteriv = 183,
- GLMessage_Function_glGetRenderbufferParameterivOES = 184,
- GLMessage_Function_glGetShaderInfoLog = 185,
- GLMessage_Function_glGetShaderiv = 186,
- GLMessage_Function_glGetShaderPrecisionFormat = 187,
- GLMessage_Function_glGetShaderSource = 188,
- GLMessage_Function_glGetString = 189,
- GLMessage_Function_glGetTexEnvfv = 190,
- GLMessage_Function_glGetTexEnviv = 191,
- GLMessage_Function_glGetTexEnvxv = 192,
- GLMessage_Function_glGetTexEnvxvOES = 193,
- GLMessage_Function_glGetTexGenfvOES = 194,
- GLMessage_Function_glGetTexGenivOES = 195,
- GLMessage_Function_glGetTexGenxvOES = 196,
- GLMessage_Function_glGetTexParameterfv = 197,
- GLMessage_Function_glGetTexParameteriv = 198,
- GLMessage_Function_glGetTexParameterxv = 199,
- GLMessage_Function_glGetTexParameterxvOES = 200,
- GLMessage_Function_glGetUniformfv = 201,
- GLMessage_Function_glGetUniformiv = 202,
- GLMessage_Function_glGetUniformLocation = 203,
- GLMessage_Function_glGetVertexAttribfv = 204,
- GLMessage_Function_glGetVertexAttribiv = 205,
- GLMessage_Function_glGetVertexAttribPointerv = 206,
- GLMessage_Function_glHint = 207,
- GLMessage_Function_glIsBuffer = 208,
- GLMessage_Function_glIsEnabled = 209,
- GLMessage_Function_glIsFenceNV = 210,
- GLMessage_Function_glIsFramebuffer = 211,
- GLMessage_Function_glIsFramebufferOES = 212,
- GLMessage_Function_glIsProgram = 213,
- GLMessage_Function_glIsRenderbuffer = 214,
- GLMessage_Function_glIsRenderbufferOES = 215,
- GLMessage_Function_glIsShader = 216,
- GLMessage_Function_glIsTexture = 217,
- GLMessage_Function_glIsVertexArrayOES = 218,
- GLMessage_Function_glLightf = 219,
- GLMessage_Function_glLightfv = 220,
- GLMessage_Function_glLightModelf = 221,
- GLMessage_Function_glLightModelfv = 222,
- GLMessage_Function_glLightModelx = 223,
- GLMessage_Function_glLightModelxOES = 224,
- GLMessage_Function_glLightModelxv = 225,
- GLMessage_Function_glLightModelxvOES = 226,
- GLMessage_Function_glLightx = 227,
- GLMessage_Function_glLightxOES = 228,
- GLMessage_Function_glLightxv = 229,
- GLMessage_Function_glLightxvOES = 230,
- GLMessage_Function_glLineWidth = 231,
- GLMessage_Function_glLineWidthx = 232,
- GLMessage_Function_glLineWidthxOES = 233,
- GLMessage_Function_glLinkProgram = 234,
- GLMessage_Function_glLoadIdentity = 235,
- GLMessage_Function_glLoadMatrixf = 236,
- GLMessage_Function_glLoadMatrixx = 237,
- GLMessage_Function_glLoadMatrixxOES = 238,
- GLMessage_Function_glLoadPaletteFromModelViewMatrixOES = 239,
- GLMessage_Function_glLogicOp = 240,
- GLMessage_Function_glMapBufferOES = 241,
- GLMessage_Function_glMaterialf = 242,
- GLMessage_Function_glMaterialfv = 243,
- GLMessage_Function_glMaterialx = 244,
- GLMessage_Function_glMaterialxOES = 245,
- GLMessage_Function_glMaterialxv = 246,
- GLMessage_Function_glMaterialxvOES = 247,
- GLMessage_Function_glMatrixIndexPointerOES = 248,
- GLMessage_Function_glMatrixMode = 249,
- GLMessage_Function_glMultiDrawArraysEXT = 250,
- GLMessage_Function_glMultiDrawElementsEXT = 251,
- GLMessage_Function_glMultiTexCoord4f = 252,
- GLMessage_Function_glMultiTexCoord4x = 253,
- GLMessage_Function_glMultiTexCoord4xOES = 254,
- GLMessage_Function_glMultMatrixf = 255,
- GLMessage_Function_glMultMatrixx = 256,
- GLMessage_Function_glMultMatrixxOES = 257,
- GLMessage_Function_glNormal3f = 258,
- GLMessage_Function_glNormal3x = 259,
- GLMessage_Function_glNormal3xOES = 260,
- GLMessage_Function_glNormalPointer = 261,
- GLMessage_Function_glOrthof = 262,
- GLMessage_Function_glOrthofOES = 263,
- GLMessage_Function_glOrthox = 264,
- GLMessage_Function_glOrthoxOES = 265,
- GLMessage_Function_glPixelStorei = 266,
- GLMessage_Function_glPointParameterf = 267,
- GLMessage_Function_glPointParameterfv = 268,
- GLMessage_Function_glPointParameterx = 269,
- GLMessage_Function_glPointParameterxOES = 270,
- GLMessage_Function_glPointParameterxv = 271,
- GLMessage_Function_glPointParameterxvOES = 272,
- GLMessage_Function_glPointSize = 273,
- GLMessage_Function_glPointSizePointerOES = 274,
- GLMessage_Function_glPointSizex = 275,
- GLMessage_Function_glPointSizexOES = 276,
- GLMessage_Function_glPolygonOffset = 277,
- GLMessage_Function_glPolygonOffsetx = 278,
- GLMessage_Function_glPolygonOffsetxOES = 279,
- GLMessage_Function_glPopMatrix = 280,
- GLMessage_Function_glProgramBinaryOES = 281,
- GLMessage_Function_glPushMatrix = 282,
- GLMessage_Function_glQueryMatrixxOES = 283,
- GLMessage_Function_glReadPixels = 284,
- GLMessage_Function_glReleaseShaderCompiler = 285,
- GLMessage_Function_glRenderbufferStorage = 286,
- GLMessage_Function_glRenderbufferStorageMultisampleIMG = 287,
- GLMessage_Function_glRenderbufferStorageOES = 288,
- GLMessage_Function_glRotatef = 289,
- GLMessage_Function_glRotatex = 290,
- GLMessage_Function_glRotatexOES = 291,
- GLMessage_Function_glSampleCoverage = 292,
- GLMessage_Function_glSampleCoveragex = 293,
- GLMessage_Function_glSampleCoveragexOES = 294,
- GLMessage_Function_glScalef = 295,
- GLMessage_Function_glScalex = 296,
- GLMessage_Function_glScalexOES = 297,
- GLMessage_Function_glScissor = 298,
- GLMessage_Function_glSelectPerfMonitorCountersAMD = 299,
- GLMessage_Function_glSetFenceNV = 300,
- GLMessage_Function_glShadeModel = 301,
- GLMessage_Function_glShaderBinary = 302,
- GLMessage_Function_glShaderSource = 303,
- GLMessage_Function_glStartTilingQCOM = 304,
- GLMessage_Function_glStencilFunc = 305,
- GLMessage_Function_glStencilFuncSeparate = 306,
- GLMessage_Function_glStencilMask = 307,
- GLMessage_Function_glStencilMaskSeparate = 308,
- GLMessage_Function_glStencilOp = 309,
- GLMessage_Function_glStencilOpSeparate = 310,
- GLMessage_Function_glTestFenceNV = 311,
- GLMessage_Function_glTexCoordPointer = 312,
- GLMessage_Function_glTexEnvf = 313,
- GLMessage_Function_glTexEnvfv = 314,
- GLMessage_Function_glTexEnvi = 315,
- GLMessage_Function_glTexEnviv = 316,
- GLMessage_Function_glTexEnvx = 317,
- GLMessage_Function_glTexEnvxOES = 318,
- GLMessage_Function_glTexEnvxv = 319,
- GLMessage_Function_glTexEnvxvOES = 320,
- GLMessage_Function_glTexGenfOES = 321,
- GLMessage_Function_glTexGenfvOES = 322,
- GLMessage_Function_glTexGeniOES = 323,
- GLMessage_Function_glTexGenivOES = 324,
- GLMessage_Function_glTexGenxOES = 325,
- GLMessage_Function_glTexGenxvOES = 326,
- GLMessage_Function_glTexImage2D = 327,
- GLMessage_Function_glTexImage3DOES = 328,
- GLMessage_Function_glTexParameterf = 329,
- GLMessage_Function_glTexParameterfv = 330,
- GLMessage_Function_glTexParameteri = 331,
- GLMessage_Function_glTexParameteriv = 332,
- GLMessage_Function_glTexParameterx = 333,
- GLMessage_Function_glTexParameterxOES = 334,
- GLMessage_Function_glTexParameterxv = 335,
- GLMessage_Function_glTexParameterxvOES = 336,
- GLMessage_Function_glTexSubImage2D = 337,
- GLMessage_Function_glTexSubImage3DOES = 338,
- GLMessage_Function_glTranslatef = 339,
- GLMessage_Function_glTranslatex = 340,
- GLMessage_Function_glTranslatexOES = 341,
- GLMessage_Function_glUniform1f = 342,
- GLMessage_Function_glUniform1fv = 343,
- GLMessage_Function_glUniform1i = 344,
- GLMessage_Function_glUniform1iv = 345,
- GLMessage_Function_glUniform2f = 346,
- GLMessage_Function_glUniform2fv = 347,
- GLMessage_Function_glUniform2i = 348,
- GLMessage_Function_glUniform2iv = 349,
- GLMessage_Function_glUniform3f = 350,
- GLMessage_Function_glUniform3fv = 351,
- GLMessage_Function_glUniform3i = 352,
- GLMessage_Function_glUniform3iv = 353,
- GLMessage_Function_glUniform4f = 354,
- GLMessage_Function_glUniform4fv = 355,
- GLMessage_Function_glUniform4i = 356,
- GLMessage_Function_glUniform4iv = 357,
- GLMessage_Function_glUniformMatrix2fv = 358,
- GLMessage_Function_glUniformMatrix3fv = 359,
- GLMessage_Function_glUniformMatrix4fv = 360,
- GLMessage_Function_glUnmapBufferOES = 361,
- GLMessage_Function_glUseProgram = 362,
- GLMessage_Function_glValidateProgram = 363,
- GLMessage_Function_glVertexAttrib1f = 364,
- GLMessage_Function_glVertexAttrib1fv = 365,
- GLMessage_Function_glVertexAttrib2f = 366,
- GLMessage_Function_glVertexAttrib2fv = 367,
- GLMessage_Function_glVertexAttrib3f = 368,
- GLMessage_Function_glVertexAttrib3fv = 369,
- GLMessage_Function_glVertexAttrib4f = 370,
- GLMessage_Function_glVertexAttrib4fv = 371,
- GLMessage_Function_glVertexAttribPointer = 372,
- GLMessage_Function_glVertexPointer = 373,
- GLMessage_Function_glViewport = 374,
- GLMessage_Function_glWeightPointerOES = 375,
- GLMessage_Function_glActiveShaderProgramEXT = 502,
- GLMessage_Function_glAlphaFuncQCOM = 503,
- GLMessage_Function_glBeginQueryEXT = 504,
- GLMessage_Function_glBindProgramPipelineEXT = 505,
- GLMessage_Function_glBlitFramebufferANGLE = 506,
- GLMessage_Function_glCreateShaderProgramvEXT = 507,
- GLMessage_Function_glDeleteProgramPipelinesEXT = 508,
- GLMessage_Function_glDeleteQueriesEXT = 509,
- GLMessage_Function_glDrawBuffersNV = 510,
- GLMessage_Function_glEndQueryEXT = 511,
- GLMessage_Function_glFramebufferTexture2DMultisampleEXT = 512,
- GLMessage_Function_glGenProgramPipelinesEXT = 513,
- GLMessage_Function_glGenQueriesEXT = 514,
- GLMessage_Function_glGetGraphicsResetStatusEXT = 515,
- GLMessage_Function_glGetObjectLabelEXT = 516,
- GLMessage_Function_glGetProgramPipelineInfoLogEXT = 517,
- GLMessage_Function_glGetProgramPipelineivEXT = 518,
- GLMessage_Function_glGetQueryObjectuivEXT = 519,
- GLMessage_Function_glGetQueryivEXT = 520,
- GLMessage_Function_glGetnUniformfvEXT = 521,
- GLMessage_Function_glGetnUniformivEXT = 521,
- GLMessage_Function_glInsertEventMarkerEXT = 522,
- GLMessage_Function_glIsProgramPipelineEXT = 523,
- GLMessage_Function_glIsQueryEXT = 524,
- GLMessage_Function_glLabelObjectEXT = 525,
- GLMessage_Function_glPopGroupMarkerEXT = 526,
- GLMessage_Function_glProgramParameteriEXT = 527,
- GLMessage_Function_glProgramUniform1fEXT = 528,
- GLMessage_Function_glProgramUniform1fvEXT = 529,
- GLMessage_Function_glProgramUniform1iEXT = 530,
- GLMessage_Function_glProgramUniform1ivEXT = 531,
- GLMessage_Function_glProgramUniform2fEXT = 532,
- GLMessage_Function_glProgramUniform2fvEXT = 533,
- GLMessage_Function_glProgramUniform2iEXT = 534,
- GLMessage_Function_glProgramUniform2ivEXT = 535,
- GLMessage_Function_glProgramUniform3fEXT = 536,
- GLMessage_Function_glProgramUniform3fvEXT = 537,
- GLMessage_Function_glProgramUniform3iEXT = 538,
- GLMessage_Function_glProgramUniform3ivEXT = 539,
- GLMessage_Function_glProgramUniform4fEXT = 540,
- GLMessage_Function_glProgramUniform4fvEXT = 541,
- GLMessage_Function_glProgramUniform4iEXT = 542,
- GLMessage_Function_glProgramUniform4ivEXT = 543,
- GLMessage_Function_glProgramUniformMatrix2fvEXT = 544,
- GLMessage_Function_glProgramUniformMatrix3fvEXT = 545,
- GLMessage_Function_glProgramUniformMatrix4fvEXT = 546,
- GLMessage_Function_glPushGroupMarkerEXT = 547,
- GLMessage_Function_glReadBufferNV = 548,
- GLMessage_Function_glReadnPixelsEXT = 549,
- GLMessage_Function_glRenderbufferStorageMultisampleANGLE = 550,
- GLMessage_Function_glRenderbufferStorageMultisampleAPPLE = 551,
- GLMessage_Function_glRenderbufferStorageMultisampleEXT = 552,
- GLMessage_Function_glResolveMultisampleFramebufferAPPLE = 553,
- GLMessage_Function_glTexStorage1DEXT = 554,
- GLMessage_Function_glTexStorage2DEXT = 555,
- GLMessage_Function_glTexStorage3DEXT = 556,
- GLMessage_Function_glTextureStorage1DEXT = 557,
- GLMessage_Function_glTextureStorage2DEXT = 558,
- GLMessage_Function_glTextureStorage3DEXT = 559,
- GLMessage_Function_glUseProgramStagesEXT = 560,
- GLMessage_Function_glValidateProgramPipelineEXT = 561,
- GLMessage_Function_eglGetDisplay = 2000,
- GLMessage_Function_eglInitialize = 2001,
- GLMessage_Function_eglTerminate = 2002,
- GLMessage_Function_eglGetConfigs = 2003,
- GLMessage_Function_eglChooseConfig = 2004,
- GLMessage_Function_eglGetConfigAttrib = 2005,
- GLMessage_Function_eglCreateWindowSurface = 2006,
- GLMessage_Function_eglCreatePixmapSurface = 2007,
- GLMessage_Function_eglCreatePbufferSurface = 2008,
- GLMessage_Function_eglDestroySurface = 2009,
- GLMessage_Function_eglQuerySurface = 2010,
- GLMessage_Function_eglCreateContext = 2011,
- GLMessage_Function_eglDestroyContext = 2012,
- GLMessage_Function_eglMakeCurrent = 2013,
- GLMessage_Function_eglGetCurrentContext = 2014,
- GLMessage_Function_eglGetCurrentSurface = 2015,
- GLMessage_Function_eglGetCurrentDisplay = 2016,
- GLMessage_Function_eglQueryContext = 2017,
- GLMessage_Function_eglWaitGL = 2018,
- GLMessage_Function_eglWaitNative = 2019,
- GLMessage_Function_eglSwapBuffers = 2020,
- GLMessage_Function_eglCopyBuffers = 2021,
- GLMessage_Function_eglGetError = 2022,
- GLMessage_Function_eglQueryString = 2023,
- GLMessage_Function_eglGetProcAddress = 2024,
- GLMessage_Function_eglSurfaceAttrib = 2025,
- GLMessage_Function_eglBindTexImage = 2026,
- GLMessage_Function_eglReleaseTexImage = 2027,
- GLMessage_Function_eglSwapInterval = 2028,
- GLMessage_Function_eglBindAPI = 2029,
- GLMessage_Function_eglQueryAPI = 2030,
- GLMessage_Function_eglWaitClient = 2031,
- GLMessage_Function_eglReleaseThread = 2032,
- GLMessage_Function_eglCreatePbufferFromClientBuffer = 2033,
- GLMessage_Function_eglLockSurfaceKHR = 2034,
- GLMessage_Function_eglUnlockSurfaceKHR = 2035,
- GLMessage_Function_eglCreateImageKHR = 2036,
- GLMessage_Function_eglDestroyImageKHR = 2037,
- GLMessage_Function_eglCreateSyncKHR = 2038,
- GLMessage_Function_eglDestroySyncKHR = 2039,
- GLMessage_Function_eglClientWaitSyncKHR = 2040,
- GLMessage_Function_eglGetSyncAttribKHR = 2041,
- GLMessage_Function_eglSetSwapRectangleANDROID = 2042,
- GLMessage_Function_eglGetRenderBufferANDROID = 2043,
- GLMessage_Function_eglGetSystemTimeFrequencyNV = 2044,
- GLMessage_Function_eglGetSystemTimeNV = 2045,
- GLMessage_Function_invalid = 3000,
- GLMessage_Function_glVertexAttribPointerData = 3001
-};
-bool GLMessage_Function_IsValid(int value);
-const GLMessage_Function GLMessage_Function_Function_MIN = GLMessage_Function_glActiveTexture;
-const GLMessage_Function GLMessage_Function_Function_MAX = GLMessage_Function_glVertexAttribPointerData;
-const int GLMessage_Function_Function_ARRAYSIZE = GLMessage_Function_Function_MAX + 1;
-
-// ===================================================================
-
-class GLMessage_DataType : public ::google::protobuf::MessageLite {
- public:
- GLMessage_DataType();
- virtual ~GLMessage_DataType();
-
- GLMessage_DataType(const GLMessage_DataType& from);
-
- inline GLMessage_DataType& operator=(const GLMessage_DataType& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const GLMessage_DataType& default_instance();
-
- void Swap(GLMessage_DataType* other);
-
- // implements Message ----------------------------------------------
-
- GLMessage_DataType* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const GLMessage_DataType& from);
- void MergeFrom(const GLMessage_DataType& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- typedef GLMessage_DataType_Type Type;
- static const Type VOID = GLMessage_DataType_Type_VOID;
- static const Type CHAR = GLMessage_DataType_Type_CHAR;
- static const Type BYTE = GLMessage_DataType_Type_BYTE;
- static const Type INT = GLMessage_DataType_Type_INT;
- static const Type FLOAT = GLMessage_DataType_Type_FLOAT;
- static const Type BOOL = GLMessage_DataType_Type_BOOL;
- static const Type ENUM = GLMessage_DataType_Type_ENUM;
- static inline bool Type_IsValid(int value) {
- return GLMessage_DataType_Type_IsValid(value);
- }
- static const Type Type_MIN =
- GLMessage_DataType_Type_Type_MIN;
- static const Type Type_MAX =
- GLMessage_DataType_Type_Type_MAX;
- static const int Type_ARRAYSIZE =
- GLMessage_DataType_Type_Type_ARRAYSIZE;
-
- // accessors -------------------------------------------------------
-
- // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
- inline bool has_type() const;
- inline void clear_type();
- static const int kTypeFieldNumber = 1;
- inline ::android::gltrace::GLMessage_DataType_Type type() const;
- inline void set_type(::android::gltrace::GLMessage_DataType_Type value);
-
- // required bool isArray = 2 [default = false];
- inline bool has_isarray() const;
- inline void clear_isarray();
- static const int kIsArrayFieldNumber = 2;
- inline bool isarray() const;
- inline void set_isarray(bool value);
-
- // repeated int32 intValue = 3;
- inline int intvalue_size() const;
- inline void clear_intvalue();
- static const int kIntValueFieldNumber = 3;
- inline ::google::protobuf::int32 intvalue(int index) const;
- inline void set_intvalue(int index, ::google::protobuf::int32 value);
- inline void add_intvalue(::google::protobuf::int32 value);
- inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
- intvalue() const;
- inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
- mutable_intvalue();
-
- // repeated float floatValue = 4;
- inline int floatvalue_size() const;
- inline void clear_floatvalue();
- static const int kFloatValueFieldNumber = 4;
- inline float floatvalue(int index) const;
- inline void set_floatvalue(int index, float value);
- inline void add_floatvalue(float value);
- inline const ::google::protobuf::RepeatedField< float >&
- floatvalue() const;
- inline ::google::protobuf::RepeatedField< float >*
- mutable_floatvalue();
-
- // repeated bytes charValue = 5;
- inline int charvalue_size() const;
- inline void clear_charvalue();
- static const int kCharValueFieldNumber = 5;
- inline const ::std::string& charvalue(int index) const;
- inline ::std::string* mutable_charvalue(int index);
- inline void set_charvalue(int index, const ::std::string& value);
- inline void set_charvalue(int index, const char* value);
- inline void set_charvalue(int index, const void* value, size_t size);
- inline ::std::string* add_charvalue();
- inline void add_charvalue(const ::std::string& value);
- inline void add_charvalue(const char* value);
- inline void add_charvalue(const void* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& charvalue() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_charvalue();
-
- // repeated bytes rawBytes = 6;
- inline int rawbytes_size() const;
- inline void clear_rawbytes();
- static const int kRawBytesFieldNumber = 6;
- inline const ::std::string& rawbytes(int index) const;
- inline ::std::string* mutable_rawbytes(int index);
- inline void set_rawbytes(int index, const ::std::string& value);
- inline void set_rawbytes(int index, const char* value);
- inline void set_rawbytes(int index, const void* value, size_t size);
- inline ::std::string* add_rawbytes();
- inline void add_rawbytes(const ::std::string& value);
- inline void add_rawbytes(const char* value);
- inline void add_rawbytes(const void* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& rawbytes() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_rawbytes();
-
- // repeated bool boolValue = 7;
- inline int boolvalue_size() const;
- inline void clear_boolvalue();
- static const int kBoolValueFieldNumber = 7;
- inline bool boolvalue(int index) const;
- inline void set_boolvalue(int index, bool value);
- inline void add_boolvalue(bool value);
- inline const ::google::protobuf::RepeatedField< bool >&
- boolvalue() const;
- inline ::google::protobuf::RepeatedField< bool >*
- mutable_boolvalue();
-
- // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.DataType)
- private:
- mutable int _cached_size_;
-
- int type_;
- bool isarray_;
- ::google::protobuf::RepeatedField< ::google::protobuf::int32 > intvalue_;
- ::google::protobuf::RepeatedField< float > floatvalue_;
- ::google::protobuf::RepeatedPtrField< ::std::string> charvalue_;
- ::google::protobuf::RepeatedPtrField< ::std::string> rawbytes_;
- ::google::protobuf::RepeatedField< bool > boolvalue_;
- friend void protobuf_AddDesc_gltrace_2eproto();
- friend void protobuf_AssignDesc_gltrace_2eproto();
- friend void protobuf_ShutdownFile_gltrace_2eproto();
-
- ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32];
-
- // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
- inline bool _has_bit(int index) const {
- return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
- }
- inline void _set_bit(int index) {
- _has_bits_[index / 32] |= (1u << (index % 32));
- }
- inline void _clear_bit(int index) {
- _has_bits_[index / 32] &= ~(1u << (index % 32));
- }
-
- void InitAsDefaultInstance();
- static GLMessage_DataType* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class GLMessage_FrameBuffer : public ::google::protobuf::MessageLite {
- public:
- GLMessage_FrameBuffer();
- virtual ~GLMessage_FrameBuffer();
-
- GLMessage_FrameBuffer(const GLMessage_FrameBuffer& from);
-
- inline GLMessage_FrameBuffer& operator=(const GLMessage_FrameBuffer& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const GLMessage_FrameBuffer& default_instance();
-
- void Swap(GLMessage_FrameBuffer* other);
-
- // implements Message ----------------------------------------------
-
- GLMessage_FrameBuffer* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const GLMessage_FrameBuffer& from);
- void MergeFrom(const GLMessage_FrameBuffer& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // required int32 width = 1;
- inline bool has_width() const;
- inline void clear_width();
- static const int kWidthFieldNumber = 1;
- inline ::google::protobuf::int32 width() const;
- inline void set_width(::google::protobuf::int32 value);
-
- // required int32 height = 2;
- inline bool has_height() const;
- inline void clear_height();
- static const int kHeightFieldNumber = 2;
- inline ::google::protobuf::int32 height() const;
- inline void set_height(::google::protobuf::int32 value);
-
- // repeated bytes contents = 3;
- inline int contents_size() const;
- inline void clear_contents();
- static const int kContentsFieldNumber = 3;
- inline const ::std::string& contents(int index) const;
- inline ::std::string* mutable_contents(int index);
- inline void set_contents(int index, const ::std::string& value);
- inline void set_contents(int index, const char* value);
- inline void set_contents(int index, const void* value, size_t size);
- inline ::std::string* add_contents();
- inline void add_contents(const ::std::string& value);
- inline void add_contents(const char* value);
- inline void add_contents(const void* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& contents() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_contents();
-
- // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.FrameBuffer)
- private:
- mutable int _cached_size_;
-
- ::google::protobuf::int32 width_;
- ::google::protobuf::int32 height_;
- ::google::protobuf::RepeatedPtrField< ::std::string> contents_;
- friend void protobuf_AddDesc_gltrace_2eproto();
- friend void protobuf_AssignDesc_gltrace_2eproto();
- friend void protobuf_ShutdownFile_gltrace_2eproto();
-
- ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
-
- // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
- inline bool _has_bit(int index) const {
- return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
- }
- inline void _set_bit(int index) {
- _has_bits_[index / 32] |= (1u << (index % 32));
- }
- inline void _clear_bit(int index) {
- _has_bits_[index / 32] &= ~(1u << (index % 32));
- }
-
- void InitAsDefaultInstance();
- static GLMessage_FrameBuffer* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class GLMessage : public ::google::protobuf::MessageLite {
- public:
- GLMessage();
- virtual ~GLMessage();
-
- GLMessage(const GLMessage& from);
-
- inline GLMessage& operator=(const GLMessage& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const GLMessage& default_instance();
-
- void Swap(GLMessage* other);
-
- // implements Message ----------------------------------------------
-
- GLMessage* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const GLMessage& from);
- void MergeFrom(const GLMessage& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- typedef GLMessage_DataType DataType;
- typedef GLMessage_FrameBuffer FrameBuffer;
-
- typedef GLMessage_Function Function;
- static const Function glActiveTexture = GLMessage_Function_glActiveTexture;
- static const Function glAlphaFunc = GLMessage_Function_glAlphaFunc;
- static const Function glAlphaFuncx = GLMessage_Function_glAlphaFuncx;
- static const Function glAlphaFuncxOES = GLMessage_Function_glAlphaFuncxOES;
- static const Function glAttachShader = GLMessage_Function_glAttachShader;
- static const Function glBeginPerfMonitorAMD = GLMessage_Function_glBeginPerfMonitorAMD;
- static const Function glBindAttribLocation = GLMessage_Function_glBindAttribLocation;
- static const Function glBindBuffer = GLMessage_Function_glBindBuffer;
- static const Function glBindFramebuffer = GLMessage_Function_glBindFramebuffer;
- static const Function glBindFramebufferOES = GLMessage_Function_glBindFramebufferOES;
- static const Function glBindRenderbuffer = GLMessage_Function_glBindRenderbuffer;
- static const Function glBindRenderbufferOES = GLMessage_Function_glBindRenderbufferOES;
- static const Function glBindTexture = GLMessage_Function_glBindTexture;
- static const Function glBindVertexArrayOES = GLMessage_Function_glBindVertexArrayOES;
- static const Function glBlendColor = GLMessage_Function_glBlendColor;
- static const Function glBlendEquation = GLMessage_Function_glBlendEquation;
- static const Function glBlendEquationOES = GLMessage_Function_glBlendEquationOES;
- static const Function glBlendEquationSeparate = GLMessage_Function_glBlendEquationSeparate;
- static const Function glBlendEquationSeparateOES = GLMessage_Function_glBlendEquationSeparateOES;
- static const Function glBlendFunc = GLMessage_Function_glBlendFunc;
- static const Function glBlendFuncSeparate = GLMessage_Function_glBlendFuncSeparate;
- static const Function glBlendFuncSeparateOES = GLMessage_Function_glBlendFuncSeparateOES;
- static const Function glBufferData = GLMessage_Function_glBufferData;
- static const Function glBufferSubData = GLMessage_Function_glBufferSubData;
- static const Function glCheckFramebufferStatus = GLMessage_Function_glCheckFramebufferStatus;
- static const Function glCheckFramebufferStatusOES = GLMessage_Function_glCheckFramebufferStatusOES;
- static const Function glClearColor = GLMessage_Function_glClearColor;
- static const Function glClearColorx = GLMessage_Function_glClearColorx;
- static const Function glClearColorxOES = GLMessage_Function_glClearColorxOES;
- static const Function glClearDepthf = GLMessage_Function_glClearDepthf;
- static const Function glClearDepthfOES = GLMessage_Function_glClearDepthfOES;
- static const Function glClearDepthx = GLMessage_Function_glClearDepthx;
- static const Function glClearDepthxOES = GLMessage_Function_glClearDepthxOES;
- static const Function glClear = GLMessage_Function_glClear;
- static const Function glClearStencil = GLMessage_Function_glClearStencil;
- static const Function glClientActiveTexture = GLMessage_Function_glClientActiveTexture;
- static const Function glClipPlanef = GLMessage_Function_glClipPlanef;
- static const Function glClipPlanefIMG = GLMessage_Function_glClipPlanefIMG;
- static const Function glClipPlanefOES = GLMessage_Function_glClipPlanefOES;
- static const Function glClipPlanex = GLMessage_Function_glClipPlanex;
- static const Function glClipPlanexIMG = GLMessage_Function_glClipPlanexIMG;
- static const Function glClipPlanexOES = GLMessage_Function_glClipPlanexOES;
- static const Function glColor4f = GLMessage_Function_glColor4f;
- static const Function glColor4ub = GLMessage_Function_glColor4ub;
- static const Function glColor4x = GLMessage_Function_glColor4x;
- static const Function glColor4xOES = GLMessage_Function_glColor4xOES;
- static const Function glColorMask = GLMessage_Function_glColorMask;
- static const Function glColorPointer = GLMessage_Function_glColorPointer;
- static const Function glCompileShader = GLMessage_Function_glCompileShader;
- static const Function glCompressedTexImage2D = GLMessage_Function_glCompressedTexImage2D;
- static const Function glCompressedTexImage3DOES = GLMessage_Function_glCompressedTexImage3DOES;
- static const Function glCompressedTexSubImage2D = GLMessage_Function_glCompressedTexSubImage2D;
- static const Function glCompressedTexSubImage3DOES = GLMessage_Function_glCompressedTexSubImage3DOES;
- static const Function glCopyTexImage2D = GLMessage_Function_glCopyTexImage2D;
- static const Function glCopyTexSubImage2D = GLMessage_Function_glCopyTexSubImage2D;
- static const Function glCopyTexSubImage3DOES = GLMessage_Function_glCopyTexSubImage3DOES;
- static const Function glCoverageMaskNV = GLMessage_Function_glCoverageMaskNV;
- static const Function glCoverageOperationNV = GLMessage_Function_glCoverageOperationNV;
- static const Function glCreateProgram = GLMessage_Function_glCreateProgram;
- static const Function glCreateShader = GLMessage_Function_glCreateShader;
- static const Function glCullFace = GLMessage_Function_glCullFace;
- static const Function glCurrentPaletteMatrixOES = GLMessage_Function_glCurrentPaletteMatrixOES;
- static const Function glDeleteBuffers = GLMessage_Function_glDeleteBuffers;
- static const Function glDeleteFencesNV = GLMessage_Function_glDeleteFencesNV;
- static const Function glDeleteFramebuffers = GLMessage_Function_glDeleteFramebuffers;
- static const Function glDeleteFramebuffersOES = GLMessage_Function_glDeleteFramebuffersOES;
- static const Function glDeletePerfMonitorsAMD = GLMessage_Function_glDeletePerfMonitorsAMD;
- static const Function glDeleteProgram = GLMessage_Function_glDeleteProgram;
- static const Function glDeleteRenderbuffers = GLMessage_Function_glDeleteRenderbuffers;
- static const Function glDeleteRenderbuffersOES = GLMessage_Function_glDeleteRenderbuffersOES;
- static const Function glDeleteShader = GLMessage_Function_glDeleteShader;
- static const Function glDeleteTextures = GLMessage_Function_glDeleteTextures;
- static const Function glDeleteVertexArraysOES = GLMessage_Function_glDeleteVertexArraysOES;
- static const Function glDepthFunc = GLMessage_Function_glDepthFunc;
- static const Function glDepthMask = GLMessage_Function_glDepthMask;
- static const Function glDepthRangef = GLMessage_Function_glDepthRangef;
- static const Function glDepthRangefOES = GLMessage_Function_glDepthRangefOES;
- static const Function glDepthRangex = GLMessage_Function_glDepthRangex;
- static const Function glDepthRangexOES = GLMessage_Function_glDepthRangexOES;
- static const Function glDetachShader = GLMessage_Function_glDetachShader;
- static const Function glDisableClientState = GLMessage_Function_glDisableClientState;
- static const Function glDisableDriverControlQCOM = GLMessage_Function_glDisableDriverControlQCOM;
- static const Function glDisable = GLMessage_Function_glDisable;
- static const Function glDisableVertexAttribArray = GLMessage_Function_glDisableVertexAttribArray;
- static const Function glDiscardFramebufferEXT = GLMessage_Function_glDiscardFramebufferEXT;
- static const Function glDrawArrays = GLMessage_Function_glDrawArrays;
- static const Function glDrawElements = GLMessage_Function_glDrawElements;
- static const Function glDrawTexfOES = GLMessage_Function_glDrawTexfOES;
- static const Function glDrawTexfvOES = GLMessage_Function_glDrawTexfvOES;
- static const Function glDrawTexiOES = GLMessage_Function_glDrawTexiOES;
- static const Function glDrawTexivOES = GLMessage_Function_glDrawTexivOES;
- static const Function glDrawTexsOES = GLMessage_Function_glDrawTexsOES;
- static const Function glDrawTexsvOES = GLMessage_Function_glDrawTexsvOES;
- static const Function glDrawTexxOES = GLMessage_Function_glDrawTexxOES;
- static const Function glDrawTexxvOES = GLMessage_Function_glDrawTexxvOES;
- static const Function glEGLImageTargetRenderbufferStorageOES = GLMessage_Function_glEGLImageTargetRenderbufferStorageOES;
- static const Function glEGLImageTargetTexture2DOES = GLMessage_Function_glEGLImageTargetTexture2DOES;
- static const Function glEnableClientState = GLMessage_Function_glEnableClientState;
- static const Function glEnableDriverControlQCOM = GLMessage_Function_glEnableDriverControlQCOM;
- static const Function glEnable = GLMessage_Function_glEnable;
- static const Function glEnableVertexAttribArray = GLMessage_Function_glEnableVertexAttribArray;
- static const Function glEndPerfMonitorAMD = GLMessage_Function_glEndPerfMonitorAMD;
- static const Function glEndTilingQCOM = GLMessage_Function_glEndTilingQCOM;
- static const Function glExtGetBufferPointervQCOM = GLMessage_Function_glExtGetBufferPointervQCOM;
- static const Function glExtGetBuffersQCOM = GLMessage_Function_glExtGetBuffersQCOM;
- static const Function glExtGetFramebuffersQCOM = GLMessage_Function_glExtGetFramebuffersQCOM;
- static const Function glExtGetProgramBinarySourceQCOM = GLMessage_Function_glExtGetProgramBinarySourceQCOM;
- static const Function glExtGetProgramsQCOM = GLMessage_Function_glExtGetProgramsQCOM;
- static const Function glExtGetRenderbuffersQCOM = GLMessage_Function_glExtGetRenderbuffersQCOM;
- static const Function glExtGetShadersQCOM = GLMessage_Function_glExtGetShadersQCOM;
- static const Function glExtGetTexLevelParameterivQCOM = GLMessage_Function_glExtGetTexLevelParameterivQCOM;
- static const Function glExtGetTexSubImageQCOM = GLMessage_Function_glExtGetTexSubImageQCOM;
- static const Function glExtGetTexturesQCOM = GLMessage_Function_glExtGetTexturesQCOM;
- static const Function glExtIsProgramBinaryQCOM = GLMessage_Function_glExtIsProgramBinaryQCOM;
- static const Function glExtTexObjectStateOverrideiQCOM = GLMessage_Function_glExtTexObjectStateOverrideiQCOM;
- static const Function glFinishFenceNV = GLMessage_Function_glFinishFenceNV;
- static const Function glFinish = GLMessage_Function_glFinish;
- static const Function glFlush = GLMessage_Function_glFlush;
- static const Function glFogf = GLMessage_Function_glFogf;
- static const Function glFogfv = GLMessage_Function_glFogfv;
- static const Function glFogx = GLMessage_Function_glFogx;
- static const Function glFogxOES = GLMessage_Function_glFogxOES;
- static const Function glFogxv = GLMessage_Function_glFogxv;
- static const Function glFogxvOES = GLMessage_Function_glFogxvOES;
- static const Function glFramebufferRenderbuffer = GLMessage_Function_glFramebufferRenderbuffer;
- static const Function glFramebufferRenderbufferOES = GLMessage_Function_glFramebufferRenderbufferOES;
- static const Function glFramebufferTexture2D = GLMessage_Function_glFramebufferTexture2D;
- static const Function glFramebufferTexture2DMultisampleIMG = GLMessage_Function_glFramebufferTexture2DMultisampleIMG;
- static const Function glFramebufferTexture2DOES = GLMessage_Function_glFramebufferTexture2DOES;
- static const Function glFramebufferTexture3DOES = GLMessage_Function_glFramebufferTexture3DOES;
- static const Function glFrontFace = GLMessage_Function_glFrontFace;
- static const Function glFrustumf = GLMessage_Function_glFrustumf;
- static const Function glFrustumfOES = GLMessage_Function_glFrustumfOES;
- static const Function glFrustumx = GLMessage_Function_glFrustumx;
- static const Function glFrustumxOES = GLMessage_Function_glFrustumxOES;
- static const Function glGenBuffers = GLMessage_Function_glGenBuffers;
- static const Function glGenerateMipmap = GLMessage_Function_glGenerateMipmap;
- static const Function glGenerateMipmapOES = GLMessage_Function_glGenerateMipmapOES;
- static const Function glGenFencesNV = GLMessage_Function_glGenFencesNV;
- static const Function glGenFramebuffers = GLMessage_Function_glGenFramebuffers;
- static const Function glGenFramebuffersOES = GLMessage_Function_glGenFramebuffersOES;
- static const Function glGenPerfMonitorsAMD = GLMessage_Function_glGenPerfMonitorsAMD;
- static const Function glGenRenderbuffers = GLMessage_Function_glGenRenderbuffers;
- static const Function glGenRenderbuffersOES = GLMessage_Function_glGenRenderbuffersOES;
- static const Function glGenTextures = GLMessage_Function_glGenTextures;
- static const Function glGenVertexArraysOES = GLMessage_Function_glGenVertexArraysOES;
- static const Function glGetActiveAttrib = GLMessage_Function_glGetActiveAttrib;
- static const Function glGetActiveUniform = GLMessage_Function_glGetActiveUniform;
- static const Function glGetAttachedShaders = GLMessage_Function_glGetAttachedShaders;
- static const Function glGetAttribLocation = GLMessage_Function_glGetAttribLocation;
- static const Function glGetBooleanv = GLMessage_Function_glGetBooleanv;
- static const Function glGetBufferParameteriv = GLMessage_Function_glGetBufferParameteriv;
- static const Function glGetBufferPointervOES = GLMessage_Function_glGetBufferPointervOES;
- static const Function glGetClipPlanef = GLMessage_Function_glGetClipPlanef;
- static const Function glGetClipPlanefOES = GLMessage_Function_glGetClipPlanefOES;
- static const Function glGetClipPlanex = GLMessage_Function_glGetClipPlanex;
- static const Function glGetClipPlanexOES = GLMessage_Function_glGetClipPlanexOES;
- static const Function glGetDriverControlsQCOM = GLMessage_Function_glGetDriverControlsQCOM;
- static const Function glGetDriverControlStringQCOM = GLMessage_Function_glGetDriverControlStringQCOM;
- static const Function glGetError = GLMessage_Function_glGetError;
- static const Function glGetFenceivNV = GLMessage_Function_glGetFenceivNV;
- static const Function glGetFixedv = GLMessage_Function_glGetFixedv;
- static const Function glGetFixedvOES = GLMessage_Function_glGetFixedvOES;
- static const Function glGetFloatv = GLMessage_Function_glGetFloatv;
- static const Function glGetFramebufferAttachmentParameteriv = GLMessage_Function_glGetFramebufferAttachmentParameteriv;
- static const Function glGetFramebufferAttachmentParameterivOES = GLMessage_Function_glGetFramebufferAttachmentParameterivOES;
- static const Function glGetIntegerv = GLMessage_Function_glGetIntegerv;
- static const Function glGetLightfv = GLMessage_Function_glGetLightfv;
- static const Function glGetLightxv = GLMessage_Function_glGetLightxv;
- static const Function glGetLightxvOES = GLMessage_Function_glGetLightxvOES;
- static const Function glGetMaterialfv = GLMessage_Function_glGetMaterialfv;
- static const Function glGetMaterialxv = GLMessage_Function_glGetMaterialxv;
- static const Function glGetMaterialxvOES = GLMessage_Function_glGetMaterialxvOES;
- static const Function glGetPerfMonitorCounterDataAMD = GLMessage_Function_glGetPerfMonitorCounterDataAMD;
- static const Function glGetPerfMonitorCounterInfoAMD = GLMessage_Function_glGetPerfMonitorCounterInfoAMD;
- static const Function glGetPerfMonitorCountersAMD = GLMessage_Function_glGetPerfMonitorCountersAMD;
- static const Function glGetPerfMonitorCounterStringAMD = GLMessage_Function_glGetPerfMonitorCounterStringAMD;
- static const Function glGetPerfMonitorGroupsAMD = GLMessage_Function_glGetPerfMonitorGroupsAMD;
- static const Function glGetPerfMonitorGroupStringAMD = GLMessage_Function_glGetPerfMonitorGroupStringAMD;
- static const Function glGetPointerv = GLMessage_Function_glGetPointerv;
- static const Function glGetProgramBinaryOES = GLMessage_Function_glGetProgramBinaryOES;
- static const Function glGetProgramInfoLog = GLMessage_Function_glGetProgramInfoLog;
- static const Function glGetProgramiv = GLMessage_Function_glGetProgramiv;
- static const Function glGetRenderbufferParameteriv = GLMessage_Function_glGetRenderbufferParameteriv;
- static const Function glGetRenderbufferParameterivOES = GLMessage_Function_glGetRenderbufferParameterivOES;
- static const Function glGetShaderInfoLog = GLMessage_Function_glGetShaderInfoLog;
- static const Function glGetShaderiv = GLMessage_Function_glGetShaderiv;
- static const Function glGetShaderPrecisionFormat = GLMessage_Function_glGetShaderPrecisionFormat;
- static const Function glGetShaderSource = GLMessage_Function_glGetShaderSource;
- static const Function glGetString = GLMessage_Function_glGetString;
- static const Function glGetTexEnvfv = GLMessage_Function_glGetTexEnvfv;
- static const Function glGetTexEnviv = GLMessage_Function_glGetTexEnviv;
- static const Function glGetTexEnvxv = GLMessage_Function_glGetTexEnvxv;
- static const Function glGetTexEnvxvOES = GLMessage_Function_glGetTexEnvxvOES;
- static const Function glGetTexGenfvOES = GLMessage_Function_glGetTexGenfvOES;
- static const Function glGetTexGenivOES = GLMessage_Function_glGetTexGenivOES;
- static const Function glGetTexGenxvOES = GLMessage_Function_glGetTexGenxvOES;
- static const Function glGetTexParameterfv = GLMessage_Function_glGetTexParameterfv;
- static const Function glGetTexParameteriv = GLMessage_Function_glGetTexParameteriv;
- static const Function glGetTexParameterxv = GLMessage_Function_glGetTexParameterxv;
- static const Function glGetTexParameterxvOES = GLMessage_Function_glGetTexParameterxvOES;
- static const Function glGetUniformfv = GLMessage_Function_glGetUniformfv;
- static const Function glGetUniformiv = GLMessage_Function_glGetUniformiv;
- static const Function glGetUniformLocation = GLMessage_Function_glGetUniformLocation;
- static const Function glGetVertexAttribfv = GLMessage_Function_glGetVertexAttribfv;
- static const Function glGetVertexAttribiv = GLMessage_Function_glGetVertexAttribiv;
- static const Function glGetVertexAttribPointerv = GLMessage_Function_glGetVertexAttribPointerv;
- static const Function glHint = GLMessage_Function_glHint;
- static const Function glIsBuffer = GLMessage_Function_glIsBuffer;
- static const Function glIsEnabled = GLMessage_Function_glIsEnabled;
- static const Function glIsFenceNV = GLMessage_Function_glIsFenceNV;
- static const Function glIsFramebuffer = GLMessage_Function_glIsFramebuffer;
- static const Function glIsFramebufferOES = GLMessage_Function_glIsFramebufferOES;
- static const Function glIsProgram = GLMessage_Function_glIsProgram;
- static const Function glIsRenderbuffer = GLMessage_Function_glIsRenderbuffer;
- static const Function glIsRenderbufferOES = GLMessage_Function_glIsRenderbufferOES;
- static const Function glIsShader = GLMessage_Function_glIsShader;
- static const Function glIsTexture = GLMessage_Function_glIsTexture;
- static const Function glIsVertexArrayOES = GLMessage_Function_glIsVertexArrayOES;
- static const Function glLightf = GLMessage_Function_glLightf;
- static const Function glLightfv = GLMessage_Function_glLightfv;
- static const Function glLightModelf = GLMessage_Function_glLightModelf;
- static const Function glLightModelfv = GLMessage_Function_glLightModelfv;
- static const Function glLightModelx = GLMessage_Function_glLightModelx;
- static const Function glLightModelxOES = GLMessage_Function_glLightModelxOES;
- static const Function glLightModelxv = GLMessage_Function_glLightModelxv;
- static const Function glLightModelxvOES = GLMessage_Function_glLightModelxvOES;
- static const Function glLightx = GLMessage_Function_glLightx;
- static const Function glLightxOES = GLMessage_Function_glLightxOES;
- static const Function glLightxv = GLMessage_Function_glLightxv;
- static const Function glLightxvOES = GLMessage_Function_glLightxvOES;
- static const Function glLineWidth = GLMessage_Function_glLineWidth;
- static const Function glLineWidthx = GLMessage_Function_glLineWidthx;
- static const Function glLineWidthxOES = GLMessage_Function_glLineWidthxOES;
- static const Function glLinkProgram = GLMessage_Function_glLinkProgram;
- static const Function glLoadIdentity = GLMessage_Function_glLoadIdentity;
- static const Function glLoadMatrixf = GLMessage_Function_glLoadMatrixf;
- static const Function glLoadMatrixx = GLMessage_Function_glLoadMatrixx;
- static const Function glLoadMatrixxOES = GLMessage_Function_glLoadMatrixxOES;
- static const Function glLoadPaletteFromModelViewMatrixOES = GLMessage_Function_glLoadPaletteFromModelViewMatrixOES;
- static const Function glLogicOp = GLMessage_Function_glLogicOp;
- static const Function glMapBufferOES = GLMessage_Function_glMapBufferOES;
- static const Function glMaterialf = GLMessage_Function_glMaterialf;
- static const Function glMaterialfv = GLMessage_Function_glMaterialfv;
- static const Function glMaterialx = GLMessage_Function_glMaterialx;
- static const Function glMaterialxOES = GLMessage_Function_glMaterialxOES;
- static const Function glMaterialxv = GLMessage_Function_glMaterialxv;
- static const Function glMaterialxvOES = GLMessage_Function_glMaterialxvOES;
- static const Function glMatrixIndexPointerOES = GLMessage_Function_glMatrixIndexPointerOES;
- static const Function glMatrixMode = GLMessage_Function_glMatrixMode;
- static const Function glMultiDrawArraysEXT = GLMessage_Function_glMultiDrawArraysEXT;
- static const Function glMultiDrawElementsEXT = GLMessage_Function_glMultiDrawElementsEXT;
- static const Function glMultiTexCoord4f = GLMessage_Function_glMultiTexCoord4f;
- static const Function glMultiTexCoord4x = GLMessage_Function_glMultiTexCoord4x;
- static const Function glMultiTexCoord4xOES = GLMessage_Function_glMultiTexCoord4xOES;
- static const Function glMultMatrixf = GLMessage_Function_glMultMatrixf;
- static const Function glMultMatrixx = GLMessage_Function_glMultMatrixx;
- static const Function glMultMatrixxOES = GLMessage_Function_glMultMatrixxOES;
- static const Function glNormal3f = GLMessage_Function_glNormal3f;
- static const Function glNormal3x = GLMessage_Function_glNormal3x;
- static const Function glNormal3xOES = GLMessage_Function_glNormal3xOES;
- static const Function glNormalPointer = GLMessage_Function_glNormalPointer;
- static const Function glOrthof = GLMessage_Function_glOrthof;
- static const Function glOrthofOES = GLMessage_Function_glOrthofOES;
- static const Function glOrthox = GLMessage_Function_glOrthox;
- static const Function glOrthoxOES = GLMessage_Function_glOrthoxOES;
- static const Function glPixelStorei = GLMessage_Function_glPixelStorei;
- static const Function glPointParameterf = GLMessage_Function_glPointParameterf;
- static const Function glPointParameterfv = GLMessage_Function_glPointParameterfv;
- static const Function glPointParameterx = GLMessage_Function_glPointParameterx;
- static const Function glPointParameterxOES = GLMessage_Function_glPointParameterxOES;
- static const Function glPointParameterxv = GLMessage_Function_glPointParameterxv;
- static const Function glPointParameterxvOES = GLMessage_Function_glPointParameterxvOES;
- static const Function glPointSize = GLMessage_Function_glPointSize;
- static const Function glPointSizePointerOES = GLMessage_Function_glPointSizePointerOES;
- static const Function glPointSizex = GLMessage_Function_glPointSizex;
- static const Function glPointSizexOES = GLMessage_Function_glPointSizexOES;
- static const Function glPolygonOffset = GLMessage_Function_glPolygonOffset;
- static const Function glPolygonOffsetx = GLMessage_Function_glPolygonOffsetx;
- static const Function glPolygonOffsetxOES = GLMessage_Function_glPolygonOffsetxOES;
- static const Function glPopMatrix = GLMessage_Function_glPopMatrix;
- static const Function glProgramBinaryOES = GLMessage_Function_glProgramBinaryOES;
- static const Function glPushMatrix = GLMessage_Function_glPushMatrix;
- static const Function glQueryMatrixxOES = GLMessage_Function_glQueryMatrixxOES;
- static const Function glReadPixels = GLMessage_Function_glReadPixels;
- static const Function glReleaseShaderCompiler = GLMessage_Function_glReleaseShaderCompiler;
- static const Function glRenderbufferStorage = GLMessage_Function_glRenderbufferStorage;
- static const Function glRenderbufferStorageMultisampleIMG = GLMessage_Function_glRenderbufferStorageMultisampleIMG;
- static const Function glRenderbufferStorageOES = GLMessage_Function_glRenderbufferStorageOES;
- static const Function glRotatef = GLMessage_Function_glRotatef;
- static const Function glRotatex = GLMessage_Function_glRotatex;
- static const Function glRotatexOES = GLMessage_Function_glRotatexOES;
- static const Function glSampleCoverage = GLMessage_Function_glSampleCoverage;
- static const Function glSampleCoveragex = GLMessage_Function_glSampleCoveragex;
- static const Function glSampleCoveragexOES = GLMessage_Function_glSampleCoveragexOES;
- static const Function glScalef = GLMessage_Function_glScalef;
- static const Function glScalex = GLMessage_Function_glScalex;
- static const Function glScalexOES = GLMessage_Function_glScalexOES;
- static const Function glScissor = GLMessage_Function_glScissor;
- static const Function glSelectPerfMonitorCountersAMD = GLMessage_Function_glSelectPerfMonitorCountersAMD;
- static const Function glSetFenceNV = GLMessage_Function_glSetFenceNV;
- static const Function glShadeModel = GLMessage_Function_glShadeModel;
- static const Function glShaderBinary = GLMessage_Function_glShaderBinary;
- static const Function glShaderSource = GLMessage_Function_glShaderSource;
- static const Function glStartTilingQCOM = GLMessage_Function_glStartTilingQCOM;
- static const Function glStencilFunc = GLMessage_Function_glStencilFunc;
- static const Function glStencilFuncSeparate = GLMessage_Function_glStencilFuncSeparate;
- static const Function glStencilMask = GLMessage_Function_glStencilMask;
- static const Function glStencilMaskSeparate = GLMessage_Function_glStencilMaskSeparate;
- static const Function glStencilOp = GLMessage_Function_glStencilOp;
- static const Function glStencilOpSeparate = GLMessage_Function_glStencilOpSeparate;
- static const Function glTestFenceNV = GLMessage_Function_glTestFenceNV;
- static const Function glTexCoordPointer = GLMessage_Function_glTexCoordPointer;
- static const Function glTexEnvf = GLMessage_Function_glTexEnvf;
- static const Function glTexEnvfv = GLMessage_Function_glTexEnvfv;
- static const Function glTexEnvi = GLMessage_Function_glTexEnvi;
- static const Function glTexEnviv = GLMessage_Function_glTexEnviv;
- static const Function glTexEnvx = GLMessage_Function_glTexEnvx;
- static const Function glTexEnvxOES = GLMessage_Function_glTexEnvxOES;
- static const Function glTexEnvxv = GLMessage_Function_glTexEnvxv;
- static const Function glTexEnvxvOES = GLMessage_Function_glTexEnvxvOES;
- static const Function glTexGenfOES = GLMessage_Function_glTexGenfOES;
- static const Function glTexGenfvOES = GLMessage_Function_glTexGenfvOES;
- static const Function glTexGeniOES = GLMessage_Function_glTexGeniOES;
- static const Function glTexGenivOES = GLMessage_Function_glTexGenivOES;
- static const Function glTexGenxOES = GLMessage_Function_glTexGenxOES;
- static const Function glTexGenxvOES = GLMessage_Function_glTexGenxvOES;
- static const Function glTexImage2D = GLMessage_Function_glTexImage2D;
- static const Function glTexImage3DOES = GLMessage_Function_glTexImage3DOES;
- static const Function glTexParameterf = GLMessage_Function_glTexParameterf;
- static const Function glTexParameterfv = GLMessage_Function_glTexParameterfv;
- static const Function glTexParameteri = GLMessage_Function_glTexParameteri;
- static const Function glTexParameteriv = GLMessage_Function_glTexParameteriv;
- static const Function glTexParameterx = GLMessage_Function_glTexParameterx;
- static const Function glTexParameterxOES = GLMessage_Function_glTexParameterxOES;
- static const Function glTexParameterxv = GLMessage_Function_glTexParameterxv;
- static const Function glTexParameterxvOES = GLMessage_Function_glTexParameterxvOES;
- static const Function glTexSubImage2D = GLMessage_Function_glTexSubImage2D;
- static const Function glTexSubImage3DOES = GLMessage_Function_glTexSubImage3DOES;
- static const Function glTranslatef = GLMessage_Function_glTranslatef;
- static const Function glTranslatex = GLMessage_Function_glTranslatex;
- static const Function glTranslatexOES = GLMessage_Function_glTranslatexOES;
- static const Function glUniform1f = GLMessage_Function_glUniform1f;
- static const Function glUniform1fv = GLMessage_Function_glUniform1fv;
- static const Function glUniform1i = GLMessage_Function_glUniform1i;
- static const Function glUniform1iv = GLMessage_Function_glUniform1iv;
- static const Function glUniform2f = GLMessage_Function_glUniform2f;
- static const Function glUniform2fv = GLMessage_Function_glUniform2fv;
- static const Function glUniform2i = GLMessage_Function_glUniform2i;
- static const Function glUniform2iv = GLMessage_Function_glUniform2iv;
- static const Function glUniform3f = GLMessage_Function_glUniform3f;
- static const Function glUniform3fv = GLMessage_Function_glUniform3fv;
- static const Function glUniform3i = GLMessage_Function_glUniform3i;
- static const Function glUniform3iv = GLMessage_Function_glUniform3iv;
- static const Function glUniform4f = GLMessage_Function_glUniform4f;
- static const Function glUniform4fv = GLMessage_Function_glUniform4fv;
- static const Function glUniform4i = GLMessage_Function_glUniform4i;
- static const Function glUniform4iv = GLMessage_Function_glUniform4iv;
- static const Function glUniformMatrix2fv = GLMessage_Function_glUniformMatrix2fv;
- static const Function glUniformMatrix3fv = GLMessage_Function_glUniformMatrix3fv;
- static const Function glUniformMatrix4fv = GLMessage_Function_glUniformMatrix4fv;
- static const Function glUnmapBufferOES = GLMessage_Function_glUnmapBufferOES;
- static const Function glUseProgram = GLMessage_Function_glUseProgram;
- static const Function glValidateProgram = GLMessage_Function_glValidateProgram;
- static const Function glVertexAttrib1f = GLMessage_Function_glVertexAttrib1f;
- static const Function glVertexAttrib1fv = GLMessage_Function_glVertexAttrib1fv;
- static const Function glVertexAttrib2f = GLMessage_Function_glVertexAttrib2f;
- static const Function glVertexAttrib2fv = GLMessage_Function_glVertexAttrib2fv;
- static const Function glVertexAttrib3f = GLMessage_Function_glVertexAttrib3f;
- static const Function glVertexAttrib3fv = GLMessage_Function_glVertexAttrib3fv;
- static const Function glVertexAttrib4f = GLMessage_Function_glVertexAttrib4f;
- static const Function glVertexAttrib4fv = GLMessage_Function_glVertexAttrib4fv;
- static const Function glVertexAttribPointer = GLMessage_Function_glVertexAttribPointer;
- static const Function glVertexPointer = GLMessage_Function_glVertexPointer;
- static const Function glViewport = GLMessage_Function_glViewport;
- static const Function glWeightPointerOES = GLMessage_Function_glWeightPointerOES;
- static const Function glActiveShaderProgramEXT = GLMessage_Function_glActiveShaderProgramEXT;
- static const Function glAlphaFuncQCOM = GLMessage_Function_glAlphaFuncQCOM;
- static const Function glBeginQueryEXT = GLMessage_Function_glBeginQueryEXT;
- static const Function glBindProgramPipelineEXT = GLMessage_Function_glBindProgramPipelineEXT;
- static const Function glBlitFramebufferANGLE = GLMessage_Function_glBlitFramebufferANGLE;
- static const Function glCreateShaderProgramvEXT = GLMessage_Function_glCreateShaderProgramvEXT;
- static const Function glDeleteProgramPipelinesEXT = GLMessage_Function_glDeleteProgramPipelinesEXT;
- static const Function glDeleteQueriesEXT = GLMessage_Function_glDeleteQueriesEXT;
- static const Function glDrawBuffersNV = GLMessage_Function_glDrawBuffersNV;
- static const Function glEndQueryEXT = GLMessage_Function_glEndQueryEXT;
- static const Function glFramebufferTexture2DMultisampleEXT = GLMessage_Function_glFramebufferTexture2DMultisampleEXT;
- static const Function glGenProgramPipelinesEXT = GLMessage_Function_glGenProgramPipelinesEXT;
- static const Function glGenQueriesEXT = GLMessage_Function_glGenQueriesEXT;
- static const Function glGetGraphicsResetStatusEXT = GLMessage_Function_glGetGraphicsResetStatusEXT;
- static const Function glGetObjectLabelEXT = GLMessage_Function_glGetObjectLabelEXT;
- static const Function glGetProgramPipelineInfoLogEXT = GLMessage_Function_glGetProgramPipelineInfoLogEXT;
- static const Function glGetProgramPipelineivEXT = GLMessage_Function_glGetProgramPipelineivEXT;
- static const Function glGetQueryObjectuivEXT = GLMessage_Function_glGetQueryObjectuivEXT;
- static const Function glGetQueryivEXT = GLMessage_Function_glGetQueryivEXT;
- static const Function glGetnUniformfvEXT = GLMessage_Function_glGetnUniformfvEXT;
- static const Function glGetnUniformivEXT = GLMessage_Function_glGetnUniformivEXT;
- static const Function glInsertEventMarkerEXT = GLMessage_Function_glInsertEventMarkerEXT;
- static const Function glIsProgramPipelineEXT = GLMessage_Function_glIsProgramPipelineEXT;
- static const Function glIsQueryEXT = GLMessage_Function_glIsQueryEXT;
- static const Function glLabelObjectEXT = GLMessage_Function_glLabelObjectEXT;
- static const Function glPopGroupMarkerEXT = GLMessage_Function_glPopGroupMarkerEXT;
- static const Function glProgramParameteriEXT = GLMessage_Function_glProgramParameteriEXT;
- static const Function glProgramUniform1fEXT = GLMessage_Function_glProgramUniform1fEXT;
- static const Function glProgramUniform1fvEXT = GLMessage_Function_glProgramUniform1fvEXT;
- static const Function glProgramUniform1iEXT = GLMessage_Function_glProgramUniform1iEXT;
- static const Function glProgramUniform1ivEXT = GLMessage_Function_glProgramUniform1ivEXT;
- static const Function glProgramUniform2fEXT = GLMessage_Function_glProgramUniform2fEXT;
- static const Function glProgramUniform2fvEXT = GLMessage_Function_glProgramUniform2fvEXT;
- static const Function glProgramUniform2iEXT = GLMessage_Function_glProgramUniform2iEXT;
- static const Function glProgramUniform2ivEXT = GLMessage_Function_glProgramUniform2ivEXT;
- static const Function glProgramUniform3fEXT = GLMessage_Function_glProgramUniform3fEXT;
- static const Function glProgramUniform3fvEXT = GLMessage_Function_glProgramUniform3fvEXT;
- static const Function glProgramUniform3iEXT = GLMessage_Function_glProgramUniform3iEXT;
- static const Function glProgramUniform3ivEXT = GLMessage_Function_glProgramUniform3ivEXT;
- static const Function glProgramUniform4fEXT = GLMessage_Function_glProgramUniform4fEXT;
- static const Function glProgramUniform4fvEXT = GLMessage_Function_glProgramUniform4fvEXT;
- static const Function glProgramUniform4iEXT = GLMessage_Function_glProgramUniform4iEXT;
- static const Function glProgramUniform4ivEXT = GLMessage_Function_glProgramUniform4ivEXT;
- static const Function glProgramUniformMatrix2fvEXT = GLMessage_Function_glProgramUniformMatrix2fvEXT;
- static const Function glProgramUniformMatrix3fvEXT = GLMessage_Function_glProgramUniformMatrix3fvEXT;
- static const Function glProgramUniformMatrix4fvEXT = GLMessage_Function_glProgramUniformMatrix4fvEXT;
- static const Function glPushGroupMarkerEXT = GLMessage_Function_glPushGroupMarkerEXT;
- static const Function glReadBufferNV = GLMessage_Function_glReadBufferNV;
- static const Function glReadnPixelsEXT = GLMessage_Function_glReadnPixelsEXT;
- static const Function glRenderbufferStorageMultisampleANGLE = GLMessage_Function_glRenderbufferStorageMultisampleANGLE;
- static const Function glRenderbufferStorageMultisampleAPPLE = GLMessage_Function_glRenderbufferStorageMultisampleAPPLE;
- static const Function glRenderbufferStorageMultisampleEXT = GLMessage_Function_glRenderbufferStorageMultisampleEXT;
- static const Function glResolveMultisampleFramebufferAPPLE = GLMessage_Function_glResolveMultisampleFramebufferAPPLE;
- static const Function glTexStorage1DEXT = GLMessage_Function_glTexStorage1DEXT;
- static const Function glTexStorage2DEXT = GLMessage_Function_glTexStorage2DEXT;
- static const Function glTexStorage3DEXT = GLMessage_Function_glTexStorage3DEXT;
- static const Function glTextureStorage1DEXT = GLMessage_Function_glTextureStorage1DEXT;
- static const Function glTextureStorage2DEXT = GLMessage_Function_glTextureStorage2DEXT;
- static const Function glTextureStorage3DEXT = GLMessage_Function_glTextureStorage3DEXT;
- static const Function glUseProgramStagesEXT = GLMessage_Function_glUseProgramStagesEXT;
- static const Function glValidateProgramPipelineEXT = GLMessage_Function_glValidateProgramPipelineEXT;
- static const Function eglGetDisplay = GLMessage_Function_eglGetDisplay;
- static const Function eglInitialize = GLMessage_Function_eglInitialize;
- static const Function eglTerminate = GLMessage_Function_eglTerminate;
- static const Function eglGetConfigs = GLMessage_Function_eglGetConfigs;
- static const Function eglChooseConfig = GLMessage_Function_eglChooseConfig;
- static const Function eglGetConfigAttrib = GLMessage_Function_eglGetConfigAttrib;
- static const Function eglCreateWindowSurface = GLMessage_Function_eglCreateWindowSurface;
- static const Function eglCreatePixmapSurface = GLMessage_Function_eglCreatePixmapSurface;
- static const Function eglCreatePbufferSurface = GLMessage_Function_eglCreatePbufferSurface;
- static const Function eglDestroySurface = GLMessage_Function_eglDestroySurface;
- static const Function eglQuerySurface = GLMessage_Function_eglQuerySurface;
- static const Function eglCreateContext = GLMessage_Function_eglCreateContext;
- static const Function eglDestroyContext = GLMessage_Function_eglDestroyContext;
- static const Function eglMakeCurrent = GLMessage_Function_eglMakeCurrent;
- static const Function eglGetCurrentContext = GLMessage_Function_eglGetCurrentContext;
- static const Function eglGetCurrentSurface = GLMessage_Function_eglGetCurrentSurface;
- static const Function eglGetCurrentDisplay = GLMessage_Function_eglGetCurrentDisplay;
- static const Function eglQueryContext = GLMessage_Function_eglQueryContext;
- static const Function eglWaitGL = GLMessage_Function_eglWaitGL;
- static const Function eglWaitNative = GLMessage_Function_eglWaitNative;
- static const Function eglSwapBuffers = GLMessage_Function_eglSwapBuffers;
- static const Function eglCopyBuffers = GLMessage_Function_eglCopyBuffers;
- static const Function eglGetError = GLMessage_Function_eglGetError;
- static const Function eglQueryString = GLMessage_Function_eglQueryString;
- static const Function eglGetProcAddress = GLMessage_Function_eglGetProcAddress;
- static const Function eglSurfaceAttrib = GLMessage_Function_eglSurfaceAttrib;
- static const Function eglBindTexImage = GLMessage_Function_eglBindTexImage;
- static const Function eglReleaseTexImage = GLMessage_Function_eglReleaseTexImage;
- static const Function eglSwapInterval = GLMessage_Function_eglSwapInterval;
- static const Function eglBindAPI = GLMessage_Function_eglBindAPI;
- static const Function eglQueryAPI = GLMessage_Function_eglQueryAPI;
- static const Function eglWaitClient = GLMessage_Function_eglWaitClient;
- static const Function eglReleaseThread = GLMessage_Function_eglReleaseThread;
- static const Function eglCreatePbufferFromClientBuffer = GLMessage_Function_eglCreatePbufferFromClientBuffer;
- static const Function eglLockSurfaceKHR = GLMessage_Function_eglLockSurfaceKHR;
- static const Function eglUnlockSurfaceKHR = GLMessage_Function_eglUnlockSurfaceKHR;
- static const Function eglCreateImageKHR = GLMessage_Function_eglCreateImageKHR;
- static const Function eglDestroyImageKHR = GLMessage_Function_eglDestroyImageKHR;
- static const Function eglCreateSyncKHR = GLMessage_Function_eglCreateSyncKHR;
- static const Function eglDestroySyncKHR = GLMessage_Function_eglDestroySyncKHR;
- static const Function eglClientWaitSyncKHR = GLMessage_Function_eglClientWaitSyncKHR;
- static const Function eglGetSyncAttribKHR = GLMessage_Function_eglGetSyncAttribKHR;
- static const Function eglSetSwapRectangleANDROID = GLMessage_Function_eglSetSwapRectangleANDROID;
- static const Function eglGetRenderBufferANDROID = GLMessage_Function_eglGetRenderBufferANDROID;
- static const Function eglGetSystemTimeFrequencyNV = GLMessage_Function_eglGetSystemTimeFrequencyNV;
- static const Function eglGetSystemTimeNV = GLMessage_Function_eglGetSystemTimeNV;
- static const Function invalid = GLMessage_Function_invalid;
- static const Function glVertexAttribPointerData = GLMessage_Function_glVertexAttribPointerData;
- static inline bool Function_IsValid(int value) {
- return GLMessage_Function_IsValid(value);
- }
- static const Function Function_MIN =
- GLMessage_Function_Function_MIN;
- static const Function Function_MAX =
- GLMessage_Function_Function_MAX;
- static const int Function_ARRAYSIZE =
- GLMessage_Function_Function_ARRAYSIZE;
-
- // accessors -------------------------------------------------------
-
- // required int32 context_id = 1;
- inline bool has_context_id() const;
- inline void clear_context_id();
- static const int kContextIdFieldNumber = 1;
- inline ::google::protobuf::int32 context_id() const;
- inline void set_context_id(::google::protobuf::int32 value);
-
- // required int64 start_time = 2;
- inline bool has_start_time() const;
- inline void clear_start_time();
- static const int kStartTimeFieldNumber = 2;
- inline ::google::protobuf::int64 start_time() const;
- inline void set_start_time(::google::protobuf::int64 value);
-
- // required int32 duration = 3;
- inline bool has_duration() const;
- inline void clear_duration();
- static const int kDurationFieldNumber = 3;
- inline ::google::protobuf::int32 duration() const;
- inline void set_duration(::google::protobuf::int32 value);
-
- // required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
- inline bool has_function() const;
- inline void clear_function();
- static const int kFunctionFieldNumber = 4;
- inline ::android::gltrace::GLMessage_Function function() const;
- inline void set_function(::android::gltrace::GLMessage_Function value);
-
- // repeated .android.gltrace.GLMessage.DataType args = 5;
- inline int args_size() const;
- inline void clear_args();
- static const int kArgsFieldNumber = 5;
- inline const ::android::gltrace::GLMessage_DataType& args(int index) const;
- inline ::android::gltrace::GLMessage_DataType* mutable_args(int index);
- inline ::android::gltrace::GLMessage_DataType* add_args();
- inline const ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >&
- args() const;
- inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >*
- mutable_args();
-
- // optional .android.gltrace.GLMessage.DataType returnValue = 6;
- inline bool has_returnvalue() const;
- inline void clear_returnvalue();
- static const int kReturnValueFieldNumber = 6;
- inline const ::android::gltrace::GLMessage_DataType& returnvalue() const;
- inline ::android::gltrace::GLMessage_DataType* mutable_returnvalue();
-
- // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
- inline bool has_fb() const;
- inline void clear_fb();
- static const int kFbFieldNumber = 7;
- inline const ::android::gltrace::GLMessage_FrameBuffer& fb() const;
- inline ::android::gltrace::GLMessage_FrameBuffer* mutable_fb();
-
- // optional int32 threadtime = 8;
- inline bool has_threadtime() const;
- inline void clear_threadtime();
- static const int kThreadtimeFieldNumber = 8;
- inline ::google::protobuf::int32 threadtime() const;
- inline void set_threadtime(::google::protobuf::int32 value);
-
- // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage)
- private:
- mutable int _cached_size_;
-
- ::google::protobuf::int32 context_id_;
- ::google::protobuf::int64 start_time_;
- ::google::protobuf::int32 duration_;
- int function_;
- ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType > args_;
- ::android::gltrace::GLMessage_DataType* returnvalue_;
- ::android::gltrace::GLMessage_FrameBuffer* fb_;
- ::google::protobuf::int32 threadtime_;
- friend void protobuf_AddDesc_gltrace_2eproto();
- friend void protobuf_AssignDesc_gltrace_2eproto();
- friend void protobuf_ShutdownFile_gltrace_2eproto();
-
- ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32];
-
- // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
- inline bool _has_bit(int index) const {
- return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
- }
- inline void _set_bit(int index) {
- _has_bits_[index / 32] |= (1u << (index % 32));
- }
- inline void _clear_bit(int index) {
- _has_bits_[index / 32] &= ~(1u << (index % 32));
- }
-
- void InitAsDefaultInstance();
- static GLMessage* default_instance_;
-};
-// ===================================================================
-
-
-// ===================================================================
-
-// GLMessage_DataType
-
-// required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
-inline bool GLMessage_DataType::has_type() const {
- return _has_bit(0);
-}
-inline void GLMessage_DataType::clear_type() {
- type_ = 1;
- _clear_bit(0);
-}
-inline ::android::gltrace::GLMessage_DataType_Type GLMessage_DataType::type() const {
- return static_cast< ::android::gltrace::GLMessage_DataType_Type >(type_);
-}
-inline void GLMessage_DataType::set_type(::android::gltrace::GLMessage_DataType_Type value) {
- GOOGLE_DCHECK(::android::gltrace::GLMessage_DataType_Type_IsValid(value));
- _set_bit(0);
- type_ = value;
-}
-
-// required bool isArray = 2 [default = false];
-inline bool GLMessage_DataType::has_isarray() const {
- return _has_bit(1);
-}
-inline void GLMessage_DataType::clear_isarray() {
- isarray_ = false;
- _clear_bit(1);
-}
-inline bool GLMessage_DataType::isarray() const {
- return isarray_;
-}
-inline void GLMessage_DataType::set_isarray(bool value) {
- _set_bit(1);
- isarray_ = value;
-}
-
-// repeated int32 intValue = 3;
-inline int GLMessage_DataType::intvalue_size() const {
- return intvalue_.size();
-}
-inline void GLMessage_DataType::clear_intvalue() {
- intvalue_.Clear();
-}
-inline ::google::protobuf::int32 GLMessage_DataType::intvalue(int index) const {
- return intvalue_.Get(index);
-}
-inline void GLMessage_DataType::set_intvalue(int index, ::google::protobuf::int32 value) {
- intvalue_.Set(index, value);
-}
-inline void GLMessage_DataType::add_intvalue(::google::protobuf::int32 value) {
- intvalue_.Add(value);
-}
-inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
-GLMessage_DataType::intvalue() const {
- return intvalue_;
-}
-inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
-GLMessage_DataType::mutable_intvalue() {
- return &intvalue_;
-}
-
-// repeated float floatValue = 4;
-inline int GLMessage_DataType::floatvalue_size() const {
- return floatvalue_.size();
-}
-inline void GLMessage_DataType::clear_floatvalue() {
- floatvalue_.Clear();
-}
-inline float GLMessage_DataType::floatvalue(int index) const {
- return floatvalue_.Get(index);
-}
-inline void GLMessage_DataType::set_floatvalue(int index, float value) {
- floatvalue_.Set(index, value);
-}
-inline void GLMessage_DataType::add_floatvalue(float value) {
- floatvalue_.Add(value);
-}
-inline const ::google::protobuf::RepeatedField< float >&
-GLMessage_DataType::floatvalue() const {
- return floatvalue_;
-}
-inline ::google::protobuf::RepeatedField< float >*
-GLMessage_DataType::mutable_floatvalue() {
- return &floatvalue_;
-}
-
-// repeated bytes charValue = 5;
-inline int GLMessage_DataType::charvalue_size() const {
- return charvalue_.size();
-}
-inline void GLMessage_DataType::clear_charvalue() {
- charvalue_.Clear();
-}
-inline const ::std::string& GLMessage_DataType::charvalue(int index) const {
- return charvalue_.Get(index);
-}
-inline ::std::string* GLMessage_DataType::mutable_charvalue(int index) {
- return charvalue_.Mutable(index);
-}
-inline void GLMessage_DataType::set_charvalue(int index, const ::std::string& value) {
- charvalue_.Mutable(index)->assign(value);
-}
-inline void GLMessage_DataType::set_charvalue(int index, const char* value) {
- charvalue_.Mutable(index)->assign(value);
-}
-inline void GLMessage_DataType::set_charvalue(int index, const void* value, size_t size) {
- charvalue_.Mutable(index)->assign(
- reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* GLMessage_DataType::add_charvalue() {
- return charvalue_.Add();
-}
-inline void GLMessage_DataType::add_charvalue(const ::std::string& value) {
- charvalue_.Add()->assign(value);
-}
-inline void GLMessage_DataType::add_charvalue(const char* value) {
- charvalue_.Add()->assign(value);
-}
-inline void GLMessage_DataType::add_charvalue(const void* value, size_t size) {
- charvalue_.Add()->assign(reinterpret_cast<const char*>(value), size);
-}
-inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
-GLMessage_DataType::charvalue() const {
- return charvalue_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::std::string>*
-GLMessage_DataType::mutable_charvalue() {
- return &charvalue_;
-}
-
-// repeated bytes rawBytes = 6;
-inline int GLMessage_DataType::rawbytes_size() const {
- return rawbytes_.size();
-}
-inline void GLMessage_DataType::clear_rawbytes() {
- rawbytes_.Clear();
-}
-inline const ::std::string& GLMessage_DataType::rawbytes(int index) const {
- return rawbytes_.Get(index);
-}
-inline ::std::string* GLMessage_DataType::mutable_rawbytes(int index) {
- return rawbytes_.Mutable(index);
-}
-inline void GLMessage_DataType::set_rawbytes(int index, const ::std::string& value) {
- rawbytes_.Mutable(index)->assign(value);
-}
-inline void GLMessage_DataType::set_rawbytes(int index, const char* value) {
- rawbytes_.Mutable(index)->assign(value);
-}
-inline void GLMessage_DataType::set_rawbytes(int index, const void* value, size_t size) {
- rawbytes_.Mutable(index)->assign(
- reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* GLMessage_DataType::add_rawbytes() {
- return rawbytes_.Add();
-}
-inline void GLMessage_DataType::add_rawbytes(const ::std::string& value) {
- rawbytes_.Add()->assign(value);
-}
-inline void GLMessage_DataType::add_rawbytes(const char* value) {
- rawbytes_.Add()->assign(value);
-}
-inline void GLMessage_DataType::add_rawbytes(const void* value, size_t size) {
- rawbytes_.Add()->assign(reinterpret_cast<const char*>(value), size);
-}
-inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
-GLMessage_DataType::rawbytes() const {
- return rawbytes_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::std::string>*
-GLMessage_DataType::mutable_rawbytes() {
- return &rawbytes_;
-}
-
-// repeated bool boolValue = 7;
-inline int GLMessage_DataType::boolvalue_size() const {
- return boolvalue_.size();
-}
-inline void GLMessage_DataType::clear_boolvalue() {
- boolvalue_.Clear();
-}
-inline bool GLMessage_DataType::boolvalue(int index) const {
- return boolvalue_.Get(index);
-}
-inline void GLMessage_DataType::set_boolvalue(int index, bool value) {
- boolvalue_.Set(index, value);
-}
-inline void GLMessage_DataType::add_boolvalue(bool value) {
- boolvalue_.Add(value);
-}
-inline const ::google::protobuf::RepeatedField< bool >&
-GLMessage_DataType::boolvalue() const {
- return boolvalue_;
-}
-inline ::google::protobuf::RepeatedField< bool >*
-GLMessage_DataType::mutable_boolvalue() {
- return &boolvalue_;
-}
-
-// -------------------------------------------------------------------
-
-// GLMessage_FrameBuffer
-
-// required int32 width = 1;
-inline bool GLMessage_FrameBuffer::has_width() const {
- return _has_bit(0);
-}
-inline void GLMessage_FrameBuffer::clear_width() {
- width_ = 0;
- _clear_bit(0);
-}
-inline ::google::protobuf::int32 GLMessage_FrameBuffer::width() const {
- return width_;
-}
-inline void GLMessage_FrameBuffer::set_width(::google::protobuf::int32 value) {
- _set_bit(0);
- width_ = value;
-}
-
-// required int32 height = 2;
-inline bool GLMessage_FrameBuffer::has_height() const {
- return _has_bit(1);
-}
-inline void GLMessage_FrameBuffer::clear_height() {
- height_ = 0;
- _clear_bit(1);
-}
-inline ::google::protobuf::int32 GLMessage_FrameBuffer::height() const {
- return height_;
-}
-inline void GLMessage_FrameBuffer::set_height(::google::protobuf::int32 value) {
- _set_bit(1);
- height_ = value;
-}
-
-// repeated bytes contents = 3;
-inline int GLMessage_FrameBuffer::contents_size() const {
- return contents_.size();
-}
-inline void GLMessage_FrameBuffer::clear_contents() {
- contents_.Clear();
-}
-inline const ::std::string& GLMessage_FrameBuffer::contents(int index) const {
- return contents_.Get(index);
-}
-inline ::std::string* GLMessage_FrameBuffer::mutable_contents(int index) {
- return contents_.Mutable(index);
-}
-inline void GLMessage_FrameBuffer::set_contents(int index, const ::std::string& value) {
- contents_.Mutable(index)->assign(value);
-}
-inline void GLMessage_FrameBuffer::set_contents(int index, const char* value) {
- contents_.Mutable(index)->assign(value);
-}
-inline void GLMessage_FrameBuffer::set_contents(int index, const void* value, size_t size) {
- contents_.Mutable(index)->assign(
- reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* GLMessage_FrameBuffer::add_contents() {
- return contents_.Add();
-}
-inline void GLMessage_FrameBuffer::add_contents(const ::std::string& value) {
- contents_.Add()->assign(value);
-}
-inline void GLMessage_FrameBuffer::add_contents(const char* value) {
- contents_.Add()->assign(value);
-}
-inline void GLMessage_FrameBuffer::add_contents(const void* value, size_t size) {
- contents_.Add()->assign(reinterpret_cast<const char*>(value), size);
-}
-inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
-GLMessage_FrameBuffer::contents() const {
- return contents_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::std::string>*
-GLMessage_FrameBuffer::mutable_contents() {
- return &contents_;
-}
-
-// -------------------------------------------------------------------
-
-// GLMessage
-
-// required int32 context_id = 1;
-inline bool GLMessage::has_context_id() const {
- return _has_bit(0);
-}
-inline void GLMessage::clear_context_id() {
- context_id_ = 0;
- _clear_bit(0);
-}
-inline ::google::protobuf::int32 GLMessage::context_id() const {
- return context_id_;
-}
-inline void GLMessage::set_context_id(::google::protobuf::int32 value) {
- _set_bit(0);
- context_id_ = value;
-}
-
-// required int64 start_time = 2;
-inline bool GLMessage::has_start_time() const {
- return _has_bit(1);
-}
-inline void GLMessage::clear_start_time() {
- start_time_ = GOOGLE_LONGLONG(0);
- _clear_bit(1);
-}
-inline ::google::protobuf::int64 GLMessage::start_time() const {
- return start_time_;
-}
-inline void GLMessage::set_start_time(::google::protobuf::int64 value) {
- _set_bit(1);
- start_time_ = value;
-}
-
-// required int32 duration = 3;
-inline bool GLMessage::has_duration() const {
- return _has_bit(2);
-}
-inline void GLMessage::clear_duration() {
- duration_ = 0;
- _clear_bit(2);
-}
-inline ::google::protobuf::int32 GLMessage::duration() const {
- return duration_;
-}
-inline void GLMessage::set_duration(::google::protobuf::int32 value) {
- _set_bit(2);
- duration_ = value;
-}
-
-// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
-inline bool GLMessage::has_function() const {
- return _has_bit(3);
-}
-inline void GLMessage::clear_function() {
- function_ = 3000;
- _clear_bit(3);
-}
-inline ::android::gltrace::GLMessage_Function GLMessage::function() const {
- return static_cast< ::android::gltrace::GLMessage_Function >(function_);
-}
-inline void GLMessage::set_function(::android::gltrace::GLMessage_Function value) {
- GOOGLE_DCHECK(::android::gltrace::GLMessage_Function_IsValid(value));
- _set_bit(3);
- function_ = value;
-}
-
-// repeated .android.gltrace.GLMessage.DataType args = 5;
-inline int GLMessage::args_size() const {
- return args_.size();
-}
-inline void GLMessage::clear_args() {
- args_.Clear();
-}
-inline const ::android::gltrace::GLMessage_DataType& GLMessage::args(int index) const {
- return args_.Get(index);
-}
-inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_args(int index) {
- return args_.Mutable(index);
-}
-inline ::android::gltrace::GLMessage_DataType* GLMessage::add_args() {
- return args_.Add();
-}
-inline const ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >&
-GLMessage::args() const {
- return args_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >*
-GLMessage::mutable_args() {
- return &args_;
-}
-
-// optional .android.gltrace.GLMessage.DataType returnValue = 6;
-inline bool GLMessage::has_returnvalue() const {
- return _has_bit(5);
-}
-inline void GLMessage::clear_returnvalue() {
- if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear();
- _clear_bit(5);
-}
-inline const ::android::gltrace::GLMessage_DataType& GLMessage::returnvalue() const {
- return returnvalue_ != NULL ? *returnvalue_ : *default_instance_->returnvalue_;
-}
-inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_returnvalue() {
- _set_bit(5);
- if (returnvalue_ == NULL) returnvalue_ = new ::android::gltrace::GLMessage_DataType;
- return returnvalue_;
-}
-
-// optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
-inline bool GLMessage::has_fb() const {
- return _has_bit(6);
-}
-inline void GLMessage::clear_fb() {
- if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear();
- _clear_bit(6);
-}
-inline const ::android::gltrace::GLMessage_FrameBuffer& GLMessage::fb() const {
- return fb_ != NULL ? *fb_ : *default_instance_->fb_;
-}
-inline ::android::gltrace::GLMessage_FrameBuffer* GLMessage::mutable_fb() {
- _set_bit(6);
- if (fb_ == NULL) fb_ = new ::android::gltrace::GLMessage_FrameBuffer;
- return fb_;
-}
-
-// optional int32 threadtime = 8;
-inline bool GLMessage::has_threadtime() const {
- return _has_bit(7);
-}
-inline void GLMessage::clear_threadtime() {
- threadtime_ = 0;
- _clear_bit(7);
-}
-inline ::google::protobuf::int32 GLMessage::threadtime() const {
- return threadtime_;
-}
-inline void GLMessage::set_threadtime(::google::protobuf::int32 value) {
- _set_bit(7);
- threadtime_ = value;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-} // namespace gltrace
-} // namespace android
-
-// @@protoc_insertion_point(global_scope)
-
-#endif // PROTOBUF_gltrace_2eproto__INCLUDED
diff --git a/opengl/libs/GLES_trace/src/gltrace_api.cpp b/opengl/libs/GLES_trace/src/gltrace_api.cpp
deleted file mode 100644
index cef6cbb..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_api.cpp
+++ /dev/null
@@ -1,17862 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- *
- * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT.
- */
-
-#include <cutils/log.h>
-#include <utils/Timers.h>
-#include <GLES2/gl2.h>
-
-#include "gltrace.pb.h"
-#include "gltrace_context.h"
-#include "gltrace_fixup.h"
-#include "gltrace_transport.h"
-
-namespace android {
-namespace gltrace {
-
-// Definitions for GL2 APIs
-
-void GLTrace_glActiveTexture(GLenum texture) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glActiveTexture);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::ENUM);
- arg_texture->add_intvalue((int)texture);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glActiveTexture(texture);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glAttachShader(GLuint program, GLuint shader) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glAttachShader);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glAttachShader(program, shader);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindAttribLocation);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // copy argument name
- GLMessage_DataType *arg_name = glmsg.add_args();
- arg_name->set_isarray(false);
- arg_name->set_type(GLMessage::DataType::INT);
- arg_name->add_intvalue((int)name);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindAttribLocation(program, index, name);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) name,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBindBuffer(GLenum target, GLuint buffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindBuffer);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument buffer
- GLMessage_DataType *arg_buffer = glmsg.add_args();
- arg_buffer->set_isarray(false);
- arg_buffer->set_type(GLMessage::DataType::INT);
- arg_buffer->add_intvalue(buffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindBuffer(target, buffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBindFramebuffer(GLenum target, GLuint framebuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindFramebuffer);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument framebuffer
- GLMessage_DataType *arg_framebuffer = glmsg.add_args();
- arg_framebuffer->set_isarray(false);
- arg_framebuffer->set_type(GLMessage::DataType::INT);
- arg_framebuffer->add_intvalue(framebuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindFramebuffer(target, framebuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBindRenderbuffer(GLenum target, GLuint renderbuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindRenderbuffer);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument renderbuffer
- GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
- arg_renderbuffer->set_isarray(false);
- arg_renderbuffer->set_type(GLMessage::DataType::INT);
- arg_renderbuffer->add_intvalue(renderbuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindRenderbuffer(target, renderbuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBindTexture(GLenum target, GLuint texture) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindTexture);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindTexture(target, texture);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendColor);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::FLOAT);
- arg_red->add_floatvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::FLOAT);
- arg_green->add_floatvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::FLOAT);
- arg_blue->add_floatvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::FLOAT);
- arg_alpha->add_floatvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendColor(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendEquation(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendEquation);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendEquation(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendEquationSeparate);
-
- // copy argument modeRGB
- GLMessage_DataType *arg_modeRGB = glmsg.add_args();
- arg_modeRGB->set_isarray(false);
- arg_modeRGB->set_type(GLMessage::DataType::ENUM);
- arg_modeRGB->add_intvalue((int)modeRGB);
-
- // copy argument modeAlpha
- GLMessage_DataType *arg_modeAlpha = glmsg.add_args();
- arg_modeAlpha->set_isarray(false);
- arg_modeAlpha->set_type(GLMessage::DataType::ENUM);
- arg_modeAlpha->add_intvalue((int)modeAlpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendEquationSeparate(modeRGB, modeAlpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendFunc(GLenum sfactor, GLenum dfactor) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendFunc);
-
- // copy argument sfactor
- GLMessage_DataType *arg_sfactor = glmsg.add_args();
- arg_sfactor->set_isarray(false);
- arg_sfactor->set_type(GLMessage::DataType::ENUM);
- arg_sfactor->add_intvalue((int)sfactor);
-
- // copy argument dfactor
- GLMessage_DataType *arg_dfactor = glmsg.add_args();
- arg_dfactor->set_isarray(false);
- arg_dfactor->set_type(GLMessage::DataType::ENUM);
- arg_dfactor->add_intvalue((int)dfactor);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendFunc(sfactor, dfactor);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendFuncSeparate);
-
- // copy argument srcRGB
- GLMessage_DataType *arg_srcRGB = glmsg.add_args();
- arg_srcRGB->set_isarray(false);
- arg_srcRGB->set_type(GLMessage::DataType::ENUM);
- arg_srcRGB->add_intvalue((int)srcRGB);
-
- // copy argument dstRGB
- GLMessage_DataType *arg_dstRGB = glmsg.add_args();
- arg_dstRGB->set_isarray(false);
- arg_dstRGB->set_type(GLMessage::DataType::ENUM);
- arg_dstRGB->add_intvalue((int)dstRGB);
-
- // copy argument srcAlpha
- GLMessage_DataType *arg_srcAlpha = glmsg.add_args();
- arg_srcAlpha->set_isarray(false);
- arg_srcAlpha->set_type(GLMessage::DataType::ENUM);
- arg_srcAlpha->add_intvalue((int)srcAlpha);
-
- // copy argument dstAlpha
- GLMessage_DataType *arg_dstAlpha = glmsg.add_args();
- arg_dstAlpha->set_isarray(false);
- arg_dstAlpha->set_type(GLMessage::DataType::ENUM);
- arg_dstAlpha->add_intvalue((int)dstAlpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBufferData);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // copy argument usage
- GLMessage_DataType *arg_usage = glmsg.add_args();
- arg_usage->set_isarray(false);
- arg_usage->set_type(GLMessage::DataType::ENUM);
- arg_usage->add_intvalue((int)usage);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBufferData(target, size, data, usage);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBufferSubData);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument offset
- GLMessage_DataType *arg_offset = glmsg.add_args();
- arg_offset->set_isarray(false);
- arg_offset->set_type(GLMessage::DataType::INT);
- arg_offset->add_intvalue(offset);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBufferSubData(target, offset, size, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLenum GLTrace_glCheckFramebufferStatus(GLenum target) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCheckFramebufferStatus);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLenum retValue = glContext->hooks->gl.glCheckFramebufferStatus(target);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::ENUM);
- rt->add_intvalue((int)retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glClear(GLbitfield mask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClear);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::INT);
- arg_mask->add_intvalue(mask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClear(mask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearColor);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::FLOAT);
- arg_red->add_floatvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::FLOAT);
- arg_green->add_floatvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::FLOAT);
- arg_blue->add_floatvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::FLOAT);
- arg_alpha->add_floatvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearColor(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearDepthf(GLclampf depth) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearDepthf);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::FLOAT);
- arg_depth->add_floatvalue(depth);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearDepthf(depth);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearStencil(GLint s) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearStencil);
-
- // copy argument s
- GLMessage_DataType *arg_s = glmsg.add_args();
- arg_s->set_isarray(false);
- arg_s->set_type(GLMessage::DataType::INT);
- arg_s->add_intvalue(s);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearStencil(s);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glColorMask);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::BOOL);
- arg_red->add_boolvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::BOOL);
- arg_green->add_boolvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::BOOL);
- arg_blue->add_boolvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::BOOL);
- arg_alpha->add_boolvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glColorMask(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCompileShader(GLuint shader) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCompileShader);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCompileShader(shader);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCompressedTexImage2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument border
- GLMessage_DataType *arg_border = glmsg.add_args();
- arg_border->set_isarray(false);
- arg_border->set_type(GLMessage::DataType::INT);
- arg_border->add_intvalue(border);
-
- // copy argument imageSize
- GLMessage_DataType *arg_imageSize = glmsg.add_args();
- arg_imageSize->set_isarray(false);
- arg_imageSize->set_type(GLMessage::DataType::INT);
- arg_imageSize->add_intvalue(imageSize);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCompressedTexSubImage2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument imageSize
- GLMessage_DataType *arg_imageSize = glmsg.add_args();
- arg_imageSize->set_isarray(false);
- arg_imageSize->set_type(GLMessage::DataType::INT);
- arg_imageSize->add_intvalue(imageSize);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCopyTexImage2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument border
- GLMessage_DataType *arg_border = glmsg.add_args();
- arg_border->set_isarray(false);
- arg_border->set_type(GLMessage::DataType::INT);
- arg_border->add_intvalue(border);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCopyTexSubImage2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLuint GLTrace_glCreateProgram(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCreateProgram);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLuint retValue = glContext->hooks->gl.glCreateProgram();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLuint GLTrace_glCreateShader(GLenum type) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCreateShader);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLuint retValue = glContext->hooks->gl.glCreateShader(type);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glCullFace(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCullFace);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCullFace(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteBuffers);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument buffers
- GLMessage_DataType *arg_buffers = glmsg.add_args();
- arg_buffers->set_isarray(false);
- arg_buffers->set_type(GLMessage::DataType::INT);
- arg_buffers->add_intvalue((int)buffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteBuffers(n, buffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) buffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteFramebuffers);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument framebuffers
- GLMessage_DataType *arg_framebuffers = glmsg.add_args();
- arg_framebuffers->set_isarray(false);
- arg_framebuffers->set_type(GLMessage::DataType::INT);
- arg_framebuffers->add_intvalue((int)framebuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteFramebuffers(n, framebuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) framebuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteProgram(GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteProgram);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteProgram(program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteRenderbuffers);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument renderbuffers
- GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
- arg_renderbuffers->set_isarray(false);
- arg_renderbuffers->set_type(GLMessage::DataType::INT);
- arg_renderbuffers->add_intvalue((int)renderbuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteRenderbuffers(n, renderbuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) renderbuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteShader(GLuint shader) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteShader);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteShader(shader);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteTextures);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument textures
- GLMessage_DataType *arg_textures = glmsg.add_args();
- arg_textures->set_isarray(false);
- arg_textures->set_type(GLMessage::DataType::INT);
- arg_textures->add_intvalue((int)textures);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteTextures(n, textures);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) textures,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDepthFunc(GLenum func) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDepthFunc);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDepthFunc(func);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDepthMask(GLboolean flag) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDepthMask);
-
- // copy argument flag
- GLMessage_DataType *arg_flag = glmsg.add_args();
- arg_flag->set_isarray(false);
- arg_flag->set_type(GLMessage::DataType::BOOL);
- arg_flag->add_boolvalue(flag);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDepthMask(flag);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDepthRangef);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::FLOAT);
- arg_zNear->add_floatvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::FLOAT);
- arg_zFar->add_floatvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDepthRangef(zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDetachShader(GLuint program, GLuint shader) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDetachShader);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDetachShader(program, shader);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDisable(GLenum cap) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDisable);
-
- // copy argument cap
- GLMessage_DataType *arg_cap = glmsg.add_args();
- arg_cap->set_isarray(false);
- arg_cap->set_type(GLMessage::DataType::ENUM);
- arg_cap->add_intvalue((int)cap);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDisable(cap);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDisableVertexAttribArray(GLuint index) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDisableVertexAttribArray);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDisableVertexAttribArray(index);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawArrays(GLenum mode, GLint first, GLsizei count) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawArrays);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // copy argument first
- GLMessage_DataType *arg_first = glmsg.add_args();
- arg_first->set_isarray(false);
- arg_first->set_type(GLMessage::DataType::INT);
- arg_first->add_intvalue(first);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawArrays(mode, first, count);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawElements);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument indices
- GLMessage_DataType *arg_indices = glmsg.add_args();
- arg_indices->set_isarray(false);
- arg_indices->set_type(GLMessage::DataType::INT);
- arg_indices->add_intvalue((int)indices);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawElements(mode, count, type, indices);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) indices,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEnable(GLenum cap) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEnable);
-
- // copy argument cap
- GLMessage_DataType *arg_cap = glmsg.add_args();
- arg_cap->set_isarray(false);
- arg_cap->set_type(GLMessage::DataType::ENUM);
- arg_cap->add_intvalue((int)cap);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEnable(cap);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEnableVertexAttribArray(GLuint index) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEnableVertexAttribArray);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEnableVertexAttribArray(index);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFinish(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFinish);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFinish();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFlush(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFlush);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFlush();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferRenderbuffer);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument renderbuffertarget
- GLMessage_DataType *arg_renderbuffertarget = glmsg.add_args();
- arg_renderbuffertarget->set_isarray(false);
- arg_renderbuffertarget->set_type(GLMessage::DataType::ENUM);
- arg_renderbuffertarget->add_intvalue((int)renderbuffertarget);
-
- // copy argument renderbuffer
- GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
- arg_renderbuffer->set_isarray(false);
- arg_renderbuffer->set_type(GLMessage::DataType::INT);
- arg_renderbuffer->add_intvalue(renderbuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferTexture2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument textarget
- GLMessage_DataType *arg_textarget = glmsg.add_args();
- arg_textarget->set_isarray(false);
- arg_textarget->set_type(GLMessage::DataType::ENUM);
- arg_textarget->add_intvalue((int)textarget);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferTexture2D(target, attachment, textarget, texture, level);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFrontFace(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFrontFace);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFrontFace(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenBuffers);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument buffers
- GLMessage_DataType *arg_buffers = glmsg.add_args();
- arg_buffers->set_isarray(false);
- arg_buffers->set_type(GLMessage::DataType::INT);
- arg_buffers->add_intvalue((int)buffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenBuffers(n, buffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) buffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenerateMipmap(GLenum target) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenerateMipmap);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenerateMipmap(target);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenFramebuffers);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument framebuffers
- GLMessage_DataType *arg_framebuffers = glmsg.add_args();
- arg_framebuffers->set_isarray(false);
- arg_framebuffers->set_type(GLMessage::DataType::INT);
- arg_framebuffers->add_intvalue((int)framebuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenFramebuffers(n, framebuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) framebuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenRenderbuffers);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument renderbuffers
- GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
- arg_renderbuffers->set_isarray(false);
- arg_renderbuffers->set_type(GLMessage::DataType::INT);
- arg_renderbuffers->add_intvalue((int)renderbuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenRenderbuffers(n, renderbuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) renderbuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenTextures(GLsizei n, GLuint* textures) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenTextures);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument textures
- GLMessage_DataType *arg_textures = glmsg.add_args();
- arg_textures->set_isarray(false);
- arg_textures->set_type(GLMessage::DataType::INT);
- arg_textures->add_intvalue((int)textures);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenTextures(n, textures);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) textures,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetActiveAttrib);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // copy argument bufsize
- GLMessage_DataType *arg_bufsize = glmsg.add_args();
- arg_bufsize->set_isarray(false);
- arg_bufsize->set_type(GLMessage::DataType::INT);
- arg_bufsize->add_intvalue(bufsize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue((int)size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::INT);
- arg_type->add_intvalue((int)type);
-
- // copy argument name
- GLMessage_DataType *arg_name = glmsg.add_args();
- arg_name->set_isarray(false);
- arg_name->set_type(GLMessage::DataType::INT);
- arg_name->add_intvalue((int)name);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetActiveAttrib(program, index, bufsize, length, size, type, name);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) size,
- (void *) type,
- (void *) name,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetActiveUniform);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // copy argument bufsize
- GLMessage_DataType *arg_bufsize = glmsg.add_args();
- arg_bufsize->set_isarray(false);
- arg_bufsize->set_type(GLMessage::DataType::INT);
- arg_bufsize->add_intvalue(bufsize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue((int)size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::INT);
- arg_type->add_intvalue((int)type);
-
- // copy argument name
- GLMessage_DataType *arg_name = glmsg.add_args();
- arg_name->set_isarray(false);
- arg_name->set_type(GLMessage::DataType::INT);
- arg_name->add_intvalue((int)name);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetActiveUniform(program, index, bufsize, length, size, type, name);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) size,
- (void *) type,
- (void *) name,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetAttachedShaders);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument maxcount
- GLMessage_DataType *arg_maxcount = glmsg.add_args();
- arg_maxcount->set_isarray(false);
- arg_maxcount->set_type(GLMessage::DataType::INT);
- arg_maxcount->add_intvalue(maxcount);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue((int)count);
-
- // copy argument shaders
- GLMessage_DataType *arg_shaders = glmsg.add_args();
- arg_shaders->set_isarray(false);
- arg_shaders->set_type(GLMessage::DataType::INT);
- arg_shaders->add_intvalue((int)shaders);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetAttachedShaders(program, maxcount, count, shaders);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) count,
- (void *) shaders,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetAttribLocation);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument name
- GLMessage_DataType *arg_name = glmsg.add_args();
- arg_name->set_isarray(false);
- arg_name->set_type(GLMessage::DataType::INT);
- arg_name->add_intvalue((int)name);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- int retValue = glContext->hooks->gl.glGetAttribLocation(program, name);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue(retValue);
-
- void *pointerArgs[] = {
- (void *) name,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetBooleanv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetBooleanv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetBufferParameteriv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetBufferParameteriv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLenum GLTrace_glGetError(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetError);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLenum retValue = glContext->hooks->gl.glGetError();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::ENUM);
- rt->add_intvalue((int)retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetFloatv(GLenum pname, GLfloat* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetFloatv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetFloatv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetFramebufferAttachmentParameteriv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetIntegerv(GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetIntegerv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetIntegerv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetProgramiv);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetProgramiv(program, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetProgramInfoLog);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument bufsize
- GLMessage_DataType *arg_bufsize = glmsg.add_args();
- arg_bufsize->set_isarray(false);
- arg_bufsize->set_type(GLMessage::DataType::INT);
- arg_bufsize->add_intvalue(bufsize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument infolog
- GLMessage_DataType *arg_infolog = glmsg.add_args();
- arg_infolog->set_isarray(false);
- arg_infolog->set_type(GLMessage::DataType::INT);
- arg_infolog->add_intvalue((int)infolog);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetProgramInfoLog(program, bufsize, length, infolog);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) infolog,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetRenderbufferParameteriv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetRenderbufferParameteriv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetShaderiv);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetShaderiv(shader, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetShaderInfoLog);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // copy argument bufsize
- GLMessage_DataType *arg_bufsize = glmsg.add_args();
- arg_bufsize->set_isarray(false);
- arg_bufsize->set_type(GLMessage::DataType::INT);
- arg_bufsize->add_intvalue(bufsize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument infolog
- GLMessage_DataType *arg_infolog = glmsg.add_args();
- arg_infolog->set_isarray(false);
- arg_infolog->set_type(GLMessage::DataType::INT);
- arg_infolog->add_intvalue((int)infolog);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetShaderInfoLog(shader, bufsize, length, infolog);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) infolog,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetShaderPrecisionFormat);
-
- // copy argument shadertype
- GLMessage_DataType *arg_shadertype = glmsg.add_args();
- arg_shadertype->set_isarray(false);
- arg_shadertype->set_type(GLMessage::DataType::ENUM);
- arg_shadertype->add_intvalue((int)shadertype);
-
- // copy argument precisiontype
- GLMessage_DataType *arg_precisiontype = glmsg.add_args();
- arg_precisiontype->set_isarray(false);
- arg_precisiontype->set_type(GLMessage::DataType::ENUM);
- arg_precisiontype->add_intvalue((int)precisiontype);
-
- // copy argument range
- GLMessage_DataType *arg_range = glmsg.add_args();
- arg_range->set_isarray(false);
- arg_range->set_type(GLMessage::DataType::INT);
- arg_range->add_intvalue((int)range);
-
- // copy argument precision
- GLMessage_DataType *arg_precision = glmsg.add_args();
- arg_precision->set_isarray(false);
- arg_precision->set_type(GLMessage::DataType::INT);
- arg_precision->add_intvalue((int)precision);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) range,
- (void *) precision,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetShaderSource);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // copy argument bufsize
- GLMessage_DataType *arg_bufsize = glmsg.add_args();
- arg_bufsize->set_isarray(false);
- arg_bufsize->set_type(GLMessage::DataType::INT);
- arg_bufsize->add_intvalue(bufsize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument source
- GLMessage_DataType *arg_source = glmsg.add_args();
- arg_source->set_isarray(false);
- arg_source->set_type(GLMessage::DataType::INT);
- arg_source->add_intvalue((int)source);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetShaderSource(shader, bufsize, length, source);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) source,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-const GLubyte* GLTrace_glGetString(GLenum name) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetString);
-
- // copy argument name
- GLMessage_DataType *arg_name = glmsg.add_args();
- arg_name->set_isarray(false);
- arg_name->set_type(GLMessage::DataType::ENUM);
- arg_name->add_intvalue((int)name);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- const GLubyte* retValue = glContext->hooks->gl.glGetString(name);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue((int)retValue);
-
- void *pointerArgs[] = {
- (void *) retValue,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexParameterfv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexParameterfv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexParameteriv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexParameteriv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetUniformfv);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetUniformfv(program, location, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetUniformiv);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetUniformiv(program, location, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetUniformLocation);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument name
- GLMessage_DataType *arg_name = glmsg.add_args();
- arg_name->set_isarray(false);
- arg_name->set_type(GLMessage::DataType::INT);
- arg_name->add_intvalue((int)name);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- int retValue = glContext->hooks->gl.glGetUniformLocation(program, name);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue(retValue);
-
- void *pointerArgs[] = {
- (void *) name,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetVertexAttribfv);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetVertexAttribfv(index, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetVertexAttribiv);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetVertexAttribiv(index, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetVertexAttribPointerv);
-
- // copy argument index
- GLMessage_DataType *arg_index = glmsg.add_args();
- arg_index->set_isarray(false);
- arg_index->set_type(GLMessage::DataType::INT);
- arg_index->add_intvalue(index);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetVertexAttribPointerv(index, pname, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glHint(GLenum target, GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glHint);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glHint(target, mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsBuffer(GLuint buffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsBuffer);
-
- // copy argument buffer
- GLMessage_DataType *arg_buffer = glmsg.add_args();
- arg_buffer->set_isarray(false);
- arg_buffer->set_type(GLMessage::DataType::INT);
- arg_buffer->add_intvalue(buffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsBuffer(buffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glIsEnabled(GLenum cap) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsEnabled);
-
- // copy argument cap
- GLMessage_DataType *arg_cap = glmsg.add_args();
- arg_cap->set_isarray(false);
- arg_cap->set_type(GLMessage::DataType::ENUM);
- arg_cap->add_intvalue((int)cap);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsEnabled(cap);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glIsFramebuffer(GLuint framebuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsFramebuffer);
-
- // copy argument framebuffer
- GLMessage_DataType *arg_framebuffer = glmsg.add_args();
- arg_framebuffer->set_isarray(false);
- arg_framebuffer->set_type(GLMessage::DataType::INT);
- arg_framebuffer->add_intvalue(framebuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsFramebuffer(framebuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glIsProgram(GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsProgram);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsProgram(program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glIsRenderbuffer(GLuint renderbuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsRenderbuffer);
-
- // copy argument renderbuffer
- GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
- arg_renderbuffer->set_isarray(false);
- arg_renderbuffer->set_type(GLMessage::DataType::INT);
- arg_renderbuffer->add_intvalue(renderbuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsRenderbuffer(renderbuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glIsShader(GLuint shader) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsShader);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsShader(shader);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glIsTexture(GLuint texture) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsTexture);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsTexture(texture);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glLineWidth(GLfloat width) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLineWidth);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::FLOAT);
- arg_width->add_floatvalue(width);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLineWidth(width);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLinkProgram(GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLinkProgram);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLinkProgram(program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPixelStorei(GLenum pname, GLint param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPixelStorei);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPixelStorei(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPolygonOffset(GLfloat factor, GLfloat units) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPolygonOffset);
-
- // copy argument factor
- GLMessage_DataType *arg_factor = glmsg.add_args();
- arg_factor->set_isarray(false);
- arg_factor->set_type(GLMessage::DataType::FLOAT);
- arg_factor->add_floatvalue(factor);
-
- // copy argument units
- GLMessage_DataType *arg_units = glmsg.add_args();
- arg_units->set_isarray(false);
- arg_units->set_type(GLMessage::DataType::FLOAT);
- arg_units->add_floatvalue(units);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPolygonOffset(factor, units);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glReadPixels);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument pixels
- GLMessage_DataType *arg_pixels = glmsg.add_args();
- arg_pixels->set_isarray(false);
- arg_pixels->set_type(GLMessage::DataType::INT);
- arg_pixels->add_intvalue((int)pixels);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glReadPixels(x, y, width, height, format, type, pixels);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pixels,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glReleaseShaderCompiler(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glReleaseShaderCompiler);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glReleaseShaderCompiler();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRenderbufferStorage);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRenderbufferStorage(target, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glSampleCoverage);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::FLOAT);
- arg_value->add_floatvalue(value);
-
- // copy argument invert
- GLMessage_DataType *arg_invert = glmsg.add_args();
- arg_invert->set_isarray(false);
- arg_invert->set_type(GLMessage::DataType::BOOL);
- arg_invert->add_boolvalue(invert);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glSampleCoverage(value, invert);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glScissor);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glScissor(x, y, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glShaderBinary);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument shaders
- GLMessage_DataType *arg_shaders = glmsg.add_args();
- arg_shaders->set_isarray(false);
- arg_shaders->set_type(GLMessage::DataType::INT);
- arg_shaders->add_intvalue((int)shaders);
-
- // copy argument binaryformat
- GLMessage_DataType *arg_binaryformat = glmsg.add_args();
- arg_binaryformat->set_isarray(false);
- arg_binaryformat->set_type(GLMessage::DataType::ENUM);
- arg_binaryformat->add_intvalue((int)binaryformat);
-
- // copy argument binary
- GLMessage_DataType *arg_binary = glmsg.add_args();
- arg_binary->set_isarray(false);
- arg_binary->set_type(GLMessage::DataType::INT);
- arg_binary->add_intvalue((int)binary);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue(length);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glShaderBinary(n, shaders, binaryformat, binary, length);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) shaders,
- (void *) binary,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glShaderSource);
-
- // copy argument shader
- GLMessage_DataType *arg_shader = glmsg.add_args();
- arg_shader->set_isarray(false);
- arg_shader->set_type(GLMessage::DataType::INT);
- arg_shader->add_intvalue(shader);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument string
- GLMessage_DataType *arg_string = glmsg.add_args();
- arg_string->set_isarray(false);
- arg_string->set_type(GLMessage::DataType::INT);
- arg_string->add_intvalue((int)string);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glShaderSource(shader, count, string, length);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) string,
- (void *) length,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStencilFunc(GLenum func, GLint ref, GLuint mask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStencilFunc);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // copy argument ref
- GLMessage_DataType *arg_ref = glmsg.add_args();
- arg_ref->set_isarray(false);
- arg_ref->set_type(GLMessage::DataType::INT);
- arg_ref->add_intvalue(ref);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::INT);
- arg_mask->add_intvalue(mask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStencilFunc(func, ref, mask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStencilFuncSeparate);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // copy argument ref
- GLMessage_DataType *arg_ref = glmsg.add_args();
- arg_ref->set_isarray(false);
- arg_ref->set_type(GLMessage::DataType::INT);
- arg_ref->add_intvalue(ref);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::INT);
- arg_mask->add_intvalue(mask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStencilFuncSeparate(face, func, ref, mask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStencilMask(GLuint mask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStencilMask);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::INT);
- arg_mask->add_intvalue(mask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStencilMask(mask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStencilMaskSeparate(GLenum face, GLuint mask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStencilMaskSeparate);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::INT);
- arg_mask->add_intvalue(mask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStencilMaskSeparate(face, mask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStencilOp);
-
- // copy argument fail
- GLMessage_DataType *arg_fail = glmsg.add_args();
- arg_fail->set_isarray(false);
- arg_fail->set_type(GLMessage::DataType::ENUM);
- arg_fail->add_intvalue((int)fail);
-
- // copy argument zfail
- GLMessage_DataType *arg_zfail = glmsg.add_args();
- arg_zfail->set_isarray(false);
- arg_zfail->set_type(GLMessage::DataType::ENUM);
- arg_zfail->add_intvalue((int)zfail);
-
- // copy argument zpass
- GLMessage_DataType *arg_zpass = glmsg.add_args();
- arg_zpass->set_isarray(false);
- arg_zpass->set_type(GLMessage::DataType::ENUM);
- arg_zpass->add_intvalue((int)zpass);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStencilOp(fail, zfail, zpass);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStencilOpSeparate);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument fail
- GLMessage_DataType *arg_fail = glmsg.add_args();
- arg_fail->set_isarray(false);
- arg_fail->set_type(GLMessage::DataType::ENUM);
- arg_fail->add_intvalue((int)fail);
-
- // copy argument zfail
- GLMessage_DataType *arg_zfail = glmsg.add_args();
- arg_zfail->set_isarray(false);
- arg_zfail->set_type(GLMessage::DataType::ENUM);
- arg_zfail->add_intvalue((int)zfail);
-
- // copy argument zpass
- GLMessage_DataType *arg_zpass = glmsg.add_args();
- arg_zpass->set_isarray(false);
- arg_zpass->set_type(GLMessage::DataType::ENUM);
- arg_zpass->add_intvalue((int)zpass);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStencilOpSeparate(face, fail, zfail, zpass);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexImage2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::INT);
- arg_internalformat->add_intvalue(internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument border
- GLMessage_DataType *arg_border = glmsg.add_args();
- arg_border->set_isarray(false);
- arg_border->set_type(GLMessage::DataType::INT);
- arg_border->add_intvalue(border);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument pixels
- GLMessage_DataType *arg_pixels = glmsg.add_args();
- arg_pixels->set_isarray(false);
- arg_pixels->set_type(GLMessage::DataType::INT);
- arg_pixels->add_intvalue((int)pixels);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pixels,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameterf(GLenum target, GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameterf);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameterf(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameterfv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameterfv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameteri(GLenum target, GLenum pname, GLint param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameteri);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameteri(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameteriv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameteriv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexSubImage2D);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument pixels
- GLMessage_DataType *arg_pixels = glmsg.add_args();
- arg_pixels->set_isarray(false);
- arg_pixels->set_type(GLMessage::DataType::INT);
- arg_pixels->add_intvalue((int)pixels);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pixels,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform1f(GLint location, GLfloat x) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform1f);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform1f(location, x);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform1fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform1fv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform1i(GLint location, GLint x) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform1i);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform1i(location, x);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform1iv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform1iv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform2f(GLint location, GLfloat x, GLfloat y) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform2f);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform2f(location, x, y);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform2fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform2fv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform2i(GLint location, GLint x, GLint y) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform2i);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform2i(location, x, y);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform2iv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform2iv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform3f);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform3f(location, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform3fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform3fv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform3i(GLint location, GLint x, GLint y, GLint z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform3i);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform3i(location, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform3iv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform3iv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform4f);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // copy argument w
- GLMessage_DataType *arg_w = glmsg.add_args();
- arg_w->set_isarray(false);
- arg_w->set_type(GLMessage::DataType::FLOAT);
- arg_w->add_floatvalue(w);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform4f(location, x, y, z, w);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform4fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform4fv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform4i);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // copy argument w
- GLMessage_DataType *arg_w = glmsg.add_args();
- arg_w->set_isarray(false);
- arg_w->set_type(GLMessage::DataType::INT);
- arg_w->add_intvalue(w);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform4i(location, x, y, z, w);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint* v) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniform4iv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument v
- GLMessage_DataType *arg_v = glmsg.add_args();
- arg_v->set_isarray(false);
- arg_v->set_type(GLMessage::DataType::INT);
- arg_v->add_intvalue((int)v);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniform4iv(location, count, v);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) v,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniformMatrix2fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument transpose
- GLMessage_DataType *arg_transpose = glmsg.add_args();
- arg_transpose->set_isarray(false);
- arg_transpose->set_type(GLMessage::DataType::BOOL);
- arg_transpose->add_boolvalue(transpose);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniformMatrix2fv(location, count, transpose, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniformMatrix3fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument transpose
- GLMessage_DataType *arg_transpose = glmsg.add_args();
- arg_transpose->set_isarray(false);
- arg_transpose->set_type(GLMessage::DataType::BOOL);
- arg_transpose->add_boolvalue(transpose);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniformMatrix3fv(location, count, transpose, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUniformMatrix4fv);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument transpose
- GLMessage_DataType *arg_transpose = glmsg.add_args();
- arg_transpose->set_isarray(false);
- arg_transpose->set_type(GLMessage::DataType::BOOL);
- arg_transpose->add_boolvalue(transpose);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUniformMatrix4fv(location, count, transpose, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUseProgram(GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUseProgram);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUseProgram(program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glValidateProgram(GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glValidateProgram);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glValidateProgram(program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib1f(GLuint indx, GLfloat x) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib1f);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib1f(indx, x);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib1fv(GLuint indx, const GLfloat* values) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib1fv);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument values
- GLMessage_DataType *arg_values = glmsg.add_args();
- arg_values->set_isarray(false);
- arg_values->set_type(GLMessage::DataType::INT);
- arg_values->add_intvalue((int)values);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib1fv(indx, values);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) values,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib2f);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib2f(indx, x, y);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib2fv(GLuint indx, const GLfloat* values) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib2fv);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument values
- GLMessage_DataType *arg_values = glmsg.add_args();
- arg_values->set_isarray(false);
- arg_values->set_type(GLMessage::DataType::INT);
- arg_values->add_intvalue((int)values);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib2fv(indx, values);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) values,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib3f);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib3f(indx, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib3fv(GLuint indx, const GLfloat* values) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib3fv);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument values
- GLMessage_DataType *arg_values = glmsg.add_args();
- arg_values->set_isarray(false);
- arg_values->set_type(GLMessage::DataType::INT);
- arg_values->add_intvalue((int)values);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib3fv(indx, values);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) values,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib4f);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // copy argument w
- GLMessage_DataType *arg_w = glmsg.add_args();
- arg_w->set_isarray(false);
- arg_w->set_type(GLMessage::DataType::FLOAT);
- arg_w->add_floatvalue(w);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib4f(indx, x, y, z, w);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttrib4fv(GLuint indx, const GLfloat* values) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttrib4fv);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument values
- GLMessage_DataType *arg_values = glmsg.add_args();
- arg_values->set_isarray(false);
- arg_values->set_type(GLMessage::DataType::INT);
- arg_values->add_intvalue((int)values);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttrib4fv(indx, values);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) values,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexAttribPointer);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument normalized
- GLMessage_DataType *arg_normalized = glmsg.add_args();
- arg_normalized->set_isarray(false);
- arg_normalized->set_type(GLMessage::DataType::BOOL);
- arg_normalized->add_boolvalue(normalized);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument ptr
- GLMessage_DataType *arg_ptr = glmsg.add_args();
- arg_ptr->set_isarray(false);
- arg_ptr->set_type(GLMessage::DataType::INT);
- arg_ptr->add_intvalue((int)ptr);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) ptr,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glViewport);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glViewport(x, y, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-
-// Definitions for GL2Ext APIs
-
-void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEGLImageTargetTexture2DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument image
- GLMessage_DataType *arg_image = glmsg.add_args();
- arg_image->set_isarray(false);
- arg_image->set_type(GLMessage::DataType::INT);
- arg_image->add_intvalue((int)image);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEGLImageTargetTexture2DOES(target, image);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) image,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEGLImageTargetRenderbufferStorageOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument image
- GLMessage_DataType *arg_image = glmsg.add_args();
- arg_image->set_isarray(false);
- arg_image->set_type(GLMessage::DataType::INT);
- arg_image->add_intvalue((int)image);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEGLImageTargetRenderbufferStorageOES(target, image);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) image,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetProgramBinaryOES);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument binaryFormat
- GLMessage_DataType *arg_binaryFormat = glmsg.add_args();
- arg_binaryFormat->set_isarray(false);
- arg_binaryFormat->set_type(GLMessage::DataType::INT);
- arg_binaryFormat->add_intvalue((int)binaryFormat);
-
- // copy argument binary
- GLMessage_DataType *arg_binary = glmsg.add_args();
- arg_binary->set_isarray(false);
- arg_binary->set_type(GLMessage::DataType::INT);
- arg_binary->add_intvalue((int)binary);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) binaryFormat,
- (void *) binary,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramBinaryOES);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument binaryFormat
- GLMessage_DataType *arg_binaryFormat = glmsg.add_args();
- arg_binaryFormat->set_isarray(false);
- arg_binaryFormat->set_type(GLMessage::DataType::ENUM);
- arg_binaryFormat->add_intvalue((int)binaryFormat);
-
- // copy argument binary
- GLMessage_DataType *arg_binary = glmsg.add_args();
- arg_binary->set_isarray(false);
- arg_binary->set_type(GLMessage::DataType::INT);
- arg_binary->add_intvalue((int)binary);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue(length);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramBinaryOES(program, binaryFormat, binary, length);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) binary,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void* GLTrace_glMapBufferOES(GLenum target, GLenum access) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMapBufferOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument access
- GLMessage_DataType *arg_access = glmsg.add_args();
- arg_access->set_isarray(false);
- arg_access->set_type(GLMessage::DataType::ENUM);
- arg_access->add_intvalue((int)access);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- void* retValue = glContext->hooks->gl.glMapBufferOES(target, access);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue((int)retValue);
-
- void *pointerArgs[] = {
- (void *) retValue,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glUnmapBufferOES(GLenum target) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUnmapBufferOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glUnmapBufferOES(target);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetBufferPointervOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetBufferPointervOES(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexImage3DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // copy argument border
- GLMessage_DataType *arg_border = glmsg.add_args();
- arg_border->set_isarray(false);
- arg_border->set_type(GLMessage::DataType::INT);
- arg_border->add_intvalue(border);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument pixels
- GLMessage_DataType *arg_pixels = glmsg.add_args();
- arg_pixels->set_isarray(false);
- arg_pixels->set_type(GLMessage::DataType::INT);
- arg_pixels->add_intvalue((int)pixels);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pixels,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexSubImage3DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument zoffset
- GLMessage_DataType *arg_zoffset = glmsg.add_args();
- arg_zoffset->set_isarray(false);
- arg_zoffset->set_type(GLMessage::DataType::INT);
- arg_zoffset->add_intvalue(zoffset);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument pixels
- GLMessage_DataType *arg_pixels = glmsg.add_args();
- arg_pixels->set_isarray(false);
- arg_pixels->set_type(GLMessage::DataType::INT);
- arg_pixels->add_intvalue((int)pixels);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pixels,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCopyTexSubImage3DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument zoffset
- GLMessage_DataType *arg_zoffset = glmsg.add_args();
- arg_zoffset->set_isarray(false);
- arg_zoffset->set_type(GLMessage::DataType::INT);
- arg_zoffset->add_intvalue(zoffset);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCompressedTexImage3DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // copy argument border
- GLMessage_DataType *arg_border = glmsg.add_args();
- arg_border->set_isarray(false);
- arg_border->set_type(GLMessage::DataType::INT);
- arg_border->add_intvalue(border);
-
- // copy argument imageSize
- GLMessage_DataType *arg_imageSize = glmsg.add_args();
- arg_imageSize->set_isarray(false);
- arg_imageSize->set_type(GLMessage::DataType::INT);
- arg_imageSize->add_intvalue(imageSize);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCompressedTexImage3DOES(target, level, internalformat, width, height, depth, border, imageSize, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCompressedTexSubImage3DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument zoffset
- GLMessage_DataType *arg_zoffset = glmsg.add_args();
- arg_zoffset->set_isarray(false);
- arg_zoffset->set_type(GLMessage::DataType::INT);
- arg_zoffset->add_intvalue(zoffset);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument imageSize
- GLMessage_DataType *arg_imageSize = glmsg.add_args();
- arg_imageSize->set_isarray(false);
- arg_imageSize->set_type(GLMessage::DataType::INT);
- arg_imageSize->add_intvalue(imageSize);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferTexture3DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument textarget
- GLMessage_DataType *arg_textarget = glmsg.add_args();
- arg_textarget->set_isarray(false);
- arg_textarget->set_type(GLMessage::DataType::ENUM);
- arg_textarget->add_intvalue((int)textarget);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument zoffset
- GLMessage_DataType *arg_zoffset = glmsg.add_args();
- arg_zoffset->set_isarray(false);
- arg_zoffset->set_type(GLMessage::DataType::INT);
- arg_zoffset->add_intvalue(zoffset);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBindVertexArrayOES(GLuint array) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindVertexArrayOES);
-
- // copy argument array
- GLMessage_DataType *arg_array = glmsg.add_args();
- arg_array->set_isarray(false);
- arg_array->set_type(GLMessage::DataType::INT);
- arg_array->add_intvalue(array);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindVertexArrayOES(array);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteVertexArraysOES);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument arrays
- GLMessage_DataType *arg_arrays = glmsg.add_args();
- arg_arrays->set_isarray(false);
- arg_arrays->set_type(GLMessage::DataType::INT);
- arg_arrays->add_intvalue((int)arrays);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteVertexArraysOES(n, arrays);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) arrays,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint *arrays) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenVertexArraysOES);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument arrays
- GLMessage_DataType *arg_arrays = glmsg.add_args();
- arg_arrays->set_isarray(false);
- arg_arrays->set_type(GLMessage::DataType::INT);
- arg_arrays->add_intvalue((int)arrays);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenVertexArraysOES(n, arrays);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) arrays,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsVertexArrayOES(GLuint array) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsVertexArrayOES);
-
- // copy argument array
- GLMessage_DataType *arg_array = glmsg.add_args();
- arg_array->set_isarray(false);
- arg_array->set_type(GLMessage::DataType::INT);
- arg_array->add_intvalue(array);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsVertexArrayOES(array);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPerfMonitorGroupsAMD);
-
- // copy argument numGroups
- GLMessage_DataType *arg_numGroups = glmsg.add_args();
- arg_numGroups->set_isarray(false);
- arg_numGroups->set_type(GLMessage::DataType::INT);
- arg_numGroups->add_intvalue((int)numGroups);
-
- // copy argument groupsSize
- GLMessage_DataType *arg_groupsSize = glmsg.add_args();
- arg_groupsSize->set_isarray(false);
- arg_groupsSize->set_type(GLMessage::DataType::INT);
- arg_groupsSize->add_intvalue(groupsSize);
-
- // copy argument groups
- GLMessage_DataType *arg_groups = glmsg.add_args();
- arg_groups->set_isarray(false);
- arg_groups->set_type(GLMessage::DataType::INT);
- arg_groups->add_intvalue((int)groups);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPerfMonitorGroupsAMD(numGroups, groupsSize, groups);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) numGroups,
- (void *) groups,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPerfMonitorCountersAMD);
-
- // copy argument group
- GLMessage_DataType *arg_group = glmsg.add_args();
- arg_group->set_isarray(false);
- arg_group->set_type(GLMessage::DataType::INT);
- arg_group->add_intvalue(group);
-
- // copy argument numCounters
- GLMessage_DataType *arg_numCounters = glmsg.add_args();
- arg_numCounters->set_isarray(false);
- arg_numCounters->set_type(GLMessage::DataType::INT);
- arg_numCounters->add_intvalue((int)numCounters);
-
- // copy argument maxActiveCounters
- GLMessage_DataType *arg_maxActiveCounters = glmsg.add_args();
- arg_maxActiveCounters->set_isarray(false);
- arg_maxActiveCounters->set_type(GLMessage::DataType::INT);
- arg_maxActiveCounters->add_intvalue((int)maxActiveCounters);
-
- // copy argument counterSize
- GLMessage_DataType *arg_counterSize = glmsg.add_args();
- arg_counterSize->set_isarray(false);
- arg_counterSize->set_type(GLMessage::DataType::INT);
- arg_counterSize->add_intvalue(counterSize);
-
- // copy argument counters
- GLMessage_DataType *arg_counters = glmsg.add_args();
- arg_counters->set_isarray(false);
- arg_counters->set_type(GLMessage::DataType::INT);
- arg_counters->add_intvalue((int)counters);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) numCounters,
- (void *) maxActiveCounters,
- (void *) counters,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPerfMonitorGroupStringAMD);
-
- // copy argument group
- GLMessage_DataType *arg_group = glmsg.add_args();
- arg_group->set_isarray(false);
- arg_group->set_type(GLMessage::DataType::INT);
- arg_group->add_intvalue(group);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument groupString
- GLMessage_DataType *arg_groupString = glmsg.add_args();
- arg_groupString->set_isarray(false);
- arg_groupString->set_type(GLMessage::DataType::INT);
- arg_groupString->add_intvalue((int)groupString);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPerfMonitorGroupStringAMD(group, bufSize, length, groupString);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) groupString,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPerfMonitorCounterStringAMD);
-
- // copy argument group
- GLMessage_DataType *arg_group = glmsg.add_args();
- arg_group->set_isarray(false);
- arg_group->set_type(GLMessage::DataType::INT);
- arg_group->add_intvalue(group);
-
- // copy argument counter
- GLMessage_DataType *arg_counter = glmsg.add_args();
- arg_counter->set_isarray(false);
- arg_counter->set_type(GLMessage::DataType::INT);
- arg_counter->add_intvalue(counter);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument counterString
- GLMessage_DataType *arg_counterString = glmsg.add_args();
- arg_counterString->set_isarray(false);
- arg_counterString->set_type(GLMessage::DataType::INT);
- arg_counterString->add_intvalue((int)counterString);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) counterString,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPerfMonitorCounterInfoAMD);
-
- // copy argument group
- GLMessage_DataType *arg_group = glmsg.add_args();
- arg_group->set_isarray(false);
- arg_group->set_type(GLMessage::DataType::INT);
- arg_group->add_intvalue(group);
-
- // copy argument counter
- GLMessage_DataType *arg_counter = glmsg.add_args();
- arg_counter->set_isarray(false);
- arg_counter->set_type(GLMessage::DataType::INT);
- arg_counter->add_intvalue(counter);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPerfMonitorCounterInfoAMD(group, counter, pname, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenPerfMonitorsAMD);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument monitors
- GLMessage_DataType *arg_monitors = glmsg.add_args();
- arg_monitors->set_isarray(false);
- arg_monitors->set_type(GLMessage::DataType::INT);
- arg_monitors->add_intvalue((int)monitors);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenPerfMonitorsAMD(n, monitors);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) monitors,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeletePerfMonitorsAMD);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument monitors
- GLMessage_DataType *arg_monitors = glmsg.add_args();
- arg_monitors->set_isarray(false);
- arg_monitors->set_type(GLMessage::DataType::INT);
- arg_monitors->add_intvalue((int)monitors);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeletePerfMonitorsAMD(n, monitors);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) monitors,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glSelectPerfMonitorCountersAMD);
-
- // copy argument monitor
- GLMessage_DataType *arg_monitor = glmsg.add_args();
- arg_monitor->set_isarray(false);
- arg_monitor->set_type(GLMessage::DataType::INT);
- arg_monitor->add_intvalue(monitor);
-
- // copy argument enable
- GLMessage_DataType *arg_enable = glmsg.add_args();
- arg_enable->set_isarray(false);
- arg_enable->set_type(GLMessage::DataType::BOOL);
- arg_enable->add_boolvalue(enable);
-
- // copy argument group
- GLMessage_DataType *arg_group = glmsg.add_args();
- arg_group->set_isarray(false);
- arg_group->set_type(GLMessage::DataType::INT);
- arg_group->add_intvalue(group);
-
- // copy argument numCounters
- GLMessage_DataType *arg_numCounters = glmsg.add_args();
- arg_numCounters->set_isarray(false);
- arg_numCounters->set_type(GLMessage::DataType::INT);
- arg_numCounters->add_intvalue(numCounters);
-
- // copy argument countersList
- GLMessage_DataType *arg_countersList = glmsg.add_args();
- arg_countersList->set_isarray(false);
- arg_countersList->set_type(GLMessage::DataType::INT);
- arg_countersList->add_intvalue((int)countersList);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glSelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, countersList);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) countersList,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBeginPerfMonitorAMD(GLuint monitor) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBeginPerfMonitorAMD);
-
- // copy argument monitor
- GLMessage_DataType *arg_monitor = glmsg.add_args();
- arg_monitor->set_isarray(false);
- arg_monitor->set_type(GLMessage::DataType::INT);
- arg_monitor->add_intvalue(monitor);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBeginPerfMonitorAMD(monitor);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEndPerfMonitorAMD(GLuint monitor) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEndPerfMonitorAMD);
-
- // copy argument monitor
- GLMessage_DataType *arg_monitor = glmsg.add_args();
- arg_monitor->set_isarray(false);
- arg_monitor->set_type(GLMessage::DataType::INT);
- arg_monitor->add_intvalue(monitor);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEndPerfMonitorAMD(monitor);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPerfMonitorCounterDataAMD);
-
- // copy argument monitor
- GLMessage_DataType *arg_monitor = glmsg.add_args();
- arg_monitor->set_isarray(false);
- arg_monitor->set_type(GLMessage::DataType::INT);
- arg_monitor->add_intvalue(monitor);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument dataSize
- GLMessage_DataType *arg_dataSize = glmsg.add_args();
- arg_dataSize->set_isarray(false);
- arg_dataSize->set_type(GLMessage::DataType::INT);
- arg_dataSize->add_intvalue(dataSize);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // copy argument bytesWritten
- GLMessage_DataType *arg_bytesWritten = glmsg.add_args();
- arg_bytesWritten->set_isarray(false);
- arg_bytesWritten->set_type(GLMessage::DataType::INT);
- arg_bytesWritten->add_intvalue((int)bytesWritten);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- (void *) bytesWritten,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlitFramebufferANGLE);
-
- // copy argument srcX0
- GLMessage_DataType *arg_srcX0 = glmsg.add_args();
- arg_srcX0->set_isarray(false);
- arg_srcX0->set_type(GLMessage::DataType::INT);
- arg_srcX0->add_intvalue(srcX0);
-
- // copy argument srcY0
- GLMessage_DataType *arg_srcY0 = glmsg.add_args();
- arg_srcY0->set_isarray(false);
- arg_srcY0->set_type(GLMessage::DataType::INT);
- arg_srcY0->add_intvalue(srcY0);
-
- // copy argument srcX1
- GLMessage_DataType *arg_srcX1 = glmsg.add_args();
- arg_srcX1->set_isarray(false);
- arg_srcX1->set_type(GLMessage::DataType::INT);
- arg_srcX1->add_intvalue(srcX1);
-
- // copy argument srcY1
- GLMessage_DataType *arg_srcY1 = glmsg.add_args();
- arg_srcY1->set_isarray(false);
- arg_srcY1->set_type(GLMessage::DataType::INT);
- arg_srcY1->add_intvalue(srcY1);
-
- // copy argument dstX0
- GLMessage_DataType *arg_dstX0 = glmsg.add_args();
- arg_dstX0->set_isarray(false);
- arg_dstX0->set_type(GLMessage::DataType::INT);
- arg_dstX0->add_intvalue(dstX0);
-
- // copy argument dstY0
- GLMessage_DataType *arg_dstY0 = glmsg.add_args();
- arg_dstY0->set_isarray(false);
- arg_dstY0->set_type(GLMessage::DataType::INT);
- arg_dstY0->add_intvalue(dstY0);
-
- // copy argument dstX1
- GLMessage_DataType *arg_dstX1 = glmsg.add_args();
- arg_dstX1->set_isarray(false);
- arg_dstX1->set_type(GLMessage::DataType::INT);
- arg_dstX1->add_intvalue(dstX1);
-
- // copy argument dstY1
- GLMessage_DataType *arg_dstY1 = glmsg.add_args();
- arg_dstY1->set_isarray(false);
- arg_dstY1->set_type(GLMessage::DataType::INT);
- arg_dstY1->add_intvalue(dstY1);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::INT);
- arg_mask->add_intvalue(mask);
-
- // copy argument filter
- GLMessage_DataType *arg_filter = glmsg.add_args();
- arg_filter->set_isarray(false);
- arg_filter->set_type(GLMessage::DataType::ENUM);
- arg_filter->add_intvalue((int)filter);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleANGLE);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument samples
- GLMessage_DataType *arg_samples = glmsg.add_args();
- arg_samples->set_isarray(false);
- arg_samples->set_type(GLMessage::DataType::INT);
- arg_samples->add_intvalue(samples);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleAPPLE);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument samples
- GLMessage_DataType *arg_samples = glmsg.add_args();
- arg_samples->set_isarray(false);
- arg_samples->set_type(GLMessage::DataType::INT);
- arg_samples->add_intvalue(samples);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRenderbufferStorageMultisampleAPPLE(target, samples, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glResolveMultisampleFramebufferAPPLE(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glResolveMultisampleFramebufferAPPLE);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glResolveMultisampleFramebufferAPPLE();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLabelObjectEXT);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument object
- GLMessage_DataType *arg_object = glmsg.add_args();
- arg_object->set_isarray(false);
- arg_object->set_type(GLMessage::DataType::INT);
- arg_object->add_intvalue(object);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue(length);
-
- // copy argument label
- GLMessage_DataType *arg_label = glmsg.add_args();
- arg_label->set_isarray(false);
- arg_label->set_type(GLMessage::DataType::INT);
- arg_label->add_intvalue((int)label);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLabelObjectEXT(type, object, length, label);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) label,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetObjectLabelEXT);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument object
- GLMessage_DataType *arg_object = glmsg.add_args();
- arg_object->set_isarray(false);
- arg_object->set_type(GLMessage::DataType::INT);
- arg_object->add_intvalue(object);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument label
- GLMessage_DataType *arg_label = glmsg.add_args();
- arg_label->set_isarray(false);
- arg_label->set_type(GLMessage::DataType::INT);
- arg_label->add_intvalue((int)label);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetObjectLabelEXT(type, object, bufSize, length, label);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) label,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glInsertEventMarkerEXT(GLsizei length, const GLchar *marker) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glInsertEventMarkerEXT);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue(length);
-
- // copy argument marker
- GLMessage_DataType *arg_marker = glmsg.add_args();
- arg_marker->set_isarray(false);
- arg_marker->set_type(GLMessage::DataType::INT);
- arg_marker->add_intvalue((int)marker);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glInsertEventMarkerEXT(length, marker);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) marker,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPushGroupMarkerEXT(GLsizei length, const GLchar *marker) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPushGroupMarkerEXT);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue(length);
-
- // copy argument marker
- GLMessage_DataType *arg_marker = glmsg.add_args();
- arg_marker->set_isarray(false);
- arg_marker->set_type(GLMessage::DataType::INT);
- arg_marker->add_intvalue((int)marker);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPushGroupMarkerEXT(length, marker);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) marker,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPopGroupMarkerEXT(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPopGroupMarkerEXT);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPopGroupMarkerEXT();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDiscardFramebufferEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument numAttachments
- GLMessage_DataType *arg_numAttachments = glmsg.add_args();
- arg_numAttachments->set_isarray(false);
- arg_numAttachments->set_type(GLMessage::DataType::INT);
- arg_numAttachments->add_intvalue(numAttachments);
-
- // copy argument attachments
- GLMessage_DataType *arg_attachments = glmsg.add_args();
- arg_attachments->set_isarray(false);
- arg_attachments->set_type(GLMessage::DataType::INT);
- arg_attachments->add_intvalue((int)attachments);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDiscardFramebufferEXT(target, numAttachments, attachments);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) attachments,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument samples
- GLMessage_DataType *arg_samples = glmsg.add_args();
- arg_samples->set_isarray(false);
- arg_samples->set_type(GLMessage::DataType::INT);
- arg_samples->add_intvalue(samples);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument textarget
- GLMessage_DataType *arg_textarget = glmsg.add_args();
- arg_textarget->set_isarray(false);
- arg_textarget->set_type(GLMessage::DataType::ENUM);
- arg_textarget->add_intvalue((int)textarget);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument samples
- GLMessage_DataType *arg_samples = glmsg.add_args();
- arg_samples->set_isarray(false);
- arg_samples->set_type(GLMessage::DataType::INT);
- arg_samples->add_intvalue(samples);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultiDrawArraysEXT);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // copy argument first
- GLMessage_DataType *arg_first = glmsg.add_args();
- arg_first->set_isarray(false);
- arg_first->set_type(GLMessage::DataType::INT);
- arg_first->add_intvalue((int)first);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue((int)count);
-
- // copy argument primcount
- GLMessage_DataType *arg_primcount = glmsg.add_args();
- arg_primcount->set_isarray(false);
- arg_primcount->set_type(GLMessage::DataType::INT);
- arg_primcount->add_intvalue(primcount);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultiDrawArraysEXT(mode, first, count, primcount);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) first,
- (void *) count,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultiDrawElementsEXT);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue((int)count);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument indices
- GLMessage_DataType *arg_indices = glmsg.add_args();
- arg_indices->set_isarray(false);
- arg_indices->set_type(GLMessage::DataType::INT);
- arg_indices->add_intvalue((int)indices);
-
- // copy argument primcount
- GLMessage_DataType *arg_primcount = glmsg.add_args();
- arg_primcount->set_isarray(false);
- arg_primcount->set_type(GLMessage::DataType::INT);
- arg_primcount->add_intvalue(primcount);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultiDrawElementsEXT(mode, count, type, indices, primcount);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) count,
- (void *) indices,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenQueriesEXT(GLsizei n, GLuint *ids) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenQueriesEXT);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument ids
- GLMessage_DataType *arg_ids = glmsg.add_args();
- arg_ids->set_isarray(false);
- arg_ids->set_type(GLMessage::DataType::INT);
- arg_ids->add_intvalue((int)ids);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenQueriesEXT(n, ids);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) ids,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteQueriesEXT(GLsizei n, const GLuint *ids) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteQueriesEXT);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument ids
- GLMessage_DataType *arg_ids = glmsg.add_args();
- arg_ids->set_isarray(false);
- arg_ids->set_type(GLMessage::DataType::INT);
- arg_ids->add_intvalue((int)ids);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteQueriesEXT(n, ids);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) ids,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsQueryEXT(GLuint id) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsQueryEXT);
-
- // copy argument id
- GLMessage_DataType *arg_id = glmsg.add_args();
- arg_id->set_isarray(false);
- arg_id->set_type(GLMessage::DataType::INT);
- arg_id->add_intvalue(id);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsQueryEXT(id);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glBeginQueryEXT(GLenum target, GLuint id) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBeginQueryEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument id
- GLMessage_DataType *arg_id = glmsg.add_args();
- arg_id->set_isarray(false);
- arg_id->set_type(GLMessage::DataType::INT);
- arg_id->add_intvalue(id);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBeginQueryEXT(target, id);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEndQueryEXT(GLenum target) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEndQueryEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEndQueryEXT(target);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetQueryivEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetQueryivEXT(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetQueryObjectuivEXT);
-
- // copy argument id
- GLMessage_DataType *arg_id = glmsg.add_args();
- arg_id->set_isarray(false);
- arg_id->set_type(GLMessage::DataType::INT);
- arg_id->add_intvalue(id);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetQueryObjectuivEXT(id, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLenum GLTrace_glGetGraphicsResetStatusEXT(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetGraphicsResetStatusEXT);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLenum retValue = glContext->hooks->gl.glGetGraphicsResetStatusEXT();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::ENUM);
- rt->add_intvalue((int)retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glReadnPixelsEXT);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument data
- GLMessage_DataType *arg_data = glmsg.add_args();
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::INT);
- arg_data->add_intvalue((int)data);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glReadnPixelsEXT(x, y, width, height, format, type, bufSize, data);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) data,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetnUniformfvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetnUniformfvEXT(program, location, bufSize, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetnUniformivEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetnUniformivEXT(program, location, bufSize, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glUseProgramStagesEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // copy argument stages
- GLMessage_DataType *arg_stages = glmsg.add_args();
- arg_stages->set_isarray(false);
- arg_stages->set_type(GLMessage::DataType::INT);
- arg_stages->add_intvalue(stages);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glUseProgramStagesEXT(pipeline, stages, program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glActiveShaderProgramEXT(GLuint pipeline, GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glActiveShaderProgramEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glActiveShaderProgramEXT(pipeline, program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLuint GLTrace_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCreateShaderProgramvEXT);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument strings
- GLMessage_DataType *arg_strings = glmsg.add_args();
- arg_strings->set_isarray(false);
- arg_strings->set_type(GLMessage::DataType::INT);
- arg_strings->add_intvalue((int)strings);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLuint retValue = glContext->hooks->gl.glCreateShaderProgramvEXT(type, count, strings);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue(retValue);
-
- void *pointerArgs[] = {
- (void *) strings,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glBindProgramPipelineEXT(GLuint pipeline) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindProgramPipelineEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindProgramPipelineEXT(pipeline);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteProgramPipelinesEXT);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument pipelines
- GLMessage_DataType *arg_pipelines = glmsg.add_args();
- arg_pipelines->set_isarray(false);
- arg_pipelines->set_type(GLMessage::DataType::INT);
- arg_pipelines->add_intvalue((int)pipelines);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteProgramPipelinesEXT(n, pipelines);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pipelines,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenProgramPipelinesEXT);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument pipelines
- GLMessage_DataType *arg_pipelines = glmsg.add_args();
- arg_pipelines->set_isarray(false);
- arg_pipelines->set_type(GLMessage::DataType::INT);
- arg_pipelines->add_intvalue((int)pipelines);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenProgramPipelinesEXT(n, pipelines);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pipelines,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsProgramPipelineEXT(GLuint pipeline) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsProgramPipelineEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsProgramPipelineEXT(pipeline);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramParameteriEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue(value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramParameteriEXT(program, pname, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetProgramPipelineivEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetProgramPipelineivEXT(pipeline, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform1iEXT(GLuint program, GLint location, GLint x) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform1iEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform1iEXT(program, location, x);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform2iEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform2iEXT(program, location, x, y);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform3iEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform3iEXT(program, location, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform4iEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // copy argument w
- GLMessage_DataType *arg_w = glmsg.add_args();
- arg_w->set_isarray(false);
- arg_w->set_type(GLMessage::DataType::INT);
- arg_w->add_intvalue(w);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform4iEXT(program, location, x, y, z, w);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform1fEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform1fEXT(program, location, x);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform2fEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform2fEXT(program, location, x, y);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform3fEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform3fEXT(program, location, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform4fEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // copy argument w
- GLMessage_DataType *arg_w = glmsg.add_args();
- arg_w->set_isarray(false);
- arg_w->set_type(GLMessage::DataType::FLOAT);
- arg_w->add_floatvalue(w);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform4fEXT(program, location, x, y, z, w);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform1ivEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform1ivEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform2ivEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform2ivEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform3ivEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform3ivEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform4ivEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform4ivEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform1fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform1fvEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform2fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform2fvEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform3fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform3fvEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniform4fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniform4fvEXT(program, location, count, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniformMatrix2fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument transpose
- GLMessage_DataType *arg_transpose = glmsg.add_args();
- arg_transpose->set_isarray(false);
- arg_transpose->set_type(GLMessage::DataType::BOOL);
- arg_transpose->add_boolvalue(transpose);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniformMatrix2fvEXT(program, location, count, transpose, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniformMatrix3fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument transpose
- GLMessage_DataType *arg_transpose = glmsg.add_args();
- arg_transpose->set_isarray(false);
- arg_transpose->set_type(GLMessage::DataType::BOOL);
- arg_transpose->add_boolvalue(transpose);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniformMatrix3fvEXT(program, location, count, transpose, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glProgramUniformMatrix4fvEXT);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument location
- GLMessage_DataType *arg_location = glmsg.add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-
- // copy argument count
- GLMessage_DataType *arg_count = glmsg.add_args();
- arg_count->set_isarray(false);
- arg_count->set_type(GLMessage::DataType::INT);
- arg_count->add_intvalue(count);
-
- // copy argument transpose
- GLMessage_DataType *arg_transpose = glmsg.add_args();
- arg_transpose->set_isarray(false);
- arg_transpose->set_type(GLMessage::DataType::BOOL);
- arg_transpose->add_boolvalue(transpose);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue((int)value);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glProgramUniformMatrix4fvEXT(program, location, count, transpose, value);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) value,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glValidateProgramPipelineEXT(GLuint pipeline) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glValidateProgramPipelineEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glValidateProgramPipelineEXT(pipeline);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetProgramPipelineInfoLogEXT);
-
- // copy argument pipeline
- GLMessage_DataType *arg_pipeline = glmsg.add_args();
- arg_pipeline->set_isarray(false);
- arg_pipeline->set_type(GLMessage::DataType::INT);
- arg_pipeline->add_intvalue(pipeline);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument infoLog
- GLMessage_DataType *arg_infoLog = glmsg.add_args();
- arg_infoLog->set_isarray(false);
- arg_infoLog->set_type(GLMessage::DataType::INT);
- arg_infoLog->add_intvalue((int)infoLog);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetProgramPipelineInfoLogEXT(pipeline, bufSize, length, infoLog);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) infoLog,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexStorage1DEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument levels
- GLMessage_DataType *arg_levels = glmsg.add_args();
- arg_levels->set_isarray(false);
- arg_levels->set_type(GLMessage::DataType::INT);
- arg_levels->add_intvalue(levels);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexStorage1DEXT(target, levels, internalformat, width);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexStorage2DEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument levels
- GLMessage_DataType *arg_levels = glmsg.add_args();
- arg_levels->set_isarray(false);
- arg_levels->set_type(GLMessage::DataType::INT);
- arg_levels->add_intvalue(levels);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexStorage2DEXT(target, levels, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexStorage3DEXT);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument levels
- GLMessage_DataType *arg_levels = glmsg.add_args();
- arg_levels->set_isarray(false);
- arg_levels->set_type(GLMessage::DataType::INT);
- arg_levels->add_intvalue(levels);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexStorage3DEXT(target, levels, internalformat, width, height, depth);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTextureStorage1DEXT);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument levels
- GLMessage_DataType *arg_levels = glmsg.add_args();
- arg_levels->set_isarray(false);
- arg_levels->set_type(GLMessage::DataType::INT);
- arg_levels->add_intvalue(levels);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTextureStorage1DEXT(texture, target, levels, internalformat, width);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTextureStorage2DEXT);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument levels
- GLMessage_DataType *arg_levels = glmsg.add_args();
- arg_levels->set_isarray(false);
- arg_levels->set_type(GLMessage::DataType::INT);
- arg_levels->add_intvalue(levels);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTextureStorage2DEXT(texture, target, levels, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTextureStorage3DEXT);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument levels
- GLMessage_DataType *arg_levels = glmsg.add_args();
- arg_levels->set_isarray(false);
- arg_levels->set_type(GLMessage::DataType::INT);
- arg_levels->add_intvalue(levels);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTextureStorage3DEXT(texture, target, levels, internalformat, width, height, depth);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleIMG);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument samples
- GLMessage_DataType *arg_samples = glmsg.add_args();
- arg_samples->set_isarray(false);
- arg_samples->set_type(GLMessage::DataType::INT);
- arg_samples->add_intvalue(samples);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleIMG);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument textarget
- GLMessage_DataType *arg_textarget = glmsg.add_args();
- arg_textarget->set_isarray(false);
- arg_textarget->set_type(GLMessage::DataType::ENUM);
- arg_textarget->add_intvalue((int)textarget);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument samples
- GLMessage_DataType *arg_samples = glmsg.add_args();
- arg_samples->set_isarray(false);
- arg_samples->set_type(GLMessage::DataType::INT);
- arg_samples->add_intvalue(samples);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCoverageMaskNV(GLboolean mask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCoverageMaskNV);
-
- // copy argument mask
- GLMessage_DataType *arg_mask = glmsg.add_args();
- arg_mask->set_isarray(false);
- arg_mask->set_type(GLMessage::DataType::BOOL);
- arg_mask->add_boolvalue(mask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCoverageMaskNV(mask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCoverageOperationNV(GLenum operation) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCoverageOperationNV);
-
- // copy argument operation
- GLMessage_DataType *arg_operation = glmsg.add_args();
- arg_operation->set_isarray(false);
- arg_operation->set_type(GLMessage::DataType::ENUM);
- arg_operation->add_intvalue((int)operation);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCoverageOperationNV(operation);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawBuffersNV(GLsizei n, const GLenum *bufs) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawBuffersNV);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument bufs
- GLMessage_DataType *arg_bufs = glmsg.add_args();
- arg_bufs->set_isarray(false);
- arg_bufs->set_type(GLMessage::DataType::INT);
- arg_bufs->add_intvalue((int)bufs);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawBuffersNV(n, bufs);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) bufs,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint *fences) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteFencesNV);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument fences
- GLMessage_DataType *arg_fences = glmsg.add_args();
- arg_fences->set_isarray(false);
- arg_fences->set_type(GLMessage::DataType::INT);
- arg_fences->add_intvalue((int)fences);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteFencesNV(n, fences);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) fences,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenFencesNV(GLsizei n, GLuint *fences) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenFencesNV);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument fences
- GLMessage_DataType *arg_fences = glmsg.add_args();
- arg_fences->set_isarray(false);
- arg_fences->set_type(GLMessage::DataType::INT);
- arg_fences->add_intvalue((int)fences);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenFencesNV(n, fences);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) fences,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsFenceNV(GLuint fence) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsFenceNV);
-
- // copy argument fence
- GLMessage_DataType *arg_fence = glmsg.add_args();
- arg_fence->set_isarray(false);
- arg_fence->set_type(GLMessage::DataType::INT);
- arg_fence->add_intvalue(fence);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsFenceNV(fence);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-GLboolean GLTrace_glTestFenceNV(GLuint fence) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTestFenceNV);
-
- // copy argument fence
- GLMessage_DataType *arg_fence = glmsg.add_args();
- arg_fence->set_isarray(false);
- arg_fence->set_type(GLMessage::DataType::INT);
- arg_fence->add_intvalue(fence);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glTestFenceNV(fence);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetFenceivNV);
-
- // copy argument fence
- GLMessage_DataType *arg_fence = glmsg.add_args();
- arg_fence->set_isarray(false);
- arg_fence->set_type(GLMessage::DataType::INT);
- arg_fence->add_intvalue(fence);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetFenceivNV(fence, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFinishFenceNV(GLuint fence) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFinishFenceNV);
-
- // copy argument fence
- GLMessage_DataType *arg_fence = glmsg.add_args();
- arg_fence->set_isarray(false);
- arg_fence->set_type(GLMessage::DataType::INT);
- arg_fence->add_intvalue(fence);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFinishFenceNV(fence);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glSetFenceNV(GLuint fence, GLenum condition) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glSetFenceNV);
-
- // copy argument fence
- GLMessage_DataType *arg_fence = glmsg.add_args();
- arg_fence->set_isarray(false);
- arg_fence->set_type(GLMessage::DataType::INT);
- arg_fence->add_intvalue(fence);
-
- // copy argument condition
- GLMessage_DataType *arg_condition = glmsg.add_args();
- arg_condition->set_isarray(false);
- arg_condition->set_type(GLMessage::DataType::ENUM);
- arg_condition->add_intvalue((int)condition);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glSetFenceNV(fence, condition);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glReadBufferNV(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glReadBufferNV);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glReadBufferNV(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glAlphaFuncQCOM(GLenum func, GLclampf ref) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glAlphaFuncQCOM);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // copy argument ref
- GLMessage_DataType *arg_ref = glmsg.add_args();
- arg_ref->set_isarray(false);
- arg_ref->set_type(GLMessage::DataType::FLOAT);
- arg_ref->add_floatvalue(ref);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glAlphaFuncQCOM(func, ref);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetDriverControlsQCOM);
-
- // copy argument num
- GLMessage_DataType *arg_num = glmsg.add_args();
- arg_num->set_isarray(false);
- arg_num->set_type(GLMessage::DataType::INT);
- arg_num->add_intvalue((int)num);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument driverControls
- GLMessage_DataType *arg_driverControls = glmsg.add_args();
- arg_driverControls->set_isarray(false);
- arg_driverControls->set_type(GLMessage::DataType::INT);
- arg_driverControls->add_intvalue((int)driverControls);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetDriverControlsQCOM(num, size, driverControls);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) num,
- (void *) driverControls,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetDriverControlStringQCOM);
-
- // copy argument driverControl
- GLMessage_DataType *arg_driverControl = glmsg.add_args();
- arg_driverControl->set_isarray(false);
- arg_driverControl->set_type(GLMessage::DataType::INT);
- arg_driverControl->add_intvalue(driverControl);
-
- // copy argument bufSize
- GLMessage_DataType *arg_bufSize = glmsg.add_args();
- arg_bufSize->set_isarray(false);
- arg_bufSize->set_type(GLMessage::DataType::INT);
- arg_bufSize->add_intvalue(bufSize);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // copy argument driverControlString
- GLMessage_DataType *arg_driverControlString = glmsg.add_args();
- arg_driverControlString->set_isarray(false);
- arg_driverControlString->set_type(GLMessage::DataType::INT);
- arg_driverControlString->add_intvalue((int)driverControlString);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) length,
- (void *) driverControlString,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEnableDriverControlQCOM(GLuint driverControl) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEnableDriverControlQCOM);
-
- // copy argument driverControl
- GLMessage_DataType *arg_driverControl = glmsg.add_args();
- arg_driverControl->set_isarray(false);
- arg_driverControl->set_type(GLMessage::DataType::INT);
- arg_driverControl->add_intvalue(driverControl);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEnableDriverControlQCOM(driverControl);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDisableDriverControlQCOM(GLuint driverControl) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDisableDriverControlQCOM);
-
- // copy argument driverControl
- GLMessage_DataType *arg_driverControl = glmsg.add_args();
- arg_driverControl->set_isarray(false);
- arg_driverControl->set_type(GLMessage::DataType::INT);
- arg_driverControl->add_intvalue(driverControl);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDisableDriverControlQCOM(driverControl);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetTexturesQCOM);
-
- // copy argument textures
- GLMessage_DataType *arg_textures = glmsg.add_args();
- arg_textures->set_isarray(false);
- arg_textures->set_type(GLMessage::DataType::INT);
- arg_textures->add_intvalue((int)textures);
-
- // copy argument maxTextures
- GLMessage_DataType *arg_maxTextures = glmsg.add_args();
- arg_maxTextures->set_isarray(false);
- arg_maxTextures->set_type(GLMessage::DataType::INT);
- arg_maxTextures->add_intvalue(maxTextures);
-
- // copy argument numTextures
- GLMessage_DataType *arg_numTextures = glmsg.add_args();
- arg_numTextures->set_isarray(false);
- arg_numTextures->set_type(GLMessage::DataType::INT);
- arg_numTextures->add_intvalue((int)numTextures);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetTexturesQCOM(textures, maxTextures, numTextures);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) textures,
- (void *) numTextures,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetBuffersQCOM);
-
- // copy argument buffers
- GLMessage_DataType *arg_buffers = glmsg.add_args();
- arg_buffers->set_isarray(false);
- arg_buffers->set_type(GLMessage::DataType::INT);
- arg_buffers->add_intvalue((int)buffers);
-
- // copy argument maxBuffers
- GLMessage_DataType *arg_maxBuffers = glmsg.add_args();
- arg_maxBuffers->set_isarray(false);
- arg_maxBuffers->set_type(GLMessage::DataType::INT);
- arg_maxBuffers->add_intvalue(maxBuffers);
-
- // copy argument numBuffers
- GLMessage_DataType *arg_numBuffers = glmsg.add_args();
- arg_numBuffers->set_isarray(false);
- arg_numBuffers->set_type(GLMessage::DataType::INT);
- arg_numBuffers->add_intvalue((int)numBuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) buffers,
- (void *) numBuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetRenderbuffersQCOM);
-
- // copy argument renderbuffers
- GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
- arg_renderbuffers->set_isarray(false);
- arg_renderbuffers->set_type(GLMessage::DataType::INT);
- arg_renderbuffers->add_intvalue((int)renderbuffers);
-
- // copy argument maxRenderbuffers
- GLMessage_DataType *arg_maxRenderbuffers = glmsg.add_args();
- arg_maxRenderbuffers->set_isarray(false);
- arg_maxRenderbuffers->set_type(GLMessage::DataType::INT);
- arg_maxRenderbuffers->add_intvalue(maxRenderbuffers);
-
- // copy argument numRenderbuffers
- GLMessage_DataType *arg_numRenderbuffers = glmsg.add_args();
- arg_numRenderbuffers->set_isarray(false);
- arg_numRenderbuffers->set_type(GLMessage::DataType::INT);
- arg_numRenderbuffers->add_intvalue((int)numRenderbuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) renderbuffers,
- (void *) numRenderbuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetFramebuffersQCOM);
-
- // copy argument framebuffers
- GLMessage_DataType *arg_framebuffers = glmsg.add_args();
- arg_framebuffers->set_isarray(false);
- arg_framebuffers->set_type(GLMessage::DataType::INT);
- arg_framebuffers->add_intvalue((int)framebuffers);
-
- // copy argument maxFramebuffers
- GLMessage_DataType *arg_maxFramebuffers = glmsg.add_args();
- arg_maxFramebuffers->set_isarray(false);
- arg_maxFramebuffers->set_type(GLMessage::DataType::INT);
- arg_maxFramebuffers->add_intvalue(maxFramebuffers);
-
- // copy argument numFramebuffers
- GLMessage_DataType *arg_numFramebuffers = glmsg.add_args();
- arg_numFramebuffers->set_isarray(false);
- arg_numFramebuffers->set_type(GLMessage::DataType::INT);
- arg_numFramebuffers->add_intvalue((int)numFramebuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) framebuffers,
- (void *) numFramebuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetTexLevelParameterivQCOM);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtTexObjectStateOverrideiQCOM);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtTexObjectStateOverrideiQCOM(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetTexSubImageQCOM);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // copy argument xoffset
- GLMessage_DataType *arg_xoffset = glmsg.add_args();
- arg_xoffset->set_isarray(false);
- arg_xoffset->set_type(GLMessage::DataType::INT);
- arg_xoffset->add_intvalue(xoffset);
-
- // copy argument yoffset
- GLMessage_DataType *arg_yoffset = glmsg.add_args();
- arg_yoffset->set_isarray(false);
- arg_yoffset->set_type(GLMessage::DataType::INT);
- arg_yoffset->add_intvalue(yoffset);
-
- // copy argument zoffset
- GLMessage_DataType *arg_zoffset = glmsg.add_args();
- arg_zoffset->set_isarray(false);
- arg_zoffset->set_type(GLMessage::DataType::INT);
- arg_zoffset->add_intvalue(zoffset);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // copy argument format
- GLMessage_DataType *arg_format = glmsg.add_args();
- arg_format->set_isarray(false);
- arg_format->set_type(GLMessage::DataType::ENUM);
- arg_format->add_intvalue((int)format);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument texels
- GLMessage_DataType *arg_texels = glmsg.add_args();
- arg_texels->set_isarray(false);
- arg_texels->set_type(GLMessage::DataType::INT);
- arg_texels->add_intvalue((int)texels);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) texels,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetBufferPointervQCOM(GLenum target, GLvoid **params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetBufferPointervQCOM);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetBufferPointervQCOM(target, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetShadersQCOM);
-
- // copy argument shaders
- GLMessage_DataType *arg_shaders = glmsg.add_args();
- arg_shaders->set_isarray(false);
- arg_shaders->set_type(GLMessage::DataType::INT);
- arg_shaders->add_intvalue((int)shaders);
-
- // copy argument maxShaders
- GLMessage_DataType *arg_maxShaders = glmsg.add_args();
- arg_maxShaders->set_isarray(false);
- arg_maxShaders->set_type(GLMessage::DataType::INT);
- arg_maxShaders->add_intvalue(maxShaders);
-
- // copy argument numShaders
- GLMessage_DataType *arg_numShaders = glmsg.add_args();
- arg_numShaders->set_isarray(false);
- arg_numShaders->set_type(GLMessage::DataType::INT);
- arg_numShaders->add_intvalue((int)numShaders);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetShadersQCOM(shaders, maxShaders, numShaders);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) shaders,
- (void *) numShaders,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetProgramsQCOM);
-
- // copy argument programs
- GLMessage_DataType *arg_programs = glmsg.add_args();
- arg_programs->set_isarray(false);
- arg_programs->set_type(GLMessage::DataType::INT);
- arg_programs->add_intvalue((int)programs);
-
- // copy argument maxPrograms
- GLMessage_DataType *arg_maxPrograms = glmsg.add_args();
- arg_maxPrograms->set_isarray(false);
- arg_maxPrograms->set_type(GLMessage::DataType::INT);
- arg_maxPrograms->add_intvalue(maxPrograms);
-
- // copy argument numPrograms
- GLMessage_DataType *arg_numPrograms = glmsg.add_args();
- arg_numPrograms->set_isarray(false);
- arg_numPrograms->set_type(GLMessage::DataType::INT);
- arg_numPrograms->add_intvalue((int)numPrograms);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetProgramsQCOM(programs, maxPrograms, numPrograms);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) programs,
- (void *) numPrograms,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtIsProgramBinaryQCOM);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glExtIsProgramBinaryQCOM(program);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glExtGetProgramBinarySourceQCOM);
-
- // copy argument program
- GLMessage_DataType *arg_program = glmsg.add_args();
- arg_program->set_isarray(false);
- arg_program->set_type(GLMessage::DataType::INT);
- arg_program->add_intvalue(program);
-
- // copy argument shadertype
- GLMessage_DataType *arg_shadertype = glmsg.add_args();
- arg_shadertype->set_isarray(false);
- arg_shadertype->set_type(GLMessage::DataType::ENUM);
- arg_shadertype->add_intvalue((int)shadertype);
-
- // copy argument source
- GLMessage_DataType *arg_source = glmsg.add_args();
- arg_source->set_isarray(false);
- arg_source->set_type(GLMessage::DataType::INT);
- arg_source->add_intvalue((int)source);
-
- // copy argument length
- GLMessage_DataType *arg_length = glmsg.add_args();
- arg_length->set_isarray(false);
- arg_length->set_type(GLMessage::DataType::INT);
- arg_length->add_intvalue((int)length);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glExtGetProgramBinarySourceQCOM(program, shadertype, source, length);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) source,
- (void *) length,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glStartTilingQCOM);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // copy argument preserveMask
- GLMessage_DataType *arg_preserveMask = glmsg.add_args();
- arg_preserveMask->set_isarray(false);
- arg_preserveMask->set_type(GLMessage::DataType::INT);
- arg_preserveMask->add_intvalue(preserveMask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glStartTilingQCOM(x, y, width, height, preserveMask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEndTilingQCOM(GLbitfield preserveMask) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEndTilingQCOM);
-
- // copy argument preserveMask
- GLMessage_DataType *arg_preserveMask = glmsg.add_args();
- arg_preserveMask->set_isarray(false);
- arg_preserveMask->set_type(GLMessage::DataType::INT);
- arg_preserveMask->add_intvalue(preserveMask);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEndTilingQCOM(preserveMask);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-
-// Definitions for GL1 APIs
-
-void GLTrace_glAlphaFunc(GLenum func, GLclampf ref) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glAlphaFunc);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // copy argument ref
- GLMessage_DataType *arg_ref = glmsg.add_args();
- arg_ref->set_isarray(false);
- arg_ref->set_type(GLMessage::DataType::FLOAT);
- arg_ref->add_floatvalue(ref);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glAlphaFunc(func, ref);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClipPlanef(GLenum plane, const GLfloat *equation) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClipPlanef);
-
- // copy argument plane
- GLMessage_DataType *arg_plane = glmsg.add_args();
- arg_plane->set_isarray(false);
- arg_plane->set_type(GLMessage::DataType::ENUM);
- arg_plane->add_intvalue((int)plane);
-
- // copy argument equation
- GLMessage_DataType *arg_equation = glmsg.add_args();
- arg_equation->set_isarray(false);
- arg_equation->set_type(GLMessage::DataType::INT);
- arg_equation->add_intvalue((int)equation);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClipPlanef(plane, equation);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) equation,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glColor4f);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::FLOAT);
- arg_red->add_floatvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::FLOAT);
- arg_green->add_floatvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::FLOAT);
- arg_blue->add_floatvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::FLOAT);
- arg_alpha->add_floatvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glColor4f(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFogf(GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFogf);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFogf(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFogfv(GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFogfv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFogfv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFrustumf);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::FLOAT);
- arg_left->add_floatvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::FLOAT);
- arg_right->add_floatvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::FLOAT);
- arg_bottom->add_floatvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::FLOAT);
- arg_top->add_floatvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::FLOAT);
- arg_zNear->add_floatvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::FLOAT);
- arg_zFar->add_floatvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFrustumf(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetClipPlanef(GLenum pname, GLfloat eqn[4]) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetClipPlanef);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument eqn
- GLMessage_DataType *arg_eqn = glmsg.add_args();
- arg_eqn->set_isarray(false);
- arg_eqn->set_type(GLMessage::DataType::INT);
- arg_eqn->add_intvalue((int)eqn);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetClipPlanef(pname, eqn);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) eqn,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetLightfv);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetLightfv(light, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetMaterialfv);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetMaterialfv(face, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexEnvfv);
-
- // copy argument env
- GLMessage_DataType *arg_env = glmsg.add_args();
- arg_env->set_isarray(false);
- arg_env->set_type(GLMessage::DataType::ENUM);
- arg_env->add_intvalue((int)env);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexEnvfv(env, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightModelf(GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightModelf);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightModelf(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightModelfv(GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightModelfv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightModelfv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightf);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightf(light, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightfv);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightfv(light, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLoadMatrixf(const GLfloat *m) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLoadMatrixf);
-
- // copy argument m
- GLMessage_DataType *arg_m = glmsg.add_args();
- arg_m->set_isarray(false);
- arg_m->set_type(GLMessage::DataType::INT);
- arg_m->add_intvalue((int)m);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLoadMatrixf(m);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) m,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMaterialf);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMaterialf(face, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMaterialfv);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMaterialfv(face, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultMatrixf(const GLfloat *m) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultMatrixf);
-
- // copy argument m
- GLMessage_DataType *arg_m = glmsg.add_args();
- arg_m->set_isarray(false);
- arg_m->set_type(GLMessage::DataType::INT);
- arg_m->add_intvalue((int)m);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultMatrixf(m);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) m,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultiTexCoord4f);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument s
- GLMessage_DataType *arg_s = glmsg.add_args();
- arg_s->set_isarray(false);
- arg_s->set_type(GLMessage::DataType::FLOAT);
- arg_s->add_floatvalue(s);
-
- // copy argument t
- GLMessage_DataType *arg_t = glmsg.add_args();
- arg_t->set_isarray(false);
- arg_t->set_type(GLMessage::DataType::FLOAT);
- arg_t->add_floatvalue(t);
-
- // copy argument r
- GLMessage_DataType *arg_r = glmsg.add_args();
- arg_r->set_isarray(false);
- arg_r->set_type(GLMessage::DataType::FLOAT);
- arg_r->add_floatvalue(r);
-
- // copy argument q
- GLMessage_DataType *arg_q = glmsg.add_args();
- arg_q->set_isarray(false);
- arg_q->set_type(GLMessage::DataType::FLOAT);
- arg_q->add_floatvalue(q);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultiTexCoord4f(target, s, t, r, q);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glNormal3f);
-
- // copy argument nx
- GLMessage_DataType *arg_nx = glmsg.add_args();
- arg_nx->set_isarray(false);
- arg_nx->set_type(GLMessage::DataType::FLOAT);
- arg_nx->add_floatvalue(nx);
-
- // copy argument ny
- GLMessage_DataType *arg_ny = glmsg.add_args();
- arg_ny->set_isarray(false);
- arg_ny->set_type(GLMessage::DataType::FLOAT);
- arg_ny->add_floatvalue(ny);
-
- // copy argument nz
- GLMessage_DataType *arg_nz = glmsg.add_args();
- arg_nz->set_isarray(false);
- arg_nz->set_type(GLMessage::DataType::FLOAT);
- arg_nz->add_floatvalue(nz);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glNormal3f(nx, ny, nz);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glOrthof);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::FLOAT);
- arg_left->add_floatvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::FLOAT);
- arg_right->add_floatvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::FLOAT);
- arg_bottom->add_floatvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::FLOAT);
- arg_top->add_floatvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::FLOAT);
- arg_zNear->add_floatvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::FLOAT);
- arg_zFar->add_floatvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glOrthof(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointParameterf(GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointParameterf);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointParameterf(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointParameterfv(GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointParameterfv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointParameterfv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointSize(GLfloat size) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointSize);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::FLOAT);
- arg_size->add_floatvalue(size);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointSize(size);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRotatef);
-
- // copy argument angle
- GLMessage_DataType *arg_angle = glmsg.add_args();
- arg_angle->set_isarray(false);
- arg_angle->set_type(GLMessage::DataType::FLOAT);
- arg_angle->add_floatvalue(angle);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRotatef(angle, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glScalef);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glScalef(x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvf);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvf(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvfv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvfv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTranslatef);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTranslatef(x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glAlphaFuncx(GLenum func, GLclampx ref) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glAlphaFuncx);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // copy argument ref
- GLMessage_DataType *arg_ref = glmsg.add_args();
- arg_ref->set_isarray(false);
- arg_ref->set_type(GLMessage::DataType::INT);
- arg_ref->add_intvalue(ref);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glAlphaFuncx(func, ref);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearColorx);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::INT);
- arg_red->add_intvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::INT);
- arg_green->add_intvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::INT);
- arg_blue->add_intvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::INT);
- arg_alpha->add_intvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearColorx(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearDepthx(GLclampx depth) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearDepthx);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearDepthx(depth);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClientActiveTexture(GLenum texture) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClientActiveTexture);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::ENUM);
- arg_texture->add_intvalue((int)texture);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClientActiveTexture(texture);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClipPlanex(GLenum plane, const GLfixed *equation) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClipPlanex);
-
- // copy argument plane
- GLMessage_DataType *arg_plane = glmsg.add_args();
- arg_plane->set_isarray(false);
- arg_plane->set_type(GLMessage::DataType::ENUM);
- arg_plane->add_intvalue((int)plane);
-
- // copy argument equation
- GLMessage_DataType *arg_equation = glmsg.add_args();
- arg_equation->set_isarray(false);
- arg_equation->set_type(GLMessage::DataType::INT);
- arg_equation->add_intvalue((int)equation);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClipPlanex(plane, equation);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) equation,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glColor4ub);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::BYTE);
- arg_red->add_intvalue((int)red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::BYTE);
- arg_green->add_intvalue((int)green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::BYTE);
- arg_blue->add_intvalue((int)blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::BYTE);
- arg_alpha->add_intvalue((int)alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glColor4ub(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glColor4x);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::INT);
- arg_red->add_intvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::INT);
- arg_green->add_intvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::INT);
- arg_blue->add_intvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::INT);
- arg_alpha->add_intvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glColor4x(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glColorPointer);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glColorPointer(size, type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDepthRangex(GLclampx zNear, GLclampx zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDepthRangex);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::INT);
- arg_zNear->add_intvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::INT);
- arg_zFar->add_intvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDepthRangex(zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDisableClientState(GLenum array) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDisableClientState);
-
- // copy argument array
- GLMessage_DataType *arg_array = glmsg.add_args();
- arg_array->set_isarray(false);
- arg_array->set_type(GLMessage::DataType::ENUM);
- arg_array->add_intvalue((int)array);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDisableClientState(array);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glEnableClientState(GLenum array) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glEnableClientState);
-
- // copy argument array
- GLMessage_DataType *arg_array = glmsg.add_args();
- arg_array->set_isarray(false);
- arg_array->set_type(GLMessage::DataType::ENUM);
- arg_array->add_intvalue((int)array);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glEnableClientState(array);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFogx(GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFogx);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFogx(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFogxv(GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFogxv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFogxv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFrustumx);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::INT);
- arg_left->add_intvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::INT);
- arg_right->add_intvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::INT);
- arg_bottom->add_intvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::INT);
- arg_top->add_intvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::INT);
- arg_zNear->add_intvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::INT);
- arg_zFar->add_intvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFrustumx(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetClipPlanex(GLenum pname, GLfixed eqn[4]) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetClipPlanex);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument eqn
- GLMessage_DataType *arg_eqn = glmsg.add_args();
- arg_eqn->set_isarray(false);
- arg_eqn->set_type(GLMessage::DataType::INT);
- arg_eqn->add_intvalue((int)eqn);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetClipPlanex(pname, eqn);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) eqn,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetFixedv(GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetFixedv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetFixedv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetLightxv);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetLightxv(light, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetMaterialxv);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetMaterialxv(face, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetPointerv(GLenum pname, GLvoid **params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetPointerv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetPointerv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexEnviv(GLenum env, GLenum pname, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexEnviv);
-
- // copy argument env
- GLMessage_DataType *arg_env = glmsg.add_args();
- arg_env->set_isarray(false);
- arg_env->set_type(GLMessage::DataType::ENUM);
- arg_env->add_intvalue((int)env);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexEnviv(env, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexEnvxv);
-
- // copy argument env
- GLMessage_DataType *arg_env = glmsg.add_args();
- arg_env->set_isarray(false);
- arg_env->set_type(GLMessage::DataType::ENUM);
- arg_env->add_intvalue((int)env);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexEnvxv(env, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexParameterxv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexParameterxv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightModelx(GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightModelx);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightModelx(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightModelxv(GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightModelxv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightModelxv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightx);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightx(light, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightxv);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightxv(light, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLineWidthx(GLfixed width) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLineWidthx);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLineWidthx(width);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLoadIdentity(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLoadIdentity);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLoadIdentity();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLoadMatrixx(const GLfixed *m) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLoadMatrixx);
-
- // copy argument m
- GLMessage_DataType *arg_m = glmsg.add_args();
- arg_m->set_isarray(false);
- arg_m->set_type(GLMessage::DataType::INT);
- arg_m->add_intvalue((int)m);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLoadMatrixx(m);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) m,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLogicOp(GLenum opcode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLogicOp);
-
- // copy argument opcode
- GLMessage_DataType *arg_opcode = glmsg.add_args();
- arg_opcode->set_isarray(false);
- arg_opcode->set_type(GLMessage::DataType::ENUM);
- arg_opcode->add_intvalue((int)opcode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLogicOp(opcode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMaterialx);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMaterialx(face, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMaterialxv);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMaterialxv(face, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMatrixMode(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMatrixMode);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMatrixMode(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultMatrixx(const GLfixed *m) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultMatrixx);
-
- // copy argument m
- GLMessage_DataType *arg_m = glmsg.add_args();
- arg_m->set_isarray(false);
- arg_m->set_type(GLMessage::DataType::INT);
- arg_m->add_intvalue((int)m);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultMatrixx(m);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) m,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultiTexCoord4x);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument s
- GLMessage_DataType *arg_s = glmsg.add_args();
- arg_s->set_isarray(false);
- arg_s->set_type(GLMessage::DataType::INT);
- arg_s->add_intvalue(s);
-
- // copy argument t
- GLMessage_DataType *arg_t = glmsg.add_args();
- arg_t->set_isarray(false);
- arg_t->set_type(GLMessage::DataType::INT);
- arg_t->add_intvalue(t);
-
- // copy argument r
- GLMessage_DataType *arg_r = glmsg.add_args();
- arg_r->set_isarray(false);
- arg_r->set_type(GLMessage::DataType::INT);
- arg_r->add_intvalue(r);
-
- // copy argument q
- GLMessage_DataType *arg_q = glmsg.add_args();
- arg_q->set_isarray(false);
- arg_q->set_type(GLMessage::DataType::INT);
- arg_q->add_intvalue(q);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultiTexCoord4x(target, s, t, r, q);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glNormal3x);
-
- // copy argument nx
- GLMessage_DataType *arg_nx = glmsg.add_args();
- arg_nx->set_isarray(false);
- arg_nx->set_type(GLMessage::DataType::INT);
- arg_nx->add_intvalue(nx);
-
- // copy argument ny
- GLMessage_DataType *arg_ny = glmsg.add_args();
- arg_ny->set_isarray(false);
- arg_ny->set_type(GLMessage::DataType::INT);
- arg_ny->add_intvalue(ny);
-
- // copy argument nz
- GLMessage_DataType *arg_nz = glmsg.add_args();
- arg_nz->set_isarray(false);
- arg_nz->set_type(GLMessage::DataType::INT);
- arg_nz->add_intvalue(nz);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glNormal3x(nx, ny, nz);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glNormalPointer);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glNormalPointer(type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glOrthox);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::INT);
- arg_left->add_intvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::INT);
- arg_right->add_intvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::INT);
- arg_bottom->add_intvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::INT);
- arg_top->add_intvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::INT);
- arg_zNear->add_intvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::INT);
- arg_zFar->add_intvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glOrthox(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointParameterx(GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointParameterx);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointParameterx(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointParameterxv(GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointParameterxv);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointParameterxv(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointSizex(GLfixed size) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointSizex);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointSizex(size);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPolygonOffsetx);
-
- // copy argument factor
- GLMessage_DataType *arg_factor = glmsg.add_args();
- arg_factor->set_isarray(false);
- arg_factor->set_type(GLMessage::DataType::INT);
- arg_factor->add_intvalue(factor);
-
- // copy argument units
- GLMessage_DataType *arg_units = glmsg.add_args();
- arg_units->set_isarray(false);
- arg_units->set_type(GLMessage::DataType::INT);
- arg_units->add_intvalue(units);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPolygonOffsetx(factor, units);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPopMatrix(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPopMatrix);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPopMatrix();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPushMatrix(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPushMatrix);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPushMatrix();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRotatex);
-
- // copy argument angle
- GLMessage_DataType *arg_angle = glmsg.add_args();
- arg_angle->set_isarray(false);
- arg_angle->set_type(GLMessage::DataType::INT);
- arg_angle->add_intvalue(angle);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRotatex(angle, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glSampleCoveragex);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue(value);
-
- // copy argument invert
- GLMessage_DataType *arg_invert = glmsg.add_args();
- arg_invert->set_isarray(false);
- arg_invert->set_type(GLMessage::DataType::BOOL);
- arg_invert->add_boolvalue(invert);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glSampleCoveragex(value, invert);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glScalex);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glScalex(x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glShadeModel(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glShadeModel);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glShadeModel(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexCoordPointer);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexCoordPointer(size, type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvi);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvi(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvx);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvx(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnviv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnviv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvxv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvxv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameterx);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameterx(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameterxv);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameterxv(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTranslatex);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTranslatex(x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glVertexPointer);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glVertexPointer(size, type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointSizePointerOES);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointSizePointerOES(type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-
-// Definitions for GL1Ext APIs
-
-void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendEquationSeparateOES);
-
- // copy argument modeRGB
- GLMessage_DataType *arg_modeRGB = glmsg.add_args();
- arg_modeRGB->set_isarray(false);
- arg_modeRGB->set_type(GLMessage::DataType::ENUM);
- arg_modeRGB->add_intvalue((int)modeRGB);
-
- // copy argument modeAlpha
- GLMessage_DataType *arg_modeAlpha = glmsg.add_args();
- arg_modeAlpha->set_isarray(false);
- arg_modeAlpha->set_type(GLMessage::DataType::ENUM);
- arg_modeAlpha->add_intvalue((int)modeAlpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendEquationSeparateOES(modeRGB, modeAlpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendFuncSeparateOES);
-
- // copy argument srcRGB
- GLMessage_DataType *arg_srcRGB = glmsg.add_args();
- arg_srcRGB->set_isarray(false);
- arg_srcRGB->set_type(GLMessage::DataType::ENUM);
- arg_srcRGB->add_intvalue((int)srcRGB);
-
- // copy argument dstRGB
- GLMessage_DataType *arg_dstRGB = glmsg.add_args();
- arg_dstRGB->set_isarray(false);
- arg_dstRGB->set_type(GLMessage::DataType::ENUM);
- arg_dstRGB->add_intvalue((int)dstRGB);
-
- // copy argument srcAlpha
- GLMessage_DataType *arg_srcAlpha = glmsg.add_args();
- arg_srcAlpha->set_isarray(false);
- arg_srcAlpha->set_type(GLMessage::DataType::ENUM);
- arg_srcAlpha->add_intvalue((int)srcAlpha);
-
- // copy argument dstAlpha
- GLMessage_DataType *arg_dstAlpha = glmsg.add_args();
- arg_dstAlpha->set_isarray(false);
- arg_dstAlpha->set_type(GLMessage::DataType::ENUM);
- arg_dstAlpha->add_intvalue((int)dstAlpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glBlendEquationOES(GLenum mode) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBlendEquationOES);
-
- // copy argument mode
- GLMessage_DataType *arg_mode = glmsg.add_args();
- arg_mode->set_isarray(false);
- arg_mode->set_type(GLMessage::DataType::ENUM);
- arg_mode->add_intvalue((int)mode);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBlendEquationOES(mode);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexsOES);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexsOES(x, y, z, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexiOES);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexiOES(x, y, z, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexxOES);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexxOES(x, y, z, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexsvOES(const GLshort *coords) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexsvOES);
-
- // copy argument coords
- GLMessage_DataType *arg_coords = glmsg.add_args();
- arg_coords->set_isarray(false);
- arg_coords->set_type(GLMessage::DataType::INT);
- arg_coords->add_intvalue((int)coords);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexsvOES(coords);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) coords,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexivOES(const GLint *coords) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexivOES);
-
- // copy argument coords
- GLMessage_DataType *arg_coords = glmsg.add_args();
- arg_coords->set_isarray(false);
- arg_coords->set_type(GLMessage::DataType::INT);
- arg_coords->add_intvalue((int)coords);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexivOES(coords);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) coords,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexxvOES(const GLfixed *coords) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexxvOES);
-
- // copy argument coords
- GLMessage_DataType *arg_coords = glmsg.add_args();
- arg_coords->set_isarray(false);
- arg_coords->set_type(GLMessage::DataType::INT);
- arg_coords->add_intvalue((int)coords);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexxvOES(coords);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) coords,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexfOES);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::FLOAT);
- arg_x->add_floatvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::FLOAT);
- arg_y->add_floatvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::FLOAT);
- arg_z->add_floatvalue(z);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::FLOAT);
- arg_width->add_floatvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::FLOAT);
- arg_height->add_floatvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexfOES(x, y, z, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDrawTexfvOES(const GLfloat *coords) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDrawTexfvOES);
-
- // copy argument coords
- GLMessage_DataType *arg_coords = glmsg.add_args();
- arg_coords->set_isarray(false);
- arg_coords->set_type(GLMessage::DataType::INT);
- arg_coords->add_intvalue((int)coords);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDrawTexfvOES(coords);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) coords,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glAlphaFuncxOES(GLenum func, GLclampx ref) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glAlphaFuncxOES);
-
- // copy argument func
- GLMessage_DataType *arg_func = glmsg.add_args();
- arg_func->set_isarray(false);
- arg_func->set_type(GLMessage::DataType::ENUM);
- arg_func->add_intvalue((int)func);
-
- // copy argument ref
- GLMessage_DataType *arg_ref = glmsg.add_args();
- arg_ref->set_isarray(false);
- arg_ref->set_type(GLMessage::DataType::INT);
- arg_ref->add_intvalue(ref);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glAlphaFuncxOES(func, ref);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearColorxOES);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::INT);
- arg_red->add_intvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::INT);
- arg_green->add_intvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::INT);
- arg_blue->add_intvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::INT);
- arg_alpha->add_intvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearColorxOES(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearDepthxOES(GLclampx depth) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearDepthxOES);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::INT);
- arg_depth->add_intvalue(depth);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearDepthxOES(depth);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed *equation) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClipPlanexOES);
-
- // copy argument plane
- GLMessage_DataType *arg_plane = glmsg.add_args();
- arg_plane->set_isarray(false);
- arg_plane->set_type(GLMessage::DataType::ENUM);
- arg_plane->add_intvalue((int)plane);
-
- // copy argument equation
- GLMessage_DataType *arg_equation = glmsg.add_args();
- arg_equation->set_isarray(false);
- arg_equation->set_type(GLMessage::DataType::INT);
- arg_equation->add_intvalue((int)equation);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClipPlanexOES(plane, equation);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) equation,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glColor4xOES);
-
- // copy argument red
- GLMessage_DataType *arg_red = glmsg.add_args();
- arg_red->set_isarray(false);
- arg_red->set_type(GLMessage::DataType::INT);
- arg_red->add_intvalue(red);
-
- // copy argument green
- GLMessage_DataType *arg_green = glmsg.add_args();
- arg_green->set_isarray(false);
- arg_green->set_type(GLMessage::DataType::INT);
- arg_green->add_intvalue(green);
-
- // copy argument blue
- GLMessage_DataType *arg_blue = glmsg.add_args();
- arg_blue->set_isarray(false);
- arg_blue->set_type(GLMessage::DataType::INT);
- arg_blue->add_intvalue(blue);
-
- // copy argument alpha
- GLMessage_DataType *arg_alpha = glmsg.add_args();
- arg_alpha->set_isarray(false);
- arg_alpha->set_type(GLMessage::DataType::INT);
- arg_alpha->add_intvalue(alpha);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glColor4xOES(red, green, blue, alpha);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDepthRangexOES(GLclampx zNear, GLclampx zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDepthRangexOES);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::INT);
- arg_zNear->add_intvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::INT);
- arg_zFar->add_intvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDepthRangexOES(zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFogxOES(GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFogxOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFogxOES(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFogxvOES(GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFogxvOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFogxvOES(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFrustumxOES);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::INT);
- arg_left->add_intvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::INT);
- arg_right->add_intvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::INT);
- arg_bottom->add_intvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::INT);
- arg_top->add_intvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::INT);
- arg_zNear->add_intvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::INT);
- arg_zFar->add_intvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFrustumxOES(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetClipPlanexOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument eqn
- GLMessage_DataType *arg_eqn = glmsg.add_args();
- arg_eqn->set_isarray(false);
- arg_eqn->set_type(GLMessage::DataType::INT);
- arg_eqn->add_intvalue((int)eqn);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetClipPlanexOES(pname, eqn);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) eqn,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetFixedvOES(GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetFixedvOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetFixedvOES(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetLightxvOES);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetLightxvOES(light, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetMaterialxvOES);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetMaterialxvOES(face, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexEnvxvOES);
-
- // copy argument env
- GLMessage_DataType *arg_env = glmsg.add_args();
- arg_env->set_isarray(false);
- arg_env->set_type(GLMessage::DataType::ENUM);
- arg_env->add_intvalue((int)env);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexEnvxvOES(env, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexParameterxvOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexParameterxvOES(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightModelxOES(GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightModelxOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightModelxOES(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightModelxvOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightModelxvOES(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightxOES);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightxOES(light, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLightxvOES);
-
- // copy argument light
- GLMessage_DataType *arg_light = glmsg.add_args();
- arg_light->set_isarray(false);
- arg_light->set_type(GLMessage::DataType::ENUM);
- arg_light->add_intvalue((int)light);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLightxvOES(light, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLineWidthxOES(GLfixed width) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLineWidthxOES);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLineWidthxOES(width);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLoadMatrixxOES(const GLfixed *m) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLoadMatrixxOES);
-
- // copy argument m
- GLMessage_DataType *arg_m = glmsg.add_args();
- arg_m->set_isarray(false);
- arg_m->set_type(GLMessage::DataType::INT);
- arg_m->add_intvalue((int)m);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLoadMatrixxOES(m);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) m,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMaterialxOES);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMaterialxOES(face, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMaterialxvOES);
-
- // copy argument face
- GLMessage_DataType *arg_face = glmsg.add_args();
- arg_face->set_isarray(false);
- arg_face->set_type(GLMessage::DataType::ENUM);
- arg_face->add_intvalue((int)face);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMaterialxvOES(face, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultMatrixxOES(const GLfixed *m) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultMatrixxOES);
-
- // copy argument m
- GLMessage_DataType *arg_m = glmsg.add_args();
- arg_m->set_isarray(false);
- arg_m->set_type(GLMessage::DataType::INT);
- arg_m->add_intvalue((int)m);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultMatrixxOES(m);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) m,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMultiTexCoord4xOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument s
- GLMessage_DataType *arg_s = glmsg.add_args();
- arg_s->set_isarray(false);
- arg_s->set_type(GLMessage::DataType::INT);
- arg_s->add_intvalue(s);
-
- // copy argument t
- GLMessage_DataType *arg_t = glmsg.add_args();
- arg_t->set_isarray(false);
- arg_t->set_type(GLMessage::DataType::INT);
- arg_t->add_intvalue(t);
-
- // copy argument r
- GLMessage_DataType *arg_r = glmsg.add_args();
- arg_r->set_isarray(false);
- arg_r->set_type(GLMessage::DataType::INT);
- arg_r->add_intvalue(r);
-
- // copy argument q
- GLMessage_DataType *arg_q = glmsg.add_args();
- arg_q->set_isarray(false);
- arg_q->set_type(GLMessage::DataType::INT);
- arg_q->add_intvalue(q);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMultiTexCoord4xOES(target, s, t, r, q);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glNormal3xOES);
-
- // copy argument nx
- GLMessage_DataType *arg_nx = glmsg.add_args();
- arg_nx->set_isarray(false);
- arg_nx->set_type(GLMessage::DataType::INT);
- arg_nx->add_intvalue(nx);
-
- // copy argument ny
- GLMessage_DataType *arg_ny = glmsg.add_args();
- arg_ny->set_isarray(false);
- arg_ny->set_type(GLMessage::DataType::INT);
- arg_ny->add_intvalue(ny);
-
- // copy argument nz
- GLMessage_DataType *arg_nz = glmsg.add_args();
- arg_nz->set_isarray(false);
- arg_nz->set_type(GLMessage::DataType::INT);
- arg_nz->add_intvalue(nz);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glNormal3xOES(nx, ny, nz);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glOrthoxOES);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::INT);
- arg_left->add_intvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::INT);
- arg_right->add_intvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::INT);
- arg_bottom->add_intvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::INT);
- arg_top->add_intvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::INT);
- arg_zNear->add_intvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::INT);
- arg_zFar->add_intvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glOrthoxOES(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointParameterxOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointParameterxOES(pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointParameterxvOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointParameterxvOES(pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPointSizexOES(GLfixed size) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPointSizexOES);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPointSizexOES(size);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glPolygonOffsetxOES);
-
- // copy argument factor
- GLMessage_DataType *arg_factor = glmsg.add_args();
- arg_factor->set_isarray(false);
- arg_factor->set_type(GLMessage::DataType::INT);
- arg_factor->add_intvalue(factor);
-
- // copy argument units
- GLMessage_DataType *arg_units = glmsg.add_args();
- arg_units->set_isarray(false);
- arg_units->set_type(GLMessage::DataType::INT);
- arg_units->add_intvalue(units);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glPolygonOffsetxOES(factor, units);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRotatexOES);
-
- // copy argument angle
- GLMessage_DataType *arg_angle = glmsg.add_args();
- arg_angle->set_isarray(false);
- arg_angle->set_type(GLMessage::DataType::INT);
- arg_angle->add_intvalue(angle);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRotatexOES(angle, x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glSampleCoveragexOES);
-
- // copy argument value
- GLMessage_DataType *arg_value = glmsg.add_args();
- arg_value->set_isarray(false);
- arg_value->set_type(GLMessage::DataType::INT);
- arg_value->add_intvalue(value);
-
- // copy argument invert
- GLMessage_DataType *arg_invert = glmsg.add_args();
- arg_invert->set_isarray(false);
- arg_invert->set_type(GLMessage::DataType::BOOL);
- arg_invert->add_boolvalue(invert);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glSampleCoveragexOES(value, invert);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glScalexOES);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glScalexOES(x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvxOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvxOES(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexEnvxvOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexEnvxvOES(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameterxOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameterxOES(target, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexParameterxvOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexParameterxvOES(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTranslatexOES);
-
- // copy argument x
- GLMessage_DataType *arg_x = glmsg.add_args();
- arg_x->set_isarray(false);
- arg_x->set_type(GLMessage::DataType::INT);
- arg_x->add_intvalue(x);
-
- // copy argument y
- GLMessage_DataType *arg_y = glmsg.add_args();
- arg_y->set_isarray(false);
- arg_y->set_type(GLMessage::DataType::INT);
- arg_y->add_intvalue(y);
-
- // copy argument z
- GLMessage_DataType *arg_z = glmsg.add_args();
- arg_z->set_isarray(false);
- arg_z->set_type(GLMessage::DataType::INT);
- arg_z->add_intvalue(z);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTranslatexOES(x, y, z);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsRenderbufferOES(GLuint renderbuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsRenderbufferOES);
-
- // copy argument renderbuffer
- GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
- arg_renderbuffer->set_isarray(false);
- arg_renderbuffer->set_type(GLMessage::DataType::INT);
- arg_renderbuffer->add_intvalue(renderbuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsRenderbufferOES(renderbuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glBindRenderbufferOES(GLenum target, GLuint renderbuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindRenderbufferOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument renderbuffer
- GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
- arg_renderbuffer->set_isarray(false);
- arg_renderbuffer->set_type(GLMessage::DataType::INT);
- arg_renderbuffer->add_intvalue(renderbuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindRenderbufferOES(target, renderbuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteRenderbuffersOES);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument renderbuffers
- GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
- arg_renderbuffers->set_isarray(false);
- arg_renderbuffers->set_type(GLMessage::DataType::INT);
- arg_renderbuffers->add_intvalue((int)renderbuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteRenderbuffersOES(n, renderbuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) renderbuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenRenderbuffersOES);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument renderbuffers
- GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
- arg_renderbuffers->set_isarray(false);
- arg_renderbuffers->set_type(GLMessage::DataType::INT);
- arg_renderbuffers->add_intvalue((int)renderbuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenRenderbuffersOES(n, renderbuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) renderbuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glRenderbufferStorageOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument internalformat
- GLMessage_DataType *arg_internalformat = glmsg.add_args();
- arg_internalformat->set_isarray(false);
- arg_internalformat->set_type(GLMessage::DataType::ENUM);
- arg_internalformat->add_intvalue((int)internalformat);
-
- // copy argument width
- GLMessage_DataType *arg_width = glmsg.add_args();
- arg_width->set_isarray(false);
- arg_width->set_type(GLMessage::DataType::INT);
- arg_width->add_intvalue(width);
-
- // copy argument height
- GLMessage_DataType *arg_height = glmsg.add_args();
- arg_height->set_isarray(false);
- arg_height->set_type(GLMessage::DataType::INT);
- arg_height->add_intvalue(height);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glRenderbufferStorageOES(target, internalformat, width, height);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetRenderbufferParameterivOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetRenderbufferParameterivOES(target, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLboolean GLTrace_glIsFramebufferOES(GLuint framebuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glIsFramebufferOES);
-
- // copy argument framebuffer
- GLMessage_DataType *arg_framebuffer = glmsg.add_args();
- arg_framebuffer->set_isarray(false);
- arg_framebuffer->set_type(GLMessage::DataType::INT);
- arg_framebuffer->add_intvalue(framebuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLboolean retValue = glContext->hooks->gl.glIsFramebufferOES(framebuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::BOOL);
- rt->add_boolvalue(retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glBindFramebufferOES(GLenum target, GLuint framebuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glBindFramebufferOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument framebuffer
- GLMessage_DataType *arg_framebuffer = glmsg.add_args();
- arg_framebuffer->set_isarray(false);
- arg_framebuffer->set_type(GLMessage::DataType::INT);
- arg_framebuffer->add_intvalue(framebuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glBindFramebufferOES(target, framebuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDeleteFramebuffersOES);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument framebuffers
- GLMessage_DataType *arg_framebuffers = glmsg.add_args();
- arg_framebuffers->set_isarray(false);
- arg_framebuffers->set_type(GLMessage::DataType::INT);
- arg_framebuffers->add_intvalue((int)framebuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDeleteFramebuffersOES(n, framebuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) framebuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenFramebuffersOES);
-
- // copy argument n
- GLMessage_DataType *arg_n = glmsg.add_args();
- arg_n->set_isarray(false);
- arg_n->set_type(GLMessage::DataType::INT);
- arg_n->add_intvalue(n);
-
- // copy argument framebuffers
- GLMessage_DataType *arg_framebuffers = glmsg.add_args();
- arg_framebuffers->set_isarray(false);
- arg_framebuffers->set_type(GLMessage::DataType::INT);
- arg_framebuffers->add_intvalue((int)framebuffers);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenFramebuffersOES(n, framebuffers);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) framebuffers,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLenum GLTrace_glCheckFramebufferStatusOES(GLenum target) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCheckFramebufferStatusOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLenum retValue = glContext->hooks->gl.glCheckFramebufferStatusOES(target);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::ENUM);
- rt->add_intvalue((int)retValue);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferRenderbufferOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument renderbuffertarget
- GLMessage_DataType *arg_renderbuffertarget = glmsg.add_args();
- arg_renderbuffertarget->set_isarray(false);
- arg_renderbuffertarget->set_type(GLMessage::DataType::ENUM);
- arg_renderbuffertarget->add_intvalue((int)renderbuffertarget);
-
- // copy argument renderbuffer
- GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
- arg_renderbuffer->set_isarray(false);
- arg_renderbuffer->set_type(GLMessage::DataType::INT);
- arg_renderbuffer->add_intvalue(renderbuffer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFramebufferTexture2DOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument textarget
- GLMessage_DataType *arg_textarget = glmsg.add_args();
- arg_textarget->set_isarray(false);
- arg_textarget->set_type(GLMessage::DataType::ENUM);
- arg_textarget->add_intvalue((int)textarget);
-
- // copy argument texture
- GLMessage_DataType *arg_texture = glmsg.add_args();
- arg_texture->set_isarray(false);
- arg_texture->set_type(GLMessage::DataType::INT);
- arg_texture->add_intvalue(texture);
-
- // copy argument level
- GLMessage_DataType *arg_level = glmsg.add_args();
- arg_level->set_isarray(false);
- arg_level->set_type(GLMessage::DataType::INT);
- arg_level->add_intvalue(level);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetFramebufferAttachmentParameterivOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // copy argument attachment
- GLMessage_DataType *arg_attachment = glmsg.add_args();
- arg_attachment->set_isarray(false);
- arg_attachment->set_type(GLMessage::DataType::ENUM);
- arg_attachment->add_intvalue((int)attachment);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGenerateMipmapOES(GLenum target) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGenerateMipmapOES);
-
- // copy argument target
- GLMessage_DataType *arg_target = glmsg.add_args();
- arg_target->set_isarray(false);
- arg_target->set_type(GLMessage::DataType::ENUM);
- arg_target->add_intvalue((int)target);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGenerateMipmapOES(target);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glCurrentPaletteMatrixOES(GLuint matrixpaletteindex) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glCurrentPaletteMatrixOES);
-
- // copy argument matrixpaletteindex
- GLMessage_DataType *arg_matrixpaletteindex = glmsg.add_args();
- arg_matrixpaletteindex->set_isarray(false);
- arg_matrixpaletteindex->set_type(GLMessage::DataType::INT);
- arg_matrixpaletteindex->add_intvalue(matrixpaletteindex);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glCurrentPaletteMatrixOES(matrixpaletteindex);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glLoadPaletteFromModelViewMatrixOES(void) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glLoadPaletteFromModelViewMatrixOES);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glLoadPaletteFromModelViewMatrixOES();
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glMatrixIndexPointerOES);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glMatrixIndexPointerOES(size, type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glWeightPointerOES);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument pointer
- GLMessage_DataType *arg_pointer = glmsg.add_args();
- arg_pointer->set_isarray(false);
- arg_pointer->set_type(GLMessage::DataType::INT);
- arg_pointer->add_intvalue((int)pointer);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glWeightPointerOES(size, type, stride, pointer);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) pointer,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-GLbitfield GLTrace_glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glQueryMatrixxOES);
-
- // copy argument mantissa
- GLMessage_DataType *arg_mantissa = glmsg.add_args();
- arg_mantissa->set_isarray(false);
- arg_mantissa->set_type(GLMessage::DataType::INT);
- arg_mantissa->add_intvalue((int)mantissa);
-
- // copy argument exponent
- GLMessage_DataType *arg_exponent = glmsg.add_args();
- arg_exponent->set_isarray(false);
- arg_exponent->set_type(GLMessage::DataType::INT);
- arg_exponent->add_intvalue((int)exponent);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- GLbitfield retValue = glContext->hooks->gl.glQueryMatrixxOES(mantissa, exponent);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::INT);
- rt->add_intvalue(retValue);
-
- void *pointerArgs[] = {
- (void *) mantissa,
- (void *) exponent,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-
- return retValue;
-}
-
-void GLTrace_glDepthRangefOES(GLclampf zNear, GLclampf zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glDepthRangefOES);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::FLOAT);
- arg_zNear->add_floatvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::FLOAT);
- arg_zFar->add_floatvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glDepthRangefOES(zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glFrustumfOES);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::FLOAT);
- arg_left->add_floatvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::FLOAT);
- arg_right->add_floatvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::FLOAT);
- arg_bottom->add_floatvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::FLOAT);
- arg_top->add_floatvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::FLOAT);
- arg_zNear->add_floatvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::FLOAT);
- arg_zFar->add_floatvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glFrustumfOES(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glOrthofOES);
-
- // copy argument left
- GLMessage_DataType *arg_left = glmsg.add_args();
- arg_left->set_isarray(false);
- arg_left->set_type(GLMessage::DataType::FLOAT);
- arg_left->add_floatvalue(left);
-
- // copy argument right
- GLMessage_DataType *arg_right = glmsg.add_args();
- arg_right->set_isarray(false);
- arg_right->set_type(GLMessage::DataType::FLOAT);
- arg_right->add_floatvalue(right);
-
- // copy argument bottom
- GLMessage_DataType *arg_bottom = glmsg.add_args();
- arg_bottom->set_isarray(false);
- arg_bottom->set_type(GLMessage::DataType::FLOAT);
- arg_bottom->add_floatvalue(bottom);
-
- // copy argument top
- GLMessage_DataType *arg_top = glmsg.add_args();
- arg_top->set_isarray(false);
- arg_top->set_type(GLMessage::DataType::FLOAT);
- arg_top->add_floatvalue(top);
-
- // copy argument zNear
- GLMessage_DataType *arg_zNear = glmsg.add_args();
- arg_zNear->set_isarray(false);
- arg_zNear->set_type(GLMessage::DataType::FLOAT);
- arg_zNear->add_floatvalue(zNear);
-
- // copy argument zFar
- GLMessage_DataType *arg_zFar = glmsg.add_args();
- arg_zFar->set_isarray(false);
- arg_zFar->set_type(GLMessage::DataType::FLOAT);
- arg_zFar->add_floatvalue(zFar);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glOrthofOES(left, right, bottom, top, zNear, zFar);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat *equation) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClipPlanefOES);
-
- // copy argument plane
- GLMessage_DataType *arg_plane = glmsg.add_args();
- arg_plane->set_isarray(false);
- arg_plane->set_type(GLMessage::DataType::ENUM);
- arg_plane->add_intvalue((int)plane);
-
- // copy argument equation
- GLMessage_DataType *arg_equation = glmsg.add_args();
- arg_equation->set_isarray(false);
- arg_equation->set_type(GLMessage::DataType::INT);
- arg_equation->add_intvalue((int)equation);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClipPlanefOES(plane, equation);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) equation,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetClipPlanefOES);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument eqn
- GLMessage_DataType *arg_eqn = glmsg.add_args();
- arg_eqn->set_isarray(false);
- arg_eqn->set_type(GLMessage::DataType::INT);
- arg_eqn->add_intvalue((int)eqn);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetClipPlanefOES(pname, eqn);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) eqn,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClearDepthfOES(GLclampf depth) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClearDepthfOES);
-
- // copy argument depth
- GLMessage_DataType *arg_depth = glmsg.add_args();
- arg_depth->set_isarray(false);
- arg_depth->set_type(GLMessage::DataType::FLOAT);
- arg_depth->add_floatvalue(depth);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClearDepthfOES(depth);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexGenfOES(GLenum coord, GLenum pname, GLfloat param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexGenfOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::FLOAT);
- arg_param->add_floatvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexGenfOES(coord, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexGenfvOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexGenfvOES(coord, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexGeniOES(GLenum coord, GLenum pname, GLint param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexGeniOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexGeniOES(coord, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexGenivOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexGenivOES(coord, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexGenxOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument param
- GLMessage_DataType *arg_param = glmsg.add_args();
- arg_param->set_isarray(false);
- arg_param->set_type(GLMessage::DataType::INT);
- arg_param->add_intvalue(param);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexGenxOES(coord, pname, param);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glTexGenxvOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glTexGenxvOES(coord, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexGenfvOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexGenfvOES(coord, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexGenivOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexGenivOES(coord, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glGetTexGenxvOES);
-
- // copy argument coord
- GLMessage_DataType *arg_coord = glmsg.add_args();
- arg_coord->set_isarray(false);
- arg_coord->set_type(GLMessage::DataType::ENUM);
- arg_coord->add_intvalue((int)coord);
-
- // copy argument pname
- GLMessage_DataType *arg_pname = glmsg.add_args();
- arg_pname->set_isarray(false);
- arg_pname->set_type(GLMessage::DataType::ENUM);
- arg_pname->add_intvalue((int)pname);
-
- // copy argument params
- GLMessage_DataType *arg_params = glmsg.add_args();
- arg_params->set_isarray(false);
- arg_params->set_type(GLMessage::DataType::INT);
- arg_params->add_intvalue((int)params);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glGetTexGenxvOES(coord, pname, params);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) params,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClipPlanefIMG);
-
- // copy argument p
- GLMessage_DataType *arg_p = glmsg.add_args();
- arg_p->set_isarray(false);
- arg_p->set_type(GLMessage::DataType::ENUM);
- arg_p->add_intvalue((int)p);
-
- // copy argument eqn
- GLMessage_DataType *arg_eqn = glmsg.add_args();
- arg_eqn->set_isarray(false);
- arg_eqn->set_type(GLMessage::DataType::INT);
- arg_eqn->add_intvalue((int)eqn);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClipPlanefIMG(p, eqn);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) eqn,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::glClipPlanexIMG);
-
- // copy argument p
- GLMessage_DataType *arg_p = glmsg.add_args();
- arg_p->set_isarray(false);
- arg_p->set_type(GLMessage::DataType::ENUM);
- arg_p->add_intvalue((int)p);
-
- // copy argument eqn
- GLMessage_DataType *arg_eqn = glmsg.add_args();
- arg_eqn->set_isarray(false);
- arg_eqn->set_type(GLMessage::DataType::INT);
- arg_eqn->add_intvalue((int)eqn);
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- glContext->hooks->gl.glClipPlanexIMG(p, eqn);
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-
- void *pointerArgs[] = {
- (void *) eqn,
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-}
-
-
-}; // namespace gltrace
-}; // namespace android
diff --git a/opengl/libs/GLES_trace/src/gltrace_api.h b/opengl/libs/GLES_trace/src/gltrace_api.h
deleted file mode 100644
index debcac0..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_api.h
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- *
- * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT.
- */
-
-namespace android {
-namespace gltrace {
-
-// Declarations for GL2 APIs
-
-void GLTrace_glActiveTexture(GLenum texture);
-void GLTrace_glAttachShader(GLuint program, GLuint shader);
-void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name);
-void GLTrace_glBindBuffer(GLenum target, GLuint buffer);
-void GLTrace_glBindFramebuffer(GLenum target, GLuint framebuffer);
-void GLTrace_glBindRenderbuffer(GLenum target, GLuint renderbuffer);
-void GLTrace_glBindTexture(GLenum target, GLuint texture);
-void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-void GLTrace_glBlendEquation(GLenum mode);
-void GLTrace_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-void GLTrace_glBlendFunc(GLenum sfactor, GLenum dfactor);
-void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
-void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
-GLenum GLTrace_glCheckFramebufferStatus(GLenum target);
-void GLTrace_glClear(GLbitfield mask);
-void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-void GLTrace_glClearDepthf(GLclampf depth);
-void GLTrace_glClearStencil(GLint s);
-void GLTrace_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-void GLTrace_glCompileShader(GLuint shader);
-void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
-void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
-void GLTrace_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void GLTrace_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLuint GLTrace_glCreateProgram(void);
-GLuint GLTrace_glCreateShader(GLenum type);
-void GLTrace_glCullFace(GLenum mode);
-void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers);
-void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
-void GLTrace_glDeleteProgram(GLuint program);
-void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
-void GLTrace_glDeleteShader(GLuint shader);
-void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures);
-void GLTrace_glDepthFunc(GLenum func);
-void GLTrace_glDepthMask(GLboolean flag);
-void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar);
-void GLTrace_glDetachShader(GLuint program, GLuint shader);
-void GLTrace_glDisable(GLenum cap);
-void GLTrace_glDisableVertexAttribArray(GLuint index);
-void GLTrace_glDrawArrays(GLenum mode, GLint first, GLsizei count);
-void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
-void GLTrace_glEnable(GLenum cap);
-void GLTrace_glEnableVertexAttribArray(GLuint index);
-void GLTrace_glFinish(void);
-void GLTrace_glFlush(void);
-void GLTrace_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-void GLTrace_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-void GLTrace_glFrontFace(GLenum mode);
-void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers);
-void GLTrace_glGenerateMipmap(GLenum target);
-void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers);
-void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
-void GLTrace_glGenTextures(GLsizei n, GLuint* textures);
-void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name);
-void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params);
-void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
-GLenum GLTrace_glGetError(void);
-void GLTrace_glGetFloatv(GLenum pname, GLfloat* params);
-void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
-void GLTrace_glGetIntegerv(GLenum pname, GLint* params);
-void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params);
-void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
-void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
-void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-const GLubyte* GLTrace_glGetString(GLenum name);
-void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
-void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
-void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params);
-void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params);
-int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name);
-void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
-void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
-void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
-void GLTrace_glHint(GLenum target, GLenum mode);
-GLboolean GLTrace_glIsBuffer(GLuint buffer);
-GLboolean GLTrace_glIsEnabled(GLenum cap);
-GLboolean GLTrace_glIsFramebuffer(GLuint framebuffer);
-GLboolean GLTrace_glIsProgram(GLuint program);
-GLboolean GLTrace_glIsRenderbuffer(GLuint renderbuffer);
-GLboolean GLTrace_glIsShader(GLuint shader);
-GLboolean GLTrace_glIsTexture(GLuint texture);
-void GLTrace_glLineWidth(GLfloat width);
-void GLTrace_glLinkProgram(GLuint program);
-void GLTrace_glPixelStorei(GLenum pname, GLint param);
-void GLTrace_glPolygonOffset(GLfloat factor, GLfloat units);
-void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
-void GLTrace_glReleaseShaderCompiler(void);
-void GLTrace_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert);
-void GLTrace_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
-void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
-void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
-void GLTrace_glStencilFunc(GLenum func, GLint ref, GLuint mask);
-void GLTrace_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
-void GLTrace_glStencilMask(GLuint mask);
-void GLTrace_glStencilMaskSeparate(GLenum face, GLuint mask);
-void GLTrace_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
-void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
-void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-void GLTrace_glTexParameterf(GLenum target, GLenum pname, GLfloat param);
-void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
-void GLTrace_glTexParameteri(GLenum target, GLenum pname, GLint param);
-void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
-void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
-void GLTrace_glUniform1f(GLint location, GLfloat x);
-void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
-void GLTrace_glUniform1i(GLint location, GLint x);
-void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint* v);
-void GLTrace_glUniform2f(GLint location, GLfloat x, GLfloat y);
-void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
-void GLTrace_glUniform2i(GLint location, GLint x, GLint y);
-void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint* v);
-void GLTrace_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
-void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
-void GLTrace_glUniform3i(GLint location, GLint x, GLint y, GLint z);
-void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint* v);
-void GLTrace_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
-void GLTrace_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
-void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint* v);
-void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-void GLTrace_glUseProgram(GLuint program);
-void GLTrace_glValidateProgram(GLuint program);
-void GLTrace_glVertexAttrib1f(GLuint indx, GLfloat x);
-void GLTrace_glVertexAttrib1fv(GLuint indx, const GLfloat* values);
-void GLTrace_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
-void GLTrace_glVertexAttrib2fv(GLuint indx, const GLfloat* values);
-void GLTrace_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
-void GLTrace_glVertexAttrib3fv(GLuint indx, const GLfloat* values);
-void GLTrace_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-void GLTrace_glVertexAttrib4fv(GLuint indx, const GLfloat* values);
-void GLTrace_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
-void GLTrace_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
-
-// Declarations for GL2Ext APIs
-
-void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
-void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
-void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
-void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
-void* GLTrace_glMapBufferOES(GLenum target, GLenum access);
-GLboolean GLTrace_glUnmapBufferOES(GLenum target);
-void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params);
-void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
-void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
-void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
-void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-void GLTrace_glBindVertexArrayOES(GLuint array);
-void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays);
-void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint *arrays);
-GLboolean GLTrace_glIsVertexArrayOES(GLuint array);
-void GLTrace_glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data);
-void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors);
-void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors);
-void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
-void GLTrace_glBeginPerfMonitorAMD(GLuint monitor);
-void GLTrace_glEndPerfMonitorAMD(GLuint monitor);
-void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-void GLTrace_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-void GLTrace_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glResolveMultisampleFramebufferAPPLE(void);
-void GLTrace_glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label);
-void GLTrace_glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-void GLTrace_glInsertEventMarkerEXT(GLsizei length, const GLchar *marker);
-void GLTrace_glPushGroupMarkerEXT(GLsizei length, const GLchar *marker);
-void GLTrace_glPopGroupMarkerEXT(void);
-void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments);
-void GLTrace_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-void GLTrace_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-void GLTrace_glGenQueriesEXT(GLsizei n, GLuint *ids);
-void GLTrace_glDeleteQueriesEXT(GLsizei n, const GLuint *ids);
-GLboolean GLTrace_glIsQueryEXT(GLuint id);
-void GLTrace_glBeginQueryEXT(GLenum target, GLuint id);
-void GLTrace_glEndQueryEXT(GLenum target);
-void GLTrace_glGetQueryivEXT(GLenum target, GLenum pname, GLint *params);
-void GLTrace_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params);
-GLenum GLTrace_glGetGraphicsResetStatusEXT(void);
-void GLTrace_glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-void GLTrace_glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params);
-void GLTrace_glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params);
-void GLTrace_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program);
-void GLTrace_glActiveShaderProgramEXT(GLuint pipeline, GLuint program);
-GLuint GLTrace_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings);
-void GLTrace_glBindProgramPipelineEXT(GLuint pipeline);
-void GLTrace_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines);
-void GLTrace_glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines);
-GLboolean GLTrace_glIsProgramPipelineEXT(GLuint pipeline);
-void GLTrace_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value);
-void GLTrace_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params);
-void GLTrace_glProgramUniform1iEXT(GLuint program, GLint location, GLint x);
-void GLTrace_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y);
-void GLTrace_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z);
-void GLTrace_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
-void GLTrace_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x);
-void GLTrace_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y);
-void GLTrace_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
-void GLTrace_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-void GLTrace_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value);
-void GLTrace_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value);
-void GLTrace_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value);
-void GLTrace_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value);
-void GLTrace_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value);
-void GLTrace_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value);
-void GLTrace_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value);
-void GLTrace_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value);
-void GLTrace_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-void GLTrace_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-void GLTrace_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-void GLTrace_glValidateProgramPipelineEXT(GLuint pipeline);
-void GLTrace_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-void GLTrace_glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-void GLTrace_glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-void GLTrace_glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-void GLTrace_glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-void GLTrace_glCoverageMaskNV(GLboolean mask);
-void GLTrace_glCoverageOperationNV(GLenum operation);
-void GLTrace_glDrawBuffersNV(GLsizei n, const GLenum *bufs);
-void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint *fences);
-void GLTrace_glGenFencesNV(GLsizei n, GLuint *fences);
-GLboolean GLTrace_glIsFenceNV(GLuint fence);
-GLboolean GLTrace_glTestFenceNV(GLuint fence);
-void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint *params);
-void GLTrace_glFinishFenceNV(GLuint fence);
-void GLTrace_glSetFenceNV(GLuint fence, GLenum condition);
-void GLTrace_glReadBufferNV(GLenum mode);
-void GLTrace_glAlphaFuncQCOM(GLenum func, GLclampf ref);
-void GLTrace_glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls);
-void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-void GLTrace_glEnableDriverControlQCOM(GLuint driverControl);
-void GLTrace_glDisableDriverControlQCOM(GLuint driverControl);
-void GLTrace_glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures);
-void GLTrace_glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-void GLTrace_glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-void GLTrace_glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param);
-void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-void GLTrace_glExtGetBufferPointervQCOM(GLenum target, GLvoid **params);
-void GLTrace_glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders);
-void GLTrace_glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program);
-void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-void GLTrace_glEndTilingQCOM(GLbitfield preserveMask);
-
-// Declarations for GL1 APIs
-
-void GLTrace_glAlphaFunc(GLenum func, GLclampf ref);
-void GLTrace_glClipPlanef(GLenum plane, const GLfloat *equation);
-void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-void GLTrace_glFogf(GLenum pname, GLfloat param);
-void GLTrace_glFogfv(GLenum pname, const GLfloat *params);
-void GLTrace_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void GLTrace_glGetClipPlanef(GLenum pname, GLfloat eqn[4]);
-void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
-void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
-void GLTrace_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params);
-void GLTrace_glLightModelf(GLenum pname, GLfloat param);
-void GLTrace_glLightModelfv(GLenum pname, const GLfloat *params);
-void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param);
-void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat *params);
-void GLTrace_glLoadMatrixf(const GLfloat *m);
-void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param);
-void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
-void GLTrace_glMultMatrixf(const GLfloat *m);
-void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
-void GLTrace_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void GLTrace_glPointParameterf(GLenum pname, GLfloat param);
-void GLTrace_glPointParameterfv(GLenum pname, const GLfloat *params);
-void GLTrace_glPointSize(GLfloat size);
-void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z);
-void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param);
-void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
-void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z);
-void GLTrace_glAlphaFuncx(GLenum func, GLclampx ref);
-void GLTrace_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-void GLTrace_glClearDepthx(GLclampx depth);
-void GLTrace_glClientActiveTexture(GLenum texture);
-void GLTrace_glClipPlanex(GLenum plane, const GLfixed *equation);
-void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-void GLTrace_glDepthRangex(GLclampx zNear, GLclampx zFar);
-void GLTrace_glDisableClientState(GLenum array);
-void GLTrace_glEnableClientState(GLenum array);
-void GLTrace_glFogx(GLenum pname, GLfixed param);
-void GLTrace_glFogxv(GLenum pname, const GLfixed *params);
-void GLTrace_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void GLTrace_glGetClipPlanex(GLenum pname, GLfixed eqn[4]);
-void GLTrace_glGetFixedv(GLenum pname, GLfixed *params);
-void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed *params);
-void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params);
-void GLTrace_glGetPointerv(GLenum pname, GLvoid **params);
-void GLTrace_glGetTexEnviv(GLenum env, GLenum pname, GLint *params);
-void GLTrace_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params);
-void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params);
-void GLTrace_glLightModelx(GLenum pname, GLfixed param);
-void GLTrace_glLightModelxv(GLenum pname, const GLfixed *params);
-void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param);
-void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed *params);
-void GLTrace_glLineWidthx(GLfixed width);
-void GLTrace_glLoadIdentity(void);
-void GLTrace_glLoadMatrixx(const GLfixed *m);
-void GLTrace_glLogicOp(GLenum opcode);
-void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param);
-void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params);
-void GLTrace_glMatrixMode(GLenum mode);
-void GLTrace_glMultMatrixx(const GLfixed *m);
-void GLTrace_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz);
-void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
-void GLTrace_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void GLTrace_glPointParameterx(GLenum pname, GLfixed param);
-void GLTrace_glPointParameterxv(GLenum pname, const GLfixed *params);
-void GLTrace_glPointSizex(GLfixed size);
-void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units);
-void GLTrace_glPopMatrix(void);
-void GLTrace_glPushMatrix(void);
-void GLTrace_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert);
-void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z);
-void GLTrace_glShadeModel(GLenum mode);
-void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param);
-void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param);
-void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint *params);
-void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params);
-void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param);
-void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params);
-void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z);
-void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer);
-
-// Declarations for GL1Ext APIs
-
-void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha);
-void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-void GLTrace_glBlendEquationOES(GLenum mode);
-void GLTrace_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-void GLTrace_glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height);
-void GLTrace_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-void GLTrace_glDrawTexsvOES(const GLshort *coords);
-void GLTrace_glDrawTexivOES(const GLint *coords);
-void GLTrace_glDrawTexxvOES(const GLfixed *coords);
-void GLTrace_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-void GLTrace_glDrawTexfvOES(const GLfloat *coords);
-void GLTrace_glAlphaFuncxOES(GLenum func, GLclampx ref);
-void GLTrace_glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-void GLTrace_glClearDepthxOES(GLclampx depth);
-void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed *equation);
-void GLTrace_glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-void GLTrace_glDepthRangexOES(GLclampx zNear, GLclampx zFar);
-void GLTrace_glFogxOES(GLenum pname, GLfixed param);
-void GLTrace_glFogxvOES(GLenum pname, const GLfixed *params);
-void GLTrace_glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void GLTrace_glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]);
-void GLTrace_glGetFixedvOES(GLenum pname, GLfixed *params);
-void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params);
-void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params);
-void GLTrace_glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params);
-void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params);
-void GLTrace_glLightModelxOES(GLenum pname, GLfixed param);
-void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed *params);
-void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param);
-void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed *params);
-void GLTrace_glLineWidthxOES(GLfixed width);
-void GLTrace_glLoadMatrixxOES(const GLfixed *m);
-void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param);
-void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params);
-void GLTrace_glMultMatrixxOES(const GLfixed *m);
-void GLTrace_glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz);
-void GLTrace_glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param);
-void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed *params);
-void GLTrace_glPointSizexOES(GLfixed size);
-void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units);
-void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert);
-void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z);
-void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param);
-void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params);
-void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param);
-void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params);
-void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z);
-GLboolean GLTrace_glIsRenderbufferOES(GLuint renderbuffer);
-void GLTrace_glBindRenderbufferOES(GLenum target, GLuint renderbuffer);
-void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers);
-void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers);
-void GLTrace_glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params);
-GLboolean GLTrace_glIsFramebufferOES(GLuint framebuffer);
-void GLTrace_glBindFramebufferOES(GLenum target, GLuint framebuffer);
-void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers);
-void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers);
-GLenum GLTrace_glCheckFramebufferStatusOES(GLenum target);
-void GLTrace_glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-void GLTrace_glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params);
-void GLTrace_glGenerateMipmapOES(GLenum target);
-void GLTrace_glCurrentPaletteMatrixOES(GLuint matrixpaletteindex);
-void GLTrace_glLoadPaletteFromModelViewMatrixOES(void);
-void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GLbitfield GLTrace_glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]);
-void GLTrace_glDepthRangefOES(GLclampf zNear, GLclampf zFar);
-void GLTrace_glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void GLTrace_glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat *equation);
-void GLTrace_glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]);
-void GLTrace_glClearDepthfOES(GLclampf depth);
-void GLTrace_glTexGenfOES(GLenum coord, GLenum pname, GLfloat param);
-void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params);
-void GLTrace_glTexGeniOES(GLenum coord, GLenum pname, GLint param);
-void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint *params);
-void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param);
-void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params);
-void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params);
-void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params);
-void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params);
-void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn);
-void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn);
-
-}; // namespace gltrace
-}; // namespace android
diff --git a/opengl/libs/GLES_trace/src/gltrace_context.cpp b/opengl/libs/GLES_trace/src/gltrace_context.cpp
deleted file mode 100644
index 45dbb43..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_context.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#include <pthread.h>
-#include <cutils/log.h>
-
-extern "C" {
-#include "liblzf/lzf.h"
-}
-
-#include "gltrace_context.h"
-
-namespace android {
-namespace gltrace {
-
-using ::android::gl_hooks_t;
-
-static pthread_key_t sTLSKey = -1;
-static pthread_once_t sPthreadOnceKey = PTHREAD_ONCE_INIT;
-
-void createTLSKey() {
- pthread_key_create(&sTLSKey, NULL);
-}
-
-GLTraceContext *getGLTraceContext() {
- return (GLTraceContext*) pthread_getspecific(sTLSKey);
-}
-
-void setGLTraceContext(GLTraceContext *c) {
- pthread_setspecific(sTLSKey, c);
-}
-
-void setupTraceContextThreadSpecific(GLTraceContext *context) {
- pthread_once(&sPthreadOnceKey, createTLSKey);
- setGLTraceContext(context);
-}
-
-void releaseContext() {
- GLTraceContext *c = getGLTraceContext();
- if (c != NULL) {
- delete c;
- setGLTraceContext(NULL);
- }
-}
-
-GLTraceState::GLTraceState(TCPStream *stream) {
- mTraceContextIds = 0;
- mStream = stream;
-
- mCollectFbOnEglSwap = false;
- mCollectFbOnGlDraw = false;
- mCollectTextureDataOnGlTexImage = false;
- pthread_rwlock_init(&mTraceOptionsRwLock, NULL);
-}
-
-GLTraceState::~GLTraceState() {
- if (mStream) {
- mStream->closeStream();
- mStream = NULL;
- }
-}
-
-TCPStream *GLTraceState::getStream() {
- return mStream;
-}
-
-void GLTraceState::safeSetValue(bool *ptr, bool value, pthread_rwlock_t *lock) {
- pthread_rwlock_wrlock(lock);
- *ptr = value;
- pthread_rwlock_unlock(lock);
-}
-
-bool GLTraceState::safeGetValue(bool *ptr, pthread_rwlock_t *lock) {
- pthread_rwlock_rdlock(lock);
- bool value = *ptr;
- pthread_rwlock_unlock(lock);
- return value;
-}
-
-void GLTraceState::setCollectFbOnEglSwap(bool en) {
- safeSetValue(&mCollectFbOnEglSwap, en, &mTraceOptionsRwLock);
-}
-
-void GLTraceState::setCollectFbOnGlDraw(bool en) {
- safeSetValue(&mCollectFbOnGlDraw, en, &mTraceOptionsRwLock);
-}
-
-void GLTraceState::setCollectTextureDataOnGlTexImage(bool en) {
- safeSetValue(&mCollectTextureDataOnGlTexImage, en, &mTraceOptionsRwLock);
-}
-
-bool GLTraceState::shouldCollectFbOnEglSwap() {
- return safeGetValue(&mCollectFbOnEglSwap, &mTraceOptionsRwLock);
-}
-
-bool GLTraceState::shouldCollectFbOnGlDraw() {
- return safeGetValue(&mCollectFbOnGlDraw, &mTraceOptionsRwLock);
-}
-
-bool GLTraceState::shouldCollectTextureDataOnGlTexImage() {
- return safeGetValue(&mCollectTextureDataOnGlTexImage, &mTraceOptionsRwLock);
-}
-
-GLTraceContext *GLTraceState::createTraceContext(int version, EGLContext eglContext) {
- int id = __sync_fetch_and_add(&mTraceContextIds, 1);
-
- const size_t DEFAULT_BUFFER_SIZE = 8192;
- BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE);
- GLTraceContext *traceContext = new GLTraceContext(id, this, stream);
- mPerContextState[eglContext] = traceContext;
-
- return traceContext;
-}
-
-GLTraceContext *GLTraceState::getTraceContext(EGLContext c) {
- return mPerContextState[c];
-}
-
-GLTraceContext::GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream) :
- mId(id),
- mState(state),
- mBufferedOutputStream(stream),
- mElementArrayBuffers(DefaultKeyedVector<GLuint, ElementArrayBuffer*>(NULL))
-{
- fbcontents = fbcompressed = NULL;
- fbcontentsSize = 0;
-}
-
-int GLTraceContext::getId() {
- return mId;
-}
-
-GLTraceState *GLTraceContext::getGlobalTraceState() {
- return mState;
-}
-
-void GLTraceContext::resizeFBMemory(unsigned minSize) {
- if (fbcontentsSize >= minSize) {
- return;
- }
-
- if (fbcontents != NULL) {
- free(fbcontents);
- free(fbcompressed);
- }
-
- fbcontents = malloc(minSize);
- fbcompressed = malloc(minSize);
-
- fbcontentsSize = minSize;
-}
-
-/** obtain a pointer to the compressed framebuffer image */
-void GLTraceContext::getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwidth,
- unsigned *fbheight, FBBinding fbToRead) {
- int viewport[4] = {};
- hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport);
- unsigned fbContentsSize = viewport[2] * viewport[3] * 4;
-
- resizeFBMemory(fbContentsSize);
-
- // switch current framebuffer binding if necessary
- GLint currentFb = -1;
- bool fbSwitched = false;
- if (fbToRead != CURRENTLY_BOUND_FB) {
- hooks->gl.glGetIntegerv(GL_FRAMEBUFFER_BINDING, ¤tFb);
-
- if (currentFb != 0) {
- hooks->gl.glBindFramebuffer(GL_FRAMEBUFFER, 0);
- fbSwitched = true;
- }
- }
-
- hooks->gl.glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
- GL_RGBA, GL_UNSIGNED_BYTE, fbcontents);
-
- // switch back to previously bound buffer if necessary
- if (fbSwitched) {
- hooks->gl.glBindFramebuffer(GL_FRAMEBUFFER, currentFb);
- }
-
- *fbsize = lzf_compress(fbcontents, fbContentsSize, fbcompressed, fbContentsSize);
- *fb = fbcompressed;
- *fbwidth = viewport[2];
- *fbheight = viewport[3];
-}
-
-void GLTraceContext::traceGLMessage(GLMessage *msg) {
- mBufferedOutputStream->send(msg);
-
- GLMessage_Function func = msg->function();
- if (func == GLMessage::eglSwapBuffers
- || func == GLMessage::glDrawArrays
- || func == GLMessage::glDrawElements) {
- mBufferedOutputStream->flush();
- }
-}
-
-void GLTraceContext::bindBuffer(GLuint bufferId, GLvoid *data, GLsizeiptr size) {
- // free previously bound buffer if any
- ElementArrayBuffer *oldBuffer = mElementArrayBuffers.valueFor(bufferId);
- if (oldBuffer != NULL) {
- delete oldBuffer;
- }
-
- mElementArrayBuffers.add(bufferId, new ElementArrayBuffer(data, size));
-}
-
-void GLTraceContext::getBuffer(GLuint bufferId, GLvoid **data, GLsizeiptr *size) {
- ElementArrayBuffer *buffer = mElementArrayBuffers.valueFor(bufferId);
- if (buffer == NULL) {
- *data = NULL;
- *size = 0;
- } else {
- *data = buffer->getBuffer();
- *size = buffer->getSize();
- }
-}
-
-void GLTraceContext::updateBufferSubData(GLuint bufferId, GLintptr offset, GLvoid *data,
- GLsizeiptr size) {
- ElementArrayBuffer *buffer = mElementArrayBuffers.valueFor(bufferId);
- if (buffer != NULL) {
- buffer->updateSubBuffer(offset, data, size);
- }
-}
-
-void GLTraceContext::deleteBuffer(GLuint bufferId) {
- ElementArrayBuffer *buffer = mElementArrayBuffers.valueFor(bufferId);
- if (buffer != NULL) {
- delete buffer;
- mElementArrayBuffers.removeItem(bufferId);
- }
-}
-
-ElementArrayBuffer::ElementArrayBuffer(GLvoid *buf, GLsizeiptr size) {
- mBuf = malloc(size);
- mSize = size;
-
- if (buf != NULL) {
- memcpy(mBuf, buf, size);
- }
-}
-
-ElementArrayBuffer::~ElementArrayBuffer() {
- if (mBuf != NULL) {
- free(mBuf);
- mSize = 0;
- }
-
- mBuf = NULL;
-}
-
-void ElementArrayBuffer::updateSubBuffer(GLintptr offset, const GLvoid* data, GLsizeiptr size) {
- if (offset + size <= mSize) {
- memcpy((char*)mBuf + offset, data, size);
- }
-}
-
-GLvoid *ElementArrayBuffer::getBuffer() {
- return mBuf;
-}
-
-GLsizeiptr ElementArrayBuffer::getSize() {
- return mSize;
-}
-
-}; // namespace gltrace
-}; // namespace android
diff --git a/opengl/libs/GLES_trace/src/gltrace_context.h b/opengl/libs/GLES_trace/src/gltrace_context.h
deleted file mode 100644
index 323cfdc..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_context.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef __GLTRACE_CONTEXT_H_
-#define __GLTRACE_CONTEXT_H_
-
-#include <map>
-#include <pthread.h>
-#include <utils/KeyedVector.h>
-
-#include "hooks.h"
-#include "gltrace_transport.h"
-
-namespace android {
-namespace gltrace {
-
-using ::android::gl_hooks_t;
-
-enum FBBinding {CURRENTLY_BOUND_FB, FB0};
-
-class GLTraceState;
-
-class ElementArrayBuffer {
- GLvoid *mBuf;
- GLsizeiptr mSize;
-
-public:
- ElementArrayBuffer():mBuf(NULL), mSize(0) {}
- ElementArrayBuffer(GLvoid *buf, GLsizeiptr size);
- ~ElementArrayBuffer();
-
- void updateSubBuffer(GLintptr offset, const GLvoid* data, GLsizeiptr size);
- GLvoid *getBuffer();
- GLsizeiptr getSize();
-};
-
-/** GL Trace Context info associated with each EGLContext */
-class GLTraceContext {
- int mId; /* unique context id */
- GLTraceState *mState; /* parent GL Trace state (for per process GL Trace State Info) */
-
- void *fbcontents; /* memory area to read framebuffer contents */
- void *fbcompressed; /* destination for lzf compressed framebuffer */
- unsigned fbcontentsSize; /* size of fbcontents & fbcompressed buffers */
-
- BufferedOutputStream *mBufferedOutputStream; /* stream where trace info is sent */
-
- /* list of element array buffers in use. */
- DefaultKeyedVector<GLuint, ElementArrayBuffer*> mElementArrayBuffers;
-
- void resizeFBMemory(unsigned minSize);
-public:
- gl_hooks_t *hooks;
-
- GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream);
- int getId();
- GLTraceState *getGlobalTraceState();
- void getCompressedFB(void **fb, unsigned *fbsize,
- unsigned *fbwidth, unsigned *fbheight,
- FBBinding fbToRead);
-
- // Methods to work with element array buffers
- void bindBuffer(GLuint bufferId, GLvoid *data, GLsizeiptr size);
- void getBuffer(GLuint bufferId, GLvoid **data, GLsizeiptr *size);
- void updateBufferSubData(GLuint bufferId, GLintptr offset, GLvoid *data, GLsizeiptr size);
- void deleteBuffer(GLuint bufferId);
-
- void traceGLMessage(GLMessage *msg);
-};
-
-/** Per process trace state. */
-class GLTraceState {
- int mTraceContextIds;
- TCPStream *mStream;
- std::map<EGLContext, GLTraceContext*> mPerContextState;
-
- /* Options controlling additional data to be collected on
- certain trace calls. */
- bool mCollectFbOnEglSwap;
- bool mCollectFbOnGlDraw;
- bool mCollectTextureDataOnGlTexImage;
- pthread_rwlock_t mTraceOptionsRwLock;
-
- /* helper methods to get/set values using provided lock for mutual exclusion. */
- void safeSetValue(bool *ptr, bool value, pthread_rwlock_t *lock);
- bool safeGetValue(bool *ptr, pthread_rwlock_t *lock);
-public:
- GLTraceState(TCPStream *stream);
- ~GLTraceState();
-
- GLTraceContext *createTraceContext(int version, EGLContext c);
- GLTraceContext *getTraceContext(EGLContext c);
-
- TCPStream *getStream();
-
- /* Methods to set trace options. */
- void setCollectFbOnEglSwap(bool en);
- void setCollectFbOnGlDraw(bool en);
- void setCollectTextureDataOnGlTexImage(bool en);
-
- /* Methods to retrieve trace options. */
- bool shouldCollectFbOnEglSwap();
- bool shouldCollectFbOnGlDraw();
- bool shouldCollectTextureDataOnGlTexImage();
-};
-
-void setupTraceContextThreadSpecific(GLTraceContext *context);
-GLTraceContext *getGLTraceContext();
-void releaseContext();
-
-};
-};
-
-#endif
diff --git a/opengl/libs/GLES_trace/src/gltrace_egl.cpp b/opengl/libs/GLES_trace/src/gltrace_egl.cpp
deleted file mode 100644
index 9d1682a..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_egl.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#include <cutils/log.h>
-#include <utils/Timers.h>
-
-#include "gltrace.pb.h"
-#include "gltrace_context.h"
-#include "gltrace_fixup.h"
-#include "gltrace_transport.h"
-
-namespace android {
-namespace gltrace {
-
-void GLTrace_eglCreateContext(int version, int contextId) {
- GLMessage glmessage;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmessage.set_context_id(contextId);
- glmessage.set_function(GLMessage::eglCreateContext);
-
- // copy argument version
- GLMessage_DataType *arg_version = glmessage.add_args();
- arg_version->set_isarray(false);
- arg_version->set_type(GLMessage::DataType::INT);
- arg_version->add_intvalue(version);
-
- // copy argument context
- GLMessage_DataType *arg_context = glmessage.add_args();
- arg_context->set_isarray(false);
- arg_context->set_type(GLMessage::DataType::INT);
- arg_context->add_intvalue(contextId);
-
- // set start time and duration
- glmessage.set_start_time(systemTime());
- glmessage.set_duration(0);
-
- glContext->traceGLMessage(&glmessage);
-}
-
-void GLTrace_eglMakeCurrent(int contextId) {
- GLMessage glmessage;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmessage.set_context_id(contextId);
- glmessage.set_function(GLMessage::eglMakeCurrent);
-
- // copy argument context
- GLMessage_DataType *arg_context = glmessage.add_args();
- arg_context->set_isarray(false);
- arg_context->set_type(GLMessage::DataType::INT);
- arg_context->add_intvalue(contextId);
-
- // set start time and duration
- glmessage.set_start_time(systemTime());
- glmessage.set_duration(0);
-
- glContext->traceGLMessage(&glmessage);
-}
-
-void GLTrace_eglSwapBuffers(void *dpy, void *draw) {
- GLMessage glmessage;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmessage.set_context_id(glContext->getId());
- glmessage.set_function(GLMessage::eglSwapBuffers);
-
- if (glContext->getGlobalTraceState()->shouldCollectFbOnEglSwap()) {
- // read FB0 since that is what is displayed on the screen
- fixup_addFBContents(glContext, &glmessage, FB0);
- }
-
- // set start time and duration
- glmessage.set_start_time(systemTime());
- glmessage.set_duration(0);
-
- glContext->traceGLMessage(&glmessage);
-}
-
-};
-};
diff --git a/opengl/libs/GLES_trace/src/gltrace_egl.h b/opengl/libs/GLES_trace/src/gltrace_egl.h
deleted file mode 100644
index f4684c5..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_egl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef __GLTRACE_EGL_H_
-#define __GLTRACE_EGL_H_
-
-namespace android {
-namespace gltrace {
-
-void GLTrace_eglCreateContext(int version, int contextId);
-void GLTrace_eglMakeCurrent(int contextId);
-void GLTrace_eglSwapBuffers(void *dpy, void *draw);
-
-};
-};
-
-#endif
diff --git a/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp b/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp
deleted file mode 100644
index c442153..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#include <arpa/inet.h>
-#include <stdlib.h>
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-#include "hooks.h"
-#include "glestrace.h"
-
-#include "gltrace_context.h"
-#include "gltrace_egl.h"
-#include "gltrace_hooks.h"
-#include "gltrace_transport.h"
-
-namespace android {
-
-using gltrace::GLTraceState;
-using gltrace::GLTraceContext;
-using gltrace::TCPStream;
-
-static GLTraceState *sGLTraceState;
-static pthread_t sReceiveThreadId;
-
-/**
- * Task that monitors the control stream from the host and updates
- * the trace status according to commands received from the host.
- */
-static void *commandReceiveTask(void *arg) {
- GLTraceState *state = (GLTraceState *)arg;
- TCPStream *stream = state->getStream();
-
- // Currently, there are very few user configurable settings.
- // As a result, they can be encoded in a single integer.
- int cmd;
- enum TraceSettingsMasks {
- READ_FB_ON_EGLSWAP_MASK = 1 << 0,
- READ_FB_ON_GLDRAW_MASK = 1 << 1,
- READ_TEXTURE_DATA_ON_GLTEXIMAGE_MASK = 1 << 2,
- };
-
- while (true) {
- int n = stream->receive(&cmd, 4);
- if (n != 4) {
- break;
- }
-
- cmd = ntohl(cmd);
-
- bool collectFbOnEglSwap = (cmd & READ_FB_ON_EGLSWAP_MASK) != 0;
- bool collectFbOnGlDraw = (cmd & READ_FB_ON_GLDRAW_MASK) != 0;
- bool collectTextureData = (cmd & READ_TEXTURE_DATA_ON_GLTEXIMAGE_MASK) != 0;
-
- state->setCollectFbOnEglSwap(collectFbOnEglSwap);
- state->setCollectFbOnGlDraw(collectFbOnGlDraw);
- state->setCollectTextureDataOnGlTexImage(collectTextureData);
-
- ALOGD("trace options: eglswap: %d, gldraw: %d, texImage: %d",
- collectFbOnEglSwap, collectFbOnGlDraw, collectTextureData);
- }
-
- return NULL;
-}
-
-void GLTrace_start() {
- char udsName[PROPERTY_VALUE_MAX];
-
- property_get("debug.egl.debug_portname", udsName, "gltrace");
- int clientSocket = gltrace::acceptClientConnection(udsName);
- if (clientSocket < 0) {
- ALOGE("Error creating GLTrace server socket. Quitting application.");
- exit(-1);
- }
-
- // create communication channel to the host
- TCPStream *stream = new TCPStream(clientSocket);
-
- // initialize tracing state
- sGLTraceState = new GLTraceState(stream);
-
- pthread_create(&sReceiveThreadId, NULL, commandReceiveTask, sGLTraceState);
-}
-
-void GLTrace_stop() {
- delete sGLTraceState;
- sGLTraceState = NULL;
-}
-
-void GLTrace_eglCreateContext(int version, EGLContext c) {
- // update trace state for new EGL context
- GLTraceContext *traceContext = sGLTraceState->createTraceContext(version, c);
- gltrace::setupTraceContextThreadSpecific(traceContext);
-
- // trace command through to the host
- gltrace::GLTrace_eglCreateContext(version, traceContext->getId());
-}
-
-void GLTrace_eglMakeCurrent(const unsigned version, gl_hooks_t *hooks, EGLContext c) {
- // setup per context state
- GLTraceContext *traceContext = sGLTraceState->getTraceContext(c);
- traceContext->hooks = hooks;
- gltrace::setupTraceContextThreadSpecific(traceContext);
-
- // trace command through to the host
- gltrace::GLTrace_eglMakeCurrent(traceContext->getId());
-}
-
-void GLTrace_eglReleaseThread() {
- gltrace::releaseContext();
-}
-
-void GLTrace_eglSwapBuffers(void *dpy, void *draw) {
- gltrace::GLTrace_eglSwapBuffers(dpy, draw);
-}
-
-gl_hooks_t *GLTrace_getGLHooks() {
- return gltrace::getGLHooks();
-}
-
-}
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
deleted file mode 100644
index 3597b26..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
+++ /dev/null
@@ -1,834 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#include <cutils/log.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include "gltrace.pb.h"
-#include "gltrace_api.h"
-#include "gltrace_context.h"
-#include "gltrace_fixup.h"
-
-namespace android {
-namespace gltrace {
-
-unsigned getBytesPerTexel(const GLenum format, const GLenum type) {
- /*
- Description from glTexImage2D spec:
-
- Data is read from data as a sequence of unsigned bytes or shorts, depending on type.
- When type is GL_UNSIGNED_BYTE, each of the bytes is interpreted as one color component.
- When type is one of GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, or
- GL_UNSIGNED_SHORT_5_5_5_1, each unsigned short value is interpreted as containing all
- the components for a single texel, with the color components arranged according to
- format. Color components are treated as groups of one, two, three, or four values,
- again based on format. Groups of components are referred to as texels.
-
- width × height texels are read from memory, starting at location data. By default,
- these texels are taken from adjacent memory locations, except that after all width
- texels are read, the read pointer is advanced to the next four-byte boundary.
- The four-byte row alignment is specified by glPixelStorei with argument
- GL_UNPACK_ALIGNMENT, and it can be set to one, two, four, or eight bytes.
- */
-
- switch (type) {
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- return 2;
- case GL_UNSIGNED_BYTE:
- break;
- default:
- ALOGE("GetBytesPerPixel: unknown type %x", type);
- }
-
- switch (format) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- return 1;
- case GL_LUMINANCE_ALPHA:
- return 2;
- case GL_RGB:
- return 3;
- case GL_RGBA:
- case 0x80E1: // GL_BGRA_EXT
- return 4;
- default:
- ALOGE("GetBytesPerPixel: unknown format %x", format);
- }
-
- return 1; // in doubt...
-}
-
-void fixup_GenericFloatArray(int argIndex, int nFloats, GLMessage *glmsg, void *src) {
- GLMessage_DataType *arg_floatarray = glmsg->mutable_args(argIndex);
- GLfloat *floatp = (GLfloat *)src;
-
- if (floatp == NULL) {
- return;
- }
-
- arg_floatarray->set_type(GLMessage::DataType::FLOAT);
- arg_floatarray->set_isarray(true);
- arg_floatarray->clear_floatvalue();
-
- for (int i = 0; i < nFloats; i++, floatp++) {
- arg_floatarray->add_floatvalue(*floatp);
- }
-}
-
-void fixup_GenericIntArray(int argIndex, int nInts, GLMessage *glmsg, void *src) {
- GLMessage_DataType *arg_intarray = glmsg->mutable_args(argIndex);
- GLint *intp = (GLint *)src;
-
- if (intp == NULL) {
- return;
- }
-
- arg_intarray->set_type(GLMessage::DataType::INT);
- arg_intarray->set_isarray(true);
- arg_intarray->clear_intvalue();
-
- for (int i = 0; i < nInts; i++, intp++) {
- arg_intarray->add_intvalue(*intp);
- }
-}
-
-void fixup_GenericEnumArray(int argIndex, int nEnums, GLMessage *glmsg, void *src) {
- // fixup as if they were ints
- fixup_GenericIntArray(argIndex, nEnums, glmsg, src);
-
- // and then set the data type to be enum
- GLMessage_DataType *arg_enumarray = glmsg->mutable_args(argIndex);
- arg_enumarray->set_type(GLMessage::DataType::ENUM);
-}
-
-/** Generic helper function: extract pointer at argIndex and
- replace it with the C style string at *pointer */
-void fixup_CStringPtr(int argIndex, GLMessage *glmsg, void *src) {
- GLMessage_DataType *arg = glmsg->mutable_args(argIndex);
- GLchar *ptr = (GLchar *) src;
-
- arg->set_type(GLMessage::DataType::CHAR);
- arg->set_isarray(true);
- arg->add_charvalue(ptr);
-}
-
-void fixup_glGetString(GLMessage *glmsg, void *pointersToFixup[]) {
- /* const GLubyte* GLTrace_glGetString(GLenum name) */
- GLMessage_DataType *ret = glmsg->mutable_returnvalue();
- GLchar *ptr = (GLchar *) pointersToFixup[0];
-
- if (ptr != NULL) {
- ret->set_type(GLMessage::DataType::CHAR);
- ret->set_isarray(true);
- ret->add_charvalue(ptr);
- }
-}
-
-/* Add the contents of the framebuffer to the protobuf message */
-void fixup_addFBContents(GLTraceContext *context, GLMessage *glmsg, FBBinding fbToRead) {
- void *fbcontents;
- unsigned fbsize, fbwidth, fbheight;
- context->getCompressedFB(&fbcontents, &fbsize, &fbwidth, &fbheight, fbToRead);
-
- GLMessage_FrameBuffer *fb = glmsg->mutable_fb();
- fb->set_width(fbwidth);
- fb->set_height(fbheight);
- fb->add_contents(fbcontents, fbsize);
-}
-
-/** Common fixup routing for glTexImage2D & glTexSubImage2D. */
-void fixup_glTexImage(int widthIndex, int heightIndex, GLMessage *glmsg, void *dataSrc) {
- GLMessage_DataType arg_width = glmsg->args(widthIndex);
- GLMessage_DataType arg_height = glmsg->args(heightIndex);
-
- GLMessage_DataType arg_format = glmsg->args(6);
- GLMessage_DataType arg_type = glmsg->args(7);
- GLMessage_DataType *arg_data = glmsg->mutable_args(8);
-
- GLsizei width = arg_width.intvalue(0);
- GLsizei height = arg_height.intvalue(0);
- GLenum format = arg_format.intvalue(0);
- GLenum type = arg_type.intvalue(0);
- void *data = (void *) dataSrc;
-
- int bytesPerTexel = getBytesPerTexel(format, type);
-
- arg_data->set_type(GLMessage::DataType::BYTE);
- arg_data->clear_rawbytes();
-
- if (data != NULL) {
- arg_data->set_isarray(true);
- arg_data->add_rawbytes(data, bytesPerTexel * width * height);
- } else {
- arg_data->set_isarray(false);
- arg_data->set_type(GLMessage::DataType::VOID);
- }
-}
-
-
-void fixup_glTexImage2D(GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glTexImage2D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *data);
- */
- int widthIndex = 3;
- int heightIndex = 4;
- fixup_glTexImage(widthIndex, heightIndex, glmsg, pointersToFixup[0]);
-}
-
-void fixup_glTexSubImage2D(GLMessage *glmsg, void *pointersToFixup[]) {
- /*
- void glTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const GLvoid * data);
- */
- int widthIndex = 4;
- int heightIndex = 5;
- fixup_glTexImage(widthIndex, heightIndex, glmsg, pointersToFixup[0]);
-}
-
-void fixup_glShaderSource(GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glShaderSource(GLuint shader, GLsizei count, const GLchar** string,
- const GLint* length) */
- GLMessage_DataType arg_count = glmsg->args(1);
- GLMessage_DataType arg_lenp = glmsg->args(3);
- GLMessage_DataType *arg_strpp = glmsg->mutable_args(2);
-
- GLsizei count = arg_count.intvalue(0);
- GLchar **stringpp = (GLchar **) pointersToFixup[0];
- GLint *lengthp = (GLint *) pointersToFixup[1];
-
- arg_strpp->set_type(GLMessage::DataType::CHAR);
- arg_strpp->set_isarray(true);
- arg_strpp->clear_charvalue();
-
- ::std::string src = "";
- for (int i = 0; i < count; i++) {
- if (lengthp != NULL)
- src.append(*stringpp, *lengthp);
- else
- src.append(*stringpp); // assume null terminated
- stringpp++;
- lengthp++;
- }
-
- arg_strpp->add_charvalue(src);
-}
-
-void fixup_glUniformGenericInteger(int argIndex, int nIntegers, GLMessage *glmsg,
- void *pointersToFixup[]) {
- /* void glUniform?iv(GLint location, GLsizei count, const GLint *value); */
- fixup_GenericIntArray(argIndex, nIntegers, glmsg, pointersToFixup[0]);
-}
-
-void fixup_glUniformGeneric(int argIndex, int nFloats, GLMessage *glmsg, void *src) {
- fixup_GenericFloatArray(argIndex, nFloats, glmsg, src);
-}
-
-void fixup_glUniformMatrixGeneric(int matrixSize, GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glUniformMatrix?fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) */
- GLMessage_DataType arg_count = glmsg->args(1);
- int n_matrices = arg_count.intvalue(0);
- fixup_glUniformGeneric(3, matrixSize * matrixSize * n_matrices, glmsg, pointersToFixup[0]);
-}
-
-void fixup_glGenGeneric(GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glGen*(GLsizei n, GLuint * buffers); */
- GLMessage_DataType arg_n = glmsg->args(0);
- GLsizei n = arg_n.intvalue(0);
-
- fixup_GenericIntArray(1, n, glmsg, pointersToFixup[0]);
-}
-
-void fixup_glDeleteGeneric(GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glDelete*(GLsizei n, GLuint *buffers); */
- GLMessage_DataType arg_n = glmsg->args(0);
- GLsizei n = arg_n.intvalue(0);
-
- fixup_GenericIntArray(1, n, glmsg, pointersToFixup[0]);
-}
-
-void fixup_glGetBooleanv(GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glGetBooleanv(GLenum pname, GLboolean *params); */
- GLMessage_DataType *arg_params = glmsg->mutable_args(1);
- GLboolean *src = (GLboolean*) pointersToFixup[0];
-
- arg_params->set_type(GLMessage::DataType::BOOL);
- arg_params->set_isarray(true);
- arg_params->clear_boolvalue();
- arg_params->add_boolvalue(*src);
-}
-
-void fixup_glGetFloatv(GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glGetFloatv(GLenum pname, GLfloat *params); */
- GLMessage_DataType *arg_params = glmsg->mutable_args(1);
- GLfloat *src = (GLfloat*) pointersToFixup[0];
-
- arg_params->set_type(GLMessage::DataType::FLOAT);
- arg_params->set_isarray(true);
- arg_params->clear_floatvalue();
- arg_params->add_floatvalue(*src);
-}
-
-void fixup_glLinkProgram(GLMessage *glmsg) {
- /* void glLinkProgram(GLuint program); */
- GLuint program = glmsg->args(0).intvalue(0);
-
- /* We don't have to fixup this call, but as soon as a program is linked,
- we obtain information about all active attributes and uniforms to
- pass on to the debugger. Note that in order to pass this info to
- the debugger, all we need to do is call the trace versions of the
- necessary calls. */
-
- GLint n, maxNameLength;
- GLchar *name;
- GLint size;
- GLenum type;
-
- // obtain info regarding active attributes
- GLTrace_glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &n);
- GLTrace_glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength);
-
- name = (GLchar *) malloc(maxNameLength);
- for (int i = 0; i < n; i++) {
- GLTrace_glGetActiveAttrib(program, i, maxNameLength, NULL, &size, &type, name);
- }
- free(name);
-
- // obtain info regarding active uniforms
- GLTrace_glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &n);
- GLTrace_glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength);
-
- name = (GLchar *) malloc(maxNameLength);
- for (int i = 0; i < n; i++) {
- GLTrace_glGetActiveUniform(program, i, maxNameLength, NULL, &size, &type, name);
- }
- free(name);
-}
-
-/** Given a glGetActive[Uniform|Attrib] call, obtain the location
- * of the variable of given name in the call.
- */
-int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) {
- GLMessage_Function func = glmsg->function();
- if (func != GLMessage::glGetActiveAttrib && func != GLMessage::glGetActiveUniform) {
- return -1;
- }
-
- int program = glmsg->args(0).intvalue(0);
-
- if (func == GLMessage::glGetActiveAttrib) {
- return context->hooks->gl.glGetAttribLocation(program, name);
- } else {
- return context->hooks->gl.glGetUniformLocation(program, name);
- }
-}
-
-void fixup_glGetActiveAttribOrUniform(GLTraceContext *context, GLMessage *glmsg,
- void *pointersToFixup[]) {
- /* void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize,
- GLsizei* length, GLint* size, GLenum* type, GLchar* name); */
- /* void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize,
- GLsizei* length, GLint* size, GLenum* type, GLchar* name) */
-
- fixup_GenericIntArray(3, 1, glmsg, pointersToFixup[0]); // length
- fixup_GenericIntArray(4, 1, glmsg, pointersToFixup[1]); // size
- fixup_GenericEnumArray(5, 1, glmsg, pointersToFixup[2]); // type
- fixup_CStringPtr(6, glmsg, pointersToFixup[3]); // name
-
- // The index argument in the glGetActive[Attrib|Uniform] functions
- // does not correspond to the actual location index as used in
- // glUniform*() or glVertexAttrib*() to actually upload the data.
- // In order to make things simpler for the debugger, we also pass
- // a hidden location argument that stores the actual location.
- // append the location value to the end of the argument list
- int location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]);
- GLMessage_DataType *arg_location = glmsg->add_args();
- arg_location->set_isarray(false);
- arg_location->set_type(GLMessage::DataType::INT);
- arg_location->add_intvalue(location);
-}
-
-GLint glGetInteger(GLTraceContext *context, GLenum param) {
- GLint x;
- context->hooks->gl.glGetIntegerv(param, &x);
- return x;
-}
-
-GLint glGetVertexAttrib(GLTraceContext *context, GLuint index, GLenum pname) {
- GLint x;
- context->hooks->gl.glGetVertexAttribiv(index, pname, &x);
- return x;
-}
-
-bool isUsingArrayBuffers(GLTraceContext *context) {
- return glGetInteger(context, GL_ARRAY_BUFFER_BINDING) != 0;
-}
-
-bool isUsingElementArrayBuffers(GLTraceContext *context) {
- return glGetInteger(context, GL_ELEMENT_ARRAY_BUFFER_BINDING) != 0;
-}
-
-/** Copy @len bytes of data from @src into the @dataIndex'th argument of the message. */
-void addGlBufferData(GLMessage *glmsg, int dataIndex, GLvoid *src, GLsizeiptr len) {
- GLMessage_DataType *arg_datap = glmsg->mutable_args(dataIndex);
- arg_datap->set_type(GLMessage::DataType::VOID);
- arg_datap->set_isarray(true);
- arg_datap->clear_intvalue();
- arg_datap->add_rawbytes(src, len);
-}
-
-void fixup_glBufferData(GLTraceContext *context, GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) */
- GLsizeiptr size = glmsg->args(1).intvalue(0);
- GLvoid *datap = (GLvoid *) pointersToFixup[0];
-
- // Save element array buffers for future use to fixup glVertexAttribPointers
- // when a glDrawElements() call is performed.
- GLenum target = glmsg->args(0).intvalue(0);
- if (target == GL_ELEMENT_ARRAY_BUFFER) {
- GLint bufferId = glGetInteger(context, GL_ELEMENT_ARRAY_BUFFER_BINDING);
- context->bindBuffer(bufferId, datap, size);
- }
-
- // add buffer data to the protobuf message
- if (datap != NULL) {
- addGlBufferData(glmsg, 2, datap, size);
- }
-}
-
-void fixup_glBufferSubData(GLTraceContext *context, GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) */
- GLenum target = glmsg->args(0).intvalue(0);
- GLintptr offset = glmsg->args(1).intvalue(0);
- GLsizeiptr size = glmsg->args(2).intvalue(0);
- GLvoid *datap = (GLvoid *) pointersToFixup[0];
- if (target == GL_ELEMENT_ARRAY_BUFFER) {
- GLint bufferId = glGetInteger(context, GL_ELEMENT_ARRAY_BUFFER_BINDING);
- context->updateBufferSubData(bufferId, offset, datap, size);
- }
-
- // add buffer data to the protobuf message
- addGlBufferData(glmsg, 3, datap, size);
-}
-
-/** Obtain the size of each vertex attribute. */
-int vertexAttribSize(GLenum type, GLsizei numComponents) {
- int sizePerComponent;
-
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- sizePerComponent = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- sizePerComponent = 2;
- break;
- case GL_FIXED:
- case GL_FLOAT:
- default:
- sizePerComponent = 4;
- break;
- }
-
- return sizePerComponent * numComponents;
-}
-
-/** Create and send a glVertexAttribPointerData trace message to the host. */
-void trace_glVertexAttribPointerData(GLTraceContext *context,
- GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, const GLvoid* ptr,
- GLuint minIndex, GLuint maxIndex, nsecs_t startTime) {
- /* void glVertexAttribPointerData(GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, const GLvoid* ptr,
- int minIndex, int maxIndex) */
- GLMessage glmsg;
- GLTraceContext *glContext = context;
-
- glmsg.set_function(GLMessage::glVertexAttribPointerData);
-
- // copy argument indx
- GLMessage_DataType *arg_indx = glmsg.add_args();
- arg_indx->set_isarray(false);
- arg_indx->set_type(GLMessage::DataType::INT);
- arg_indx->add_intvalue(indx);
-
- // copy argument size
- GLMessage_DataType *arg_size = glmsg.add_args();
- arg_size->set_isarray(false);
- arg_size->set_type(GLMessage::DataType::INT);
- arg_size->add_intvalue(size);
-
- // copy argument type
- GLMessage_DataType *arg_type = glmsg.add_args();
- arg_type->set_isarray(false);
- arg_type->set_type(GLMessage::DataType::ENUM);
- arg_type->add_intvalue((int)type);
-
- // copy argument normalized
- GLMessage_DataType *arg_normalized = glmsg.add_args();
- arg_normalized->set_isarray(false);
- arg_normalized->set_type(GLMessage::DataType::BOOL);
- arg_normalized->add_boolvalue(normalized);
-
- // copy argument stride
- GLMessage_DataType *arg_stride = glmsg.add_args();
- arg_stride->set_isarray(false);
- arg_stride->set_type(GLMessage::DataType::INT);
- arg_stride->add_intvalue(stride);
-
- // copy argument ptr
- GLMessage_DataType *arg_ptr = glmsg.add_args();
- arg_ptr->set_isarray(true);
- arg_ptr->set_type(GLMessage::DataType::BYTE);
- int perVertexSize = vertexAttribSize(type, size);
- GLchar *p = (GLchar*) ptr;
- std::string data;
- for (GLuint i = minIndex; i < maxIndex; i++) {
- data.append(p, perVertexSize);
- p += stride == 0 ? perVertexSize : stride;
- }
- arg_ptr->add_rawbytes(data);
-
- // copy argument min index
- GLMessage_DataType *arg_min = glmsg.add_args();
- arg_min->set_isarray(false);
- arg_min->set_type(GLMessage::DataType::INT);
- arg_min->add_intvalue(minIndex);
-
- // copy argument max index
- GLMessage_DataType *arg_max = glmsg.add_args();
- arg_max->set_isarray(false);
- arg_max->set_type(GLMessage::DataType::INT);
- arg_max->add_intvalue(maxIndex);
-
- glmsg.set_context_id(context->getId());
- glmsg.set_start_time(startTime);
- glmsg.set_threadtime(0);
- glmsg.set_duration(0);
-
- context->traceGLMessage(&glmsg);
-}
-
-void findMinAndMaxIndices(GLvoid *indices, GLsizei count, GLenum type,
- GLuint *minIndex, GLuint *maxIndex) {
- GLuint index;
- *minIndex = UINT_MAX;
- *maxIndex = 0;
-
- if (indices == NULL) {
- return;
- }
-
- for (GLsizei i = 0; i < count; i++) {
- if (type == GL_UNSIGNED_BYTE) {
- index = *((GLubyte*) indices + i);
- } else {
- index = *((GLushort*) indices + i);
- }
-
- if (index < *minIndex) *minIndex = index;
- if (index > *maxIndex) *maxIndex = index;
- }
-}
-
-void trace_VertexAttribPointerData(GLTraceContext *context,
- GLuint minIndex, GLuint maxIndex, nsecs_t time) {
- GLuint maxAttribs = glGetInteger(context, GL_MAX_VERTEX_ATTRIBS);
- for (GLuint index = 0; index < maxAttribs; index++) {
- if (!glGetVertexAttrib(context, index, GL_VERTEX_ATTRIB_ARRAY_ENABLED)) {
- // vertex array disabled
- continue;
- }
-
- if (glGetVertexAttrib(context, index, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)) {
- // vbo
- continue;
- }
-
- GLint size = glGetVertexAttrib(context, index, GL_VERTEX_ATTRIB_ARRAY_SIZE);
- GLenum type = glGetVertexAttrib(context, index, GL_VERTEX_ATTRIB_ARRAY_TYPE);
- GLboolean norm = glGetVertexAttrib(context, index, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED);
- GLsizei stride = glGetVertexAttrib(context, index, GL_VERTEX_ATTRIB_ARRAY_STRIDE);
- GLvoid* ptr;
- context->hooks->gl.glGetVertexAttribPointerv(index, GL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr);
-
- trace_glVertexAttribPointerData(context,
- index, size, type, norm, stride, ptr,
- minIndex, maxIndex, time);
- }
-}
-
-void trace_VertexAttribPointerDataForGlDrawArrays(GLTraceContext *context, GLMessage *glmsg) {
- /* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */
- GLsizei count = glmsg->args(2).intvalue(0);
-
- // Vertex attrib pointer data patchup calls should appear as if
- // they occurred right before the draw call.
- nsecs_t time = glmsg->start_time() - 1;
-
- trace_VertexAttribPointerData(context, 0, count, time);
-}
-
-void trace_VertexAttribPointerDataForGlDrawElements(GLTraceContext *context, GLMessage *glmsg,
- GLvoid *indices) {
- /* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */
- GLsizei count = glmsg->args(1).intvalue(0);
- GLenum type = glmsg->args(2).intvalue(0);
- GLuint index;
-
- GLuint minIndex, maxIndex;
-
- // The index buffer is either passed in as an argument to the glDrawElements() call,
- // or it is stored in the current GL_ELEMENT_ARRAY_BUFFER.
- GLvoid *indexBuffer;
- if (isUsingElementArrayBuffers(context)) {
- GLsizeiptr eaBufferSize;
- GLuint bufferId = glGetInteger(context, GL_ELEMENT_ARRAY_BUFFER_BINDING);
- context->getBuffer(bufferId, &indexBuffer, &eaBufferSize);
- } else {
- indexBuffer = indices;
- }
-
- // Rather than sending vertex attribute data that corresponds to the indices
- // being drawn, we send the vertex attribute data for the entire range of
- // indices being drawn, including the ones not drawn. The min & max indices
- // provide the range of indices being drawn.
- findMinAndMaxIndices(indexBuffer, count, type, &minIndex, &maxIndex);
-
- // Vertex attrib pointer data patchup calls should appear as if
- // they occurred right before the draw call.
- nsecs_t time = glmsg->start_time() - 1;
-
- trace_VertexAttribPointerData(context, minIndex, maxIndex + 1, time);
-}
-
-void fixup_glDrawArrays(GLTraceContext *context, GLMessage *glmsg) {
- // Trace all vertex attribute data stored in client space.
- trace_VertexAttribPointerDataForGlDrawArrays(context, glmsg);
-
- // Attach the FB if requested
- if (context->getGlobalTraceState()->shouldCollectFbOnGlDraw()) {
- fixup_addFBContents(context, glmsg, CURRENTLY_BOUND_FB);
- }
-}
-
-void fixup_glDrawElements(GLTraceContext *context, GLMessage *glmsg, void *pointersToFixup[]) {
- /* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */
- GLvoid *indices = pointersToFixup[0];
- GLenum type = glmsg->args(2).intvalue(0);
- GLsizei count = glmsg->args(1).intvalue(0);
- GLuint index;
-
- // Trace all vertex attribute data stored in client space.
- trace_VertexAttribPointerDataForGlDrawElements(context, glmsg, indices);
-
- // Fixup indices argument
- if (!isUsingElementArrayBuffers(context)) {
- GLMessage_DataType *arg_indices = glmsg->mutable_args(3);
- arg_indices->set_isarray(true);
- arg_indices->clear_intvalue();
- arg_indices->set_type(GLMessage::DataType::INT);
- for (GLsizei i = 0; i < count; i++) {
- if (type == GL_UNSIGNED_BYTE) {
- index = *((GLubyte*) indices + i);
- } else {
- index = *((GLushort*) indices + i);
- }
- arg_indices->add_intvalue(index);
- }
- }
-
- // Attach the FB if requested
- if (context->getGlobalTraceState()->shouldCollectFbOnGlDraw()) {
- fixup_addFBContents(context, glmsg, CURRENTLY_BOUND_FB);
- }
-}
-
-void fixupGLMessage(GLTraceContext *context, nsecs_t wallStart, nsecs_t wallEnd,
- nsecs_t threadStart, nsecs_t threadEnd,
- GLMessage *glmsg, void *pointersToFixup[]) {
- // for all messages, set the current context id
- glmsg->set_context_id(context->getId());
-
- // set start time and duration
- glmsg->set_start_time(wallStart);
- glmsg->set_duration((unsigned)(wallEnd - wallStart));
- glmsg->set_threadtime((unsigned)(threadEnd - threadStart));
-
- // do any custom message dependent processing
- switch (glmsg->function()) {
- case GLMessage::glDeleteBuffers: /* glDeleteBuffers(GLsizei n, GLuint *buffers); */
- case GLMessage::glDeleteFramebuffers: /* glDeleteFramebuffers(GLsizei n, GLuint *buffers); */
- case GLMessage::glDeleteRenderbuffers:/* glDeleteRenderbuffers(GLsizei n, GLuint *buffers); */
- case GLMessage::glDeleteTextures: /* glDeleteTextures(GLsizei n, GLuint *textures); */
- fixup_glDeleteGeneric(glmsg, pointersToFixup);
- break;
- case GLMessage::glGenBuffers: /* void glGenBuffers(GLsizei n, GLuint *buffers); */
- case GLMessage::glGenFramebuffers: /* void glGenFramebuffers(GLsizei n, GLuint *buffers); */
- case GLMessage::glGenRenderbuffers: /* void glGenFramebuffers(GLsizei n, GLuint *buffers); */
- case GLMessage::glGenTextures: /* void glGenTextures(GLsizei n, GLuint *textures); */
- fixup_glGenGeneric(glmsg, pointersToFixup);
- break;
- case GLMessage::glLinkProgram: /* void glLinkProgram(GLuint program); */
- fixup_glLinkProgram(glmsg);
- break;
- case GLMessage::glGetActiveAttrib:
- fixup_glGetActiveAttribOrUniform(context, glmsg, pointersToFixup);
- break;
- case GLMessage::glGetActiveUniform:
- fixup_glGetActiveAttribOrUniform(context, glmsg, pointersToFixup);
- break;
- case GLMessage::glBindAttribLocation:
- /* void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name); */
- fixup_CStringPtr(2, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glGetAttribLocation:
- case GLMessage::glGetUniformLocation:
- /* int glGetAttribLocation(GLuint program, const GLchar* name) */
- /* int glGetUniformLocation(GLuint program, const GLchar* name) */
- fixup_CStringPtr(1, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glGetBooleanv:
- fixup_glGetBooleanv(glmsg, pointersToFixup);
- break;
- case GLMessage::glGetFloatv:
- fixup_glGetFloatv(glmsg, pointersToFixup);
- break;
- case GLMessage::glGetIntegerv: /* void glGetIntegerv(GLenum pname, GLint *params); */
- fixup_GenericIntArray(1, 1, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glGetProgramiv:
- case GLMessage::glGetRenderbufferParameteriv:
- case GLMessage::glGetShaderiv:
- /* void glGetProgramiv(GLuint program, GLenum pname, GLint* params) */
- /* void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) */
- /* void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) */
- fixup_GenericIntArray(2, 1, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glGetString:
- fixup_glGetString(glmsg, pointersToFixup);
- break;
- case GLMessage::glTexImage2D:
- if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) {
- fixup_glTexImage2D(glmsg, pointersToFixup);
- }
- break;
- case GLMessage::glTexSubImage2D:
- if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) {
- fixup_glTexSubImage2D(glmsg, pointersToFixup);
- }
- break;
- case GLMessage::glShaderSource:
- fixup_glShaderSource(glmsg, pointersToFixup);
- break;
- case GLMessage::glUniform1iv:
- /* void glUniform1iv(GLint location, GLsizei count, const GLint *value); */
- fixup_glUniformGenericInteger(2, 1, glmsg, pointersToFixup);
- break;
- case GLMessage::glUniform2iv:
- /* void glUniform2iv(GLint location, GLsizei count, const GLint *value); */
- fixup_glUniformGenericInteger(2, 2, glmsg, pointersToFixup);
- break;
- case GLMessage::glUniform3iv:
- /* void glUniform3iv(GLint location, GLsizei count, const GLint *value); */
- fixup_glUniformGenericInteger(2, 3, glmsg, pointersToFixup);
- break;
- case GLMessage::glUniform4iv:
- /* void glUniform4iv(GLint location, GLsizei count, const GLint *value); */
- fixup_glUniformGenericInteger(2, 4, glmsg, pointersToFixup);
- break;
- case GLMessage::glUniform1fv:
- /* void glUniform1fv(GLint location, GLsizei count, const GLfloat *value); */
- fixup_glUniformGeneric(2, 1, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glUniform2fv:
- /* void glUniform2fv(GLint location, GLsizei count, const GLfloat *value); */
- fixup_glUniformGeneric(2, 2, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glUniform3fv:
- /* void glUniform3fv(GLint location, GLsizei count, const GLfloat *value); */
- fixup_glUniformGeneric(2, 3, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glUniform4fv:
- /* void glUniform4fv(GLint location, GLsizei count, const GLfloat *value); */
- fixup_glUniformGeneric(2, 4, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glUniformMatrix2fv:
- /* void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) */
- fixup_glUniformMatrixGeneric(2, glmsg, pointersToFixup);
- break;
- case GLMessage::glUniformMatrix3fv:
- /* void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) */
- fixup_glUniformMatrixGeneric(3, glmsg, pointersToFixup);
- break;
- case GLMessage::glUniformMatrix4fv:
- /* void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) */
- fixup_glUniformMatrixGeneric(4, glmsg, pointersToFixup);
- break;
- case GLMessage::glBufferData:
- /* void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) */
- fixup_glBufferData(context, glmsg, pointersToFixup);
- break;
- case GLMessage::glBufferSubData:
- /* void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) */
- fixup_glBufferSubData(context, glmsg, pointersToFixup);
- break;
- case GLMessage::glDrawArrays:
- /* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */
- fixup_glDrawArrays(context, glmsg);
- break;
- case GLMessage::glDrawElements:
- /* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */
- fixup_glDrawElements(context, glmsg, pointersToFixup);
- break;
- case GLMessage::glPushGroupMarkerEXT:
- /* void PushGroupMarkerEXT(sizei length, const char *marker); */
- fixup_CStringPtr(1, glmsg, pointersToFixup[0]);
- break;
- case GLMessage::glInsertEventMarkerEXT:
- /* void InsertEventMarkerEXT(sizei length, const char *marker); */
- fixup_CStringPtr(1, glmsg, pointersToFixup[0]);
- break;
- default:
- break;
- }
-}
-
-};
-};
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.h b/opengl/libs/GLES_trace/src/gltrace_fixup.h
deleted file mode 100644
index fe30125..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_fixup.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef __GLTRACE_FIXUP_H_
-#define __GLTRACE_FIXUP_H_
-
-#include <utils/Timers.h>
-
-#include "gltrace.pb.h"
-#include "gltrace_context.h"
-
-namespace android {
-namespace gltrace {
-
-void fixupGLMessage(GLTraceContext *curContext, nsecs_t wallStart, nsecs_t wallEnd,
- nsecs_t threadStart, nsecs_t threadEnd,
- GLMessage *message, void *pointersToFixup[]);
-void fixup_addFBContents(GLTraceContext *curContext, GLMessage *message, FBBinding fbToRead);
-
-};
-};
-
-#endif
diff --git a/opengl/libs/GLES_trace/src/gltrace_hooks.cpp b/opengl/libs/GLES_trace/src/gltrace_hooks.cpp
deleted file mode 100644
index de8d463..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_hooks.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#include "hooks.h"
-#include "gltrace_api.h"
-#include "gltrace_hooks.h"
-
-namespace android {
-namespace gltrace {
-
-// Hook up all the GLTrace functions
-#define GL_ENTRY(_r, _api, ...) GLTrace_ ## _api,
-EGLAPI gl_hooks_t gHooksDebug = {
- {
- #include "entries.in"
- },
- {
- {0}
- }
-};
-#undef GL_ENTRY
-
-gl_hooks_t *getGLHooks() {
- return &gHooksDebug;
-}
-
-};
-};
diff --git a/opengl/libs/GLES_trace/src/gltrace_hooks.h b/opengl/libs/GLES_trace/src/gltrace_hooks.h
deleted file mode 100644
index c946a09..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_hooks.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef __GLD_HOOKS_H_
-#define __GLD_HOOKS_H_
-
-#include "hooks.h"
-
-namespace android {
-namespace gltrace {
-
-using ::android::gl_hooks_t;
-
-gl_hooks_t *getGLHooks();
-
-};
-};
-
-#endif
diff --git a/opengl/libs/GLES_trace/src/gltrace_transport.cpp b/opengl/libs/GLES_trace/src/gltrace_transport.cpp
deleted file mode 100644
index 5251b12..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_transport.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-
-#include <cutils/log.h>
-
-#include "gltrace_transport.h"
-
-namespace android {
-namespace gltrace {
-
-int acceptClientConnection(char *sockname) {
- int serverSocket = socket(AF_LOCAL, SOCK_STREAM, 0);
- if (serverSocket < 0) {
- ALOGE("Error (%d) while creating socket. Check if app has network permissions.",
- serverSocket);
- return -1;
- }
-
- struct sockaddr_un server, client;
-
- memset(&server, 0, sizeof server);
- server.sun_family = AF_UNIX;
- // the first byte of sun_path should be '\0' for abstract namespace
- strcpy(server.sun_path + 1, sockname);
-
- // note that sockaddr_len should be set to the exact size of the buffer that is used.
- socklen_t sockaddr_len = sizeof(server.sun_family) + strlen(sockname) + 1;
- if (bind(serverSocket, (struct sockaddr *) &server, sockaddr_len) < 0) {
- close(serverSocket);
- ALOGE("Failed to bind the server socket");
- return -1;
- }
-
- if (listen(serverSocket, 1) < 0) {
- close(serverSocket);
- ALOGE("Failed to listen on server socket");
- return -1;
- }
-
- ALOGD("gltrace::waitForClientConnection: server listening @ path %s", sockname);
-
- int clientSocket = accept(serverSocket, (struct sockaddr *)&client, &sockaddr_len);
- if (clientSocket < 0) {
- close(serverSocket);
- ALOGE("Failed to accept client connection");
- return -1;
- }
-
- ALOGD("gltrace::waitForClientConnection: client connected.");
-
- // do not accept any more incoming connections
- close(serverSocket);
-
- return clientSocket;
-}
-
-TCPStream::TCPStream(int socket) {
- mSocket = socket;
- pthread_mutex_init(&mSocketWriteMutex, NULL);
-}
-
-TCPStream::~TCPStream() {
- pthread_mutex_destroy(&mSocketWriteMutex);
-}
-
-void TCPStream::closeStream() {
- if (mSocket > 0) {
- close(mSocket);
- mSocket = 0;
- }
-}
-
-int TCPStream::send(void *buf, size_t len) {
- if (mSocket <= 0) {
- return -1;
- }
-
- pthread_mutex_lock(&mSocketWriteMutex);
- int n = write(mSocket, buf, len);
- pthread_mutex_unlock(&mSocketWriteMutex);
-
- return n;
-}
-
-int TCPStream::receive(void *data, size_t len) {
- if (mSocket <= 0) {
- return -1;
- }
-
- return read(mSocket, data, len);
-}
-
-BufferedOutputStream::BufferedOutputStream(TCPStream *stream, size_t bufferSize) {
- mStream = stream;
-
- mBufferSize = bufferSize;
- mStringBuffer = "";
- mStringBuffer.reserve(bufferSize);
-}
-
-int BufferedOutputStream::flush() {
- if (mStringBuffer.size() == 0) {
- return 0;
- }
-
- int n = mStream->send((void *)mStringBuffer.data(), mStringBuffer.size());
- mStringBuffer.clear();
- return n;
-}
-
-void BufferedOutputStream::enqueueMessage(GLMessage *msg) {
- const uint32_t len = msg->ByteSize();
-
- mStringBuffer.append((const char *)&len, sizeof(len)); // append header
- msg->AppendToString(&mStringBuffer); // append message
-}
-
-int BufferedOutputStream::send(GLMessage *msg) {
- enqueueMessage(msg);
-
- if (mStringBuffer.size() > mBufferSize) {
- return flush();
- }
-
- return 0;
-}
-
-}; // namespace gltrace
-}; // namespace android
diff --git a/opengl/libs/GLES_trace/src/gltrace_transport.h b/opengl/libs/GLES_trace/src/gltrace_transport.h
deleted file mode 100644
index 3665035..0000000
--- a/opengl/libs/GLES_trace/src/gltrace_transport.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef __GLTRACE_TRANSPORT_H_
-#define __GLTRACE_TRANSPORT_H_
-
-#include <pthread.h>
-
-#include "gltrace.pb.h"
-
-namespace android {
-namespace gltrace {
-
-/**
- * TCPStream provides a TCP based communication channel from the device to
- * the host for transferring GLMessages.
- */
-class TCPStream {
- int mSocket;
- pthread_mutex_t mSocketWriteMutex;
-public:
- /** Create a TCP based communication channel over @socket */
- TCPStream(int socket);
- ~TCPStream();
-
- /** Close the channel. */
- void closeStream();
-
- /** Send @data of size @len to host. . Returns -1 on error, 0 on success. */
- int send(void *data, size_t len);
-
- /** Receive data into @buf from the remote end. This is a blocking call. */
- int receive(void *buf, size_t size);
-};
-
-/**
- * BufferedOutputStream provides buffering of data sent to the underlying
- * unbuffered channel.
- */
-class BufferedOutputStream {
- TCPStream *mStream;
-
- size_t mBufferSize;
- std::string mStringBuffer;
-
- /** Enqueue message into internal buffer. */
- void enqueueMessage(GLMessage *msg);
-public:
- /**
- * Construct a Buffered stream of size @bufferSize, using @stream as
- * its underlying channel for transport.
- */
- BufferedOutputStream(TCPStream *stream, size_t bufferSize);
-
- /**
- * Send @msg. The message could be buffered and sent later with a
- * subsequent message. Returns -1 on error, 0 on success.
- */
- int send(GLMessage *msg);
-
- /** Send any buffered messages, returns -1 on error, 0 on success. */
- int flush();
-};
-
-/**
- * Utility method: start a server listening at @sockName (unix domain socket,
- * abstract namespace path), and wait for a client connection.
- * Returns the connected client socket on success, or -1 on failure.
- */
-int acceptClientConnection(char *sockName);
-
-};
-};
-
-#endif
diff --git a/opengl/libs/GLES_trace/tools/genapi.py b/opengl/libs/GLES_trace/tools/genapi.py
deleted file mode 100755
index 24034c1..0000000
--- a/opengl/libs/GLES_trace/tools/genapi.py
+++ /dev/null
@@ -1,408 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2011 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.
-#
-# ABOUT
-# This script is used to generate the trace implementations of all
-# OpenGL calls. When executed, it reads the specs for the OpenGL calls
-# from the files GLES2/gl2_api.in, GLES2/gl2ext_api.in, GLES_CM/gl_api.in,
-# and GLES_CM/glext_api.in, and generates trace versions for all the
-# defined functions.
-#
-# PREREQUISITES
-# To generate C++ files, this script uses the 'pyratemp' template
-# module. The only reason to use pyratemp is that it is extremly
-# simple to install:
-# $ wget http://www.simple-is-better.org/template/pyratemp-current/pyratemp.py
-# Put the file in the GLES_trace/tools folder, or update PYTHONPATH
-# to point to wherever it was downloaded.
-#
-# USAGE
-# $ cd GLES_trace - run the program from GLES2_trace folder
-# $ ./tools/genapi.py - generates a .cpp and .h file
-# $ mv *.cpp *.h src/ - move the generated files into the src folder
-
-import sys
-import re
-import pyratemp
-
-# Constants corresponding to the protobuf DataType.Type
-class DataType:
- def __init__(self, name):
- self.name = name
-
- def __str__(self):
- if self.name == "pointer": # pointers map to the INT DataType
- return "INT"
- return self.name.upper()
-
- def getProtobufCall(self):
- if self.name == "void":
- raise ValueError("Attempt to set void value")
- elif self.name == "char" or self.name == "byte" \
- or self.name == "pointer" or self.name == "enum":
- return "add_intvalue((int)"
- elif self.name == "int":
- return "add_intvalue("
- elif self.name == "float":
- return "add_floatvalue("
- elif self.name == "bool":
- return "add_boolvalue("
- else:
- raise ValueError("Unknown value type %s" % self.name)
-
-DataType.VOID = DataType("void")
-DataType.CHAR = DataType("char")
-DataType.BYTE = DataType("byte")
-DataType.ENUM = DataType("enum")
-DataType.BOOL = DataType("bool")
-DataType.INT = DataType("int")
-DataType.FLOAT = DataType("float")
-DataType.POINTER = DataType("pointer")
-
-# mapping of GL types to protobuf DataType
-GL2PROTOBUF_TYPE_MAP = {
- "GLvoid":DataType.VOID,
- "void":DataType.VOID,
- "GLchar":DataType.CHAR,
- "GLenum":DataType.ENUM,
- "GLboolean":DataType.BOOL,
- "GLbitfield":DataType.INT,
- "GLbyte":DataType.BYTE,
- "GLshort":DataType.INT,
- "GLint":DataType.INT,
- "int":DataType.INT,
- "GLsizei":DataType.INT,
- "GLubyte":DataType.BYTE,
- "GLushort":DataType.INT,
- "GLuint":DataType.INT,
- "GLfloat":DataType.FLOAT,
- "GLclampf":DataType.FLOAT,
- "GLfixed":DataType.INT,
- "GLclampx":DataType.INT,
- "GLsizeiptr":DataType.INT,
- "GLintptr":DataType.INT,
- "GLeglImageOES":DataType.POINTER,
-}
-
-API_SPECS = [
- ('GL2','../GLES2/gl2_api.in'),
- ('GL2Ext','../GLES2/gl2ext_api.in'),
- ('GL1','../GLES_CM/gl_api.in'),
- ('GL1Ext','../GLES_CM/glext_api.in'),
-]
-
-HEADER_LICENSE = """/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- *
- * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT.
- */
-"""
-
-HEADER_INCLUDES = """
-#include <cutils/log.h>
-#include <utils/Timers.h>
-#include <GLES2/gl2.h>
-
-#include "gltrace.pb.h"
-#include "gltrace_context.h"
-#include "gltrace_fixup.h"
-#include "gltrace_transport.h"
-"""
-
-HEADER_NAMESPACE_START = """
-namespace android {
-namespace gltrace {
-"""
-
-FOOTER_TEXT = """
-}; // namespace gltrace
-}; // namespace android
-"""
-
-TRACE_CALL_TEMPLATE = pyratemp.Template(
-"""$!retType!$ GLTrace_$!func!$($!inputArgList!$) {
- GLMessage glmsg;
- GLTraceContext *glContext = getGLTraceContext();
-
- glmsg.set_function(GLMessage::$!func!$);
-<!--(if len(parsedArgs) > 0)-->
- <!--(for argname, argtype in parsedArgs)-->
-
- // copy argument $!argname!$
- GLMessage_DataType *arg_$!argname!$ = glmsg.add_args();
- arg_$!argname!$->set_isarray(false);
- arg_$!argname!$->set_type(GLMessage::DataType::$!argtype!$);
- arg_$!argname!$->$!argtype.getProtobufCall()!$$!argname!$);
- <!--(end)-->
-<!--(end)-->
-
- // call function
- nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
- nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
-<!--(if retType != "void")-->
- $!retType!$ retValue = glContext->hooks->gl.$!callsite!$;
-<!--(else)-->
- glContext->hooks->gl.$!callsite!$;
-<!--(end)-->
- nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
- nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
-<!--(if retType != "void")-->
-
- // set return value
- GLMessage_DataType *rt = glmsg.mutable_returnvalue();
- rt->set_isarray(false);
- rt->set_type(GLMessage::DataType::$!retDataType!$);
- rt->$!retDataType.getProtobufCall()!$retValue);
-<!--(end)-->
-
- void *pointerArgs[] = {
-<!--(for argname, argtype in parsedArgs)-->
- <!--(if argtype == DataType.POINTER)-->
- (void *) $!argname!$,
- <!--(end)-->
-<!--(end)-->
-<!--(if retDataType == DataType.POINTER)-->
- (void *) retValue,
-<!--(end)-->
- };
-
- fixupGLMessage(glContext, wallStartTime, wallEndTime,
- threadStartTime, threadEndTime,
- &glmsg, pointerArgs);
- glContext->traceGLMessage(&glmsg);
-<!--(if retType != "void")-->
-
- return retValue;
-<!--(end)-->
-}
-""")
-
-def getDataTypeFromKw(kw):
- """ Get the data type given declaration.
- All pointer declarations are of type DataType.POINTER
-
- e.g.: GLvoid -> DataType.VOID"""
-
- if kw.count('*') > 0:
- return DataType.POINTER
- return GL2PROTOBUF_TYPE_MAP.get(kw)
-
-def getNameTypePair(decl):
- """ Split declaration of a variable to a tuple of (variable name, DataType).
- e.g. "const GLChar* varName" -> (varName, POINTER) """
- elements = decl.strip().split(' ')
- name = None
- if len(elements) > 1:
- name = " ".join(elements[-1:]).strip() # last element is the name
- dataType = " ".join(elements[:-1]).strip() # everything else is the data type
-
- # if name is a pointer (e.g. "*ptr"), then remove the "*" from the name
- # and add it to the data type
- pointersInName = name.count("*")
- if pointersInName > 0:
- name = name.replace("*", "")
- dataType += "*" * pointersInName
-
- # if name is an array (e.g. "array[10]"), then remove the "[X]" from the name
- # and make the datatype to be a pointer
- arraysInName = name.count("[")
- if arraysInName > 0:
- name = name.split('[')[0]
- dataType += "*"
- else:
- dataType = elements[0]
- return (name, getDataTypeFromKw(dataType))
-
-def parseArgs(arglist):
- """ Parse the argument list into a list of (var name, DataType) tuples """
- args = arglist.split(',')
- args = map(lambda x: x.strip(), args) # remove unnecessary whitespaces
- argtypelist = map(getNameTypePair, args) # split arg into arg type and arg name
- if len(argtypelist) == 1:
- (name, argtype) = argtypelist[0]
- if argtype == DataType.VOID:
- return []
-
- return argtypelist
-
-class ApiCall(object):
- """An ApiCall models all information about a single OpenGL API"""
-
- # Regex to match API_ENTRY specification:
- # e.g. void API_ENTRY(glActiveTexture)(GLenum texture) {
- # the regex uses a non greedy match (?) to match the first closing paren
- API_ENTRY_REGEX = "(.*)API_ENTRY\(.*?\)\((.*?)\)"
-
- # Regex to match CALL_GL_API specification:
- # e.g. CALL_GL_API(glCullFace, mode);
- # CALL_GL_API_RETURN(glCreateProgram);
- CALL_GL_API_REGEX = "CALL_GL_API(_RETURN)?\((.*)\);"
-
- def __init__(self, prefix, apientry, callsite):
- """Construct an ApiCall from its specification.
-
- The specification is provided by the two arguments:
- prefix: prefix to use for function names
- defn: specification line containing API_ENTRY macro
- e.g: void API_ENTRY(glActiveTexture)(GLenum texture) {
- callsite: specification line containing CALL_GL_API macro
- e.g: CALL_GL_API(glActiveTexture, texture);
- """
- self.prefix = prefix
- self.ret = self.getReturnType(apientry)
- self.arglist = self.getArgList(apientry)
-
- # some functions (e.g. __glEGLImageTargetRenderbufferStorageOES), define their
- # names one way in the API_ENTRY and another way in the CALL_GL_API macros.
- # so self.func is reassigned based on what is there in the call site
- self.func = self.getFunc(callsite)
- self.callsite = self.getCallSite(callsite)
-
- def getReturnType(self, apientry):
- '''Extract the return type from the API_ENTRY specification'''
- m = re.search(self.API_ENTRY_REGEX, apientry)
- if not m:
- raise ValueError("%s does not match API_ENTRY specification %s"
- % (apientry, self.API_ENTRY_REGEX))
-
- return m.group(1).strip()
-
- def getArgList(self, apientry):
- '''Extract the argument list from the API_ENTRY specification'''
- m = re.search(self.API_ENTRY_REGEX, apientry)
- if not m:
- raise ValueError("%s does not match API_ENTRY specification %s"
- % (apientry, self.API_ENTRY_REGEX))
-
- return m.group(2).strip()
-
- def parseCallSite(self, callsite):
- m = re.search(self.CALL_GL_API_REGEX, callsite)
- if not m:
- raise ValueError("%s does not match CALL_GL_API specification (%s)"
- % (callsite, self.CALL_GL_API_REGEX))
-
- arglist = m.group(2)
- args = arglist.split(',')
- args = map(lambda x: x.strip(), args)
-
- return args
-
- def getCallSite(self, callsite):
- '''Extract the callsite from the CALL_GL_API specification'''
- args = self.parseCallSite(callsite)
- return "%s(%s)" % (args[0], ", ".join(args[1:]))
-
- def getFunc(self, callsite):
- '''Extract the function name from the CALL_GL_API specification'''
- args = self.parseCallSite(callsite)
- return args[0]
-
- def genDeclaration(self):
- return "%s GLTrace_%s(%s);" % (self.ret, self.func, self.arglist)
-
- def genCode(self):
- return TRACE_CALL_TEMPLATE(func = self.func,
- retType = self.ret,
- retDataType = getDataTypeFromKw(self.ret),
- inputArgList = self.arglist,
- callsite = self.callsite,
- parsedArgs = parseArgs(self.arglist),
- DataType=DataType)
-
-def getApis(apiEntryFile, prefix):
- '''Get a list of all ApiCalls in provided specification file'''
- lines = open(apiEntryFile).readlines()
-
- apis = []
- for i in range(0, len(lines)/3):
- apis.append(ApiCall(prefix, lines[i*3], lines[i*3+1]))
-
- return apis
-
-def parseAllSpecs(specs):
- apis = []
- for name, specfile in specs:
- a = getApis(specfile, name)
- print 'Parsed %s APIs from %s, # of entries = %d' % (name, specfile, len(a))
- apis.extend(a)
- return apis
-
-def removeDuplicates(apis):
- '''Remove all duplicate function entries.
-
- The input list contains functions declared in GL1 and GL2 APIs.
- This will return a list that contains only the first function if there are
- multiple functions with the same name.'''
- uniqs = []
- funcs = set()
- for api in apis:
- if api.func not in funcs:
- uniqs.append(api)
- funcs.add(api.func)
-
- return uniqs
-
-def genHeaders(apis, fname):
- lines = []
- lines.append(HEADER_LICENSE)
- lines.append(HEADER_NAMESPACE_START)
- prefix = ""
- for api in apis:
- if prefix != api.prefix:
- lines.append("\n// Declarations for %s APIs\n\n" % api.prefix)
- prefix = api.prefix
- lines.append(api.genDeclaration())
- lines.append("\n")
- lines.append(FOOTER_TEXT)
-
- with open(fname, "w") as f:
- f.writelines(lines)
-
-def genSrcs(apis, fname):
- lines = []
- lines.append(HEADER_LICENSE)
- lines.append(HEADER_INCLUDES)
- lines.append(HEADER_NAMESPACE_START)
- prefix = ""
- for api in apis:
- if prefix != api.prefix:
- lines.append("\n// Definitions for %s APIs\n\n" % api.prefix)
- prefix = api.prefix
- lines.append(api.genCode())
- lines.append("\n")
- lines.append(FOOTER_TEXT)
-
- with open(fname, "w") as f:
- f.writelines(lines)
-
-if __name__ == '__main__':
- apis = parseAllSpecs(API_SPECS) # read in all the specfiles
- apis = removeDuplicates(apis) # remove duplication of functions common to GL1 and GL2
- genHeaders(apis, 'gltrace_api.h') # generate header file
- genSrcs(apis, 'gltrace_api.cpp') # generate source file
diff --git a/opengl/libs/GLES_trace/tools/testgenapi.py b/opengl/libs/GLES_trace/tools/testgenapi.py
deleted file mode 100644
index fe14954..0000000
--- a/opengl/libs/GLES_trace/tools/testgenapi.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2011 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.
-#
-# USAGE
-# $ cd GLES_trace/tools
-# $ python testgenapi.py
-
-import unittest
-from genapi import DataType, ApiCall, getApis, parseArgs
-
-class TestApiCall(unittest.TestCase):
- def test_parsing(self):
- apientry = 'void API_ENTRY(glCopyTexSubImage2D)(GLenum target, GLint level, ' \
- 'GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, ' \
- 'GLsizei height) {'
- callsite = 'CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y,' \
- 'width, height, border);'
-
- api = ApiCall("GL", apientry, callsite)
- self.assertEqual(api.func, "glCopyTexImage2D")
- self.assertEqual(api.callsite, 'glCopyTexImage2D(target, level, internalformat, ' \
- 'x, y, width, height, border)')
- self.assertEqual(api.ret, 'void')
- self.assertEqual(api.arglist, 'GLenum target, GLint level, ' \
- 'GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, ' \
- 'GLsizei height')
-
- def test_num_functions_parsed(self):
- gl2_apis = getApis('../../GLES2/gl2_api.in', 'GL2')
- gl2ext_apis = getApis('../../GLES2/gl2ext_api.in', 'GL2Ext')
- gl_apis = getApis('../../GLES_CM/gl_api.in', "GL1")
- glext_apis = getApis('../../GLES_CM/glext_api.in', 'GL1Ext')
-
- self.assertEqual(len(gl2_apis), 142)
- self.assertEqual(len(gl2ext_apis), 121)
- self.assertEqual(len(gl_apis), 145)
- self.assertEqual(len(glext_apis), 140)
-
- def test_parseArgs(self):
- args = parseArgs("void")
- self.assertEqual(len(args), 0)
-
- args = parseArgs("GLchar a")
- self.assertEqual(args, [("a", DataType.CHAR)])
-
- args = parseArgs("GLchar *a")
- self.assertEqual(args, [("a", DataType.POINTER)])
-
- args = parseArgs("GLint exponent[16]")
- self.assertEqual(args, [("exponent", DataType.POINTER)])
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/opengl/libs/debug.in b/opengl/libs/debug.in
deleted file mode 100644
index 882b2da..0000000
--- a/opengl/libs/debug.in
+++ /dev/null
@@ -1,235 +0,0 @@
-// the following functions are not defined in GLESv2_dbg
-TRACE_GL_VOID(glAlphaFunc, (GLenum func, GLclampf ref), (func, ref), 2, "GLenum", func, "GLclampf", ref)
-TRACE_GL_VOID(glAlphaFuncx, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref)
-TRACE_GL_VOID(glAlphaFuncxOES, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref)
-TRACE_GL_VOID(glBeginPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor)
-TRACE_GL_VOID(glBindFramebufferOES, (GLenum target, GLuint framebuffer), (target, framebuffer), 2, "GLenum", target, "GLuint", framebuffer)
-TRACE_GL_VOID(glBindRenderbufferOES, (GLenum target, GLuint renderbuffer), (target, renderbuffer), 2, "GLenum", target, "GLuint", renderbuffer)
-TRACE_GL_VOID(glBindVertexArrayOES, (GLuint array), (array), 1, "GLuint", array)
-TRACE_GL_VOID(glBlendEquationOES, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glBlendEquationSeparateOES, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha), 2, "GLenum", modeRGB, "GLenum", modeAlpha)
-TRACE_GL_VOID(glBlendFuncSeparateOES, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha), 4, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha)
-TRACE_GL(GLenum, glCheckFramebufferStatusOES, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha)
-TRACE_GL_VOID(glClearColorxOES, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha)
-TRACE_GL_VOID(glClearDepthfOES, (GLclampf depth), (depth), 1, "GLclampf", depth)
-TRACE_GL_VOID(glClearDepthx, (GLclampx depth), (depth), 1, "GLclampx", depth)
-TRACE_GL_VOID(glClearDepthxOES, (GLclampx depth), (depth), 1, "GLclampx", depth)
-TRACE_GL_VOID(glClientActiveTexture, (GLenum texture), (texture), 1, "GLenum", texture)
-TRACE_GL_VOID(glClipPlanef, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation)
-TRACE_GL_VOID(glClipPlanefIMG, (GLenum p, const GLfloat *eqn), (p, eqn), 2, "GLenum", p, "const GLfloat *", eqn)
-TRACE_GL_VOID(glClipPlanefOES, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation)
-TRACE_GL_VOID(glClipPlanex, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation)
-TRACE_GL_VOID(glClipPlanexIMG, (GLenum p, const GLfixed *eqn), (p, eqn), 2, "GLenum", p, "const GLfixed *", eqn)
-TRACE_GL_VOID(glClipPlanexOES, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation)
-TRACE_GL_VOID(glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha), 4, "GLfloat", red, "GLfloat", green, "GLfloat", blue, "GLfloat", alpha)
-TRACE_GL_VOID(glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha), 4, "GLubyte", red, "GLubyte", green, "GLubyte", blue, "GLubyte", alpha)
-TRACE_GL_VOID(glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha)
-TRACE_GL_VOID(glColor4xOES, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha)
-TRACE_GL_VOID(glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data), (target, level, internalformat, width, height, depth, border, imageSize, data), 9, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLsizei", imageSize, "const GLvoid*", data)
-TRACE_GL_VOID(glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLsizei", imageSize, "const GLvoid*", data)
-TRACE_GL_VOID(glCopyTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, zoffset, x, y, width, height), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glCoverageMaskNV, (GLboolean mask), (mask), 1, "GLboolean", mask)
-TRACE_GL_VOID(glCoverageOperationNV, (GLenum operation), (operation), 1, "GLenum", operation)
-TRACE_GL_VOID(glCurrentPaletteMatrixOES, (GLuint matrixpaletteindex), (matrixpaletteindex), 1, "GLuint", matrixpaletteindex)
-TRACE_GL_VOID(glDeleteFencesNV, (GLsizei n, const GLuint *fences), (n, fences), 2, "GLsizei", n, "const GLuint *", fences)
-TRACE_GL_VOID(glDeleteFramebuffersOES, (GLsizei n, const GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint*", framebuffers)
-TRACE_GL_VOID(glDeletePerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors)
-TRACE_GL_VOID(glDeleteRenderbuffersOES, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint*", renderbuffers)
-TRACE_GL_VOID(glDeleteVertexArraysOES, (GLsizei n, const GLuint *arrays), (n, arrays), 2, "GLsizei", n, "const GLuint *", arrays)
-TRACE_GL_VOID(glDepthRangefOES, (GLclampf zNear, GLclampf zFar), (zNear, zFar), 2, "GLclampf", zNear, "GLclampf", zFar)
-TRACE_GL_VOID(glDepthRangex, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar)
-TRACE_GL_VOID(glDepthRangexOES, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar)
-TRACE_GL_VOID(glDisableClientState, (GLenum array), (array), 1, "GLenum", array)
-TRACE_GL_VOID(glDisableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl)
-TRACE_GL_VOID(glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum *attachments), (target, numAttachments, attachments), 3, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments)
-TRACE_GL_VOID(glDrawTexfOES, (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), (x, y, z, width, height), 5, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", width, "GLfloat", height)
-TRACE_GL_VOID(glDrawTexfvOES, (const GLfloat *coords), (coords), 1, "const GLfloat *", coords)
-TRACE_GL_VOID(glDrawTexiOES, (GLint x, GLint y, GLint z, GLint width, GLint height), (x, y, z, width, height), 5, "GLint", x, "GLint", y, "GLint", z, "GLint", width, "GLint", height)
-TRACE_GL_VOID(glDrawTexivOES, (const GLint *coords), (coords), 1, "const GLint *", coords)
-TRACE_GL_VOID(glDrawTexsOES, (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), (x, y, z, width, height), 5, "GLshort", x, "GLshort", y, "GLshort", z, "GLshort", width, "GLshort", height)
-TRACE_GL_VOID(glDrawTexsvOES, (const GLshort *coords), (coords), 1, "const GLshort *", coords)
-TRACE_GL_VOID(glDrawTexxOES, (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), (x, y, z, width, height), 5, "GLfixed", x, "GLfixed", y, "GLfixed", z, "GLfixed", width, "GLfixed", height)
-TRACE_GL_VOID(glDrawTexxvOES, (const GLfixed *coords), (coords), 1, "const GLfixed *", coords)
-TRACE_GL_VOID(glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image)
-TRACE_GL_VOID(glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image)
-TRACE_GL_VOID(glEnableClientState, (GLenum array), (array), 1, "GLenum", array)
-TRACE_GL_VOID(glEnableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl)
-TRACE_GL_VOID(glEndPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor)
-TRACE_GL_VOID(glEndTilingQCOM, (GLbitfield preserveMask), (preserveMask), 1, "GLbitfield", preserveMask)
-TRACE_GL_VOID(glExtGetBufferPointervQCOM, (GLenum target, GLvoid **params), (target, params), 2, "GLenum", target, "GLvoid **", params)
-TRACE_GL_VOID(glExtGetBuffersQCOM, (GLuint *buffers, GLint maxBuffers, GLint *numBuffers), (buffers, maxBuffers, numBuffers), 3, "GLuint *", buffers, "GLint", maxBuffers, "GLint *", numBuffers)
-TRACE_GL_VOID(glExtGetFramebuffersQCOM, (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers), (framebuffers, maxFramebuffers, numFramebuffers), 3, "GLuint *", framebuffers, "GLint", maxFramebuffers, "GLint *", numFramebuffers)
-TRACE_GL_VOID(glExtGetProgramBinarySourceQCOM, (GLuint program, GLenum shadertype, GLchar *source, GLint *length), (program, shadertype, source, length), 4, "GLuint", program, "GLenum", shadertype, "GLchar *", source, "GLint *", length)
-TRACE_GL_VOID(glExtGetProgramsQCOM, (GLuint *programs, GLint maxPrograms, GLint *numPrograms), (programs, maxPrograms, numPrograms), 3, "GLuint *", programs, "GLint", maxPrograms, "GLint *", numPrograms)
-TRACE_GL_VOID(glExtGetRenderbuffersQCOM, (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers), (renderbuffers, maxRenderbuffers, numRenderbuffers), 3, "GLuint *", renderbuffers, "GLint", maxRenderbuffers, "GLint *", numRenderbuffers)
-TRACE_GL_VOID(glExtGetShadersQCOM, (GLuint *shaders, GLint maxShaders, GLint *numShaders), (shaders, maxShaders, numShaders), 3, "GLuint *", shaders, "GLint", maxShaders, "GLint *", numShaders)
-TRACE_GL_VOID(glExtGetTexLevelParameterivQCOM, (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params), (texture, face, level, pname, params), 5, "GLuint", texture, "GLenum", face, "GLint", level, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glExtGetTexSubImageQCOM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "GLvoid *", texels)
-TRACE_GL_VOID(glExtGetTexturesQCOM, (GLuint *textures, GLint maxTextures, GLint *numTextures), (textures, maxTextures, numTextures), 3, "GLuint *", textures, "GLint", maxTextures, "GLint *", numTextures)
-TRACE_GL(GLboolean, glExtIsProgramBinaryQCOM, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL_VOID(glExtTexObjectStateOverrideiQCOM, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glFinishFenceNV, (GLuint fence), (fence), 1, "GLuint", fence)
-TRACE_GL_VOID(glFogf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glFogfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glFogx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glFogxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glFogxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glFogxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glFramebufferRenderbufferOES, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer), 4, "GLenum", target, "GLenum", attachment, "GLenum", renderbuffertarget, "GLuint", renderbuffer)
-TRACE_GL_VOID(glFramebufferTexture2DMultisampleIMG, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples), (target, attachment, textarget, texture, level, samples), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLsizei", samples)
-TRACE_GL_VOID(glFramebufferTexture2DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level), 5, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level)
-TRACE_GL_VOID(glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset), (target, attachment, textarget, texture, level, zoffset), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLint", zoffset)
-TRACE_GL_VOID(glFrustumf, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glFrustumfOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glFrustumxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glGenFencesNV, (GLsizei n, GLuint *fences), (n, fences), 2, "GLsizei", n, "GLuint *", fences)
-TRACE_GL_VOID(glGenFramebuffersOES, (GLsizei n, GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint*", framebuffers)
-TRACE_GL_VOID(glGenPerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors)
-TRACE_GL_VOID(glGenRenderbuffersOES, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint*", renderbuffers)
-TRACE_GL_VOID(glGenVertexArraysOES, (GLsizei n, GLuint *arrays), (n, arrays), 2, "GLsizei", n, "GLuint *", arrays)
-TRACE_GL_VOID(glGenerateMipmapOES, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params)
-TRACE_GL_VOID(glGetClipPlanef, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn)
-TRACE_GL_VOID(glGetClipPlanefOES, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn)
-TRACE_GL_VOID(glGetClipPlanex, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn)
-TRACE_GL_VOID(glGetClipPlanexOES, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn)
-TRACE_GL_VOID(glGetDriverControlStringQCOM, (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString), (driverControl, bufSize, length, driverControlString), 4, "GLuint", driverControl, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", driverControlString)
-TRACE_GL_VOID(glGetDriverControlsQCOM, (GLint *num, GLsizei size, GLuint *driverControls), (num, size, driverControls), 3, "GLint *", num, "GLsizei", size, "GLuint *", driverControls)
-TRACE_GL_VOID(glGetFenceivNV, (GLuint fence, GLenum pname, GLint *params), (fence, pname, params), 3, "GLuint", fence, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetFixedv, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetFixedvOES, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetFramebufferAttachmentParameterivOES, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetLightfv, (GLenum light, GLenum pname, GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetLightxv, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetLightxvOES, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetMaterialxv, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetMaterialxvOES, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetPerfMonitorCounterDataAMD, (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten), (monitor, pname, dataSize, data, bytesWritten), 5, "GLuint", monitor, "GLenum", pname, "GLsizei", dataSize, "GLuint *", data, "GLint *", bytesWritten)
-TRACE_GL_VOID(glGetPerfMonitorCounterInfoAMD, (GLuint group, GLuint counter, GLenum pname, GLvoid *data), (group, counter, pname, data), 4, "GLuint", group, "GLuint", counter, "GLenum", pname, "GLvoid *", data)
-TRACE_GL_VOID(glGetPerfMonitorCounterStringAMD, (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString), (group, counter, bufSize, length, counterString), 5, "GLuint", group, "GLuint", counter, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", counterString)
-TRACE_GL_VOID(glGetPerfMonitorCountersAMD, (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters), (group, numCounters, maxActiveCounters, counterSize, counters), 5, "GLuint", group, "GLint *", numCounters, "GLint *", maxActiveCounters, "GLsizei", counterSize, "GLuint *", counters)
-TRACE_GL_VOID(glGetPerfMonitorGroupStringAMD, (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString), (group, bufSize, length, groupString), 4, "GLuint", group, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", groupString)
-TRACE_GL_VOID(glGetPerfMonitorGroupsAMD, (GLint *numGroups, GLsizei groupsSize, GLuint *groups), (numGroups, groupsSize, groups), 3, "GLint *", numGroups, "GLsizei", groupsSize, "GLuint *", groups)
-TRACE_GL_VOID(glGetPointerv, (GLenum pname, GLvoid **params), (pname, params), 2, "GLenum", pname, "GLvoid **", params)
-TRACE_GL_VOID(glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary), (program, bufSize, length, binaryFormat, binary), 5, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLenum *", binaryFormat, "GLvoid *", binary)
-TRACE_GL_VOID(glGetRenderbufferParameterivOES, (GLenum target, GLenum pname, GLint* params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetTexEnvfv, (GLenum env, GLenum pname, GLfloat *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetTexEnviv, (GLenum env, GLenum pname, GLint *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetTexEnvxv, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexEnvxvOES, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexGenfvOES, (GLenum coord, GLenum pname, GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetTexGenivOES, (GLenum coord, GLenum pname, GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetTexGenxvOES, (GLenum coord, GLenum pname, GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
-TRACE_GL(GLboolean, glIsFenceNV, (GLuint fence), (fence), 1, "GLuint", fence)
-TRACE_GL(GLboolean, glIsFramebufferOES, (GLuint framebuffer), (framebuffer), 1, "GLuint", framebuffer)
-TRACE_GL(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer), (renderbuffer), 1, "GLuint", renderbuffer)
-TRACE_GL(GLboolean, glIsVertexArrayOES, (GLuint array), (array), 1, "GLuint", array)
-TRACE_GL_VOID(glLightModelf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glLightModelfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glLightModelx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightModelxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightModelxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLightModelxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLightf, (GLenum light, GLenum pname, GLfloat param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glLightfv, (GLenum light, GLenum pname, const GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glLightx, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightxOES, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightxv, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLightxvOES, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLineWidthx, (GLfixed width), (width), 1, "GLfixed", width)
-TRACE_GL_VOID(glLineWidthxOES, (GLfixed width), (width), 1, "GLfixed", width)
-TRACE_GL_VOID(glLoadIdentity, (void), (), 0)
-TRACE_GL_VOID(glLoadMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m)
-TRACE_GL_VOID(glLoadMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glLoadMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glLoadPaletteFromModelViewMatrixOES, (void), (), 0)
-TRACE_GL_VOID(glLogicOp, (GLenum opcode), (opcode), 1, "GLenum", opcode)
-TRACE_GL(void*, glMapBufferOES, (GLenum target, GLenum access), (target, access), 2, "GLenum", target, "GLenum", access)
-TRACE_GL_VOID(glMaterialf, (GLenum face, GLenum pname, GLfloat param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glMaterialx, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glMaterialxOES, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glMaterialxvOES, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glMatrixIndexPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glMatrixMode, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glMultMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m)
-TRACE_GL_VOID(glMultMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glMultMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glMultiDrawArraysEXT, (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "GLint *", first, "GLsizei *", count, "GLsizei", primcount)
-TRACE_GL_VOID(glMultiDrawElementsEXT, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "const GLsizei *", count, "GLenum", type, "const GLvoid* *", indices, "GLsizei", primcount)
-TRACE_GL_VOID(glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), (target, s, t, r, q), 5, "GLenum", target, "GLfloat", s, "GLfloat", t, "GLfloat", r, "GLfloat", q)
-TRACE_GL_VOID(glMultiTexCoord4x, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q)
-TRACE_GL_VOID(glMultiTexCoord4xOES, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q)
-TRACE_GL_VOID(glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz), 3, "GLfloat", nx, "GLfloat", ny, "GLfloat", nz)
-TRACE_GL_VOID(glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz)
-TRACE_GL_VOID(glNormal3xOES, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz)
-TRACE_GL_VOID(glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glOrthofOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glOrthox, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glOrthoxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glPointParameterf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glPointParameterfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glPointParameterx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glPointParameterxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glPointParameterxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glPointParameterxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glPointSize, (GLfloat size), (size), 1, "GLfloat", size)
-TRACE_GL_VOID(glPointSizePointerOES, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glPointSizex, (GLfixed size), (size), 1, "GLfixed", size)
-TRACE_GL_VOID(glPointSizexOES, (GLfixed size), (size), 1, "GLfixed", size)
-TRACE_GL_VOID(glPolygonOffsetx, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units)
-TRACE_GL_VOID(glPolygonOffsetxOES, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units)
-TRACE_GL_VOID(glPopMatrix, (void), (), 0)
-TRACE_GL_VOID(glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length), (program, binaryFormat, binary, length), 4, "GLuint", program, "GLenum", binaryFormat, "const GLvoid *", binary, "GLint", length)
-TRACE_GL_VOID(glPushMatrix, (void), (), 0)
-TRACE_GL(GLbitfield, glQueryMatrixxOES, (GLfixed mantissa[16], GLint exponent[16]), (mantissa, exponent), 2, "GLfixed", mantissa, "GLint", exponent)
-TRACE_GL_VOID(glRenderbufferStorageMultisampleIMG, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRenderbufferStorageOES, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height), 4, "GLenum", target, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z), 4, "GLfloat", angle, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glRotatexOES, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glSampleCoveragex, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert)
-TRACE_GL_VOID(glSampleCoveragexOES, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert)
-TRACE_GL_VOID(glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glScalex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glScalexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glSelectPerfMonitorCountersAMD, (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList), (monitor, enable, group, numCounters, countersList), 5, "GLuint", monitor, "GLboolean", enable, "GLuint", group, "GLint", numCounters, "GLuint *", countersList)
-TRACE_GL_VOID(glSetFenceNV, (GLuint fence, GLenum condition), (fence, condition), 2, "GLuint", fence, "GLenum", condition)
-TRACE_GL_VOID(glShadeModel, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glStartTilingQCOM, (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask), (x, y, width, height, preserveMask), 5, "GLuint", x, "GLuint", y, "GLuint", width, "GLuint", height, "GLbitfield", preserveMask)
-TRACE_GL(GLboolean, glTestFenceNV, (GLuint fence), (fence), 1, "GLuint", fence)
-TRACE_GL_VOID(glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glTexEnviv, (GLenum target, GLenum pname, const GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params)
-TRACE_GL_VOID(glTexEnvx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexEnvxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexEnvxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexEnvxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexGenfOES, (GLenum coord, GLenum pname, GLfloat param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glTexGenfvOES, (GLenum coord, GLenum pname, const GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glTexGeniOES, (GLenum coord, GLenum pname, GLint param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glTexGenivOES, (GLenum coord, GLenum pname, const GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLint *", params)
-TRACE_GL_VOID(glTexGenxOES, (GLenum coord, GLenum pname, GLfixed param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexGenxvOES, (GLenum coord, GLenum pname, const GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels), (target, level, internalformat, width, height, depth, border, format, type, pixels), 10, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLenum", format, "GLenum", type, "const GLvoid*", pixels)
-TRACE_GL_VOID(glTexParameterx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexParameterxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexParameterxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexParameterxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "const GLvoid*", pixels)
-TRACE_GL_VOID(glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glTranslatex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glTranslatexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL(GLboolean, glUnmapBufferOES, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glWeightPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
diff --git a/opengl/libs/egl_impl.h b/opengl/libs/egl_impl.h
deleted file mode 100644
index cb0e908..0000000
--- a/opengl/libs/egl_impl.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_EGL_IMPL_H
-#define ANDROID_EGL_IMPL_H
-
-#include <ctype.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <EGL/eglplatform.h>
-
-#include "hooks.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name);
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_EGL_IMPL_H */
diff --git a/opengl/libs/entries.in b/opengl/libs/entries.in
deleted file mode 100644
index 6316d78..0000000
--- a/opengl/libs/entries.in
+++ /dev/null
@@ -1,437 +0,0 @@
-GL_ENTRY(void, glActiveShaderProgramEXT, GLuint pipeline, GLuint program)
-GL_ENTRY(void, glActiveTexture, GLenum texture)
-GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref)
-GL_ENTRY(void, glAlphaFuncQCOM, GLenum func, GLclampf ref)
-GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref)
-GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref)
-GL_ENTRY(void, glAttachShader, GLuint program, GLuint shader)
-GL_ENTRY(void, glBeginPerfMonitorAMD, GLuint monitor)
-GL_ENTRY(void, glBeginQueryEXT, GLenum target, GLuint id)
-GL_ENTRY(void, glBindAttribLocation, GLuint program, GLuint index, const GLchar* name)
-GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer)
-GL_ENTRY(void, glBindFramebuffer, GLenum target, GLuint framebuffer)
-GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer)
-GL_ENTRY(void, glBindProgramPipelineEXT, GLuint pipeline)
-GL_ENTRY(void, glBindRenderbuffer, GLenum target, GLuint renderbuffer)
-GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer)
-GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture)
-GL_ENTRY(void, glBindVertexArrayOES, GLuint array)
-GL_ENTRY(void, glBlendColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-GL_ENTRY(void, glBlendEquation, GLenum mode )
-GL_ENTRY(void, glBlendEquationOES, GLenum mode)
-GL_ENTRY(void, glBlendEquationSeparate, GLenum modeRGB, GLenum modeAlpha)
-GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha)
-GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
-GL_ENTRY(void, glBlendFuncSeparate, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-GL_ENTRY(void, glBlitFramebufferANGLE, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-GL_ENTRY(GLenum, glCheckFramebufferStatus, GLenum target)
-GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target)
-GL_ENTRY(void, glClear, GLbitfield mask)
-GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-GL_ENTRY(void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-GL_ENTRY(void, glClearDepthf, GLclampf depth)
-GL_ENTRY(void, glClearDepthfOES, GLclampf depth)
-GL_ENTRY(void, glClearDepthx, GLclampx depth)
-GL_ENTRY(void, glClearDepthxOES, GLclampx depth)
-GL_ENTRY(void, glClearStencil, GLint s)
-GL_ENTRY(void, glClientActiveTexture, GLenum texture)
-GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat *equation)
-GL_ENTRY(void, glClipPlanefIMG, GLenum p, const GLfloat *eqn)
-GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation)
-GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed *equation)
-GL_ENTRY(void, glClipPlanexIMG, GLenum p, const GLfixed *eqn)
-GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed *equation)
-GL_ENTRY(void, glColor4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-GL_ENTRY(void, glColor4ub, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-GL_ENTRY(void, glColor4x, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-GL_ENTRY(void, glCompileShader, GLuint shader)
-GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-GL_ENTRY(void, glCompressedTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
-GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-GL_ENTRY(void, glCompressedTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
-GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-GL_ENTRY(void, glCopyTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-GL_ENTRY(void, glCoverageMaskNV, GLboolean mask)
-GL_ENTRY(void, glCoverageOperationNV, GLenum operation)
-GL_ENTRY(GLuint, glCreateProgram, void)
-GL_ENTRY(GLuint, glCreateShader, GLenum type)
-GL_ENTRY(GLuint, glCreateShaderProgramvEXT, GLenum type, GLsizei count, const GLchar **strings)
-GL_ENTRY(void, glCullFace, GLenum mode)
-GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex)
-GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint *buffers)
-GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint *fences)
-GL_ENTRY(void, glDeleteFramebuffers, GLsizei n, const GLuint* framebuffers)
-GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers)
-GL_ENTRY(void, glDeletePerfMonitorsAMD, GLsizei n, GLuint *monitors)
-GL_ENTRY(void, glDeleteProgram, GLuint program)
-GL_ENTRY(void, glDeleteProgramPipelinesEXT, GLsizei n, const GLuint *pipelines)
-GL_ENTRY(void, glDeleteQueriesEXT, GLsizei n, const GLuint *ids)
-GL_ENTRY(void, glDeleteRenderbuffers, GLsizei n, const GLuint* renderbuffers)
-GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers)
-GL_ENTRY(void, glDeleteShader, GLuint shader)
-GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *textures)
-GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint *arrays)
-GL_ENTRY(void, glDepthFunc, GLenum func)
-GL_ENTRY(void, glDepthMask, GLboolean flag)
-GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
-GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar)
-GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar)
-GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar)
-GL_ENTRY(void, glDetachShader, GLuint program, GLuint shader)
-GL_ENTRY(void, glDisable, GLenum cap)
-GL_ENTRY(void, glDisableClientState, GLenum array)
-GL_ENTRY(void, glDisableDriverControlQCOM, GLuint driverControl)
-GL_ENTRY(void, glDisableVertexAttribArray, GLuint index)
-GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum *attachments)
-GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count)
-GL_ENTRY(void, glDrawBuffersNV, GLsizei n, const GLenum *bufs)
-GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
-GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords)
-GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height)
-GL_ENTRY(void, glDrawTexivOES, const GLint *coords)
-GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
-GL_ENTRY(void, glDrawTexsvOES, const GLshort *coords)
-GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
-GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords)
-GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image)
-GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image)
-GL_ENTRY(void, glEnable, GLenum cap)
-GL_ENTRY(void, glEnableClientState, GLenum array)
-GL_ENTRY(void, glEnableDriverControlQCOM, GLuint driverControl)
-GL_ENTRY(void, glEnableVertexAttribArray, GLuint index)
-GL_ENTRY(void, glEndPerfMonitorAMD, GLuint monitor)
-GL_ENTRY(void, glEndQueryEXT, GLenum target)
-GL_ENTRY(void, glEndTilingQCOM, GLbitfield preserveMask)
-GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, GLvoid **params)
-GL_ENTRY(void, glExtGetBuffersQCOM, GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
-GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
-GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar *source, GLint *length)
-GL_ENTRY(void, glExtGetProgramsQCOM, GLuint *programs, GLint maxPrograms, GLint *numPrograms)
-GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers)
-GL_ENTRY(void, glExtGetShadersQCOM, GLuint *shaders, GLint maxShaders, GLint *numShaders)
-GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
-GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
-GL_ENTRY(void, glExtGetTexturesQCOM, GLuint *textures, GLint maxTextures, GLint *numTextures)
-GL_ENTRY(GLboolean, glExtIsProgramBinaryQCOM, GLuint program)
-GL_ENTRY(void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param)
-GL_ENTRY(void, glFinish, void)
-GL_ENTRY(void, glFinishFenceNV, GLuint fence)
-GL_ENTRY(void, glFlush, void)
-GL_ENTRY(void, glFogf, GLenum pname, GLfloat param)
-GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glFogx, GLenum pname, GLfixed param)
-GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param)
-GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glFramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-GL_ENTRY(void, glFramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-GL_ENTRY(void, glFramebufferTexture2DMultisampleEXT, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
-GL_ENTRY(void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
-GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-GL_ENTRY(void, glFramebufferTexture3DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-GL_ENTRY(void, glFrontFace, GLenum mode)
-GL_ENTRY(void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-GL_ENTRY(void, glFrustumx, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint *buffers)
-GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint *fences)
-GL_ENTRY(void, glGenFramebuffers, GLsizei n, GLuint* framebuffers)
-GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers)
-GL_ENTRY(void, glGenPerfMonitorsAMD, GLsizei n, GLuint *monitors)
-GL_ENTRY(void, glGenProgramPipelinesEXT, GLsizei n, GLuint *pipelines)
-GL_ENTRY(void, glGenQueriesEXT, GLsizei n, GLuint *ids)
-GL_ENTRY(void, glGenRenderbuffers, GLsizei n, GLuint* renderbuffers)
-GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers)
-GL_ENTRY(void, glGenTextures, GLsizei n, GLuint *textures)
-GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint *arrays)
-GL_ENTRY(void, glGenerateMipmap, GLenum target)
-GL_ENTRY(void, glGenerateMipmapOES, GLenum target)
-GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name)
-GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params)
-GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid ** params)
-GL_ENTRY(void, glGetClipPlanef, GLenum pname, GLfloat eqn[4])
-GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat eqn[4])
-GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed eqn[4])
-GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed eqn[4])
-GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
-GL_ENTRY(void, glGetDriverControlsQCOM, GLint *num, GLsizei size, GLuint *driverControls)
-GL_ENTRY(GLenum, glGetError, void)
-GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat *params)
-GL_ENTRY(void, glGetFramebufferAttachmentParameteriv, GLenum target, GLenum attachment, GLenum pname, GLint* params)
-GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params)
-GL_ENTRY(GLenum, glGetGraphicsResetStatusEXT, void)
-GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat *params)
-GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat *params)
-GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetObjectLabelEXT, GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label)
-GL_ENTRY(void, glGetPerfMonitorCounterDataAMD, GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten)
-GL_ENTRY(void, glGetPerfMonitorCounterInfoAMD, GLuint group, GLuint counter, GLenum pname, GLvoid *data)
-GL_ENTRY(void, glGetPerfMonitorCounterStringAMD, GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString)
-GL_ENTRY(void, glGetPerfMonitorCountersAMD, GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters)
-GL_ENTRY(void, glGetPerfMonitorGroupStringAMD, GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString)
-GL_ENTRY(void, glGetPerfMonitorGroupsAMD, GLint *numGroups, GLsizei groupsSize, GLuint *groups)
-GL_ENTRY(void, glGetPointerv, GLenum pname, GLvoid **params)
-GL_ENTRY(void, glGetProgramBinaryOES, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-GL_ENTRY(void, glGetProgramInfoLog, GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-GL_ENTRY(void, glGetProgramPipelineInfoLogEXT, GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-GL_ENTRY(void, glGetProgramPipelineivEXT, GLuint pipeline, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetProgramiv, GLuint program, GLenum pname, GLint* params)
-GL_ENTRY(void, glGetQueryObjectuivEXT, GLuint id, GLenum pname, GLuint *params)
-GL_ENTRY(void, glGetQueryivEXT, GLenum target, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetRenderbufferParameteriv, GLenum target, GLenum pname, GLint* params)
-GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params)
-GL_ENTRY(void, glGetShaderInfoLog, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-GL_ENTRY(void, glGetShaderPrecisionFormat, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-GL_ENTRY(void, glGetShaderSource, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-GL_ENTRY(void, glGetShaderiv, GLuint shader, GLenum pname, GLint* params)
-GL_ENTRY(const GLubyte *, glGetString, GLenum name)
-GL_ENTRY(void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat *params)
-GL_ENTRY(void, glGetTexEnviv, GLenum env, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params)
-GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params)
-GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params)
-GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params)
-GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
-GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name)
-GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params)
-GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params)
-GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer)
-GL_ENTRY(void, glGetVertexAttribfv, GLuint index, GLenum pname, GLfloat* params)
-GL_ENTRY(void, glGetVertexAttribiv, GLuint index, GLenum pname, GLint* params)
-GL_ENTRY(void, glGetnUniformfvEXT, GLuint program, GLint location, GLsizei bufSize, float *params)
-GL_ENTRY(void, glGetnUniformivEXT, GLuint program, GLint location, GLsizei bufSize, GLint *params)
-GL_ENTRY(void, glHint, GLenum target, GLenum mode)
-GL_ENTRY(void, glInsertEventMarkerEXT, GLsizei length, const GLchar *marker)
-GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer)
-GL_ENTRY(GLboolean, glIsEnabled, GLenum cap)
-GL_ENTRY(GLboolean, glIsFenceNV, GLuint fence)
-GL_ENTRY(GLboolean, glIsFramebuffer, GLuint framebuffer)
-GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer)
-GL_ENTRY(GLboolean, glIsProgram, GLuint program)
-GL_ENTRY(GLboolean, glIsProgramPipelineEXT, GLuint pipeline)
-GL_ENTRY(GLboolean, glIsQueryEXT, GLuint id)
-GL_ENTRY(GLboolean, glIsRenderbuffer, GLuint renderbuffer)
-GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer)
-GL_ENTRY(GLboolean, glIsShader, GLuint shader)
-GL_ENTRY(GLboolean, glIsTexture, GLuint texture)
-GL_ENTRY(GLboolean, glIsVertexArrayOES, GLuint array)
-GL_ENTRY(void, glLabelObjectEXT, GLenum type, GLuint object, GLsizei length, const GLchar *label)
-GL_ENTRY(void, glLightModelf, GLenum pname, GLfloat param)
-GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glLightModelx, GLenum pname, GLfixed param)
-GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param)
-GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glLightf, GLenum light, GLenum pname, GLfloat param)
-GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glLightx, GLenum light, GLenum pname, GLfixed param)
-GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param)
-GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glLineWidth, GLfloat width)
-GL_ENTRY(void, glLineWidthx, GLfixed width)
-GL_ENTRY(void, glLineWidthxOES, GLfixed width)
-GL_ENTRY(void, glLinkProgram, GLuint program)
-GL_ENTRY(void, glLoadIdentity, void)
-GL_ENTRY(void, glLoadMatrixf, const GLfloat *m)
-GL_ENTRY(void, glLoadMatrixx, const GLfixed *m)
-GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m)
-GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void)
-GL_ENTRY(void, glLogicOp, GLenum opcode)
-GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access)
-GL_ENTRY(void, glMaterialf, GLenum face, GLenum pname, GLfloat param)
-GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glMaterialx, GLenum face, GLenum pname, GLfixed param)
-GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param)
-GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-GL_ENTRY(void, glMatrixMode, GLenum mode)
-GL_ENTRY(void, glMultMatrixf, const GLfloat *m)
-GL_ENTRY(void, glMultMatrixx, const GLfixed *m)
-GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m)
-GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
-GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount)
-GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-GL_ENTRY(void, glMultiTexCoord4x, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-GL_ENTRY(void, glNormal3f, GLfloat nx, GLfloat ny, GLfloat nz)
-GL_ENTRY(void, glNormal3x, GLfixed nx, GLfixed ny, GLfixed nz)
-GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz)
-GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const GLvoid *pointer)
-GL_ENTRY(void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-GL_ENTRY(void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param)
-GL_ENTRY(void, glPointParameterf, GLenum pname, GLfloat param)
-GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glPointParameterx, GLenum pname, GLfixed param)
-GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param)
-GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glPointSize, GLfloat size)
-GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid *pointer)
-GL_ENTRY(void, glPointSizex, GLfixed size)
-GL_ENTRY(void, glPointSizexOES, GLfixed size)
-GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
-GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units)
-GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units)
-GL_ENTRY(void, glPopGroupMarkerEXT, void)
-GL_ENTRY(void, glPopMatrix, void)
-GL_ENTRY(void, glProgramBinaryOES, GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length)
-GL_ENTRY(void, glProgramParameteriEXT, GLuint program, GLenum pname, GLint value)
-GL_ENTRY(void, glProgramUniform1fEXT, GLuint program, GLint location, GLfloat x)
-GL_ENTRY(void, glProgramUniform1fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value)
-GL_ENTRY(void, glProgramUniform1iEXT, GLuint program, GLint location, GLint x)
-GL_ENTRY(void, glProgramUniform1ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value)
-GL_ENTRY(void, glProgramUniform2fEXT, GLuint program, GLint location, GLfloat x, GLfloat y)
-GL_ENTRY(void, glProgramUniform2fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value)
-GL_ENTRY(void, glProgramUniform2iEXT, GLuint program, GLint location, GLint x, GLint y)
-GL_ENTRY(void, glProgramUniform2ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value)
-GL_ENTRY(void, glProgramUniform3fEXT, GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
-GL_ENTRY(void, glProgramUniform3fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value)
-GL_ENTRY(void, glProgramUniform3iEXT, GLuint program, GLint location, GLint x, GLint y, GLint z)
-GL_ENTRY(void, glProgramUniform3ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value)
-GL_ENTRY(void, glProgramUniform4fEXT, GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-GL_ENTRY(void, glProgramUniform4fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value)
-GL_ENTRY(void, glProgramUniform4iEXT, GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
-GL_ENTRY(void, glProgramUniform4ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value)
-GL_ENTRY(void, glProgramUniformMatrix2fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-GL_ENTRY(void, glProgramUniformMatrix3fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-GL_ENTRY(void, glProgramUniformMatrix4fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-GL_ENTRY(void, glPushGroupMarkerEXT, GLsizei length, const GLchar *marker)
-GL_ENTRY(void, glPushMatrix, void)
-GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed mantissa[16], GLint exponent[16])
-GL_ENTRY(void, glReadBufferNV, GLenum mode)
-GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-GL_ENTRY(void, glReadnPixelsEXT, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data)
-GL_ENTRY(void, glReleaseShaderCompiler, void)
-GL_ENTRY(void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glRenderbufferStorageMultisampleANGLE, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glRenderbufferStorageMultisampleAPPLE, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glRenderbufferStorageMultisampleEXT, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glResolveMultisampleFramebufferAPPLE, void)
-GL_ENTRY(void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-GL_ENTRY(void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
-GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert)
-GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert)
-GL_ENTRY(void, glScalef, GLfloat x, GLfloat y, GLfloat z)
-GL_ENTRY(void, glScalex, GLfixed x, GLfixed y, GLfixed z)
-GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z)
-GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
-GL_ENTRY(void, glSelectPerfMonitorCountersAMD, GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList)
-GL_ENTRY(void, glSetFenceNV, GLuint fence, GLenum condition)
-GL_ENTRY(void, glShadeModel, GLenum mode)
-GL_ENTRY(void, glShaderBinary, GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-GL_ENTRY(void, glShaderSource, GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
-GL_ENTRY(void, glStartTilingQCOM, GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
-GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
-GL_ENTRY(void, glStencilFuncSeparate, GLenum face, GLenum func, GLint ref, GLuint mask)
-GL_ENTRY(void, glStencilMask, GLuint mask)
-GL_ENTRY(void, glStencilMaskSeparate, GLenum face, GLuint mask)
-GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
-GL_ENTRY(void, glStencilOpSeparate, GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-GL_ENTRY(GLboolean, glTestFenceNV, GLuint fence)
-GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-GL_ENTRY(void, glTexEnvf, GLenum target, GLenum pname, GLfloat param)
-GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glTexEnvi, GLenum target, GLenum pname, GLint param)
-GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint *params)
-GL_ENTRY(void, glTexEnvx, GLenum target, GLenum pname, GLfixed param)
-GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param)
-GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param)
-GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param)
-GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params)
-GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param)
-GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-GL_ENTRY(void, glTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param)
-GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat *params)
-GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param)
-GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint *params)
-GL_ENTRY(void, glTexParameterx, GLenum target, GLenum pname, GLfixed param)
-GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param)
-GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params)
-GL_ENTRY(void, glTexStorage1DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-GL_ENTRY(void, glTexStorage2DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glTexStorage3DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-GL_ENTRY(void, glTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
-GL_ENTRY(void, glTextureStorage1DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-GL_ENTRY(void, glTextureStorage2DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-GL_ENTRY(void, glTextureStorage3DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-GL_ENTRY(void, glTranslatef, GLfloat x, GLfloat y, GLfloat z)
-GL_ENTRY(void, glTranslatex, GLfixed x, GLfixed y, GLfixed z)
-GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z)
-GL_ENTRY(void, glUniform1f, GLint location, GLfloat x)
-GL_ENTRY(void, glUniform1fv, GLint location, GLsizei count, const GLfloat* v)
-GL_ENTRY(void, glUniform1i, GLint location, GLint x)
-GL_ENTRY(void, glUniform1iv, GLint location, GLsizei count, const GLint* v)
-GL_ENTRY(void, glUniform2f, GLint location, GLfloat x, GLfloat y)
-GL_ENTRY(void, glUniform2fv, GLint location, GLsizei count, const GLfloat* v)
-GL_ENTRY(void, glUniform2i, GLint location, GLint x, GLint y)
-GL_ENTRY(void, glUniform2iv, GLint location, GLsizei count, const GLint* v)
-GL_ENTRY(void, glUniform3f, GLint location, GLfloat x, GLfloat y, GLfloat z)
-GL_ENTRY(void, glUniform3fv, GLint location, GLsizei count, const GLfloat* v)
-GL_ENTRY(void, glUniform3i, GLint location, GLint x, GLint y, GLint z)
-GL_ENTRY(void, glUniform3iv, GLint location, GLsizei count, const GLint* v)
-GL_ENTRY(void, glUniform4f, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-GL_ENTRY(void, glUniform4fv, GLint location, GLsizei count, const GLfloat* v)
-GL_ENTRY(void, glUniform4i, GLint location, GLint x, GLint y, GLint z, GLint w)
-GL_ENTRY(void, glUniform4iv, GLint location, GLsizei count, const GLint* v)
-GL_ENTRY(void, glUniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-GL_ENTRY(void, glUniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-GL_ENTRY(void, glUniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target)
-GL_ENTRY(void, glUseProgram, GLuint program)
-GL_ENTRY(void, glUseProgramStagesEXT, GLuint pipeline, GLbitfield stages, GLuint program)
-GL_ENTRY(void, glValidateProgram, GLuint program)
-GL_ENTRY(void, glValidateProgramPipelineEXT, GLuint pipeline)
-GL_ENTRY(void, glVertexAttrib1f, GLuint indx, GLfloat x)
-GL_ENTRY(void, glVertexAttrib1fv, GLuint indx, const GLfloat* values)
-GL_ENTRY(void, glVertexAttrib2f, GLuint indx, GLfloat x, GLfloat y)
-GL_ENTRY(void, glVertexAttrib2fv, GLuint indx, const GLfloat* values)
-GL_ENTRY(void, glVertexAttrib3f, GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-GL_ENTRY(void, glVertexAttrib3fv, GLuint indx, const GLfloat* values)
-GL_ENTRY(void, glVertexAttrib4f, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-GL_ENTRY(void, glVertexAttrib4fv, GLuint indx, const GLfloat* values)
-GL_ENTRY(void, glVertexAttribPointer, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height)
-GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
diff --git a/opengl/libs/enums.in b/opengl/libs/enums.in
deleted file mode 100644
index bfbc866..0000000
--- a/opengl/libs/enums.in
+++ /dev/null
@@ -1,702 +0,0 @@
-GL_ENUM(0x0000,GL_POINTS)
-GL_ENUM(0x00000001,GL_VERTEX_SHADER_BIT_EXT)
-GL_ENUM(0x00000002,GL_FRAGMENT_SHADER_BIT_EXT)
-GL_ENUM(0x0001,GL_LINES)
-GL_ENUM(0x0002,GL_LINE_LOOP)
-GL_ENUM(0x0003,GL_LINE_STRIP)
-GL_ENUM(0x0004,GL_TRIANGLES)
-GL_ENUM(0x0005,GL_TRIANGLE_STRIP)
-GL_ENUM(0x0006,GL_TRIANGLE_FAN)
-GL_ENUM(0x0104,GL_ADD)
-GL_ENUM(0x0200,GL_NEVER)
-GL_ENUM(0x0201,GL_LESS)
-GL_ENUM(0x0202,GL_EQUAL)
-GL_ENUM(0x0203,GL_LEQUAL)
-GL_ENUM(0x0204,GL_GREATER)
-GL_ENUM(0x0205,GL_NOTEQUAL)
-GL_ENUM(0x0206,GL_GEQUAL)
-GL_ENUM(0x0207,GL_ALWAYS)
-GL_ENUM(0x0300,GL_SRC_COLOR)
-GL_ENUM(0x0301,GL_ONE_MINUS_SRC_COLOR)
-GL_ENUM(0x0302,GL_SRC_ALPHA)
-GL_ENUM(0x0303,GL_ONE_MINUS_SRC_ALPHA)
-GL_ENUM(0x0304,GL_DST_ALPHA)
-GL_ENUM(0x0305,GL_ONE_MINUS_DST_ALPHA)
-GL_ENUM(0x0306,GL_DST_COLOR)
-GL_ENUM(0x0307,GL_ONE_MINUS_DST_COLOR)
-GL_ENUM(0x0308,GL_SRC_ALPHA_SATURATE)
-GL_ENUM(0x0404,GL_FRONT)
-GL_ENUM(0x0405,GL_BACK)
-GL_ENUM(0x0408,GL_FRONT_AND_BACK)
-GL_ENUM(0x0500,GL_INVALID_ENUM)
-GL_ENUM(0x0501,GL_INVALID_VALUE)
-GL_ENUM(0x0502,GL_INVALID_OPERATION)
-GL_ENUM(0x0503,GL_STACK_OVERFLOW)
-GL_ENUM(0x0504,GL_STACK_UNDERFLOW)
-GL_ENUM(0x0505,GL_OUT_OF_MEMORY)
-GL_ENUM(0x0506,GL_INVALID_FRAMEBUFFER_OPERATION_OES)
-GL_ENUM(0x0800,GL_EXP)
-GL_ENUM(0x0801,GL_EXP2)
-GL_ENUM(0x0900,GL_CW)
-GL_ENUM(0x0901,GL_CCW)
-GL_ENUM(0x0B00,GL_CURRENT_COLOR)
-GL_ENUM(0x0B02,GL_CURRENT_NORMAL)
-GL_ENUM(0x0B03,GL_CURRENT_TEXTURE_COORDS)
-GL_ENUM(0x0B10,GL_POINT_SMOOTH)
-GL_ENUM(0x0B11,GL_POINT_SIZE)
-GL_ENUM(0x0B12,GL_SMOOTH_POINT_SIZE_RANGE)
-GL_ENUM(0x0B20,GL_LINE_SMOOTH)
-GL_ENUM(0x0B21,GL_LINE_WIDTH)
-GL_ENUM(0x0B22,GL_SMOOTH_LINE_WIDTH_RANGE)
-GL_ENUM(0x0B44,GL_CULL_FACE)
-GL_ENUM(0x0B45,GL_CULL_FACE_MODE)
-GL_ENUM(0x0B46,GL_FRONT_FACE)
-GL_ENUM(0x0B50,GL_LIGHTING)
-GL_ENUM(0x0B52,GL_LIGHT_MODEL_TWO_SIDE)
-GL_ENUM(0x0B53,GL_LIGHT_MODEL_AMBIENT)
-GL_ENUM(0x0B54,GL_SHADE_MODEL)
-GL_ENUM(0x0B57,GL_COLOR_MATERIAL)
-GL_ENUM(0x0B60,GL_FOG)
-GL_ENUM(0x0B62,GL_FOG_DENSITY)
-GL_ENUM(0x0B63,GL_FOG_START)
-GL_ENUM(0x0B64,GL_FOG_END)
-GL_ENUM(0x0B65,GL_FOG_MODE)
-GL_ENUM(0x0B66,GL_FOG_COLOR)
-GL_ENUM(0x0B70,GL_DEPTH_RANGE)
-GL_ENUM(0x0B71,GL_DEPTH_TEST)
-GL_ENUM(0x0B72,GL_DEPTH_WRITEMASK)
-GL_ENUM(0x0B73,GL_DEPTH_CLEAR_VALUE)
-GL_ENUM(0x0B74,GL_DEPTH_FUNC)
-GL_ENUM(0x0B90,GL_STENCIL_TEST)
-GL_ENUM(0x0B91,GL_STENCIL_CLEAR_VALUE)
-GL_ENUM(0x0B92,GL_STENCIL_FUNC)
-GL_ENUM(0x0B93,GL_STENCIL_VALUE_MASK)
-GL_ENUM(0x0B94,GL_STENCIL_FAIL)
-GL_ENUM(0x0B95,GL_STENCIL_PASS_DEPTH_FAIL)
-GL_ENUM(0x0B96,GL_STENCIL_PASS_DEPTH_PASS)
-GL_ENUM(0x0B97,GL_STENCIL_REF)
-GL_ENUM(0x0B98,GL_STENCIL_WRITEMASK)
-GL_ENUM(0x0BA0,GL_MATRIX_MODE)
-GL_ENUM(0x0BA1,GL_NORMALIZE)
-GL_ENUM(0x0BA2,GL_VIEWPORT)
-GL_ENUM(0x0BA3,GL_MODELVIEW_STACK_DEPTH)
-GL_ENUM(0x0BA4,GL_PROJECTION_STACK_DEPTH)
-GL_ENUM(0x0BA5,GL_TEXTURE_STACK_DEPTH)
-GL_ENUM(0x0BA6,GL_MODELVIEW_MATRIX)
-GL_ENUM(0x0BA7,GL_PROJECTION_MATRIX)
-GL_ENUM(0x0BA8,GL_TEXTURE_MATRIX)
-GL_ENUM(0x0BC0,GL_ALPHA_TEST)
-GL_ENUM(0x0BC1,GL_ALPHA_TEST_FUNC)
-GL_ENUM(0x0BC2,GL_ALPHA_TEST_REF)
-GL_ENUM(0x0BD0,GL_DITHER)
-GL_ENUM(0x0BE0,GL_BLEND_DST)
-GL_ENUM(0x0BE1,GL_BLEND_SRC)
-GL_ENUM(0x0BE2,GL_BLEND)
-GL_ENUM(0x0BF0,GL_LOGIC_OP_MODE)
-GL_ENUM(0x0BF2,GL_COLOR_LOGIC_OP)
-GL_ENUM(0x0C02,GL_READ_BUFFER_NV)
-GL_ENUM(0x0C10,GL_SCISSOR_BOX)
-GL_ENUM(0x0C11,GL_SCISSOR_TEST)
-GL_ENUM(0x0C22,GL_COLOR_CLEAR_VALUE)
-GL_ENUM(0x0C23,GL_COLOR_WRITEMASK)
-GL_ENUM(0x0C50,GL_PERSPECTIVE_CORRECTION_HINT)
-GL_ENUM(0x0C51,GL_POINT_SMOOTH_HINT)
-GL_ENUM(0x0C52,GL_LINE_SMOOTH_HINT)
-GL_ENUM(0x0C54,GL_FOG_HINT)
-GL_ENUM(0x0CF2,GL_UNPACK_ROW_LENGTH)
-GL_ENUM(0x0CF3,GL_UNPACK_SKIP_ROWS)
-GL_ENUM(0x0CF4,GL_UNPACK_SKIP_PIXELS)
-GL_ENUM(0x0CF5,GL_UNPACK_ALIGNMENT)
-GL_ENUM(0x0D05,GL_PACK_ALIGNMENT)
-GL_ENUM(0x0D1C,GL_ALPHA_SCALE)
-GL_ENUM(0x0D31,GL_MAX_LIGHTS)
-GL_ENUM(0x0D32,GL_MAX_CLIP_PLANES)
-GL_ENUM(0x0D33,GL_MAX_TEXTURE_SIZE)
-GL_ENUM(0x0D36,GL_MAX_MODELVIEW_STACK_DEPTH)
-GL_ENUM(0x0D38,GL_MAX_PROJECTION_STACK_DEPTH)
-GL_ENUM(0x0D39,GL_MAX_TEXTURE_STACK_DEPTH)
-GL_ENUM(0x0D3A,GL_MAX_VIEWPORT_DIMS)
-GL_ENUM(0x0D50,GL_SUBPIXEL_BITS)
-GL_ENUM(0x0D52,GL_RED_BITS)
-GL_ENUM(0x0D53,GL_GREEN_BITS)
-GL_ENUM(0x0D54,GL_BLUE_BITS)
-GL_ENUM(0x0D55,GL_ALPHA_BITS)
-GL_ENUM(0x0D56,GL_DEPTH_BITS)
-GL_ENUM(0x0D57,GL_STENCIL_BITS)
-GL_ENUM(0x0DE1,GL_TEXTURE_2D)
-GL_ENUM(0x1100,GL_DONT_CARE)
-GL_ENUM(0x1101,GL_FASTEST)
-GL_ENUM(0x1102,GL_NICEST)
-GL_ENUM(0x1200,GL_AMBIENT)
-GL_ENUM(0x1201,GL_DIFFUSE)
-GL_ENUM(0x1202,GL_SPECULAR)
-GL_ENUM(0x1203,GL_POSITION)
-GL_ENUM(0x1204,GL_SPOT_DIRECTION)
-GL_ENUM(0x1205,GL_SPOT_EXPONENT)
-GL_ENUM(0x1206,GL_SPOT_CUTOFF)
-GL_ENUM(0x1207,GL_CONSTANT_ATTENUATION)
-GL_ENUM(0x1208,GL_LINEAR_ATTENUATION)
-GL_ENUM(0x1209,GL_QUADRATIC_ATTENUATION)
-GL_ENUM(0x1400,GL_BYTE)
-GL_ENUM(0x1401,GL_UNSIGNED_BYTE)
-GL_ENUM(0x1402,GL_SHORT)
-GL_ENUM(0x1403,GL_UNSIGNED_SHORT)
-GL_ENUM(0x1404,GL_INT)
-GL_ENUM(0x1405,GL_UNSIGNED_INT)
-GL_ENUM(0x1406,GL_FLOAT)
-GL_ENUM(0x140C,GL_FIXED)
-GL_ENUM(0x1500,GL_CLEAR)
-GL_ENUM(0x1501,GL_AND)
-GL_ENUM(0x1502,GL_AND_REVERSE)
-GL_ENUM(0x1503,GL_COPY)
-GL_ENUM(0x1504,GL_AND_INVERTED)
-GL_ENUM(0x1505,GL_NOOP)
-GL_ENUM(0x1506,GL_XOR)
-GL_ENUM(0x1507,GL_OR)
-GL_ENUM(0x1508,GL_NOR)
-GL_ENUM(0x1509,GL_EQUIV)
-GL_ENUM(0x150A,GL_INVERT)
-GL_ENUM(0x150B,GL_OR_REVERSE)
-GL_ENUM(0x150C,GL_COPY_INVERTED)
-GL_ENUM(0x150D,GL_OR_INVERTED)
-GL_ENUM(0x150E,GL_NAND)
-GL_ENUM(0x150F,GL_SET)
-GL_ENUM(0x1600,GL_EMISSION)
-GL_ENUM(0x1601,GL_SHININESS)
-GL_ENUM(0x1602,GL_AMBIENT_AND_DIFFUSE)
-GL_ENUM(0x1700,GL_MODELVIEW)
-GL_ENUM(0x1701,GL_PROJECTION)
-GL_ENUM(0x1702,GL_TEXTURE)
-GL_ENUM(0x1800,GL_COLOR_EXT)
-GL_ENUM(0x1801,GL_DEPTH_EXT)
-GL_ENUM(0x1802,GL_STENCIL_EXT)
-GL_ENUM(0x1901,GL_STENCIL_INDEX)
-GL_ENUM(0x1902,GL_DEPTH_COMPONENT)
-GL_ENUM(0x1903,GL_RED_EXT)
-GL_ENUM(0x1906,GL_ALPHA)
-GL_ENUM(0x1907,GL_RGB)
-GL_ENUM(0x1908,GL_RGBA)
-GL_ENUM(0x1909,GL_LUMINANCE)
-GL_ENUM(0x190A,GL_LUMINANCE_ALPHA)
-GL_ENUM(0x1D00,GL_FLAT)
-GL_ENUM(0x1D01,GL_SMOOTH)
-GL_ENUM(0x1E00,GL_KEEP)
-GL_ENUM(0x1E01,GL_REPLACE)
-GL_ENUM(0x1E02,GL_INCR)
-GL_ENUM(0x1E03,GL_DECR)
-GL_ENUM(0x1F00,GL_VENDOR)
-GL_ENUM(0x1F01,GL_RENDERER)
-GL_ENUM(0x1F02,GL_VERSION)
-GL_ENUM(0x1F03,GL_EXTENSIONS)
-GL_ENUM(0x2100,GL_MODULATE)
-GL_ENUM(0x2101,GL_DECAL)
-GL_ENUM(0x2200,GL_TEXTURE_ENV_MODE)
-GL_ENUM(0x2201,GL_TEXTURE_ENV_COLOR)
-GL_ENUM(0x2300,GL_TEXTURE_ENV)
-GL_ENUM(0x2500,GL_TEXTURE_GEN_MODE_OES)
-GL_ENUM(0x2600,GL_NEAREST)
-GL_ENUM(0x2601,GL_LINEAR)
-GL_ENUM(0x2700,GL_NEAREST_MIPMAP_NEAREST)
-GL_ENUM(0x2701,GL_LINEAR_MIPMAP_NEAREST)
-GL_ENUM(0x2702,GL_NEAREST_MIPMAP_LINEAR)
-GL_ENUM(0x2703,GL_LINEAR_MIPMAP_LINEAR)
-GL_ENUM(0x2800,GL_TEXTURE_MAG_FILTER)
-GL_ENUM(0x2801,GL_TEXTURE_MIN_FILTER)
-GL_ENUM(0x2802,GL_TEXTURE_WRAP_S)
-GL_ENUM(0x2803,GL_TEXTURE_WRAP_T)
-GL_ENUM(0x2901,GL_REPEAT)
-GL_ENUM(0x2A00,GL_POLYGON_OFFSET_UNITS)
-GL_ENUM(0x3000,GL_CLIP_PLANE0)
-GL_ENUM(0x3001,GL_CLIP_PLANE1)
-GL_ENUM(0x3002,GL_CLIP_PLANE2)
-GL_ENUM(0x3003,GL_CLIP_PLANE3)
-GL_ENUM(0x3004,GL_CLIP_PLANE4)
-GL_ENUM(0x3005,GL_CLIP_PLANE5)
-GL_ENUM(0x4000,GL_LIGHT0)
-GL_ENUM(0x4001,GL_LIGHT1)
-GL_ENUM(0x4002,GL_LIGHT2)
-GL_ENUM(0x4003,GL_LIGHT3)
-GL_ENUM(0x4004,GL_LIGHT4)
-GL_ENUM(0x4005,GL_LIGHT5)
-GL_ENUM(0x4006,GL_LIGHT6)
-GL_ENUM(0x4007,GL_LIGHT7)
-GL_ENUM(0x8000,GL_COVERAGE_BUFFER_BIT_NV)
-GL_ENUM(0x8001,GL_CONSTANT_COLOR)
-GL_ENUM(0x8002,GL_ONE_MINUS_CONSTANT_COLOR)
-GL_ENUM(0x8003,GL_CONSTANT_ALPHA)
-GL_ENUM(0x8004,GL_ONE_MINUS_CONSTANT_ALPHA)
-GL_ENUM(0x8005,GL_BLEND_COLOR)
-GL_ENUM(0x8006,GL_FUNC_ADD_OES)
-GL_ENUM(0x8007,GL_MIN_EXT)
-GL_ENUM(0x8008,GL_MAX_EXT)
-GL_ENUM(0x8009,GL_BLEND_EQUATION_RGB_OES)
-GL_ENUM(0x800A,GL_FUNC_SUBTRACT_OES)
-GL_ENUM(0x800B,GL_FUNC_REVERSE_SUBTRACT_OES)
-GL_ENUM(0x8033,GL_UNSIGNED_SHORT_4_4_4_4)
-GL_ENUM(0x8034,GL_UNSIGNED_SHORT_5_5_5_1)
-GL_ENUM(0x8037,GL_POLYGON_OFFSET_FILL)
-GL_ENUM(0x8038,GL_POLYGON_OFFSET_FACTOR)
-GL_ENUM(0x803A,GL_RESCALE_NORMAL)
-GL_ENUM(0x803C,GL_ALPHA8_EXT)
-GL_ENUM(0x8040,GL_LUMINANCE8_EXT)
-GL_ENUM(0x8045,GL_LUMINANCE8_ALPHA8_EXT)
-GL_ENUM(0x8051,GL_RGB8_OES)
-GL_ENUM(0x8052,GL_RGB10_EXT)
-GL_ENUM(0x8056,GL_RGBA4_OES)
-GL_ENUM(0x8057,GL_RGB5_A1_OES)
-GL_ENUM(0x8058,GL_RGBA8_OES)
-GL_ENUM(0x8059,GL_RGB10_A2_EXT)
-GL_ENUM(0x8069,GL_TEXTURE_BINDING_2D)
-GL_ENUM(0x806A,GL_TEXTURE_BINDING_3D_OES)
-GL_ENUM(0x806F,GL_TEXTURE_3D_OES)
-GL_ENUM(0x8072,GL_TEXTURE_WRAP_R_OES)
-GL_ENUM(0x8073,GL_MAX_3D_TEXTURE_SIZE_OES)
-GL_ENUM(0x8074,GL_VERTEX_ARRAY)
-GL_ENUM(0x8075,GL_NORMAL_ARRAY)
-GL_ENUM(0x8076,GL_COLOR_ARRAY)
-GL_ENUM(0x8078,GL_TEXTURE_COORD_ARRAY)
-GL_ENUM(0x807A,GL_VERTEX_ARRAY_SIZE)
-GL_ENUM(0x807B,GL_VERTEX_ARRAY_TYPE)
-GL_ENUM(0x807C,GL_VERTEX_ARRAY_STRIDE)
-GL_ENUM(0x807E,GL_NORMAL_ARRAY_TYPE)
-GL_ENUM(0x807F,GL_NORMAL_ARRAY_STRIDE)
-GL_ENUM(0x8081,GL_COLOR_ARRAY_SIZE)
-GL_ENUM(0x8082,GL_COLOR_ARRAY_TYPE)
-GL_ENUM(0x8083,GL_COLOR_ARRAY_STRIDE)
-GL_ENUM(0x8088,GL_TEXTURE_COORD_ARRAY_SIZE)
-GL_ENUM(0x8089,GL_TEXTURE_COORD_ARRAY_TYPE)
-GL_ENUM(0x808A,GL_TEXTURE_COORD_ARRAY_STRIDE)
-GL_ENUM(0x808E,GL_VERTEX_ARRAY_POINTER)
-GL_ENUM(0x808F,GL_NORMAL_ARRAY_POINTER)
-GL_ENUM(0x8090,GL_COLOR_ARRAY_POINTER)
-GL_ENUM(0x8092,GL_TEXTURE_COORD_ARRAY_POINTER)
-GL_ENUM(0x809D,GL_MULTISAMPLE)
-GL_ENUM(0x809E,GL_SAMPLE_ALPHA_TO_COVERAGE)
-GL_ENUM(0x809F,GL_SAMPLE_ALPHA_TO_ONE)
-GL_ENUM(0x80A0,GL_SAMPLE_COVERAGE)
-GL_ENUM(0x80A8,GL_SAMPLE_BUFFERS)
-GL_ENUM(0x80A9,GL_SAMPLES)
-GL_ENUM(0x80AA,GL_SAMPLE_COVERAGE_VALUE)
-GL_ENUM(0x80AB,GL_SAMPLE_COVERAGE_INVERT)
-GL_ENUM(0x80C8,GL_BLEND_DST_RGB_OES)
-GL_ENUM(0x80C9,GL_BLEND_SRC_RGB_OES)
-GL_ENUM(0x80CA,GL_BLEND_DST_ALPHA_OES)
-GL_ENUM(0x80CB,GL_BLEND_SRC_ALPHA_OES)
-GL_ENUM(0x80E1,GL_BGRA_EXT)
-GL_ENUM(0x8126,GL_POINT_SIZE_MIN)
-GL_ENUM(0x8127,GL_POINT_SIZE_MAX)
-GL_ENUM(0x8128,GL_POINT_FADE_THRESHOLD_SIZE)
-GL_ENUM(0x8129,GL_POINT_DISTANCE_ATTENUATION)
-GL_ENUM(0x812F,GL_CLAMP_TO_EDGE)
-GL_ENUM(0x813D,GL_TEXTURE_MAX_LEVEL_APPLE)
-GL_ENUM(0x8191,GL_GENERATE_MIPMAP)
-GL_ENUM(0x8192,GL_GENERATE_MIPMAP_HINT)
-GL_ENUM(0x81A5,GL_DEPTH_COMPONENT16_OES)
-GL_ENUM(0x81A6,GL_DEPTH_COMPONENT24_OES)
-GL_ENUM(0x81A7,GL_DEPTH_COMPONENT32_OES)
-GL_ENUM(0x8210,GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT)
-GL_ENUM(0x8211,GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT)
-GL_ENUM(0x8227,GL_RG_EXT)
-GL_ENUM(0x8229,GL_R8_EXT)
-GL_ENUM(0x822B,GL_RG8_EXT)
-GL_ENUM(0x822D,GL_R16F_EXT)
-GL_ENUM(0x822F,GL_RG16F_EXT)
-GL_ENUM(0x8252,GL_LOSE_CONTEXT_ON_RESET_EXT)
-GL_ENUM(0x8253,GL_GUILTY_CONTEXT_RESET_EXT)
-GL_ENUM(0x8254,GL_INNOCENT_CONTEXT_RESET_EXT)
-GL_ENUM(0x8255,GL_UNKNOWN_CONTEXT_RESET_EXT)
-GL_ENUM(0x8256,GL_RESET_NOTIFICATION_STRATEGY_EXT)
-GL_ENUM(0x8258,GL_PROGRAM_SEPARABLE_EXT)
-GL_ENUM(0x8259,GL_ACTIVE_PROGRAM_EXT)
-GL_ENUM(0x825A,GL_PROGRAM_PIPELINE_BINDING_EXT)
-GL_ENUM(0x8261,GL_NO_RESET_NOTIFICATION_EXT)
-GL_ENUM(0x8363,GL_UNSIGNED_SHORT_5_6_5)
-GL_ENUM(0x8365,GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT)
-GL_ENUM(0x8366,GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT)
-GL_ENUM(0x8368,GL_UNSIGNED_INT_2_10_10_10_REV_EXT)
-GL_ENUM(0x8370,GL_MIRRORED_REPEAT_OES)
-GL_ENUM(0x83F0,GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
-GL_ENUM(0x83F1,GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
-GL_ENUM(0x846D,GL_ALIASED_POINT_SIZE_RANGE)
-GL_ENUM(0x846E,GL_ALIASED_LINE_WIDTH_RANGE)
-GL_ENUM(0x84C0,GL_TEXTURE0)
-GL_ENUM(0x84C1,GL_TEXTURE1)
-GL_ENUM(0x84C2,GL_TEXTURE2)
-GL_ENUM(0x84C3,GL_TEXTURE3)
-GL_ENUM(0x84C4,GL_TEXTURE4)
-GL_ENUM(0x84C5,GL_TEXTURE5)
-GL_ENUM(0x84C6,GL_TEXTURE6)
-GL_ENUM(0x84C7,GL_TEXTURE7)
-GL_ENUM(0x84C8,GL_TEXTURE8)
-GL_ENUM(0x84C9,GL_TEXTURE9)
-GL_ENUM(0x84CA,GL_TEXTURE10)
-GL_ENUM(0x84CB,GL_TEXTURE11)
-GL_ENUM(0x84CC,GL_TEXTURE12)
-GL_ENUM(0x84CD,GL_TEXTURE13)
-GL_ENUM(0x84CE,GL_TEXTURE14)
-GL_ENUM(0x84CF,GL_TEXTURE15)
-GL_ENUM(0x84D0,GL_TEXTURE16)
-GL_ENUM(0x84D1,GL_TEXTURE17)
-GL_ENUM(0x84D2,GL_TEXTURE18)
-GL_ENUM(0x84D3,GL_TEXTURE19)
-GL_ENUM(0x84D4,GL_TEXTURE20)
-GL_ENUM(0x84D5,GL_TEXTURE21)
-GL_ENUM(0x84D6,GL_TEXTURE22)
-GL_ENUM(0x84D7,GL_TEXTURE23)
-GL_ENUM(0x84D8,GL_TEXTURE24)
-GL_ENUM(0x84D9,GL_TEXTURE25)
-GL_ENUM(0x84DA,GL_TEXTURE26)
-GL_ENUM(0x84DB,GL_TEXTURE27)
-GL_ENUM(0x84DC,GL_TEXTURE28)
-GL_ENUM(0x84DD,GL_TEXTURE29)
-GL_ENUM(0x84DE,GL_TEXTURE30)
-GL_ENUM(0x84DF,GL_TEXTURE31)
-GL_ENUM(0x84E0,GL_ACTIVE_TEXTURE)
-GL_ENUM(0x84E1,GL_CLIENT_ACTIVE_TEXTURE)
-GL_ENUM(0x84E2,GL_MAX_TEXTURE_UNITS)
-GL_ENUM(0x84E7,GL_SUBTRACT)
-GL_ENUM(0x84E8,GL_MAX_RENDERBUFFER_SIZE_OES)
-GL_ENUM(0x84F2,GL_ALL_COMPLETED_NV)
-GL_ENUM(0x84F3,GL_FENCE_STATUS_NV)
-GL_ENUM(0x84F4,GL_FENCE_CONDITION_NV)
-GL_ENUM(0x84F9,GL_DEPTH_STENCIL_OES)
-GL_ENUM(0x84FA,GL_UNSIGNED_INT_24_8_OES)
-GL_ENUM(0x84FD,GL_MAX_TEXTURE_LOD_BIAS_EXT)
-GL_ENUM(0x84FE,GL_TEXTURE_MAX_ANISOTROPY_EXT)
-GL_ENUM(0x84FF,GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)
-GL_ENUM(0x8500,GL_TEXTURE_FILTER_CONTROL_EXT)
-GL_ENUM(0x8501,GL_TEXTURE_LOD_BIAS_EXT)
-GL_ENUM(0x8507,GL_INCR_WRAP_OES)
-GL_ENUM(0x8508,GL_DECR_WRAP_OES)
-GL_ENUM(0x8511,GL_NORMAL_MAP_OES)
-GL_ENUM(0x8512,GL_REFLECTION_MAP_OES)
-GL_ENUM(0x8513,GL_TEXTURE_CUBE_MAP_OES)
-GL_ENUM(0x8514,GL_TEXTURE_BINDING_CUBE_MAP_OES)
-GL_ENUM(0x8515,GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES)
-GL_ENUM(0x8516,GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES)
-GL_ENUM(0x8517,GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES)
-GL_ENUM(0x8518,GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES)
-GL_ENUM(0x8519,GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES)
-GL_ENUM(0x851A,GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES)
-GL_ENUM(0x851C,GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES)
-GL_ENUM(0x8570,GL_COMBINE)
-GL_ENUM(0x8571,GL_COMBINE_RGB)
-GL_ENUM(0x8572,GL_COMBINE_ALPHA)
-GL_ENUM(0x8573,GL_RGB_SCALE)
-GL_ENUM(0x8574,GL_ADD_SIGNED)
-GL_ENUM(0x8575,GL_INTERPOLATE)
-GL_ENUM(0x8576,GL_CONSTANT)
-GL_ENUM(0x8577,GL_PRIMARY_COLOR)
-GL_ENUM(0x8578,GL_PREVIOUS)
-GL_ENUM(0x8580,GL_SRC0_RGB)
-GL_ENUM(0x8581,GL_SRC1_RGB)
-GL_ENUM(0x8582,GL_SRC2_RGB)
-GL_ENUM(0x8588,GL_SRC0_ALPHA)
-GL_ENUM(0x8589,GL_SRC1_ALPHA)
-GL_ENUM(0x858A,GL_SRC2_ALPHA)
-GL_ENUM(0x8590,GL_OPERAND0_RGB)
-GL_ENUM(0x8591,GL_OPERAND1_RGB)
-GL_ENUM(0x8592,GL_OPERAND2_RGB)
-GL_ENUM(0x8598,GL_OPERAND0_ALPHA)
-GL_ENUM(0x8599,GL_OPERAND1_ALPHA)
-GL_ENUM(0x859A,GL_OPERAND2_ALPHA)
-GL_ENUM(0x85B5,GL_VERTEX_ARRAY_BINDING_OES)
-GL_ENUM(0x85BA,GL_UNSIGNED_SHORT_8_8_APPLE)
-GL_ENUM(0x85BB,GL_UNSIGNED_SHORT_8_8_REV_APPLE)
-GL_ENUM(0x8622,GL_VERTEX_ATTRIB_ARRAY_ENABLED)
-GL_ENUM(0x8623,GL_VERTEX_ATTRIB_ARRAY_SIZE)
-GL_ENUM(0x8624,GL_VERTEX_ATTRIB_ARRAY_STRIDE)
-GL_ENUM(0x8625,GL_VERTEX_ATTRIB_ARRAY_TYPE)
-GL_ENUM(0x8626,GL_CURRENT_VERTEX_ATTRIB)
-GL_ENUM(0x8645,GL_VERTEX_ATTRIB_ARRAY_POINTER)
-GL_ENUM(0x86A2,GL_NUM_COMPRESSED_TEXTURE_FORMATS)
-GL_ENUM(0x86A3,GL_COMPRESSED_TEXTURE_FORMATS)
-GL_ENUM(0x86A4,GL_MAX_VERTEX_UNITS_OES)
-GL_ENUM(0x86A9,GL_WEIGHT_ARRAY_TYPE_OES)
-GL_ENUM(0x86AA,GL_WEIGHT_ARRAY_STRIDE_OES)
-GL_ENUM(0x86AB,GL_WEIGHT_ARRAY_SIZE_OES)
-GL_ENUM(0x86AC,GL_WEIGHT_ARRAY_POINTER_OES)
-GL_ENUM(0x86AD,GL_WEIGHT_ARRAY_OES)
-GL_ENUM(0x86AE,GL_DOT3_RGB)
-GL_ENUM(0x86AF,GL_DOT3_RGBA)
-GL_ENUM(0x8740,GL_Z400_BINARY_AMD)
-GL_ENUM(0x8741,GL_PROGRAM_BINARY_LENGTH_OES)
-GL_ENUM(0x8764,GL_BUFFER_SIZE)
-GL_ENUM(0x8765,GL_BUFFER_USAGE)
-GL_ENUM(0x87EE,GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD)
-GL_ENUM(0x87F9,GL_3DC_X_AMD)
-GL_ENUM(0x87FA,GL_3DC_XY_AMD)
-GL_ENUM(0x87FE,GL_NUM_PROGRAM_BINARY_FORMATS_OES)
-GL_ENUM(0x87FF,GL_PROGRAM_BINARY_FORMATS_OES)
-GL_ENUM(0x8800,GL_STENCIL_BACK_FUNC)
-GL_ENUM(0x8801,GL_STENCIL_BACK_FAIL)
-GL_ENUM(0x8802,GL_STENCIL_BACK_PASS_DEPTH_FAIL)
-GL_ENUM(0x8803,GL_STENCIL_BACK_PASS_DEPTH_PASS)
-GL_ENUM(0x8814,GL_RGBA32F_EXT)
-GL_ENUM(0x8815,GL_RGB32F_EXT)
-GL_ENUM(0x8816,GL_ALPHA32F_EXT)
-GL_ENUM(0x8818,GL_LUMINANCE32F_EXT)
-GL_ENUM(0x8819,GL_LUMINANCE_ALPHA32F_EXT)
-GL_ENUM(0x881A,GL_RGBA16F_EXT)
-GL_ENUM(0x881B,GL_RGB16F_EXT)
-GL_ENUM(0x881C,GL_ALPHA16F_EXT)
-GL_ENUM(0x881E,GL_LUMINANCE16F_EXT)
-GL_ENUM(0x881F,GL_LUMINANCE_ALPHA16F_EXT)
-GL_ENUM(0x8823,GL_WRITEONLY_RENDERING_QCOM)
-GL_ENUM(0x8824,GL_MAX_DRAW_BUFFERS_NV)
-GL_ENUM(0x8825,GL_DRAW_BUFFER0_NV)
-GL_ENUM(0x8826,GL_DRAW_BUFFER1_NV)
-GL_ENUM(0x8827,GL_DRAW_BUFFER2_NV)
-GL_ENUM(0x8828,GL_DRAW_BUFFER3_NV)
-GL_ENUM(0x8829,GL_DRAW_BUFFER4_NV)
-GL_ENUM(0x882A,GL_DRAW_BUFFER5_NV)
-GL_ENUM(0x882B,GL_DRAW_BUFFER6_NV)
-GL_ENUM(0x882C,GL_DRAW_BUFFER7_NV)
-GL_ENUM(0x882D,GL_DRAW_BUFFER8_NV)
-GL_ENUM(0x882E,GL_DRAW_BUFFER9_NV)
-GL_ENUM(0x882F,GL_DRAW_BUFFER10_NV)
-GL_ENUM(0x8830,GL_DRAW_BUFFER11_NV)
-GL_ENUM(0x8831,GL_DRAW_BUFFER12_NV)
-GL_ENUM(0x8832,GL_DRAW_BUFFER13_NV)
-GL_ENUM(0x8833,GL_DRAW_BUFFER14_NV)
-GL_ENUM(0x8834,GL_DRAW_BUFFER15_NV)
-GL_ENUM(0x883D,GL_BLEND_EQUATION_ALPHA_OES)
-GL_ENUM(0x8840,GL_MATRIX_PALETTE_OES)
-GL_ENUM(0x8842,GL_MAX_PALETTE_MATRICES_OES)
-GL_ENUM(0x8843,GL_CURRENT_PALETTE_MATRIX_OES)
-GL_ENUM(0x8844,GL_MATRIX_INDEX_ARRAY_OES)
-GL_ENUM(0x8846,GL_MATRIX_INDEX_ARRAY_SIZE_OES)
-GL_ENUM(0x8847,GL_MATRIX_INDEX_ARRAY_TYPE_OES)
-GL_ENUM(0x8848,GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
-GL_ENUM(0x8849,GL_MATRIX_INDEX_ARRAY_POINTER_OES)
-GL_ENUM(0x884C,GL_TEXTURE_COMPARE_MODE_EXT)
-GL_ENUM(0x884D,GL_TEXTURE_COMPARE_FUNC_EXT)
-GL_ENUM(0x884E,GL_COMPARE_REF_TO_TEXTURE_EXT)
-GL_ENUM(0x8861,GL_POINT_SPRITE_OES)
-GL_ENUM(0x8862,GL_COORD_REPLACE_OES)
-GL_ENUM(0x8865,GL_CURRENT_QUERY_EXT)
-GL_ENUM(0x8866,GL_QUERY_RESULT_EXT)
-GL_ENUM(0x8867,GL_QUERY_RESULT_AVAILABLE_EXT)
-GL_ENUM(0x8869,GL_MAX_VERTEX_ATTRIBS)
-GL_ENUM(0x886A,GL_VERTEX_ATTRIB_ARRAY_NORMALIZED)
-GL_ENUM(0x8872,GL_MAX_TEXTURE_IMAGE_UNITS)
-GL_ENUM(0x8892,GL_ARRAY_BUFFER)
-GL_ENUM(0x8893,GL_ELEMENT_ARRAY_BUFFER)
-GL_ENUM(0x8894,GL_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x8895,GL_ELEMENT_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x8896,GL_VERTEX_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x8897,GL_NORMAL_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x8898,GL_COLOR_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x889A,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x889E,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
-GL_ENUM(0x889F,GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)
-GL_ENUM(0x88B9,GL_WRITE_ONLY_OES)
-GL_ENUM(0x88BB,GL_BUFFER_ACCESS_OES)
-GL_ENUM(0x88BC,GL_BUFFER_MAPPED_OES)
-GL_ENUM(0x88BD,GL_BUFFER_MAP_POINTER_OES)
-GL_ENUM(0x88E0,GL_STREAM_DRAW)
-GL_ENUM(0x88E4,GL_STATIC_DRAW)
-GL_ENUM(0x88E8,GL_DYNAMIC_DRAW)
-GL_ENUM(0x88F0,GL_DEPTH24_STENCIL8_OES)
-GL_ENUM(0x898A,GL_POINT_SIZE_ARRAY_TYPE_OES)
-GL_ENUM(0x898B,GL_POINT_SIZE_ARRAY_STRIDE_OES)
-GL_ENUM(0x898C,GL_POINT_SIZE_ARRAY_POINTER_OES)
-GL_ENUM(0x898D,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
-GL_ENUM(0x898E,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
-GL_ENUM(0x898F,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
-GL_ENUM(0x8A1F,GL_RGB_422_APPLE)
-GL_ENUM(0x8A4F,GL_PROGRAM_PIPELINE_OBJECT_EXT)
-GL_ENUM(0x8B30,GL_FRAGMENT_SHADER)
-GL_ENUM(0x8B31,GL_VERTEX_SHADER)
-GL_ENUM(0x8B40,GL_PROGRAM_OBJECT_EXT)
-GL_ENUM(0x8B48,GL_SHADER_OBJECT_EXT)
-GL_ENUM(0x8B4C,GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)
-GL_ENUM(0x8B4D,GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
-GL_ENUM(0x8B4F,GL_SHADER_TYPE)
-GL_ENUM(0x8B50,GL_FLOAT_VEC2)
-GL_ENUM(0x8B51,GL_FLOAT_VEC3)
-GL_ENUM(0x8B52,GL_FLOAT_VEC4)
-GL_ENUM(0x8B53,GL_INT_VEC2)
-GL_ENUM(0x8B54,GL_INT_VEC3)
-GL_ENUM(0x8B55,GL_INT_VEC4)
-GL_ENUM(0x8B56,GL_BOOL)
-GL_ENUM(0x8B57,GL_BOOL_VEC2)
-GL_ENUM(0x8B58,GL_BOOL_VEC3)
-GL_ENUM(0x8B59,GL_BOOL_VEC4)
-GL_ENUM(0x8B5A,GL_FLOAT_MAT2)
-GL_ENUM(0x8B5B,GL_FLOAT_MAT3)
-GL_ENUM(0x8B5C,GL_FLOAT_MAT4)
-GL_ENUM(0x8B5E,GL_SAMPLER_2D)
-GL_ENUM(0x8B5F,GL_SAMPLER_3D_OES)
-GL_ENUM(0x8B60,GL_SAMPLER_CUBE)
-GL_ENUM(0x8B62,GL_SAMPLER_2D_SHADOW_EXT)
-GL_ENUM(0x8B80,GL_DELETE_STATUS)
-GL_ENUM(0x8B81,GL_COMPILE_STATUS)
-GL_ENUM(0x8B82,GL_LINK_STATUS)
-GL_ENUM(0x8B83,GL_VALIDATE_STATUS)
-GL_ENUM(0x8B84,GL_INFO_LOG_LENGTH)
-GL_ENUM(0x8B85,GL_ATTACHED_SHADERS)
-GL_ENUM(0x8B86,GL_ACTIVE_UNIFORMS)
-GL_ENUM(0x8B87,GL_ACTIVE_UNIFORM_MAX_LENGTH)
-GL_ENUM(0x8B88,GL_SHADER_SOURCE_LENGTH)
-GL_ENUM(0x8B89,GL_ACTIVE_ATTRIBUTES)
-GL_ENUM(0x8B8A,GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
-GL_ENUM(0x8B8B,GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES)
-GL_ENUM(0x8B8C,GL_SHADING_LANGUAGE_VERSION)
-GL_ENUM(0x8B8D,GL_CURRENT_PROGRAM)
-GL_ENUM(0x8B90,GL_PALETTE4_RGB8_OES)
-GL_ENUM(0x8B91,GL_PALETTE4_RGBA8_OES)
-GL_ENUM(0x8B92,GL_PALETTE4_R5_G6_B5_OES)
-GL_ENUM(0x8B93,GL_PALETTE4_RGBA4_OES)
-GL_ENUM(0x8B94,GL_PALETTE4_RGB5_A1_OES)
-GL_ENUM(0x8B95,GL_PALETTE8_RGB8_OES)
-GL_ENUM(0x8B96,GL_PALETTE8_RGBA8_OES)
-GL_ENUM(0x8B97,GL_PALETTE8_R5_G6_B5_OES)
-GL_ENUM(0x8B98,GL_PALETTE8_RGBA4_OES)
-GL_ENUM(0x8B99,GL_PALETTE8_RGB5_A1_OES)
-GL_ENUM(0x8B9A,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
-GL_ENUM(0x8B9B,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
-GL_ENUM(0x8B9C,GL_POINT_SIZE_ARRAY_OES)
-GL_ENUM(0x8B9D,GL_TEXTURE_CROP_RECT_OES)
-GL_ENUM(0x8B9E,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
-GL_ENUM(0x8B9F,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
-GL_ENUM(0x8BC0,GL_COUNTER_TYPE_AMD)
-GL_ENUM(0x8BC1,GL_COUNTER_RANGE_AMD)
-GL_ENUM(0x8BC2,GL_UNSIGNED_INT64_AMD)
-GL_ENUM(0x8BC3,GL_PERCENTAGE_AMD)
-GL_ENUM(0x8BC4,GL_PERFMON_RESULT_AVAILABLE_AMD)
-GL_ENUM(0x8BC5,GL_PERFMON_RESULT_SIZE_AMD)
-GL_ENUM(0x8BC6,GL_PERFMON_RESULT_AMD)
-GL_ENUM(0x8BD2,GL_TEXTURE_WIDTH_QCOM)
-GL_ENUM(0x8BD3,GL_TEXTURE_HEIGHT_QCOM)
-GL_ENUM(0x8BD4,GL_TEXTURE_DEPTH_QCOM)
-GL_ENUM(0x8BD5,GL_TEXTURE_INTERNAL_FORMAT_QCOM)
-GL_ENUM(0x8BD6,GL_TEXTURE_FORMAT_QCOM)
-GL_ENUM(0x8BD7,GL_TEXTURE_TYPE_QCOM)
-GL_ENUM(0x8BD8,GL_TEXTURE_IMAGE_VALID_QCOM)
-GL_ENUM(0x8BD9,GL_TEXTURE_NUM_LEVELS_QCOM)
-GL_ENUM(0x8BDA,GL_TEXTURE_TARGET_QCOM)
-GL_ENUM(0x8BDB,GL_TEXTURE_OBJECT_VALID_QCOM)
-GL_ENUM(0x8BDC,GL_STATE_RESTORE)
-GL_ENUM(0x8C00,GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG)
-GL_ENUM(0x8C01,GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG)
-GL_ENUM(0x8C02,GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG)
-GL_ENUM(0x8C03,GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG)
-GL_ENUM(0x8C04,GL_MODULATE_COLOR_IMG)
-GL_ENUM(0x8C05,GL_RECIP_ADD_SIGNED_ALPHA_IMG)
-GL_ENUM(0x8C06,GL_TEXTURE_ALPHA_MODULATE_IMG)
-GL_ENUM(0x8C07,GL_FACTOR_ALPHA_MODULATE_IMG)
-GL_ENUM(0x8C08,GL_FRAGMENT_ALPHA_MODULATE_IMG)
-GL_ENUM(0x8C09,GL_ADD_BLEND_IMG)
-GL_ENUM(0x8C0A,GL_SGX_BINARY_IMG)
-GL_ENUM(0x8C17,GL_UNSIGNED_NORMALIZED_EXT)
-GL_ENUM(0x8C2F,GL_ANY_SAMPLES_PASSED_EXT)
-GL_ENUM(0x8C40,GL_SRGB_EXT)
-GL_ENUM(0x8C42,GL_SRGB_ALPHA_EXT)
-GL_ENUM(0x8C43,GL_SRGB8_ALPHA8_EXT)
-GL_ENUM(0x8C92,GL_ATC_RGB_AMD)
-GL_ENUM(0x8C93,GL_ATC_RGBA_EXPLICIT_ALPHA_AMD)
-GL_ENUM(0x8CA3,GL_STENCIL_BACK_REF)
-GL_ENUM(0x8CA4,GL_STENCIL_BACK_VALUE_MASK)
-GL_ENUM(0x8CA5,GL_STENCIL_BACK_WRITEMASK)
-GL_ENUM(0x8CA6,GL_FRAMEBUFFER_BINDING_OES)
-GL_ENUM(0x8CA7,GL_RENDERBUFFER_BINDING_OES)
-GL_ENUM(0x8CA8,GL_READ_FRAMEBUFFER_APPLE)
-GL_ENUM(0x8CA9,GL_DRAW_FRAMEBUFFER_APPLE)
-GL_ENUM(0x8CAA,GL_READ_FRAMEBUFFER_BINDING_APPLE)
-GL_ENUM(0x8CAB,GL_RENDERBUFFER_SAMPLES_APPLE)
-GL_ENUM(0x8CD0,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES)
-GL_ENUM(0x8CD1,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES)
-GL_ENUM(0x8CD2,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES)
-GL_ENUM(0x8CD3,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES)
-GL_ENUM(0x8CD4,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES)
-GL_ENUM(0x8CD5,GL_FRAMEBUFFER_COMPLETE_OES)
-GL_ENUM(0x8CD6,GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES)
-GL_ENUM(0x8CD7,GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES)
-GL_ENUM(0x8CD9,GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES)
-GL_ENUM(0x8CDA,GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES)
-GL_ENUM(0x8CDD,GL_FRAMEBUFFER_UNSUPPORTED_OES)
-GL_ENUM(0x8CDF,GL_MAX_COLOR_ATTACHMENTS_NV)
-GL_ENUM(0x8CE0,GL_COLOR_ATTACHMENT0_OES)
-GL_ENUM(0x8CE1,GL_COLOR_ATTACHMENT1_NV)
-GL_ENUM(0x8CE2,GL_COLOR_ATTACHMENT2_NV)
-GL_ENUM(0x8CE3,GL_COLOR_ATTACHMENT3_NV)
-GL_ENUM(0x8CE4,GL_COLOR_ATTACHMENT4_NV)
-GL_ENUM(0x8CE5,GL_COLOR_ATTACHMENT5_NV)
-GL_ENUM(0x8CE6,GL_COLOR_ATTACHMENT6_NV)
-GL_ENUM(0x8CE7,GL_COLOR_ATTACHMENT7_NV)
-GL_ENUM(0x8CE8,GL_COLOR_ATTACHMENT8_NV)
-GL_ENUM(0x8CE9,GL_COLOR_ATTACHMENT9_NV)
-GL_ENUM(0x8CEA,GL_COLOR_ATTACHMENT10_NV)
-GL_ENUM(0x8CEB,GL_COLOR_ATTACHMENT11_NV)
-GL_ENUM(0x8CEC,GL_COLOR_ATTACHMENT12_NV)
-GL_ENUM(0x8CED,GL_COLOR_ATTACHMENT13_NV)
-GL_ENUM(0x8CEE,GL_COLOR_ATTACHMENT14_NV)
-GL_ENUM(0x8CEF,GL_COLOR_ATTACHMENT15_NV)
-GL_ENUM(0x8D00,GL_DEPTH_ATTACHMENT_OES)
-GL_ENUM(0x8D20,GL_STENCIL_ATTACHMENT_OES)
-GL_ENUM(0x8D40,GL_FRAMEBUFFER_OES)
-GL_ENUM(0x8D41,GL_RENDERBUFFER_OES)
-GL_ENUM(0x8D42,GL_RENDERBUFFER_WIDTH_OES)
-GL_ENUM(0x8D43,GL_RENDERBUFFER_HEIGHT_OES)
-GL_ENUM(0x8D44,GL_RENDERBUFFER_INTERNAL_FORMAT_OES)
-GL_ENUM(0x8D46,GL_STENCIL_INDEX1_OES)
-GL_ENUM(0x8D47,GL_STENCIL_INDEX4_OES)
-GL_ENUM(0x8D48,GL_STENCIL_INDEX8_OES)
-GL_ENUM(0x8D50,GL_RENDERBUFFER_RED_SIZE_OES)
-GL_ENUM(0x8D51,GL_RENDERBUFFER_GREEN_SIZE_OES)
-GL_ENUM(0x8D52,GL_RENDERBUFFER_BLUE_SIZE_OES)
-GL_ENUM(0x8D53,GL_RENDERBUFFER_ALPHA_SIZE_OES)
-GL_ENUM(0x8D54,GL_RENDERBUFFER_DEPTH_SIZE_OES)
-GL_ENUM(0x8D55,GL_RENDERBUFFER_STENCIL_SIZE_OES)
-GL_ENUM(0x8D56,GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE)
-GL_ENUM(0x8D57,GL_MAX_SAMPLES_APPLE)
-GL_ENUM(0x8D60,GL_TEXTURE_GEN_STR_OES)
-GL_ENUM(0x8D61,GL_HALF_FLOAT_OES)
-GL_ENUM(0x8D62,GL_RGB565_OES)
-GL_ENUM(0x8D64,GL_ETC1_RGB8_OES)
-GL_ENUM(0x8D65,GL_TEXTURE_EXTERNAL_OES)
-GL_ENUM(0x8D66,GL_SAMPLER_EXTERNAL_OES)
-GL_ENUM(0x8D67,GL_TEXTURE_BINDING_EXTERNAL_OES)
-GL_ENUM(0x8D68,GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES)
-GL_ENUM(0x8D6A,GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT)
-GL_ENUM(0x8D6C,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT)
-GL_ENUM(0x8DF0,GL_LOW_FLOAT)
-GL_ENUM(0x8DF1,GL_MEDIUM_FLOAT)
-GL_ENUM(0x8DF2,GL_HIGH_FLOAT)
-GL_ENUM(0x8DF3,GL_LOW_INT)
-GL_ENUM(0x8DF4,GL_MEDIUM_INT)
-GL_ENUM(0x8DF5,GL_HIGH_INT)
-GL_ENUM(0x8DF6,GL_UNSIGNED_INT_10_10_10_2_OES)
-GL_ENUM(0x8DF7,GL_INT_10_10_10_2_OES)
-GL_ENUM(0x8DF8,GL_SHADER_BINARY_FORMATS)
-GL_ENUM(0x8DF9,GL_NUM_SHADER_BINARY_FORMATS)
-GL_ENUM(0x8DFA,GL_SHADER_COMPILER)
-GL_ENUM(0x8DFB,GL_MAX_VERTEX_UNIFORM_VECTORS)
-GL_ENUM(0x8DFC,GL_MAX_VARYING_VECTORS)
-GL_ENUM(0x8DFD,GL_MAX_FRAGMENT_UNIFORM_VECTORS)
-GL_ENUM(0x8E2C,GL_DEPTH_COMPONENT16_NONLINEAR_NV)
-GL_ENUM(0x8ED0,GL_COVERAGE_COMPONENT_NV)
-GL_ENUM(0x8ED1,GL_COVERAGE_COMPONENT4_NV)
-GL_ENUM(0x8ED2,GL_COVERAGE_ATTACHMENT_NV)
-GL_ENUM(0x8ED3,GL_COVERAGE_BUFFERS_NV)
-GL_ENUM(0x8ED4,GL_COVERAGE_SAMPLES_NV)
-GL_ENUM(0x8ED5,GL_COVERAGE_ALL_FRAGMENTS_NV)
-GL_ENUM(0x8ED6,GL_COVERAGE_EDGE_FRAGMENTS_NV)
-GL_ENUM(0x8ED7,GL_COVERAGE_AUTOMATIC_NV)
-GL_ENUM(0x8F60,GL_MALI_SHADER_BINARY_ARM)
-GL_ENUM(0x8FA0,GL_PERFMON_GLOBAL_MODE_QCOM)
-GL_ENUM(0x8FC4,GL_SHADER_BINARY_VIV)
-GL_ENUM(0x90F3,GL_CONTEXT_ROBUST_ACCESS_EXT)
-GL_ENUM(0x912F,GL_TEXTURE_IMMUTABLE_FORMAT_EXT)
-GL_ENUM(0x9130,GL_SGX_PROGRAM_BINARY_IMG)
-GL_ENUM(0x9133,GL_RENDERBUFFER_SAMPLES_EXT)
-GL_ENUM(0x9134,GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT)
-GL_ENUM(0x9135,GL_MAX_SAMPLES_EXT)
-GL_ENUM(0x9136,GL_TEXTURE_SAMPLES_IMG)
-GL_ENUM(0x9151,GL_BUFFER_OBJECT_EXT)
-GL_ENUM(0x9153,GL_QUERY_OBJECT_EXT)
-GL_ENUM(0x9154,GL_VERTEX_ARRAY_OBJECT_EXT)
-GL_ENUM(0x9250,GL_SHADER_BINARY_DMP)
-GL_ENUM(0x93A1,GL_BGRA8_EXT)
-GL_ENUM(0xFFFFFFFF,GL_ALL_SHADER_BITS_EXT)
diff --git a/opengl/libs/glestrace.h b/opengl/libs/glestrace.h
deleted file mode 100644
index a08f97b..0000000
--- a/opengl/libs/glestrace.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * 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.
- *
- * This file declares the API provided by the glestrace library.
- */
-
-#ifndef _GLES_TRACE_H_
-#define _GLES_TRACE_H_
-
-#include "hooks.h"
-
-namespace android {
-
-/* Hooks to be called by "interesting" EGL functions. */
-void GLTrace_eglCreateContext(int version, EGLContext c);
-void GLTrace_eglMakeCurrent(unsigned version, gl_hooks_t *hooks, EGLContext c);
-void GLTrace_eglReleaseThread();
-void GLTrace_eglSwapBuffers(void*, void*);
-
-/* Start and stop GL Tracing. */
-void GLTrace_start();
-void GLTrace_stop();
-
-/* Obtain the gl_hooks structure filled with the trace implementation for all GL functions. */
-gl_hooks_t *GLTrace_getGLHooks();
-
-};
-
-#endif
diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h
deleted file mode 100644
index 8b1b389..0000000
--- a/opengl/libs/hooks.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** 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.
- */
-
-#ifndef ANDROID_GLES_CM_HOOKS_H
-#define ANDROID_GLES_CM_HOOKS_H
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-
-#include <pthread.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#if !defined(__arm__)
-#define USE_SLOW_BINDING 1
-#else
-#define USE_SLOW_BINDING 0
-#endif
-#undef NELEM
-#define NELEM(x) (sizeof(x)/sizeof(*(x)))
-
-// maximum number of GL extensions that can be used simultaneously in
-// a given process. this limitation exists because we need to have
-// a static function for each extension and currently these static functions
-// are generated at compile time.
-#define MAX_NUMBER_OF_GL_EXTENSIONS 256
-
-
-#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && __OPTIMIZE__
-#define USE_FAST_TLS_KEY 1
-#else
-#define USE_FAST_TLS_KEY 0
-#endif
-
-#if USE_FAST_TLS_KEY
-# include <bionic_tls.h> /* special private C library header */
-#endif
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-// GL / EGL hooks
-
-#undef GL_ENTRY
-#undef EGL_ENTRY
-#define GL_ENTRY(_r, _api, ...) _r (*_api)(__VA_ARGS__);
-#define EGL_ENTRY(_r, _api, ...) _r (*_api)(__VA_ARGS__);
-
-struct egl_t {
- #include "EGL/egl_entries.in"
-};
-
-struct gl_hooks_t {
- struct gl_t {
- #include "entries.in"
- } gl;
- struct gl_ext_t {
- __eglMustCastToProperFunctionPointerType extensions[MAX_NUMBER_OF_GL_EXTENSIONS];
- } ext;
-};
-#undef GL_ENTRY
-#undef EGL_ENTRY
-
-EGLAPI void setGlThreadSpecific(gl_hooks_t const *value);
-EGLAPI gl_hooks_t const* getGlThreadSpecific();
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_GLES_CM_HOOKS_H */
diff --git a/opengl/libs/tools/genfiles b/opengl/libs/tools/genfiles
deleted file mode 100755
index 50bbf08..0000000
--- a/opengl/libs/tools/genfiles
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /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
-./glapigen ../../include/GLES/glext.h > ../GLES_CM/glext_api.in
-./glapigen ../../include/GLES2/gl2.h > ../GLES2/gl2_api.in
-./glapigen ../../include/GLES2/gl2ext.h > ../GLES2/gl2ext_api.in
-
-./glentrygen ../../include/GLES/gl.h > /tmp/gl_entries.in
-./glentrygen ../../include/GLES/glext.h > /tmp/glext_entries.in
-./glentrygen ../../include/GLES2/gl2.h > /tmp/gl2_entries.in
-./glentrygen ../../include/GLES2/gl2ext.h > /tmp/gl2ext_entries.in
-
-cat /tmp/gl_entries.in \
- /tmp/glext_entries.in \
- /tmp/gl2_entries.in \
- /tmp/gl2ext_entries.in \
- | sort -t, -k2 \
- | awk -F, '!_[$2]++' \
- > ../entries.in
-
-./gltracegen ../entries.in >../trace.in
-
-cat ../../include/GLES/gl.h \
- ../../include/GLES/glext.h \
- ../../include/GLES2/gl2.h \
- ../../include/GLES2/gl2ext.h \
- | ./glenumsgen \
- | sort \
- > ../enums.in
-
diff --git a/opengl/libs/tools/glapigen b/opengl/libs/tools/glapigen
deleted file mode 100755
index 4d8334f..0000000
--- a/opengl/libs/tools/glapigen
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /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;
-
-sub rtrim($)
-{
- my $string = shift;
- $string =~ s/\s+$//;
- return $string;
-}
-
-while (my $line = <>) {
- next if $line =~ /^\//;
- next if $line =~ /^#/;
- next if $line =~ /^\s*$/;
- if ($line !~ /^GL_API(CALL)?\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
- next;
- }
- my $type = rtrim($2);
- my $name = $3;
- my $args = $4;
-
- #printf("%s", $line);
-
- my $prefix = "";
- if ($name eq "glGetString") {
- $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 ", ";
- #
- # 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");
- printf("}\n");
-}
-
-
-
-
-
diff --git a/opengl/libs/tools/glentrygen b/opengl/libs/tools/glentrygen
deleted file mode 100755
index 170f041..0000000
--- a/opengl/libs/tools/glentrygen
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /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;
-
-sub rtrim($)
-{
- my $string = shift;
- $string =~ s/\s+$//;
- return $string;
-}
-
-while (my $line = <>) {
- next if $line =~ /^\//;
- next if $line =~ /^#/;
- next if $line =~ /^\s*$/;
- if ($line !~ /^GL_API(CALL)?\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
- next;
- }
- my $type = rtrim($2);
- my $name = $3;
- my $args = $4;
-
- printf("GL_ENTRY(%s, %s, %s)\n", $type, $name, $args);
-}
diff --git a/opengl/libs/tools/glenumsgen b/opengl/libs/tools/glenumsgen
deleted file mode 100755
index 2ae5fbf..0000000
--- a/opengl/libs/tools/glenumsgen
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /usr/bin/perl
-#
-# Copyright (C) 2010 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 %enumHash = ();
-
-while (my $line = <STDIN>) {
- next if $line =~ /^\//;
- # Skip bitfield definitions.
- next if $line =~ /_BIT(\d+_|\s+)/;
- if ($line !~ /^#define\s+(\S+)\s+(0x\S+)/) {
- next;
- }
- my $enumName = $1;
- my $enumValue = $2;
- next if exists($enumHash { $enumValue });
- $enumHash { $enumValue } = $enumName;
- printf("GL_ENUM(%s,%s)\n", $enumValue, $enumName);
-}
-
-
-
-
-
diff --git a/opengl/libs/tools/gltracegen b/opengl/libs/tools/gltracegen
deleted file mode 100755
index da42653..0000000
--- a/opengl/libs/tools/gltracegen
+++ /dev/null
@@ -1,95 +0,0 @@
-#! /usr/bin/perl
-#
-# Copyright (C) 2010 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;
-
-sub rtrim($)
-{
- my $string = shift;
- $string =~ s/\s+$//;
- return $string;
-}
-
-while (my $line = <>) {
- next if $line =~ /^\//;
- next if $line =~ /^#/;
- next if $line =~ /^\s*$/;
- if ($line !~ /^GL_ENTRY\(([^,]+), ([^,]+), ([^\)]+)\)/) {
- next;
- }
- my $type = $1;
- my $name = $2;
- my $args = $3;
-
- my @args = split ',', $args;
- my $len = scalar(@args);
- my $nonVoidArgLen = 0;
- for (my $num = 0; $num < $len; $num++) {
- if ($args[$num] ne "void") {
- $nonVoidArgLen++;
- }
- }
- if ($type eq "void") {
- printf("TRACE_GL_VOID(");
- } else {
- printf("TRACE_GL(%s, ", $type);
- }
-
- printf("%s, (%s), (", $name, $args);
- for (my $num = 0; $num < $len; $num++) {
- if ($args[$num] ne "void") {
- if ($num > 0) {
- print ", ";
- }
- #
- # 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("), %d", $nonVoidArgLen);
- for (my $num = 0; $num < $len; $num++) {
- if ($args[$num] ne "void") {
- #
- # extract the name from the parameter
- # type name
- # const type *name
- # type *name
- # type name[4]
- #
- my $arg = $args[$num];
- if ($arg =~ /(\S+\s)+\**\s*([\w]+)/) {
- my $name = $2;
- if ($arg =~ /((const )*(\S+\s)+\**)\s*([\w]+)/) {
- my $type = rtrim($1);
- printf(", \"%s\", %s", $type, $name);
- }
- }
- }
- }
- printf(")\n");
-}
-
-
-
-
-
diff --git a/opengl/libs/trace.in b/opengl/libs/trace.in
deleted file mode 100644
index a5c5c84..0000000
--- a/opengl/libs/trace.in
+++ /dev/null
@@ -1,437 +0,0 @@
-TRACE_GL_VOID(glActiveShaderProgramEXT, (GLuint pipeline, GLuint program), (pipeline, program), 2, "GLuint", pipeline, "GLuint", program)
-TRACE_GL_VOID(glActiveTexture, (GLenum texture), (texture), 1, "GLenum", texture)
-TRACE_GL_VOID(glAlphaFunc, (GLenum func, GLclampf ref), (func, ref), 2, "GLenum", func, "GLclampf", ref)
-TRACE_GL_VOID(glAlphaFuncQCOM, (GLenum func, GLclampf ref), (func, ref), 2, "GLenum", func, "GLclampf", ref)
-TRACE_GL_VOID(glAlphaFuncx, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref)
-TRACE_GL_VOID(glAlphaFuncxOES, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref)
-TRACE_GL_VOID(glAttachShader, (GLuint program, GLuint shader), (program, shader), 2, "GLuint", program, "GLuint", shader)
-TRACE_GL_VOID(glBeginPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor)
-TRACE_GL_VOID(glBeginQueryEXT, (GLenum target, GLuint id), (target, id), 2, "GLenum", target, "GLuint", id)
-TRACE_GL_VOID(glBindAttribLocation, (GLuint program, GLuint index, const GLchar* name), (program, index, name), 3, "GLuint", program, "GLuint", index, "const GLchar*", name)
-TRACE_GL_VOID(glBindBuffer, (GLenum target, GLuint buffer), (target, buffer), 2, "GLenum", target, "GLuint", buffer)
-TRACE_GL_VOID(glBindFramebuffer, (GLenum target, GLuint framebuffer), (target, framebuffer), 2, "GLenum", target, "GLuint", framebuffer)
-TRACE_GL_VOID(glBindFramebufferOES, (GLenum target, GLuint framebuffer), (target, framebuffer), 2, "GLenum", target, "GLuint", framebuffer)
-TRACE_GL_VOID(glBindProgramPipelineEXT, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline)
-TRACE_GL_VOID(glBindRenderbuffer, (GLenum target, GLuint renderbuffer), (target, renderbuffer), 2, "GLenum", target, "GLuint", renderbuffer)
-TRACE_GL_VOID(glBindRenderbufferOES, (GLenum target, GLuint renderbuffer), (target, renderbuffer), 2, "GLenum", target, "GLuint", renderbuffer)
-TRACE_GL_VOID(glBindTexture, (GLenum target, GLuint texture), (target, texture), 2, "GLenum", target, "GLuint", texture)
-TRACE_GL_VOID(glBindVertexArrayOES, (GLuint array), (array), 1, "GLuint", array)
-TRACE_GL_VOID(glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha), 4, "GLclampf", red, "GLclampf", green, "GLclampf", blue, "GLclampf", alpha)
-TRACE_GL_VOID(glBlendEquation, ( GLenum mode ), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glBlendEquationOES, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha), 2, "GLenum", modeRGB, "GLenum", modeAlpha)
-TRACE_GL_VOID(glBlendEquationSeparateOES, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha), 2, "GLenum", modeRGB, "GLenum", modeAlpha)
-TRACE_GL_VOID(glBlendFunc, (GLenum sfactor, GLenum dfactor), (sfactor, dfactor), 2, "GLenum", sfactor, "GLenum", dfactor)
-TRACE_GL_VOID(glBlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha), 4, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha)
-TRACE_GL_VOID(glBlendFuncSeparateOES, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha), 4, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha)
-TRACE_GL_VOID(glBlitFramebufferANGLE, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter), (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), 10, "GLint", srcX0, "GLint", srcY0, "GLint", srcX1, "GLint", srcY1, "GLint", dstX0, "GLint", dstY0, "GLint", dstX1, "GLint", dstY1, "GLbitfield", mask, "GLenum", filter)
-TRACE_GL_VOID(glBufferData, (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage), (target, size, data, usage), 4, "GLenum", target, "GLsizeiptr", size, "const GLvoid *", data, "GLenum", usage)
-TRACE_GL_VOID(glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data), (target, offset, size, data), 4, "GLenum", target, "GLintptr", offset, "GLsizeiptr", size, "const GLvoid *", data)
-TRACE_GL(GLenum, glCheckFramebufferStatus, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL(GLenum, glCheckFramebufferStatusOES, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glClear, (GLbitfield mask), (mask), 1, "GLbitfield", mask)
-TRACE_GL_VOID(glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha), 4, "GLclampf", red, "GLclampf", green, "GLclampf", blue, "GLclampf", alpha)
-TRACE_GL_VOID(glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha)
-TRACE_GL_VOID(glClearColorxOES, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha)
-TRACE_GL_VOID(glClearDepthf, (GLclampf depth), (depth), 1, "GLclampf", depth)
-TRACE_GL_VOID(glClearDepthfOES, (GLclampf depth), (depth), 1, "GLclampf", depth)
-TRACE_GL_VOID(glClearDepthx, (GLclampx depth), (depth), 1, "GLclampx", depth)
-TRACE_GL_VOID(glClearDepthxOES, (GLclampx depth), (depth), 1, "GLclampx", depth)
-TRACE_GL_VOID(glClearStencil, (GLint s), (s), 1, "GLint", s)
-TRACE_GL_VOID(glClientActiveTexture, (GLenum texture), (texture), 1, "GLenum", texture)
-TRACE_GL_VOID(glClipPlanef, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation)
-TRACE_GL_VOID(glClipPlanefIMG, (GLenum p, const GLfloat *eqn), (p, eqn), 2, "GLenum", p, "const GLfloat *", eqn)
-TRACE_GL_VOID(glClipPlanefOES, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation)
-TRACE_GL_VOID(glClipPlanex, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation)
-TRACE_GL_VOID(glClipPlanexIMG, (GLenum p, const GLfixed *eqn), (p, eqn), 2, "GLenum", p, "const GLfixed *", eqn)
-TRACE_GL_VOID(glClipPlanexOES, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation)
-TRACE_GL_VOID(glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha), 4, "GLfloat", red, "GLfloat", green, "GLfloat", blue, "GLfloat", alpha)
-TRACE_GL_VOID(glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha), 4, "GLubyte", red, "GLubyte", green, "GLubyte", blue, "GLubyte", alpha)
-TRACE_GL_VOID(glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha)
-TRACE_GL_VOID(glColor4xOES, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha)
-TRACE_GL_VOID(glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), (red, green, blue, alpha), 4, "GLboolean", red, "GLboolean", green, "GLboolean", blue, "GLboolean", alpha)
-TRACE_GL_VOID(glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glCompileShader, (GLuint shader), (shader), 1, "GLuint", shader)
-TRACE_GL_VOID(glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data), (target, level, internalformat, width, height, border, imageSize, data), 8, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLint", border, "GLsizei", imageSize, "const GLvoid *", data)
-TRACE_GL_VOID(glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data), (target, level, internalformat, width, height, depth, border, imageSize, data), 9, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLsizei", imageSize, "const GLvoid*", data)
-TRACE_GL_VOID(glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data), (target, level, xoffset, yoffset, width, height, format, imageSize, data), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLsizei", imageSize, "const GLvoid *", data)
-TRACE_GL_VOID(glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLsizei", imageSize, "const GLvoid*", data)
-TRACE_GL_VOID(glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), (target, level, internalformat, x, y, width, height, border), 8, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLint", border)
-TRACE_GL_VOID(glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, x, y, width, height), 8, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glCopyTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, zoffset, x, y, width, height), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glCoverageMaskNV, (GLboolean mask), (mask), 1, "GLboolean", mask)
-TRACE_GL_VOID(glCoverageOperationNV, (GLenum operation), (operation), 1, "GLenum", operation)
-TRACE_GL(GLuint, glCreateProgram, (void), (), 0)
-TRACE_GL(GLuint, glCreateShader, (GLenum type), (type), 1, "GLenum", type)
-TRACE_GL(GLuint, glCreateShaderProgramvEXT, (GLenum type, GLsizei count, const GLchar **strings), (type, count, strings), 3, "GLenum", type, "GLsizei", count, "const GLchar **", strings)
-TRACE_GL_VOID(glCullFace, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glCurrentPaletteMatrixOES, (GLuint matrixpaletteindex), (matrixpaletteindex), 1, "GLuint", matrixpaletteindex)
-TRACE_GL_VOID(glDeleteBuffers, (GLsizei n, const GLuint *buffers), (n, buffers), 2, "GLsizei", n, "const GLuint *", buffers)
-TRACE_GL_VOID(glDeleteFencesNV, (GLsizei n, const GLuint *fences), (n, fences), 2, "GLsizei", n, "const GLuint *", fences)
-TRACE_GL_VOID(glDeleteFramebuffers, (GLsizei n, const GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint*", framebuffers)
-TRACE_GL_VOID(glDeleteFramebuffersOES, (GLsizei n, const GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint*", framebuffers)
-TRACE_GL_VOID(glDeletePerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors)
-TRACE_GL_VOID(glDeleteProgram, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL_VOID(glDeleteProgramPipelinesEXT, (GLsizei n, const GLuint *pipelines), (n, pipelines), 2, "GLsizei", n, "const GLuint *", pipelines)
-TRACE_GL_VOID(glDeleteQueriesEXT, (GLsizei n, const GLuint *ids), (n, ids), 2, "GLsizei", n, "const GLuint *", ids)
-TRACE_GL_VOID(glDeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint*", renderbuffers)
-TRACE_GL_VOID(glDeleteRenderbuffersOES, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint*", renderbuffers)
-TRACE_GL_VOID(glDeleteShader, (GLuint shader), (shader), 1, "GLuint", shader)
-TRACE_GL_VOID(glDeleteTextures, (GLsizei n, const GLuint *textures), (n, textures), 2, "GLsizei", n, "const GLuint *", textures)
-TRACE_GL_VOID(glDeleteVertexArraysOES, (GLsizei n, const GLuint *arrays), (n, arrays), 2, "GLsizei", n, "const GLuint *", arrays)
-TRACE_GL_VOID(glDepthFunc, (GLenum func), (func), 1, "GLenum", func)
-TRACE_GL_VOID(glDepthMask, (GLboolean flag), (flag), 1, "GLboolean", flag)
-TRACE_GL_VOID(glDepthRangef, (GLclampf zNear, GLclampf zFar), (zNear, zFar), 2, "GLclampf", zNear, "GLclampf", zFar)
-TRACE_GL_VOID(glDepthRangefOES, (GLclampf zNear, GLclampf zFar), (zNear, zFar), 2, "GLclampf", zNear, "GLclampf", zFar)
-TRACE_GL_VOID(glDepthRangex, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar)
-TRACE_GL_VOID(glDepthRangexOES, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar)
-TRACE_GL_VOID(glDetachShader, (GLuint program, GLuint shader), (program, shader), 2, "GLuint", program, "GLuint", shader)
-TRACE_GL_VOID(glDisable, (GLenum cap), (cap), 1, "GLenum", cap)
-TRACE_GL_VOID(glDisableClientState, (GLenum array), (array), 1, "GLenum", array)
-TRACE_GL_VOID(glDisableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl)
-TRACE_GL_VOID(glDisableVertexAttribArray, (GLuint index), (index), 1, "GLuint", index)
-TRACE_GL_VOID(glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum *attachments), (target, numAttachments, attachments), 3, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments)
-TRACE_GL_VOID(glDrawArrays, (GLenum mode, GLint first, GLsizei count), (mode, first, count), 3, "GLenum", mode, "GLint", first, "GLsizei", count)
-TRACE_GL_VOID(glDrawBuffersNV, (GLsizei n, const GLenum *bufs), (n, bufs), 2, "GLsizei", n, "const GLenum *", bufs)
-TRACE_GL_VOID(glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices), (mode, count, type, indices), 4, "GLenum", mode, "GLsizei", count, "GLenum", type, "const GLvoid *", indices)
-TRACE_GL_VOID(glDrawTexfOES, (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), (x, y, z, width, height), 5, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", width, "GLfloat", height)
-TRACE_GL_VOID(glDrawTexfvOES, (const GLfloat *coords), (coords), 1, "const GLfloat *", coords)
-TRACE_GL_VOID(glDrawTexiOES, (GLint x, GLint y, GLint z, GLint width, GLint height), (x, y, z, width, height), 5, "GLint", x, "GLint", y, "GLint", z, "GLint", width, "GLint", height)
-TRACE_GL_VOID(glDrawTexivOES, (const GLint *coords), (coords), 1, "const GLint *", coords)
-TRACE_GL_VOID(glDrawTexsOES, (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), (x, y, z, width, height), 5, "GLshort", x, "GLshort", y, "GLshort", z, "GLshort", width, "GLshort", height)
-TRACE_GL_VOID(glDrawTexsvOES, (const GLshort *coords), (coords), 1, "const GLshort *", coords)
-TRACE_GL_VOID(glDrawTexxOES, (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), (x, y, z, width, height), 5, "GLfixed", x, "GLfixed", y, "GLfixed", z, "GLfixed", width, "GLfixed", height)
-TRACE_GL_VOID(glDrawTexxvOES, (const GLfixed *coords), (coords), 1, "const GLfixed *", coords)
-TRACE_GL_VOID(glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image)
-TRACE_GL_VOID(glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image)
-TRACE_GL_VOID(glEnable, (GLenum cap), (cap), 1, "GLenum", cap)
-TRACE_GL_VOID(glEnableClientState, (GLenum array), (array), 1, "GLenum", array)
-TRACE_GL_VOID(glEnableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl)
-TRACE_GL_VOID(glEnableVertexAttribArray, (GLuint index), (index), 1, "GLuint", index)
-TRACE_GL_VOID(glEndPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor)
-TRACE_GL_VOID(glEndQueryEXT, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glEndTilingQCOM, (GLbitfield preserveMask), (preserveMask), 1, "GLbitfield", preserveMask)
-TRACE_GL_VOID(glExtGetBufferPointervQCOM, (GLenum target, GLvoid **params), (target, params), 2, "GLenum", target, "GLvoid **", params)
-TRACE_GL_VOID(glExtGetBuffersQCOM, (GLuint *buffers, GLint maxBuffers, GLint *numBuffers), (buffers, maxBuffers, numBuffers), 3, "GLuint *", buffers, "GLint", maxBuffers, "GLint *", numBuffers)
-TRACE_GL_VOID(glExtGetFramebuffersQCOM, (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers), (framebuffers, maxFramebuffers, numFramebuffers), 3, "GLuint *", framebuffers, "GLint", maxFramebuffers, "GLint *", numFramebuffers)
-TRACE_GL_VOID(glExtGetProgramBinarySourceQCOM, (GLuint program, GLenum shadertype, GLchar *source, GLint *length), (program, shadertype, source, length), 4, "GLuint", program, "GLenum", shadertype, "GLchar *", source, "GLint *", length)
-TRACE_GL_VOID(glExtGetProgramsQCOM, (GLuint *programs, GLint maxPrograms, GLint *numPrograms), (programs, maxPrograms, numPrograms), 3, "GLuint *", programs, "GLint", maxPrograms, "GLint *", numPrograms)
-TRACE_GL_VOID(glExtGetRenderbuffersQCOM, (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers), (renderbuffers, maxRenderbuffers, numRenderbuffers), 3, "GLuint *", renderbuffers, "GLint", maxRenderbuffers, "GLint *", numRenderbuffers)
-TRACE_GL_VOID(glExtGetShadersQCOM, (GLuint *shaders, GLint maxShaders, GLint *numShaders), (shaders, maxShaders, numShaders), 3, "GLuint *", shaders, "GLint", maxShaders, "GLint *", numShaders)
-TRACE_GL_VOID(glExtGetTexLevelParameterivQCOM, (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params), (texture, face, level, pname, params), 5, "GLuint", texture, "GLenum", face, "GLint", level, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glExtGetTexSubImageQCOM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "GLvoid *", texels)
-TRACE_GL_VOID(glExtGetTexturesQCOM, (GLuint *textures, GLint maxTextures, GLint *numTextures), (textures, maxTextures, numTextures), 3, "GLuint *", textures, "GLint", maxTextures, "GLint *", numTextures)
-TRACE_GL(GLboolean, glExtIsProgramBinaryQCOM, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL_VOID(glExtTexObjectStateOverrideiQCOM, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glFinish, (void), (), 0)
-TRACE_GL_VOID(glFinishFenceNV, (GLuint fence), (fence), 1, "GLuint", fence)
-TRACE_GL_VOID(glFlush, (void), (), 0)
-TRACE_GL_VOID(glFogf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glFogfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glFogx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glFogxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glFogxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glFogxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer), 4, "GLenum", target, "GLenum", attachment, "GLenum", renderbuffertarget, "GLuint", renderbuffer)
-TRACE_GL_VOID(glFramebufferRenderbufferOES, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer), 4, "GLenum", target, "GLenum", attachment, "GLenum", renderbuffertarget, "GLuint", renderbuffer)
-TRACE_GL_VOID(glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level), 5, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level)
-TRACE_GL_VOID(glFramebufferTexture2DMultisampleEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples), (target, attachment, textarget, texture, level, samples), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLsizei", samples)
-TRACE_GL_VOID(glFramebufferTexture2DMultisampleIMG, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples), (target, attachment, textarget, texture, level, samples), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLsizei", samples)
-TRACE_GL_VOID(glFramebufferTexture2DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level), 5, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level)
-TRACE_GL_VOID(glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset), (target, attachment, textarget, texture, level, zoffset), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLint", zoffset)
-TRACE_GL_VOID(glFrontFace, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glFrustumf, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glFrustumfOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glFrustumxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glGenBuffers, (GLsizei n, GLuint *buffers), (n, buffers), 2, "GLsizei", n, "GLuint *", buffers)
-TRACE_GL_VOID(glGenFencesNV, (GLsizei n, GLuint *fences), (n, fences), 2, "GLsizei", n, "GLuint *", fences)
-TRACE_GL_VOID(glGenFramebuffers, (GLsizei n, GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint*", framebuffers)
-TRACE_GL_VOID(glGenFramebuffersOES, (GLsizei n, GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint*", framebuffers)
-TRACE_GL_VOID(glGenPerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors)
-TRACE_GL_VOID(glGenProgramPipelinesEXT, (GLsizei n, GLuint *pipelines), (n, pipelines), 2, "GLsizei", n, "GLuint *", pipelines)
-TRACE_GL_VOID(glGenQueriesEXT, (GLsizei n, GLuint *ids), (n, ids), 2, "GLsizei", n, "GLuint *", ids)
-TRACE_GL_VOID(glGenRenderbuffers, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint*", renderbuffers)
-TRACE_GL_VOID(glGenRenderbuffersOES, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint*", renderbuffers)
-TRACE_GL_VOID(glGenTextures, (GLsizei n, GLuint *textures), (n, textures), 2, "GLsizei", n, "GLuint *", textures)
-TRACE_GL_VOID(glGenVertexArraysOES, (GLsizei n, GLuint *arrays), (n, arrays), 2, "GLsizei", n, "GLuint *", arrays)
-TRACE_GL_VOID(glGenerateMipmap, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glGenerateMipmapOES, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name)
-TRACE_GL_VOID(glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name)
-TRACE_GL_VOID(glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders), 4, "GLuint", program, "GLsizei", maxcount, "GLsizei*", count, "GLuint*", shaders)
-TRACE_GL(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
-TRACE_GL_VOID(glGetBooleanv, (GLenum pname, GLboolean *params), (pname, params), 2, "GLenum", pname, "GLboolean *", params)
-TRACE_GL_VOID(glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params)
-TRACE_GL_VOID(glGetClipPlanef, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn)
-TRACE_GL_VOID(glGetClipPlanefOES, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn)
-TRACE_GL_VOID(glGetClipPlanex, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn)
-TRACE_GL_VOID(glGetClipPlanexOES, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn)
-TRACE_GL_VOID(glGetDriverControlStringQCOM, (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString), (driverControl, bufSize, length, driverControlString), 4, "GLuint", driverControl, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", driverControlString)
-TRACE_GL_VOID(glGetDriverControlsQCOM, (GLint *num, GLsizei size, GLuint *driverControls), (num, size, driverControls), 3, "GLint *", num, "GLsizei", size, "GLuint *", driverControls)
-TRACE_GL(GLenum, glGetError, (void), (), 0)
-TRACE_GL_VOID(glGetFenceivNV, (GLuint fence, GLenum pname, GLint *params), (fence, pname, params), 3, "GLuint", fence, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetFixedv, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetFixedvOES, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetFloatv, (GLenum pname, GLfloat *params), (pname, params), 2, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetFramebufferAttachmentParameterivOES, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint*", params)
-TRACE_GL(GLenum, glGetGraphicsResetStatusEXT, (void), (), 0)
-TRACE_GL_VOID(glGetIntegerv, (GLenum pname, GLint *params), (pname, params), 2, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetLightfv, (GLenum light, GLenum pname, GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetLightxv, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetLightxvOES, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetMaterialxv, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetMaterialxvOES, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetObjectLabelEXT, (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label), (type, object, bufSize, length, label), 5, "GLenum", type, "GLuint", object, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", label)
-TRACE_GL_VOID(glGetPerfMonitorCounterDataAMD, (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten), (monitor, pname, dataSize, data, bytesWritten), 5, "GLuint", monitor, "GLenum", pname, "GLsizei", dataSize, "GLuint *", data, "GLint *", bytesWritten)
-TRACE_GL_VOID(glGetPerfMonitorCounterInfoAMD, (GLuint group, GLuint counter, GLenum pname, GLvoid *data), (group, counter, pname, data), 4, "GLuint", group, "GLuint", counter, "GLenum", pname, "GLvoid *", data)
-TRACE_GL_VOID(glGetPerfMonitorCounterStringAMD, (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString), (group, counter, bufSize, length, counterString), 5, "GLuint", group, "GLuint", counter, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", counterString)
-TRACE_GL_VOID(glGetPerfMonitorCountersAMD, (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters), (group, numCounters, maxActiveCounters, counterSize, counters), 5, "GLuint", group, "GLint *", numCounters, "GLint *", maxActiveCounters, "GLsizei", counterSize, "GLuint *", counters)
-TRACE_GL_VOID(glGetPerfMonitorGroupStringAMD, (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString), (group, bufSize, length, groupString), 4, "GLuint", group, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", groupString)
-TRACE_GL_VOID(glGetPerfMonitorGroupsAMD, (GLint *numGroups, GLsizei groupsSize, GLuint *groups), (numGroups, groupsSize, groups), 3, "GLint *", numGroups, "GLsizei", groupsSize, "GLuint *", groups)
-TRACE_GL_VOID(glGetPointerv, (GLenum pname, GLvoid **params), (pname, params), 2, "GLenum", pname, "GLvoid **", params)
-TRACE_GL_VOID(glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary), (program, bufSize, length, binaryFormat, binary), 5, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLenum *", binaryFormat, "GLvoid *", binary)
-TRACE_GL_VOID(glGetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog), (program, bufsize, length, infolog), 4, "GLuint", program, "GLsizei", bufsize, "GLsizei*", length, "GLchar*", infolog)
-TRACE_GL_VOID(glGetProgramPipelineInfoLogEXT, (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog), (pipeline, bufSize, length, infoLog), 4, "GLuint", pipeline, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", infoLog)
-TRACE_GL_VOID(glGetProgramPipelineivEXT, (GLuint pipeline, GLenum pname, GLint *params), (pipeline, pname, params), 3, "GLuint", pipeline, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetProgramiv, (GLuint program, GLenum pname, GLint* params), (program, pname, params), 3, "GLuint", program, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetQueryObjectuivEXT, (GLuint id, GLenum pname, GLuint *params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLuint *", params)
-TRACE_GL_VOID(glGetQueryivEXT, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetRenderbufferParameterivOES, (GLenum target, GLenum pname, GLint* params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog), (shader, bufsize, length, infolog), 4, "GLuint", shader, "GLsizei", bufsize, "GLsizei*", length, "GLchar*", infolog)
-TRACE_GL_VOID(glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision), (shadertype, precisiontype, range, precision), 4, "GLenum", shadertype, "GLenum", precisiontype, "GLint*", range, "GLint*", precision)
-TRACE_GL_VOID(glGetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source), (shader, bufsize, length, source), 4, "GLuint", shader, "GLsizei", bufsize, "GLsizei*", length, "GLchar*", source)
-TRACE_GL_VOID(glGetShaderiv, (GLuint shader, GLenum pname, GLint* params), (shader, pname, params), 3, "GLuint", shader, "GLenum", pname, "GLint*", params)
-TRACE_GL(const GLubyte *, glGetString, (GLenum name), (name), 1, "GLenum", name)
-TRACE_GL_VOID(glGetTexEnvfv, (GLenum env, GLenum pname, GLfloat *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetTexEnviv, (GLenum env, GLenum pname, GLint *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetTexEnvxv, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexEnvxvOES, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexGenfvOES, (GLenum coord, GLenum pname, GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetTexGenivOES, (GLenum coord, GLenum pname, GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetTexGenxvOES, (GLenum coord, GLenum pname, GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfloat *", params)
-TRACE_GL_VOID(glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
-TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
-TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
-TRACE_GL(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
-TRACE_GL_VOID(glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLfloat*", params)
-TRACE_GL_VOID(glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLint*", params)
-TRACE_GL_VOID(glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer), 3, "GLuint", index, "GLenum", pname, "GLvoid**", pointer)
-TRACE_GL_VOID(glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLfloat*", params)
-TRACE_GL_VOID(glGetVertexAttribiv, (GLuint index, GLenum pname, GLint* params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLint*", params)
-TRACE_GL_VOID(glGetnUniformfvEXT, (GLuint program, GLint location, GLsizei bufSize, float *params), (program, location, bufSize, params), 4, "GLuint", program, "GLint", location, "GLsizei", bufSize, "float *", params)
-TRACE_GL_VOID(glGetnUniformivEXT, (GLuint program, GLint location, GLsizei bufSize, GLint *params), (program, location, bufSize, params), 4, "GLuint", program, "GLint", location, "GLsizei", bufSize, "GLint *", params)
-TRACE_GL_VOID(glHint, (GLenum target, GLenum mode), (target, mode), 2, "GLenum", target, "GLenum", mode)
-TRACE_GL_VOID(glInsertEventMarkerEXT, (GLsizei length, const GLchar *marker), (length, marker), 2, "GLsizei", length, "const GLchar *", marker)
-TRACE_GL(GLboolean, glIsBuffer, (GLuint buffer), (buffer), 1, "GLuint", buffer)
-TRACE_GL(GLboolean, glIsEnabled, (GLenum cap), (cap), 1, "GLenum", cap)
-TRACE_GL(GLboolean, glIsFenceNV, (GLuint fence), (fence), 1, "GLuint", fence)
-TRACE_GL(GLboolean, glIsFramebuffer, (GLuint framebuffer), (framebuffer), 1, "GLuint", framebuffer)
-TRACE_GL(GLboolean, glIsFramebufferOES, (GLuint framebuffer), (framebuffer), 1, "GLuint", framebuffer)
-TRACE_GL(GLboolean, glIsProgram, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL(GLboolean, glIsProgramPipelineEXT, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline)
-TRACE_GL(GLboolean, glIsQueryEXT, (GLuint id), (id), 1, "GLuint", id)
-TRACE_GL(GLboolean, glIsRenderbuffer, (GLuint renderbuffer), (renderbuffer), 1, "GLuint", renderbuffer)
-TRACE_GL(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer), (renderbuffer), 1, "GLuint", renderbuffer)
-TRACE_GL(GLboolean, glIsShader, (GLuint shader), (shader), 1, "GLuint", shader)
-TRACE_GL(GLboolean, glIsTexture, (GLuint texture), (texture), 1, "GLuint", texture)
-TRACE_GL(GLboolean, glIsVertexArrayOES, (GLuint array), (array), 1, "GLuint", array)
-TRACE_GL_VOID(glLabelObjectEXT, (GLenum type, GLuint object, GLsizei length, const GLchar *label), (type, object, length, label), 4, "GLenum", type, "GLuint", object, "GLsizei", length, "const GLchar *", label)
-TRACE_GL_VOID(glLightModelf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glLightModelfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glLightModelx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightModelxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightModelxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLightModelxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLightf, (GLenum light, GLenum pname, GLfloat param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glLightfv, (GLenum light, GLenum pname, const GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glLightx, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightxOES, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glLightxv, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLightxvOES, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glLineWidth, (GLfloat width), (width), 1, "GLfloat", width)
-TRACE_GL_VOID(glLineWidthx, (GLfixed width), (width), 1, "GLfixed", width)
-TRACE_GL_VOID(glLineWidthxOES, (GLfixed width), (width), 1, "GLfixed", width)
-TRACE_GL_VOID(glLinkProgram, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL_VOID(glLoadIdentity, (void), (), 0)
-TRACE_GL_VOID(glLoadMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m)
-TRACE_GL_VOID(glLoadMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glLoadMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glLoadPaletteFromModelViewMatrixOES, (void), (), 0)
-TRACE_GL_VOID(glLogicOp, (GLenum opcode), (opcode), 1, "GLenum", opcode)
-TRACE_GL(void*, glMapBufferOES, (GLenum target, GLenum access), (target, access), 2, "GLenum", target, "GLenum", access)
-TRACE_GL_VOID(glMaterialf, (GLenum face, GLenum pname, GLfloat param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glMaterialx, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glMaterialxOES, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glMaterialxvOES, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glMatrixIndexPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glMatrixMode, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glMultMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m)
-TRACE_GL_VOID(glMultMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glMultMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m)
-TRACE_GL_VOID(glMultiDrawArraysEXT, (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "GLint *", first, "GLsizei *", count, "GLsizei", primcount)
-TRACE_GL_VOID(glMultiDrawElementsEXT, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "const GLsizei *", count, "GLenum", type, "const GLvoid* *", indices, "GLsizei", primcount)
-TRACE_GL_VOID(glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), (target, s, t, r, q), 5, "GLenum", target, "GLfloat", s, "GLfloat", t, "GLfloat", r, "GLfloat", q)
-TRACE_GL_VOID(glMultiTexCoord4x, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q)
-TRACE_GL_VOID(glMultiTexCoord4xOES, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q)
-TRACE_GL_VOID(glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz), 3, "GLfloat", nx, "GLfloat", ny, "GLfloat", nz)
-TRACE_GL_VOID(glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz)
-TRACE_GL_VOID(glNormal3xOES, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz)
-TRACE_GL_VOID(glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glOrthofOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar)
-TRACE_GL_VOID(glOrthox, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glOrthoxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar)
-TRACE_GL_VOID(glPixelStorei, (GLenum pname, GLint param), (pname, param), 2, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glPointParameterf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glPointParameterfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glPointParameterx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glPointParameterxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glPointParameterxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glPointParameterxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glPointSize, (GLfloat size), (size), 1, "GLfloat", size)
-TRACE_GL_VOID(glPointSizePointerOES, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glPointSizex, (GLfixed size), (size), 1, "GLfixed", size)
-TRACE_GL_VOID(glPointSizexOES, (GLfixed size), (size), 1, "GLfixed", size)
-TRACE_GL_VOID(glPolygonOffset, (GLfloat factor, GLfloat units), (factor, units), 2, "GLfloat", factor, "GLfloat", units)
-TRACE_GL_VOID(glPolygonOffsetx, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units)
-TRACE_GL_VOID(glPolygonOffsetxOES, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units)
-TRACE_GL_VOID(glPopGroupMarkerEXT, (void), (), 0)
-TRACE_GL_VOID(glPopMatrix, (void), (), 0)
-TRACE_GL_VOID(glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length), (program, binaryFormat, binary, length), 4, "GLuint", program, "GLenum", binaryFormat, "const GLvoid *", binary, "GLint", length)
-TRACE_GL_VOID(glProgramParameteriEXT, (GLuint program, GLenum pname, GLint value), (program, pname, value), 3, "GLuint", program, "GLenum", pname, "GLint", value)
-TRACE_GL_VOID(glProgramUniform1fEXT, (GLuint program, GLint location, GLfloat x), (program, location, x), 3, "GLuint", program, "GLint", location, "GLfloat", x)
-TRACE_GL_VOID(glProgramUniform1fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value)
-TRACE_GL_VOID(glProgramUniform1iEXT, (GLuint program, GLint location, GLint x), (program, location, x), 3, "GLuint", program, "GLint", location, "GLint", x)
-TRACE_GL_VOID(glProgramUniform1ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value)
-TRACE_GL_VOID(glProgramUniform2fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y), (program, location, x, y), 4, "GLuint", program, "GLint", location, "GLfloat", x, "GLfloat", y)
-TRACE_GL_VOID(glProgramUniform2fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value)
-TRACE_GL_VOID(glProgramUniform2iEXT, (GLuint program, GLint location, GLint x, GLint y), (program, location, x, y), 4, "GLuint", program, "GLint", location, "GLint", x, "GLint", y)
-TRACE_GL_VOID(glProgramUniform2ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value)
-TRACE_GL_VOID(glProgramUniform3fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z), (program, location, x, y, z), 5, "GLuint", program, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glProgramUniform3fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value)
-TRACE_GL_VOID(glProgramUniform3iEXT, (GLuint program, GLint location, GLint x, GLint y, GLint z), (program, location, x, y, z), 5, "GLuint", program, "GLint", location, "GLint", x, "GLint", y, "GLint", z)
-TRACE_GL_VOID(glProgramUniform3ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value)
-TRACE_GL_VOID(glProgramUniform4fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (program, location, x, y, z, w), 6, "GLuint", program, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w)
-TRACE_GL_VOID(glProgramUniform4fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value)
-TRACE_GL_VOID(glProgramUniform4iEXT, (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w), (program, location, x, y, z, w), 6, "GLuint", program, "GLint", location, "GLint", x, "GLint", y, "GLint", z, "GLint", w)
-TRACE_GL_VOID(glProgramUniform4ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value)
-TRACE_GL_VOID(glProgramUniformMatrix2fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value)
-TRACE_GL_VOID(glProgramUniformMatrix3fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value)
-TRACE_GL_VOID(glProgramUniformMatrix4fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value)
-TRACE_GL_VOID(glPushGroupMarkerEXT, (GLsizei length, const GLchar *marker), (length, marker), 2, "GLsizei", length, "const GLchar *", marker)
-TRACE_GL_VOID(glPushMatrix, (void), (), 0)
-TRACE_GL(GLbitfield, glQueryMatrixxOES, (GLfixed mantissa[16], GLint exponent[16]), (mantissa, exponent), 2, "GLfixed", mantissa, "GLint", exponent)
-TRACE_GL_VOID(glReadBufferNV, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels), (x, y, width, height, format, type, pixels), 7, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "GLvoid *", pixels)
-TRACE_GL_VOID(glReadnPixelsEXT, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data), (x, y, width, height, format, type, bufSize, data), 8, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "GLsizei", bufSize, "void *", data)
-TRACE_GL_VOID(glReleaseShaderCompiler, (void), (), 0)
-TRACE_GL_VOID(glRenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height), 4, "GLenum", target, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRenderbufferStorageMultisampleANGLE, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRenderbufferStorageMultisampleAPPLE, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRenderbufferStorageMultisampleEXT, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRenderbufferStorageMultisampleIMG, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glRenderbufferStorageOES, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height), 4, "GLenum", target, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glResolveMultisampleFramebufferAPPLE, (void), (), 0)
-TRACE_GL_VOID(glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z), 4, "GLfloat", angle, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glRotatexOES, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glSampleCoverage, (GLclampf value, GLboolean invert), (value, invert), 2, "GLclampf", value, "GLboolean", invert)
-TRACE_GL_VOID(glSampleCoveragex, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert)
-TRACE_GL_VOID(glSampleCoveragexOES, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert)
-TRACE_GL_VOID(glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glScalex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glScalexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glScissor, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height), 4, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glSelectPerfMonitorCountersAMD, (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList), (monitor, enable, group, numCounters, countersList), 5, "GLuint", monitor, "GLboolean", enable, "GLuint", group, "GLint", numCounters, "GLuint *", countersList)
-TRACE_GL_VOID(glSetFenceNV, (GLuint fence, GLenum condition), (fence, condition), 2, "GLuint", fence, "GLenum", condition)
-TRACE_GL_VOID(glShadeModel, (GLenum mode), (mode), 1, "GLenum", mode)
-TRACE_GL_VOID(glShaderBinary, (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length), (n, shaders, binaryformat, binary, length), 5, "GLsizei", n, "const GLuint*", shaders, "GLenum", binaryformat, "const GLvoid*", binary, "GLsizei", length)
-TRACE_GL_VOID(glShaderSource, (GLuint shader, GLsizei count, const GLchar** string, const GLint* length), (shader, count, string, length), 4, "GLuint", shader, "GLsizei", count, "const GLchar**", string, "const GLint*", length)
-TRACE_GL_VOID(glStartTilingQCOM, (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask), (x, y, width, height, preserveMask), 5, "GLuint", x, "GLuint", y, "GLuint", width, "GLuint", height, "GLbitfield", preserveMask)
-TRACE_GL_VOID(glStencilFunc, (GLenum func, GLint ref, GLuint mask), (func, ref, mask), 3, "GLenum", func, "GLint", ref, "GLuint", mask)
-TRACE_GL_VOID(glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask), (face, func, ref, mask), 4, "GLenum", face, "GLenum", func, "GLint", ref, "GLuint", mask)
-TRACE_GL_VOID(glStencilMask, (GLuint mask), (mask), 1, "GLuint", mask)
-TRACE_GL_VOID(glStencilMaskSeparate, (GLenum face, GLuint mask), (face, mask), 2, "GLenum", face, "GLuint", mask)
-TRACE_GL_VOID(glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass), (fail, zfail, zpass), 3, "GLenum", fail, "GLenum", zfail, "GLenum", zpass)
-TRACE_GL_VOID(glStencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass), (face, fail, zfail, zpass), 4, "GLenum", face, "GLenum", fail, "GLenum", zfail, "GLenum", zpass)
-TRACE_GL(GLboolean, glTestFenceNV, (GLuint fence), (fence), 1, "GLuint", fence)
-TRACE_GL_VOID(glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glTexEnviv, (GLenum target, GLenum pname, const GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params)
-TRACE_GL_VOID(glTexEnvx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexEnvxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexEnvxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexEnvxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexGenfOES, (GLenum coord, GLenum pname, GLfloat param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glTexGenfvOES, (GLenum coord, GLenum pname, const GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glTexGeniOES, (GLenum coord, GLenum pname, GLint param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glTexGenivOES, (GLenum coord, GLenum pname, const GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLint *", params)
-TRACE_GL_VOID(glTexGenxOES, (GLenum coord, GLenum pname, GLfixed param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexGenxvOES, (GLenum coord, GLenum pname, const GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels), (target, level, internalformat, width, height, border, format, type, pixels), 9, "GLenum", target, "GLint", level, "GLint", internalformat, "GLsizei", width, "GLsizei", height, "GLint", border, "GLenum", format, "GLenum", type, "const GLvoid *", pixels)
-TRACE_GL_VOID(glTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels), (target, level, internalformat, width, height, depth, border, format, type, pixels), 10, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLenum", format, "GLenum", type, "const GLvoid*", pixels)
-TRACE_GL_VOID(glTexParameterf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfloat", param)
-TRACE_GL_VOID(glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params)
-TRACE_GL_VOID(glTexParameteri, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param)
-TRACE_GL_VOID(glTexParameteriv, (GLenum target, GLenum pname, const GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params)
-TRACE_GL_VOID(glTexParameterx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexParameterxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param)
-TRACE_GL_VOID(glTexParameterxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexParameterxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params)
-TRACE_GL_VOID(glTexStorage1DEXT, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width), (target, levels, internalformat, width), 4, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width)
-TRACE_GL_VOID(glTexStorage2DEXT, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height), (target, levels, internalformat, width, height), 5, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glTexStorage3DEXT, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth), (target, levels, internalformat, width, height, depth), 6, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth)
-TRACE_GL_VOID(glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels), (target, level, xoffset, yoffset, width, height, format, type, pixels), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "const GLvoid *", pixels)
-TRACE_GL_VOID(glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "const GLvoid*", pixels)
-TRACE_GL_VOID(glTextureStorage1DEXT, (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width), (texture, target, levels, internalformat, width), 5, "GLuint", texture, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width)
-TRACE_GL_VOID(glTextureStorage2DEXT, (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height), (texture, target, levels, internalformat, width, height), 6, "GLuint", texture, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glTextureStorage3DEXT, (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth), (texture, target, levels, internalformat, width, height, depth), 7, "GLuint", texture, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth)
-TRACE_GL_VOID(glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glTranslatex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glTranslatexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z)
-TRACE_GL_VOID(glUniform1f, (GLint location, GLfloat x), (location, x), 2, "GLint", location, "GLfloat", x)
-TRACE_GL_VOID(glUniform1fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v)
-TRACE_GL_VOID(glUniform1i, (GLint location, GLint x), (location, x), 2, "GLint", location, "GLint", x)
-TRACE_GL_VOID(glUniform1iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v)
-TRACE_GL_VOID(glUniform2f, (GLint location, GLfloat x, GLfloat y), (location, x, y), 3, "GLint", location, "GLfloat", x, "GLfloat", y)
-TRACE_GL_VOID(glUniform2fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v)
-TRACE_GL_VOID(glUniform2i, (GLint location, GLint x, GLint y), (location, x, y), 3, "GLint", location, "GLint", x, "GLint", y)
-TRACE_GL_VOID(glUniform2iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v)
-TRACE_GL_VOID(glUniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z), (location, x, y, z), 4, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glUniform3fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v)
-TRACE_GL_VOID(glUniform3i, (GLint location, GLint x, GLint y, GLint z), (location, x, y, z), 4, "GLint", location, "GLint", x, "GLint", y, "GLint", z)
-TRACE_GL_VOID(glUniform3iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v)
-TRACE_GL_VOID(glUniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (location, x, y, z, w), 5, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w)
-TRACE_GL_VOID(glUniform4fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v)
-TRACE_GL_VOID(glUniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w), (location, x, y, z, w), 5, "GLint", location, "GLint", x, "GLint", y, "GLint", z, "GLint", w)
-TRACE_GL_VOID(glUniform4iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v)
-TRACE_GL_VOID(glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat*", value)
-TRACE_GL_VOID(glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat*", value)
-TRACE_GL_VOID(glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat*", value)
-TRACE_GL(GLboolean, glUnmapBufferOES, (GLenum target), (target), 1, "GLenum", target)
-TRACE_GL_VOID(glUseProgram, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL_VOID(glUseProgramStagesEXT, (GLuint pipeline, GLbitfield stages, GLuint program), (pipeline, stages, program), 3, "GLuint", pipeline, "GLbitfield", stages, "GLuint", program)
-TRACE_GL_VOID(glValidateProgram, (GLuint program), (program), 1, "GLuint", program)
-TRACE_GL_VOID(glValidateProgramPipelineEXT, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline)
-TRACE_GL_VOID(glVertexAttrib1f, (GLuint indx, GLfloat x), (indx, x), 2, "GLuint", indx, "GLfloat", x)
-TRACE_GL_VOID(glVertexAttrib1fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values)
-TRACE_GL_VOID(glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y), (indx, x, y), 3, "GLuint", indx, "GLfloat", x, "GLfloat", y)
-TRACE_GL_VOID(glVertexAttrib2fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values)
-TRACE_GL_VOID(glVertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z), (indx, x, y, z), 4, "GLuint", indx, "GLfloat", x, "GLfloat", y, "GLfloat", z)
-TRACE_GL_VOID(glVertexAttrib3fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values)
-TRACE_GL_VOID(glVertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (indx, x, y, z, w), 5, "GLuint", indx, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w)
-TRACE_GL_VOID(glVertexAttrib4fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values)
-TRACE_GL_VOID(glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr), (indx, size, type, normalized, stride, ptr), 6, "GLuint", indx, "GLint", size, "GLenum", type, "GLboolean", normalized, "GLsizei", stride, "const GLvoid*", ptr)
-TRACE_GL_VOID(glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
-TRACE_GL_VOID(glViewport, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height), 4, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height)
-TRACE_GL_VOID(glWeightPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer)
diff --git a/opengl/specs/EGL_ANDROID_blob_cache.txt b/opengl/specs/EGL_ANDROID_blob_cache.txt
deleted file mode 100644
index 61f45d3..0000000
--- a/opengl/specs/EGL_ANDROID_blob_cache.txt
+++ /dev/null
@@ -1,208 +0,0 @@
-Name
-
- ANDROID_blob_cache
-
-Name Strings
-
- EGL_ANDROID_blob_cache
-
-Contributors
-
- Jamie Gennis
-
-Contact
-
- Jamie Gennis, Google Inc. (jgennis 'at' google.com)
-
-Status
-
- Draft.
-
-Version
-
- Version 1, April 22, 2011
-
-Number
-
- EGL Extension #XXX
-
-Dependencies
-
- Requires EGL 1.0
-
- This extension is written against the wording of the EGL 1.4 Specification
-
-Overview
-
- Shader compilation and optimization has been a troublesome aspect of OpenGL
- programming for a long time. It can consume seconds of CPU cycles during
- application start-up. Additionally, state-based re-compiles done
- internally by the drivers add an unpredictable element to application
- performance tuning, often leading to occasional pauses in otherwise smooth
- animations.
-
- This extension provides a mechanism through which client API
- implementations may cache shader binaries after they are compiled. It may
- then retrieve those cached shaders during subsequent executions of the same
- program. The management of the cache is handled by the application (or
- middleware), allowing it to be tuned to a particular platform or
- environment.
-
- While the focus of this extension is on providing a persistent cache for
- shader binaries, it may also be useful for caching other data. This is
- perfectly acceptable, but the guarantees provided (or lack thereof) were
- designed around the shader use case.
-
- Note that although this extension is written as if the application
- implements the caching functionality, on the Android OS it is implemented
- as part of the Android EGL module. This extension is not exposed to
- applications on Android, but will be used automatically in every
- application that uses EGL if it is supported by the underlying
- device-specific EGL implementation.
-
-New Types
-
- /*
- * EGLsizeiANDROID is a signed integer type for representing the size of a
- * memory buffer.
- */
- #include <khrplatform.h>
- typedef khronos_ssize_t EGLsizeiANDROID;
-
- /*
- * EGLSetBlobFunc is a pointer to an application-provided function that a
- * client API implementation may use to insert a key/value pair into the
- * cache.
- */
- typedef void (*EGLSetBlobFuncANDROID) (const void* key,
- EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize)
-
- /*
- * EGLGetBlobFunc is a pointer to an application-provided function that a
- * client API implementation may use to retrieve a cached value from the
- * cache.
- */
- typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key,
- EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize)
-
-New Procedures and Functions
-
- void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
- EGLSetBlobFunc set,
- EGLGetBlobFunc get);
-
-New Tokens
-
- None.
-
-Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
-
- Add a new subsection after Section 3.8, page 50
- (Synchronization Primitives)
-
- "3.9 Persistent Caching
-
- In order to facilitate persistent caching of internal client API state that
- is slow to compute or collect, the application may specify callback
- function pointers through which the client APIs can request data be cached
- and retrieved. The command
-
- void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
- EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-
- sets the callback function pointers that client APIs associated with
- display <dpy> can use to interact with caching functionality provided by
- the application. <set> points to a function that inserts a new value into
- the cache and associates it with the given key. <get> points to a function
- that retrieves from the cache the value associated with a given key. The
- semantics of these callback functions are described in Section 3.9.1 (Cache
- Operations).
-
- Cache functions may only be specified once during the lifetime of an
- EGLDisplay. The <set> and <get> functions may be called at any time and
- from any thread from the time at which eglSetBlobCacheFuncsANDROID is
- called until the time that the last resource associated with <dpy> is
- deleted and <dpy> itself is terminated. Concurrent calls to these
- functions from different threads is also allowed.
-
- If eglSetBlobCacheFuncsANDROID generates an error then all client APIs must
- behave as though eglSetBlobCacheFuncsANDROID was not called for the display
- <dpy>. If <set> or <get> is NULL then an EGL_BAD_PARAMETER error is
- generated. If a successful eglSetBlobCacheFuncsANDROID call was already
- made for <dpy> and the display has not since been terminated then an
- EGL_BAD_PARAMETER error is generated.
-
- 3.9.1 Cache Operations
-
- To insert a new binary value into the cache and associate it with a given
- key, a client API implementation can call the application-provided callback
- function
-
- void (*set) (const void* key, EGLsizeiANDROID keySize,
- const void* value, EGLsizeiANDROID valueSize)
-
- <key> and <value> are pointers to the beginning of the key and value,
- respectively, that are to be inserted. <keySize> and <valueSize> specify
- the size in bytes of the data pointed to by <key> and <value>,
- respectively.
-
- No guarantees are made as to whether a given key/value pair is present in
- the cache after the set call. If a different value has been associated
- with the given key in the past then it is undefined which value, if any, is
- associated with the key after the set call. Note that while there are no
- guarantees, the cache implementation should attempt to cache the most
- recently set value for a given key.
-
- To retrieve the binary value associated with a given key from the cache, a
- client API implementation can call the application-provided callback
- function
-
- EGLsizeiANDROID (*get) (const void* key, EGLsizeiANDROID keySize,
- void* value, EGLsizeiANDROID valueSize)
-
- <key> is a pointer to the beginning of the key. <keySize> specifies the
- size in bytes of the binary key pointed to by <key>. If the cache contains
- a value associated with the given key then the size of that binary value in
- bytes is returned. Otherwise 0 is returned.
-
- If the cache contains a value for the given key and its size in bytes is
- less than or equal to <valueSize> then the value is written to the memory
- pointed to by <value>. Otherwise nothing is written to the memory pointed
- to by <value>.
-
-Issues
-
- 1. How should errors be handled in the callback functions?
-
- RESOLVED: No guarantees are made about the presence of values in the cache,
- so there should not be a need to return error information to the client API
- implementation. The cache implementation can simply drop a value if it
- encounters an error during the 'set' callback. Similarly, it can simply
- return 0 if it encouters an error in a 'get' callback.
-
- 2. When a client API driver gets updated, that may need to invalidate
- previously cached entries. How can the driver handle this situation?
-
- RESPONSE: There are a number of ways the driver can handle this situation.
- The recommended way is to include the driver version in all cache keys.
- That way each driver version will use a set of cache keys that are unique
- to that version, and conflicts should never occur. Updating the driver
- could then leave a number of values in the cache that will never be
- requested again. If needed, the cache implementation can handle those
- values in some way, but the driver does not need to take any special
- action.
-
- 3. How much data can be stored in the cache?
-
- RESPONSE: This is entirely dependent upon the cache implementation.
- Presumably it will be tuned to store enough data to be useful, but not
- enough to become problematic. :)
-
-Revision History
-
-#2 (Jamie Gennis, April 25, 2011)
- - Swapped the order of the size and pointer arguments to the get and set
- functions.
-
-#1 (Jamie Gennis, April 22, 2011)
- - Initial draft.
diff --git a/opengl/specs/EGL_ANDROID_recordable.txt b/opengl/specs/EGL_ANDROID_recordable.txt
deleted file mode 100644
index 8dbd26f..0000000
--- a/opengl/specs/EGL_ANDROID_recordable.txt
+++ /dev/null
@@ -1,140 +0,0 @@
-Name
-
- ANDROID_recordable
-
-Name Strings
-
- EGL_ANDROID_recordable
-
-Contributors
-
- Jamie Gennis
-
-Contact
-
- Jamie Gennis, Google Inc. (jgennis 'at' google.com)
-
-Status
-
- Draft.
-
-Version
-
- Version 1, July 8, 2011
-
-Number
-
- EGL Extension #XXX
-
-Dependencies
-
- Requires EGL 1.0
-
- This extension is written against the wording of the EGL 1.4 Specification
-
-Overview
-
- Android supports a number of different ANativeWindow implementations that
- can be used to create an EGLSurface. One implementation, which records the
- rendered image as a video each time eglSwapBuffers gets called, may have
- some device-specific restrictions. Because of this, some EGLConfigs may be
- incompatible with these ANativeWindows. This extension introduces a new
- boolean EGLConfig attribute that indicates whether the EGLConfig supports
- rendering to an ANativeWindow that records images to a video.
-
-New Types
-
- None.
-
-New Procedures and Functions
-
- None.
-
-New Tokens
-
- Accepted by the <attribute> parameter of eglGetConfigAttrib and
- the <attrib_list> parameter of eglChooseConfig:
-
- EGL_RECORDABLE_ANDROID 0x3142
-
-Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
-
- Section 3.4, Configuration Management, add a row to Table 3.1.
-
- Attribute Type Notes
- ---------------------- ------- --------------------------
- EGL_RECORDABLE_ANDROID boolean whether video recording is
- supported
-
- Section 3.4, Configuration Management, add a row to Table 3.4.
-
- Attribute Default Selection Sort Sort
- Criteria Order Priority
- ---------------------- ------------- --------- ----- --------
- EGL_RECORDABLE_ANDROID EGL_DONT_CARE Exact None
-
- Section 3.4, Configuration Management, add a paragraph at the end of the
- subsection titled Other EGLConfig Attribute Descriptions.
-
- EGL_RECORDABLE_ANDROID is a boolean indicating whether the config may
- be used to create an EGLSurface from an ANativeWindow that is a video
- recorder as indicated by the NATIVE_WINDOW_IS_VIDEO_RECORDER query on
- the ANativeWindow.
-
- Section 3.4.1, Querying Configurations, change the last paragraph as follow
-
- EGLConfigs are not sorted with respect to the parameters
- EGL_BIND_TO_TEXTURE_RGB, EGL_BIND_TO_TEXTURE_RGBA, EGL_CONFORMANT,
- EGL_LEVEL, EGL_NATIVE_RENDERABLE, EGL_MAX_SWAP_INTERVAL,
- EGL_MIN_SWAP_INTERVAL, EGL_RENDERABLE_TYPE, EGL_SURFACE_TYPE,
- EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RED_VALUE,
- EGL_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_BLUE_VALUE, and
- EGL_RECORDABLE_ANDROID.
-
-Issues
-
- 1. Should this functionality be exposed as a new attribute or as a bit in
- the EGL_SURFACE_TYPE bitfield?
-
- RESOLVED: It should be a new attribute. It does not make sense to use up a
- bit in the limit-size bitfield for a platform-specific extension.
-
- 2. How should the new attribute affect the sorting of EGLConfigs?
-
- RESOLVED: It should not affect sorting. Some implementations may not have
- any drawback associated with using a recordable EGLConfig. Such
- implementations should not have to double-up some of their configs to one
- sort earlier than . Implementations that do have drawbacks can use the
- existing caveat mechanism to report this drawback to the client.
-
- 3. How is this extension expected to be implemented?
-
- RESPONSE: There are two basic approaches to implementing this extension
- that were considered during its design. In both cases it is assumed that a
- color space conversion must be performed at some point because most video
- encoding formats use a YUV color space. The two approaches are
- distinguished by the point at which this color space conversion is
- performed.
-
- One approach involves performing the color space conversion as part of the
- eglSwapBuffers call before queuing the rendered image to the ANativeWindow.
- In this case, the VisualID of the EGLConfig would correspond to a YUV
- Android HAL pixel format from which the video encoder can read. The
- EGLConfig would likely have the EGL_SLOW_CONFIG caveat because using that
- config to render normal window contents would result in an RGB -> YUV color
- space conversion when rendering the frame as well as a YUV -> RGB
- conversion when compositing the window.
-
- The other approach involves performing the color space conversion in the
- video encoder. In this case, the VisualID of the EGLConfig would
- correspond to an RGB HAL pixel format from which the video encoder can
- read. The EGLConfig would likely not need to have any caveat set, as using
- this config for normal window rendering would not have any added cost.
-
-Revision History
-
-#2 (Jamie Gennis, July 15, 2011)
- - Added issue 3.
-
-#1 (Jamie Gennis, July 8, 2011)
- - Initial draft.
diff --git a/opengl/specs/README b/opengl/specs/README
deleted file mode 100644
index 16b278f..0000000
--- a/opengl/specs/README
+++ /dev/null
@@ -1,13 +0,0 @@
-This directory contains OpenGL ES and EGL extension specifications that have
-been or are being defined for Android.
-
-The table below tracks usage of EGL enumerant values that have been reserved
-for use by Android extensions.
-
- Value Extension
----------------- ----------------------------------
-0x3140 EGL_ANDROID_image_native_buffer
-0x3141 (unused)
-0x3142 EGL_ANDROID_recordable
-0x3143 EGL_VERSION_HW_ANDROID (internal use)
-0x3144 - 0x314F (unused)
diff --git a/opengl/tests/Android.mk b/opengl/tests/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/opengl/tests/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/opengl/tests/EGLTest/Android.mk b/opengl/tests/EGLTest/Android.mk
deleted file mode 100644
index 14104d1..0000000
--- a/opengl/tests/EGLTest/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Build the unit tests.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := EGL_test
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- egl_cache_test.cpp \
- EGL_test.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- libEGL \
- libcutils \
- libstlport \
- libutils \
-
-LOCAL_STATIC_LIBRARIES := \
- libgtest \
- libgtest_main \
-
-LOCAL_C_INCLUDES := \
- bionic \
- bionic/libc/private \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport \
- frameworks/base/opengl/libs \
- frameworks/base/opengl/libs/EGL \
-
-include $(BUILD_EXECUTABLE)
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/opengl/tests/EGLTest/EGL_test.cpp b/opengl/tests/EGLTest/EGL_test.cpp
deleted file mode 100644
index 337ad33..0000000
--- a/opengl/tests/EGLTest/EGL_test.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <utils/String8.h>
-
-#include <EGL/egl.h>
-
-namespace android {
-
-class EGLTest : public ::testing::Test {
-protected:
- EGLDisplay mEglDisplay;
-
-protected:
- EGLTest() :
- mEglDisplay(EGL_NO_DISPLAY) {
- }
-
- virtual void SetUp() {
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLint majorVersion;
- EGLint minorVersion;
- EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- RecordProperty("EglVersionMajor", majorVersion);
- RecordProperty("EglVersionMajor", minorVersion);
- }
-
- virtual void TearDown() {
- EGLBoolean success = eglTerminate(mEglDisplay);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- }
-};
-
-TEST_F(EGLTest, DISABLED_EGLConfigEightBitFirst) {
-
- EGLint numConfigs;
- EGLConfig config;
- EGLBoolean success;
- EGLint attrs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
- };
-
- success = eglChooseConfig(mEglDisplay, attrs, &config, 1, &numConfigs);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_GE(numConfigs, 1);
-
- EGLint components[3];
-
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_RED_SIZE, &components[0]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_GREEN_SIZE, &components[1]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_BLUE_SIZE, &components[2]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EXPECT_GE(components[0], 8);
- EXPECT_GE(components[1], 8);
- EXPECT_GE(components[2], 8);
-}
-
-TEST_F(EGLTest, EGLConfigRGBA8888First) {
-
- EGLint numConfigs;
- EGLConfig config;
- EGLBoolean success;
- EGLint attrs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE
- };
-
- success = eglChooseConfig(mEglDisplay, attrs, &config, 1, &numConfigs);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_GE(numConfigs, 1);
-
- EGLint components[4];
-
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_RED_SIZE, &components[0]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_GREEN_SIZE, &components[1]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_BLUE_SIZE, &components[2]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- success = eglGetConfigAttrib(mEglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
- ASSERT_EQ(EGL_TRUE, success);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EXPECT_GE(components[0], 8);
- EXPECT_GE(components[1], 8);
- EXPECT_GE(components[2], 8);
- EXPECT_GE(components[3], 8);
-}
-
-
-}
diff --git a/opengl/tests/EGLTest/egl_cache_test.cpp b/opengl/tests/EGLTest/egl_cache_test.cpp
deleted file mode 100644
index c7d9e3e..0000000
--- a/opengl/tests/EGLTest/egl_cache_test.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#define LOG_TAG "EGL_test"
-//#define LOG_NDEBUG 0
-
-#include <gtest/gtest.h>
-
-#include <utils/Log.h>
-
-#include "egl_cache.h"
-#include "egl_display.h"
-
-namespace android {
-
-class EGLCacheTest : public ::testing::Test {
-protected:
- virtual void SetUp() {
- mCache = egl_cache_t::get();
- }
-
- virtual void TearDown() {
- mCache->setCacheFilename("");
- mCache->terminate();
- }
-
- egl_cache_t* mCache;
-};
-
-TEST_F(EGLCacheTest, UninitializedCacheAlwaysMisses) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mCache->setBlob("abcd", 4, "efgh", 4);
- ASSERT_EQ(0, mCache->getBlob("abcd", 4, buf, 4));
- ASSERT_EQ(0xee, buf[0]);
- ASSERT_EQ(0xee, buf[1]);
- ASSERT_EQ(0xee, buf[2]);
- ASSERT_EQ(0xee, buf[3]);
-}
-
-TEST_F(EGLCacheTest, InitializedCacheAlwaysHits) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY));
- mCache->setBlob("abcd", 4, "efgh", 4);
- ASSERT_EQ(4, mCache->getBlob("abcd", 4, buf, 4));
- ASSERT_EQ('e', buf[0]);
- ASSERT_EQ('f', buf[1]);
- ASSERT_EQ('g', buf[2]);
- ASSERT_EQ('h', buf[3]);
-}
-
-TEST_F(EGLCacheTest, TerminatedCacheAlwaysMisses) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY));
- mCache->setBlob("abcd", 4, "efgh", 4);
- mCache->terminate();
- ASSERT_EQ(0, mCache->getBlob("abcd", 4, buf, 4));
- ASSERT_EQ(0xee, buf[0]);
- ASSERT_EQ(0xee, buf[1]);
- ASSERT_EQ(0xee, buf[2]);
- ASSERT_EQ(0xee, buf[3]);
-}
-
-class EGLCacheSerializationTest : public EGLCacheTest {
-
-protected:
-
- virtual void SetUp() {
- EGLCacheTest::SetUp();
-
- char* tn = tempnam("/sdcard", "EGL_test-cache-");
- mFilename = tn;
- free(tn);
- }
-
- virtual void TearDown() {
- unlink(mFilename.string());
- EGLCacheTest::TearDown();
- }
-
- String8 mFilename;
-};
-
-TEST_F(EGLCacheSerializationTest, ReinitializedCacheContainsValues) {
- char buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mCache->setCacheFilename(mFilename);
- mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY));
- mCache->setBlob("abcd", 4, "efgh", 4);
- mCache->terminate();
- mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY));
- ASSERT_EQ(4, mCache->getBlob("abcd", 4, buf, 4));
- ASSERT_EQ('e', buf[0]);
- ASSERT_EQ('f', buf[1]);
- ASSERT_EQ('g', buf[2]);
- ASSERT_EQ('h', buf[3]);
-}
-
-}
diff --git a/opengl/tests/angeles/Android.mk b/opengl/tests/angeles/Android.mk
deleted file mode 100644
index ae4f76d..0000000
--- a/opengl/tests/angeles/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2006 The Android Open Source Project
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-LOCAL_MODULE:= angeles
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/angeles/MODULE_LICENSE_BSD_OR_LGPL b/opengl/tests/angeles/MODULE_LICENSE_BSD_OR_LGPL
deleted file mode 100644
index e69de29..0000000
--- a/opengl/tests/angeles/MODULE_LICENSE_BSD_OR_LGPL
+++ /dev/null
diff --git a/opengl/tests/angeles/README.txt b/opengl/tests/angeles/README.txt
deleted file mode 100644
index 38b8a4a..0000000
--- a/opengl/tests/angeles/README.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-------------------------------------------------------------------------
-San Angeles Observation OpenGL ES version example
-Copyright 2004-2005 Jetro Lauha
-Web: http://iki.fi/jetro/
-See file license.txt for licensing information.
-------------------------------------------------------------------------
-
-This is an OpenGL ES port of the small self-running demonstration
-called "San Angeles Observation", which was first presented in the
-Assembly'2004 event. It won the first place in the 4 KB intro
-competition category.
-
-The demonstration features a sightseeing of a futuristic city
-having many different kind of buildings and items. Everything is
-flat shaded with three different lights.
-
-The original version was made for desktop with OpenGL. It was
-naturally heavily size optimized in order to fit it in the size
-limit. For this OpenGL ES version example much of the code is
-cleaned up and the sound is removed. Also detail level is lowered,
-although it still contains over 60000 faces.
-
-The Win32 (2000/XP) binary package of original version is
-available from this address: http://jet.ro/files/angeles.zip
-
-First version of this OpenGL ES port was submitted to the Khronos
-OpenGL ES Coding Challenge held in 2004-2005.
-
-As a code example, this source shows the following:
- * How to create a minimal and portable ad hoc framework
- for small testing/demonstration programs. This framework
- compiles for both desktop and PocketPC Win32 environment,
- and a separate source is included for Linux with X11.
- * How to dynamically find and use the OpenGL ES DLL or
- shared object, so that the library is not needed at
- the compile/link stage.
- * How to use the basic features of OpenGL ES 1.0/1.1
- Common Lite, such as vertex arrays, color arrays and
- lighting.
- * How to create a self contained small demonstration
- application with objects generated using procedural
- algorithms.
-
-As the original version was optimized for size instead of
-performance, that holds true for this OpenGL ES version as
-well. Thus the performance could be significantly increased,
-for example by changing the code to use glDrawElements
-instead of glDrawArrays. The code uses only OpenGL ES 1.0
-Common Lite -level function calls without any extensions.
-
-The reference OpenGL ES implementations used for this application:
- * Hybrid's OpenGL ES API Implementation (Gerbera) version 2.0.4
- Prebuilt Win32 PC executable: SanOGLES-Gerbera.exe
- * PowerVR MBX SDK, OpenGL ES Windows PC Emulation version 1.04.14.0170
- Prebuilt Win32 PC executable: SanOGLES-PVRSDK.exe
-
-Note that DISABLE_IMPORTGL preprocessor macro can be used
-to specify not to use dynamic runtime binding of the library.
-You also need to define preprocessor macro PVRSDK to compile
-the source with PowerVR OpenGL ES SDK.
-
-The demo application is briefly tested with a few other OpenGL ES
-implementations as well (e.g. Vincent, GLESonGL on Linux, Dell
-Axim X50v). Most of these other implementations rendered the demo
-erroneously in some aspect. This may indicate that the demo source
-could still have some work to do with compatibility and correct
-API usage, although the non-conforming implementations are most
-probably unfinished as well.
-
-Thanks and Acknowledgements:
-
-* Toni Lönnberg (!Cube) created the music for original version, which
- is not featured in this OpenGL ES port.
-* Sara Kapli (st Rana) for additional camera work.
-* Paul Bourke for information about the supershapes.
-
-------------------------------------------------------------------------
diff --git a/opengl/tests/angeles/app-linux.cpp b/opengl/tests/angeles/app-linux.cpp
deleted file mode 100644
index 6ac68a2..0000000
--- a/opengl/tests/angeles/app-linux.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/* San Angeles Observation OpenGL ES version example
- * Copyright 2004-2005 Jetro Lauha
- * All rights reserved.
- * Web: http://iki.fi/jetro/
- *
- * This source is free software; you can redistribute it and/or
- * modify it under the terms of EITHER:
- * (1) The GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version. The text of the GNU Lesser
- * General Public License is included with this source in the
- * file LICENSE-LGPL.txt.
- * (2) The BSD-style license that is included with this source in
- * the file LICENSE-BSD.txt.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
- * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
- *
- * $Id: app-linux.c,v 1.4 2005/02/08 18:42:48 tonic Exp $
- * $Revision: 1.4 $
- *
- * Parts of this source file is based on test/example code from
- * GLESonGL implementation by David Blythe. Here is copy of the
- * license notice from that source:
- *
- * Copyright (C) 2003 David Blythe All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID BLYTHE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/time.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-#include "app.h"
-
-
-int gAppAlive = 1;
-
-static const char sAppName[] =
- "San Angeles Observation OpenGL ES version example (Linux)";
-
-static int sWindowWidth = WINDOW_DEFAULT_WIDTH;
-static int sWindowHeight = WINDOW_DEFAULT_HEIGHT;
-static EGLDisplay sEglDisplay = EGL_NO_DISPLAY;
-static EGLContext sEglContext = EGL_NO_CONTEXT;
-static EGLSurface sEglSurface = EGL_NO_SURFACE;
-
-const char *egl_strerror(unsigned err)
-{
- switch(err){
- case EGL_SUCCESS: return "SUCCESS";
- case EGL_NOT_INITIALIZED: return "NOT INITIALIZED";
- case EGL_BAD_ACCESS: return "BAD ACCESS";
- case EGL_BAD_ALLOC: return "BAD ALLOC";
- case EGL_BAD_ATTRIBUTE: return "BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG: return "BAD CONFIG";
- case EGL_BAD_CONTEXT: return "BAD CONTEXT";
- case EGL_BAD_CURRENT_SURFACE: return "BAD CURRENT SURFACE";
- case EGL_BAD_DISPLAY: return "BAD DISPLAY";
- case EGL_BAD_MATCH: return "BAD MATCH";
- case EGL_BAD_NATIVE_PIXMAP: return "BAD NATIVE PIXMAP";
- case EGL_BAD_NATIVE_WINDOW: return "BAD NATIVE WINDOW";
- case EGL_BAD_PARAMETER: return "BAD PARAMETER";
- case EGL_BAD_SURFACE: return "BAD_SURFACE";
- // case EGL_CONTEXT_LOST: return "CONTEXT LOST";
- default: return "UNKNOWN";
- }
-}
-
-void egl_error(const char *name)
-{
- unsigned err = eglGetError();
- if(err != EGL_SUCCESS) {
- fprintf(stderr,"%s(): egl error 0x%x (%s)\n",
- name, err, egl_strerror(err));
- }
-}
-
-static void checkGLErrors()
-{
- GLenum error = glGetError();
- if (error != GL_NO_ERROR)
- fprintf(stderr, "GL Error: 0x%04x\n", (int)error);
-}
-
-
-static void checkEGLErrors()
-{
- EGLint error = eglGetError();
- // GLESonGL seems to be returning 0 when there is no errors?
- if (error && error != EGL_SUCCESS)
- fprintf(stderr, "EGL Error: 0x%04x\n", (int)error);
-}
-
-static int initGraphics(unsigned samples)
-{
- EGLint configAttribs[] = {
- EGL_DEPTH_SIZE, 16,
- EGL_SAMPLE_BUFFERS, samples ? 1 : 0,
- EGL_SAMPLES, samples,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
-
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
- return 0;
- }
-
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- egl_error("eglCreateWindowSurface");
-
- fprintf(stderr,"surface = %p\n", surface);
-
- context = eglCreateContext(dpy, config, NULL, NULL);
- egl_error("eglCreateContext");
- fprintf(stderr,"context = %p\n", context);
-
- eglMakeCurrent(dpy, surface, surface, context);
- egl_error("eglMakeCurrent");
-
- eglQuerySurface(dpy, surface, EGL_WIDTH, &sWindowWidth);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &sWindowHeight);
-
- sEglDisplay = dpy;
- sEglSurface = surface;
- sEglContext = context;
-
- if (samples == 0) {
- // GL_MULTISAMPLE is enabled by default
- glDisable(GL_MULTISAMPLE);
- }
-
- return EGL_TRUE;
-}
-
-
-static void deinitGraphics()
-{
- eglMakeCurrent(sEglDisplay, NULL, NULL, NULL);
- eglDestroyContext(sEglDisplay, sEglContext);
- eglDestroySurface(sEglDisplay, sEglSurface);
- eglTerminate(sEglDisplay);
-}
-
-
-int main(int argc, char *argv[])
-{
- unsigned samples = 0;
- printf("usage: %s [samples]\n", argv[0]);
- if (argc == 2) {
- samples = atoi( argv[1] );
- printf("Multisample enabled: GL_SAMPLES = %u\n", samples);
- }
-
- if (!initGraphics(samples))
- {
- fprintf(stderr, "Graphics initialization failed.\n");
- return EXIT_FAILURE;
- }
-
- appInit();
-
- struct timeval timeTemp;
- int frameCount = 0;
- gettimeofday(&timeTemp, NULL);
- double totalTime = timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec;
-
- while (gAppAlive)
- {
- struct timeval timeNow;
-
- gettimeofday(&timeNow, NULL);
- appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
- sWindowWidth, sWindowHeight);
- checkGLErrors();
- eglSwapBuffers(sEglDisplay, sEglSurface);
- checkEGLErrors();
- frameCount++;
- }
-
- gettimeofday(&timeTemp, NULL);
-
- appDeinit();
- deinitGraphics();
-
- totalTime = (timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec) - totalTime;
- printf("totalTime=%f s, frameCount=%d, %.2f fps\n",
- totalTime, frameCount, frameCount/totalTime);
-
- return EXIT_SUCCESS;
-}
diff --git a/opengl/tests/angeles/app.h b/opengl/tests/angeles/app.h
deleted file mode 100644
index 70ebd35..0000000
--- a/opengl/tests/angeles/app.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* San Angeles Observation OpenGL ES version example
- * Copyright 2004-2005 Jetro Lauha
- * All rights reserved.
- * Web: http://iki.fi/jetro/
- *
- * This source is free software; you can redistribute it and/or
- * modify it under the terms of EITHER:
- * (1) The GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version. The text of the GNU Lesser
- * General Public License is included with this source in the
- * file LICENSE-LGPL.txt.
- * (2) The BSD-style license that is included with this source in
- * the file LICENSE-BSD.txt.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
- * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
- *
- * $Id: app.h,v 1.14 2005/02/06 21:13:54 tonic Exp $
- * $Revision: 1.14 $
- */
-
-#ifndef APP_H_INCLUDED
-#define APP_H_INCLUDED
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define WINDOW_DEFAULT_WIDTH 640
-#define WINDOW_DEFAULT_HEIGHT 480
-
-#define WINDOW_BPP 16
-
-
-// The simple framework expects the application code to define these functions.
-extern void appInit();
-extern void appDeinit();
-extern void appRender(long tick, int width, int height);
-
-/* Value is non-zero when application is alive, and 0 when it is closing.
- * Defined by the application framework.
- */
-extern int gAppAlive;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif // !APP_H_INCLUDED
diff --git a/opengl/tests/angeles/cams.h b/opengl/tests/angeles/cams.h
deleted file mode 100644
index 2b1acb3..0000000
--- a/opengl/tests/angeles/cams.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* San Angeles Observation OpenGL ES version example
- * Copyright 2004-2005 Jetro Lauha
- * All rights reserved.
- * Web: http://iki.fi/jetro/
- *
- * This source is free software; you can redistribute it and/or
- * modify it under the terms of EITHER:
- * (1) The GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version. The text of the GNU Lesser
- * General Public License is included with this source in the
- * file LICENSE-LGPL.txt.
- * (2) The BSD-style license that is included with this source in
- * the file LICENSE-BSD.txt.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
- * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
- *
- * $Id: cams.h,v 1.7 2005/01/31 22:15:15 tonic Exp $
- * $Revision: 1.7 $
- */
-
-#ifndef CAMS_H_INCLUDED
-#define CAMS_H_INCLUDED
-
-
-/* Length in milliseconds of one camera track base unit.
- * The value originates from the music synchronization.
- */
-#define CAMTRACK_LEN 5442
-
-
-// Camera track definition for one camera trucking shot.
-typedef struct
-{
- /* Five parameters of src[5] and dest[5]:
- * eyeX, eyeY, eyeZ, viewAngle, viewHeightOffs
- */
- short src[5], dest[5];
- unsigned char dist; // if >0, cam rotates around eye xy on dist * 0.1
- unsigned char len; // length multiplier
-} CAMTRACK;
-
-static CAMTRACK sCamTracks[] =
-{
- { { 4500, 2700, 100, 70, -30 }, { 50, 50, -90, -100, 0 }, 20, 1 },
- { { -1448, 4294, 25, 363, 0 }, { -136, 202, 125, -98, 100 }, 0, 1 },
- { { 1437, 4930, 200, -275, -20 }, { 1684, 0, 0, 9, 0 }, 0, 1 },
- { { 1800, 3609, 200, 0, 675 }, { 0, 0, 0, 300, 0 }, 0, 1 },
- { { 923, 996, 50, 2336, -80 }, { 0, -20, -50, 0, 170 }, 0, 1 },
- { { -1663, -43, 600, 2170, 0 }, { 20, 0, -600, 0, 100 }, 0, 1 },
- { { 1049, -1420, 175, 2111, -17 }, { 0, 0, 0, -334, 0 }, 0, 2 },
- { { 0, 0, 50, 300, 25 }, { 0, 0, 0, 300, 0 }, 70, 2 },
- { { -473, -953, 3500, -353, -350 }, { 0, 0, -2800, 0, 0 }, 0, 2 },
- { { 191, 1938, 35, 1139, -17 }, { 1205, -2909, 0, 0, 0 }, 0, 2 },
- { { -1449, -2700, 150, 0, 0 }, { 0, 2000, 0, 0, 0 }, 0, 2 },
- { { 5273, 4992, 650, 373, -50 }, { -4598, -3072, 0, 0, 0 }, 0, 2 },
- { { 3223, -3282, 1075, -393, -25 }, { 1649, -1649, 0, 0, 0 }, 0, 2 }
-};
-#define CAMTRACK_COUNT (sizeof(camTracks) / sizeof(camTracks[0]))
-
-
-#endif // !CAMS_H_INCLUDED
diff --git a/opengl/tests/angeles/demo.c b/opengl/tests/angeles/demo.c
deleted file mode 100644
index 802f398..0000000
--- a/opengl/tests/angeles/demo.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/* San Angeles Observation OpenGL ES version example
- * Copyright 2004-2005 Jetro Lauha
- * All rights reserved.
- * Web: http://iki.fi/jetro/
- *
- * This source is free software; you can redistribute it and/or
- * modify it under the terms of EITHER:
- * (1) The GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version. The text of the GNU Lesser
- * General Public License is included with this source in the
- * file LICENSE-LGPL.txt.
- * (2) The BSD-style license that is included with this source in
- * the file LICENSE-BSD.txt.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
- * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
- *
- * $Id: demo.c,v 1.10 2005/02/08 20:54:39 tonic Exp $
- * $Revision: 1.10 $
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <float.h>
-#include <assert.h>
-
-#include <GLES/gl.h>
-
-#include "app.h"
-#include "shapes.h"
-#include "cams.h"
-
-
-// Total run length is 20 * camera track base unit length (see cams.h).
-#define RUN_LENGTH (20 * CAMTRACK_LEN)
-#undef PI
-#define PI 3.1415926535897932f
-#define RANDOM_UINT_MAX 65535
-
-
-static unsigned long sRandomSeed = 0;
-
-static void seedRandom(unsigned long seed)
-{
- sRandomSeed = seed;
-}
-
-static unsigned long randomUInt()
-{
- sRandomSeed = sRandomSeed * 0x343fd + 0x269ec3;
- return sRandomSeed >> 16;
-}
-
-
-// Capped conversion from float to fixed.
-static long floatToFixed(float value)
-{
- if (value < -32768) value = -32768;
- if (value > 32767) value = 32767;
- return (long)(value * 65536);
-}
-
-#define FIXED(value) floatToFixed(value)
-
-
-// Definition of one GL object in this demo.
-typedef struct {
- /* Vertex array and color array are enabled for all objects, so their
- * pointers must always be valid and non-NULL. Normal array is not
- * used by the ground plane, so when its pointer is NULL then normal
- * array usage is disabled.
- *
- * Vertex array is supposed to use GL_FIXED datatype and stride 0
- * (i.e. tightly packed array). Color array is supposed to have 4
- * components per color with GL_UNSIGNED_BYTE datatype and stride 0.
- * Normal array is supposed to use GL_FIXED datatype and stride 0.
- */
- GLfixed *vertexArray;
- GLubyte *colorArray;
- GLfixed *normalArray;
- GLint vertexComponents;
- GLsizei count;
-} GLOBJECT;
-
-
-static long sStartTick = 0;
-static long sTick = 0;
-
-static int sCurrentCamTrack = 0;
-static long sCurrentCamTrackStartTick = 0;
-static long sNextCamTrackStartTick = 0x7fffffff;
-
-static GLOBJECT *sSuperShapeObjects[SUPERSHAPE_COUNT] = { NULL };
-static GLOBJECT *sGroundPlane = NULL;
-
-
-typedef struct {
- float x, y, z;
-} VECTOR3;
-
-
-static void freeGLObject(GLOBJECT *object)
-{
- if (object == NULL)
- return;
- free(object->normalArray);
- free(object->colorArray);
- free(object->vertexArray);
- free(object);
-}
-
-
-static GLOBJECT * newGLObject(long vertices, int vertexComponents,
- int useNormalArray)
-{
- GLOBJECT *result;
- result = (GLOBJECT *)malloc(sizeof(GLOBJECT));
- if (result == NULL)
- return NULL;
- result->count = vertices;
- result->vertexComponents = vertexComponents;
- result->vertexArray = (GLfixed *)malloc(vertices * vertexComponents *
- sizeof(GLfixed));
- result->colorArray = (GLubyte *)malloc(vertices * 4 * sizeof(GLubyte));
- if (useNormalArray)
- {
- result->normalArray = (GLfixed *)malloc(vertices * 3 *
- sizeof(GLfixed));
- }
- else
- result->normalArray = NULL;
- if (result->vertexArray == NULL ||
- result->colorArray == NULL ||
- (useNormalArray && result->normalArray == NULL))
- {
- freeGLObject(result);
- return NULL;
- }
- return result;
-}
-
-
-static void drawGLObject(GLOBJECT *object)
-{
- assert(object != NULL);
-
- glVertexPointer(object->vertexComponents, GL_FIXED,
- 0, object->vertexArray);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, object->colorArray);
-
- // Already done in initialization:
- //glEnableClientState(GL_VERTEX_ARRAY);
- //glEnableClientState(GL_COLOR_ARRAY);
-
- if (object->normalArray)
- {
- glNormalPointer(GL_FIXED, 0, object->normalArray);
- glEnableClientState(GL_NORMAL_ARRAY);
- }
- else
- glDisableClientState(GL_NORMAL_ARRAY);
- glDrawArrays(GL_TRIANGLES, 0, object->count);
-}
-
-
-static void vector3Sub(VECTOR3 *dest, VECTOR3 *v1, VECTOR3 *v2)
-{
- dest->x = v1->x - v2->x;
- dest->y = v1->y - v2->y;
- dest->z = v1->z - v2->z;
-}
-
-
-static void superShapeMap(VECTOR3 *point, float r1, float r2, float t, float p)
-{
- // sphere-mapping of supershape parameters
- point->x = (float)(cos(t) * cos(p) / r1 / r2);
- point->y = (float)(sin(t) * cos(p) / r1 / r2);
- point->z = (float)(sin(p) / r2);
-}
-
-
-static float ssFunc(const float t, const float *p)
-{
- return (float)(pow(pow(fabs(cos(p[0] * t / 4)) / p[1], p[4]) +
- pow(fabs(sin(p[0] * t / 4)) / p[2], p[5]), 1 / p[3]));
-}
-
-
-// Creates and returns a supershape object.
-// Based on Paul Bourke's POV-Ray implementation.
-// http://astronomy.swin.edu.au/~pbourke/povray/supershape/
-static GLOBJECT * createSuperShape(const float *params)
-{
- const int resol1 = (int)params[SUPERSHAPE_PARAMS - 3];
- const int resol2 = (int)params[SUPERSHAPE_PARAMS - 2];
- // latitude 0 to pi/2 for no mirrored bottom
- // (latitudeBegin==0 for -pi/2 to pi/2 originally)
- const int latitudeBegin = resol2 / 4;
- const int latitudeEnd = resol2 / 2; // non-inclusive
- const int longitudeCount = resol1;
- const int latitudeCount = latitudeEnd - latitudeBegin;
- const long triangleCount = longitudeCount * latitudeCount * 2;
- const long vertices = triangleCount * 3;
- GLOBJECT *result;
- float baseColor[3];
- int a, longitude, latitude;
- long currentVertex, currentQuad;
-
- result = newGLObject(vertices, 3, 1);
- if (result == NULL)
- return NULL;
-
- for (a = 0; a < 3; ++a)
- baseColor[a] = ((randomUInt() % 155) + 100) / 255.f;
-
- currentQuad = 0;
- currentVertex = 0;
-
- // longitude -pi to pi
- for (longitude = 0; longitude < longitudeCount; ++longitude)
- {
-
- // latitude 0 to pi/2
- for (latitude = latitudeBegin; latitude < latitudeEnd; ++latitude)
- {
- float t1 = -PI + longitude * 2 * PI / resol1;
- float t2 = -PI + (longitude + 1) * 2 * PI / resol1;
- float p1 = -PI / 2 + latitude * 2 * PI / resol2;
- float p2 = -PI / 2 + (latitude + 1) * 2 * PI / resol2;
- float r0, r1, r2, r3;
-
- r0 = ssFunc(t1, params);
- r1 = ssFunc(p1, ¶ms[6]);
- r2 = ssFunc(t2, params);
- r3 = ssFunc(p2, ¶ms[6]);
-
- if (r0 != 0 && r1 != 0 && r2 != 0 && r3 != 0)
- {
- VECTOR3 pa, pb, pc, pd;
- VECTOR3 v1, v2, n;
- float ca;
- int i;
- //float lenSq, invLenSq;
-
- superShapeMap(&pa, r0, r1, t1, p1);
- superShapeMap(&pb, r2, r1, t2, p1);
- superShapeMap(&pc, r2, r3, t2, p2);
- superShapeMap(&pd, r0, r3, t1, p2);
-
- // kludge to set lower edge of the object to fixed level
- if (latitude == latitudeBegin + 1)
- pa.z = pb.z = 0;
-
- vector3Sub(&v1, &pb, &pa);
- vector3Sub(&v2, &pd, &pa);
-
- // Calculate normal with cross product.
- /* i j k i j
- * v1.x v1.y v1.z | v1.x v1.y
- * v2.x v2.y v2.z | v2.x v2.y
- */
-
- n.x = v1.y * v2.z - v1.z * v2.y;
- n.y = v1.z * v2.x - v1.x * v2.z;
- n.z = v1.x * v2.y - v1.y * v2.x;
-
- /* Pre-normalization of the normals is disabled here because
- * they will be normalized anyway later due to automatic
- * normalization (GL_NORMALIZE). It is enabled because the
- * objects are scaled with glScale.
- */
- /*
- lenSq = n.x * n.x + n.y * n.y + n.z * n.z;
- invLenSq = (float)(1 / sqrt(lenSq));
- n.x *= invLenSq;
- n.y *= invLenSq;
- n.z *= invLenSq;
- */
-
- ca = pa.z + 0.5f;
-
- for (i = currentVertex * 3;
- i < (currentVertex + 6) * 3;
- i += 3)
- {
- result->normalArray[i] = FIXED(n.x);
- result->normalArray[i + 1] = FIXED(n.y);
- result->normalArray[i + 2] = FIXED(n.z);
- }
- for (i = currentVertex * 4;
- i < (currentVertex + 6) * 4;
- i += 4)
- {
- int a, color[3];
- for (a = 0; a < 3; ++a)
- {
- color[a] = (int)(ca * baseColor[a] * 255);
- if (color[a] > 255) color[a] = 255;
- }
- result->colorArray[i] = (GLubyte)color[0];
- result->colorArray[i + 1] = (GLubyte)color[1];
- result->colorArray[i + 2] = (GLubyte)color[2];
- result->colorArray[i + 3] = 0;
- }
- result->vertexArray[currentVertex * 3] = FIXED(pa.x);
- result->vertexArray[currentVertex * 3 + 1] = FIXED(pa.y);
- result->vertexArray[currentVertex * 3 + 2] = FIXED(pa.z);
- ++currentVertex;
- result->vertexArray[currentVertex * 3] = FIXED(pb.x);
- result->vertexArray[currentVertex * 3 + 1] = FIXED(pb.y);
- result->vertexArray[currentVertex * 3 + 2] = FIXED(pb.z);
- ++currentVertex;
- result->vertexArray[currentVertex * 3] = FIXED(pd.x);
- result->vertexArray[currentVertex * 3 + 1] = FIXED(pd.y);
- result->vertexArray[currentVertex * 3 + 2] = FIXED(pd.z);
- ++currentVertex;
- result->vertexArray[currentVertex * 3] = FIXED(pb.x);
- result->vertexArray[currentVertex * 3 + 1] = FIXED(pb.y);
- result->vertexArray[currentVertex * 3 + 2] = FIXED(pb.z);
- ++currentVertex;
- result->vertexArray[currentVertex * 3] = FIXED(pc.x);
- result->vertexArray[currentVertex * 3 + 1] = FIXED(pc.y);
- result->vertexArray[currentVertex * 3 + 2] = FIXED(pc.z);
- ++currentVertex;
- result->vertexArray[currentVertex * 3] = FIXED(pd.x);
- result->vertexArray[currentVertex * 3 + 1] = FIXED(pd.y);
- result->vertexArray[currentVertex * 3 + 2] = FIXED(pd.z);
- ++currentVertex;
- } // r0 && r1 && r2 && r3
- ++currentQuad;
- } // latitude
- } // longitude
-
- // Set number of vertices in object to the actual amount created.
- result->count = currentVertex;
-
- return result;
-}
-
-
-static GLOBJECT * createGroundPlane()
-{
- const int scale = 4;
- const int yBegin = -15, yEnd = 15; // ends are non-inclusive
- const int xBegin = -15, xEnd = 15;
- const long triangleCount = (yEnd - yBegin) * (xEnd - xBegin) * 2;
- const long vertices = triangleCount * 3;
- GLOBJECT *result;
- int x, y;
- long currentVertex, currentQuad;
-
- result = newGLObject(vertices, 2, 0);
- if (result == NULL)
- return NULL;
-
- currentQuad = 0;
- currentVertex = 0;
-
- for (y = yBegin; y < yEnd; ++y)
- {
- for (x = xBegin; x < xEnd; ++x)
- {
- GLubyte color;
- int i, a;
- color = (GLubyte)((randomUInt() & 0x5f) + 81); // 101 1111
- for (i = currentVertex * 4; i < (currentVertex + 6) * 4; i += 4)
- {
- result->colorArray[i] = color;
- result->colorArray[i + 1] = color;
- result->colorArray[i + 2] = color;
- result->colorArray[i + 3] = 0;
- }
-
- // Axis bits for quad triangles:
- // x: 011100 (0x1c), y: 110001 (0x31) (clockwise)
- // x: 001110 (0x0e), y: 100011 (0x23) (counter-clockwise)
- for (a = 0; a < 6; ++a)
- {
- const int xm = x + ((0x1c >> a) & 1);
- const int ym = y + ((0x31 >> a) & 1);
- const float m = (float)(cos(xm * 2) * sin(ym * 4) * 0.75f);
- result->vertexArray[currentVertex * 2] =
- FIXED(xm * scale + m);
- result->vertexArray[currentVertex * 2 + 1] =
- FIXED(ym * scale + m);
- ++currentVertex;
- }
- ++currentQuad;
- }
- }
- return result;
-}
-
-
-static void drawGroundPlane()
-{
- glDisable(GL_CULL_FACE);
- glDisable(GL_DEPTH_TEST);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ZERO, GL_SRC_COLOR);
- glDisable(GL_LIGHTING);
-
- drawGLObject(sGroundPlane);
-
- glEnable(GL_LIGHTING);
- glDisable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
-}
-
-
-static void drawFadeQuad()
-{
- static const GLfixed quadVertices[] = {
- -0x10000, -0x10000,
- 0x10000, -0x10000,
- -0x10000, 0x10000,
- 0x10000, -0x10000,
- 0x10000, 0x10000,
- -0x10000, 0x10000
- };
-
- const int beginFade = sTick - sCurrentCamTrackStartTick;
- const int endFade = sNextCamTrackStartTick - sTick;
- const int minFade = beginFade < endFade ? beginFade : endFade;
-
- if (minFade < 1024)
- {
- const GLfixed fadeColor = minFade << 6;
- glColor4x(fadeColor, fadeColor, fadeColor, 0);
-
- glDisable(GL_DEPTH_TEST);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ZERO, GL_SRC_COLOR);
- glDisable(GL_LIGHTING);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glDisableClientState(GL_COLOR_ARRAY);
- glDisableClientState(GL_NORMAL_ARRAY);
- glVertexPointer(2, GL_FIXED, 0, quadVertices);
- glDrawArrays(GL_TRIANGLES, 0, 6);
-
- glEnableClientState(GL_COLOR_ARRAY);
-
- glMatrixMode(GL_MODELVIEW);
-
- glEnable(GL_LIGHTING);
- glDisable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
- }
-}
-
-
-// Called from the app framework.
-void appInit()
-{
- int a;
-
- glEnable(GL_NORMALIZE);
- glEnable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- glShadeModel(GL_FLAT);
-
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHT1);
- glEnable(GL_LIGHT2);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- seedRandom(15);
-
- for (a = 0; a < SUPERSHAPE_COUNT; ++a)
- {
- sSuperShapeObjects[a] = createSuperShape(sSuperShapeParams[a]);
- assert(sSuperShapeObjects[a] != NULL);
- }
- sGroundPlane = createGroundPlane();
- assert(sGroundPlane != NULL);
-}
-
-
-// Called from the app framework.
-void appDeinit()
-{
- int a;
- for (a = 0; a < SUPERSHAPE_COUNT; ++a)
- freeGLObject(sSuperShapeObjects[a]);
- freeGLObject(sGroundPlane);
-}
-
-
-static void gluPerspective(GLfloat fovy, GLfloat aspect,
- GLfloat zNear, GLfloat zFar)
-{
- GLfloat xmin, xmax, ymin, ymax;
-
- ymax = zNear * (GLfloat)tan(fovy * PI / 360);
- ymin = -ymax;
- xmin = ymin * aspect;
- xmax = ymax * aspect;
-
- glFrustumx((GLfixed)(xmin * 65536), (GLfixed)(xmax * 65536),
- (GLfixed)(ymin * 65536), (GLfixed)(ymax * 65536),
- (GLfixed)(zNear * 65536), (GLfixed)(zFar * 65536));
-}
-
-
-static void prepareFrame(int width, int height)
-{
- glViewport(0, 0, width, height);
-
- glClearColorx((GLfixed)(0.1f * 65536),
- (GLfixed)(0.2f * 65536),
- (GLfixed)(0.3f * 65536), 0x10000);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45, (float)width / height, 0.5f, 150);
-
- glMatrixMode(GL_MODELVIEW);
-
- glLoadIdentity();
-}
-
-
-static void configureLightAndMaterial()
-{
- static GLfixed light0Position[] = { -0x40000, 0x10000, 0x10000, 0 };
- static GLfixed light0Diffuse[] = { 0x10000, 0x6666, 0, 0x10000 };
- static GLfixed light1Position[] = { 0x10000, -0x20000, -0x10000, 0 };
- static GLfixed light1Diffuse[] = { 0x11eb, 0x23d7, 0x5999, 0x10000 };
- static GLfixed light2Position[] = { -0x10000, 0, -0x40000, 0 };
- static GLfixed light2Diffuse[] = { 0x11eb, 0x2b85, 0x23d7, 0x10000 };
- static GLfixed materialSpecular[] = { 0x10000, 0x10000, 0x10000, 0x10000 };
-
- glLightxv(GL_LIGHT0, GL_POSITION, light0Position);
- glLightxv(GL_LIGHT0, GL_DIFFUSE, light0Diffuse);
- glLightxv(GL_LIGHT1, GL_POSITION, light1Position);
- glLightxv(GL_LIGHT1, GL_DIFFUSE, light1Diffuse);
- glLightxv(GL_LIGHT2, GL_POSITION, light2Position);
- glLightxv(GL_LIGHT2, GL_DIFFUSE, light2Diffuse);
- glMaterialxv(GL_FRONT_AND_BACK, GL_SPECULAR, materialSpecular);
-
- glMaterialx(GL_FRONT_AND_BACK, GL_SHININESS, 60 << 16);
- glEnable(GL_COLOR_MATERIAL);
-}
-
-
-static void drawModels(float zScale)
-{
- const int translationScale = 9;
- int x, y;
-
- seedRandom(9);
-
- glScalex(1 << 16, 1 << 16, (GLfixed)(zScale * 65536));
-
- for (y = -5; y <= 5; ++y)
- {
- for (x = -5; x <= 5; ++x)
- {
- float buildingScale;
- GLfixed fixedScale;
-
- int curShape = randomUInt() % SUPERSHAPE_COUNT;
- buildingScale = sSuperShapeParams[curShape][SUPERSHAPE_PARAMS - 1];
- fixedScale = (GLfixed)(buildingScale * 65536);
-
- glPushMatrix();
- glTranslatex((x * translationScale) * 65536,
- (y * translationScale) * 65536,
- 0);
- glRotatex((GLfixed)((randomUInt() % 360) << 16), 0, 0, 1 << 16);
- glScalex(fixedScale, fixedScale, fixedScale);
-
- drawGLObject(sSuperShapeObjects[curShape]);
- glPopMatrix();
- }
- }
-
- for (x = -2; x <= 2; ++x)
- {
- const int shipScale100 = translationScale * 500;
- const int offs100 = x * shipScale100 + (sTick % shipScale100);
- float offs = offs100 * 0.01f;
- GLfixed fixedOffs = (GLfixed)(offs * 65536);
- glPushMatrix();
- glTranslatex(fixedOffs, -4 * 65536, 2 << 16);
- drawGLObject(sSuperShapeObjects[SUPERSHAPE_COUNT - 1]);
- glPopMatrix();
- glPushMatrix();
- glTranslatex(-4 * 65536, fixedOffs, 4 << 16);
- glRotatex(90 << 16, 0, 0, 1 << 16);
- drawGLObject(sSuperShapeObjects[SUPERSHAPE_COUNT - 1]);
- glPopMatrix();
- }
-}
-
-
-/* Following gluLookAt implementation is adapted from the
- * Mesa 3D Graphics library. http://www.mesa3d.org
- */
-static void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
- GLfloat centerx, GLfloat centery, GLfloat centerz,
- GLfloat upx, GLfloat upy, GLfloat upz)
-{
- GLfloat m[16];
- GLfloat x[3], y[3], z[3];
- GLfloat mag;
-
- /* Make rotation matrix */
-
- /* Z vector */
- z[0] = eyex - centerx;
- z[1] = eyey - centery;
- z[2] = eyez - centerz;
- mag = (float)sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
- if (mag) { /* mpichler, 19950515 */
- z[0] /= mag;
- z[1] /= mag;
- z[2] /= mag;
- }
-
- /* Y vector */
- y[0] = upx;
- y[1] = upy;
- y[2] = upz;
-
- /* X vector = Y cross Z */
- x[0] = y[1] * z[2] - y[2] * z[1];
- x[1] = -y[0] * z[2] + y[2] * z[0];
- x[2] = y[0] * z[1] - y[1] * z[0];
-
- /* Recompute Y = Z cross X */
- y[0] = z[1] * x[2] - z[2] * x[1];
- y[1] = -z[0] * x[2] + z[2] * x[0];
- y[2] = z[0] * x[1] - z[1] * x[0];
-
- /* mpichler, 19950515 */
- /* cross product gives area of parallelogram, which is < 1.0 for
- * non-perpendicular unit-length vectors; so normalize x, y here
- */
-
- mag = (float)sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
- if (mag) {
- x[0] /= mag;
- x[1] /= mag;
- x[2] /= mag;
- }
-
- mag = (float)sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
- if (mag) {
- y[0] /= mag;
- y[1] /= mag;
- y[2] /= mag;
- }
-
-#define M(row,col) m[col*4+row]
- M(0, 0) = x[0];
- M(0, 1) = x[1];
- M(0, 2) = x[2];
- M(0, 3) = 0.0;
- M(1, 0) = y[0];
- M(1, 1) = y[1];
- M(1, 2) = y[2];
- M(1, 3) = 0.0;
- M(2, 0) = z[0];
- M(2, 1) = z[1];
- M(2, 2) = z[2];
- M(2, 3) = 0.0;
- M(3, 0) = 0.0;
- M(3, 1) = 0.0;
- M(3, 2) = 0.0;
- M(3, 3) = 1.0;
-#undef M
- {
- int a;
- GLfixed fixedM[16];
- for (a = 0; a < 16; ++a)
- fixedM[a] = (GLfixed)(m[a] * 65536);
- glMultMatrixx(fixedM);
- }
-
- /* Translate Eye to Origin */
- glTranslatex((GLfixed)(-eyex * 65536),
- (GLfixed)(-eyey * 65536),
- (GLfixed)(-eyez * 65536));
-}
-
-
-static void camTrack()
-{
- float lerp[5];
- float eX, eY, eZ, cX, cY, cZ;
- float trackPos;
- CAMTRACK *cam;
- long currentCamTick;
- int a;
-
- if (sNextCamTrackStartTick <= sTick)
- {
- ++sCurrentCamTrack;
- sCurrentCamTrackStartTick = sNextCamTrackStartTick;
- }
- sNextCamTrackStartTick = sCurrentCamTrackStartTick +
- sCamTracks[sCurrentCamTrack].len * CAMTRACK_LEN;
-
- cam = &sCamTracks[sCurrentCamTrack];
- currentCamTick = sTick - sCurrentCamTrackStartTick;
- trackPos = (float)currentCamTick / (CAMTRACK_LEN * cam->len);
-
- for (a = 0; a < 5; ++a)
- lerp[a] = (cam->src[a] + cam->dest[a] * trackPos) * 0.01f;
-
- if (cam->dist)
- {
- float dist = cam->dist * 0.1f;
- cX = lerp[0];
- cY = lerp[1];
- cZ = lerp[2];
- eX = cX - (float)cos(lerp[3]) * dist;
- eY = cY - (float)sin(lerp[3]) * dist;
- eZ = cZ - lerp[4];
- }
- else
- {
- eX = lerp[0];
- eY = lerp[1];
- eZ = lerp[2];
- cX = eX + (float)cos(lerp[3]);
- cY = eY + (float)sin(lerp[3]);
- cZ = eZ + lerp[4];
- }
- gluLookAt(eX, eY, eZ, cX, cY, cZ, 0, 0, 1);
-}
-
-
-// Called from the app framework.
-/* The tick is current time in milliseconds, width and height
- * are the image dimensions to be rendered.
- */
-void appRender(long tick, int width, int height)
-{
- if (sStartTick == 0)
- sStartTick = tick;
- if (!gAppAlive)
- return;
-
- // Actual tick value is "blurred" a little bit.
- sTick = (sTick + tick - sStartTick) >> 1;
-
- // Terminate application after running through the demonstration once.
- if (sTick >= RUN_LENGTH)
- {
- gAppAlive = 0;
- return;
- }
-
- // Prepare OpenGL ES for rendering of the frame.
- prepareFrame(width, height);
-
- // Update the camera position and set the lookat.
- camTrack();
-
- // Configure environment.
- configureLightAndMaterial();
-
- // Draw the reflection by drawing models with negated Z-axis.
- glPushMatrix();
- drawModels(-1);
- glPopMatrix();
-
- // Blend the ground plane to the window.
- drawGroundPlane();
-
- // Draw all the models normally.
- drawModels(1);
-
- // Draw fade quad over whole window (when changing cameras).
- drawFadeQuad();
-}
diff --git a/opengl/tests/angeles/include/GLES/egl.h b/opengl/tests/angeles/include/GLES/egl.h
deleted file mode 100644
index cdf8410..0000000
--- a/opengl/tests/angeles/include/GLES/egl.h
+++ /dev/null
@@ -1,229 +0,0 @@
-#ifndef __egl_h_
-#define __egl_h_
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.0 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-*/
-
-#include <GLES/gl.h>
-#include <GLES/egltypes.h>
-
-/*
-** egltypes.h is platform dependent. It defines:
-**
-** - EGL types and resources
-** - Native types
-** - EGL and native handle values
-**
-** EGL types and resources are to be typedef'ed with appropriate platform
-** dependent resource handle types. EGLint must be an integer of at least
-** 32-bit.
-**
-** NativeDisplayType, NativeWindowType and NativePixmapType are to be
-** replaced with corresponding types of the native window system in egl.h.
-**
-** EGL and native handle values must match their types.
-**
-** Example egltypes.h:
-*/
-
-#if 0
-
-#include <sys/types.h>
-#include <native_window_system.h>
-
-/*
-** Types and resources
-*/
-typedef int EGLBoolean;
-typedef int32_t EGLint;
-typedef void *EGLDisplay;
-typedef void *EGLConfig;
-typedef void *EGLSurface;
-typedef void *EGLContext;
-
-/*
-** EGL and native handle values
-*/
-#define EGL_DEFAULT_DISPLAY ((NativeDisplayType)0)
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
-
-#endif
-
-/*
-** Versioning and extensions
-*/
-#define EGL_VERSION_1_0 1
-
-/*
-** Boolean
-*/
-#define EGL_FALSE 0
-#define EGL_TRUE 1
-
-/*
-** Errors
-*/
-#define EGL_SUCCESS 0x3000
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-/* 0x300E - 0x301F reserved for additional errors. */
-
-/*
-** Config attributes
-*/
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE 0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-/*#define EGL_PRESERVED_RESOURCES 0x3030*/
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-
-/*
-** Config attribute and value
-*/
-#define EGL_NONE 0x3038
-/* 0x3039 - 0x304F reserved for additional config attributes. */
-
-/*
-** Config values
-*/
-#define EGL_DONT_CARE ((EGLint) -1)
-#define EGL_PBUFFER_BIT 0x01
-#define EGL_PIXMAP_BIT 0x02
-#define EGL_WINDOW_BIT 0x04
-#define EGL_SLOW_CONFIG 0x3050
-#define EGL_NON_CONFORMANT_CONFIG 0x3051
-#define EGL_TRANSPARENT_RGB 0x3052
-
-/*
-** String names
-*/
-#define EGL_VENDOR 0x3053
-#define EGL_VERSION 0x3054
-#define EGL_EXTENSIONS 0x3055
-
-/*
-** Surface attributes
-*/
-#define EGL_HEIGHT 0x3056
-#define EGL_WIDTH 0x3057
-#define EGL_LARGEST_PBUFFER 0x3058
-
-/*
-** Current surfaces
-*/
-#define EGL_DRAW 0x3059
-#define EGL_READ 0x305A
-
-/*
-** Engines
-*/
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-
-/* 0x305C-0x3FFFF reserved for future use */
-
-/*
-** Functions
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-GLAPI EGLint APIENTRY eglGetError (void);
-
-GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display);
-GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
-GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy);
-GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
-GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))();
-
-GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-
-GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
-GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
-GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
-GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-
-GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
-GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
-GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-GLAPI EGLContext APIENTRY eglGetCurrentContext (void);
-GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw);
-GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void);
-GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-
-GLAPI EGLBoolean APIENTRY eglWaitGL (void);
-GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
-GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
-GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ___egl_h_ */
diff --git a/opengl/tests/angeles/include/GLES/egltypes.h b/opengl/tests/angeles/include/GLES/egltypes.h
deleted file mode 100644
index 9db36c9..0000000
--- a/opengl/tests/angeles/include/GLES/egltypes.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-** Types and resources
-*/
-typedef int EGLBoolean;
-typedef long EGLint;
-typedef void *EGLDisplay;
-typedef void *EGLConfig;
-typedef void *EGLSurface;
-typedef void *EGLContext;
-typedef void *NativeDisplayType;
-typedef void *NativeWindowType;
-typedef void *NativePixmapType;
-
-/*
-** EGL and native handle values
-*/
-#define EGL_DEFAULT_DISPLAY ((NativeDisplayType)0)
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
diff --git a/opengl/tests/angeles/include/GLES/gl.h b/opengl/tests/angeles/include/GLES/gl.h
deleted file mode 100644
index 4154822..0000000
--- a/opengl/tests/angeles/include/GLES/gl.h
+++ /dev/null
@@ -1,584 +0,0 @@
-#ifndef __gl_h_
-#define __gl_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.0 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-*/
-
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef signed char GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef unsigned char GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef float GLfloat;
-typedef float GLclampf;
-typedef void GLvoid;
-typedef int GLintptrARB;
-typedef int GLsizeiptrARB;
-typedef int GLfixed;
-typedef int GLclampx;
-/* Internal convenience typedefs */
-typedef void (*_GLfuncptr)();
-
-/*************************************************************/
-
-/* Extensions */
-#define GL_OES_VERSION_1_0 1
-#define GL_OES_read_format 1
-#define GL_OES_compressed_paletted_texture 1
-
-/* ClearBufferMask */
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-
-/* Boolean */
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/* BeginMode */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-
-/* AlphaFunction */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-
-/* BlendingFactorDest */
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-
-/* BlendingFactorSrc */
-/* GL_ZERO */
-/* GL_ONE */
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-/* GL_SRC_ALPHA */
-/* GL_ONE_MINUS_SRC_ALPHA */
-/* GL_DST_ALPHA */
-/* GL_ONE_MINUS_DST_ALPHA */
-
-/* ColorMaterialFace */
-/* GL_FRONT_AND_BACK */
-
-/* ColorMaterialParameter */
-/* GL_AMBIENT_AND_DIFFUSE */
-
-/* ColorPointerType */
-/* GL_UNSIGNED_BYTE */
-/* GL_FLOAT */
-/* GL_FIXED */
-
-/* CullFaceMode */
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-
-/* DepthFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* EnableCap */
-#define GL_FOG 0x0B60
-#define GL_LIGHTING 0x0B50
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_BLEND 0x0BE2
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-/* GL_LIGHT0 */
-/* GL_LIGHT1 */
-/* GL_LIGHT2 */
-/* GL_LIGHT3 */
-/* GL_LIGHT4 */
-/* GL_LIGHT5 */
-/* GL_LIGHT6 */
-/* GL_LIGHT7 */
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_NORMALIZE 0x0BA1
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-
-/* ErrorCode */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* FogMode */
-/* GL_LINEAR */
-#define GL_EXP 0x0800
-#define GL_EXP2 0x0801
-
-/* FogParameter */
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_COLOR 0x0B66
-
-/* FrontFaceDirection */
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-
-/* GetPName */
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-
-/* HintMode */
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* HintTarget */
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_POLYGON_SMOOTH_HINT 0x0C53
-#define GL_FOG_HINT 0x0C54
-
-/* LightModelParameter */
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-
-/* LightParameter */
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-
-/* DataType */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-
-/* LogicOp */
-#define GL_CLEAR 0x1500
-#define GL_AND 0x1501
-#define GL_AND_REVERSE 0x1502
-#define GL_COPY 0x1503
-#define GL_AND_INVERTED 0x1504
-#define GL_NOOP 0x1505
-#define GL_XOR 0x1506
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_EQUIV 0x1509
-#define GL_INVERT 0x150A
-#define GL_OR_REVERSE 0x150B
-#define GL_COPY_INVERTED 0x150C
-#define GL_OR_INVERTED 0x150D
-#define GL_NAND 0x150E
-#define GL_SET 0x150F
-
-/* MaterialFace */
-/* GL_FRONT_AND_BACK */
-
-/* MaterialParameter */
-#define GL_EMISSION 0x1600
-#define GL_SHININESS 0x1601
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-/* GL_AMBIENT */
-/* GL_DIFFUSE */
-/* GL_SPECULAR */
-
-/* MatrixMode */
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-
-/* NormalPointerType */
-/* GL_BYTE */
-/* GL_SHORT */
-/* GL_FLOAT */
-/* GL_FIXED */
-
-/* PixelFormat */
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-
-/* PixelStoreParameter */
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-
-/* PixelType */
-/* GL_UNSIGNED_BYTE */
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-
-/* ShadingModel */
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-
-/* StencilFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* StencilOp */
-/* GL_ZERO */
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-/* GL_INVERT */
-
-/* StringName */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* TexCoordPointerType */
-/* GL_SHORT */
-/* GL_FLOAT */
-/* GL_FIXED */
-/* GL_BYTE */
-
-/* TextureEnvMode */
-#define GL_MODULATE 0x2100
-#define GL_DECAL 0x2101
-/* GL_BLEND */
-#define GL_ADD 0x0104
-/* GL_REPLACE */
-
-/* TextureEnvParameter */
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_ENV_COLOR 0x2201
-
-/* TextureEnvTarget */
-#define GL_TEXTURE_ENV 0x2300
-
-/* TextureMagFilter */
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-
-/* TextureMinFilter */
-/* GL_NEAREST */
-/* GL_LINEAR */
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-
-/* TextureParameterName */
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-
-/* TextureTarget */
-/* GL_TEXTURE_2D */
-
-/* TextureUnit */
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-
-/* TextureWrapMode */
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-
-/* PixelInternalFormat */
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-
-/* VertexPointerType */
-/* GL_SHORT */
-/* GL_FLOAT */
-/* GL_FIXED */
-/* GL_BYTE */
-
-/* LightName */
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-
-
-/*************************************************************/
-
-GLAPI void APIENTRY glActiveTexture (GLenum texture);
-GLAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
-GLAPI void APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
-GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
-GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GLAPI void APIENTRY glClear (GLbitfield mask);
-GLAPI void APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GLAPI void APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-GLAPI void APIENTRY glClearDepthf (GLclampf depth);
-GLAPI void APIENTRY glClearDepthx (GLclampx depth);
-GLAPI void APIENTRY glClearStencil (GLint s);
-GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
-GLAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GLAPI void APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GLAPI void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glCullFace (GLenum mode);
-GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GLAPI void APIENTRY glDepthFunc (GLenum func);
-GLAPI void APIENTRY glDepthMask (GLboolean flag);
-GLAPI void APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
-GLAPI void APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
-GLAPI void APIENTRY glDisable (GLenum cap);
-GLAPI void APIENTRY glDisableClientState (GLenum array);
-GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-GLAPI void APIENTRY glEnable (GLenum cap);
-GLAPI void APIENTRY glEnableClientState (GLenum array);
-GLAPI void APIENTRY glFinish (void);
-GLAPI void APIENTRY glFlush (void);
-GLAPI void APIENTRY glFogf (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glFogfv (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glFogx (GLenum pname, GLfixed param);
-GLAPI void APIENTRY glFogxv (GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glFrontFace (GLenum mode);
-GLAPI void APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GLAPI void APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GLAPI GLenum APIENTRY glGetError (void);
-GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params);
-GLAPI const GLubyte * APIENTRY glGetString (GLenum name);
-GLAPI void APIENTRY glHint (GLenum target, GLenum mode);
-GLAPI void APIENTRY glLightModelf (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glLightModelx (GLenum pname, GLfixed param);
-GLAPI void APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glLineWidth (GLfloat width);
-GLAPI void APIENTRY glLineWidthx (GLfixed width);
-GLAPI void APIENTRY glLoadIdentity (void);
-GLAPI void APIENTRY glLoadMatrixf (const GLfloat *m);
-GLAPI void APIENTRY glLoadMatrixx (const GLfixed *m);
-GLAPI void APIENTRY glLogicOp (GLenum opcode);
-GLAPI void APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glMatrixMode (GLenum mode);
-GLAPI void APIENTRY glMultMatrixf (const GLfloat *m);
-GLAPI void APIENTRY glMultMatrixx (const GLfixed *m);
-GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GLAPI void APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
-GLAPI void APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
-GLAPI void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
-GLAPI void APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GLAPI void APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
-GLAPI void APIENTRY glPointSize (GLfloat size);
-GLAPI void APIENTRY glPointSizex (GLfixed size);
-GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GLAPI void APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
-GLAPI void APIENTRY glPopMatrix (void);
-GLAPI void APIENTRY glPushMatrix (void);
-GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
-GLAPI void APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
-GLAPI void APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
-GLAPI void APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glShadeModel (GLenum mode);
-GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GLAPI void APIENTRY glStencilMask (GLuint mask);
-GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GLAPI void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GLAPI void APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-GLAPI void APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl_h_ */
diff --git a/opengl/tests/angeles/license-BSD.txt b/opengl/tests/angeles/license-BSD.txt
deleted file mode 100644
index 8924e3c..0000000
--- a/opengl/tests/angeles/license-BSD.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-This is the BSD-style license for the "San Angeles Observation"
-OpenGL ES version example source code
----------------------------------------------------------------
-
-San Angeles Observation OpenGL ES version example
-Copyright (c) 2004-2005, Jetro Lauha
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of the software product's copyright owner nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/opengl/tests/angeles/license-LGPL.txt b/opengl/tests/angeles/license-LGPL.txt
deleted file mode 100644
index b1e3f5a..0000000
--- a/opengl/tests/angeles/license-LGPL.txt
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/opengl/tests/angeles/license.txt b/opengl/tests/angeles/license.txt
deleted file mode 100644
index 620841e..0000000
--- a/opengl/tests/angeles/license.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-San Angeles Observation OpenGL ES version example
-Copyright 2004-2005 Jetro Lauha
-All rights reserved.
-Web: http://iki.fi/jetro/
-
-This source is free software; you can redistribute it and/or
-modify it under the terms of EITHER:
- (1) The GNU Lesser General Public License as published by the Free
- Software Foundation; either version 2.1 of the License, or (at
- your option) any later version. The text of the GNU Lesser
- General Public License is included with this source in the
- file LICENSE-LGPL.txt.
- (2) The BSD-style license that is included with this source in
- the file LICENSE-BSD.txt.
-
-This source is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
-LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
diff --git a/opengl/tests/angeles/shapes.h b/opengl/tests/angeles/shapes.h
deleted file mode 100644
index 25ffae8..0000000
--- a/opengl/tests/angeles/shapes.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* San Angeles Observation OpenGL ES version example
- * Copyright 2004-2005 Jetro Lauha
- * All rights reserved.
- * Web: http://iki.fi/jetro/
- *
- * This source is free software; you can redistribute it and/or
- * modify it under the terms of EITHER:
- * (1) The GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version. The text of the GNU Lesser
- * General Public License is included with this source in the
- * file LICENSE-LGPL.txt.
- * (2) The BSD-style license that is included with this source in
- * the file LICENSE-BSD.txt.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
- * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
- *
- * $Id: shapes.h,v 1.6 2005/01/31 22:15:30 tonic Exp $
- * $Revision: 1.6 $
- */
-
-#ifndef SHAPES_H_INCLUDED
-#define SHAPES_H_INCLUDED
-
-
-#define SUPERSHAPE_PARAMS 15
-
-static const float sSuperShapeParams[][SUPERSHAPE_PARAMS] =
-{
- // m a b n1 n2 n3 m a b n1 n2 n3 res1 res2 scale (org.res1,res2)
- { 10, 1, 2, 90, 1, -45, 8, 1, 1, -1, 1, -0.4f, 20, 30, 2 }, // 40, 60
- { 10, 1, 2, 90, 1, -45, 4, 1, 1, 10, 1, -0.4f, 20, 20, 4 }, // 40, 40
- { 10, 1, 2, 60, 1, -10, 4, 1, 1, -1, -2, -0.4f, 41, 41, 1 }, // 82, 82
- { 6, 1, 1, 60, 1, -70, 8, 1, 1, 0.4f, 3, 0.25f, 20, 20, 1 }, // 40, 40
- { 4, 1, 1, 30, 1, 20, 12, 1, 1, 0.4f, 3, 0.25f, 10, 30, 1 }, // 20, 60
- { 8, 1, 1, 30, 1, -4, 8, 2, 1, -1, 5, 0.5f, 25, 26, 1 }, // 60, 60
- { 13, 1, 1, 30, 1, -4, 13, 1, 1, 1, 5, 1, 30, 30, 6 }, // 60, 60
- { 10, 1, 1.1f, -0.5f, 0.1f, 70, 60, 1, 1, -90, 0, -0.25f, 20, 60, 8 }, // 60, 180
- { 7, 1, 1, 20, -0.3f, -3.5f, 6, 1, 1, -1, 4.5f, 0.5f, 10, 20, 4 }, // 60, 80
- { 4, 1, 1, 10, 10, 10, 4, 1, 1, 10, 10, 10, 10, 20, 1 }, // 20, 40
- { 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 10, 10, 2 }, // 10, 10
- { 1, 1, 1, 38, -0.25f, 19, 4, 1, 1, 10, 10, 10, 10, 15, 2 }, // 20, 40
- { 2, 1, 1, 0.7f, 0.3f, 0.2f, 3, 1, 1, 100, 100, 100, 10, 25, 2 }, // 20, 50
- { 6, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 30, 30, 2 }, // 60, 60
- { 3, 1, 1, 1, 1, 1, 6, 1, 1, 2, 1, 1, 10, 20, 2 }, // 20, 40
- { 6, 1, 1, 6, 5.5f, 100, 6, 1, 1, 25, 10, 10, 30, 20, 2 }, // 60, 40
- { 3, 1, 1, 0.5f, 1.7f, 1.7f, 2, 1, 1, 10, 10, 10, 20, 20, 2 }, // 40, 40
- { 5, 1, 1, 0.1f, 1.7f, 1.7f, 1, 1, 1, 0.3f, 0.5f, 0.5f, 20, 20, 4 }, // 40, 40
- { 2, 1, 1, 6, 5.5f, 100, 6, 1, 1, 4, 10, 10, 10, 22, 1 }, // 40, 40
- { 6, 1, 1, -1, 70, 0.1f, 9, 1, 0.5f, -98, 0.05f, -45, 20, 30, 4 }, // 60, 91
- { 6, 1, 1, -1, 90, -0.1f, 7, 1, 1, 90, 1.3f, 34, 13, 16, 1 }, // 32, 60
-};
-#define SUPERSHAPE_COUNT (sizeof(sSuperShapeParams) / sizeof(sSuperShapeParams[0]))
-
-
-#endif // !SHAPES_H_INCLUDED
diff --git a/opengl/tests/configdump/Android.mk b/opengl/tests/configdump/Android.mk
deleted file mode 100644
index 3f7c915..0000000
--- a/opengl/tests/configdump/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- configdump.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM
-
-LOCAL_MODULE:= test-opengl-configdump
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/configdump/configdump.cpp b/opengl/tests/configdump/configdump.cpp
deleted file mode 100644
index 69b9eb6..0000000
--- a/opengl/tests/configdump/configdump.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-** Copyright 2010, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <EGL/egl.h>
-
-#define ATTRIBUTE(_attr) { _attr, #_attr }
-
-struct Attribute {
- EGLint attribute;
- char const* name;
-};
-
-Attribute attributes[] = {
- ATTRIBUTE( EGL_BUFFER_SIZE ),
- ATTRIBUTE( EGL_ALPHA_SIZE ),
- ATTRIBUTE( EGL_BLUE_SIZE ),
- ATTRIBUTE( EGL_GREEN_SIZE ),
- ATTRIBUTE( EGL_RED_SIZE ),
- ATTRIBUTE( EGL_DEPTH_SIZE ),
- ATTRIBUTE( EGL_STENCIL_SIZE ),
- ATTRIBUTE( EGL_CONFIG_CAVEAT ),
- ATTRIBUTE( EGL_CONFIG_ID ),
- ATTRIBUTE( EGL_LEVEL ),
- ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ),
- ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ),
- ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ),
- ATTRIBUTE( EGL_NATIVE_RENDERABLE ),
- ATTRIBUTE( EGL_NATIVE_VISUAL_ID ),
- ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ),
- ATTRIBUTE( EGL_SAMPLES ),
- ATTRIBUTE( EGL_SAMPLE_BUFFERS ),
- ATTRIBUTE( EGL_SURFACE_TYPE ),
- ATTRIBUTE( EGL_TRANSPARENT_TYPE ),
- ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ),
- ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ),
- ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ),
- ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ),
- ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ),
- ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ),
- ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ),
- ATTRIBUTE( EGL_LUMINANCE_SIZE ),
- ATTRIBUTE( EGL_ALPHA_MASK_SIZE ),
- ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ),
- ATTRIBUTE( EGL_RENDERABLE_TYPE ),
- ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ),
- ATTRIBUTE( EGL_CONFORMANT ),
-};
-
-
-int main(int argc, char** argv)
-{
- EGLConfig* configs;
- EGLint n;
-
- EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, 0, 0);
- eglGetConfigs(dpy, NULL, 0, &n);
- configs = new EGLConfig[n];
- eglGetConfigs(dpy, configs, n, &n);
-
- for (EGLint i=0 ; i<n ; i++) {
- printf("EGLConfig[%d]\n", i);
- for (int attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
- EGLint value;
- eglGetConfigAttrib(dpy, configs[i], attributes[attr].attribute, &value);
- printf("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value);
- }
- }
-
- delete [] configs;
- eglTerminate(dpy);
- return 0;
-}
diff --git a/opengl/tests/fillrate/Android.mk b/opengl/tests/fillrate/Android.mk
deleted file mode 100644
index 4dade21..0000000
--- a/opengl/tests/fillrate/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- fillrate.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-fillrate
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/fillrate/fillrate.cpp b/opengl/tests/fillrate/fillrate.cpp
deleted file mode 100644
index a708647..0000000
--- a/opengl/tests/fillrate/fillrate.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#define LOG_TAG "fillrate"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- EGLint configAttribs[] = {
- EGL_DEPTH_SIZE, 0,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
-
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
- return 0;
- }
-
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- context = eglCreateContext(dpy, config, NULL, NULL);
- eglMakeCurrent(dpy, surface, surface, context);
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
-
- printf("w=%d, h=%d\n", w, h);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_DITHER);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
-
- uint32_t* t32 = (uint32_t*)malloc(512*512*4);
- for (int y=0 ; y<512 ; y++) {
- for (int x=0 ; x<512 ; x++) {
- int u = x-256;
- int v = y-256;
- if (u*u+v*v < 256*256) {
- t32[x+y*512] = 0x10FFFFFF;
- } else {
- t32[x+y*512] = 0x20FF0000;
- }
- }
- }
-
- const GLfloat vertices[4][2] = {
- { 0, 0 },
- { 0, h },
- { w, h },
- { w, 0 }
- };
-
- const GLfloat texCoords[4][2] = {
- { 0, 0 },
- { 0, 1 },
- { 1, 1 },
- { 1, 0 }
- };
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, t32);
-
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrthof(0, w, 0, h, 0, 1);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
-
- eglSwapInterval(dpy, 1);
-
- glClearColor(1,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- eglSwapBuffers(dpy, surface);
-
-
- nsecs_t times[32];
-
- for (int c=1 ; c<32 ; c++) {
- glClear(GL_COLOR_BUFFER_BIT);
- for (int i=0 ; i<c ; i++) {
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- eglSwapBuffers(dpy, surface);
- }
-
-
- // for (int c=31 ; c>=1 ; c--) {
- int j=0;
- for (int c=1 ; c<32 ; c++) {
- glClear(GL_COLOR_BUFFER_BIT);
- nsecs_t now = systemTime();
- for (int i=0 ; i<c ; i++) {
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- eglSwapBuffers(dpy, surface);
- nsecs_t t = systemTime() - now;
- times[j++] = t;
- }
-
- for (int c=1, j=0 ; c<32 ; c++, j++) {
- nsecs_t t = times[j];
- printf("%lld\t%d\t%f\n", t, c, (double(t)/c)/1000000.0);
- }
-
-
-
- eglTerminate(dpy);
-
- return 0;
-}
diff --git a/opengl/tests/filter/Android.mk b/opengl/tests/filter/Android.mk
deleted file mode 100644
index d3e4d38..0000000
--- a/opengl/tests/filter/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- filter.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-filter
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/filter/filter.cpp b/opengl/tests/filter/filter.cpp
deleted file mode 100644
index 0067327..0000000
--- a/opengl/tests/filter/filter.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-#define USE_DRAW_TEXTURE 1
-
-int main(int argc, char** argv)
-{
- if (argc!=2 && argc!=3) {
- printf("usage: %s <0-6> [pbuffer]\n", argv[0]);
- return 0;
- }
-
- const int test = atoi(argv[1]);
- int usePbuffer = argc==3 && !strcmp(argv[2], "pbuffer");
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT|EGL_WINDOW_BIT,
- EGL_RED_SIZE, 5,
- EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5,
- EGL_NONE
- };
-
- EGLint numConfigs = -1;
- EGLint majorVersion;
- EGLint minorVersion;
- EGLConfig config;
- EGLContext context;
- EGLSurface surface;
- EGLint w, h;
-
- EGLDisplay dpy;
-
- EGLNativeWindowType window = 0;
- if (!usePbuffer) {
- window = android_createDisplaySurface();
- }
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
- if (!usePbuffer) {
- EGLUtils::selectConfigForNativeWindow(
- dpy, s_configAttribs, window, &config);
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- } else {
- printf("using pbuffer\n");
- eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
- EGLint attribs[] = { EGL_WIDTH, 320, EGL_HEIGHT, 480, EGL_NONE };
- surface = eglCreatePbufferSurface(dpy, config, attribs);
- if (surface == EGL_NO_SURFACE) {
- printf("eglCreatePbufferSurface error %x\n", eglGetError());
- }
- }
- context = eglCreateContext(dpy, config, NULL, NULL);
- eglMakeCurrent(dpy, surface, surface, context);
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- GLint dim = w<h ? w : h;
-
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrthof(0, w, 0, h, 0, 1);
-
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- GLint crop[4] = { 0, 4, 4, -4 };
- glBindTexture(GL_TEXTURE_2D, 0);
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
-
- // packing is always 4
- uint8_t t8[] = {
- 0x00, 0x55, 0x00, 0x55,
- 0xAA, 0xFF, 0xAA, 0xFF,
- 0x00, 0x55, 0x00, 0x55,
- 0xAA, 0xFF, 0xAA, 0xFF };
-
- uint16_t t16[] = {
- 0x0000, 0x5555, 0x0000, 0x5555,
- 0xAAAA, 0xFFFF, 0xAAAA, 0xFFFF,
- 0x0000, 0x5555, 0x0000, 0x5555,
- 0xAAAA, 0xFFFF, 0xAAAA, 0xFFFF };
-
- uint16_t t5551[] = {
- 0x0000, 0xFFFF, 0x0000, 0xFFFF,
- 0xFFFF, 0x0000, 0xFFFF, 0x0000,
- 0x0000, 0xFFFF, 0x0000, 0xFFFF,
- 0xFFFF, 0x0000, 0xFFFF, 0x0000 };
-
- uint32_t t32[] = {
- 0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFFFF0000,
- 0xFF00FF00, 0xFFFF0000, 0xFF000000, 0xFF0000FF,
- 0xFF00FFFF, 0xFF00FF00, 0x00FF00FF, 0xFFFFFF00,
- 0xFF000000, 0xFFFF00FF, 0xFF00FFFF, 0xFFFFFFFF
- };
-
- switch(test)
- {
- case 1:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE,
- 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, t8);
- break;
- case 2:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- 4, 4, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, t16);
- break;
- case 3:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, t16);
- break;
- case 4:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA,
- 4, 4, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, t16);
- break;
- case 5:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, t5551);
- break;
- case 6:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, t32);
- break;
- }
-
- //glDrawTexiOES(0, 0, 0, dim, dim);
-
- const GLfloat vertices[4][2] = {
- { 0, 0 },
- { 0, dim },
- { dim, dim },
- { dim, 0 }
- };
-
- const GLfloat texCoords[4][2] = {
- { 0, 0 },
- { 0, 1 },
- { 1, 1 },
- { 1, 0 }
- };
-
- if (!usePbuffer) {
- eglSwapBuffers(dpy, surface);
- }
-
- glMatrixMode(GL_MODELVIEW);
- glScissor(0,dim,dim,h-dim);
- glDisable(GL_SCISSOR_TEST);
-
- for (int y=0 ; y<dim ; y++) {
- //glDisable(GL_SCISSOR_TEST);
- glClear(GL_COLOR_BUFFER_BIT);
-
- //glEnable(GL_SCISSOR_TEST);
-
-#if USE_DRAW_TEXTURE && GL_OES_draw_texture
- glDrawTexiOES(0, y, 1, dim, dim);
-#else
- glLoadIdentity();
- glTranslatef(0, y, 0);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-#endif
-
- if (!usePbuffer) {
- eglSwapBuffers(dpy, surface);
- } else {
- glFinish();
- }
- }
-
- eglTerminate(dpy);
- return 0;
-}
diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk
deleted file mode 100644
index aa8adca..0000000
--- a/opengl/tests/finish/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- finish.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-finish
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/finish/finish.cpp b/opengl/tests/finish/finish.cpp
deleted file mode 100644
index 11f0c22..0000000
--- a/opengl/tests/finish/finish.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/Timers.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- EGLint configAttribs[] = {
- EGL_DEPTH_SIZE, 0,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
-
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
- return 0;
- }
-
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- context = eglCreateContext(dpy, config, NULL, NULL);
- eglMakeCurrent(dpy, surface, surface, context);
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- GLint dim = w<h ? w : h;
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
- glDisable(GL_DITHER);
- glShadeModel(GL_FLAT);
-
- long long now, t;
- int i;
-
- char* texels = (char*)malloc(512*512*2);
- memset(texels,0xFF,512*512*2);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- 512, 512, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, texels);
-
- char* dst = (char*)malloc(320*480*2);
- memset(dst, 0, 320*480*2);
- printf("307200 bytes memcpy\n");
- for (i=0 ; i<4 ; i++) {
- now = systemTime();
- memcpy(dst, texels, 320*480*2);
- t = systemTime();
- printf("memcpy() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- }
- free(dst);
-
- free(texels);
-
- setpriority(PRIO_PROCESS, 0, -20);
-
- printf("512x512 unmodified texture, 512x512 blit:\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- GLint crop[4] = { 0, 512, 512, -512 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 512, 512);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
- printf("512x512 unmodified texture, 1x1 blit:\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- GLint crop[4] = { 0, 1, 1, -1 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 1, 1);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
- printf("512x512 unmodified texture, 512x512 blit (x2):\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- GLint crop[4] = { 0, 512, 512, -512 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 512, 512);
- glDrawTexiOES(0, 0, 0, 512, 512);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
- printf("512x512 unmodified texture, 1x1 blit (x2):\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- GLint crop[4] = { 0, 1, 1, -1 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 1, 1);
- glDrawTexiOES(0, 0, 0, 1, 1);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
-
- printf("512x512 (1x1 texel MODIFIED texture), 512x512 blit:\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- uint16_t green = 0x7E0;
- GLint crop[4] = { 0, 512, 512, -512 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, &green);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 512, 512);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
-
- int16_t texel = 0xF800;
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, &texel);
-
- printf("1x1 unmodified texture, 1x1 blit:\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- GLint crop[4] = { 0, 1, 1, -1 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 1, 1);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- eglSwapBuffers(dpy, surface);
- }
-
- printf("1x1 unmodified texture, 512x512 blit:\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- GLint crop[4] = { 0, 1, 1, -1 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 512, 512);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
- printf("1x1 (1x1 texel MODIFIED texture), 512x512 blit:\n");
- glClear(GL_COLOR_BUFFER_BIT);
- for (i=0 ; i<4 ; i++) {
- uint16_t green = 0x7E0;
- GLint crop[4] = { 0, 1, 1, -1 };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, &green);
- now = systemTime();
- glDrawTexiOES(0, 0, 0, 1, 1);
- glFinish();
- t = systemTime();
- printf("glFinish() time = %llu us\n", (t-now)/1000);
- fflush(stdout);
- eglSwapBuffers(dpy, surface);
- }
-
- return 0;
-}
diff --git a/opengl/tests/gl2_basic/Android.mk b/opengl/tests/gl2_basic/Android.mk
deleted file mode 100644
index d7819a1..0000000
--- a/opengl/tests/gl2_basic/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_basic.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_basic
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl2_basic/gl2_basic.cpp b/opengl/tests/gl2_basic/gl2_basic.cpp
deleted file mode 100644
index 7007871..0000000
--- a/opengl/tests/gl2_basic/gl2_basic.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <utils/Timers.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-static void printGLString(const char *name, GLenum s) {
- // fprintf(stderr, "printGLString %s, %d\n", name, s);
- const char *v = (const char *) glGetString(s);
- // int error = glGetError();
- // fprintf(stderr, "glGetError() = %d, result of glGetString = %x\n", error,
- // (unsigned int) v);
- // if ((v < (const char*) 0) || (v > (const char*) 0x10000))
- // fprintf(stderr, "GL %s = %s\n", name, v);
- // else
- // fprintf(stderr, "GL %s = (null) 0x%08x\n", name, (unsigned int) v);
- fprintf(stderr, "GL %s = %s\n", name, v);
-}
-
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
- if (returnVal != EGL_TRUE) {
- fprintf(stderr, "%s() returned %d\n", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
- error);
- }
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- fprintf(stderr, "after %s() glError (0x%x)\n", op, error);
- }
-}
-
-static const char gVertexShader[] = "attribute vec4 vPosition;\n"
- "void main() {\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
-static const char gFragmentShader[] = "precision mediump float;\n"
- "void main() {\n"
- " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
- "}\n";
-
-GLuint loadShader(GLenum shaderType, const char* pSource) {
- GLuint shader = glCreateShader(shaderType);
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- glCompileShader(shader);
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- fprintf(stderr, "Could not compile shader %d:\n%s\n",
- shaderType, buf);
- free(buf);
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- }
- return shader;
-}
-
-GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader) {
- return 0;
- }
-
- GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader) {
- return 0;
- }
-
- GLuint program = glCreateProgram();
- if (program) {
- glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- fprintf(stderr, "Could not link program:\n%s\n", buf);
- free(buf);
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
-}
-
-GLuint gProgram;
-GLuint gvPositionHandle;
-
-bool setupGraphics(int w, int h) {
- gProgram = createProgram(gVertexShader, gFragmentShader);
- if (!gProgram) {
- return false;
- }
- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
- checkGlError("glGetAttribLocation");
- fprintf(stderr, "glGetAttribLocation(\"vPosition\") = %d\n",
- gvPositionHandle);
-
- glViewport(0, 0, w, h);
- checkGlError("glViewport");
- return true;
-}
-
-const GLfloat gTriangleVertices[] = { 0.0f, 0.5f, -0.5f, -0.5f,
- 0.5f, -0.5f };
-
-void renderFrame() {
- glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
- checkGlError("glClearColor");
- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- glUseProgram(gProgram);
- checkGlError("glUseProgram");
-
- glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices);
- checkGlError("glVertexAttribPointer");
- glEnableVertexAttribArray(gvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
- glDrawArrays(GL_TRIANGLES, 0, 3);
- checkGlError("glDrawArrays");
-}
-
-void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- printf(" %s: ", names[j].name);
- printf("%d (0x%x)", value, value);
- }
- }
- printf("\n");
-}
-
-int printEGLConfigurations(EGLDisplay dpy) {
- EGLint numConfig = 0;
- EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
- checkEglError("eglGetConfigs", returnVal);
- if (!returnVal) {
- return false;
- }
-
- printf("Number of EGL configuration: %d\n", numConfig);
-
- EGLConfig* configs = (EGLConfig*) malloc(sizeof(EGLConfig) * numConfig);
- if (! configs) {
- printf("Could not allocate configs.\n");
- return false;
- }
-
- returnVal = eglGetConfigs(dpy, configs, numConfig, &numConfig);
- checkEglError("eglGetConfigs", returnVal);
- if (!returnVal) {
- free(configs);
- return false;
- }
-
- for(int i = 0; i < numConfig; i++) {
- printf("Configuration %d\n", i);
- printEGLConfiguration(dpy, configs[i]);
- }
-
- free(configs);
- return true;
-}
-
-int main(int argc, char** argv) {
- EGLBoolean returnValue;
- EGLConfig myConfig = {0};
-
- EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE };
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLSurface surface;
- EGLint w, h;
-
- EGLDisplay dpy;
-
- checkEglError("<init>");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- checkEglError("eglGetDisplay");
- if (dpy == EGL_NO_DISPLAY) {
- printf("eglGetDisplay returned EGL_NO_DISPLAY.\n");
- return 0;
- }
-
- returnValue = eglInitialize(dpy, &majorVersion, &minorVersion);
- checkEglError("eglInitialize", returnValue);
- fprintf(stderr, "EGL version %d.%d\n", majorVersion, minorVersion);
- if (returnValue != EGL_TRUE) {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- if (!printEGLConfigurations(dpy)) {
- printf("printEGLConfigurations failed\n");
- return 0;
- }
-
- checkEglError("printEGLConfigurations");
-
- EGLNativeWindowType window = android_createDisplaySurface();
- returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
- if (returnValue) {
- printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
- return 0;
- }
-
- checkEglError("EGLUtils::selectConfigForNativeWindow");
-
- printf("Chose this configuration:\n");
- printEGLConfiguration(dpy, myConfig);
-
- surface = eglCreateWindowSurface(dpy, myConfig, window, NULL);
- checkEglError("eglCreateWindowSurface");
- if (surface == EGL_NO_SURFACE) {
- printf("gelCreateWindowSurface failed.\n");
- return 0;
- }
-
- context = eglCreateContext(dpy, myConfig, EGL_NO_CONTEXT, context_attribs);
- checkEglError("eglCreateContext");
- if (context == EGL_NO_CONTEXT) {
- printf("eglCreateContext failed\n");
- return 0;
- }
- returnValue = eglMakeCurrent(dpy, surface, surface, context);
- checkEglError("eglMakeCurrent", returnValue);
- if (returnValue != EGL_TRUE) {
- return 0;
- }
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- checkEglError("eglQuerySurface");
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- checkEglError("eglQuerySurface");
- GLint dim = w < h ? w : h;
-
- fprintf(stderr, "Window dimensions: %d x %d\n", w, h);
-
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- if(!setupGraphics(w, h)) {
- fprintf(stderr, "Could not set up graphics.\n");
- return 0;
- }
-
- for (;;) {
- renderFrame();
- eglSwapBuffers(dpy, surface);
- checkEglError("eglSwapBuffers");
- }
-
- return 0;
-}
diff --git a/opengl/tests/gl2_cameraeye/Android.mk b/opengl/tests/gl2_cameraeye/Android.mk
deleted file mode 100644
index 4a43a9e..0000000
--- a/opengl/tests/gl2_cameraeye/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := GL2CameraEye
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/opengl/tests/gl2_cameraeye/AndroidManifest.xml b/opengl/tests/gl2_cameraeye/AndroidManifest.xml
deleted file mode 100644
index c53f7be..0000000
--- a/opengl/tests/gl2_cameraeye/AndroidManifest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- 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.
--->
-
-<!-- Declare the contents of this Android application. The namespace
- attribute brings in the Android platform namespace, and the package
- supplies a unique name for the application. When writing your
- own application, the package name must be changed from "com.example.*"
- to come from a domain that you own or have control over. -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gl2cameraeye">
- <uses-permission android:name="android.permission.CAMERA" />
- <uses-feature android:name="android.hardware.camera" />
- <uses-feature android:name="android.hardware.camera.autofocus" />
- <uses-feature android:glEsVersion="0x00020000" />
- <application android:label="@string/gl2cameraeye_name">
- <activity android:name="GL2CameraEye">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/gl2_cameraeye/res/values/strings.xml b/opengl/tests/gl2_cameraeye/res/values/strings.xml
deleted file mode 100644
index 386b930..0000000
--- a/opengl/tests/gl2_cameraeye/res/values/strings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
- 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.
--->
-
-<resources>
-
- <string name="gl2cameraeye_name">GL2CameraEye</string>
-
-</resources>
diff --git a/opengl/tests/gl2_cameraeye/src/com/android/gl2cameraeye/GL2CameraEye.java b/opengl/tests/gl2_cameraeye/src/com/android/gl2cameraeye/GL2CameraEye.java
deleted file mode 100644
index 561e4c5..0000000
--- a/opengl/tests/gl2_cameraeye/src/com/android/gl2cameraeye/GL2CameraEye.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gl2cameraeye;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.app.Activity;
-import android.content.pm.ActivityInfo;
-import android.os.Bundle;
-import android.view.MotionEvent;
-import android.content.Context;
-import android.util.Log;
-
-import android.opengl.GLES20;
-import android.opengl.GLSurfaceView;
-import android.opengl.GLUtils;
-import android.opengl.Matrix;
-
-import android.graphics.SurfaceTexture;
-
-import android.hardware.Camera;
-import android.hardware.SensorManager;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.Sensor;
-
-public class GL2CameraEye extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mGLView = new CamGLSurfaceView(this);
- setContentView(mGLView);
- setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mGLView.onPause();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mGLView.onResume();
- }
-
- private GLSurfaceView mGLView;
-}
-
-class CamGLSurfaceView extends GLSurfaceView implements SensorEventListener {
- public CamGLSurfaceView(Context context) {
- super(context);
- setEGLContextClientVersion(2);
- mRenderer = new CamRenderer(context);
- setRenderer(mRenderer);
-
- mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
- mAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
- }
-
- public boolean onTouchEvent(final MotionEvent event) {
- queueEvent(new Runnable(){
- public void run() {
- mRenderer.setPosition(event.getX() / getWidth(),
- event.getY() / getHeight());
- }});
- return true;
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mCamera.stopPreview();
- mCamera.release();
-
- mSensorManager.unregisterListener(this);
- }
-
- @Override
- public void onResume() {
- mCamera = Camera.open();
- Camera.Parameters p = mCamera.getParameters();
- // No changes to default camera parameters
- mCamera.setParameters(p);
-
- queueEvent(new Runnable(){
- public void run() {
- mRenderer.setCamera(mCamera);
- }});
-
- mSensorManager.registerListener(this, mAcceleration, SensorManager.SENSOR_DELAY_GAME);
- super.onResume();
- }
-
- public void onSensorChanged(SensorEvent event) {
- if (event.sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION) {
- final float[] accelerationVector = event.values;
- queueEvent(new Runnable(){
- public void run() {
- mRenderer.setAcceleration(accelerationVector);
- }});
- }
- }
-
- public void onAccuracyChanged(Sensor sensor, int accuracy) {
- // Ignoring sensor accuracy changes.
- }
-
- CamRenderer mRenderer;
- Camera mCamera;
-
- SensorManager mSensorManager;
- Sensor mAcceleration;
-}
-
-class CamRenderer implements GLSurfaceView.Renderer, SurfaceTexture.OnFrameAvailableListener {
-
- public CamRenderer(Context context) {
- mContext = context;
-
- mTriangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length
- * FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
- mTriangleVertices.put(mTriangleVerticesData).position(0);
-
- Matrix.setIdentityM(mSTMatrix, 0);
- Matrix.setIdentityM(mMMatrix, 0);
-
- float[] defaultAcceleration = {0.f,0.f,0.f};
- setAcceleration(defaultAcceleration);
- mPos[0] = 0.f;
- mPos[1] = 0.f;
- mPos[2] = 0.f;
- mVel[0] = 0.f;
- mVel[1] = 0.f;
- mVel[2] = 0.f;
-
- }
-
- /* The following set methods are not synchronized, so should only
- * be called within the rendering thread context. Use GLSurfaceView.queueEvent for safe access.
- */
- public void setPosition(float x, float y) {
- /* Map from screen (0,0)-(1,1) to scene coordinates */
- mPos[0] = (x*2-1)*mRatio;
- mPos[1] = (-y)*2+1;
- mPos[2] = 0.f;
- mVel[0] = 0;
- mVel[1] = 0;
- mVel[2] = 0;
- }
-
- public void setCamera(Camera camera) {
- mCamera = camera;
- Camera.Size previewSize = camera.getParameters().getPreviewSize();
- mCameraRatio = (float)previewSize.width/previewSize.height;
- }
-
- public void setAcceleration(float[] accelerationVector) {
- mGForce[0] = accelerationVector[0];
- mGForce[1] = accelerationVector[1];
- mGForce[2] = accelerationVector[2];
- }
-
- public void onDrawFrame(GL10 glUnused) {
- synchronized(this) {
- if (updateSurface) {
- mSurface.updateTexImage();
-
- mSurface.getTransformMatrix(mSTMatrix);
- long timestamp = mSurface.getTimestamp();
- doPhysics(timestamp);
-
- updateSurface = false;
- }
- }
-
- // Ignore the passed-in GL10 interface, and use the GLES20
- // class's static methods instead.
- GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
- GLES20.glUseProgram(mProgram);
- checkGlError("glUseProgram");
-
- GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
- GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureID);
-
- mTriangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET);
- GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false,
- TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices);
- checkGlError("glVertexAttribPointer maPosition");
- GLES20.glEnableVertexAttribArray(maPositionHandle);
- checkGlError("glEnableVertexAttribArray maPositionHandle");
-
- mTriangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET);
- GLES20.glVertexAttribPointer(maTextureHandle, 3, GLES20.GL_FLOAT, false,
- TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices);
- checkGlError("glVertexAttribPointer maTextureHandle");
- GLES20.glEnableVertexAttribArray(maTextureHandle);
- checkGlError("glEnableVertexAttribArray maTextureHandle");
-
- Matrix.multiplyMM(mMVPMatrix, 0, mVMatrix, 0, mMMatrix, 0);
- Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVPMatrix, 0);
-
- GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mMVPMatrix, 0);
- GLES20.glUniformMatrix4fv(muSTMatrixHandle, 1, false, mSTMatrix, 0);
- GLES20.glUniform1f(muCRatioHandle, mCameraRatio);
-
- GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
- checkGlError("glDrawArrays");
- }
-
- public void onSurfaceChanged(GL10 glUnused, int width, int height) {
- // Ignore the passed-in GL10 interface, and use the GLES20
- // class's static methods instead.
- GLES20.glViewport(0, 0, width, height);
- mRatio = (float) width / height;
- Matrix.frustumM(mProjMatrix, 0, -mRatio, mRatio, -1, 1, 3, 7);
- }
-
- public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
- // Ignore the passed-in GL10 interface, and use the GLES20
- // class's static methods instead.
-
- /* Set up alpha blending and an Android background color */
- GLES20.glEnable(GLES20.GL_BLEND);
- GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
- GLES20.glClearColor(0.643f, 0.776f, 0.223f, 1.0f);
-
- /* Set up shaders and handles to their variables */
- mProgram = createProgram(mVertexShader, mFragmentShader);
- if (mProgram == 0) {
- return;
- }
- maPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
- checkGlError("glGetAttribLocation aPosition");
- if (maPositionHandle == -1) {
- throw new RuntimeException("Could not get attrib location for aPosition");
- }
- maTextureHandle = GLES20.glGetAttribLocation(mProgram, "aTextureCoord");
- checkGlError("glGetAttribLocation aTextureCoord");
- if (maTextureHandle == -1) {
- throw new RuntimeException("Could not get attrib location for aTextureCoord");
- }
-
- muMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
- checkGlError("glGetUniformLocation uMVPMatrix");
- if (muMVPMatrixHandle == -1) {
- throw new RuntimeException("Could not get attrib location for uMVPMatrix");
- }
-
- muSTMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uSTMatrix");
- checkGlError("glGetUniformLocation uSTMatrix");
- if (muMVPMatrixHandle == -1) {
- throw new RuntimeException("Could not get attrib location for uSTMatrix");
- }
-
- muCRatioHandle = GLES20.glGetUniformLocation(mProgram, "uCRatio");
- checkGlError("glGetUniformLocation uCRatio");
- if (muMVPMatrixHandle == -1) {
- throw new RuntimeException("Could not get attrib location for uCRatio");
- }
-
- /*
- * Create our texture. This has to be done each time the
- * surface is created.
- */
-
- int[] textures = new int[1];
- GLES20.glGenTextures(1, textures, 0);
-
- mTextureID = textures[0];
- GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureID);
- checkGlError("glBindTexture mTextureID");
-
- // Can't do mipmapping with camera source
- GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
- GLES20.GL_NEAREST);
- GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
- GLES20.GL_LINEAR);
- // Clamp to edge is the only option
- GLES20.glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S,
- GLES20.GL_CLAMP_TO_EDGE);
- GLES20.glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T,
- GLES20.GL_CLAMP_TO_EDGE);
- checkGlError("glTexParameteri mTextureID");
-
- /*
- * Create the SurfaceTexture that will feed this textureID, and pass it to the camera
- */
-
- mSurface = new SurfaceTexture(mTextureID);
- mSurface.setOnFrameAvailableListener(this);
- try {
- mCamera.setPreviewTexture(mSurface);
- } catch (IOException t) {
- Log.e(TAG, "Cannot set preview texture target!");
- }
-
- /* Start the camera */
- mCamera.startPreview();
-
- Matrix.setLookAtM(mVMatrix, 0, 0, 0, 5f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
-
- mLastTime = 0;
-
- synchronized(this) {
- updateSurface = false;
- }
- }
-
- synchronized public void onFrameAvailable(SurfaceTexture surface) {
- /* For simplicity, SurfaceTexture calls here when it has new
- * data available. Call may come in from some random thread,
- * so let's be safe and use synchronize. No OpenGL calls can be done here.
- */
- updateSurface = true;
- }
-
- private void doPhysics(long timestamp) {
- /*
- * Move the camera surface around based on some simple spring physics with drag
- */
-
- if (mLastTime == 0)
- mLastTime = timestamp;
-
- float deltaT = (timestamp - mLastTime)/1000000000.f; // To seconds
-
- float springStrength = 20.f;
- float frictionCoeff = 10.f;
- float mass = 10.f;
- float gMultiplier = 4.f;
- /* Only update physics every 30 ms */
- if (deltaT > 0.030f) {
- mLastTime = timestamp;
-
- float[] totalForce = new float[3];
- totalForce[0] = -mPos[0] * springStrength - mVel[0]*frictionCoeff + gMultiplier*mGForce[0]*mass;
- totalForce[1] = -mPos[1] * springStrength - mVel[1]*frictionCoeff + gMultiplier*mGForce[1]*mass;
- totalForce[2] = -mPos[2] * springStrength - mVel[2]*frictionCoeff + gMultiplier*mGForce[2]*mass;
-
- float[] accel = new float[3];
- accel[0] = totalForce[0]/mass;
- accel[1] = totalForce[1]/mass;
- accel[2] = totalForce[2]/mass;
-
- /* Not a very accurate integrator */
- mVel[0] = mVel[0] + accel[0]*deltaT;
- mVel[1] = mVel[1] + accel[1]*deltaT;
- mVel[2] = mVel[2] + accel[2]*deltaT;
-
- mPos[0] = mPos[0] + mVel[0]*deltaT;
- mPos[1] = mPos[1] + mVel[1]*deltaT;
- mPos[2] = mPos[2] + mVel[2]*deltaT;
-
- Matrix.setIdentityM(mMMatrix, 0);
- Matrix.translateM(mMMatrix, 0, mPos[0], mPos[1], mPos[2]);
- }
-
- }
-
- private int loadShader(int shaderType, String source) {
- int shader = GLES20.glCreateShader(shaderType);
- if (shader != 0) {
- GLES20.glShaderSource(shader, source);
- GLES20.glCompileShader(shader);
- int[] compiled = new int[1];
- GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
- if (compiled[0] == 0) {
- Log.e(TAG, "Could not compile shader " + shaderType + ":");
- Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
- GLES20.glDeleteShader(shader);
- shader = 0;
- }
- }
- return shader;
- }
-
- private int createProgram(String vertexSource, String fragmentSource) {
- int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
- if (vertexShader == 0) {
- return 0;
- }
- int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
- if (pixelShader == 0) {
- return 0;
- }
-
- int program = GLES20.glCreateProgram();
- if (program != 0) {
- GLES20.glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- GLES20.glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- GLES20.glLinkProgram(program);
- int[] linkStatus = new int[1];
- GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
- if (linkStatus[0] != GLES20.GL_TRUE) {
- Log.e(TAG, "Could not link program: ");
- Log.e(TAG, GLES20.glGetProgramInfoLog(program));
- GLES20.glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
- }
-
- private void checkGlError(String op) {
- int error;
- while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
- Log.e(TAG, op + ": glError " + error);
- throw new RuntimeException(op + ": glError " + error);
- }
- }
-
- private static final int FLOAT_SIZE_BYTES = 4;
- private static final int TRIANGLE_VERTICES_DATA_STRIDE_BYTES = 5 * FLOAT_SIZE_BYTES;
- private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0;
- private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3;
- private final float[] mTriangleVerticesData = {
- // X, Y, Z, U, V
- -1.0f, -1.0f, 0, 0.f, 0.f,
- 1.0f, -1.0f, 0, 1.f, 0.f,
- -1.0f, 1.0f, 0, 0.f, 1.f,
- 1.0f, 1.0f, 0, 1.f, 1.f,
- };
-
- private FloatBuffer mTriangleVertices;
-
- private final String mVertexShader =
- "uniform mat4 uMVPMatrix;\n" +
- "uniform mat4 uSTMatrix;\n" +
- "uniform float uCRatio;\n" +
- "attribute vec4 aPosition;\n" +
- "attribute vec4 aTextureCoord;\n" +
- "varying vec2 vTextureCoord;\n" +
- "varying vec2 vTextureNormCoord;\n" +
- "void main() {\n" +
- " vec4 scaledPos = aPosition;\n" +
- " scaledPos.x = scaledPos.x * uCRatio;\n" +
- " gl_Position = uMVPMatrix * scaledPos;\n" +
- " vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n" +
- " vTextureNormCoord = aTextureCoord.xy;\n" +
- "}\n";
-
- private final String mFragmentShader =
- "#extension GL_OES_EGL_image_external : require\n" +
- "precision mediump float;\n" +
- "varying vec2 vTextureCoord;\n" +
- "varying vec2 vTextureNormCoord;\n" +
- "uniform samplerExternalOES sTexture;\n" +
- "void main() {\n" +
- " gl_FragColor = texture2D(sTexture, vTextureCoord);\n" +
- " gl_FragColor.a = 1.0-min(length(vTextureNormCoord-0.5)*2.0,1.0);\n" +
- "}\n";
-
- private float[] mMVPMatrix = new float[16];
- private float[] mProjMatrix = new float[16];
- private float[] mMMatrix = new float[16];
- private float[] mVMatrix = new float[16];
- private float[] mSTMatrix = new float[16];
-
- private int mProgram;
- private int mTextureID;
- private int muMVPMatrixHandle;
- private int muSTMatrixHandle;
- private int muCRatioHandle;
- private int maPositionHandle;
- private int maTextureHandle;
-
- private float mRatio = 1.0f;
- private float mCameraRatio = 1.0f;
- private float[] mVel = new float[3];
- private float[] mPos = new float[3];
- private float[] mGForce = new float[3];
-
- private long mLastTime;
-
- private SurfaceTexture mSurface;
- private Camera mCamera;
- private boolean updateSurface = false;
-
- private Context mContext;
- private static String TAG = "CamRenderer";
-
- // Magic key
- private static int GL_TEXTURE_EXTERNAL_OES = 0x8D65;
-}
diff --git a/opengl/tests/gl2_copyTexImage/Android.mk b/opengl/tests/gl2_copyTexImage/Android.mk
deleted file mode 100644
index 005c383..0000000
--- a/opengl/tests/gl2_copyTexImage/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_copyTexImage.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_copyTexImage
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
deleted file mode 100644
index 988d7ac..0000000
--- a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <utils/Timers.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-static void printGLString(const char *name, GLenum s) {
- // fprintf(stderr, "printGLString %s, %d\n", name, s);
- const char *v = (const char *) glGetString(s);
- // int error = glGetError();
- // fprintf(stderr, "glGetError() = %d, result of glGetString = %x\n", error,
- // (unsigned int) v);
- // if ((v < (const char*) 0) || (v > (const char*) 0x10000))
- // fprintf(stderr, "GL %s = %s\n", name, v);
- // else
- // fprintf(stderr, "GL %s = (null) 0x%08x\n", name, (unsigned int) v);
- fprintf(stderr, "GL %s = %s\n", name, v);
-}
-
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
- if (returnVal != EGL_TRUE) {
- fprintf(stderr, "%s() returned %d\n", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
- error);
- }
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- fprintf(stderr, "after %s() glError (0x%x)\n", op, error);
- }
-}
-
-static const char gVertexShader[] = "attribute vec4 vPosition;\n"
- "void main() {\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
-static const char gFragmentShader[] = "precision mediump float;\n"
- "void main() {\n"
- " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.5);\n"
- "}\n";
-
-GLuint loadShader(GLenum shaderType, const char* pSource) {
- GLuint shader = glCreateShader(shaderType);
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- glCompileShader(shader);
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- fprintf(stderr, "Could not compile shader %d:\n%s\n",
- shaderType, buf);
- free(buf);
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- }
- return shader;
-}
-
-GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader) {
- return 0;
- }
-
- GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader) {
- return 0;
- }
-
- GLuint program = glCreateProgram();
- if (program) {
- glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- fprintf(stderr, "Could not link program:\n%s\n", buf);
- free(buf);
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
-}
-
-GLuint gProgram;
-GLuint gTextureProgram;
-GLuint gvPositionHandle;
-GLuint gvTexturePositionHandle;
-GLuint gvTextureTexCoordsHandle;
-GLuint gvTextureSamplerHandle;
-GLuint gFbo;
-GLuint gTexture;
-GLuint gBufferTexture;
-
-static const char gSimpleVS[] =
- "attribute vec4 position;\n"
- "attribute vec2 texCoords;\n"
- "varying vec2 outTexCoords;\n"
- "\nvoid main(void) {\n"
- " outTexCoords = texCoords;\n"
- " gl_Position = position;\n"
- "}\n\n";
-static const char gSimpleFS[] =
- "precision mediump float;\n\n"
- "varying vec2 outTexCoords;\n"
- "uniform sampler2D texture;\n"
- "\nvoid main(void) {\n"
- " gl_FragColor = texture2D(texture, outTexCoords);\n"
- "}\n\n";
-
-bool setupGraphics(int w, int h) {
- gProgram = createProgram(gVertexShader, gFragmentShader);
- if (!gProgram) {
- return false;
- }
- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
- checkGlError("glGetAttribLocation");
- fprintf(stderr, "glGetAttribLocation(\"vPosition\") = %d\n", gvPositionHandle);
-
- gTextureProgram = createProgram(gSimpleVS, gSimpleFS);
- if (!gTextureProgram) {
- return false;
- }
- gvTexturePositionHandle = glGetAttribLocation(gTextureProgram, "position");
- checkGlError("glGetAttribLocation");
- gvTextureTexCoordsHandle = glGetAttribLocation(gTextureProgram, "texCoords");
- checkGlError("glGetAttribLocation");
- gvTextureSamplerHandle = glGetUniformLocation(gTextureProgram, "texture");
- checkGlError("glGetAttribLocation");
-
- glActiveTexture(GL_TEXTURE0);
-
- glGenTextures(1, &gTexture);
- glBindTexture(GL_TEXTURE_2D, gTexture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glGenTextures(1, &gBufferTexture);
- glBindTexture(GL_TEXTURE_2D, gBufferTexture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glGenFramebuffers(1, &gFbo);
- glBindFramebuffer(GL_FRAMEBUFFER, gFbo);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gTexture, 0);
-
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
- glViewport(0, 0, w, h);
- checkGlError("glViewport");
- return true;
-}
-
-const GLfloat gTriangleVertices[] = { 0.0f, 0.5f, -0.5f, -0.5f,
- 0.5f, -0.5f };
-
-const GLint FLOAT_SIZE_BYTES = 4;
-const GLint TRIANGLE_VERTICES_DATA_STRIDE_BYTES = 5 * FLOAT_SIZE_BYTES;
-const GLfloat gTriangleVerticesData[] = {
- // X, Y, Z, U, V
- -1.0f, -1.0f, 0, 0.f, 0.f,
- 1.0f, -1.0f, 0, 1.f, 0.f,
- -1.0f, 1.0f, 0, 0.f, 1.f,
- 1.0f, 1.0f, 0, 1.f, 1.f,
-};
-
-void renderFrame(GLint w, GLint h) {
- glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
- checkGlError("glClearColor");
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- // Bind FBO and draw into it
- glBindFramebuffer(GL_FRAMEBUFFER, gFbo);
- checkGlError("glBindFramebuffer");
-
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- checkGlError("glClearColor");
- glClear(GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- glUseProgram(gProgram);
- checkGlError("glUseProgram");
-
- glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices);
- checkGlError("glVertexAttribPointer");
- glEnableVertexAttribArray(gvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
- glDrawArrays(GL_TRIANGLES, 0, 3);
- checkGlError("glDrawArrays");
-
- // Copy content of FBO into a texture
- glBindTexture(GL_TEXTURE_2D, gBufferTexture);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, w / 2, h / 2);
- checkGlError("glCopyTexSubImage2D");
-
- // Back to the display
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- checkGlError("glBindFramebuffer");
-
- // Draw copied content on the screen
- glUseProgram(gTextureProgram);
- checkGlError("glUseProgram");
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-
- glVertexAttribPointer(gvTexturePositionHandle, 3, GL_FLOAT, GL_FALSE,
- TRIANGLE_VERTICES_DATA_STRIDE_BYTES, gTriangleVerticesData);
- checkGlError("glVertexAttribPointer");
- glVertexAttribPointer(gvTextureTexCoordsHandle, 2, GL_FLOAT, GL_FALSE,
- TRIANGLE_VERTICES_DATA_STRIDE_BYTES, &gTriangleVerticesData[3]);
- checkGlError("glVertexAttribPointer");
- glEnableVertexAttribArray(gvTexturePositionHandle);
- glEnableVertexAttribArray(gvTextureTexCoordsHandle);
- checkGlError("glEnableVertexAttribArray");
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- checkGlError("glDrawArrays");
-}
-
-void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- printf(" %s: ", names[j].name);
- printf("%d (0x%x)", value, value);
- }
- }
- printf("\n");
-}
-
-int printEGLConfigurations(EGLDisplay dpy) {
- EGLint numConfig = 0;
- EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
- checkEglError("eglGetConfigs", returnVal);
- if (!returnVal) {
- return false;
- }
-
- printf("Number of EGL configuration: %d\n", numConfig);
-
- EGLConfig* configs = (EGLConfig*) malloc(sizeof(EGLConfig) * numConfig);
- if (! configs) {
- printf("Could not allocate configs.\n");
- return false;
- }
-
- returnVal = eglGetConfigs(dpy, configs, numConfig, &numConfig);
- checkEglError("eglGetConfigs", returnVal);
- if (!returnVal) {
- free(configs);
- return false;
- }
-
- for(int i = 0; i < numConfig; i++) {
- printf("Configuration %d\n", i);
- printEGLConfiguration(dpy, configs[i]);
- }
-
- free(configs);
- return true;
-}
-
-int main(int argc, char** argv) {
- EGLBoolean returnValue;
- EGLConfig myConfig = {0};
-
- EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE };
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLSurface surface;
- EGLint w, h;
-
- EGLDisplay dpy;
-
- checkEglError("<init>");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- checkEglError("eglGetDisplay");
- if (dpy == EGL_NO_DISPLAY) {
- printf("eglGetDisplay returned EGL_NO_DISPLAY.\n");
- return 0;
- }
-
- returnValue = eglInitialize(dpy, &majorVersion, &minorVersion);
- checkEglError("eglInitialize", returnValue);
- fprintf(stderr, "EGL version %d.%d\n", majorVersion, minorVersion);
- if (returnValue != EGL_TRUE) {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- if (!printEGLConfigurations(dpy)) {
- printf("printEGLConfigurations failed\n");
- return 0;
- }
-
- checkEglError("printEGLConfigurations");
-
- EGLNativeWindowType window = android_createDisplaySurface();
- EGLint numConfigs = -1, n = 0;
- eglChooseConfig(dpy, s_configAttribs, 0, 0, &numConfigs);
- if (numConfigs) {
- EGLConfig* const configs = new EGLConfig[numConfigs];
- eglChooseConfig(dpy, s_configAttribs, configs, numConfigs, &n);
- myConfig = configs[0];
- delete[] configs;
- }
-
- checkEglError("EGLUtils::selectConfigForNativeWindow");
-
- printf("Chose this configuration:\n");
- printEGLConfiguration(dpy, myConfig);
-
- surface = eglCreateWindowSurface(dpy, myConfig, window, NULL);
- checkEglError("eglCreateWindowSurface");
- if (surface == EGL_NO_SURFACE) {
- printf("gelCreateWindowSurface failed.\n");
- return 0;
- }
-
- context = eglCreateContext(dpy, myConfig, EGL_NO_CONTEXT, context_attribs);
- checkEglError("eglCreateContext");
- if (context == EGL_NO_CONTEXT) {
- printf("eglCreateContext failed\n");
- return 0;
- }
- returnValue = eglMakeCurrent(dpy, surface, surface, context);
- checkEglError("eglMakeCurrent", returnValue);
- if (returnValue != EGL_TRUE) {
- return 0;
- }
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- checkEglError("eglQuerySurface");
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- checkEglError("eglQuerySurface");
- GLint dim = w < h ? w : h;
-
- fprintf(stderr, "Window dimensions: %d x %d\n", w, h);
-
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- if(!setupGraphics(w, h)) {
- fprintf(stderr, "Could not set up graphics.\n");
- return 0;
- }
-
- for (;;) {
- renderFrame(w, h);
- eglSwapBuffers(dpy, surface);
- checkEglError("eglSwapBuffers");
- }
-
- return 0;
-}
diff --git a/opengl/tests/gl2_java/Android.mk b/opengl/tests/gl2_java/Android.mk
deleted file mode 100644
index 34f4aee..0000000
--- a/opengl/tests/gl2_java/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#########################################################################
-# OpenGL ES 2.0 Java sample
-#########################################################################
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := GL2Java
-
-include $(BUILD_PACKAGE)
diff --git a/opengl/tests/gl2_java/AndroidManifest.xml b/opengl/tests/gl2_java/AndroidManifest.xml
deleted file mode 100644
index 8bb6840..0000000
--- a/opengl/tests/gl2_java/AndroidManifest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gl2java">
- <uses-feature android:glEsVersion="0x00020000" />
- <application
- android:label="@string/gl2java_activity">
- <activity android:name="GL2JavaActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/gl2_java/res/values/strings.xml b/opengl/tests/gl2_java/res/values/strings.xml
deleted file mode 100644
index 06bd23c..0000000
--- a/opengl/tests/gl2_java/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="gl2java_activity">GL2Java</string>
-
-</resources>
-
diff --git a/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaActivity.java b/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaActivity.java
deleted file mode 100644
index 37654fb..0000000
--- a/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gl2java;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-import java.io.File;
-
-
-public class GL2JavaActivity extends Activity {
-
- GL2JavaView mView;
-
- @Override protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new GL2JavaView(getApplication());
- setContentView(mView);
- }
-
- @Override protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaView.java b/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaView.java
deleted file mode 100644
index 7f2bfd3..0000000
--- a/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaView.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gl2java;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.opengl.GLES20;
-
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class GL2JavaView extends GLSurfaceView {
- private static String TAG = "GL2JavaView";
-
- public GL2JavaView(Context context) {
- super(context);
- setEGLContextClientVersion(2);
- setRenderer(new Renderer());
- }
-
- private static class Renderer implements GLSurfaceView.Renderer {
-
- public Renderer() {
- mTriangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length * 4)
- .order(ByteOrder.nativeOrder()).asFloatBuffer();
- mTriangleVertices.put(mTriangleVerticesData).position(0);
- }
-
- public void onDrawFrame(GL10 gl) {
- GLES20.glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
- GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
- GLES20.glUseProgram(mProgram);
- checkGlError("glUseProgram");
-
- GLES20.glVertexAttribPointer(mvPositionHandle, 2, GLES20.GL_FLOAT, false, 0, mTriangleVertices);
- checkGlError("glVertexAttribPointer");
- GLES20.glEnableVertexAttribArray(mvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
- GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
- checkGlError("glDrawArrays");
-
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GLES20.glViewport(0, 0, width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- mProgram = createProgram(mVertexShader, mFragmentShader);
- if (mProgram == 0) {
- return;
- }
- mvPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
- checkGlError("glGetAttribLocation");
- if (mvPositionHandle == -1) {
- throw new RuntimeException("Could not get attrib location for vPosition");
- }
- }
-
- private int loadShader(int shaderType, String source) {
- int shader = GLES20.glCreateShader(shaderType);
- if (shader != 0) {
- GLES20.glShaderSource(shader, source);
- GLES20.glCompileShader(shader);
- int[] compiled = new int[1];
- GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
- if (compiled[0] == 0) {
- Log.e(TAG, "Could not compile shader " + shaderType + ":");
- Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
- GLES20.glDeleteShader(shader);
- shader = 0;
- }
- }
- return shader;
- }
-
- private int createProgram(String vertexSource, String fragmentSource) {
- int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
- if (vertexShader == 0) {
- return 0;
- }
-
- int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
- if (pixelShader == 0) {
- return 0;
- }
-
- int program = GLES20.glCreateProgram();
- if (program != 0) {
- GLES20.glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- GLES20.glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- GLES20.glLinkProgram(program);
- int[] linkStatus = new int[1];
- GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
- if (linkStatus[0] != GLES20.GL_TRUE) {
- Log.e(TAG, "Could not link program: ");
- Log.e(TAG, GLES20.glGetProgramInfoLog(program));
- GLES20.glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
- }
-
- private void checkGlError(String op) {
- int error;
- while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
- Log.e(TAG, op + ": glError " + error);
- throw new RuntimeException(op + ": glError " + error);
- }
- }
-
- private final float[] mTriangleVerticesData = { 0.0f, 0.5f, -0.5f, -0.5f,
- 0.5f, -0.5f };
-
- private FloatBuffer mTriangleVertices;
-
- private final String mVertexShader = "attribute vec4 vPosition;\n"
- + "void main() {\n"
- + " gl_Position = vPosition;\n"
- + "}\n";
-
- private final String mFragmentShader = "precision mediump float;\n"
- + "void main() {\n"
- + " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
- + "}\n";
-
- private int mProgram;
- private int mvPositionHandle;
-
- }
-}
-
diff --git a/opengl/tests/gl2_jni/Android.mk b/opengl/tests/gl2_jni/Android.mk
deleted file mode 100644
index 5d90ff6..0000000
--- a/opengl/tests/gl2_jni/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#########################################################################
-# OpenGL ES JNI sample
-# This makefile builds both an activity and a shared library.
-#########################################################################
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := GL2JNI
-
-LOCAL_JNI_SHARED_LIBRARIES := libgl2jni
-
-include $(BUILD_PACKAGE)
-
-#########################################################################
-# Build JNI Shared Library
-#########################################################################
-
-LOCAL_PATH:= $(LOCAL_PATH)/jni
-
-include $(CLEAR_VARS)
-
-# Optional tag would mean it doesn't get installed by default
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -Werror
-
-LOCAL_SRC_FILES:= \
- gl_code.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libEGL \
- libGLESv2
-
-LOCAL_MODULE := libgl2jni
-
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/tests/gl2_jni/AndroidManifest.xml b/opengl/tests/gl2_jni/AndroidManifest.xml
deleted file mode 100644
index 1827e5f..0000000
--- a/opengl/tests/gl2_jni/AndroidManifest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gl2jni">
- <application
- android:label="@string/gl2jni_activity">
- <activity android:name="GL2JNIActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/gl2_jni/jni/gl_code.cpp b/opengl/tests/gl2_jni/jni/gl_code.cpp
deleted file mode 100644
index fa6bd93..0000000
--- a/opengl/tests/gl2_jni/jni/gl_code.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-// OpenGL ES 2.0 code
-
-#include <nativehelper/jni.h>
-#define LOG_TAG "GL2JNI gl_code.cpp"
-#include <utils/Log.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-static void printGLString(const char *name, GLenum s) {
- const char *v = (const char *) glGetString(s);
- ALOGI("GL %s = %s\n", name, v);
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- ALOGI("after %s() glError (0x%x)\n", op, error);
- }
-}
-
-static const char gVertexShader[] = "attribute vec4 vPosition;\n"
- "void main() {\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
-static const char gFragmentShader[] = "precision mediump float;\n"
- "void main() {\n"
- " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
- "}\n";
-
-GLuint loadShader(GLenum shaderType, const char* pSource) {
- GLuint shader = glCreateShader(shaderType);
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- glCompileShader(shader);
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- ALOGE("Could not compile shader %d:\n%s\n",
- shaderType, buf);
- free(buf);
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- }
- return shader;
-}
-
-GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader) {
- return 0;
- }
-
- GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader) {
- return 0;
- }
-
- GLuint program = glCreateProgram();
- if (program) {
- glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- ALOGE("Could not link program:\n%s\n", buf);
- free(buf);
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
-}
-
-GLuint gProgram;
-GLuint gvPositionHandle;
-
-bool setupGraphics(int w, int h) {
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- ALOGI("setupGraphics(%d, %d)", w, h);
- gProgram = createProgram(gVertexShader, gFragmentShader);
- if (!gProgram) {
- ALOGE("Could not create program.");
- return false;
- }
- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
- checkGlError("glGetAttribLocation");
- ALOGI("glGetAttribLocation(\"vPosition\") = %d\n",
- gvPositionHandle);
-
- glViewport(0, 0, w, h);
- checkGlError("glViewport");
- return true;
-}
-
-const GLfloat gTriangleVertices[] = { 0.0f, 0.5f, -0.5f, -0.5f,
- 0.5f, -0.5f };
-
-void renderFrame() {
- static float grey;
- grey += 0.01f;
- if (grey > 1.0f) {
- grey = 0.0f;
- }
- glClearColor(grey, grey, grey, 1.0f);
- checkGlError("glClearColor");
- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- glUseProgram(gProgram);
- checkGlError("glUseProgram");
-
- glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices);
- checkGlError("glVertexAttribPointer");
- glEnableVertexAttribArray(gvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
- glDrawArrays(GL_TRIANGLES, 0, 3);
- checkGlError("glDrawArrays");
-}
-
-extern "C" {
- JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height);
- JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj);
-};
-
-JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height)
-{
- setupGraphics(width, height);
-}
-
-JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj)
-{
- renderFrame();
-}
-
diff --git a/opengl/tests/gl2_jni/res/values/strings.xml b/opengl/tests/gl2_jni/res/values/strings.xml
deleted file mode 100644
index a29c74b..0000000
--- a/opengl/tests/gl2_jni/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="gl2jni_activity">GL2JNI</string>
-
-</resources>
-
diff --git a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIActivity.java b/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIActivity.java
deleted file mode 100644
index c366a2c..0000000
--- a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gl2jni;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-import java.io.File;
-
-
-public class GL2JNIActivity extends Activity {
-
- GL2JNIView mView;
-
- @Override protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new GL2JNIView(getApplication());
- setContentView(mView);
- }
-
- @Override protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNILib.java b/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNILib.java
deleted file mode 100644
index 040a984..0000000
--- a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNILib.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gl2jni;
-
-// Wrapper for native library
-
-public class GL2JNILib {
-
- static {
- System.loadLibrary("gl2jni");
- }
-
- /**
- * @param width the current view width
- * @param height the current view height
- */
- public static native void init(int width, int height);
- public static native void step();
-}
diff --git a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java b/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java
deleted file mode 100644
index 72b1dfb..0000000
--- a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gl2jni;
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class GL2JNIView extends GLSurfaceView {
- private static String TAG = "GL2JNIView";
-
- public GL2JNIView(Context context) {
- super(context);
- init(false, 0, 0);
- }
-
- public GL2JNIView(Context context, boolean translucent, int depth, int stencil) {
- super(context);
- init(translucent, depth, stencil);
- }
-
- private void init(boolean translucent, int depth, int stencil) {
- setEGLContextFactory(new ContextFactory());
- setEGLConfigChooser( translucent ?
- new ConfigChooser(8,8,8,8, depth, stencil) :
- new ConfigChooser(5,6,5,0, depth, stencil));
- setRenderer(new Renderer());
- }
-
- private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
- private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
- public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
- Log.w(TAG, "creating OpenGL ES 2.0 context");
- checkEglError("Before eglCreateContext", egl);
- int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
- EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
- checkEglError("After eglCreateContext", egl);
- return context;
- }
-
- public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
- egl.eglDestroyContext(display, context);
- }
- }
-
- private static void checkEglError(String prompt, EGL10 egl) {
- int error;
- while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
- Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
- }
- }
-
- private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
- private static int EGL_OPENGL_ES2_BIT = 4;
- private static int[] s_configAttribs2 =
- {
- EGL10.EGL_RED_SIZE, 4,
- EGL10.EGL_GREEN_SIZE, 4,
- EGL10.EGL_BLUE_SIZE, 4,
- EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL10.EGL_NONE
- };
-
- public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) {
- mRedSize = r;
- mGreenSize = g;
- mBlueSize = b;
- mAlphaSize = a;
- mDepthSize = depth;
- mStencilSize = stencil;
- }
-
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
-
- int[] num_config = new int[1];
- egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
-
- int numConfigs = num_config[0];
-
- if (numConfigs <= 0) {
- throw new IllegalArgumentException("No configs match configSpec");
- }
- EGLConfig[] configs = new EGLConfig[numConfigs];
- egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
- // printConfigs(egl, display, configs);
- return chooseConfig(egl, display, configs);
- }
-
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
- EGLConfig[] configs) {
- EGLConfig closestConfig = null;
- int closestDistance = 1000;
- for(EGLConfig config : configs) {
- int d = findConfigAttrib(egl, display, config,
- EGL10.EGL_DEPTH_SIZE, 0);
- int s = findConfigAttrib(egl, display, config,
- EGL10.EGL_STENCIL_SIZE, 0);
- if (d >= mDepthSize && s>= mStencilSize) {
- int r = findConfigAttrib(egl, display, config,
- EGL10.EGL_RED_SIZE, 0);
- int g = findConfigAttrib(egl, display, config,
- EGL10.EGL_GREEN_SIZE, 0);
- int b = findConfigAttrib(egl, display, config,
- EGL10.EGL_BLUE_SIZE, 0);
- int a = findConfigAttrib(egl, display, config,
- EGL10.EGL_ALPHA_SIZE, 0);
- int distance = Math.abs(r - mRedSize)
- + Math.abs(g - mGreenSize)
- + Math.abs(b - mBlueSize)
- + Math.abs(a - mAlphaSize);
- if (distance < closestDistance) {
- closestDistance = distance;
- closestConfig = config;
- }
- }
- }
- return closestConfig;
- }
-
- private int findConfigAttrib(EGL10 egl, EGLDisplay display,
- EGLConfig config, int attribute, int defaultValue) {
-
- if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
- return mValue[0];
- }
- return defaultValue;
- }
-
- private void printConfigs(EGL10 egl, EGLDisplay display,
- EGLConfig[] configs) {
- int numConfigs = configs.length;
- Log.w(TAG, String.format("%d configurations", numConfigs));
- for (int i = 0; i < numConfigs; i++) {
- Log.w(TAG, String.format("Configuration %d:\n", i));
- printConfig(egl, display, configs[i]);
- }
- }
-
- private void printConfig(EGL10 egl, EGLDisplay display,
- EGLConfig config) {
- int[] attributes = {
- EGL10.EGL_BUFFER_SIZE,
- EGL10.EGL_ALPHA_SIZE,
- EGL10.EGL_BLUE_SIZE,
- EGL10.EGL_GREEN_SIZE,
- EGL10.EGL_RED_SIZE,
- EGL10.EGL_DEPTH_SIZE,
- EGL10.EGL_STENCIL_SIZE,
- EGL10.EGL_CONFIG_CAVEAT,
- EGL10.EGL_CONFIG_ID,
- EGL10.EGL_LEVEL,
- EGL10.EGL_MAX_PBUFFER_HEIGHT,
- EGL10.EGL_MAX_PBUFFER_PIXELS,
- EGL10.EGL_MAX_PBUFFER_WIDTH,
- EGL10.EGL_NATIVE_RENDERABLE,
- EGL10.EGL_NATIVE_VISUAL_ID,
- EGL10.EGL_NATIVE_VISUAL_TYPE,
- 0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
- EGL10.EGL_SAMPLES,
- EGL10.EGL_SAMPLE_BUFFERS,
- EGL10.EGL_SURFACE_TYPE,
- EGL10.EGL_TRANSPARENT_TYPE,
- EGL10.EGL_TRANSPARENT_RED_VALUE,
- EGL10.EGL_TRANSPARENT_GREEN_VALUE,
- EGL10.EGL_TRANSPARENT_BLUE_VALUE,
- 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
- 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
- 0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
- 0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
- EGL10.EGL_LUMINANCE_SIZE,
- EGL10.EGL_ALPHA_MASK_SIZE,
- EGL10.EGL_COLOR_BUFFER_TYPE,
- EGL10.EGL_RENDERABLE_TYPE,
- 0x3042 // EGL10.EGL_CONFORMANT
- };
- String[] names = {
- "EGL_BUFFER_SIZE",
- "EGL_ALPHA_SIZE",
- "EGL_BLUE_SIZE",
- "EGL_GREEN_SIZE",
- "EGL_RED_SIZE",
- "EGL_DEPTH_SIZE",
- "EGL_STENCIL_SIZE",
- "EGL_CONFIG_CAVEAT",
- "EGL_CONFIG_ID",
- "EGL_LEVEL",
- "EGL_MAX_PBUFFER_HEIGHT",
- "EGL_MAX_PBUFFER_PIXELS",
- "EGL_MAX_PBUFFER_WIDTH",
- "EGL_NATIVE_RENDERABLE",
- "EGL_NATIVE_VISUAL_ID",
- "EGL_NATIVE_VISUAL_TYPE",
- "EGL_PRESERVED_RESOURCES",
- "EGL_SAMPLES",
- "EGL_SAMPLE_BUFFERS",
- "EGL_SURFACE_TYPE",
- "EGL_TRANSPARENT_TYPE",
- "EGL_TRANSPARENT_RED_VALUE",
- "EGL_TRANSPARENT_GREEN_VALUE",
- "EGL_TRANSPARENT_BLUE_VALUE",
- "EGL_BIND_TO_TEXTURE_RGB",
- "EGL_BIND_TO_TEXTURE_RGBA",
- "EGL_MIN_SWAP_INTERVAL",
- "EGL_MAX_SWAP_INTERVAL",
- "EGL_LUMINANCE_SIZE",
- "EGL_ALPHA_MASK_SIZE",
- "EGL_COLOR_BUFFER_TYPE",
- "EGL_RENDERABLE_TYPE",
- "EGL_CONFORMANT"
- };
- int[] value = new int[1];
- for (int i = 0; i < attributes.length; i++) {
- int attribute = attributes[i];
- String name = names[i];
- if ( egl.eglGetConfigAttrib(display, config, attribute, value)) {
- Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
- } else {
- // Log.w(TAG, String.format(" %s: failed\n", name));
- while (egl.eglGetError() != EGL10.EGL_SUCCESS);
- }
- }
- }
-
- // Subclasses can adjust these values:
- protected int mRedSize;
- protected int mGreenSize;
- protected int mBlueSize;
- protected int mAlphaSize;
- protected int mDepthSize;
- protected int mStencilSize;
- private int[] mValue = new int[1];
- }
-
- private static class Renderer implements GLSurfaceView.Renderer {
- public void onDrawFrame(GL10 gl) {
- GL2JNILib.step();
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GL2JNILib.init(width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing.
- }
- }
-}
-
diff --git a/opengl/tests/gl2_yuvtex/Android.mk b/opengl/tests/gl2_yuvtex/Android.mk
deleted file mode 100644
index 7d43759..0000000
--- a/opengl/tests/gl2_yuvtex/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_yuvtex.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_yuvtex
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
deleted file mode 100644
index d3e4932..0000000
--- a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <utils/Timers.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-static void printGLString(const char *name, GLenum s) {
- // fprintf(stderr, "printGLString %s, %d\n", name, s);
- const char *v = (const char *) glGetString(s);
- // int error = glGetError();
- // fprintf(stderr, "glGetError() = %d, result of glGetString = %x\n", error,
- // (unsigned int) v);
- // if ((v < (const char*) 0) || (v > (const char*) 0x10000))
- // fprintf(stderr, "GL %s = %s\n", name, v);
- // else
- // fprintf(stderr, "GL %s = (null) 0x%08x\n", name, (unsigned int) v);
- fprintf(stderr, "GL %s = %s\n", name, v);
-}
-
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
- if (returnVal != EGL_TRUE) {
- fprintf(stderr, "%s() returned %d\n", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
- error);
- }
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- fprintf(stderr, "after %s() glError (0x%x)\n", op, error);
- }
-}
-
-static const char gVertexShader[] = "attribute vec4 vPosition;\n"
- "varying vec2 yuvTexCoords;\n"
- "void main() {\n"
- " yuvTexCoords = vPosition.xy + vec2(0.5, 0.5);\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
-static const char gFragmentShader[] = "#extension GL_OES_EGL_image_external : require\n"
- "precision mediump float;\n"
- "uniform samplerExternalOES yuvTexSampler;\n"
- "varying vec2 yuvTexCoords;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(yuvTexSampler, yuvTexCoords);\n"
- "}\n";
-
-GLuint loadShader(GLenum shaderType, const char* pSource) {
- GLuint shader = glCreateShader(shaderType);
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- glCompileShader(shader);
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- fprintf(stderr, "Could not compile shader %d:\n%s\n",
- shaderType, buf);
- free(buf);
- }
- } else {
- fprintf(stderr, "Guessing at GL_INFO_LOG_LENGTH size\n");
- char* buf = (char*) malloc(0x1000);
- if (buf) {
- glGetShaderInfoLog(shader, 0x1000, NULL, buf);
- fprintf(stderr, "Could not compile shader %d:\n%s\n",
- shaderType, buf);
- free(buf);
- }
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- return shader;
-}
-
-GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader) {
- return 0;
- }
-
- GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader) {
- return 0;
- }
-
- GLuint program = glCreateProgram();
- if (program) {
- glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- fprintf(stderr, "Could not link program:\n%s\n", buf);
- free(buf);
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
-}
-
-GLuint gProgram;
-GLint gvPositionHandle;
-GLint gYuvTexSamplerHandle;
-
-bool setupGraphics(int w, int h) {
- gProgram = createProgram(gVertexShader, gFragmentShader);
- if (!gProgram) {
- return false;
- }
- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
- checkGlError("glGetAttribLocation");
- fprintf(stderr, "glGetAttribLocation(\"vPosition\") = %d\n",
- gvPositionHandle);
- gYuvTexSamplerHandle = glGetUniformLocation(gProgram, "yuvTexSampler");
- checkGlError("glGetUniformLocation");
- fprintf(stderr, "glGetUniformLocation(\"yuvTexSampler\") = %d\n",
- gYuvTexSamplerHandle);
-
- glViewport(0, 0, w, h);
- checkGlError("glViewport");
- return true;
-}
-
-int align(int x, int a) {
- return (x + (a-1)) & (~(a-1));
-}
-
-const int yuvTexWidth = 608;
-const int yuvTexHeight = 480;
-const int yuvTexUsage = GraphicBuffer::USAGE_HW_TEXTURE |
- GraphicBuffer::USAGE_SW_WRITE_RARELY;
-const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12;
-const int yuvTexOffsetY = 0;
-const bool yuvTexSameUV = false;
-static sp<GraphicBuffer> yuvTexBuffer;
-static GLuint yuvTex;
-
-bool setupYuvTexSurface(EGLDisplay dpy, EGLContext context) {
- int blockWidth = yuvTexWidth > 16 ? yuvTexWidth / 16 : 1;
- int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1;
- yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat,
- yuvTexUsage);
- int yuvTexStrideY = yuvTexBuffer->getStride();
- int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
- int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
- int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
- int yuvTexStrideU = yuvTexStrideV;
- char* buf = NULL;
- status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
- if (err != 0) {
- fprintf(stderr, "yuvTexBuffer->lock(...) failed: %d\n", err);
- return false;
- }
- for (int x = 0; x < yuvTexWidth; x++) {
- for (int y = 0; y < yuvTexHeight; y++) {
- int parityX = (x / blockWidth) & 1;
- int parityY = (y / blockHeight) & 1;
- unsigned char intensity = (parityX ^ parityY) ? 63 : 191;
- buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity;
- if (x < yuvTexWidth / 2 && y < yuvTexHeight / 2) {
- buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity;
- if (yuvTexSameUV) {
- buf[yuvTexOffsetV + (y * yuvTexStrideV) + x] = intensity;
- } else if (x < yuvTexWidth / 4 && y < yuvTexHeight / 4) {
- buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] =
- buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] =
- buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] =
- buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] = intensity;
- }
- }
- }
- }
-
- err = yuvTexBuffer->unlock();
- if (err != 0) {
- fprintf(stderr, "yuvTexBuffer->unlock() failed: %d\n", err);
- return false;
- }
-
- EGLClientBuffer clientBuffer = (EGLClientBuffer)yuvTexBuffer->getNativeBuffer();
- EGLImageKHR img = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,
- clientBuffer, 0);
- checkEglError("eglCreateImageKHR");
- if (img == EGL_NO_IMAGE_KHR) {
- return false;
- }
-
- glGenTextures(1, &yuvTex);
- checkGlError("glGenTextures");
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, yuvTex);
- checkGlError("glBindTexture");
- glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)img);
- checkGlError("glEGLImageTargetTexture2DOES");
-
- return true;
-}
-
-const GLfloat gTriangleVertices[] = {
- -0.5f, 0.5f,
- -0.5f, -0.5f,
- 0.5f, -0.5f,
- 0.5f, 0.5f,
-};
-
-void renderFrame() {
- glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
- checkGlError("glClearColor");
- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- glUseProgram(gProgram);
- checkGlError("glUseProgram");
-
- glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices);
- checkGlError("glVertexAttribPointer");
- glEnableVertexAttribArray(gvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
-
- glUniform1i(gYuvTexSamplerHandle, 0);
- checkGlError("glUniform1i");
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, yuvTex);
- checkGlError("glBindTexture");
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- checkGlError("glDrawArrays");
-}
-
-void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- printf(" %s: ", names[j].name);
- printf("%d (0x%x)", value, value);
- }
- }
- printf("\n");
-}
-
-int main(int argc, char** argv) {
- EGLBoolean returnValue;
- EGLConfig myConfig = {0};
-
- EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE };
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLSurface surface;
- EGLint w, h;
-
- EGLDisplay dpy;
-
- checkEglError("<init>");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- checkEglError("eglGetDisplay");
- if (dpy == EGL_NO_DISPLAY) {
- printf("eglGetDisplay returned EGL_NO_DISPLAY.\n");
- return 0;
- }
-
- returnValue = eglInitialize(dpy, &majorVersion, &minorVersion);
- checkEglError("eglInitialize", returnValue);
- fprintf(stderr, "EGL version %d.%d\n", majorVersion, minorVersion);
- if (returnValue != EGL_TRUE) {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- EGLNativeWindowType window = android_createDisplaySurface();
- returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
- if (returnValue) {
- printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
- return 1;
- }
-
- checkEglError("EGLUtils::selectConfigForNativeWindow");
-
- printf("Chose this configuration:\n");
- printEGLConfiguration(dpy, myConfig);
-
- surface = eglCreateWindowSurface(dpy, myConfig, window, NULL);
- checkEglError("eglCreateWindowSurface");
- if (surface == EGL_NO_SURFACE) {
- printf("gelCreateWindowSurface failed.\n");
- return 1;
- }
-
- context = eglCreateContext(dpy, myConfig, EGL_NO_CONTEXT, context_attribs);
- checkEglError("eglCreateContext");
- if (context == EGL_NO_CONTEXT) {
- printf("eglCreateContext failed\n");
- return 1;
- }
- returnValue = eglMakeCurrent(dpy, surface, surface, context);
- checkEglError("eglMakeCurrent", returnValue);
- if (returnValue != EGL_TRUE) {
- return 1;
- }
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- checkEglError("eglQuerySurface");
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- checkEglError("eglQuerySurface");
- GLint dim = w < h ? w : h;
-
- fprintf(stderr, "Window dimensions: %d x %d\n", w, h);
-
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- if(!setupYuvTexSurface(dpy, context)) {
- fprintf(stderr, "Could not set up texture surface.\n");
- return 1;
- }
-
- if(!setupGraphics(w, h)) {
- fprintf(stderr, "Could not set up graphics.\n");
- return 1;
- }
-
- for (;;) {
- renderFrame();
- eglSwapBuffers(dpy, surface);
- checkEglError("eglSwapBuffers");
- }
-
- return 0;
-}
diff --git a/opengl/tests/gl_basic/Android.mk b/opengl/tests/gl_basic/Android.mk
deleted file mode 100644
index 46bcc60..0000000
--- a/opengl/tests/gl_basic/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl_basic.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl_basic
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_basic/gl_basic.cpp b/opengl/tests/gl_basic/gl_basic.cpp
deleted file mode 100644
index 23ce934..0000000
--- a/opengl/tests/gl_basic/gl_basic.cpp
+++ /dev/null
@@ -1,364 +0,0 @@
-// Simple OpenGL ES 1.x application showing how to initialize and draw something.
-
-#include <EGL/egl.h>
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-#include <stdio.h>
-
-#include <stdlib.h>
-#include <math.h>
-
-using namespace android;
-
-EGLDisplay eglDisplay;
-EGLSurface eglSurface;
-EGLContext eglContext;
-GLuint texture;
-
-#define FIXED_ONE 0x10000
-#define ITERATIONS 50
-
-int init_gl_surface(void);
-void free_gl_surface(void);
-void init_scene(void);
-void render();
-void create_texture(void);
-int readTimer(void);
-
-static void printGLString(const char *name, GLenum s) {
- const char *v = (const char *) glGetString(s);
- fprintf(stderr, "GL %s = %s\n", name, v);
-}
-
-static void gluLookAt(float eyeX, float eyeY, float eyeZ,
- float centerX, float centerY, float centerZ, float upX, float upY,
- float upZ)
-{
- // See the OpenGL GLUT documentation for gluLookAt for a description
- // of the algorithm. We implement it in a straightforward way:
-
- float fx = centerX - eyeX;
- float fy = centerY - eyeY;
- float fz = centerZ - eyeZ;
-
- // Normalize f
- float rlf = 1.0f / sqrtf(fx*fx + fy*fy + fz*fz);
- fx *= rlf;
- fy *= rlf;
- fz *= rlf;
-
- // Normalize up
- float rlup = 1.0f / sqrtf(upX*upX + upY*upY + upZ*upZ);
- upX *= rlup;
- upY *= rlup;
- upZ *= rlup;
-
- // compute s = f x up (x means "cross product")
-
- float sx = fy * upZ - fz * upY;
- float sy = fz * upX - fx * upZ;
- float sz = fx * upY - fy * upX;
-
- // compute u = s x f
- float ux = sy * fz - sz * fy;
- float uy = sz * fx - sx * fz;
- float uz = sx * fy - sy * fx;
-
- float m[16] ;
- m[0] = sx;
- m[1] = ux;
- m[2] = -fx;
- m[3] = 0.0f;
-
- m[4] = sy;
- m[5] = uy;
- m[6] = -fy;
- m[7] = 0.0f;
-
- m[8] = sz;
- m[9] = uz;
- m[10] = -fz;
- m[11] = 0.0f;
-
- m[12] = 0.0f;
- m[13] = 0.0f;
- m[14] = 0.0f;
- m[15] = 1.0f;
-
- glMultMatrixf(m);
- glTranslatef(-eyeX, -eyeY, -eyeZ);
-}
-
-void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- printf(" %s: ", names[j].name);
- printf("%d (0x%x)", value, value);
- }
- }
- printf("\n");
-}
-
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
- if (returnVal != EGL_TRUE) {
- fprintf(stderr, "%s() returned %d\n", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
- error);
- }
-}
-
-int printEGLConfigurations(EGLDisplay dpy) {
- EGLint numConfig = 0;
- EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
- checkEglError("eglGetConfigs", returnVal);
- if (!returnVal) {
- return false;
- }
-
- printf("Number of EGL configurations: %d\n", numConfig);
-
- EGLConfig* configs = (EGLConfig*) malloc(sizeof(EGLConfig) * numConfig);
- if (! configs) {
- printf("Could not allocate configs.\n");
- return false;
- }
-
- returnVal = eglGetConfigs(dpy, configs, numConfig, &numConfig);
- checkEglError("eglGetConfigs", returnVal);
- if (!returnVal) {
- free(configs);
- return false;
- }
-
- for(int i = 0; i < numConfig; i++) {
- printf("Configuration %d\n", i);
- printEGLConfiguration(dpy, configs[i]);
- }
-
- free(configs);
- return true;
-}
-
-int main(int argc, char **argv)
-{
- int q;
- int start, end;
- printf("Initializing EGL...\n");
- if(!init_gl_surface())
- {
- printf("GL initialisation failed - exiting\n");
- return 0;
- }
- init_scene();
- create_texture();
- printf("Running...\n");
- while(true) {
- render();
- }
- free_gl_surface();
- return 0;
-}
-
-int init_gl_surface(void)
-{
- EGLint numConfigs = 1;
- EGLConfig myConfig = {0};
- EGLint attrib[] =
- {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE
- };
-
- if ( (eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY )
- {
- printf("eglGetDisplay failed\n");
- return 0;
- }
-
- if ( eglInitialize(eglDisplay, NULL, NULL) != EGL_TRUE )
- {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- if (! printEGLConfigurations(eglDisplay)) {
- printf("printEGLConfigurations failed.\n");
- return 0;
- }
-
- EGLNativeWindowType window = android_createDisplaySurface();
- EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
-
- if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,
- window, 0)) == EGL_NO_SURFACE )
- {
- printf("eglCreateWindowSurface failed\n");
- return 0;
- }
-
- if ( (eglContext = eglCreateContext(eglDisplay, myConfig, 0, 0)) == EGL_NO_CONTEXT )
- {
- printf("eglCreateContext failed\n");
- return 0;
- }
-
- if ( eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) != EGL_TRUE )
- {
- printf("eglMakeCurrent failed\n");
- return 0;
- }
-
- int w, h;
-
- eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &w);
- checkEglError("eglQuerySurface");
- eglQuerySurface(eglDisplay, eglSurface, EGL_HEIGHT, &h);
- checkEglError("eglQuerySurface");
- GLint dim = w < h ? w : h;
-
- fprintf(stderr, "Window dimensions: %d x %d\n", w, h);
-
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- return 1;
-}
-
-void free_gl_surface(void)
-{
- if (eglDisplay != EGL_NO_DISPLAY)
- {
- eglMakeCurrent( EGL_NO_DISPLAY, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT );
- eglDestroyContext( eglDisplay, eglContext );
- eglDestroySurface( eglDisplay, eglSurface );
- eglTerminate( eglDisplay );
- eglDisplay = EGL_NO_DISPLAY;
- }
-}
-
-void init_scene(void)
-{
- glDisable(GL_DITHER);
- glEnable(GL_CULL_FACE);
- float ratio = 320.0f / 480.0f;
- glViewport(0, 0, 320, 480);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustumf(-ratio, ratio, -1, 1, 1, 10);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(
- 0, 0, 3, // eye
- 0, 0, 0, // center
- 0, 1, 0); // up
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-void create_texture(void)
-{
- const unsigned int on = 0xff0000ff;
- const unsigned int off = 0xffffffff;
- const unsigned int pixels[] =
- {
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- };
-
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
-void render()
-{
- int i, j;
- int quads = 1;
-
- const GLfloat vertices[] = {
- -1, -1, 0,
- 1, -1, 0,
- 1, 1, 0,
- -1, 1, 0
- };
-
- const GLfixed texCoords[] = {
- 0, 0,
- FIXED_ONE, 0,
- FIXED_ONE, FIXED_ONE,
- 0, FIXED_ONE
- };
-
- const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- glVertexPointer(3, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FIXED, 0, texCoords);
- glClearColor(1.0, 1.0, 1.0, 1.0);
- int nelem = sizeof(indices)/sizeof(indices[0]);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, indices);
- eglSwapBuffers(eglDisplay, eglSurface);
-}
diff --git a/opengl/tests/gl_jni/Android.mk b/opengl/tests/gl_jni/Android.mk
deleted file mode 100644
index 3d20e72..0000000
--- a/opengl/tests/gl_jni/Android.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-#########################################################################
-# OpenGL ES JNI sample
-# This makefile builds both an activity and a shared library.
-#########################################################################
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := GLJNI
-
-LOCAL_JNI_SHARED_LIBRARIES := libgljni
-
-include $(BUILD_PACKAGE)
-
-#########################################################################
-# Build JNI Shared Library
-#########################################################################
-
-LOCAL_PATH:= $(LOCAL_PATH)/jni
-
-include $(CLEAR_VARS)
-
-# Optional tag would mean it doesn't get installed by default
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -Werror
-
-LOCAL_SRC_FILES:= \
- gl_code.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libEGL \
- libGLESv1_CM
-
-LOCAL_MODULE := libgljni
-
-LOCAL_ARM_MODE := arm
-
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/tests/gl_jni/AndroidManifest.xml b/opengl/tests/gl_jni/AndroidManifest.xml
deleted file mode 100644
index 5d0ec96..0000000
--- a/opengl/tests/gl_jni/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gljni">
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <application
- android:label="@string/gljni_activity">
- <activity android:name="GLJNIActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:screenOrientation="landscape"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/gl_jni/jni/gl_code.cpp b/opengl/tests/gl_jni/jni/gl_code.cpp
deleted file mode 100644
index cf86020..0000000
--- a/opengl/tests/gl_jni/jni/gl_code.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// OpenGL ES 1.0 code
-
-#include <nativehelper/jni.h>
-#define LOG_TAG "GLJNI gl_code.cpp"
-#include <utils/Log.h>
-
-#include <GLES/gl.h>
-
-#include <stdio.h>
-
-#include <stdlib.h>
-#include <math.h>
-
-GLuint texture;
-GLfloat background;
-
-#define FIXED_ONE 0x10000
-
-static void printGLString(const char *name, GLenum s) {
- const char *v = (const char *) glGetString(s);
- ALOGI("GL %s = %s\n", name, v);
-}
-
-static void gluLookAt(float eyeX, float eyeY, float eyeZ,
- float centerX, float centerY, float centerZ, float upX, float upY,
- float upZ)
-{
- // See the OpenGL GLUT documentation for gluLookAt for a description
- // of the algorithm. We implement it in a straightforward way:
-
- float fx = centerX - eyeX;
- float fy = centerY - eyeY;
- float fz = centerZ - eyeZ;
-
- // Normalize f
- float rlf = 1.0f / sqrtf(fx*fx + fy*fy + fz*fz);
- fx *= rlf;
- fy *= rlf;
- fz *= rlf;
-
- // Normalize up
- float rlup = 1.0f / sqrtf(upX*upX + upY*upY + upZ*upZ);
- upX *= rlup;
- upY *= rlup;
- upZ *= rlup;
-
- // compute s = f x up (x means "cross product")
-
- float sx = fy * upZ - fz * upY;
- float sy = fz * upX - fx * upZ;
- float sz = fx * upY - fy * upX;
-
- // compute u = s x f
- float ux = sy * fz - sz * fy;
- float uy = sz * fx - sx * fz;
- float uz = sx * fy - sy * fx;
-
- float m[16] ;
- m[0] = sx;
- m[1] = ux;
- m[2] = -fx;
- m[3] = 0.0f;
-
- m[4] = sy;
- m[5] = uy;
- m[6] = -fy;
- m[7] = 0.0f;
-
- m[8] = sz;
- m[9] = uz;
- m[10] = -fz;
- m[11] = 0.0f;
-
- m[12] = 0.0f;
- m[13] = 0.0f;
- m[14] = 0.0f;
- m[15] = 1.0f;
-
- glMultMatrixf(m);
- glTranslatef(-eyeX, -eyeY, -eyeZ);
-}
-
-void init_scene(int width, int height)
-{
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- glDisable(GL_DITHER);
- glEnable(GL_CULL_FACE);
-
- float ratio = width / height;
- glViewport(0, 0, width, height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustumf(-ratio, ratio, -1, 1, 1, 10);
-
- glMatrixMode(GL_MODELVIEW);
-
- glLoadIdentity();
- gluLookAt(
- 0, 0, 3, // eye
- 0, 0, 0, // center
- 0, 1, 0); // up
-
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-void create_texture()
-{
- const unsigned int on = 0xff0000ff;
- const unsigned int off = 0xffffffff;
- const unsigned int pixels[] =
- {
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- };
-
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
-extern "C" {
- JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj, jint width, jint height);
- JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobject obj);
- JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * env, jobject obj);
-};
-
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj, jint width, jint height)
-{
- init_scene(width, height);
- create_texture();
-}
-
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobject obj)
-{
- const GLfloat vertices[] = {
- -1, -1, 0,
- 1, -1, 0,
- 1, 1, 0,
- -1, 1, 0
- };
-
- const GLfixed texCoords[] = {
- 0, 0,
- FIXED_ONE, 0,
- FIXED_ONE, FIXED_ONE,
- 0, FIXED_ONE
- };
-
- const GLushort quadIndices[] = { 0, 1, 2, 0, 2, 3 };
- glVertexPointer(3, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FIXED, 0, texCoords);
-
- int nelem = sizeof(quadIndices)/sizeof(quadIndices[0]);
- static float grey;
- grey += 0.01f;
- if (grey > 1.0f) {
- grey = 0.0f;
- }
- glClearColor(background, grey, grey, 1.0f);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, quadIndices);
-}
-
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * env, jobject obj)
-{
- background = 1.0f - background;
-}
diff --git a/opengl/tests/gl_jni/res/values/strings.xml b/opengl/tests/gl_jni/res/values/strings.xml
deleted file mode 100644
index aee9fa0..0000000
--- a/opengl/tests/gl_jni/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="gljni_activity">GLJNI</string>
-
-</resources>
-
diff --git a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java b/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java
deleted file mode 100644
index c6f5313..0000000
--- a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gljni;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class GLJNIActivity extends Activity {
-
- GLJNIView mView;
-
- @Override
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new GLJNIView(getApplication());
- mView.setFocusableInTouchMode(true);
- setContentView(mView);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java b/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java
deleted file mode 100644
index f56d2af..0000000
--- a/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gljni;
-
-// Wrapper for native library
-
-public class GLJNILib {
-
- static {
- System.loadLibrary("gljni");
- }
-
- /**
- * @param width the current view width
- * @param height the current view height
- */
- public static native void init(int width, int height);
- public static native void step();
- public static native void changeBackground();
-}
diff --git a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java b/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java
deleted file mode 100644
index 9a2c8c4..0000000
--- a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gljni;
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class GLJNIView extends GLSurfaceView {
- GLJNIView(Context context) {
- super(context);
- init();
- }
-
- public GLJNIView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
- }
-
- private void init() {
- setRenderer(new Renderer());
- }
-
- private class Renderer implements GLSurfaceView.Renderer {
- private static final String TAG = "Renderer";
- public void onDrawFrame(GL10 gl) {
- GLJNILib.step();
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GLJNILib.init(width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing.
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- GLJNILib.changeBackground();
- return true;
- }
-}
-
diff --git a/opengl/tests/gl_perf/Android.mk b/opengl/tests/gl_perf/Android.mk
deleted file mode 100644
index cfca089..0000000
--- a/opengl/tests/gl_perf/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_perf.cpp \
- filltest.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_perf
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_perf/fill_common.cpp b/opengl/tests/gl_perf/fill_common.cpp
deleted file mode 100644
index 389381f..0000000
--- a/opengl/tests/gl_perf/fill_common.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include "fragment_shaders.cpp"
-
-FILE * fOut = NULL;
-void ptSwap();
-
-static char gCurrentTestName[1024];
-static uint32_t gWidth = 0;
-static uint32_t gHeight = 0;
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- ALOGE("after %s() glError (0x%x)\n", op, error);
- }
-}
-
-GLuint loadShader(GLenum shaderType, const char* pSource) {
- GLuint shader = glCreateShader(shaderType);
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- glCompileShader(shader);
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- ALOGE("Could not compile shader %d:\n%s\n", shaderType, buf);
- free(buf);
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- }
- return shader;
-}
-
-enum {
- A_POS,
- A_COLOR,
- A_TEX0,
- A_TEX1
-};
-
-GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader) {
- return 0;
- }
-
- GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader) {
- return 0;
- }
-
- GLuint program = glCreateProgram();
- if (program) {
- glAttachShader(program, vertexShader);
- checkGlError("glAttachShader v");
- glAttachShader(program, pixelShader);
- checkGlError("glAttachShader p");
-
- glBindAttribLocation(program, A_POS, "a_pos");
- glBindAttribLocation(program, A_COLOR, "a_color");
- glBindAttribLocation(program, A_TEX0, "a_tex0");
- glBindAttribLocation(program, A_TEX1, "a_tex1");
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- ALOGE("Could not link program:\n%s\n", buf);
- free(buf);
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- checkGlError("createProgram");
- glUseProgram(program);
- return program;
-}
-
-uint64_t getTime() {
- struct timespec t;
- clock_gettime(CLOCK_MONOTONIC, &t);
- return t.tv_nsec + ((uint64_t)t.tv_sec * 1000 * 1000 * 1000);
-}
-
-uint64_t gTime;
-void startTimer() {
- gTime = getTime();
-}
-
-
-static void endTimer(int count) {
- uint64_t t2 = getTime();
- double delta = ((double)(t2 - gTime)) / 1000000000;
- double pixels = (gWidth * gHeight) * count;
- double mpps = pixels / delta / 1000000;
- double dc60 = ((double)count) / delta / 60;
-
- if (fOut) {
- fprintf(fOut, "%s, %f, %f\r\n", gCurrentTestName, mpps, dc60);
- fflush(fOut);
- } else {
- printf("%s, %f, %f\n", gCurrentTestName, mpps, dc60);
- }
- ALOGI("%s, %f, %f\r\n", gCurrentTestName, mpps, dc60);
-}
-
-
-static const char gVertexShader[] =
- "attribute vec4 a_pos;\n"
- "attribute vec4 a_color;\n"
- "attribute vec2 a_tex0;\n"
- "attribute vec2 a_tex1;\n"
- "varying vec4 v_color;\n"
- "varying vec2 v_tex0;\n"
- "varying vec2 v_tex1;\n"
- "uniform vec2 u_texOff;\n"
-
- "void main() {\n"
- " v_color = a_color;\n"
- " v_tex0 = a_tex0;\n"
- " v_tex1 = a_tex1;\n"
- " v_tex0.x += u_texOff.x;\n"
- " v_tex1.y += u_texOff.y;\n"
- " gl_Position = a_pos;\n"
- "}\n";
-
-static void setupVA() {
- static const float vtx[] = {
- -1.0f,-1.0f,
- 1.0f,-1.0f,
- -1.0f, 1.0f,
- 1.0f, 1.0f };
- static const float color[] = {
- 1.0f,0.0f,1.0f,1.0f,
- 0.0f,0.0f,1.0f,1.0f,
- 1.0f,1.0f,0.0f,1.0f,
- 1.0f,1.0f,1.0f,1.0f };
- static const float tex0[] = {
- 0.0f,0.0f,
- 1.0f,0.0f,
- 0.0f,1.0f,
- 1.0f,1.0f };
- static const float tex1[] = {
- 1.0f,0.0f,
- 1.0f,1.0f,
- 0.0f,1.0f,
- 0.0f,0.0f };
-
- glEnableVertexAttribArray(A_POS);
- glEnableVertexAttribArray(A_COLOR);
- glEnableVertexAttribArray(A_TEX0);
- glEnableVertexAttribArray(A_TEX1);
-
- glVertexAttribPointer(A_POS, 2, GL_FLOAT, false, 8, vtx);
- glVertexAttribPointer(A_COLOR, 4, GL_FLOAT, false, 16, color);
- glVertexAttribPointer(A_TEX0, 2, GL_FLOAT, false, 8, tex0);
- glVertexAttribPointer(A_TEX1, 2, GL_FLOAT, false, 8, tex1);
-}
-
-static void randUniform(int pgm, const char *var) {
- int loc = glGetUniformLocation(pgm, var);
- if (loc >= 0) {
- float x = ((float)rand()) / RAND_MAX;
- float y = ((float)rand()) / RAND_MAX;
- float z = ((float)rand()) / RAND_MAX;
- float w = ((float)rand()) / RAND_MAX;
- glUniform4f(loc, x, y, z, w);
- }
-}
-
-static void doLoop(bool warmup, int pgm, uint32_t passCount) {
- if (warmup) {
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- ptSwap();
- glFinish();
- return;
- }
-
- startTimer();
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- for (uint32_t ct=0; ct < passCount; ct++) {
- int loc = glGetUniformLocation(pgm, "u_texOff");
- glUniform2f(loc, ((float)ct) / passCount, ((float)ct) / 2.f / passCount);
-
- randUniform(pgm, "u_color");
- randUniform(pgm, "u_0");
- randUniform(pgm, "u_1");
- randUniform(pgm, "u_2");
- randUniform(pgm, "u_3");
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- }
- ptSwap();
- glFinish();
- endTimer(passCount);
-}
-
-
-static uint32_t rgb(uint32_t r, uint32_t g, uint32_t b)
-{
- uint32_t ret = 0xff000000;
- ret |= r & 0xff;
- ret |= (g & 0xff) << 8;
- ret |= (b & 0xff) << 16;
- return ret;
-}
-
-void genTextures() {
- uint32_t *m = (uint32_t *)malloc(1024*1024*4);
- for (int y=0; y < 1024; y++){
- for (int x=0; x < 1024; x++){
- m[y*1024 + x] = rgb(x, (((x+y) & 0xff) == 0x7f) * 0xff, y);
- }
- }
- glBindTexture(GL_TEXTURE_2D, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, m);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- for (int y=0; y < 16; y++){
- for (int x=0; x < 16; x++){
- m[y*16 + x] = rgb(x << 4, (((x+y) & 0xf) == 0x7) * 0xff, y << 4);
- }
- }
- glBindTexture(GL_TEXTURE_2D, 2);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, m);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- free(m);
-}
-
-static void doSingleTest(uint32_t pgmNum, int tex) {
- const char *pgmTxt = gFragmentTests[pgmNum]->txt;
- int pgm = createProgram(gVertexShader, pgmTxt);
- if (!pgm) {
- printf("error running test\n");
- return;
- }
- int loc = glGetUniformLocation(pgm, "u_tex0");
- if (loc >= 0) glUniform1i(loc, 0);
- loc = glGetUniformLocation(pgm, "u_tex1");
- if (loc >= 0) glUniform1i(loc, 1);
-
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, tex);
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, tex);
- glActiveTexture(GL_TEXTURE0);
-
- glBlendFunc(GL_ONE, GL_ONE);
- glDisable(GL_BLEND);
- //sprintf(str2, "%i, %i, %i, %i, %i, 0",
- //useVarColor, texCount, modulateFirstTex, extraMath, tex0);
- //doLoop(true, pgm, w, h, str2);
- //doLoop(false, pgm, w, h, str2);
-
- glEnable(GL_BLEND);
- sprintf(gCurrentTestName, "%s, %i, %i, 1", gFragmentTests[pgmNum]->name, pgmNum, tex);
- doLoop(true, pgm, 100);
- doLoop(false, pgm, 100);
-}
-
diff --git a/opengl/tests/gl_perf/filltest.cpp b/opengl/tests/gl_perf/filltest.cpp
deleted file mode 100644
index 3f8faca..0000000
--- a/opengl/tests/gl_perf/filltest.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-#include <string.h>
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <utils/Timers.h>
-#include <EGL/egl.h>
-#include <utils/Log.h>
-
-
-using namespace android;
-
-
-#include "fill_common.cpp"
-
-
-bool doTest(uint32_t w, uint32_t h) {
- gWidth = w;
- gHeight = h;
- setupVA();
- genTextures();
-
- printf("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n");
-
- for (uint32_t num = 0; num < gFragmentTestCount; num++) {
- doSingleTest(num, 2);
- if (gFragmentTests[num]->texCount) {
- doSingleTest(num, 1);
- }
- }
-
- exit(0);
- return true;
-}
diff --git a/opengl/tests/gl_perf/fragment_shaders.cpp b/opengl/tests/gl_perf/fragment_shaders.cpp
deleted file mode 100644
index 79d5ead..0000000
--- a/opengl/tests/gl_perf/fragment_shaders.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-
-typedef struct FragmentTestRec {
- const char * name;
- uint32_t texCount;
- const char * txt;
-} FragmentTest;
-
-static FragmentTest fpFill = {
- "Solid color", 0,
-
- "precision mediump float;\n"
- "uniform vec4 u_color;\n"
- "void main() {\n"
- " gl_FragColor = u_color;\n"
- "}\n"
-};
-
-static FragmentTest fpGradient = {
- "Solid gradient", 0,
-
- "precision mediump float;\n"
- "varying lowp vec4 v_color;\n"
- "void main() {\n"
- " gl_FragColor = v_color;\n"
- "}\n"
-};
-
-static FragmentTest fpCopyTex = {
- "Texture copy", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "uniform sampler2D u_tex0;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(u_tex0, v_tex0);\n"
- "}\n"
-};
-
-static FragmentTest fpCopyTexGamma = {
- "Texture copy with gamma", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "uniform sampler2D u_tex0;\n"
- "void main() {\n"
- " vec4 t = texture2D(u_tex0, v_tex0);\n"
- " t.rgb = pow(t.rgb, vec3(1.4, 1.4, 1.4));\n"
- " gl_FragColor = t;\n"
- "}\n"
-};
-
-static FragmentTest fpTexSpec = {
- "Texture spec", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "uniform sampler2D u_tex0;\n"
- "void main() {\n"
- " vec4 t = texture2D(u_tex0, v_tex0);\n"
- " float simSpec = dot(gl_FragCoord.xyz, gl_FragCoord.xyz);\n"
- " simSpec = pow(clamp(simSpec, 0.1, 1.0), 40.0);\n"
- " gl_FragColor = t + vec4(simSpec, simSpec, simSpec, simSpec);\n"
- "}\n"
-};
-
-static FragmentTest fpDepTex = {
- "Dependent Lookup", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "uniform sampler2D u_tex0;\n"
- "void main() {\n"
- " vec4 t = texture2D(u_tex0, v_tex0);\n"
- " t += texture2D(u_tex0, t.xy);\n"
- " gl_FragColor = t;\n"
- "}\n"
-};
-
-static FragmentTest fpModulateConstantTex = {
- "Texture modulate constant", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "uniform sampler2D u_tex0;\n"
- "uniform vec4 u_color;\n"
-
- "void main() {\n"
- " lowp vec4 c = texture2D(u_tex0, v_tex0);\n"
- " c *= u_color;\n"
- " gl_FragColor = c;\n"
- "}\n"
-};
-
-static FragmentTest fpModulateVaryingTex = {
- "Texture modulate gradient", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "varying lowp vec4 v_color;\n"
- "uniform sampler2D u_tex0;\n"
-
- "void main() {\n"
- " lowp vec4 c = texture2D(u_tex0, v_tex0);\n"
- " c *= v_color;\n"
- " gl_FragColor = c;\n"
- "}\n"
-};
-
-static FragmentTest fpModulateVaryingConstantTex = {
- "Texture modulate gradient constant", 1,
-
- "precision mediump float;\n"
- "varying vec2 v_tex0;\n"
- "varying lowp vec4 v_color;\n"
- "uniform sampler2D u_tex0;\n"
- "uniform vec4 u_color;\n"
-
- "void main() {\n"
- " lowp vec4 c = texture2D(u_tex0, v_tex0);\n"
- " c *= v_color;\n"
- " c *= u_color;\n"
- " gl_FragColor = c;\n"
- "}\n"
-};
-
-static FragmentTest *gFragmentTests[] = {
- &fpFill,
- &fpGradient,
- &fpCopyTex,
- &fpCopyTexGamma,
- &fpTexSpec,
- &fpDepTex,
- &fpModulateConstantTex,
- &fpModulateVaryingTex,
- &fpModulateVaryingConstantTex,
-
-};
-
-static const size_t gFragmentTestCount = sizeof(gFragmentTests) / sizeof(gFragmentTests[0]);
diff --git a/opengl/tests/gl_perf/gl2_perf.cpp b/opengl/tests/gl_perf/gl2_perf.cpp
deleted file mode 100644
index 224acaf..0000000
--- a/opengl/tests/gl_perf/gl2_perf.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <utils/Timers.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
- if (returnVal != EGL_TRUE) {
- fprintf(stderr, "%s() returned %d\n", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
- error);
- }
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- fprintf(stderr, "after %s() glError (0x%x)\n", op, error);
- }
-}
-
-bool doTest(uint32_t w, uint32_t h);
-
-static EGLDisplay dpy;
-static EGLSurface surface;
-
-int main(int argc, char** argv) {
- EGLBoolean returnValue;
- EGLConfig myConfig = {0};
-
- EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE };
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLint w, h;
-
-
- checkEglError("<init>");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- checkEglError("eglGetDisplay");
- if (dpy == EGL_NO_DISPLAY) {
- printf("eglGetDisplay returned EGL_NO_DISPLAY.\n");
- return 0;
- }
-
- returnValue = eglInitialize(dpy, &majorVersion, &minorVersion);
- checkEglError("eglInitialize", returnValue);
- if (returnValue != EGL_TRUE) {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- EGLNativeWindowType window = android_createDisplaySurface();
- returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
- if (returnValue) {
- printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
- return 0;
- }
-
- checkEglError("EGLUtils::selectConfigForNativeWindow");
-
- surface = eglCreateWindowSurface(dpy, myConfig, window, NULL);
- checkEglError("eglCreateWindowSurface");
- if (surface == EGL_NO_SURFACE) {
- printf("gelCreateWindowSurface failed.\n");
- return 0;
- }
-
- context = eglCreateContext(dpy, myConfig, EGL_NO_CONTEXT, context_attribs);
- checkEglError("eglCreateContext");
- if (context == EGL_NO_CONTEXT) {
- printf("eglCreateContext failed\n");
- return 0;
- }
- returnValue = eglMakeCurrent(dpy, surface, surface, context);
- checkEglError("eglMakeCurrent", returnValue);
- if (returnValue != EGL_TRUE) {
- return 0;
- }
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- checkEglError("eglQuerySurface");
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- checkEglError("eglQuerySurface");
- GLint dim = w < h ? w : h;
-
- glViewport(0, 0, w, h);
-
- for (;;) {
- doTest(w, h);
- eglSwapBuffers(dpy, surface);
- checkEglError("eglSwapBuffers");
- }
-
- return 0;
-}
-
-void ptSwap() {
- eglSwapBuffers(dpy, surface);
-}
-
diff --git a/opengl/tests/gl_perfapp/Android.mk b/opengl/tests/gl_perfapp/Android.mk
deleted file mode 100644
index 65e50e9..0000000
--- a/opengl/tests/gl_perfapp/Android.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-#########################################################################
-# OpenGL ES Perf App
-# This makefile builds both an activity and a shared library.
-#########################################################################
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := GLPerf
-
-LOCAL_JNI_SHARED_LIBRARIES := libglperf
-
-# Run on Eclair
-LOCAL_SDK_VERSION := 7
-
-include $(BUILD_PACKAGE)
-
-#########################################################################
-# Build JNI Shared Library
-#########################################################################
-
-LOCAL_PATH:= $(LOCAL_PATH)/jni
-
-include $(CLEAR_VARS)
-
-# Optional tag would mean it doesn't get installed by default
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -Werror
-
-LOCAL_SRC_FILES:= \
- gl_code.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libEGL \
- libGLESv2
-
-LOCAL_MODULE := libglperf
-
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/tests/gl_perfapp/AndroidManifest.xml b/opengl/tests/gl_perfapp/AndroidManifest.xml
deleted file mode 100644
index ee4bd98..0000000
--- a/opengl/tests/gl_perfapp/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.glperf"
- android:versionName="1.0.0" android:versionCode="10000" >
- <uses-sdk android:targetSdkVersion="7" android:minSdkVersion="7" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <application
- android:label="@string/glperf_activity">
- <activity android:name="GLPerfActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp
deleted file mode 100644
index 2f04183..0000000
--- a/opengl/tests/gl_perfapp/jni/gl_code.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// OpenGL ES 2.0 code
-
-#include <nativehelper/jni.h>
-#define LOG_TAG "GLPerf gl_code.cpp"
-#include <utils/Log.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <utils/Timers.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "../../gl_perf/fill_common.cpp"
-
-
-//////////////////////////
-
-// Width and height of the screen
-
-uint32_t w;
-uint32_t h;
-
-// The stateClock starts at zero and increments by 1 every time we draw a frame. It is used to control which phase of the test we are in.
-
-int stateClock;
-const int doLoopStates = 2;
-const int doSingleTestStates = 2;
-bool done;
-
-// Saves the parameters of the test (so we can print them out when we finish the timing.)
-
-
-int pgm;
-
-void ptSwap() {
-}
-
-void doTest() {
- uint32_t testNum = stateClock >> 2;
- int texSize = ((stateClock >> 1) & 0x1) + 1;
-
- if (testNum >= gFragmentTestCount) {
- ALOGI("done\n");
- if (fOut) {
- fclose(fOut);
- fOut = NULL;
- }
- done = true;
- return;
- }
-
- // ALOGI("doTest %d %d %d\n", texCount, extraMath, testSubState);
-
-// for (uint32_t num = 0; num < gFragmentTestCount; num++) {
- doSingleTest(testNum, texSize);
-}
-
-extern "C" {
- JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_init(JNIEnv * env, jobject obj, jint width, jint height);
- JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_step(JNIEnv * env, jobject obj);
-};
-
-JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_init(JNIEnv * env, jobject obj, jint width, jint height)
-{
- gWidth = width;
- gHeight = height;
- if (!done) {
- stateClock = 0;
- done = false;
- setupVA();
- genTextures();
- const char* fileName = "/sdcard/glperf.csv";
- if (fOut != NULL) {
- ALOGI("Closing partially written output.n");
- fclose(fOut);
- fOut = NULL;
- }
- ALOGI("Writing to: %s\n",fileName);
- fOut = fopen(fileName, "w");
- if (fOut == NULL) {
- ALOGE("Could not open: %s\n", fileName);
- }
-
- ALOGI("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n");
- if (fOut) fprintf(fOut,"varColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\r\n");
- }
-}
-
-JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_step(JNIEnv * env, jobject obj)
-{
- if (! done) {
- if (stateClock > 0 && ((stateClock & 1) == 0)) {
- //endTimer(100);
- }
- doTest();
- stateClock++;
- } else {
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- }
-}
diff --git a/opengl/tests/gl_perfapp/res/values/strings.xml b/opengl/tests/gl_perfapp/res/values/strings.xml
deleted file mode 100644
index 52cd961..0000000
--- a/opengl/tests/gl_perfapp/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="glperf_activity">GLPerf</string>
-
-</resources>
-
diff --git a/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfActivity.java b/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfActivity.java
deleted file mode 100644
index e3f3abf..0000000
--- a/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfActivity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.glperf;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-import java.io.File;
-
-
-public class GLPerfActivity extends Activity {
-
- GLPerfView mView;
-
- @Override protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- mView = new GLPerfView(getApplication());
- setContentView(mView);
- }
-
- @Override protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfLib.java b/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfLib.java
deleted file mode 100644
index 89a0e54..0000000
--- a/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfLib.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.glperf;
-
-// Wrapper for native library
-
-public class GLPerfLib {
-
- static {
- System.loadLibrary("glperf");
- }
-
- /**
- * @param width the current view width
- * @param height the current view height
- */
- public static native void init(int width, int height);
- public static native void step();
-}
diff --git a/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfView.java b/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfView.java
deleted file mode 100644
index 4ce4a4d..0000000
--- a/opengl/tests/gl_perfapp/src/com/android/glperf/GLPerfView.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.glperf;
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class GLPerfView extends GLSurfaceView {
- private static String TAG = "GLPerfView";
-
- public GLPerfView(Context context) {
- super(context);
- init(false, 0, 0);
- }
-
- public GLPerfView(Context context, boolean translucent, int depth, int stencil) {
- super(context);
- init(translucent, depth, stencil);
- }
-
- private void init(boolean translucent, int depth, int stencil) {
- setEGLContextFactory(new ContextFactory());
- setEGLConfigChooser( translucent ?
- new ConfigChooser(8,8,8,8, depth, stencil) :
- new ConfigChooser(5,6,5,0, depth, stencil));
- setRenderer(new Renderer());
- }
-
- private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
- private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
- public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
- Log.w(TAG, "creating OpenGL ES 2.0 context");
- checkEglError("Before eglCreateContext", egl);
- int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
- EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
- checkEglError("After eglCreateContext", egl);
- return context;
- }
-
- public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
- egl.eglDestroyContext(display, context);
- }
- }
-
- private static void checkEglError(String prompt, EGL10 egl) {
- int error;
- while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
- Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
- }
- }
-
- private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
- private static int EGL_OPENGL_ES2_BIT = 4;
- private static int[] s_configAttribs2 =
- {
- EGL10.EGL_RED_SIZE, 4,
- EGL10.EGL_GREEN_SIZE, 4,
- EGL10.EGL_BLUE_SIZE, 4,
- EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL10.EGL_NONE
- };
-
- public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) {
- mRedSize = r;
- mGreenSize = g;
- mBlueSize = b;
- mAlphaSize = a;
- mDepthSize = depth;
- mStencilSize = stencil;
- }
-
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
-
- int[] num_config = new int[1];
- egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
-
- int numConfigs = num_config[0];
-
- if (numConfigs <= 0) {
- throw new IllegalArgumentException("No configs match configSpec");
- }
- EGLConfig[] configs = new EGLConfig[numConfigs];
- egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
- // printConfigs(egl, display, configs);
- return chooseConfig(egl, display, configs);
- }
-
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
- EGLConfig[] configs) {
- EGLConfig closestConfig = null;
- int closestDistance = 1000;
- for(EGLConfig config : configs) {
- int d = findConfigAttrib(egl, display, config,
- EGL10.EGL_DEPTH_SIZE, 0);
- int s = findConfigAttrib(egl, display, config,
- EGL10.EGL_STENCIL_SIZE, 0);
- if (d >= mDepthSize && s>= mStencilSize) {
- int r = findConfigAttrib(egl, display, config,
- EGL10.EGL_RED_SIZE, 0);
- int g = findConfigAttrib(egl, display, config,
- EGL10.EGL_GREEN_SIZE, 0);
- int b = findConfigAttrib(egl, display, config,
- EGL10.EGL_BLUE_SIZE, 0);
- int a = findConfigAttrib(egl, display, config,
- EGL10.EGL_ALPHA_SIZE, 0);
- int distance = Math.abs(r - mRedSize)
- + Math.abs(g - mGreenSize)
- + Math.abs(b - mBlueSize)
- + Math.abs(a - mAlphaSize);
- if (distance < closestDistance) {
- closestDistance = distance;
- closestConfig = config;
- }
- }
- }
- return closestConfig;
- }
-
- private int findConfigAttrib(EGL10 egl, EGLDisplay display,
- EGLConfig config, int attribute, int defaultValue) {
-
- if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
- return mValue[0];
- }
- return defaultValue;
- }
-
- private void printConfigs(EGL10 egl, EGLDisplay display,
- EGLConfig[] configs) {
- int numConfigs = configs.length;
- Log.w(TAG, String.format("%d configurations", numConfigs));
- for (int i = 0; i < numConfigs; i++) {
- Log.w(TAG, String.format("Configuration %d:\n", i));
- printConfig(egl, display, configs[i]);
- }
- }
-
- private void printConfig(EGL10 egl, EGLDisplay display,
- EGLConfig config) {
- int[] attributes = {
- EGL10.EGL_BUFFER_SIZE,
- EGL10.EGL_ALPHA_SIZE,
- EGL10.EGL_BLUE_SIZE,
- EGL10.EGL_GREEN_SIZE,
- EGL10.EGL_RED_SIZE,
- EGL10.EGL_DEPTH_SIZE,
- EGL10.EGL_STENCIL_SIZE,
- EGL10.EGL_CONFIG_CAVEAT,
- EGL10.EGL_CONFIG_ID,
- EGL10.EGL_LEVEL,
- EGL10.EGL_MAX_PBUFFER_HEIGHT,
- EGL10.EGL_MAX_PBUFFER_PIXELS,
- EGL10.EGL_MAX_PBUFFER_WIDTH,
- EGL10.EGL_NATIVE_RENDERABLE,
- EGL10.EGL_NATIVE_VISUAL_ID,
- EGL10.EGL_NATIVE_VISUAL_TYPE,
- 0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
- EGL10.EGL_SAMPLES,
- EGL10.EGL_SAMPLE_BUFFERS,
- EGL10.EGL_SURFACE_TYPE,
- EGL10.EGL_TRANSPARENT_TYPE,
- EGL10.EGL_TRANSPARENT_RED_VALUE,
- EGL10.EGL_TRANSPARENT_GREEN_VALUE,
- EGL10.EGL_TRANSPARENT_BLUE_VALUE,
- 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
- 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
- 0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
- 0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
- EGL10.EGL_LUMINANCE_SIZE,
- EGL10.EGL_ALPHA_MASK_SIZE,
- EGL10.EGL_COLOR_BUFFER_TYPE,
- EGL10.EGL_RENDERABLE_TYPE,
- 0x3042 // EGL10.EGL_CONFORMANT
- };
- String[] names = {
- "EGL_BUFFER_SIZE",
- "EGL_ALPHA_SIZE",
- "EGL_BLUE_SIZE",
- "EGL_GREEN_SIZE",
- "EGL_RED_SIZE",
- "EGL_DEPTH_SIZE",
- "EGL_STENCIL_SIZE",
- "EGL_CONFIG_CAVEAT",
- "EGL_CONFIG_ID",
- "EGL_LEVEL",
- "EGL_MAX_PBUFFER_HEIGHT",
- "EGL_MAX_PBUFFER_PIXELS",
- "EGL_MAX_PBUFFER_WIDTH",
- "EGL_NATIVE_RENDERABLE",
- "EGL_NATIVE_VISUAL_ID",
- "EGL_NATIVE_VISUAL_TYPE",
- "EGL_PRESERVED_RESOURCES",
- "EGL_SAMPLES",
- "EGL_SAMPLE_BUFFERS",
- "EGL_SURFACE_TYPE",
- "EGL_TRANSPARENT_TYPE",
- "EGL_TRANSPARENT_RED_VALUE",
- "EGL_TRANSPARENT_GREEN_VALUE",
- "EGL_TRANSPARENT_BLUE_VALUE",
- "EGL_BIND_TO_TEXTURE_RGB",
- "EGL_BIND_TO_TEXTURE_RGBA",
- "EGL_MIN_SWAP_INTERVAL",
- "EGL_MAX_SWAP_INTERVAL",
- "EGL_LUMINANCE_SIZE",
- "EGL_ALPHA_MASK_SIZE",
- "EGL_COLOR_BUFFER_TYPE",
- "EGL_RENDERABLE_TYPE",
- "EGL_CONFORMANT"
- };
- int[] value = new int[1];
- for (int i = 0; i < attributes.length; i++) {
- int attribute = attributes[i];
- String name = names[i];
- if ( egl.eglGetConfigAttrib(display, config, attribute, value)) {
- Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
- } else {
- // Log.w(TAG, String.format(" %s: failed\n", name));
- while (egl.eglGetError() != EGL10.EGL_SUCCESS);
- }
- }
- }
-
- // Subclasses can adjust these values:
- protected int mRedSize;
- protected int mGreenSize;
- protected int mBlueSize;
- protected int mAlphaSize;
- protected int mDepthSize;
- protected int mStencilSize;
- private int[] mValue = new int[1];
- }
-
- private static class Renderer implements GLSurfaceView.Renderer {
- public void onDrawFrame(GL10 gl) {
- GLPerfLib.step();
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GLPerfLib.init(width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing.
- }
- }
-}
-
diff --git a/opengl/tests/gl_yuvtex/Android.mk b/opengl/tests/gl_yuvtex/Android.mk
deleted file mode 100644
index 9e5dba0..0000000
--- a/opengl/tests/gl_yuvtex/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl_yuvtex.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl_yuvtex
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
deleted file mode 100644
index 7a00f76..0000000
--- a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/Timers.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-static void printGLString(const char *name, GLenum s) {
- // fprintf(stderr, "printGLString %s, %d\n", name, s);
- const char *v = (const char *) glGetString(s);
- // int error = glGetError();
- // fprintf(stderr, "glGetError() = %d, result of glGetString = %x\n", error,
- // (unsigned int) v);
- // if ((v < (const char*) 0) || (v > (const char*) 0x10000))
- // fprintf(stderr, "GL %s = %s\n", name, v);
- // else
- // fprintf(stderr, "GL %s = (null) 0x%08x\n", name, (unsigned int) v);
- fprintf(stderr, "GL %s = %s\n", name, v);
-}
-
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
- if (returnVal != EGL_TRUE) {
- fprintf(stderr, "%s() returned %d\n", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
- error);
- }
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- fprintf(stderr, "after %s() glError (0x%x)\n", op, error);
- }
-}
-
-bool setupGraphics(int w, int h) {
- glViewport(0, 0, w, h);
- checkGlError("glViewport");
- return true;
-}
-
-int align(int x, int a) {
- return (x + (a-1)) & (~(a-1));
-}
-
-const int yuvTexWidth = 600;
-const int yuvTexHeight = 480;
-const int yuvTexUsage = GraphicBuffer::USAGE_HW_TEXTURE |
- GraphicBuffer::USAGE_SW_WRITE_RARELY;
-const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12;
-const int yuvTexOffsetY = 0;
-const int yuvTexStrideY = (yuvTexWidth + 0xf) & ~0xf;
-const int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
-const int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
-const int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
-const int yuvTexStrideU = yuvTexStrideV;
-const bool yuvTexSameUV = false;
-static sp<GraphicBuffer> yuvTexBuffer;
-static GLuint yuvTex;
-
-bool setupYuvTexSurface(EGLDisplay dpy, EGLContext context) {
- int blockWidth = yuvTexWidth > 16 ? yuvTexWidth / 16 : 1;
- int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1;
- yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat,
- yuvTexUsage);
- char* buf = NULL;
- status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
- if (err != 0) {
- fprintf(stderr, "yuvTexBuffer->lock(...) failed: %d\n", err);
- return false;
- }
- for (int x = 0; x < yuvTexWidth; x++) {
- for (int y = 0; y < yuvTexHeight; y++) {
- int parityX = (x / blockWidth) & 1;
- int parityY = (y / blockHeight) & 1;
- unsigned char intensity = (parityX ^ parityY) ? 63 : 191;
- buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity;
- if (x < yuvTexWidth / 2 && y < yuvTexHeight / 2) {
- buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity;
- if (yuvTexSameUV) {
- buf[yuvTexOffsetV + (y * yuvTexStrideV) + x] = intensity;
- } else if (x < yuvTexWidth / 4 && y < yuvTexHeight / 4) {
- buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] =
- buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] =
- buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] =
- buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] = intensity;
- }
- }
- }
- }
-
- err = yuvTexBuffer->unlock();
- if (err != 0) {
- fprintf(stderr, "yuvTexBuffer->unlock() failed: %d\n", err);
- return false;
- }
-
- EGLClientBuffer clientBuffer = (EGLClientBuffer)yuvTexBuffer->getNativeBuffer();
- EGLImageKHR img = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,
- clientBuffer, 0);
- checkEglError("eglCreateImageKHR");
- if (img == EGL_NO_IMAGE_KHR) {
- return false;
- }
-
- glGenTextures(1, &yuvTex);
- checkGlError("glGenTextures");
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, yuvTex);
- checkGlError("glBindTexture");
- glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)img);
- checkGlError("glEGLImageTargetTexture2DOES");
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- checkGlError("glTexParameteri");
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- checkGlError("glTexParameteri");
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- checkGlError("glTexEnvx");
-
- GLint crop[4] = { 0, 0, yuvTexWidth, yuvTexHeight };
- glTexParameteriv(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_CROP_RECT_OES, crop);
- checkGlError("glTexParameteriv");
-
- return true;
-}
-
-void renderFrame(int w, int h) {
- glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
- checkGlError("glClearColor");
- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, yuvTex);
- checkGlError("glBindTexture");
- glEnable(GL_TEXTURE_EXTERNAL_OES);
- checkGlError("glEnable");
-
- glDrawTexiOES(0, 0, 0, w, h);
- checkGlError("glDrawTexiOES");
-}
-
-void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- printf(" %s: ", names[j].name);
- printf("%d (0x%x)", value, value);
- }
- }
- printf("\n");
-}
-
-int main(int argc, char** argv) {
- EGLBoolean returnValue;
- EGLConfig myConfig = {0};
-
- EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE };
- EGLint s_configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
- EGL_NONE };
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLSurface surface;
- EGLint w, h;
-
- EGLDisplay dpy;
-
- checkEglError("<init>");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- checkEglError("eglGetDisplay");
- if (dpy == EGL_NO_DISPLAY) {
- printf("eglGetDisplay returned EGL_NO_DISPLAY.\n");
- return 0;
- }
-
- returnValue = eglInitialize(dpy, &majorVersion, &minorVersion);
- checkEglError("eglInitialize", returnValue);
- fprintf(stderr, "EGL version %d.%d\n", majorVersion, minorVersion);
- if (returnValue != EGL_TRUE) {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- EGLNativeWindowType window = android_createDisplaySurface();
- returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
- if (returnValue) {
- printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
- return 1;
- }
-
- checkEglError("EGLUtils::selectConfigForNativeWindow");
-
- printf("Chose this configuration:\n");
- printEGLConfiguration(dpy, myConfig);
-
- surface = eglCreateWindowSurface(dpy, myConfig, window, NULL);
- checkEglError("eglCreateWindowSurface");
- if (surface == EGL_NO_SURFACE) {
- printf("gelCreateWindowSurface failed.\n");
- return 1;
- }
-
- context = eglCreateContext(dpy, myConfig, EGL_NO_CONTEXT, context_attribs);
- checkEglError("eglCreateContext");
- if (context == EGL_NO_CONTEXT) {
- printf("eglCreateContext failed\n");
- return 1;
- }
- returnValue = eglMakeCurrent(dpy, surface, surface, context);
- checkEglError("eglMakeCurrent", returnValue);
- if (returnValue != EGL_TRUE) {
- return 1;
- }
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- checkEglError("eglQuerySurface");
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- checkEglError("eglQuerySurface");
- GLint dim = w < h ? w : h;
-
- fprintf(stderr, "Window dimensions: %d x %d\n", w, h);
-
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- if(!setupYuvTexSurface(dpy, context)) {
- fprintf(stderr, "Could not set up texture surface.\n");
- return 1;
- }
-
- if(!setupGraphics(w, h)) {
- fprintf(stderr, "Could not set up graphics.\n");
- return 1;
- }
-
- for (;;) {
- static int dir = -1;
-
- renderFrame(w, h);
- eglSwapBuffers(dpy, surface);
- checkEglError("eglSwapBuffers");
-
- if (w <= 10 || h <= 10)
- {
- dir = -dir;
- }
-
- if (w >= 1300 || h >= 900)
- {
- dir = -dir;
- }
-
-
- w += dir;
- h += dir;
- }
-
- return 0;
-}
diff --git a/opengl/tests/gldual/Android.mk b/opengl/tests/gldual/Android.mk
deleted file mode 100644
index b4b378e..0000000
--- a/opengl/tests/gldual/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#########################################################################
-# OpenGL ES JNI sample
-# This makefile builds both an activity and a shared library.
-#########################################################################
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := GLDual
-
-LOCAL_JNI_SHARED_LIBRARIES := libgldualjni
-
-include $(BUILD_PACKAGE)
-
-#########################################################################
-# Build JNI Shared Library
-#########################################################################
-
-LOCAL_PATH:= $(LOCAL_PATH)/jni
-
-include $(CLEAR_VARS)
-
-# Optional tag would mean it doesn't get installed by default
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -Werror
-
-LOCAL_SRC_FILES:= \
- gl_code.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libEGL \
- libGLESv2
-
-LOCAL_MODULE := libgldualjni
-
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/tests/gldual/AndroidManifest.xml b/opengl/tests/gldual/AndroidManifest.xml
deleted file mode 100644
index a36f4f7..0000000
--- a/opengl/tests/gldual/AndroidManifest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gldual">
- <application
- android:label="@string/gldual_activity">
- <activity android:name="GLDualActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/gldual/jni/gl_code.cpp b/opengl/tests/gldual/jni/gl_code.cpp
deleted file mode 100644
index 22867ed..0000000
--- a/opengl/tests/gldual/jni/gl_code.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-// OpenGL ES 2.0 code
-
-#include <nativehelper/jni.h>
-#define LOG_TAG "GL2JNI gl_code.cpp"
-#include <utils/Log.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-static void printGLString(const char *name, GLenum s) {
- const char *v = (const char *) glGetString(s);
- ALOGI("GL %s = %s\n", name, v);
-}
-
-static void checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- ALOGI("after %s() glError (0x%x)\n", op, error);
- }
-}
-
-static const char gVertexShader[] = "attribute vec4 vPosition;\n"
- "void main() {\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
-static const char gFragmentShader[] = "precision mediump float;\n"
- "void main() {\n"
- " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
- "}\n";
-
-GLuint loadShader(GLenum shaderType, const char* pSource) {
- GLuint shader = glCreateShader(shaderType);
- if (shader) {
- glShaderSource(shader, 1, &pSource, NULL);
- glCompileShader(shader);
- GLint compiled = 0;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (infoLen) {
- char* buf = (char*) malloc(infoLen);
- if (buf) {
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- ALOGE("Could not compile shader %d:\n%s\n",
- shaderType, buf);
- free(buf);
- }
- glDeleteShader(shader);
- shader = 0;
- }
- }
- }
- return shader;
-}
-
-GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader) {
- return 0;
- }
-
- GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader) {
- return 0;
- }
-
- GLuint program = glCreateProgram();
- if (program) {
- glAttachShader(program, vertexShader);
- checkGlError("glAttachShader");
- glAttachShader(program, pixelShader);
- checkGlError("glAttachShader");
- glLinkProgram(program);
- GLint linkStatus = GL_FALSE;
- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- if (linkStatus != GL_TRUE) {
- GLint bufLength = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
- if (bufLength) {
- char* buf = (char*) malloc(bufLength);
- if (buf) {
- glGetProgramInfoLog(program, bufLength, NULL, buf);
- ALOGE("Could not link program:\n%s\n", buf);
- free(buf);
- }
- }
- glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
-}
-
-GLuint gProgram;
-GLuint gvPositionHandle;
-
-bool setupGraphics(int w, int h) {
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
-
- ALOGI("setupGraphics(%d, %d)", w, h);
- gProgram = createProgram(gVertexShader, gFragmentShader);
- if (!gProgram) {
- ALOGE("Could not create program.");
- return false;
- }
- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
- checkGlError("glGetAttribLocation");
- ALOGI("glGetAttribLocation(\"vPosition\") = %d\n",
- gvPositionHandle);
-
- glViewport(0, 0, w, h);
- checkGlError("glViewport");
- return true;
-}
-
-const GLfloat gTriangleVertices[] = { 0.0f, 0.5f, -0.5f, -0.5f,
- 0.5f, -0.5f };
-
-void renderFrame() {
- static float grey;
- grey += 0.01f;
- if (grey > 1.0f) {
- grey = 0.0f;
- }
- glClearColor(grey, grey, grey, 1.0f);
- checkGlError("glClearColor");
- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- checkGlError("glClear");
-
- glUseProgram(gProgram);
- checkGlError("glUseProgram");
-
- glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices);
- checkGlError("glVertexAttribPointer");
- glEnableVertexAttribArray(gvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
- glDrawArrays(GL_TRIANGLES, 0, 3);
- checkGlError("glDrawArrays");
-}
-
-extern "C" {
- JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_init(JNIEnv * env, jobject obj, jint width, jint height);
- JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * env, jobject obj);
-};
-
-JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_init(JNIEnv * env, jobject obj, jint width, jint height)
-{
- setupGraphics(width, height);
-}
-
-JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * env, jobject obj)
-{
- renderFrame();
-}
-
diff --git a/opengl/tests/gldual/res/layout/gldual_activity.xml b/opengl/tests/gldual/res/layout/gldual_activity.xml
deleted file mode 100644
index d75acbc..0000000
--- a/opengl/tests/gldual/res/layout/gldual_activity.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
- 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <android.opengl.GLSurfaceView android:id="@+id/gl1"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" />
- <com.android.gldual.GLDualGL2View android:id="@+id/gl2"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" />
-</LinearLayout>
diff --git a/opengl/tests/gldual/res/values/strings.xml b/opengl/tests/gldual/res/values/strings.xml
deleted file mode 100644
index b1f535d..0000000
--- a/opengl/tests/gldual/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="gldual_activity">GLDual</string>
-
-</resources>
-
diff --git a/opengl/tests/gldual/src/com/android/gldual/GLDualActivity.java b/opengl/tests/gldual/src/com/android/gldual/GLDualActivity.java
deleted file mode 100644
index 9d88f64..0000000
--- a/opengl/tests/gldual/src/com/android/gldual/GLDualActivity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gldual;
-
-import android.app.Activity;
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.LinearLayout;
-
-
-public class GLDualActivity extends Activity {
-
- GLSurfaceView mGLView;
- GLDualGL2View mGL2View;
-
- @Override protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- View root = getLayoutInflater().inflate(R.layout.gldual_activity, null);
- mGLView = (GLSurfaceView) root.findViewById(R.id.gl1);
- mGLView.setEGLConfigChooser(5,6,5,0,0,0);
- mGLView.setRenderer(new TriangleRenderer());
- mGL2View = (GLDualGL2View) root.findViewById(R.id.gl2);
- setContentView(root);
- }
-
- @Override protected void onPause() {
- super.onPause();
- mGLView.onPause();
- mGL2View.onPause();
- }
-
- @Override protected void onResume() {
- super.onResume();
- mGLView.onResume();
- mGL2View.onResume();
- }
-}
diff --git a/opengl/tests/gldual/src/com/android/gldual/GLDualGL2View.java b/opengl/tests/gldual/src/com/android/gldual/GLDualGL2View.java
deleted file mode 100644
index 8f5e347..0000000
--- a/opengl/tests/gldual/src/com/android/gldual/GLDualGL2View.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gldual;
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class GLDualGL2View extends GLSurfaceView {
- private static String TAG = "GLDualGL2View";
-
- public GLDualGL2View(Context context) {
- super(context);
- init(false, 0, 0);
- }
-
- public GLDualGL2View(Context context, AttributeSet set) {
- super(context, set);
- init(false, 0, 0);
- }
-
- public GLDualGL2View(Context context, boolean translucent, int depth, int stencil) {
- super(context);
- init(translucent, depth, stencil);
- }
-
- private void init(boolean translucent, int depth, int stencil) {
- setEGLContextFactory(new ContextFactory());
- setEGLConfigChooser( translucent ?
- new ConfigChooser(8,8,8,8, depth, stencil) :
- new ConfigChooser(5,6,5,0, depth, stencil));
- setRenderer(new Renderer());
- }
-
- private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
- private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
- public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
- Log.w(TAG, "creating OpenGL ES 2.0 context");
- checkEglError("Before eglCreateContext", egl);
- int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
- EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
- checkEglError("After eglCreateContext", egl);
- return context;
- }
-
- public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
- egl.eglDestroyContext(display, context);
- }
- }
-
- private static void checkEglError(String prompt, EGL10 egl) {
- int error;
- while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
- Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
- }
- }
-
- private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
- private static int EGL_OPENGL_ES2_BIT = 4;
- private static int[] s_configAttribs2 =
- {
- EGL10.EGL_RED_SIZE, 4,
- EGL10.EGL_GREEN_SIZE, 4,
- EGL10.EGL_BLUE_SIZE, 4,
- EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL10.EGL_NONE
- };
-
- public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) {
- mRedSize = r;
- mGreenSize = g;
- mBlueSize = b;
- mAlphaSize = a;
- mDepthSize = depth;
- mStencilSize = stencil;
- }
-
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
-
- int[] num_config = new int[1];
- egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
-
- int numConfigs = num_config[0];
-
- if (numConfigs <= 0) {
- throw new IllegalArgumentException("No configs match configSpec");
- }
- EGLConfig[] configs = new EGLConfig[numConfigs];
- egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
- // printConfigs(egl, display, configs);
- return chooseConfig(egl, display, configs);
- }
-
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
- EGLConfig[] configs) {
- EGLConfig closestConfig = null;
- int closestDistance = 1000;
- for(EGLConfig config : configs) {
- int d = findConfigAttrib(egl, display, config,
- EGL10.EGL_DEPTH_SIZE, 0);
- int s = findConfigAttrib(egl, display, config,
- EGL10.EGL_STENCIL_SIZE, 0);
- if (d >= mDepthSize && s>= mStencilSize) {
- int r = findConfigAttrib(egl, display, config,
- EGL10.EGL_RED_SIZE, 0);
- int g = findConfigAttrib(egl, display, config,
- EGL10.EGL_GREEN_SIZE, 0);
- int b = findConfigAttrib(egl, display, config,
- EGL10.EGL_BLUE_SIZE, 0);
- int a = findConfigAttrib(egl, display, config,
- EGL10.EGL_ALPHA_SIZE, 0);
- int distance = Math.abs(r - mRedSize)
- + Math.abs(g - mGreenSize)
- + Math.abs(b - mBlueSize)
- + Math.abs(a - mAlphaSize);
- if (distance < closestDistance) {
- closestDistance = distance;
- closestConfig = config;
- }
- }
- }
- return closestConfig;
- }
-
- private int findConfigAttrib(EGL10 egl, EGLDisplay display,
- EGLConfig config, int attribute, int defaultValue) {
-
- if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
- return mValue[0];
- }
- return defaultValue;
- }
-
- private void printConfigs(EGL10 egl, EGLDisplay display,
- EGLConfig[] configs) {
- int numConfigs = configs.length;
- Log.w(TAG, String.format("%d configurations", numConfigs));
- for (int i = 0; i < numConfigs; i++) {
- Log.w(TAG, String.format("Configuration %d:\n", i));
- printConfig(egl, display, configs[i]);
- }
- }
-
- private void printConfig(EGL10 egl, EGLDisplay display,
- EGLConfig config) {
- int[] attributes = {
- EGL10.EGL_BUFFER_SIZE,
- EGL10.EGL_ALPHA_SIZE,
- EGL10.EGL_BLUE_SIZE,
- EGL10.EGL_GREEN_SIZE,
- EGL10.EGL_RED_SIZE,
- EGL10.EGL_DEPTH_SIZE,
- EGL10.EGL_STENCIL_SIZE,
- EGL10.EGL_CONFIG_CAVEAT,
- EGL10.EGL_CONFIG_ID,
- EGL10.EGL_LEVEL,
- EGL10.EGL_MAX_PBUFFER_HEIGHT,
- EGL10.EGL_MAX_PBUFFER_PIXELS,
- EGL10.EGL_MAX_PBUFFER_WIDTH,
- EGL10.EGL_NATIVE_RENDERABLE,
- EGL10.EGL_NATIVE_VISUAL_ID,
- EGL10.EGL_NATIVE_VISUAL_TYPE,
- 0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
- EGL10.EGL_SAMPLES,
- EGL10.EGL_SAMPLE_BUFFERS,
- EGL10.EGL_SURFACE_TYPE,
- EGL10.EGL_TRANSPARENT_TYPE,
- EGL10.EGL_TRANSPARENT_RED_VALUE,
- EGL10.EGL_TRANSPARENT_GREEN_VALUE,
- EGL10.EGL_TRANSPARENT_BLUE_VALUE,
- 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
- 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
- 0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
- 0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
- EGL10.EGL_LUMINANCE_SIZE,
- EGL10.EGL_ALPHA_MASK_SIZE,
- EGL10.EGL_COLOR_BUFFER_TYPE,
- EGL10.EGL_RENDERABLE_TYPE,
- 0x3042 // EGL10.EGL_CONFORMANT
- };
- String[] names = {
- "EGL_BUFFER_SIZE",
- "EGL_ALPHA_SIZE",
- "EGL_BLUE_SIZE",
- "EGL_GREEN_SIZE",
- "EGL_RED_SIZE",
- "EGL_DEPTH_SIZE",
- "EGL_STENCIL_SIZE",
- "EGL_CONFIG_CAVEAT",
- "EGL_CONFIG_ID",
- "EGL_LEVEL",
- "EGL_MAX_PBUFFER_HEIGHT",
- "EGL_MAX_PBUFFER_PIXELS",
- "EGL_MAX_PBUFFER_WIDTH",
- "EGL_NATIVE_RENDERABLE",
- "EGL_NATIVE_VISUAL_ID",
- "EGL_NATIVE_VISUAL_TYPE",
- "EGL_PRESERVED_RESOURCES",
- "EGL_SAMPLES",
- "EGL_SAMPLE_BUFFERS",
- "EGL_SURFACE_TYPE",
- "EGL_TRANSPARENT_TYPE",
- "EGL_TRANSPARENT_RED_VALUE",
- "EGL_TRANSPARENT_GREEN_VALUE",
- "EGL_TRANSPARENT_BLUE_VALUE",
- "EGL_BIND_TO_TEXTURE_RGB",
- "EGL_BIND_TO_TEXTURE_RGBA",
- "EGL_MIN_SWAP_INTERVAL",
- "EGL_MAX_SWAP_INTERVAL",
- "EGL_LUMINANCE_SIZE",
- "EGL_ALPHA_MASK_SIZE",
- "EGL_COLOR_BUFFER_TYPE",
- "EGL_RENDERABLE_TYPE",
- "EGL_CONFORMANT"
- };
- int[] value = new int[1];
- for (int i = 0; i < attributes.length; i++) {
- int attribute = attributes[i];
- String name = names[i];
- if ( egl.eglGetConfigAttrib(display, config, attribute, value)) {
- Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
- } else {
- // Log.w(TAG, String.format(" %s: failed\n", name));
- while (egl.eglGetError() != EGL10.EGL_SUCCESS);
- }
- }
- }
-
- // Subclasses can adjust these values:
- protected int mRedSize;
- protected int mGreenSize;
- protected int mBlueSize;
- protected int mAlphaSize;
- protected int mDepthSize;
- protected int mStencilSize;
- private int[] mValue = new int[1];
- }
-
- private static class Renderer implements GLSurfaceView.Renderer {
- public void onDrawFrame(GL10 gl) {
- GLDualLib.step();
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GLDualLib.init(width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing.
- }
- }
-}
-
diff --git a/opengl/tests/gldual/src/com/android/gldual/GLDualLib.java b/opengl/tests/gldual/src/com/android/gldual/GLDualLib.java
deleted file mode 100644
index d8f765e..0000000
--- a/opengl/tests/gldual/src/com/android/gldual/GLDualLib.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gldual;
-
-// Wrapper for native library
-
-public class GLDualLib {
-
- static {
- System.loadLibrary("gldualjni");
- }
-
- /**
- * @param width the current view width
- * @param height the current view height
- */
- public static native void init(int width, int height);
- public static native void step();
-}
diff --git a/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java b/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java
deleted file mode 100644
index a082d47..0000000
--- a/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.gldual;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-import java.nio.ShortBuffer;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.opengl.GLSurfaceView;
-import android.opengl.GLU;
-import android.os.SystemClock;
-
-public class TriangleRenderer implements GLSurfaceView.Renderer{
-
- public TriangleRenderer() {
- mTriangle = new Triangle();
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- /*
- * By default, OpenGL enables features that improve quality
- * but reduce performance. One might want to tweak that
- * especially on software renderer.
- */
- gl.glDisable(GL10.GL_DITHER);
-
- /*
- * Some one-time OpenGL initialization can be made here
- * probably based on features of this particular context
- */
- gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
- GL10.GL_FASTEST);
-
- gl.glClearColor(.5f, .5f, .5f, 1);
- gl.glShadeModel(GL10.GL_SMOOTH);
- }
-
- public void onDrawFrame(GL10 gl) {
- /*
- * By default, OpenGL enables features that improve quality
- * but reduce performance. One might want to tweak that
- * especially on software renderer.
- */
- gl.glDisable(GL10.GL_DITHER);
-
- /*
- * Usually, the first thing one might want to do is to clear
- * the screen. The most efficient way of doing this is to use
- * glClear().
- */
-
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
-
- /*
- * Now we're ready to draw some 3D objects
- */
-
- gl.glMatrixMode(GL10.GL_MODELVIEW);
- gl.glLoadIdentity();
-
- GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
-
- gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
-
- long time = SystemClock.uptimeMillis() % 4000L;
- float angle = 0.090f * ((int) time);
-
- gl.glRotatef(angle, 0, 0, 1.0f);
-
- mTriangle.draw(gl);
- }
-
- public void onSurfaceChanged(GL10 gl, int w, int h) {
- gl.glViewport(0, 0, w, h);
-
- /*
- * Set our projection matrix. This doesn't have to be done
- * each time we draw, but usually a new projection needs to
- * be set when the viewport is resized.
- */
-
- float ratio = (float) w / h;
- gl.glMatrixMode(GL10.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);
-
- }
-
- private Triangle mTriangle;
-}
-
-class Triangle {
- public Triangle() {
-
- // Buffers to be passed to gl*Pointer() functions
- // must be direct, i.e., they must be placed on the
- // native heap where the garbage collector cannot
- // move them.
- //
- // Buffers with multi-byte datatypes (e.g., short, int, float)
- // must have their byte order set to native order
-
- ByteBuffer vbb = ByteBuffer.allocateDirect(VERTS * 3 * 4);
- vbb.order(ByteOrder.nativeOrder());
- mFVertexBuffer = vbb.asFloatBuffer();
-
- ByteBuffer tbb = ByteBuffer.allocateDirect(VERTS * 2 * 4);
- tbb.order(ByteOrder.nativeOrder());
-
- ByteBuffer ibb = ByteBuffer.allocateDirect(VERTS * 2);
- ibb.order(ByteOrder.nativeOrder());
- mIndexBuffer = ibb.asShortBuffer();
-
- // A unit-sided equalateral triangle centered on the origin.
- float[] coords = {
- // X, Y, Z
- -0.5f, -0.25f, 0,
- 0.5f, -0.25f, 0,
- 0.0f, 0.559016994f, 0
- };
-
- for (int i = 0; i < VERTS; i++) {
- for(int j = 0; j < 3; j++) {
- mFVertexBuffer.put(coords[i*3+j] * 2.0f);
- }
- }
-
- for(int i = 0; i < VERTS; i++) {
- mIndexBuffer.put((short) i);
- }
-
- mFVertexBuffer.position(0);
- mIndexBuffer.position(0);
- }
-
- public void draw(GL10 gl) {
- gl.glFrontFace(GL10.GL_CCW);
- gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
- gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, VERTS,
- GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
- }
-
- private final static int VERTS = 3;
-
- private FloatBuffer mFVertexBuffer;
- private ShortBuffer mIndexBuffer;
-}
diff --git a/opengl/tests/gralloc/Android.mk b/opengl/tests/gralloc/Android.mk
deleted file mode 100644
index d43c39a..0000000
--- a/opengl/tests/gralloc/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gralloc.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui
-
-LOCAL_MODULE:= test-opengl-gralloc
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gralloc/gralloc.cpp b/opengl/tests/gralloc/gralloc.cpp
deleted file mode 100644
index 8987040..0000000
--- a/opengl/tests/gralloc/gralloc.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- **
- ** Copyright 2009, The Android Open Source Project
- **
- ** 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.
- */
-
-#define LOG_TAG "StopWatch"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <utils/StopWatch.h>
-#include <utils/Log.h>
-
-#include <ui/GraphicBuffer.h>
-#include <ui/GraphicBufferMapper.h>
-
-using namespace android;
-
-void* lamecpy(void* d, void const* s, size_t size) {
- char* dst = (char*)d;
- char const* src = (char const*)s;
- while (size) {
- *dst++ = *src++;
- size--;
- }
- return d;
-}
-
-int main(int argc, char** argv)
-{
- size_t size = 128*256*4;
- void* temp = malloc(size);
- void* temp2 = malloc(size);
- memset(temp, 0, size);
- memset(temp2, 0, size);
-
-
- sp<GraphicBuffer> buffer = new GraphicBuffer(128, 256, HAL_PIXEL_FORMAT_RGBA_8888,
- GRALLOC_USAGE_SW_READ_OFTEN |
- GRALLOC_USAGE_SW_WRITE_OFTEN);
-
- status_t err = buffer->initCheck();
- if (err != NO_ERROR) {
- printf("%s\n", strerror(-err));
- return 0;
- }
-
- void* vaddr;
- buffer->lock(
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
- &vaddr);
-
- {
- StopWatch watch("memset");
- for (int i=0 ; i<10 ; i++)
- memset(vaddr, 0, size);
- }
-
- {
- StopWatch watch("memcpy baseline");
- for (int i=0 ; i<10 ; i++)
- memcpy(temp, temp2, size);
- }
-
- {
- StopWatch watch("memcpy from gralloc");
- for (int i=0 ; i<10 ; i++)
- memcpy(temp, vaddr, size);
- }
-
- {
- StopWatch watch("memcpy into gralloc");
- for (int i=0 ; i<10 ; i++)
- memcpy(vaddr, temp, size);
- }
-
-
- {
- StopWatch watch("lamecpy baseline");
- for (int i=0 ; i<10 ; i++)
- lamecpy(temp, temp2, size);
- }
-
- {
- StopWatch watch("lamecpy from gralloc");
- for (int i=0 ; i<10 ; i++)
- lamecpy(temp, vaddr, size);
- }
-
- {
- StopWatch watch("lamecpy into gralloc");
- for (int i=0 ; i<10 ; i++)
- lamecpy(vaddr, temp, size);
- }
-
- buffer->unlock();
-
- return 0;
-}
diff --git a/opengl/tests/hwc/Android.mk b/opengl/tests/hwc/Android.mk
deleted file mode 100644
index 9eb58b1..0000000
--- a/opengl/tests/hwc/Android.mk
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright (C) 2010 The Android Open Source Project
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE:= libhwcTest
-LOCAL_SRC_FILES:= hwcTestLib.cpp
-LOCAL_C_INCLUDES += system/extras/tests/include \
- bionic \
- bionic/libstdc++/include \
- external/stlport/stlport \
- $(call include-path-for, opengl-tests-includes)
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport
-LOCAL_STATIC_LIBRARIES += libglTest
-
-
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= hwcStress.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui \
- libhardware \
-
-LOCAL_STATIC_LIBRARIES := \
- libtestUtil \
- libglTest \
- libhwcTest \
-
-LOCAL_C_INCLUDES += \
- system/extras/tests/include \
- hardware/libhardware/include \
- $(call include-path-for, opengl-tests-includes)
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-LOCAL_MODULE:= hwcStress
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativestresstest
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_NATIVE_TEST)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= hwcRects.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui \
- libhardware \
-
-LOCAL_STATIC_LIBRARIES := \
- libtestUtil \
- libglTest \
- libhwcTest \
-
-LOCAL_C_INCLUDES += \
- system/extras/tests/include \
- hardware/libhardware/include \
- $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= hwcRects
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativeutil
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_NATIVE_TEST)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= hwcColorEquiv.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui \
- libhardware \
-
-LOCAL_STATIC_LIBRARIES := \
- libtestUtil \
- libglTest \
- libhwcTest \
-
-LOCAL_C_INCLUDES += \
- system/extras/tests/include \
- hardware/libhardware/include \
- $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= hwcColorEquiv
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativeutil
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_NATIVE_TEST)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= hwcCommit.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui \
- libhardware \
-
-LOCAL_STATIC_LIBRARIES := \
- libtestUtil \
- libglTest \
- libhwcTest \
-
-LOCAL_C_INCLUDES += \
- system/extras/tests/include \
- hardware/libhardware/include \
- $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= hwcCommit
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativebenchmark
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_NATIVE_TEST)
diff --git a/opengl/tests/hwc/hwcColorEquiv.cpp b/opengl/tests/hwc/hwcColorEquiv.cpp
deleted file mode 100644
index bb305dc..0000000
--- a/opengl/tests/hwc/hwcColorEquiv.cpp
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Hardware Composer Color Equivalence
- *
- * Synopsis
- * hwc_colorequiv [options] eFmt
- *
- * options:
- -v - verbose
- * -s <0.##, 0.##, 0.##> - Start color (default: <0.0, 0.0, 0.0>
- * -e <0.##, 0.##, 0.##> - Ending color (default: <1.0, 1.0, 1.0>
- * -r fmt - reference graphic format
- * -D #.## - End of test delay
- *
- * graphic formats:
- * RGBA8888 (reference frame default)
- * RGBX8888
- * RGB888
- * RGB565
- * BGRA8888
- * RGBA5551
- * RGBA4444
- * YV12
- *
- * Description
- * Renders a horizontal blend in two frames. The first frame is rendered
- * in the upper third of the display and is called the reference frame.
- * The second frame is displayed in the middle third and is called the
- * equivalence frame. The primary purpose of this utility is to verify
- * that the colors produced in the reference and equivalence frames are
- * the same. The colors are the same when the colors are the same
- * vertically between the reference and equivalence frames.
- *
- * By default the reference frame is rendered through the use of the
- * RGBA8888 graphic format. The -r option can be used to specify a
- * non-default reference frame graphic format. The graphic format of
- * the equivalence frame is determined by a single required positional
- * parameter. Intentionally there is no default for the graphic format
- * of the equivalence frame.
- *
- * The horizontal blend in the reference frame is produced from a linear
- * interpolation from a start color (default: <0.0, 0.0, 0.0> on the left
- * side to an end color (default <1.0, 1.0, 1.0> on the right side. Where
- * possible the equivalence frame is rendered with the equivalent color
- * from the reference frame. A color of black is used in the equivalence
- * frame for cases where an equivalent color does not exist.
- */
-
-#include <algorithm>
-#include <assert.h>
-#include <cerrno>
-#include <cmath>
-#include <cstdlib>
-#include <ctime>
-#include <libgen.h>
-#include <sched.h>
-#include <sstream>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <vector>
-
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-
-#define LOG_TAG "hwcColorEquivTest"
-#include <utils/Log.h>
-#include <testUtil.h>
-
-#include <hardware/hwcomposer.h>
-
-#include "hwcTestLib.h"
-
-using namespace std;
-using namespace android;
-
-// Defaults for command-line options
-const bool defaultVerbose = false;
-const ColorFract defaultStartColor(0.0, 0.0, 0.0);
-const ColorFract defaultEndColor(1.0, 1.0, 1.0);
-const char *defaultRefFormat = "RGBA8888";
-const float defaultEndDelay = 2.0; // Default delay after rendering graphics
-
-// Defines
-#define MAXSTR 100
-#define MAXCMD 200
-#define BITSPERBYTE 8 // TODO: Obtain from <values.h>, once
- // it has been added
-
-#define CMD_STOP_FRAMEWORK "stop 2>&1"
-#define CMD_START_FRAMEWORK "start 2>&1"
-
-// Macros
-#define NUMA(a) (sizeof(a) / sizeof(a [0])) // Num elements in an array
-#define MEMCLR(addr, size) do { \
- memset((addr), 0, (size)); \
- } while (0)
-
-// Globals
-static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE |
- GraphicBuffer::USAGE_SW_WRITE_RARELY;
-static hwc_composer_device_t *hwcDevice;
-static EGLDisplay dpy;
-static EGLSurface surface;
-static EGLint width, height;
-
-// Functions prototypes
-void init(void);
-void printSyntax(const char *cmd);
-
-// Command-line option settings
-static bool verbose = defaultVerbose;
-static ColorFract startRefColor = defaultStartColor;
-static ColorFract endRefColor = defaultEndColor;
-static float endDelay = defaultEndDelay;
-static const struct hwcTestGraphicFormat *refFormat
- = hwcTestGraphicFormatLookup(defaultRefFormat);
-static const struct hwcTestGraphicFormat *equivFormat;
-
-/*
- * Main
- *
- * Performs the following high-level sequence of operations:
- *
- * 1. Command-line parsing
- *
- * 2. Stop framework
- *
- * 3. Initialization
- *
- * 4. Create Hardware Composer description of reference and equivalence frames
- *
- * 5. Have Hardware Composer render the reference and equivalence frames
- *
- * 6. Delay for amount of time given by endDelay
- *
- * 7. Start framework
- */
-int
-main(int argc, char *argv[])
-{
- int rv, opt;
- bool error;
- char *chptr;
- unsigned int pass;
- char cmd[MAXCMD];
- string str;
-
- testSetLogCatTag(LOG_TAG);
-
- assert(refFormat != NULL);
-
- testSetLogCatTag(LOG_TAG);
-
- // Parse command line arguments
- while ((opt = getopt(argc, argv, "vs:e:r:D:?h")) != -1) {
- switch (opt) {
- case 'D': // End of test delay
- // Delay between completion of final pass and restart
- // of framework
- endDelay = strtod(optarg, &chptr);
- if ((*chptr != '\0') || (endDelay < 0.0)) {
- testPrintE("Invalid command-line specified end of test delay "
- "of: %s", optarg);
- exit(1);
- }
- break;
-
- case 's': // Starting reference color
- str = optarg;
- while (optind < argc) {
- if (*argv[optind] == '-') { break; }
- char endChar = (str.length() > 1) ? str[str.length() - 1] : 0;
- if ((endChar == '>') || (endChar == ']')) { break; }
- str += " " + string(argv[optind++]);
- }
- {
- istringstream in(str);
- startRefColor = hwcTestParseColor(in, error);
- // Any parse error or characters not used by parser
- if (error
- || (((unsigned int) in.tellg() != in.str().length())
- && (in.tellg() != (streampos) -1))) {
- testPrintE("Invalid command-line specified start "
- "reference color of: %s", str.c_str());
- exit(2);
- }
- }
- break;
-
- case 'e': // Ending reference color
- str = optarg;
- while (optind < argc) {
- if (*argv[optind] == '-') { break; }
- char endChar = (str.length() > 1) ? str[str.length() - 1] : 0;
- if ((endChar == '>') || (endChar == ']')) { break; }
- str += " " + string(argv[optind++]);
- }
- {
- istringstream in(str);
- endRefColor = hwcTestParseColor(in, error);
- // Any parse error or characters not used by parser
- if (error
- || (((unsigned int) in.tellg() != in.str().length())
- && (in.tellg() != (streampos) -1))) {
- testPrintE("Invalid command-line specified end "
- "reference color of: %s", str.c_str());
- exit(3);
- }
- }
- break;
-
- case 'r': // Reference graphic format
- refFormat = hwcTestGraphicFormatLookup(optarg);
- if (refFormat == NULL) {
- testPrintE("Unkown command-line specified reference graphic "
- "format of: %s", optarg);
- printSyntax(basename(argv[0]));
- exit(4);
- }
- break;
-
- case 'v': // Verbose
- verbose = true;
- break;
-
- case 'h': // Help
- case '?':
- default:
- printSyntax(basename(argv[0]));
- exit(((optopt == 0) || (optopt == '?')) ? 0 : 5);
- }
- }
-
- // Expect a single positional parameter, which specifies the
- // equivalence graphic format.
- if (argc != (optind + 1)) {
- testPrintE("Expected a single command-line postional parameter");
- printSyntax(basename(argv[0]));
- exit(6);
- }
- equivFormat = hwcTestGraphicFormatLookup(argv[optind]);
- if (equivFormat == NULL) {
- testPrintE("Unkown command-line specified equivalence graphic "
- "format of: %s", argv[optind]);
- printSyntax(basename(argv[0]));
- exit(7);
- }
-
- testPrintI("refFormat: %u %s", refFormat->format, refFormat->desc);
- testPrintI("equivFormat: %u %s", equivFormat->format, equivFormat->desc);
- testPrintI("startRefColor: %s", ((string) startRefColor).c_str());
- testPrintI("endRefColor: %s", ((string) endRefColor).c_str());
- testPrintI("endDelay: %f", endDelay);
-
- // Stop framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_STOP_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_STOP_FRAMEWORK);
- exit(8);
- }
- testExecCmd(cmd);
- testDelay(1.0); // TODO - needs means to query whether asynchronous stop
- // framework operation has completed. For now, just wait
- // a long time.
-
- init();
-
- // Use the upper third of the display for the reference frame and
- // the middle third for the equivalence frame.
- unsigned int refHeight = height / 3;
- unsigned int refPosY = 0; // Reference frame Y position
- unsigned int refPosX = 0; // Reference frame X position
- unsigned int refWidth = width - refPosX;
- if ((refWidth & refFormat->wMod) != 0) {
- refWidth += refFormat->wMod - (refWidth % refFormat->wMod);
- }
- unsigned int equivHeight = height / 3;
- unsigned int equivPosY = refHeight; // Equivalence frame Y position
- unsigned int equivPosX = 0; // Equivalence frame X position
- unsigned int equivWidth = width - equivPosX;
- if ((equivWidth & equivFormat->wMod) != 0) {
- equivWidth += equivFormat->wMod - (equivWidth % equivFormat->wMod);
- }
-
- // Create reference and equivalence graphic buffers
- const unsigned int numFrames = 2;
- sp<GraphicBuffer> refFrame;
- refFrame = new GraphicBuffer(refWidth, refHeight,
- refFormat->format, texUsage);
- if ((rv = refFrame->initCheck()) != NO_ERROR) {
- testPrintE("refFrame initCheck failed, rv: %i", rv);
- testPrintE(" width %u height: %u format: %u %s", refWidth, refHeight,
- refFormat->format,
- hwcTestGraphicFormat2str(refFormat->format));
- exit(9);
- }
- testPrintI("refFrame width: %u height: %u format: %u %s",
- refWidth, refHeight, refFormat->format,
- hwcTestGraphicFormat2str(refFormat->format));
-
- sp<GraphicBuffer> equivFrame;
- equivFrame = new GraphicBuffer(equivWidth, equivHeight,
- equivFormat->format, texUsage);
- if ((rv = refFrame->initCheck()) != NO_ERROR) {
- testPrintE("refFrame initCheck failed, rv: %i", rv);
- testPrintE(" width %u height: %u format: %u %s", refWidth, refHeight,
- refFormat->format,
- hwcTestGraphicFormat2str(refFormat->format));
- exit(10);
- }
- testPrintI("equivFrame width: %u height: %u format: %u %s",
- equivWidth, equivHeight, equivFormat->format,
- hwcTestGraphicFormat2str(equivFormat->format));
-
- // Fill the frames with a horizontal blend
- hwcTestFillColorHBlend(refFrame.get(), refFormat->format,
- startRefColor, endRefColor);
- hwcTestFillColorHBlend(equivFrame.get(), refFormat->format,
- startRefColor, endRefColor);
-
- hwc_layer_list_t *list;
- size_t size = sizeof(hwc_layer_list) + numFrames * sizeof(hwc_layer_t);
- if ((list = (hwc_layer_list_t *) calloc(1, size)) == NULL) {
- testPrintE("Allocate list failed");
- exit(11);
- }
- list->flags = HWC_GEOMETRY_CHANGED;
- list->numHwLayers = numFrames;
-
- hwc_layer_t *layer = &list->hwLayers[0];
- layer->handle = refFrame->handle;
- layer->blending = HWC_BLENDING_NONE;
- layer->sourceCrop.left = 0;
- layer->sourceCrop.top = 0;
- layer->sourceCrop.right = width;
- layer->sourceCrop.bottom = refHeight;
- layer->displayFrame.left = 0;
- layer->displayFrame.top = 0;
- layer->displayFrame.right = width;
- layer->displayFrame.bottom = refHeight;
- layer->visibleRegionScreen.numRects = 1;
- layer->visibleRegionScreen.rects = &layer->displayFrame;
-
- layer++;
- layer->handle = equivFrame->handle;
- layer->blending = HWC_BLENDING_NONE;
- layer->sourceCrop.left = 0;
- layer->sourceCrop.top = 0;
- layer->sourceCrop.right = width;
- layer->sourceCrop.bottom = equivHeight;
- layer->displayFrame.left = 0;
- layer->displayFrame.top = refHeight;
- layer->displayFrame.right = width;
- layer->displayFrame.bottom = layer->displayFrame.top + equivHeight;
- layer->visibleRegionScreen.numRects = 1;
- layer->visibleRegionScreen.rects = &layer->displayFrame;
-
- // Perform prepare operation
- if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); }
- hwcDevice->prepare(hwcDevice, list);
- if (verbose) {
- testPrintI("Post Prepare:");
- hwcTestDisplayListPrepareModifiable(list);
- }
-
- // Turn off the geometry changed flag
- list->flags &= ~HWC_GEOMETRY_CHANGED;
-
- if (verbose) {hwcTestDisplayListHandles(list); }
- hwcDevice->set(hwcDevice, dpy, surface, list);
-
- testDelay(endDelay);
-
- // Start framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_START_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_START_FRAMEWORK);
- exit(12);
- }
- testExecCmd(cmd);
-
- return 0;
-}
-
-void init(void)
-{
- // Seed pseudo random number generator
- // Seeding causes fill horizontal blend to fill the pad area with
- // a deterministic set of values.
- srand48(0);
-
- hwcTestInitDisplay(verbose, &dpy, &surface, &width, &height);
-
- hwcTestOpenHwc(&hwcDevice);
-}
-
-void printSyntax(const char *cmd)
-{
- testPrintE(" %s [options] graphicFormat", cmd);
- testPrintE(" options:");
- testPrintE(" -s <0.##, 0.##, 0.##> - Starting reference color");
- testPrintE(" -e <0.##, 0.##, 0.##> - Ending reference color");
- testPrintE(" -r format - Reference graphic format");
- testPrintE(" -D #.## - End of test delay");
- testPrintE(" -v Verbose");
- testPrintE("");
- testPrintE(" graphic formats:");
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- testPrintE(" %s", hwcTestGraphicFormat[n1].desc);
- }
-}
diff --git a/opengl/tests/hwc/hwcCommit.cpp b/opengl/tests/hwc/hwcCommit.cpp
deleted file mode 100644
index efa646c..0000000
--- a/opengl/tests/hwc/hwcCommit.cpp
+++ /dev/null
@@ -1,1561 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Hardware Composer Commit Points
- *
- * Synopsis
- * hwcCommit [options] graphicFormat ...
- * options:
- * -s [width, height] - Starting dimension
- * -v - Verbose
- *
- * graphic formats:
- * RGBA8888 (reference frame default)
- * RGBX8888
- * RGB888
- * RGB565
- * BGRA8888
- * RGBA5551
- * RGBA4444
- * YV12
- *
- * Description
- * The Hardware Composer (HWC) Commit test is a benchmark that
- * discovers the points at which the HWC will commit to rendering an
- * overlay(s). Before rendering a set of overlays, the HWC is shown
- * the list through a prepare call. During the prepare call the HWC
- * is able to examine the list and specify which overlays it is able
- * to handle. The overlays that it can't handle are typically composited
- * by a higher level (e.g. Surface Flinger) and then the original list
- * plus a composit of what HWC passed on are provided back to the HWC
- * for rendering.
- *
- * Once an implementation of the HWC has been shipped, a regression would
- * likely occur if a latter implementation started passing on conditions
- * that it used to commit to. The primary purpose of this benchmark
- * is the automated discovery of the commit points, where an implementation
- * is on the edge between committing and not committing. These are commonly
- * referred to as commit points. Between implementations changes to the
- * commit points are allowed, as long as they improve what the HWC commits
- * to. Once an implementation of the HWC is shipped, the commit points are
- * not allowed to regress in future implementations.
- *
- * This benchmark takes a sampling and then adjusts until it finds a
- * commit point. It doesn't exhaustively check all possible conditions,
- * which do to the number of combinations would be impossible. Instead
- * it starts its search from a starting dimension, that can be changed
- * via the -s option. The search is also bounded by a set of search
- * limits, that are hard-coded into a structure of constants named
- * searchLimits. Results that happen to reach a searchLimit are prefixed
- * with >=, so that it is known that the value could possibly be larger.
- *
- * Measurements are made for each of the graphic formats specified as
- * positional parameters on the command-line. If no graphic formats
- * are specified on the command line, then by default measurements are
- * made and reported for each of the known graphic format.
- */
-
-#include <algorithm>
-#include <assert.h>
-#include <cerrno>
-#include <cmath>
-#include <cstdlib>
-#include <ctime>
-#include <iomanip>
-#include <istream>
-#include <libgen.h>
-#include <list>
-#include <sched.h>
-#include <sstream>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <vector>
-
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-
-#define LOG_TAG "hwcCommitTest"
-#include <utils/Log.h>
-#include <testUtil.h>
-
-#include <hardware/hwcomposer.h>
-
-#include <glTestLib.h>
-#include "hwcTestLib.h"
-
-using namespace std;
-using namespace android;
-
-// Defaults
-const HwcTestDim defaultStartDim = HwcTestDim(100, 100);
-const bool defaultVerbose = false;
-
-const uint32_t defaultFormat = HAL_PIXEL_FORMAT_RGBA_8888;
-const int32_t defaultTransform = 0;
-const uint32_t defaultBlend = HWC_BLENDING_NONE;
-const ColorFract defaultColor(0.5, 0.5, 0.5);
-const float defaultAlpha = 1.0; // Opaque
-const HwcTestDim defaultSourceDim(1, 1);
-const struct hwc_rect defaultSourceCrop = {0, 0, 1, 1};
-const struct hwc_rect defaultDisplayFrame = {0, 0, 100, 100};
-
-// Global Constants
-const uint32_t printFieldWidth = 2;
-const struct searchLimits {
- uint32_t numOverlays;
- HwcTestDim sourceCrop;
-} searchLimits = {
- 10,
- HwcTestDim(3000, 2000),
-};
-const struct transformType {
- const char *desc;
- uint32_t id;
-} transformType[] = {
- {"fliph", HWC_TRANSFORM_FLIP_H},
- {"flipv", HWC_TRANSFORM_FLIP_V},
- {"rot90", HWC_TRANSFORM_ROT_90},
- {"rot180", HWC_TRANSFORM_ROT_180},
- {"rot270", HWC_TRANSFORM_ROT_270},
-};
-const struct blendType {
- const char *desc;
- uint32_t id;
-} blendType[] = {
- {"none", HWC_BLENDING_NONE},
- {"premult", HWC_BLENDING_PREMULT},
- {"coverage", HWC_BLENDING_COVERAGE},
-};
-
-// Defines
-#define MAXCMD 200
-#define CMD_STOP_FRAMEWORK "stop 2>&1"
-#define CMD_START_FRAMEWORK "start 2>&1"
-
-// Macros
-#define NUMA(a) (sizeof(a) / sizeof(a [0])) // Num elements in an array
-
-// Local types
-class Rectangle {
-public:
- Rectangle(uint32_t graphicFormat = defaultFormat,
- HwcTestDim dfDim = HwcTestDim(1, 1),
- HwcTestDim sDim = HwcTestDim(1, 1));
- void setSourceDim(HwcTestDim dim);
-
- uint32_t format;
- uint32_t transform;
- int32_t blend;
- ColorFract color;
- float alpha;
- HwcTestDim sourceDim;
- struct hwc_rect sourceCrop;
- struct hwc_rect displayFrame;
-};
-
-class Range {
-public:
- Range(void) : _l(0), _u(0) {}
- Range(uint32_t lower, uint32_t upper) : _l(lower), _u(upper) {}
- uint32_t lower(void) { return _l; }
- uint32_t upper(void) { return _u; }
-
- operator string();
-
-private:
- uint32_t _l; // lower
- uint32_t _u; // upper
-};
-
-Range::operator string()
-{
- ostringstream out;
-
- out << '[' << _l << ", " << _u << ']';
-
- return out.str();
-}
-
-class Rational {
-public:
- Rational(void) : _n(0), _d(1) {}
- Rational(uint32_t n, uint32_t d) : _n(n), _d(d) {}
- uint32_t numerator(void) { return _n; }
- uint32_t denominator(void) { return _d; }
- void setNumerator(uint32_t numerator) { _n = numerator; }
-
- bool operator==(const Rational& other) const;
- bool operator!=(const Rational& other) const { return !(*this == other); }
- bool operator<(const Rational& other) const;
- bool operator>(const Rational& other) const {
- return (!(*this == other) && !(*this < other));
- }
- static void double2Rational(double f, Range nRange, Range dRange,
- Rational& lower, Rational& upper);
-
- operator string() const;
- operator double() const { return (double) _n / (double) _d; }
-
-
-private:
- uint32_t _n;
- uint32_t _d;
-};
-
-// Globals
-static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE |
- GraphicBuffer::USAGE_SW_WRITE_RARELY;
-static hwc_composer_device_t *hwcDevice;
-static EGLDisplay dpy;
-static EGLSurface surface;
-static EGLint width, height;
-static size_t maxHeadingLen;
-static vector<string> formats;
-
-// Measurements
-struct meas {
- uint32_t format;
- uint32_t startDimOverlays;
- uint32_t maxNonOverlapping;
- uint32_t maxOverlapping;
- list<uint32_t> transforms;
- list<uint32_t> blends;
- struct displayFrame {
- uint32_t minWidth;
- uint32_t minHeight;
- HwcTestDim minDim;
- uint32_t maxWidth;
- uint32_t maxHeight;
- HwcTestDim maxDim;
- } df;
- struct sourceCrop {
- uint32_t minWidth;
- uint32_t minHeight;
- HwcTestDim minDim;
- uint32_t maxWidth;
- uint32_t maxHeight;
- HwcTestDim maxDim;
- Rational hScale;
- HwcTestDim hScaleBestDf;
- HwcTestDim hScaleBestSc;
- Rational vScale;
- HwcTestDim vScaleBestDf;
- HwcTestDim vScaleBestSc;
- } sc;
- vector<uint32_t> overlapBlendNone;
- vector<uint32_t> overlapBlendPremult;
- vector<uint32_t> overlapBlendCoverage;
-};
-vector<meas> measurements;
-
-// Function prototypes
-uint32_t numOverlays(list<Rectangle>& rectList);
-uint32_t maxOverlays(uint32_t format, bool allowOverlap);
-list<uint32_t> supportedTransforms(uint32_t format);
-list<uint32_t> supportedBlends(uint32_t format);
-uint32_t dfMinWidth(uint32_t format);
-uint32_t dfMinHeight(uint32_t format);
-uint32_t dfMaxWidth(uint32_t format);
-uint32_t dfMaxHeight(uint32_t format);
-HwcTestDim dfMinDim(uint32_t format);
-HwcTestDim dfMaxDim(uint32_t format);
-uint32_t scMinWidth(uint32_t format, const HwcTestDim& dfDim);
-uint32_t scMinHeight(uint32_t format, const HwcTestDim& dfDim);
-uint32_t scMaxWidth(uint32_t format, const HwcTestDim& dfDim);
-uint32_t scMaxHeight(uint32_t format, const HwcTestDim& dfDim);
-HwcTestDim scMinDim(uint32_t format, const HwcTestDim& dfDim);
-HwcTestDim scMaxDim(uint32_t format, const HwcTestDim& dfDim);
-Rational scHScale(uint32_t format,
- const HwcTestDim& dfMin, const HwcTestDim& dfMax,
- const HwcTestDim& scMin, const HwcTestDim& scMax,
- HwcTestDim& outBestDf, HwcTestDim& outBestSc);
-Rational scVScale(uint32_t format,
- const HwcTestDim& dfMin, const HwcTestDim& dfMax,
- const HwcTestDim& scMin, const HwcTestDim& scMax,
- HwcTestDim& outBestDf, HwcTestDim& outBestSc);
-uint32_t numOverlapping(uint32_t backgroundFormat, uint32_t foregroundFormat,
- uint32_t backgroundBlend, uint32_t foregroundBlend);
-string transformList2str(const list<uint32_t>& transformList);
-string blendList2str(const list<uint32_t>& blendList);
-void init(void);
-void printFormatHeadings(size_t indent);
-void printOverlapLine(size_t indent, const string formatStr,
- const vector<uint32_t>& results);
-void printSyntax(const char *cmd);
-
-// Command-line option settings
-static bool verbose = defaultVerbose;
-static HwcTestDim startDim = defaultStartDim;
-
-/*
- * Main
- *
- * Performs the following high-level sequence of operations:
- *
- * 1. Command-line parsing
- *
- * 2. Form a list of command-line specified graphic formats. If
- * no formats are specified, then form a list of all known formats.
- *
- * 3. Stop framework
- * Only one user at a time is allowed to use the HWC. Surface
- * Flinger uses the HWC and is part of the framework. Need to
- * stop the framework so that Surface Flinger will stop using
- * the HWC.
- *
- * 4. Initialization
- *
- * 5. For each graphic format in the previously formed list perform
- * measurements on that format and report the results.
- *
- * 6. Start framework
- */
-int
-main(int argc, char *argv[])
-{
- int rv, opt;
- char *chptr;
- bool error;
- string str;
- char cmd[MAXCMD];
- list<Rectangle> rectList;
-
- testSetLogCatTag(LOG_TAG);
-
- // Parse command line arguments
- while ((opt = getopt(argc, argv, "s:v?h")) != -1) {
- switch (opt) {
-
- case 's': // Start Dimension
- // Use arguments until next starts with a dash
- // or current ends with a > or ]
- str = optarg;
- while (optind < argc) {
- if (*argv[optind] == '-') { break; }
- char endChar = (str.length() > 1) ? str[str.length() - 1] : 0;
- if ((endChar == '>') || (endChar == ']')) { break; }
- str += " " + string(argv[optind++]);
- }
- {
- istringstream in(str);
- startDim = hwcTestParseDim(in, error);
- // Any parse error or characters not used by parser
- if (error
- || (((unsigned int) in.tellg() != in.str().length())
- && (in.tellg() != (streampos) -1))) {
- testPrintE("Invalid command-line specified start "
- "dimension of: %s", str.c_str());
- exit(8);
- }
- }
- break;
-
- case 'v': // Verbose
- verbose = true;
- break;
-
- case 'h': // Help
- case '?':
- default:
- printSyntax(basename(argv[0]));
- exit(((optopt == 0) || (optopt == '?')) ? 0 : 11);
- }
- }
-
- // Positional parameters
- // Positional parameters provide the names of graphic formats that
- // measurements are to be made on. Measurements are made on all
- // known graphic formats when no positional parameters are provided.
- if (optind == argc) {
- // No command-line specified graphic formats
- // Add all graphic formats to the list of formats to be measured
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- formats.push_back(hwcTestGraphicFormat[n1].desc);
- }
- } else {
- // Add names of command-line specified graphic formats to the
- // list of formats to be tested
- for (; argv[optind] != NULL; optind++) {
- formats.push_back(argv[optind]);
- }
- }
-
- // Determine length of longest specified graphic format.
- // This value is used for output formating
- for (vector<string>::iterator it = formats.begin();
- it != formats.end(); ++it) {
- maxHeadingLen = max(maxHeadingLen, it->length());
- }
-
- // Stop framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_STOP_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_STOP_FRAMEWORK);
- exit(14);
- }
- testExecCmd(cmd);
- testDelay(1.0); // TODO - needs means to query whether asynchronous stop
- // framework operation has completed. For now, just wait
- // a long time.
-
- testPrintI("startDim: %s", ((string) startDim).c_str());
-
- init();
-
- // For each of the graphic formats
- for (vector<string>::iterator itFormat = formats.begin();
- itFormat != formats.end(); ++itFormat) {
-
- // Locate hwcTestLib structure that describes this format
- const struct hwcTestGraphicFormat *format;
- format = hwcTestGraphicFormatLookup((*itFormat).c_str());
- if (format == NULL) {
- testPrintE("Unknown graphic format of: %s", (*itFormat).c_str());
- exit(1);
- }
-
- // Display format header
- testPrintI("format: %s", format->desc);
-
- // Create area to hold the measurements
- struct meas meas;
- struct meas *measPtr;
- meas.format = format->format;
- measurements.push_back(meas);
- measPtr = &measurements[measurements.size() - 1];
-
- // Start dimension num overlays
- Rectangle rect(format->format, startDim);
- rectList.clear();
- rectList.push_back(rect);
- measPtr->startDimOverlays = numOverlays(rectList);
- testPrintI(" startDimOverlays: %u", measPtr->startDimOverlays);
-
- // Skip the rest of the measurements, when the start dimension
- // doesn't produce an overlay
- if (measPtr->startDimOverlays == 0) { continue; }
-
- // Max Overlays
- measPtr->maxNonOverlapping = maxOverlays(format->format, false);
- testPrintI(" max nonOverlapping overlays: %s%u",
- (measPtr->maxNonOverlapping == searchLimits.numOverlays)
- ? ">= " : "",
- measPtr->maxNonOverlapping);
- measPtr->maxOverlapping = maxOverlays(format->format, true);
- testPrintI(" max Overlapping overlays: %s%u",
- (measPtr->maxOverlapping == searchLimits.numOverlays)
- ? ">= " : "",
- measPtr->maxOverlapping);
-
- // Transforms and blends
- measPtr->transforms = supportedTransforms(format->format);
- testPrintI(" transforms: %s",
- transformList2str(measPtr->transforms).c_str());
- measPtr->blends = supportedBlends(format->format);
- testPrintI(" blends: %s",
- blendList2str(measPtr->blends).c_str());
-
- // Display frame measurements
- measPtr->df.minWidth = dfMinWidth(format->format);
- testPrintI(" dfMinWidth: %u", measPtr->df.minWidth);
-
- measPtr->df.minHeight = dfMinHeight(format->format);
- testPrintI(" dfMinHeight: %u", measPtr->df.minHeight);
-
- measPtr->df.maxWidth = dfMaxWidth(format->format);
- testPrintI(" dfMaxWidth: %u", measPtr->df.maxWidth);
-
- measPtr->df.maxHeight = dfMaxHeight(format->format);
- testPrintI(" dfMaxHeight: %u", measPtr->df.maxHeight);
-
- measPtr->df.minDim = dfMinDim(format->format);
- testPrintI(" dfMinDim: %s", ((string) measPtr->df.minDim).c_str());
-
- measPtr->df.maxDim = dfMaxDim(format->format);
- testPrintI(" dfMaxDim: %s", ((string) measPtr->df.maxDim).c_str());
-
- // Source crop measurements
- measPtr->sc.minWidth = scMinWidth(format->format, measPtr->df.minDim);
- testPrintI(" scMinWidth: %u", measPtr->sc.minWidth);
-
- measPtr->sc.minHeight = scMinHeight(format->format, measPtr->df.minDim);
- testPrintI(" scMinHeight: %u", measPtr->sc.minHeight);
-
- measPtr->sc.maxWidth = scMaxWidth(format->format, measPtr->df.maxDim);
- testPrintI(" scMaxWidth: %s%u", (measPtr->sc.maxWidth
- == searchLimits.sourceCrop.width()) ? ">= " : "",
- measPtr->sc.maxWidth);
-
- measPtr->sc.maxHeight = scMaxHeight(format->format, measPtr->df.maxDim);
- testPrintI(" scMaxHeight: %s%u", (measPtr->sc.maxHeight
- == searchLimits.sourceCrop.height()) ? ">= " : "",
- measPtr->sc.maxHeight);
-
- measPtr->sc.minDim = scMinDim(format->format, measPtr->df.minDim);
- testPrintI(" scMinDim: %s", ((string) measPtr->sc.minDim).c_str());
-
- measPtr->sc.maxDim = scMaxDim(format->format, measPtr->df.maxDim);
- testPrintI(" scMaxDim: %s%s", ((measPtr->sc.maxDim.width()
- >= searchLimits.sourceCrop.width())
- || (measPtr->sc.maxDim.width() >=
- searchLimits.sourceCrop.height())) ? ">= " : "",
- ((string) measPtr->sc.maxDim).c_str());
-
- measPtr->sc.hScale = scHScale(format->format,
- measPtr->df.minDim, measPtr->df.maxDim,
- measPtr->sc.minDim, measPtr->sc.maxDim,
- measPtr->sc.hScaleBestDf,
- measPtr->sc.hScaleBestSc);
- testPrintI(" scHScale: %s%f",
- (measPtr->sc.hScale
- >= Rational(searchLimits.sourceCrop.width(),
- measPtr->df.minDim.width())) ? ">= " : "",
- (double) measPtr->sc.hScale);
- testPrintI(" HScale Best Display Frame: %s",
- ((string) measPtr->sc.hScaleBestDf).c_str());
- testPrintI(" HScale Best Source Crop: %s",
- ((string) measPtr->sc.hScaleBestSc).c_str());
-
- measPtr->sc.vScale = scVScale(format->format,
- measPtr->df.minDim, measPtr->df.maxDim,
- measPtr->sc.minDim, measPtr->sc.maxDim,
- measPtr->sc.vScaleBestDf,
- measPtr->sc.vScaleBestSc);
- testPrintI(" scVScale: %s%f",
- (measPtr->sc.vScale
- >= Rational(searchLimits.sourceCrop.height(),
- measPtr->df.minDim.height())) ? ">= " : "",
- (double) measPtr->sc.vScale);
- testPrintI(" VScale Best Display Frame: %s",
- ((string) measPtr->sc.vScaleBestDf).c_str());
- testPrintI(" VScale Best Source Crop: %s",
- ((string) measPtr->sc.vScaleBestSc).c_str());
-
- // Overlap two graphic formats and different blends
- // Results displayed after all overlap measurments with
- // current format in the foreground
- // TODO: make measurments with background blend other than
- // none. All of these measurements are done with a
- // background blend of HWC_BLENDING_NONE, with the
- // blend type of the foregound being varied.
- uint32_t foregroundFormat = format->format;
- for (vector<string>::iterator it = formats.begin();
- it != formats.end(); ++it) {
- uint32_t num;
-
- const struct hwcTestGraphicFormat *backgroundFormatPtr
- = hwcTestGraphicFormatLookup((*it).c_str());
- uint32_t backgroundFormat = backgroundFormatPtr->format;
-
- num = numOverlapping(backgroundFormat, foregroundFormat,
- HWC_BLENDING_NONE, HWC_BLENDING_NONE);
- measPtr->overlapBlendNone.push_back(num);
-
- num = numOverlapping(backgroundFormat, foregroundFormat,
- HWC_BLENDING_NONE, HWC_BLENDING_PREMULT);
- measPtr->overlapBlendPremult.push_back(num);
-
- num = numOverlapping(backgroundFormat, foregroundFormat,
- HWC_BLENDING_NONE, HWC_BLENDING_COVERAGE);
- measPtr->overlapBlendCoverage.push_back(num);
- }
-
- }
-
- // Display overlap results
- size_t indent = 2;
- testPrintI("overlapping blend: none");
- printFormatHeadings(indent);
- for (vector<string>::iterator it = formats.begin();
- it != formats.end(); ++it) {
- printOverlapLine(indent, *it, measurements[it
- - formats.begin()].overlapBlendNone);
- }
- testPrintI("");
-
- testPrintI("overlapping blend: premult");
- printFormatHeadings(indent);
- for (vector<string>::iterator it = formats.begin();
- it != formats.end(); ++it) {
- printOverlapLine(indent, *it, measurements[it
- - formats.begin()].overlapBlendPremult);
- }
- testPrintI("");
-
- testPrintI("overlapping blend: coverage");
- printFormatHeadings(indent);
- for (vector<string>::iterator it = formats.begin();
- it != formats.end(); ++it) {
- printOverlapLine(indent, *it, measurements[it
- - formats.begin()].overlapBlendCoverage);
- }
- testPrintI("");
-
- // Start framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_START_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_START_FRAMEWORK);
- exit(21);
- }
- testExecCmd(cmd);
-
- return 0;
-}
-
-// Determine the maximum number of overlays that are all of the same format
-// that the HWC will commit to. If allowOverlap is true, then the rectangles
-// are laid out on a diagonal starting from the upper left corner. With
-// each rectangle adjust one pixel to the right and one pixel down.
-// When allowOverlap is false, the rectangles are tiled in column major
-// order. Note, column major ordering is used so that the initial rectangles
-// are all on different horizontal scan rows. It is common that hardware
-// has limits on the number of objects it can handle on any single row.
-uint32_t maxOverlays(uint32_t format, bool allowOverlap)
-{
- unsigned int max = 0;
-
- for (unsigned int numRects = 1; numRects <= searchLimits.numOverlays;
- numRects++) {
- list<Rectangle> rectList;
-
- for (unsigned int x = 0;
- (x + startDim.width()) < (unsigned int) width;
- x += (allowOverlap) ? 1 : startDim.width()) {
- for (unsigned int y = 0;
- (y + startDim.height()) < (unsigned int) height;
- y += (allowOverlap) ? 1 : startDim.height()) {
- Rectangle rect(format, startDim, startDim);
- rect.displayFrame.left = x;
- rect.displayFrame.top = y;
- rect.displayFrame.right = x + startDim.width();
- rect.displayFrame.bottom = y + startDim.height();
-
- rectList.push_back(rect);
-
- if (rectList.size() >= numRects) { break; }
- }
- if (rectList.size() >= numRects) { break; }
- }
-
- uint32_t num = numOverlays(rectList);
- if (num > max) { max = num; }
- }
-
- return max;
-}
-
-// Measures what transforms (i.e. flip horizontal, rotate 180) are
-// supported by the specified format
-list<uint32_t> supportedTransforms(uint32_t format)
-{
- list<uint32_t> rv;
- list<Rectangle> rectList;
- Rectangle rect(format, startDim);
-
- // For each of the transform types
- for (unsigned int idx = 0; idx < NUMA(transformType); idx++) {
- unsigned int id = transformType[idx].id;
-
- rect.transform = id;
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
-
- if (num == 1) {
- rv.push_back(id);
- }
- }
-
- return rv;
-}
-
-// Determines which types of blends (i.e. none, premult, coverage) are
-// supported by the specified format
-list<uint32_t> supportedBlends(uint32_t format)
-{
- list<uint32_t> rv;
- list<Rectangle> rectList;
- Rectangle rect(format, startDim);
-
- // For each of the blend types
- for (unsigned int idx = 0; idx < NUMA(blendType); idx++) {
- unsigned int id = blendType[idx].id;
-
- rect.blend = id;
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
-
- if (num == 1) {
- rv.push_back(id);
- }
- }
-
- return rv;
-}
-
-// Determines the minimum width of any display frame of the given format
-// that the HWC will commit to.
-uint32_t dfMinWidth(uint32_t format)
-{
- uint32_t w;
- list<Rectangle> rectList;
-
- for (w = 1; w <= startDim.width(); w++) {
- HwcTestDim dim(w, startDim.height());
- Rectangle rect(format, dim);
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return w;
- }
- }
- if (w > startDim.width()) {
- testPrintE("Failed to locate display frame min width");
- exit(33);
- }
-
- return w;
-}
-
-// Display frame minimum height
-uint32_t dfMinHeight(uint32_t format)
-{
- uint32_t h;
- list<Rectangle> rectList;
-
- for (h = 1; h <= startDim.height(); h++) {
- HwcTestDim dim(startDim.width(), h);
- Rectangle rect(format, dim);
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return h;
- }
- }
- if (h > startDim.height()) {
- testPrintE("Failed to locate display frame min height");
- exit(34);
- }
-
- return h;
-}
-
-// Display frame maximum width
-uint32_t dfMaxWidth(uint32_t format)
-{
- uint32_t w;
- list<Rectangle> rectList;
-
- for (w = width; w >= startDim.width(); w--) {
- HwcTestDim dim(w, startDim.height());
- Rectangle rect(format, dim);
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return w;
- }
- }
- if (w < startDim.width()) {
- testPrintE("Failed to locate display frame max width");
- exit(35);
- }
-
- return w;
-}
-
-// Display frame maximum height
-uint32_t dfMaxHeight(uint32_t format)
-{
- uint32_t h;
-
- for (h = height; h >= startDim.height(); h--) {
- HwcTestDim dim(startDim.width(), h);
- Rectangle rect(format, dim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return h;
- }
- }
- if (h < startDim.height()) {
- testPrintE("Failed to locate display frame max height");
- exit(36);
- }
-
- return h;
-}
-
-// Determine the minimum number of pixels that the HWC will ever commit to.
-// Note, this might be different that dfMinWidth * dfMinHeight, in that this
-// function adjusts both the width and height from the starting dimension.
-HwcTestDim dfMinDim(uint32_t format)
-{
- uint64_t bestMinPixels = 0;
- HwcTestDim bestDim;
- bool bestSet = false; // True when value has been assigned to
- // bestMinPixels and bestDim
-
- bool origVerbose = verbose; // Temporarily turn off verbose
- verbose = false;
- for (uint32_t w = 1; w <= startDim.width(); w++) {
- for (uint32_t h = 1; h <= startDim.height(); h++) {
- if (bestSet && ((w > bestMinPixels) || (h > bestMinPixels))) {
- break;
- }
-
- HwcTestDim dim(w, h);
- Rectangle rect(format, dim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- uint64_t pixels = dim.width() * dim.height();
- if (!bestSet || (pixels < bestMinPixels)) {
- bestMinPixels = pixels;
- bestDim = dim;
- bestSet = true;
- }
- }
- }
- }
- verbose = origVerbose;
-
- if (!bestSet) {
- testPrintE("Unable to locate display frame min dimension");
- exit(20);
- }
-
- return bestDim;
-}
-
-// Display frame maximum dimension
-HwcTestDim dfMaxDim(uint32_t format)
-{
- uint64_t bestMaxPixels = 0;
- HwcTestDim bestDim;
- bool bestSet = false; // True when value has been assigned to
- // bestMaxPixels and bestDim;
-
- // Potentially increase benchmark performance by first checking
- // for the common case of supporting a full display frame.
- HwcTestDim dim(width, height);
- Rectangle rect(format, dim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num == 1) { return dim; }
-
- // TODO: Use a binary search
- bool origVerbose = verbose; // Temporarily turn off verbose
- verbose = false;
- for (uint32_t w = startDim.width(); w <= (uint32_t) width; w++) {
- for (uint32_t h = startDim.height(); h <= (uint32_t) height; h++) {
- if (bestSet && ((w * h) <= bestMaxPixels)) { continue; }
-
- HwcTestDim dim(w, h);
- Rectangle rect(format, dim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- uint64_t pixels = dim.width() * dim.height();
- if (!bestSet || (pixels > bestMaxPixels)) {
- bestMaxPixels = pixels;
- bestDim = dim;
- bestSet = true;
- }
- }
- }
- }
- verbose = origVerbose;
-
- if (!bestSet) {
- testPrintE("Unable to locate display frame max dimension");
- exit(21);
- }
-
- return bestDim;
-}
-
-// Source crop minimum width
-uint32_t scMinWidth(uint32_t format, const HwcTestDim& dfDim)
-{
- uint32_t w;
- list<Rectangle> rectList;
-
- // Source crop frame min width
- for (w = 1; w <= dfDim.width(); w++) {
- Rectangle rect(format, dfDim, HwcTestDim(w, dfDim.height()));
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return w;
- }
- }
- testPrintE("Failed to locate source crop min width");
- exit(35);
-}
-
-// Source crop minimum height
-uint32_t scMinHeight(uint32_t format, const HwcTestDim& dfDim)
-{
- uint32_t h;
- list<Rectangle> rectList;
-
- for (h = 1; h <= dfDim.height(); h++) {
- Rectangle rect(format, dfDim, HwcTestDim(dfDim.width(), h));
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return h;
- }
- }
- testPrintE("Failed to locate source crop min height");
- exit(36);
-}
-
-// Source crop maximum width
-uint32_t scMaxWidth(uint32_t format, const HwcTestDim& dfDim)
-{
- uint32_t w;
- list<Rectangle> rectList;
-
- for (w = searchLimits.sourceCrop.width(); w >= dfDim.width(); w--) {
- Rectangle rect(format, dfDim, HwcTestDim(w, dfDim.height()));
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return w;
- }
- }
- testPrintE("Failed to locate source crop max width");
- exit(35);
-}
-
-// Source crop maximum height
-uint32_t scMaxHeight(uint32_t format, const HwcTestDim& dfDim)
-{
- uint32_t h;
- list<Rectangle> rectList;
-
- for (h = searchLimits.sourceCrop.height(); h >= dfDim.height(); h--) {
- Rectangle rect(format, dfDim, HwcTestDim(dfDim.width(), h));
- rectList.clear();
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- return h;
- }
- }
- testPrintE("Failed to locate source crop max height");
- exit(36);
-}
-
-// Source crop minimum dimension
-// Discovers the source crop with the least number of pixels that the
-// HWC will commit to. Note, this may be different from scMinWidth
-// * scMinHeight, in that this function searches for a combination of
-// width and height. While the other routines always keep one of the
-// dimensions equal to the corresponding start dimension.
-HwcTestDim scMinDim(uint32_t format, const HwcTestDim& dfDim)
-{
- uint64_t bestMinPixels = 0;
- HwcTestDim bestDim;
- bool bestSet = false; // True when value has been assigned to
- // bestMinPixels and bestDim
-
- bool origVerbose = verbose; // Temporarily turn off verbose
- verbose = false;
- for (uint32_t w = 1; w <= dfDim.width(); w++) {
- for (uint32_t h = 1; h <= dfDim.height(); h++) {
- if (bestSet && ((w > bestMinPixels) || (h > bestMinPixels))) {
- break;
- }
-
- HwcTestDim dim(w, h);
- Rectangle rect(format, dfDim, HwcTestDim(w, h));
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- uint64_t pixels = dim.width() * dim.height();
- if (!bestSet || (pixels < bestMinPixels)) {
- bestMinPixels = pixels;
- bestDim = dim;
- bestSet = true;
- }
- }
- }
- }
- verbose = origVerbose;
-
- if (!bestSet) {
- testPrintE("Unable to locate source crop min dimension");
- exit(20);
- }
-
- return bestDim;
-}
-
-// Source crop maximum dimension
-HwcTestDim scMaxDim(uint32_t format, const HwcTestDim& dfDim)
-{
- uint64_t bestMaxPixels = 0;
- HwcTestDim bestDim;
- bool bestSet = false; // True when value has been assigned to
- // bestMaxPixels and bestDim;
-
- // Potentially increase benchmark performance by first checking
- // for the common case of supporting the maximum checked source size
- HwcTestDim dim = searchLimits.sourceCrop;
- Rectangle rect(format, dfDim, searchLimits.sourceCrop);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num == 1) { return dim; }
-
- // TODO: Use a binary search
- bool origVerbose = verbose; // Temporarily turn off verbose
- verbose = false;
- for (uint32_t w = dfDim.width();
- w <= searchLimits.sourceCrop.width(); w++) {
- for (uint32_t h = dfDim.height();
- h <= searchLimits.sourceCrop.height(); h++) {
- if (bestSet && ((w * h) <= bestMaxPixels)) { continue; }
-
- HwcTestDim dim(w, h);
- Rectangle rect(format, dfDim, dim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
- if (num > 0) {
- uint64_t pixels = dim.width() * dim.height();
- if (!bestSet || (pixels > bestMaxPixels)) {
- bestMaxPixels = pixels;
- bestDim = dim;
- bestSet = true;
- }
- }
- }
- }
- verbose = origVerbose;
-
- if (!bestSet) {
- testPrintE("Unable to locate source crop max dimension");
- exit(21);
- }
-
- return bestDim;
-}
-
-// Source crop horizontal scale
-// Determines the maximum factor by which the source crop can be larger
-// that the display frame. The commit point is discovered through a
-// binary search of rational numbers. The numerator in each of the
-// rational numbers contains the dimension for the source crop, while
-// the denominator specifies the dimension for the display frame. On
-// each pass of the binary search the mid-point between the greatest
-// point committed to (best) and the smallest point in which a commit
-// has failed is calculated. This mid-point is then passed to a function
-// named double2Rational, which determines the closest rational numbers
-// just below and above the mid-point. By default the lower rational
-// number is used for the scale factor on the next pass of the binary
-// search. The upper value is only used when best is already equal
-// to the lower value. This only occurs when the lower value has already
-// been tried.
-Rational scHScale(uint32_t format,
- const HwcTestDim& dfMin, const HwcTestDim& dfMax,
- const HwcTestDim& scMin, const HwcTestDim& scMax,
- HwcTestDim& outBestDf, HwcTestDim& outBestSc)
-{
- HwcTestDim scDim, dfDim; // Source crop and display frame dimension
- Rational best(0, 1), minBad; // Current bounds for a binary search
- // MinGood is set below the lowest
- // possible scale. The value of minBad,
- // will be set by the first pass
- // of the binary search.
-
- // Perform the passes of the binary search
- bool firstPass = true;
- do {
- // On first pass try the maximum scale within the search limits
- if (firstPass) {
- // Try the maximum possible scale, within the search limits
- scDim = HwcTestDim(searchLimits.sourceCrop.width(), scMin.height());
- dfDim = dfMin;
- } else {
- // Subsequent pass
- // Halve the difference between best and minBad.
- Rational lower, upper, selected;
-
- // Try the closest ratio halfway between minBood and minBad;
- // TODO: Avoid rounding issue by using Rational type for
- // midpoint. For now will use double, which should
- // have more than sufficient resolution.
- double mid = (double) best
- + ((double) minBad - (double) best) / 2.0;
- Rational::double2Rational(mid,
- Range(scMin.width(), scMax.width()),
- Range(dfMin.width(), dfMax.width()),
- lower, upper);
- if (((lower == best) && (upper == minBad))) {
- return best;
- }
-
- // Use lower value unless its already been tried
- selected = (lower != best) ? lower : upper;
-
- // Assign the size of the source crop and display frame
- // from the selected ratio of source crop to display frame.
- scDim = HwcTestDim(selected.numerator(), scMin.height());
- dfDim = HwcTestDim(selected.denominator(), dfMin.height());
- }
-
- // See if the HWC will commit to this combination
- Rectangle rect(format, dfDim, scDim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
-
- if (verbose) {
- testPrintI(" scHscale num: %u scale: %f dfDim: %s scDim: %s",
- num, (float) Rational(scDim.width(), dfDim.width()),
- ((string) dfDim).c_str(), ((string) scDim).c_str());
- }
- if (num == 1) {
- // HWC committed to the combination
- // This is the best scale factor seen so far. Report the
- // dimensions to the caller, in case nothing better is seen.
- outBestDf = dfDim;
- outBestSc = scDim;
-
- // Success on the first pass means the largest possible scale
- // is supported, in which case no need to search any further.
- if (firstPass) { return Rational(scDim.width(), dfDim.width()); }
-
- // Update the lower bound of the binary search
- best = Rational(scDim.width(), dfDim.width());
- } else {
- // HWC didn't commit to this combination, so update the
- // upper bound of the binary search.
- minBad = Rational(scDim.width(), dfDim.width());
- }
-
- firstPass = false;
- } while (best != minBad);
-
- return best;
-}
-
-// Source crop vertical scale
-// Determines the maximum factor by which the source crop can be larger
-// that the display frame. The commit point is discovered through a
-// binary search of rational numbers. The numerator in each of the
-// rational numbers contains the dimension for the source crop, while
-// the denominator specifies the dimension for the display frame. On
-// each pass of the binary search the mid-point between the greatest
-// point committed to (best) and the smallest point in which a commit
-// has failed is calculated. This mid-point is then passed to a function
-// named double2Rational, which determines the closest rational numbers
-// just below and above the mid-point. By default the lower rational
-// number is used for the scale factor on the next pass of the binary
-// search. The upper value is only used when best is already equal
-// to the lower value. This only occurs when the lower value has already
-// been tried.
-Rational scVScale(uint32_t format,
- const HwcTestDim& dfMin, const HwcTestDim& dfMax,
- const HwcTestDim& scMin, const HwcTestDim& scMax,
- HwcTestDim& outBestDf, HwcTestDim& outBestSc)
-{
- HwcTestDim scDim, dfDim; // Source crop and display frame dimension
- Rational best(0, 1), minBad; // Current bounds for a binary search
- // MinGood is set below the lowest
- // possible scale. The value of minBad,
- // will be set by the first pass
- // of the binary search.
-
- // Perform the passes of the binary search
- bool firstPass = true;
- do {
- // On first pass try the maximum scale within the search limits
- if (firstPass) {
- // Try the maximum possible scale, within the search limits
- scDim = HwcTestDim(scMin.width(), searchLimits.sourceCrop.height());
- dfDim = dfMin;
- } else {
- // Subsequent pass
- // Halve the difference between best and minBad.
- Rational lower, upper, selected;
-
- // Try the closest ratio halfway between minBood and minBad;
- // TODO: Avoid rounding issue by using Rational type for
- // midpoint. For now will use double, which should
- // have more than sufficient resolution.
- double mid = (double) best
- + ((double) minBad - (double) best) / 2.0;
- Rational::double2Rational(mid,
- Range(scMin.height(), scMax.height()),
- Range(dfMin.height(), dfMax.height()),
- lower, upper);
- if (((lower == best) && (upper == minBad))) {
- return best;
- }
-
- // Use lower value unless its already been tried
- selected = (lower != best) ? lower : upper;
-
- // Assign the size of the source crop and display frame
- // from the selected ratio of source crop to display frame.
- scDim = HwcTestDim(scMin.width(), selected.numerator());
- dfDim = HwcTestDim(dfMin.width(), selected.denominator());
- }
-
- // See if the HWC will commit to this combination
- Rectangle rect(format, dfDim, scDim);
- list<Rectangle> rectList;
- rectList.push_back(rect);
- uint32_t num = numOverlays(rectList);
-
- if (verbose) {
- testPrintI(" scHscale num: %u scale: %f dfDim: %s scDim: %s",
- num, (float) Rational(scDim.height(), dfDim.height()),
- ((string) dfDim).c_str(), ((string) scDim).c_str());
- }
- if (num == 1) {
- // HWC committed to the combination
- // This is the best scale factor seen so far. Report the
- // dimensions to the caller, in case nothing better is seen.
- outBestDf = dfDim;
- outBestSc = scDim;
-
- // Success on the first pass means the largest possible scale
- // is supported, in which case no need to search any further.
- if (firstPass) { return Rational(scDim.height(), dfDim.height()); }
-
- // Update the lower bound of the binary search
- best = Rational(scDim.height(), dfDim.height());
- } else {
- // HWC didn't commit to this combination, so update the
- // upper bound of the binary search.
- minBad = Rational(scDim.height(), dfDim.height());
- }
-
- firstPass = false;
- } while (best != minBad);
-
- return best;
-}
-
-uint32_t numOverlapping(uint32_t backgroundFormat, uint32_t foregroundFormat,
- uint32_t backgroundBlend, uint32_t foregroundBlend)
-{
- list<Rectangle> rectList;
-
- Rectangle background(backgroundFormat, startDim, startDim);
- background.blend = backgroundBlend;
- rectList.push_back(background);
-
- // TODO: Handle cases where startDim is so small that adding 5
- // causes frames not to overlap.
- // TODO: Handle cases where startDim is so large that adding 5
- // cause a portion or all of the foreground displayFrame
- // to be off the display.
- Rectangle foreground(foregroundFormat, startDim, startDim);
- foreground.displayFrame.left += 5;
- foreground.displayFrame.top += 5;
- foreground.displayFrame.right += 5;
- foreground.displayFrame.bottom += 5;
- background.blend = foregroundBlend;
- rectList.push_back(foreground);
-
- uint32_t num = numOverlays(rectList);
-
- return num;
-}
-
-Rectangle::Rectangle(uint32_t graphicFormat, HwcTestDim dfDim,
- HwcTestDim sDim) :
- format(graphicFormat), transform(defaultTransform),
- blend(defaultBlend), color(defaultColor), alpha(defaultAlpha),
- sourceCrop(sDim), displayFrame(dfDim)
-{
- // Set source dimension
- // Can't use a base initializer, because the setting of format
- // must be done before setting the sourceDimension.
- setSourceDim(sDim);
-}
-
-void Rectangle::setSourceDim(HwcTestDim dim)
-{
- this->sourceDim = dim;
-
- const struct hwcTestGraphicFormat *attrib;
- attrib = hwcTestGraphicFormatLookup(this->format);
- if (attrib != NULL) {
- if (sourceDim.width() % attrib->wMod) {
- sourceDim.setWidth(sourceDim.width() + attrib->wMod
- - (sourceDim.width() % attrib->wMod));
- }
- if (sourceDim.height() % attrib->hMod) {
- sourceDim.setHeight(sourceDim.height() + attrib->hMod
- - (sourceDim.height() % attrib->hMod));
- }
- }
-}
-
-// Rational member functions
-bool Rational::operator==(const Rational& other) const
-{
- if (((uint64_t) _n * other._d)
- == ((uint64_t) _d * other._n)) { return true; }
-
- return false;
-}
-
-bool Rational::operator<(const Rational& other) const
-{
- if (((uint64_t) _n * other._d)
- < ((uint64_t) _d * other._n)) { return true; }
-
- return false;
-}
-
-Rational::operator string() const
-{
- ostringstream out;
-
- out << _n << '/' << _d;
-
- return out.str();
-}
-
-void Rational::double2Rational(double f, Range nRange, Range dRange,
- Rational& lower, Rational& upper)
-{
- Rational bestLower(nRange.lower(), dRange.upper());
- Rational bestUpper(nRange.upper(), dRange.lower());
-
- // Search for a better solution
- for (uint32_t d = dRange.lower(); d <= dRange.upper(); d++) {
- Rational val(d * f, d); // Lower, because double to int cast truncates
-
- if ((val.numerator() < nRange.lower())
- || (val.numerator() > nRange.upper())) { continue; }
-
- if (((double) val > (double) bestLower) && ((double) val <= f)) {
- bestLower = val;
- }
-
- val.setNumerator(val.numerator() + 1);
- if (val.numerator() > nRange.upper()) { continue; }
-
- if (((double) val < (double) bestUpper) && ((double) val >= f)) {
- bestUpper = val;
- }
- }
-
- lower = bestLower;
- upper = bestUpper;
-}
-
-// Local functions
-
-// Num Overlays
-// Given a list of rectangles, determine how many HWC will commit to render
-uint32_t numOverlays(list<Rectangle>& rectList)
-{
- hwc_layer_list_t *hwcList;
- list<sp<GraphicBuffer> > buffers;
-
- hwcList = hwcTestCreateLayerList(rectList.size());
- if (hwcList == NULL) {
- testPrintE("numOverlays create hwcList failed");
- exit(30);
- }
-
- hwc_layer_t *layer = &hwcList->hwLayers[0];
- for (std::list<Rectangle>::iterator it = rectList.begin();
- it != rectList.end(); ++it, ++layer) {
- // Allocate the texture for the source frame
- // and push it onto the buffers list, so that it
- // stays in scope until a return from this function.
- sp<GraphicBuffer> texture;
- texture = new GraphicBuffer(it->sourceDim.width(),
- it->sourceDim.height(),
- it->format, texUsage);
- buffers.push_back(texture);
-
- layer->handle = texture->handle;
- layer->blending = it->blend;
- layer->transform = it->transform;
- layer->sourceCrop = it->sourceCrop;
- layer->displayFrame = it->displayFrame;
-
- layer->visibleRegionScreen.numRects = 1;
- layer->visibleRegionScreen.rects = &layer->displayFrame;
- }
-
- // Perform prepare operation
- if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(hwcList); }
- hwcDevice->prepare(hwcDevice, hwcList);
- if (verbose) {
- testPrintI("Post Prepare:");
- hwcTestDisplayListPrepareModifiable(hwcList);
- }
-
- // Count the number of overlays
- uint32_t total = 0;
- for (unsigned int n1 = 0; n1 < hwcList->numHwLayers; n1++) {
- if (hwcList->hwLayers[n1].compositionType == HWC_OVERLAY) {
- total++;
- }
- }
-
- // Free the layer list and graphic buffers
- hwcTestFreeLayerList(hwcList);
-
- return total;
-}
-
-string transformList2str(const list<uint32_t>& transformList)
-{
- ostringstream out;
-
- for (list<uint32_t>::const_iterator it = transformList.begin();
- it != transformList.end(); ++it) {
- uint32_t id = *it;
-
- if (it != transformList.begin()) {
- out << ", ";
- }
- out << id;
-
- for (unsigned int idx = 0; idx < NUMA(transformType); idx++) {
- if (id == transformType[idx].id) {
- out << " (" << transformType[idx].desc << ')';
- break;
- }
- }
- }
-
- return out.str();
-}
-
-string blendList2str(const list<uint32_t>& blendList)
-{
- ostringstream out;
-
- for (list<uint32_t>::const_iterator it = blendList.begin();
- it != blendList.end(); ++it) {
- uint32_t id = *it;
-
- if (it != blendList.begin()) {
- out << ", ";
- }
- out << id;
-
- for (unsigned int idx = 0; idx < NUMA(blendType); idx++) {
- if (id == blendType[idx].id) {
- out << " (" << blendType[idx].desc << ')';
- break;
- }
- }
- }
-
- return out.str();
-}
-
-void init(void)
-{
- srand48(0);
-
- hwcTestInitDisplay(verbose, &dpy, &surface, &width, &height);
-
- hwcTestOpenHwc(&hwcDevice);
-}
-
-void printFormatHeadings(size_t indent)
-{
- for (size_t row = 0; row <= maxHeadingLen; row++) {
- ostringstream line;
- for(vector<string>::iterator it = formats.begin();
- it != formats.end(); ++it) {
- if ((maxHeadingLen - row) <= it->length()) {
- if (row != maxHeadingLen) {
- char ch = (*it)[it->length() - (maxHeadingLen - row)];
- line << ' ' << setw(printFieldWidth) << ch;
- } else {
- line << ' ' << string(printFieldWidth, '-');
- }
- } else {
- line << ' ' << setw(printFieldWidth) << "";
- }
- }
- testPrintI("%*s%s", indent + maxHeadingLen, "",
- line.str().c_str());
- }
-}
-
-void printOverlapLine(size_t indent, const string formatStr,
- const vector<uint32_t>& results)
-{
- ostringstream line;
-
- line << setw(indent + maxHeadingLen - formatStr.length()) << "";
-
- line << formatStr;
-
- for (vector<uint32_t>::const_iterator it = results.begin();
- it != results.end(); ++it) {
- line << ' ' << setw(printFieldWidth) << *it;
- }
-
- testPrintI("%s", line.str().c_str());
-}
-
-void printSyntax(const char *cmd)
-{
- testPrintE(" %s [options] [graphicFormat] ...",
- cmd);
- testPrintE(" options:");
- testPrintE(" -s [width, height] - start dimension");
- testPrintE(" -v - Verbose");
- testPrintE("");
- testPrintE(" graphic formats:");
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- testPrintE(" %s", hwcTestGraphicFormat[n1].desc);
- }
-}
diff --git a/opengl/tests/hwc/hwcRects.cpp b/opengl/tests/hwc/hwcRects.cpp
deleted file mode 100644
index 906c169..0000000
--- a/opengl/tests/hwc/hwcRects.cpp
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-/*
- * Hardware Composer Rectangles
- *
- * Synopsis
- * hwcRects [options] (graphicFormat displayFrame [attributes],)...
- * options:
- * -D #.## - End of test delay
- * -v - Verbose
- *
- * graphic formats:
- * RGBA8888 (reference frame default)
- * RGBX8888
- * RGB888
- * RGB565
- * BGRA8888
- * RGBA5551
- * RGBA4444
- * YV12
- *
- * displayFrame
- * [left, top, right, bottom]
- *
- * attributes:
- * transform: none | fliph | flipv | rot90 | rot180 | rot270
- * blend: none | premult | coverage
- * color: [0.##, 0.##, 0.##]
- * alpha: 0.##
- * sourceDim: [width, height]
- * sourceCrop: [left, top, right, bottom]
- *
- * Example:
- * # White YV12 rectangle, with overlapping turquoise
- * # RGBA8888 rectangle at 30%% (alpha: 0.7) transparency
- * hwcRects -v -D 30.0 \
- * YV12 [50, 80, 200, 300] transform: none \
- * color: [1.0, 0.5, 0.5], \
- * RGBA8888 [100, 150, 300, 400] blend: coverage \
- * color: [0.251, 0.878, 0.816] alpha: 0.7 \
- * sourceDim: [50, 60] sourceCrop: [5, 8, 12, 15]
- *
- * Description
- * Constructs a Hardware Composer (HWC) list of frames from
- * command-line specified parameters. Then sends it to the HWC
- * be rendered. The intended purpose of this tool is as a means to
- * reproduce and succinctly specify an observed HWC operation, with
- * no need to modify/compile a program.
- *
- * The command-line syntax consists of a few standard command-line
- * options and then a description of one or more frames. The frame
- * descriptions are separated from one another via a comma. The
- * beginning of a frame description requires the specification
- * of the graphic format and then the display frame rectangle where
- * the frame will be displayed. The display frame rectangle is
- * specified as follows, with the right and bottom coordinates being
- * exclusive values:
- *
- * [left, top, right, bottom]
- *
- * After these two required parameters each frame description can
- * specify 1 or more optional attributes. The name of each optional
- * attribute is preceded by a colon. The current implementation
- * then requires white space after the colon and then the value of
- * the attribute is specified. See the synopsis section above for
- * a list of attributes and the format of their expected value.
- */
-
-#include <algorithm>
-#include <assert.h>
-#include <cerrno>
-#include <cmath>
-#include <cstdlib>
-#include <ctime>
-#include <istream>
-#include <libgen.h>
-#include <list>
-#include <sched.h>
-#include <sstream>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-
-#define LOG_TAG "hwcRectsTest"
-#include <utils/Log.h>
-#include <testUtil.h>
-
-#include <hardware/hwcomposer.h>
-
-#include <glTestLib.h>
-#include "hwcTestLib.h"
-
-using namespace std;
-using namespace android;
-
-// Defaults
-const bool defaultVerbose = false;
-const float defaultEndDelay = 2.0; // Default delay after rendering graphics
-
-const uint32_t defaultFormat = HAL_PIXEL_FORMAT_RGBA_8888;
-const int32_t defaultTransform = 0;
-const uint32_t defaultBlend = HWC_BLENDING_NONE;
-const ColorFract defaultColor(0.5, 0.5, 0.5);
-const float defaultAlpha = 1.0; // Opaque
-const HwcTestDim defaultSourceDim(1, 1);
-const struct hwc_rect defaultSourceCrop = {0, 0, 1, 1};
-const struct hwc_rect defaultDisplayFrame = {0, 0, 100, 100};
-
-// Defines
-#define MAXCMD 200
-#define CMD_STOP_FRAMEWORK "stop 2>&1"
-#define CMD_START_FRAMEWORK "start 2>&1"
-
-// Macros
-#define NUMA(a) (sizeof(a) / sizeof(a [0])) // Num elements in an array
-
-// Local types
-class Rectangle {
-public:
- Rectangle() : format(defaultFormat), transform(defaultTransform),
- blend(defaultBlend), color(defaultColor),
- alpha(defaultAlpha), sourceDim(defaultSourceDim),
- sourceCrop(defaultSourceCrop),
- displayFrame(defaultDisplayFrame) {};
-
- uint32_t format;
- uint32_t transform;
- int32_t blend;
- ColorFract color;
- float alpha;
- HwcTestDim sourceDim;
- struct hwc_rect sourceCrop;
- struct hwc_rect displayFrame;
-
- sp<GraphicBuffer> texture;
-};
-
-// Globals
-list<Rectangle> rectangle;
-static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE |
- GraphicBuffer::USAGE_SW_WRITE_RARELY;
-static hwc_composer_device_t *hwcDevice;
-static EGLDisplay dpy;
-static EGLSurface surface;
-static EGLint width, height;
-
-// Function prototypes
-static Rectangle parseRect(string rectStr);
-void init(void);
-void printSyntax(const char *cmd);
-
-// Command-line option settings
-static bool verbose = defaultVerbose;
-static float endDelay = defaultEndDelay;
-
-/*
- * Main
- *
- * Performs the following high-level sequence of operations:
- *
- * 1. Parse command-line options
- *
- * 2. Stop framework
- *
- * 3. Initialization
- *
- * 4. Parse frame descriptions
- *
- * 5. Create HWC list from frame descriptions
- *
- * 6. Have HWC render the list description of the frames
- *
- * 7. Delay for amount of time given by endDelay
- *
- * 8. Start framework
- */
-int
-main(int argc, char *argv[])
-{
- int rv, opt;
- char *chptr;
- bool error;
- string str;
- char cmd[MAXCMD];
-
- testSetLogCatTag(LOG_TAG);
-
- // Parse command line arguments
- while ((opt = getopt(argc, argv, "D:v?h")) != -1) {
- switch (opt) {
- case 'D': // End of test delay
- endDelay = strtod(optarg, &chptr);
- if ((*chptr != '\0') || (endDelay < 0.0)) {
- testPrintE("Invalid command-line specified end of test delay "
- "of: %s", optarg);
- exit(1);
- }
- break;
-
- case 'v': // Verbose
- verbose = true;
- break;
-
- case 'h': // Help
- case '?':
- default:
- printSyntax(basename(argv[0]));
- exit(((optopt == 0) || (optopt == '?')) ? 0 : 2);
- }
- }
-
- // Stop framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_STOP_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_STOP_FRAMEWORK);
- exit(3);
- }
- testExecCmd(cmd);
- testDelay(1.0); // TODO - needs means to query whether asyncronous stop
- // framework operation has completed. For now, just wait
- // a long time.
-
- init();
-
- // Parse rectangle descriptions
- int numOpen = 0; // Current number of unmatched <[
- string rectDesc(""); // String description of a single rectangle
- while (optind < argc) {
- string argNext = string(argv[optind++]);
-
- if (rectDesc.length()) { rectDesc += ' '; }
- rectDesc += argNext;
-
- // Count number of opening <[ and matching >]
- // At this point not worried about an opening character being
- // matched by it's corresponding closing character. For example,
- // "<1.0, 2.0]" is incorrect because the opening < should be matched
- // with a closing >, instead of the closing ]. Such errors are
- // detected when the actual value is parsed.
- for (unsigned int n1 = 0; n1 < argNext.length(); n1++) {
- switch(argNext[n1]) {
- case '[':
- case '<':
- numOpen++;
- break;
-
- case ']':
- case '>':
- numOpen--;
- break;
- }
-
- // Error anytime there is more closing then opening characters
- if (numOpen < 0) {
- testPrintI("Mismatched number of opening <[ with "
- "closing >] in: %s", rectDesc.c_str());
- exit(4);
- }
- }
-
- // Description of a rectangle is complete when all opening
- // <[ are closed with >] and the string ends with a comma or
- // there are no more args.
- if ((numOpen == 0) && rectDesc.length()
- && ((rectDesc[rectDesc.length() - 1] == ',')
- || (optind == argc))) {
- // Remove trailing comma if it is present
- if (rectDesc[rectDesc.length() - 1] == ',') {
- rectDesc.erase(rectDesc.length() - 1);
- }
-
- // Parse string description of rectangle
- Rectangle rect = parseRect(rectDesc);
-
- // Add to the list of rectangles
- rectangle.push_back(rect);
-
- // Prepare for description of another rectangle
- rectDesc = string("");
- }
- }
-
- // Create list of frames
- hwc_layer_list_t *list;
- list = hwcTestCreateLayerList(rectangle.size());
- if (list == NULL) {
- testPrintE("hwcTestCreateLayerList failed");
- exit(5);
- }
-
- hwc_layer_t *layer = &list->hwLayers[0];
- for (std::list<Rectangle>::iterator it = rectangle.begin();
- it != rectangle.end(); ++it, ++layer) {
- layer->handle = it->texture->handle;
- layer->blending = it->blend;
- layer->transform = it->transform;
- layer->sourceCrop = it->sourceCrop;
- layer->displayFrame = it->displayFrame;
-
- layer->visibleRegionScreen.numRects = 1;
- layer->visibleRegionScreen.rects = &layer->displayFrame;
- }
-
- // Perform prepare operation
- if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); }
- hwcDevice->prepare(hwcDevice, list);
- if (verbose) {
- testPrintI("Post Prepare:");
- hwcTestDisplayListPrepareModifiable(list);
- }
-
- // Turn off the geometry changed flag
- list->flags &= ~HWC_GEOMETRY_CHANGED;
-
- // Perform the set operation(s)
- if (verbose) {testPrintI("Set:"); }
- if (verbose) { hwcTestDisplayListHandles(list); }
- hwcDevice->set(hwcDevice, dpy, surface, list);
-
- testDelay(endDelay);
-
- // Start framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_START_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_START_FRAMEWORK);
- exit(6);
- }
- testExecCmd(cmd);
-
- return 0;
-}
-
-// Parse string description of rectangle and add it to list of rectangles
-// to be rendered.
-static Rectangle parseRect(string rectStr)
-{
- int rv;
- string str;
- bool error;
- istringstream in(rectStr);
- const struct hwcTestGraphicFormat *format;
- Rectangle rect;
- struct hwc_rect hwcRect;
-
- // Graphic Format
- in >> str;
- if (!in) {
- testPrintE("Error parsing format from: %s", rectStr.c_str());
- exit(20);
- }
- format = hwcTestGraphicFormatLookup(str.c_str());
- if (format == NULL) {
- testPrintE("Unknown graphic format in: %s", rectStr.c_str());
- exit(21);
- }
- rect.format = format->format;
-
- // Display Frame
- rect.displayFrame = hwcTestParseHwcRect(in, error);
- if (error) {
- testPrintE("Invalid display frame in: %s", rectStr.c_str());
- exit(22);
- }
-
- // Set default sourceDim and sourceCrop based on size of display frame.
- // Default is source size equal to the size of the display frame, with
- // the source crop being the entire size of the source frame.
- rect.sourceDim = HwcTestDim(rect.displayFrame.right
- - rect.displayFrame.left,
- rect.displayFrame.bottom
- - rect.displayFrame.top);
- rect.sourceCrop.left = 0;
- rect.sourceCrop.top = 0;
- rect.sourceCrop.right = rect.sourceDim.width();
- rect.sourceCrop.bottom = rect.sourceDim.height();
-
- // Optional settings
- while ((in.tellg() < (streampos) in.str().length())
- && (in.tellg() != (streampos) -1)) {
- string attrName;
-
- in >> attrName;
- if (in.eof()) { break; }
- if (!in) {
- testPrintE("Error reading attribute name in: %s",
- rectStr.c_str());
- exit(23);
- }
-
- // Transform
- if (attrName == "transform:") { // Transform
- string str;
-
- in >> str;
- if (str == "none") {
- rect.transform = 0;
- } else if (str == "fliph") {
- rect.transform = HWC_TRANSFORM_FLIP_H;
- } else if (str == "flipv") {
- rect.transform = HWC_TRANSFORM_FLIP_V;
- } else if (str == "rot90") {
- rect.transform = HWC_TRANSFORM_ROT_90;
- } else if (str == "rot180") {
- rect.transform = HWC_TRANSFORM_ROT_180;
- } else if (str == "rot270") {
- rect.transform = HWC_TRANSFORM_ROT_270;
- } else {
- testPrintE("Unknown transform of \"%s\" in: %s", str.c_str(),
- rectStr.c_str());
- exit(24);
- }
- } else if (attrName == "blend:") { // Blend
- string str;
-
- in >> str;
- if (str == string("none")) {
- rect.blend = HWC_BLENDING_NONE;
- } else if (str == "premult") {
- rect.blend = HWC_BLENDING_PREMULT;
- } else if (str == "coverage") {
- rect.blend = HWC_BLENDING_COVERAGE;
- } else {
- testPrintE("Unknown blend of \"%s\" in: %s", str.c_str(),
- rectStr.c_str());
- exit(25);
- }
- } else if (attrName == "color:") { // Color
- rect.color = hwcTestParseColor(in, error);
- if (error) {
- testPrintE("Error parsing color in: %s", rectStr.c_str());
- exit(26);
- }
- } else if (attrName == "alpha:") { // Alpha
- in >> rect.alpha;
- if (!in) {
- testPrintE("Error parsing value for alpha attribute in: %s",
- rectStr.c_str());
- exit(27);
- }
- } else if (attrName == "sourceDim:") { // Source Dimension
- rect.sourceDim = hwcTestParseDim(in, error);
- if (error) {
- testPrintE("Error parsing source dimenision in: %s",
- rectStr.c_str());
- exit(28);
- }
- } else if (attrName == "sourceCrop:") { // Source Crop
- rect.sourceCrop = hwcTestParseHwcRect(in, error);
- if (error) {
- testPrintE("Error parsing source crop in: %s",
- rectStr.c_str());
- exit(29);
- }
- } else { // Unknown attribute
- testPrintE("Unknown attribute of \"%s\" in: %s", attrName.c_str(),
- rectStr.c_str());
- exit(30);
- }
- }
-
- // Validate
- if (((uint32_t) rect.sourceCrop.left >= rect.sourceDim.width())
- || ((uint32_t) rect.sourceCrop.right > rect.sourceDim.width())
- || ((uint32_t) rect.sourceCrop.top >= rect.sourceDim.height())
- || ((uint32_t) rect.sourceCrop.bottom > rect.sourceDim.height())) {
- testPrintE("Invalid source crop in: %s", rectStr.c_str());
- exit(31);
- }
- if ((rect.displayFrame.left >= width)
- || (rect.displayFrame.right > width)
- || (rect.displayFrame.top >= height)
- || (rect.displayFrame.bottom > height)) {
- testPrintE("Invalid display frame in: %s", rectStr.c_str());
- exit(32);
- }
- if ((rect.alpha < 0.0) || (rect.alpha > 1.0)) {
- testPrintE("Invalid alpha in: %s", rectStr.c_str());
- exit(33);
- }
-
- // Create source texture
- rect.texture = new GraphicBuffer(rect.sourceDim.width(),
- rect.sourceDim.height(),
- rect.format, texUsage);
- if ((rv = rect.texture->initCheck()) != NO_ERROR) {
- testPrintE("source texture initCheck failed, rv: %i", rv);
- testPrintE(" %s", rectStr.c_str());
-
- }
-
- // Fill with uniform color
- hwcTestFillColor(rect.texture.get(), rect.color, rect.alpha);
- if (verbose) {
- testPrintI(" buf: %p handle: %p format: %s width: %u height: %u "
- "color: %s alpha: %f",
- rect.texture.get(), rect.texture->handle, format->desc,
- rect.sourceDim.width(), rect.sourceDim.height(),
- string(rect.color).c_str(), rect.alpha);
- }
-
- return rect;
-}
-
-void init(void)
-{
- // Seed pseudo random number generator
- // Needed so that the pad areas of frames are filled with a deterministic
- // pseudo random value.
- srand48(0);
-
- hwcTestInitDisplay(verbose, &dpy, &surface, &width, &height);
-
- hwcTestOpenHwc(&hwcDevice);
-}
-
-void printSyntax(const char *cmd)
-{
- testPrintE(" %s [options] (graphicFormat displayFrame [attributes],)...",
- cmd);
- testPrintE(" options:");
- testPrintE(" -D End of test delay");
- testPrintE(" -v Verbose");
- testPrintE("");
- testPrintE(" graphic formats:");
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- testPrintE(" %s", hwcTestGraphicFormat[n1].desc);
- }
- testPrintE("");
- testPrintE(" displayFrame");
- testPrintE(" [left, top, right, bottom]");
- testPrintE("");
- testPrintE(" attributes:");
- testPrintE(" transform: none | fliph | flipv | rot90 | rot180 "
- " | rot270");
- testPrintE(" blend: none | premult | coverage");
- testPrintE(" color: [0.##, 0.##, 0.##]");
- testPrintE(" alpha: 0.##");
- testPrintE(" sourceDim: [width, height]");
- testPrintE(" sourceCrop: [left, top, right, bottom]");
- testPrintE("");
- testPrintE(" Example:");
- testPrintE(" # White YV12 rectangle, with overlapping turquoise ");
- testPrintE(" # RGBA8888 rectangle at 30%% (alpha: 0.7) transparency");
- testPrintE(" %s -v -D 30.0 \\", cmd);
- testPrintE(" YV12 [50, 80, 200, 300] transform: none \\");
- testPrintE(" color: [1.0, 0.5, 0.5], \\");
- testPrintE(" RGBA8888 [100, 150, 300, 400] blend: coverage \\");
- testPrintE(" color: [0.251, 0.878, 0.816] alpha: 0.7 \\");
- testPrintE(" sourceDim: [50, 60] sourceCrop: [5, 8, 12, 15]");
-}
diff --git a/opengl/tests/hwc/hwcStress.cpp b/opengl/tests/hwc/hwcStress.cpp
deleted file mode 100644
index b02a424..0000000
--- a/opengl/tests/hwc/hwcStress.cpp
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Hardware Composer stress test
- *
- * Performs a pseudo-random (prandom) sequence of operations to the
- * Hardware Composer (HWC), for a specified number of passes or for
- * a specified period of time. By default the period of time is FLT_MAX,
- * so that the number of passes will take precedence.
- *
- * The passes are grouped together, where (pass / passesPerGroup) specifies
- * which group a particular pass is in. This causes every passesPerGroup
- * worth of sequential passes to be within the same group. Computationally
- * intensive operations are performed just once at the beginning of a group
- * of passes and then used by all the passes in that group. This is done
- * so as to increase both the average and peak rate of graphic operations,
- * by moving computationally intensive operations to the beginning of a group.
- * In particular, at the start of each group of passes a set of
- * graphic buffers are created, then used by the first and remaining
- * passes of that group of passes.
- *
- * The per-group initialization of the graphic buffers is performed
- * by a function called initFrames. This function creates an array
- * of smart pointers to the graphic buffers, in the form of a vector
- * of vectors. The array is accessed in row major order, so each
- * row is a vector of smart pointers. All the pointers of a single
- * row point to graphic buffers which use the same pixel format and
- * have the same dimension, although it is likely that each one is
- * filled with a different color. This is done so that after doing
- * the first HWC prepare then set call, subsequent set calls can
- * be made with each of the layer handles changed to a different
- * graphic buffer within the same row. Since the graphic buffers
- * in a particular row have the same pixel format and dimension,
- * additional HWC set calls can be made, without having to perform
- * an HWC prepare call.
- *
- * This test supports the following command-line options:
- *
- * -v Verbose
- * -s num Starting pass
- * -e num Ending pass
- * -p num Execute the single pass specified by num
- * -n num Number of set operations to perform after each prepare operation
- * -t float Maximum time in seconds to execute the test
- * -d float Delay in seconds performed after each set operation
- * -D float Delay in seconds performed after the last pass is executed
- *
- * Typically the test is executed for a large range of passes. By default
- * passes 0 through 99999 (100,000 passes) are executed. Although this test
- * does not validate the generated image, at times it is useful to reexecute
- * a particular pass and leave the displayed image on the screen for an
- * extended period of time. This can be done either by setting the -s
- * and -e options to the desired pass, along with a large value for -D.
- * This can also be done via the -p option, again with a large value for
- * the -D options.
- *
- * So far this test only contains code to create graphic buffers with
- * a continuous solid color. Although this test is unable to validate the
- * image produced, any image that contains other than rectangles of a solid
- * color are incorrect. Note that the rectangles may use a transparent
- * color and have a blending operation that causes the color in overlapping
- * rectangles to be mixed. In such cases the overlapping portions may have
- * a different color from the rest of the rectangle.
- */
-
-#include <algorithm>
-#include <assert.h>
-#include <cerrno>
-#include <cmath>
-#include <cstdlib>
-#include <ctime>
-#include <libgen.h>
-#include <sched.h>
-#include <sstream>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <vector>
-
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-
-#define LOG_TAG "hwcStressTest"
-#include <utils/Log.h>
-#include <testUtil.h>
-
-#include <hardware/hwcomposer.h>
-
-#include <glTestLib.h>
-#include "hwcTestLib.h"
-
-using namespace std;
-using namespace android;
-
-const float maxSizeRatio = 1.3; // Graphic buffers can be upto this munch
- // larger than the default screen size
-const unsigned int passesPerGroup = 10; // A group of passes all use the same
- // graphic buffers
-
-// Ratios at which rare and frequent conditions should be produced
-const float rareRatio = 0.1;
-const float freqRatio = 0.9;
-
-// Defaults for command-line options
-const bool defaultVerbose = false;
-const unsigned int defaultStartPass = 0;
-const unsigned int defaultEndPass = 99999;
-const unsigned int defaultPerPassNumSet = 10;
-const float defaultPerSetDelay = 0.0; // Default delay after each set
- // operation. Default delay of
- // zero used so as to perform the
- // the set operations as quickly
- // as possible.
-const float defaultEndDelay = 2.0; // Default delay between completion of
- // final pass and restart of framework
-const float defaultDuration = FLT_MAX; // A fairly long time, so that
- // range of passes will have
- // precedence
-
-// Command-line option settings
-static bool verbose = defaultVerbose;
-static unsigned int startPass = defaultStartPass;
-static unsigned int endPass = defaultEndPass;
-static unsigned int numSet = defaultPerPassNumSet;
-static float perSetDelay = defaultPerSetDelay;
-static float endDelay = defaultEndDelay;
-static float duration = defaultDuration;
-
-// Command-line mutual exclusion detection flags.
-// Corresponding flag set true once an option is used.
-bool eFlag, sFlag, pFlag;
-
-#define MAXSTR 100
-#define MAXCMD 200
-#define BITSPERBYTE 8 // TODO: Obtain from <values.h>, once
- // it has been added
-
-#define CMD_STOP_FRAMEWORK "stop 2>&1"
-#define CMD_START_FRAMEWORK "start 2>&1"
-
-#define NUMA(a) (sizeof(a) / sizeof(a [0]))
-#define MEMCLR(addr, size) do { \
- memset((addr), 0, (size)); \
- } while (0)
-
-// File scope constants
-const unsigned int blendingOps[] = {
- HWC_BLENDING_NONE,
- HWC_BLENDING_PREMULT,
- HWC_BLENDING_COVERAGE,
-};
-const unsigned int layerFlags[] = {
- HWC_SKIP_LAYER,
-};
-const vector<unsigned int> vecLayerFlags(layerFlags,
- layerFlags + NUMA(layerFlags));
-
-const unsigned int transformFlags[] = {
- HWC_TRANSFORM_FLIP_H,
- HWC_TRANSFORM_FLIP_V,
- HWC_TRANSFORM_ROT_90,
- // ROT_180 & ROT_270 intentionally not listed, because they
- // they are formed from combinations of the flags already listed.
-};
-const vector<unsigned int> vecTransformFlags(transformFlags,
- transformFlags + NUMA(transformFlags));
-
-// File scope globals
-static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE |
- GraphicBuffer::USAGE_SW_WRITE_RARELY;
-static hwc_composer_device_t *hwcDevice;
-static EGLDisplay dpy;
-static EGLSurface surface;
-static EGLint width, height;
-static vector <vector <sp<GraphicBuffer> > > frames;
-
-// File scope prototypes
-void init(void);
-void initFrames(unsigned int seed);
-template <class T> vector<T> vectorRandSelect(const vector<T>& vec, size_t num);
-template <class T> T vectorOr(const vector<T>& vec);
-
-/*
- * Main
- *
- * Performs the following high-level sequence of operations:
- *
- * 1. Command-line parsing
- *
- * 2. Initialization
- *
- * 3. For each pass:
- *
- * a. If pass is first pass or in a different group from the
- * previous pass, initialize the array of graphic buffers.
- *
- * b. Create a HWC list with room to specify a prandomly
- * selected number of layers.
- *
- * c. Select a subset of the rows from the graphic buffer array,
- * such that there is a unique row to be used for each
- * of the layers in the HWC list.
- *
- * d. Prandomly fill in the HWC list with handles
- * selected from any of the columns of the selected row.
- *
- * e. Pass the populated list to the HWC prepare call.
- *
- * f. Pass the populated list to the HWC set call.
- *
- * g. If additional set calls are to be made, then for each
- * additional set call, select a new set of handles and
- * perform the set call.
- */
-int
-main(int argc, char *argv[])
-{
- int rv, opt;
- char *chptr;
- unsigned int pass;
- char cmd[MAXCMD];
- struct timeval startTime, currentTime, delta;
-
- testSetLogCatTag(LOG_TAG);
-
- // Parse command line arguments
- while ((opt = getopt(argc, argv, "vp:d:D:n:s:e:t:?h")) != -1) {
- switch (opt) {
- case 'd': // Delay after each set operation
- perSetDelay = strtod(optarg, &chptr);
- if ((*chptr != '\0') || (perSetDelay < 0.0)) {
- testPrintE("Invalid command-line specified per pass delay of: "
- "%s", optarg);
- exit(1);
- }
- break;
-
- case 'D': // End of test delay
- // Delay between completion of final pass and restart
- // of framework
- endDelay = strtod(optarg, &chptr);
- if ((*chptr != '\0') || (endDelay < 0.0)) {
- testPrintE("Invalid command-line specified end of test delay "
- "of: %s", optarg);
- exit(2);
- }
- break;
-
- case 't': // Duration
- duration = strtod(optarg, &chptr);
- if ((*chptr != '\0') || (duration < 0.0)) {
- testPrintE("Invalid command-line specified duration of: %s",
- optarg);
- exit(3);
- }
- break;
-
- case 'n': // Num set operations per pass
- numSet = strtoul(optarg, &chptr, 10);
- if (*chptr != '\0') {
- testPrintE("Invalid command-line specified num set per pass "
- "of: %s", optarg);
- exit(4);
- }
- break;
-
- case 's': // Starting Pass
- sFlag = true;
- if (pFlag) {
- testPrintE("Invalid combination of command-line options.");
- testPrintE(" The -p option is mutually exclusive from the");
- testPrintE(" -s and -e options.");
- exit(5);
- }
- startPass = strtoul(optarg, &chptr, 10);
- if (*chptr != '\0') {
- testPrintE("Invalid command-line specified starting pass "
- "of: %s", optarg);
- exit(6);
- }
- break;
-
- case 'e': // Ending Pass
- eFlag = true;
- if (pFlag) {
- testPrintE("Invalid combination of command-line options.");
- testPrintE(" The -p option is mutually exclusive from the");
- testPrintE(" -s and -e options.");
- exit(7);
- }
- endPass = strtoul(optarg, &chptr, 10);
- if (*chptr != '\0') {
- testPrintE("Invalid command-line specified ending pass "
- "of: %s", optarg);
- exit(8);
- }
- break;
-
- case 'p': // Run a single specified pass
- pFlag = true;
- if (sFlag || eFlag) {
- testPrintE("Invalid combination of command-line options.");
- testPrintE(" The -p option is mutually exclusive from the");
- testPrintE(" -s and -e options.");
- exit(9);
- }
- startPass = endPass = strtoul(optarg, &chptr, 10);
- if (*chptr != '\0') {
- testPrintE("Invalid command-line specified pass of: %s",
- optarg);
- exit(10);
- }
- break;
-
- case 'v': // Verbose
- verbose = true;
- break;
-
- case 'h': // Help
- case '?':
- default:
- testPrintE(" %s [options]", basename(argv[0]));
- testPrintE(" options:");
- testPrintE(" -p Execute specified pass");
- testPrintE(" -s Starting pass");
- testPrintE(" -e Ending pass");
- testPrintE(" -t Duration");
- testPrintE(" -d Delay after each set operation");
- testPrintE(" -D End of test delay");
- testPrintE(" -n Num set operations per pass");
- testPrintE(" -v Verbose");
- exit(((optopt == 0) || (optopt == '?')) ? 0 : 11);
- }
- }
- if (endPass < startPass) {
- testPrintE("Unexpected ending pass before starting pass");
- testPrintE(" startPass: %u endPass: %u", startPass, endPass);
- exit(12);
- }
- if (argc != optind) {
- testPrintE("Unexpected command-line postional argument");
- testPrintE(" %s [-s start_pass] [-e end_pass] [-t duration]",
- basename(argv[0]));
- exit(13);
- }
- testPrintI("duration: %g", duration);
- testPrintI("startPass: %u", startPass);
- testPrintI("endPass: %u", endPass);
- testPrintI("numSet: %u", numSet);
-
- // Stop framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_STOP_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_STOP_FRAMEWORK);
- exit(14);
- }
- testExecCmd(cmd);
- testDelay(1.0); // TODO - need means to query whether asyncronous stop
- // framework operation has completed. For now, just wait
- // a long time.
-
- init();
-
- // For each pass
- gettimeofday(&startTime, NULL);
- for (pass = startPass; pass <= endPass; pass++) {
- // Stop if duration of work has already been performed
- gettimeofday(¤tTime, NULL);
- delta = tvDelta(&startTime, ¤tTime);
- if (tv2double(&delta) > duration) { break; }
-
- // Regenerate a new set of test frames when this pass is
- // either the first pass or is in a different group then
- // the previous pass. A group of passes are passes that
- // all have the same quotient when their pass number is
- // divided by passesPerGroup.
- if ((pass == startPass)
- || ((pass / passesPerGroup) != ((pass - 1) / passesPerGroup))) {
- initFrames(pass / passesPerGroup);
- }
-
- testPrintI("==== Starting pass: %u", pass);
-
- // Cause deterministic sequence of prandom numbers to be
- // generated for this pass.
- srand48(pass);
-
- hwc_layer_list_t *list;
- list = hwcTestCreateLayerList(testRandMod(frames.size()) + 1);
- if (list == NULL) {
- testPrintE("hwcTestCreateLayerList failed");
- exit(20);
- }
-
- // Prandomly select a subset of frames to be used by this pass.
- vector <vector <sp<GraphicBuffer> > > selectedFrames;
- selectedFrames = vectorRandSelect(frames, list->numHwLayers);
-
- // Any transform tends to create a layer that the hardware
- // composer is unable to support and thus has to leave for
- // SurfaceFlinger. Place heavy bias on specifying no transforms.
- bool noTransform = testRandFract() > rareRatio;
-
- for (unsigned int n1 = 0; n1 < list->numHwLayers; n1++) {
- unsigned int idx = testRandMod(selectedFrames[n1].size());
- sp<GraphicBuffer> gBuf = selectedFrames[n1][idx];
- hwc_layer_t *layer = &list->hwLayers[n1];
- layer->handle = gBuf->handle;
-
- layer->blending = blendingOps[testRandMod(NUMA(blendingOps))];
- layer->flags = (testRandFract() > rareRatio) ? 0
- : vectorOr(vectorRandSelect(vecLayerFlags,
- testRandMod(vecLayerFlags.size() + 1)));
- layer->transform = (noTransform || testRandFract() > rareRatio) ? 0
- : vectorOr(vectorRandSelect(vecTransformFlags,
- testRandMod(vecTransformFlags.size() + 1)));
- layer->sourceCrop.left = testRandMod(gBuf->getWidth());
- layer->sourceCrop.top = testRandMod(gBuf->getHeight());
- layer->sourceCrop.right = layer->sourceCrop.left
- + testRandMod(gBuf->getWidth() - layer->sourceCrop.left) + 1;
- layer->sourceCrop.bottom = layer->sourceCrop.top
- + testRandMod(gBuf->getHeight() - layer->sourceCrop.top) + 1;
- layer->displayFrame.left = testRandMod(width);
- layer->displayFrame.top = testRandMod(height);
- layer->displayFrame.right = layer->displayFrame.left
- + testRandMod(width - layer->displayFrame.left) + 1;
- layer->displayFrame.bottom = layer->displayFrame.top
- + testRandMod(height - layer->displayFrame.top) + 1;
-
- // Increase the frequency that a scale factor of 1.0 from
- // the sourceCrop to displayFrame occurs. This is the
- // most common scale factor used by applications and would
- // be rarely produced by this stress test without this
- // logic.
- if (testRandFract() <= freqRatio) {
- // Only change to scale factor to 1.0 if both the
- // width and height will fit.
- int sourceWidth = layer->sourceCrop.right
- - layer->sourceCrop.left;
- int sourceHeight = layer->sourceCrop.bottom
- - layer->sourceCrop.top;
- if (((layer->displayFrame.left + sourceWidth) <= width)
- && ((layer->displayFrame.top + sourceHeight) <= height)) {
- layer->displayFrame.right = layer->displayFrame.left
- + sourceWidth;
- layer->displayFrame.bottom = layer->displayFrame.top
- + sourceHeight;
- }
- }
-
- layer->visibleRegionScreen.numRects = 1;
- layer->visibleRegionScreen.rects = &layer->displayFrame;
- }
-
- // Perform prepare operation
- if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); }
- hwcDevice->prepare(hwcDevice, list);
- if (verbose) {
- testPrintI("Post Prepare:");
- hwcTestDisplayListPrepareModifiable(list);
- }
-
- // Turn off the geometry changed flag
- list->flags &= ~HWC_GEOMETRY_CHANGED;
-
- // Perform the set operation(s)
- if (verbose) {testPrintI("Set:"); }
- for (unsigned int n1 = 0; n1 < numSet; n1++) {
- if (verbose) { hwcTestDisplayListHandles(list); }
- hwcDevice->set(hwcDevice, dpy, surface, list);
-
- // Prandomly select a new set of handles
- for (unsigned int n1 = 0; n1 < list->numHwLayers; n1++) {
- unsigned int idx = testRandMod(selectedFrames[n1].size());
- sp<GraphicBuffer> gBuf = selectedFrames[n1][idx];
- hwc_layer_t *layer = &list->hwLayers[n1];
- layer->handle = (native_handle_t *) gBuf->handle;
- }
-
- testDelay(perSetDelay);
- }
-
- hwcTestFreeLayerList(list);
- testPrintI("==== Completed pass: %u", pass);
- }
-
- testDelay(endDelay);
-
- // Start framework
- rv = snprintf(cmd, sizeof(cmd), "%s", CMD_START_FRAMEWORK);
- if (rv >= (signed) sizeof(cmd) - 1) {
- testPrintE("Command too long for: %s", CMD_START_FRAMEWORK);
- exit(21);
- }
- testExecCmd(cmd);
-
- testPrintI("Successfully completed %u passes", pass - startPass);
-
- return 0;
-}
-
-void init(void)
-{
- srand48(0); // Defensively set pseudo random number generator.
- // Should not need to set this, because a stress test
- // sets the seed on each pass. Defensively set it here
- // so that future code that uses pseudo random numbers
- // before the first pass will be deterministic.
-
- hwcTestInitDisplay(verbose, &dpy, &surface, &width, &height);
-
- hwcTestOpenHwc(&hwcDevice);
-}
-
-/*
- * Initialize Frames
- *
- * Creates an array of graphic buffers, within the global variable
- * named frames. The graphic buffers are contained within a vector of
- * vectors. All the graphic buffers in a particular row are of the same
- * format and dimension. Each graphic buffer is uniformly filled with a
- * prandomly selected color. It is likely that each buffer, even
- * in the same row, will be filled with a unique color.
- */
-void initFrames(unsigned int seed)
-{
- int rv;
- const size_t maxRows = 5;
- const size_t minCols = 2; // Need at least double buffering
- const size_t maxCols = 4; // One more than triple buffering
-
- if (verbose) { testPrintI("initFrames seed: %u", seed); }
- srand48(seed);
- size_t rows = testRandMod(maxRows) + 1;
-
- frames.clear();
- frames.resize(rows);
-
- for (unsigned int row = 0; row < rows; row++) {
- // All frames within a row have to have the same format and
- // dimensions. Width and height need to be >= 1.
- unsigned int formatIdx = testRandMod(NUMA(hwcTestGraphicFormat));
- const struct hwcTestGraphicFormat *formatPtr
- = &hwcTestGraphicFormat[formatIdx];
- int format = formatPtr->format;
-
- // Pick width and height, which must be >= 1 and the size
- // mod the wMod/hMod value must be equal to 0.
- size_t w = (width * maxSizeRatio) * testRandFract();
- size_t h = (height * maxSizeRatio) * testRandFract();
- w = max(1u, w);
- h = max(1u, h);
- if ((w % formatPtr->wMod) != 0) {
- w += formatPtr->wMod - (w % formatPtr->wMod);
- }
- if ((h % formatPtr->hMod) != 0) {
- h += formatPtr->hMod - (h % formatPtr->hMod);
- }
- if (verbose) {
- testPrintI(" frame %u width: %u height: %u format: %u %s",
- row, w, h, format, hwcTestGraphicFormat2str(format));
- }
-
- size_t cols = testRandMod((maxCols + 1) - minCols) + minCols;
- frames[row].resize(cols);
- for (unsigned int col = 0; col < cols; col++) {
- ColorFract color(testRandFract(), testRandFract(), testRandFract());
- float alpha = testRandFract();
-
- frames[row][col] = new GraphicBuffer(w, h, format, texUsage);
- if ((rv = frames[row][col]->initCheck()) != NO_ERROR) {
- testPrintE("GraphicBuffer initCheck failed, rv: %i", rv);
- testPrintE(" frame %u width: %u height: %u format: %u %s",
- row, w, h, format, hwcTestGraphicFormat2str(format));
- exit(80);
- }
-
- hwcTestFillColor(frames[row][col].get(), color, alpha);
- if (verbose) {
- testPrintI(" buf: %p handle: %p color: %s alpha: %f",
- frames[row][col].get(), frames[row][col]->handle,
- string(color).c_str(), alpha);
- }
- }
- }
-}
-
-/*
- * Vector Random Select
- *
- * Prandomly selects and returns num elements from vec.
- */
-template <class T>
-vector<T> vectorRandSelect(const vector<T>& vec, size_t num)
-{
- vector<T> rv = vec;
-
- while (rv.size() > num) {
- rv.erase(rv.begin() + testRandMod(rv.size()));
- }
-
- return rv;
-}
-
-/*
- * Vector Or
- *
- * Or's togethen the values of each element of vec and returns the result.
- */
-template <class T>
-T vectorOr(const vector<T>& vec)
-{
- T rv = 0;
-
- for (size_t n1 = 0; n1 < vec.size(); n1++) {
- rv |= vec[n1];
- }
-
- return rv;
-}
diff --git a/opengl/tests/hwc/hwcTestLib.cpp b/opengl/tests/hwc/hwcTestLib.cpp
deleted file mode 100644
index 28e0c3f..0000000
--- a/opengl/tests/hwc/hwcTestLib.cpp
+++ /dev/null
@@ -1,1030 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Hardware Composer Test Library
- * Utility library functions for use by the Hardware Composer test cases
- */
-
-#include <sstream>
-#include <string>
-
-#include <arpa/inet.h> // For ntohl() and htonl()
-
-#include "hwcTestLib.h"
-
-#include "EGLUtils.h"
-
-// Defines
-#define NUMA(a) (sizeof(a) / sizeof(a [0]))
-
-// Function Prototypes
-static void printGLString(const char *name, GLenum s);
-static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE);
-static void checkGlError(const char* op);
-static void printEGLConfiguration(EGLDisplay dpy, EGLConfig config);
-
-using namespace std;
-using namespace android;
-
-
-#define BITSPERBYTE 8 // TODO: Obtain from <values.h>, once
- // it has been added
-
-// Initialize Display
-void hwcTestInitDisplay(bool verbose, EGLDisplay *dpy, EGLSurface *surface,
- EGLint *width, EGLint *height)
-{
- static EGLContext context;
-
- int rv;
-
- EGLBoolean returnValue;
- EGLConfig myConfig = {0};
- EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- EGLint sConfigAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE };
- EGLint majorVersion, minorVersion;
-
- checkEglError("<init>");
- *dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- checkEglError("eglGetDisplay");
- if (*dpy == EGL_NO_DISPLAY) {
- testPrintE("eglGetDisplay returned EGL_NO_DISPLAY");
- exit(70);
- }
-
- returnValue = eglInitialize(*dpy, &majorVersion, &minorVersion);
- checkEglError("eglInitialize", returnValue);
- if (verbose) {
- testPrintI("EGL version %d.%d", majorVersion, minorVersion);
- }
- if (returnValue != EGL_TRUE) {
- testPrintE("eglInitialize failed");
- exit(71);
- }
-
- EGLNativeWindowType window = android_createDisplaySurface();
- if (window == NULL) {
- testPrintE("android_createDisplaySurface failed");
- exit(72);
- }
- returnValue = EGLUtils::selectConfigForNativeWindow(*dpy,
- sConfigAttribs, window, &myConfig);
- if (returnValue) {
- testPrintE("EGLUtils::selectConfigForNativeWindow() returned %d",
- returnValue);
- exit(73);
- }
- checkEglError("EGLUtils::selectConfigForNativeWindow");
-
- if (verbose) {
- testPrintI("Chose this configuration:");
- printEGLConfiguration(*dpy, myConfig);
- }
-
- *surface = eglCreateWindowSurface(*dpy, myConfig, window, NULL);
- checkEglError("eglCreateWindowSurface");
- if (*surface == EGL_NO_SURFACE) {
- testPrintE("gelCreateWindowSurface failed.");
- exit(74);
- }
-
- context = eglCreateContext(*dpy, myConfig, EGL_NO_CONTEXT, contextAttribs);
- checkEglError("eglCreateContext");
- if (context == EGL_NO_CONTEXT) {
- testPrintE("eglCreateContext failed");
- exit(75);
- }
- returnValue = eglMakeCurrent(*dpy, *surface, *surface, context);
- checkEglError("eglMakeCurrent", returnValue);
- if (returnValue != EGL_TRUE) {
- testPrintE("eglMakeCurrent failed");
- exit(76);
- }
- eglQuerySurface(*dpy, *surface, EGL_WIDTH, width);
- checkEglError("eglQuerySurface");
- eglQuerySurface(*dpy, *surface, EGL_HEIGHT, height);
- checkEglError("eglQuerySurface");
-
- if (verbose) {
- testPrintI("Window dimensions: %d x %d", *width, *height);
-
- printGLString("Version", GL_VERSION);
- printGLString("Vendor", GL_VENDOR);
- printGLString("Renderer", GL_RENDERER);
- printGLString("Extensions", GL_EXTENSIONS);
- }
-}
-
-// Open Hardware Composer Device
-void hwcTestOpenHwc(hwc_composer_device_t **hwcDevicePtr)
-{
- int rv;
- hw_module_t const *hwcModule;
-
- if ((rv = hw_get_module(HWC_HARDWARE_MODULE_ID, &hwcModule)) != 0) {
- testPrintE("hw_get_module failed, rv: %i", rv);
- errno = -rv;
- perror(NULL);
- exit(77);
- }
- if ((rv = hwc_open(hwcModule, hwcDevicePtr)) != 0) {
- testPrintE("hwc_open failed, rv: %i", rv);
- errno = -rv;
- perror(NULL);
- exit(78);
- }
-}
-
-// Color fraction class to string conversion
-ColorFract::operator string()
-{
- ostringstream out;
-
- out << '[' << this->c1() << ", "
- << this->c2() << ", "
- << this->c3() << ']';
-
- return out.str();
-}
-
-// Dimension class to string conversion
-HwcTestDim::operator string()
-{
- ostringstream out;
-
- out << '[' << this->width() << ", "
- << this->height() << ']';
-
- return out.str();
-}
-
-// Dimension class to hwc_rect conversion
-HwcTestDim::operator hwc_rect() const
-{
- hwc_rect rect;
-
- rect.left = rect.top = 0;
-
- rect.right = this->_w;
- rect.bottom = this->_h;
-
- return rect;
-}
-
-// Hardware Composer rectangle to string conversion
-string hwcTestRect2str(const struct hwc_rect& rect)
-{
- ostringstream out;
-
- out << '[';
- out << rect.left << ", ";
- out << rect.top << ", ";
- out << rect.right << ", ";
- out << rect.bottom;
- out << ']';
-
- return out.str();
-}
-
-// Parse HWC rectangle description of form [left, top, right, bottom]
-struct hwc_rect hwcTestParseHwcRect(istringstream& in, bool& error)
-{
- struct hwc_rect rect;
- char chStart, ch;
-
- // Defensively specify that an error occurred. Will clear
- // error flag if all of parsing succeeds.
- error = true;
-
- // First character should be a [ or <
- in >> chStart;
- if (!in || ((chStart != '<') && (chStart != '['))) { return rect; }
-
- // Left
- in >> rect.left;
- if (!in) { return rect; }
- in >> ch;
- if (!in || (ch != ',')) { return rect; }
-
- // Top
- in >> rect.top;
- if (!in) { return rect; }
- in >> ch;
- if (!in || (ch != ',')) { return rect; }
-
- // Right
- in >> rect.right;
- if (!in) { return rect; }
- in >> ch;
- if (!in || (ch != ',')) { return rect; }
-
- // Bottom
- in >> rect.bottom;
- if (!in) { return rect; }
-
- // Closing > or ]
- in >> ch;
- if (!in) { return rect; }
- if (((chStart == '<') && (ch != '>'))
- || ((chStart == '[') && (ch != ']'))) { return rect; }
-
- // Validate right and bottom are greater than left and top
- if ((rect.right <= rect.left) || (rect.bottom <= rect.top)) { return rect; }
-
- // Made It, clear error indicator
- error = false;
-
- return rect;
-}
-
-// Parse dimension of form [width, height]
-HwcTestDim hwcTestParseDim(istringstream& in, bool& error)
-{
- HwcTestDim dim;
- char chStart, ch;
- uint32_t val;
-
- // Defensively specify that an error occurred. Will clear
- // error flag if all of parsing succeeds.
- error = true;
-
- // First character should be a [ or <
- in >> chStart;
- if (!in || ((chStart != '<') && (chStart != '['))) { return dim; }
-
- // Width
- in >> val;
- if (!in) { return dim; }
- dim.setWidth(val);
- in >> ch;
- if (!in || (ch != ',')) { return dim; }
-
- // Height
- in >> val;
- if (!in) { return dim; }
- dim.setHeight(val);
-
- // Closing > or ]
- in >> ch;
- if (!in) { return dim; }
- if (((chStart == '<') && (ch != '>'))
- || ((chStart == '[') && (ch != ']'))) { return dim; }
-
- // Validate width and height greater than 0
- if ((dim.width() <= 0) || (dim.height() <= 0)) { return dim; }
-
- // Made It, clear error indicator
- error = false;
- return dim;
-}
-
-// Parse fractional color of form [0.##, 0.##, 0.##]
-// Fractional values can be from 0.0 to 1.0 inclusive. Note, integer
-// values of 0.0 and 1.0, which are non-fractional, are considered valid.
-// They are an exception, all other valid inputs are fractions.
-ColorFract hwcTestParseColor(istringstream& in, bool& error)
-{
- ColorFract color;
- char chStart, ch;
- float c1, c2, c3;
-
- // Defensively specify that an error occurred. Will clear
- // error flag if all of parsing succeeds.
- error = true;
-
- // First character should be a [ or <
- in >> chStart;
- if (!in || ((chStart != '<') && (chStart != '['))) { return color; }
-
- // 1st Component
- in >> c1;
- if (!in) { return color; }
- if ((c1 < 0.0) || (c1 > 1.0)) { return color; }
- in >> ch;
- if (!in || (ch != ',')) { return color; }
-
- // 2nd Component
- in >> c2;
- if (!in) { return color; }
- if ((c2 < 0.0) || (c2 > 1.0)) { return color; }
- in >> ch;
- if (!in || (ch != ',')) { return color; }
-
- // 3rd Component
- in >> c3;
- if (!in) { return color; }
- if ((c3 < 0.0) || (c3 > 1.0)) { return color; }
-
- // Closing > or ]
- in >> ch;
- if (!in) { return color; }
- if (((chStart == '<') && (ch != '>'))
- || ((chStart == '[') && (ch != ']'))) { return color; }
-
- // Are all the components fractional
- if ((c1 < 0.0) || (c1 > 1.0)
- || (c2 < 0.0) || (c2 > 1.0)
- || (c3 < 0.0) || (c3 > 1.0)) { return color; }
-
- // Made It, clear error indicator
- error = false;
-
- return ColorFract(c1, c2, c3);
-}
-
-// Look up and return pointer to structure with the characteristics
-// of the graphic format named by the desc parameter. Search failure
-// indicated by the return of NULL.
-const struct hwcTestGraphicFormat *hwcTestGraphicFormatLookup(const char *desc)
-{
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- if (string(desc) == string(hwcTestGraphicFormat[n1].desc)) {
- return &hwcTestGraphicFormat[n1];
- }
- }
-
- return NULL;
-}
-
-// Look up and return pointer to structure with the characteristics
-// of the graphic format specified by the id parameter. Search failure
-// indicated by the return of NULL.
-const struct hwcTestGraphicFormat *hwcTestGraphicFormatLookup(uint32_t id)
-{
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- if (id == hwcTestGraphicFormat[n1].format) {
- return &hwcTestGraphicFormat[n1];
- }
- }
-
- return NULL;
-}
-
-
-// Given the integer ID of a graphic format, return a pointer to
-// a string that describes the format.
-const char *hwcTestGraphicFormat2str(uint32_t format)
-{
- const static char *unknown = "unknown";
-
- for (unsigned int n1 = 0; n1 < NUMA(hwcTestGraphicFormat); n1++) {
- if (format == hwcTestGraphicFormat[n1].format) {
- return hwcTestGraphicFormat[n1].desc;
- }
- }
-
- return unknown;
-}
-
-/*
- * hwcTestCreateLayerList
- * Dynamically creates layer list with numLayers worth
- * of hwLayers entries.
- */
-hwc_layer_list_t *hwcTestCreateLayerList(size_t numLayers)
-{
- hwc_layer_list_t *list;
-
- size_t size = sizeof(hwc_layer_list) + numLayers * sizeof(hwc_layer_t);
- if ((list = (hwc_layer_list_t *) calloc(1, size)) == NULL) {
- return NULL;
- }
- list->flags = HWC_GEOMETRY_CHANGED;
- list->numHwLayers = numLayers;
-
- return list;
-}
-
-/*
- * hwcTestFreeLayerList
- * Frees memory previous allocated via hwcTestCreateLayerList().
- */
-void hwcTestFreeLayerList(hwc_layer_list_t *list)
-{
- free(list);
-}
-
-// Display the settings of the layer list pointed to by list
-void hwcTestDisplayList(hwc_layer_list_t *list)
-{
- testPrintI(" flags: %#x%s", list->flags,
- (list->flags & HWC_GEOMETRY_CHANGED) ? " GEOMETRY_CHANGED" : "");
- testPrintI(" numHwLayers: %u", list->numHwLayers);
-
- for (unsigned int layer = 0; layer < list->numHwLayers; layer++) {
- testPrintI(" layer %u compositionType: %#x%s%s", layer,
- list->hwLayers[layer].compositionType,
- (list->hwLayers[layer].compositionType == HWC_FRAMEBUFFER)
- ? " FRAMEBUFFER" : "",
- (list->hwLayers[layer].compositionType == HWC_OVERLAY)
- ? " OVERLAY" : "");
-
- testPrintI(" hints: %#x",
- list->hwLayers[layer].hints,
- (list->hwLayers[layer].hints & HWC_HINT_TRIPLE_BUFFER)
- ? " TRIPLE_BUFFER" : "",
- (list->hwLayers[layer].hints & HWC_HINT_CLEAR_FB)
- ? " CLEAR_FB" : "");
-
- testPrintI(" flags: %#x%s",
- list->hwLayers[layer].flags,
- (list->hwLayers[layer].flags & HWC_SKIP_LAYER)
- ? " SKIP_LAYER" : "");
-
- testPrintI(" handle: %p",
- list->hwLayers[layer].handle);
-
- // Intentionally skipped display of ROT_180 & ROT_270,
- // which are formed from combinations of the other flags.
- testPrintI(" transform: %#x%s%s%s",
- list->hwLayers[layer].transform,
- (list->hwLayers[layer].transform & HWC_TRANSFORM_FLIP_H)
- ? " FLIP_H" : "",
- (list->hwLayers[layer].transform & HWC_TRANSFORM_FLIP_V)
- ? " FLIP_V" : "",
- (list->hwLayers[layer].transform & HWC_TRANSFORM_ROT_90)
- ? " ROT_90" : "");
-
- testPrintI(" blending: %#x%s%s%s",
- list->hwLayers[layer].blending,
- (list->hwLayers[layer].blending == HWC_BLENDING_NONE)
- ? " NONE" : "",
- (list->hwLayers[layer].blending == HWC_BLENDING_PREMULT)
- ? " PREMULT" : "",
- (list->hwLayers[layer].blending == HWC_BLENDING_COVERAGE)
- ? " COVERAGE" : "");
-
- testPrintI(" sourceCrop: %s",
- hwcTestRect2str(list->hwLayers[layer].sourceCrop).c_str());
- testPrintI(" displayFrame: %s",
- hwcTestRect2str(list->hwLayers[layer].displayFrame).c_str());
- testPrintI(" scaleFactor: [%f, %f]",
- (float) (list->hwLayers[layer].sourceCrop.right
- - list->hwLayers[layer].sourceCrop.left)
- / (float) (list->hwLayers[layer].displayFrame.right
- - list->hwLayers[layer].displayFrame.left),
- (float) (list->hwLayers[layer].sourceCrop.bottom
- - list->hwLayers[layer].sourceCrop.top)
- / (float) (list->hwLayers[layer].displayFrame.bottom
- - list->hwLayers[layer].displayFrame.top));
- }
-}
-
-/*
- * Display List Prepare Modifiable
- *
- * Displays the portions of a list that are meant to be modified by
- * a prepare call.
- */
-void hwcTestDisplayListPrepareModifiable(hwc_layer_list_t *list)
-{
- uint32_t numOverlays = 0;
- for (unsigned int layer = 0; layer < list->numHwLayers; layer++) {
- if (list->hwLayers[layer].compositionType == HWC_OVERLAY) {
- numOverlays++;
- }
- testPrintI(" layer %u compositionType: %#x%s%s", layer,
- list->hwLayers[layer].compositionType,
- (list->hwLayers[layer].compositionType == HWC_FRAMEBUFFER)
- ? " FRAMEBUFFER" : "",
- (list->hwLayers[layer].compositionType == HWC_OVERLAY)
- ? " OVERLAY" : "");
- testPrintI(" hints: %#x%s%s",
- list->hwLayers[layer].hints,
- (list->hwLayers[layer].hints & HWC_HINT_TRIPLE_BUFFER)
- ? " TRIPLE_BUFFER" : "",
- (list->hwLayers[layer].hints & HWC_HINT_CLEAR_FB)
- ? " CLEAR_FB" : "");
- }
- testPrintI(" numOverlays: %u", numOverlays);
-}
-
-/*
- * Display List Handles
- *
- * Displays the handles of all the graphic buffers in the list.
- */
-void hwcTestDisplayListHandles(hwc_layer_list_t *list)
-{
- const unsigned int maxLayersPerLine = 6;
-
- ostringstream str(" layers:");
- for (unsigned int layer = 0; layer < list->numHwLayers; layer++) {
- str << ' ' << list->hwLayers[layer].handle;
- if (((layer % maxLayersPerLine) == (maxLayersPerLine - 1))
- && (layer != list->numHwLayers - 1)) {
- testPrintI("%s", str.str().c_str());
- str.str(" ");
- }
- }
- testPrintI("%s", str.str().c_str());
-}
-
-// Returns a uint32_t that contains a format specific representation of a
-// single pixel of the given color and alpha values.
-uint32_t hwcTestColor2Pixel(uint32_t format, ColorFract color, float alpha)
-{
- const struct attrib {
- uint32_t format;
- bool hostByteOrder;
- size_t bytes;
- size_t c1Offset;
- size_t c1Size;
- size_t c2Offset;
- size_t c2Size;
- size_t c3Offset;
- size_t c3Size;
- size_t aOffset;
- size_t aSize;
- } attributes[] = {
- {HAL_PIXEL_FORMAT_RGBA_8888, false, 4, 0, 8, 8, 8, 16, 8, 24, 8},
- {HAL_PIXEL_FORMAT_RGBX_8888, false, 4, 0, 8, 8, 8, 16, 8, 0, 0},
- {HAL_PIXEL_FORMAT_RGB_888, false, 3, 0, 8, 8, 8, 16, 8, 0, 0},
- {HAL_PIXEL_FORMAT_RGB_565, true, 2, 0, 5, 5, 6, 11, 5, 0, 0},
- {HAL_PIXEL_FORMAT_BGRA_8888, false, 4, 16, 8, 8, 8, 0, 8, 24, 8},
- {HAL_PIXEL_FORMAT_RGBA_5551, true , 2, 0, 5, 5, 5, 10, 5, 15, 1},
- {HAL_PIXEL_FORMAT_RGBA_4444, false, 2, 12, 4, 0, 4, 4, 4, 8, 4},
- {HAL_PIXEL_FORMAT_YV12, true, 3, 16, 8, 8, 8, 0, 8, 0, 0},
- };
-
- const struct attrib *attrib;
- for (attrib = attributes; attrib < attributes + NUMA(attributes);
- attrib++) {
- if (attrib->format == format) { break; }
- }
- if (attrib >= attributes + NUMA(attributes)) {
- testPrintE("colorFract2Pixel unsupported format of: %u", format);
- exit(80);
- }
-
- uint32_t pixel;
- pixel = htonl((uint32_t) round((((1 << attrib->c1Size) - 1) * color.c1()))
- << ((sizeof(pixel) * BITSPERBYTE)
- - (attrib->c1Offset + attrib->c1Size)));
- pixel |= htonl((uint32_t) round((((1 << attrib->c2Size) - 1) * color.c2()))
- << ((sizeof(pixel) * BITSPERBYTE)
- - (attrib->c2Offset + attrib->c2Size)));
- pixel |= htonl((uint32_t) round((((1 << attrib->c3Size) - 1) * color.c3()))
- << ((sizeof(pixel) * BITSPERBYTE)
- - (attrib->c3Offset + attrib->c3Size)));
- if (attrib->aSize) {
- pixel |= htonl((uint32_t) round((((1 << attrib->aSize) - 1) * alpha))
- << ((sizeof(pixel) * BITSPERBYTE)
- - (attrib->aOffset + attrib->aSize)));
- }
- if (attrib->hostByteOrder) {
- pixel = ntohl(pixel);
- pixel >>= sizeof(pixel) * BITSPERBYTE - attrib->bytes * BITSPERBYTE;
- }
-
- return pixel;
-}
-
-// Sets the pixel at the given x and y coordinates to the color and alpha
-// value given by pixel. The contents of pixel is format specific. It's
-// value should come from a call to hwcTestColor2Pixel().
-void hwcTestSetPixel(GraphicBuffer *gBuf, unsigned char *buf,
- uint32_t x, uint32_t y, uint32_t pixel)
-{
-
- const struct attrib {
- int format;
- size_t bytes;
- } attributes[] = {
- {HAL_PIXEL_FORMAT_RGBA_8888, 4},
- {HAL_PIXEL_FORMAT_RGBX_8888, 4},
- {HAL_PIXEL_FORMAT_RGB_888, 3},
- {HAL_PIXEL_FORMAT_RGB_565, 2},
- {HAL_PIXEL_FORMAT_BGRA_8888, 4},
- {HAL_PIXEL_FORMAT_RGBA_5551, 2},
- {HAL_PIXEL_FORMAT_RGBA_4444, 2},
- };
-
- if (gBuf->getPixelFormat() == HAL_PIXEL_FORMAT_YV12) {
- uint32_t yPlaneOffset, uPlaneOffset, vPlaneOffset;
- uint32_t yPlaneStride = gBuf->getStride();
- uint32_t uPlaneStride = ((gBuf->getStride() / 2) + 0xf) & ~0xf;
- uint32_t vPlaneStride = uPlaneStride;
- yPlaneOffset = 0;
- vPlaneOffset = yPlaneOffset + yPlaneStride * gBuf->getHeight();
- uPlaneOffset = vPlaneOffset
- + vPlaneStride * (gBuf->getHeight() / 2);
- *(buf + yPlaneOffset + y * yPlaneStride + x) = pixel & 0xff;
- *(buf + uPlaneOffset + (y / 2) * uPlaneStride + (x / 2))
- = (pixel & 0xff00) >> 8;
- *(buf + vPlaneOffset + (y / 2) * vPlaneStride + (x / 2))
- = (pixel & 0xff0000) >> 16;
-
- return;
- }
-
- const struct attrib *attrib;
- for (attrib = attributes; attrib < attributes + NUMA(attributes);
- attrib++) {
- if (attrib->format == gBuf->getPixelFormat()) { break; }
- }
- if (attrib >= attributes + NUMA(attributes)) {
- testPrintE("setPixel unsupported format of: %u",
- gBuf->getPixelFormat());
- exit(90);
- }
-
- memmove(buf + ((gBuf->getStride() * attrib->bytes) * y)
- + (attrib->bytes * x), &pixel, attrib->bytes);
-}
-
-// Fill a given graphic buffer with a uniform color and alpha
-void hwcTestFillColor(GraphicBuffer *gBuf, ColorFract color, float alpha)
-{
- unsigned char* buf = NULL;
- status_t err;
- uint32_t pixel;
-
- pixel = hwcTestColor2Pixel(gBuf->getPixelFormat(), color, alpha);
-
- err = gBuf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
- if (err != 0) {
- testPrintE("hwcTestFillColor lock failed: %d", err);
- exit(100);
- }
-
- for (unsigned int x = 0; x < gBuf->getStride(); x++) {
- for (unsigned int y = 0; y < gBuf->getHeight(); y++) {
- uint32_t val = pixel;
- hwcTestSetPixel(gBuf, buf, x, y, (x < gBuf->getWidth())
- ? pixel : testRand());
- }
- }
-
- err = gBuf->unlock();
- if (err != 0) {
- testPrintE("hwcTestFillColor unlock failed: %d", err);
- exit(101);
- }
-}
-
-// Fill the given buffer with a horizontal blend of colors, with the left
-// side color given by startColor and the right side color given by
-// endColor. The startColor and endColor values are specified in the format
-// given by colorFormat, which might be different from the format of the
-// graphic buffer. When different, a color conversion is done when possible
-// to the graphic format of the graphic buffer. A color of black is
-// produced for cases where the conversion is impossible (e.g. out of gamut
-// values).
-void hwcTestFillColorHBlend(GraphicBuffer *gBuf, uint32_t colorFormat,
- ColorFract startColor, ColorFract endColor)
-{
- status_t err;
- unsigned char* buf = NULL;
- const uint32_t width = gBuf->getWidth();
- const uint32_t height = gBuf->getHeight();
- const uint32_t stride = gBuf->getStride();
-
- err = gBuf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
- if (err != 0) {
- testPrintE("hwcTestFillColorHBlend lock failed: %d", err);
- exit(110);
- }
-
- for (unsigned int x = 0; x < stride; x++) {
- uint32_t pixel;
- if (x < width) {
- ColorFract color(startColor.c1() + (endColor.c1() - startColor.c1())
- * ((float) x / (float) (width - 1)),
- startColor.c2() + (endColor.c2() - startColor.c2())
- * ((float) x / (float) (width - 1)),
- startColor.c3() + (endColor.c3() - startColor.c3())
- * ((float) x / (float) (width - 1)));
-
- // When formats differ, convert colors.
- // Important to not convert when formats are the same, since
- // out of gamut colors are always converted to black.
- if (colorFormat != (uint32_t) gBuf->getPixelFormat()) {
- hwcTestColorConvert(colorFormat, gBuf->getPixelFormat(), color);
- }
- pixel = hwcTestColor2Pixel(gBuf->getPixelFormat(), color, 1.0);
- } else {
- // Fill pad with random values
- pixel = testRand();
- }
-
- for (unsigned int y = 0; y < height; y++) {
- hwcTestSetPixel(gBuf, buf, x, y, pixel);
- }
- }
-
- err = gBuf->unlock();
- if (err != 0) {
- testPrintE("hwcTestFillColorHBlend unlock failed: %d", err);
- exit(111);
- }
-}
-
-/*
- * When possible, converts color specified as a full range value in
- * the fromFormat, into an equivalent full range color in the toFormat.
- * When conversion is impossible (e.g. out of gamut color) a color
- * or black in the full range output format is produced. The input
- * color is given as a fractional color in the parameter named color.
- * The produced color is written over the same parameter used to
- * provide the input color.
- *
- * Each graphic format has 3 color components and each of these
- * components has both a full and in gamut range. This function uses
- * a table that provides the full and in gamut ranges of each of the
- * supported graphic formats. The full range is given by members named
- * c[123]Min to c[123]Max, while the in gamut range is given by members
- * named c[123]Low to c[123]High. In most cases the full and in gamut
- * ranges are equivalent. This occurs when the c[123]Min == c[123]Low and
- * c[123]High == c[123]Max.
- *
- * The input and produced colors are both specified as a fractional amount
- * of the full range. The diagram below provides an overview of the
- * conversion process. The main steps are:
- *
- * 1. Produce black if the input color is out of gamut.
- *
- * 2. Convert the in gamut color into the fraction of the fromFromat
- * in gamut range.
- *
- * 3. Convert from the fraction of the in gamut from format range to
- * the fraction of the in gamut to format range. Produce black
- * if an equivalent color does not exists.
- *
- * 4. Covert from the fraction of the in gamut to format to the
- * fraction of the full range to format.
- *
- * From Format To Format
- * max high high max
- * ----+ +-----------+
- * high \ / \ high
- * ------\-------------+ +-------->
- * \
- * \ +--- black --+
- * \ / \
- * \ / +-->
- * low \ / low
- * -------- ---+-- black --+
- * min low low min
- * ^ ^ ^ ^ ^
- * | | | | |
- * | | | | +-- fraction of full range
- * | | | +-- fraction of valid range
- * | | +-- fromFormat to toFormat color conversion
- * | +-- fraction of valid range
- * +-- fraction of full range
- */
-void hwcTestColorConvert(uint32_t fromFormat, uint32_t toFormat,
- ColorFract& color)
-{
- const struct attrib {
- uint32_t format;
- bool rgb;
- bool yuv;
- int c1Min, c1Low, c1High, c1Max;
- int c2Min, c2Low, c2High, c2Max;
- int c3Min, c3Low, c3High, c3Max;
- } attributes[] = {
- {HAL_PIXEL_FORMAT_RGBA_8888, true, false,
- 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255},
- {HAL_PIXEL_FORMAT_RGBX_8888, true, false,
- 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255},
- {HAL_PIXEL_FORMAT_RGB_888, true, false,
- 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255},
- {HAL_PIXEL_FORMAT_RGB_565, true, false,
- 0, 0, 31, 31, 0, 0, 63, 63, 0, 0, 31, 31},
- {HAL_PIXEL_FORMAT_BGRA_8888, true, false,
- 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255},
- {HAL_PIXEL_FORMAT_RGBA_5551, true, false,
- 0, 0, 31, 31, 0, 0, 31, 31, 0, 0, 31, 31},
- {HAL_PIXEL_FORMAT_RGBA_4444, true, false,
- 0, 0, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15},
- {HAL_PIXEL_FORMAT_YV12, false, true,
- 0, 16, 235, 255, 0, 16, 240, 255, 0, 16, 240, 255},
- };
-
- const struct attrib *fromAttrib;
- for (fromAttrib = attributes; fromAttrib < attributes + NUMA(attributes);
- fromAttrib++) {
- if (fromAttrib->format == fromFormat) { break; }
- }
- if (fromAttrib >= attributes + NUMA(attributes)) {
- testPrintE("hwcTestColorConvert unsupported from format of: %u",
- fromFormat);
- exit(120);
- }
-
- const struct attrib *toAttrib;
- for (toAttrib = attributes; toAttrib < attributes + NUMA(attributes);
- toAttrib++) {
- if (toAttrib->format == toFormat) { break; }
- }
- if (toAttrib >= attributes + NUMA(attributes)) {
- testPrintE("hwcTestColorConvert unsupported to format of: %u",
- toFormat);
- exit(121);
- }
-
- // Produce black if any of the from components are outside the
- // valid color range
- float c1Val = fromAttrib->c1Min
- + ((float) (fromAttrib->c1Max - fromAttrib->c1Min) * color.c1());
- float c2Val = fromAttrib->c2Min
- + ((float) (fromAttrib->c2Max - fromAttrib->c2Min) * color.c2());
- float c3Val = fromAttrib->c3Min
- + ((float) (fromAttrib->c3Max - fromAttrib->c3Min) * color.c3());
- if ((c1Val < fromAttrib->c1Low) || (c1Val > fromAttrib->c1High)
- || (c2Val < fromAttrib->c2Low) || (c2Val > fromAttrib->c2High)
- || (c3Val < fromAttrib->c3Low) || (c3Val > fromAttrib->c3High)) {
-
- // Return black
- // Will use representation of black from RGBA8888 graphic format
- // and recursively convert it to the requested graphic format.
- color = ColorFract(0.0, 0.0, 0.0);
- hwcTestColorConvert(HAL_PIXEL_FORMAT_RGBA_8888, toFormat, color);
- return;
- }
-
- // Within from format, convert from fraction of full range
- // to fraction of valid range
- color = ColorFract((c1Val - fromAttrib->c1Low)
- / (fromAttrib->c1High - fromAttrib->c1Low),
- (c2Val - fromAttrib->c2Low)
- / (fromAttrib->c2High - fromAttrib->c2Low),
- (c3Val - fromAttrib->c3Low)
- / (fromAttrib->c3High - fromAttrib->c3Low));
-
- // If needed perform RGB to YUV conversion
- float wr = 0.2126, wg = 0.7152, wb = 0.0722; // ITU709 recommended constants
- if (fromAttrib->rgb && toAttrib->yuv) {
- float r = color.c1(), g = color.c2(), b = color.c3();
- float y = wr * r + wg * g + wb * b;
- float u = 0.5 * ((b - y) / (1.0 - wb)) + 0.5;
- float v = 0.5 * ((r - y) / (1.0 - wr)) + 0.5;
-
- // Produce black if color is outside the YUV gamut
- if ((y < 0.0) || (y > 1.0)
- || (u < 0.0) || (u > 1.0)
- || (v < 0.0) || (v > 1.0)) {
- y = 0.0;
- u = v = 0.5;
- }
-
- color = ColorFract(y, u, v);
- }
-
- // If needed perform YUV to RGB conversion
- // Equations determined from the ITU709 equations for RGB to YUV
- // conversion, plus the following algebra:
- //
- // u = 0.5 * ((b - y) / (1.0 - wb)) + 0.5
- // 0.5 * ((b - y) / (1.0 - wb)) = u - 0.5
- // (b - y) / (1.0 - wb) = 2 * (u - 0.5)
- // b - y = 2 * (u - 0.5) * (1.0 - wb)
- // b = 2 * (u - 0.5) * (1.0 - wb) + y
- //
- // v = 0.5 * ((r -y) / (1.0 - wr)) + 0.5
- // 0.5 * ((r - y) / (1.0 - wr)) = v - 0.5
- // (r - y) / (1.0 - wr) = 2 * (v - 0.5)
- // r - y = 2 * (v - 0.5) * (1.0 - wr)
- // r = 2 * (v - 0.5) * (1.0 - wr) + y
- //
- // y = wr * r + wg * g + wb * b
- // wr * r + wg * g + wb * b = y
- // wg * g = y - wr * r - wb * b
- // g = (y - wr * r - wb * b) / wg
- if (fromAttrib->yuv && toAttrib->rgb) {
- float y = color.c1(), u = color.c2(), v = color.c3();
- float r = 2.0 * (v - 0.5) * (1.0 - wr) + y;
- float b = 2.0 * (u - 0.5) * (1.0 - wb) + y;
- float g = (y - wr * r - wb * b) / wg;
-
- // Produce black if color is outside the RGB gamut
- if ((r < 0.0) || (r > 1.0)
- || (g < 0.0) || (g > 1.0)
- || (b < 0.0) || (b > 1.0)) {
- r = g = b = 0.0;
- }
-
- color = ColorFract(r, g, b);
- }
-
- // Within to format, convert from fraction of valid range
- // to fraction of full range
- c1Val = (toAttrib->c1Low
- + (float) (toAttrib->c1High - toAttrib->c1Low) * color.c1());
- c2Val = (toAttrib->c1Low
- + (float) (toAttrib->c2High - toAttrib->c2Low) * color.c2());
- c3Val = (toAttrib->c1Low
- + (float) (toAttrib->c3High - toAttrib->c3Low) * color.c3());
- color = ColorFract((float) (c1Val - toAttrib->c1Min)
- / (float) (toAttrib->c1Max - toAttrib->c1Min),
- (float) (c2Val - toAttrib->c2Min)
- / (float) (toAttrib->c2Max - toAttrib->c2Min),
- (float) (c3Val - toAttrib->c3Min)
- / (float) (toAttrib->c3Max - toAttrib->c3Min));
-}
-
-// TODO: Use PrintGLString, CechckGlError, and PrintEGLConfiguration
-// from libglTest
-static void printGLString(const char *name, GLenum s)
-{
- const char *v = (const char *) glGetString(s);
-
- if (v == NULL) {
- testPrintI("GL %s unknown", name);
- } else {
- testPrintI("GL %s = %s", name, v);
- }
-}
-
-static void checkEglError(const char* op, EGLBoolean returnVal)
-{
- if (returnVal != EGL_TRUE) {
- testPrintE("%s() returned %d", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- testPrintE("after %s() eglError %s (0x%x)",
- op, EGLUtils::strerror(error), error);
- }
-}
-
-static void checkGlError(const char* op)
-{
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- testPrintE("after %s() glError (0x%x)", op, error);
- }
-}
-
-static void printEGLConfiguration(EGLDisplay dpy, EGLConfig config)
-{
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute,
- &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- testPrintI(" %s: %d (%#x)", names[j].name, value, value);
- }
- }
- testPrintI("");
-}
diff --git a/opengl/tests/hwc/hwcTestLib.h b/opengl/tests/hwc/hwcTestLib.h
deleted file mode 100644
index b0c3012..0000000
--- a/opengl/tests/hwc/hwcTestLib.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Hardware Composer Test Library Header
- */
-
-#include <sstream>
-#include <string>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicBuffer.h>
-
-#include <utils/Log.h>
-#include <testUtil.h>
-
-#include <hardware/hwcomposer.h>
-
-// Characteristics of known graphic formats
-const struct hwcTestGraphicFormat {
- uint32_t format;
- const char *desc;
- uint32_t wMod, hMod; // Width/height mod this value must equal zero
-} hwcTestGraphicFormat[] = {
- {HAL_PIXEL_FORMAT_RGBA_8888, "RGBA8888", 1, 1},
- {HAL_PIXEL_FORMAT_RGBX_8888, "RGBX8888", 1, 1},
- {HAL_PIXEL_FORMAT_RGB_888, "RGB888", 1, 1},
- {HAL_PIXEL_FORMAT_RGB_565, "RGB565", 1, 1},
- {HAL_PIXEL_FORMAT_BGRA_8888, "BGRA8888", 1, 1},
- {HAL_PIXEL_FORMAT_RGBA_5551, "RGBA5551", 1, 1},
- {HAL_PIXEL_FORMAT_RGBA_4444, "RGBA4444", 1, 1},
- {HAL_PIXEL_FORMAT_YV12, "YV12", 2, 2},
-};
-
-// Represent RGB color as fraction of color components.
-// Each of the color components are expected in the range [0.0, 1.0]
-class ColorFract {
- public:
- ColorFract(): _c1(0.0), _c2(0.0), _c3(0.0) {};
- ColorFract(float c1, float c2, float c3): _c1(c1), _c2(c2), _c3(c3) {};
- float c1(void) const { return _c1; }
- float c2(void) const { return _c2; }
- float c3(void) const { return _c3; }
-
- operator std::string();
-
- private:
- float _c1;
- float _c2;
- float _c3;
-};
-
-// Represent RGB color as fraction of color components.
-// Each of the color components are expected in the range [0.0, 1.0]
-class ColorRGB {
- public:
- ColorRGB(): _r(0.0), _g(0.0), _b(0.0) {};
- ColorRGB(float f): _r(f), _g(f), _b(f) {}; // Gray
- ColorRGB(float r, float g, float b): _r(r), _g(g), _b(b) {};
- float r(void) const { return _r; }
- float g(void) const { return _g; }
- float b(void) const { return _b; }
-
- private:
- float _r;
- float _g;
- float _b;
-};
-
-// Dimension - width and height of a rectanguler area
-class HwcTestDim {
- public:
- HwcTestDim(): _w(0), _h(0) {};
- HwcTestDim(uint32_t w, uint32_t h) : _w(w), _h(h) {}
- uint32_t width(void) const { return _w; }
- uint32_t height(void) const { return _h; }
- void setWidth(uint32_t w) { _w = w; }
- void setHeight(uint32_t h) { _h = h; }
-
- operator std::string();
- operator hwc_rect() const;
-
- private:
- uint32_t _w;
- uint32_t _h;
-};
-
-// Function Prototypes
-void hwcTestInitDisplay(bool verbose, EGLDisplay *dpy, EGLSurface *surface,
- EGLint *width, EGLint *height);
-void hwcTestOpenHwc(hwc_composer_device_t **hwcDevicePtr);
-const struct hwcTestGraphicFormat *hwcTestGraphicFormatLookup(const char *desc);
-const struct hwcTestGraphicFormat *hwcTestGraphicFormatLookup(uint32_t id);
-const char *hwcTestGraphicFormat2str(uint32_t format);
-std::string hwcTestRect2str(const struct hwc_rect& rect);
-
-hwc_layer_list_t *hwcTestCreateLayerList(size_t numLayers);
-void hwcTestFreeLayerList(hwc_layer_list_t *list);
-void hwcTestDisplayList(hwc_layer_list_t *list);
-void hwcTestDisplayListPrepareModifiable(hwc_layer_list_t *list);
-void hwcTestDisplayListHandles(hwc_layer_list_t *list);
-
-uint32_t hwcTestColor2Pixel(uint32_t format, ColorFract color, float alpha);
-void hwcTestColorConvert(uint32_t fromFormat, uint32_t toFormat,
- ColorFract& color);
-void hwcTestSetPixel(android::GraphicBuffer *gBuf, unsigned char *buf,
- uint32_t x, uint32_t y, uint32_t pixel);
-void hwcTestFillColor(android::GraphicBuffer *gBuf, ColorFract color,
- float alpha);
-void hwcTestFillColorHBlend(android::GraphicBuffer *gBuf,
- uint32_t colorFormat,
- ColorFract startColor, ColorFract endColor);
-ColorFract hwcTestParseColor(std::istringstream& in, bool& error);
-struct hwc_rect hwcTestParseHwcRect(std::istringstream& in, bool& error);
-HwcTestDim hwcTestParseDim(std::istringstream& in, bool& error);
diff --git a/opengl/tests/include/EGLUtils.h b/opengl/tests/include/EGLUtils.h
deleted file mode 100644
index 014c261..0000000
--- a/opengl/tests/include/EGLUtils.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-
-#ifndef ANDROID_UI_EGLUTILS_H
-#define ANDROID_UI_EGLUTILS_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <system/window.h>
-#include <utils/Errors.h>
-#include <EGL/egl.h>
-
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class EGLUtils
-{
-public:
-
- static inline const char *strerror(EGLint err);
-
- static inline status_t selectConfigForPixelFormat(
- EGLDisplay dpy,
- EGLint const* attrs,
- int32_t format,
- EGLConfig* outConfig);
-
- static inline status_t selectConfigForNativeWindow(
- EGLDisplay dpy,
- EGLint const* attrs,
- EGLNativeWindowType window,
- EGLConfig* outConfig);
-};
-
-// ----------------------------------------------------------------------------
-
-const char *EGLUtils::strerror(EGLint err)
-{
- switch (err){
- case EGL_SUCCESS: return "EGL_SUCCESS";
- case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
- case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
- case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
- case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
- case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
- case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
- case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
- case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
- case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
- case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
- case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
- case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
- case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
- default: return "UNKNOWN";
- }
-}
-
-status_t EGLUtils::selectConfigForPixelFormat(
- EGLDisplay dpy,
- EGLint const* attrs,
- int32_t format,
- EGLConfig* outConfig)
-{
- EGLint numConfigs = -1, n=0;
-
- if (!attrs)
- return BAD_VALUE;
-
- if (outConfig == NULL)
- return BAD_VALUE;
-
- // Get all the "potential match" configs...
- if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
- return BAD_VALUE;
-
- EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs);
- if (eglChooseConfig(dpy, attrs, configs, numConfigs, &n) == EGL_FALSE) {
- free(configs);
- return BAD_VALUE;
- }
-
- int i;
- EGLConfig config = NULL;
- for (i=0 ; i<n ; i++) {
- EGLint nativeVisualId = 0;
- eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
- if (nativeVisualId>0 && format == nativeVisualId) {
- config = configs[i];
- break;
- }
- }
-
- free(configs);
-
- if (i<n) {
- *outConfig = config;
- return NO_ERROR;
- }
-
- return NAME_NOT_FOUND;
-}
-
-status_t EGLUtils::selectConfigForNativeWindow(
- EGLDisplay dpy,
- EGLint const* attrs,
- EGLNativeWindowType window,
- EGLConfig* outConfig)
-{
- int err;
- int format;
-
- if (!window)
- return BAD_VALUE;
-
- if ((err = window->query(window, NATIVE_WINDOW_FORMAT, &format)) < 0) {
- return err;
- }
-
- return selectConfigForPixelFormat(dpy, attrs, format, outConfig);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_UI_EGLUTILS_H */
diff --git a/opengl/tests/include/glTestLib.h b/opengl/tests/include/glTestLib.h
deleted file mode 100644
index c91c594..0000000
--- a/opengl/tests/include/glTestLib.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Graphics Test Library Header
- */
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include "EGLUtils.h"
-
-void glTestPrintGLString(const char *name, GLenum s);
-void glTestCheckEglError(const char* op, EGLBoolean returnVal = EGL_TRUE);
-void glTestCheckGlError(const char* op);
-void glTestPrintEGLConfiguration(EGLDisplay dpy, EGLConfig config);
diff --git a/opengl/tests/lib/Android.mk b/opengl/tests/lib/Android.mk
deleted file mode 100644
index 0352a37..0000000
--- a/opengl/tests/lib/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2010 The Android Open Source Project
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE:= libglTest
-LOCAL_SRC_FILES:= glTestLib.cpp
-LOCAL_C_INCLUDES += system/extras/tests/include \
- bionic \
- bionic/libstdc++/include \
- external/stlport/stlport \
- $(call include-path-for, opengl-tests-includes)
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport
-
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/opengl/tests/lib/glTestLib.cpp b/opengl/tests/lib/glTestLib.cpp
deleted file mode 100644
index b434fc7..0000000
--- a/opengl/tests/lib/glTestLib.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- *
- */
-
-/*
- * Graphics Test Library
- */
-
-#include <glTestLib.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include "EGLUtils.h"
-
-#include <utils/Log.h>
-#include <testUtil.h>
-
-using namespace std;
-using namespace android;
-
-void glTestPrintGLString(const char *name, GLenum s)
-{
- const char *v = (const char *) glGetString(s);
-
- if (v == NULL) {
- testPrintI("GL %s unknown", name);
- } else {
- testPrintI("GL %s = %s", name, v);
- }
-}
-
-void glTestCheckEglError(const char* op, EGLBoolean returnVal)
-{
- if (returnVal != EGL_TRUE) {
- testPrintE("%s() returned %d", op, returnVal);
- }
-
- for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
- = eglGetError()) {
- testPrintE("after %s() eglError %s (0x%x)",
- op, EGLUtils::strerror(error), error);
- }
-}
-
-void glTestCheckGlError(const char* op)
-{
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- testPrintE("after %s() glError (0x%x)", op, error);
- }
-}
-
-void glTestPrintEGLConfiguration(EGLDisplay dpy, EGLConfig config)
-{
-
-#define X(VAL) {VAL, #VAL}
- struct {EGLint attribute; const char* name;} names[] = {
- X(EGL_BUFFER_SIZE),
- X(EGL_ALPHA_SIZE),
- X(EGL_BLUE_SIZE),
- X(EGL_GREEN_SIZE),
- X(EGL_RED_SIZE),
- X(EGL_DEPTH_SIZE),
- X(EGL_STENCIL_SIZE),
- X(EGL_CONFIG_CAVEAT),
- X(EGL_CONFIG_ID),
- X(EGL_LEVEL),
- X(EGL_MAX_PBUFFER_HEIGHT),
- X(EGL_MAX_PBUFFER_PIXELS),
- X(EGL_MAX_PBUFFER_WIDTH),
- X(EGL_NATIVE_RENDERABLE),
- X(EGL_NATIVE_VISUAL_ID),
- X(EGL_NATIVE_VISUAL_TYPE),
- X(EGL_SAMPLES),
- X(EGL_SAMPLE_BUFFERS),
- X(EGL_SURFACE_TYPE),
- X(EGL_TRANSPARENT_TYPE),
- X(EGL_TRANSPARENT_RED_VALUE),
- X(EGL_TRANSPARENT_GREEN_VALUE),
- X(EGL_TRANSPARENT_BLUE_VALUE),
- X(EGL_BIND_TO_TEXTURE_RGB),
- X(EGL_BIND_TO_TEXTURE_RGBA),
- X(EGL_MIN_SWAP_INTERVAL),
- X(EGL_MAX_SWAP_INTERVAL),
- X(EGL_LUMINANCE_SIZE),
- X(EGL_ALPHA_MASK_SIZE),
- X(EGL_COLOR_BUFFER_TYPE),
- X(EGL_RENDERABLE_TYPE),
- X(EGL_CONFORMANT),
- };
-#undef X
-
- for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
- EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute,
- &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
- testPrintI(" %s: %d (%#x)", names[j].name, value, value);
- }
- }
- testPrintI("");
-}
diff --git a/opengl/tests/lighting1709/Android.mk b/opengl/tests/lighting1709/Android.mk
deleted file mode 100644
index 9563e61..0000000
--- a/opengl/tests/lighting1709/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := LightingTest
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/opengl/tests/lighting1709/AndroidManifest.xml b/opengl/tests/lighting1709/AndroidManifest.xml
deleted file mode 100644
index 6c23d42..0000000
--- a/opengl/tests/lighting1709/AndroidManifest.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.lightingtest">
-
- <application>
- <activity android:name="ClearActivity" android:label="LightingTest">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java b/opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java
deleted file mode 100644
index 3ae8c5c..0000000
--- a/opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.lightingtest;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.app.Activity;
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.MotionEvent;
-
-public class ClearActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mGLView = new ClearGLSurfaceView(this);
- setContentView(mGLView);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mGLView.onPause();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mGLView.onResume();
- }
- private GLSurfaceView mGLView;
-}
-
-class ClearGLSurfaceView extends GLSurfaceView {
- public ClearGLSurfaceView(Context context) {
- super(context);
- mRenderer = new ClearRenderer();
- setRenderer(mRenderer);
- }
-
- ClearRenderer mRenderer;
-}
-
-class ClearRenderer implements GLSurfaceView.Renderer {
- public ClearRenderer() {
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing special.
- }
-
- public void onSurfaceChanged(GL10 gl, int w, int h) {
- // Compute the projection matrix
- gl.glMatrixMode(GL10.GL_PROJECTION);
- gl.glLoadIdentity();
-
- // Compute the boundaries of the frustum
- float fl = (float) (-(w / 2)) / 288;
- float fr = (float) (w / 2) / 288;
- float ft = (float) (h / 2) / 288;
- float fb = (float) (-(h / 2)) / 288;
-
- // Set the view frustum
- gl.glFrustumf(fl, fr, fb, ft, 1.0f, 2000.0f);
-
- // Set the viewport dimensions
- gl.glMatrixMode(GL10.GL_MODELVIEW);
- gl.glLoadIdentity();
- gl.glViewport(0, 0, w, h);
- }
-
- public void onDrawFrame(GL10 gl) {
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
-
- final float lightOff[] = {0.0f, 0.0f, 0.0f, 1.0f};
- final float lightAmbient[] = {5.0f, 0.0f, 0.0f, 1.0f};
- final float lightDiffuse[] = {0.0f, 2.0f, 0.0f, 0.0f};
- final float lightPosSpot[] = {0.0f, 0.0f, -8.0f, 1.0f};
-
- final float pos[] = {
- -5.0f, -1.5f, 0.0f,
- 0.0f, -1.5f, 0.0f,
- 5.0f, -1.5f, 0.0f,
- };
-
- final float v[] = new float[9];
- ByteBuffer vbb = ByteBuffer.allocateDirect(v.length*4);
- vbb.order(ByteOrder.nativeOrder());
- FloatBuffer vb = vbb.asFloatBuffer();
-
- gl.glDisable(GL10.GL_DITHER);
-
- gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lightAmbient, 0);
- gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightDiffuse, 0);
- gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, lightOff, 0);
- gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosSpot, 0);
- gl.glEnable(GL10.GL_LIGHT0);
-
- gl.glEnable(GL10.GL_LIGHTING);
-
-
- gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
- gl.glNormal3f(0, 0, 1);
-
-
- // draw first 3 triangles, without using transforms
- for (int i=0 ; i<3 ; i++) {
- v[0] = -1; v[1] =-1; v[2] = -10;
- v[3] = 0; v[4] = 1; v[5] = -10;
- v[6] = 1; v[7] =-1; v[8] = -10;
- for (int j=0 ; j<3 ; j++) {
- v[j*3+0] -= pos[i*3+0];
- v[j*3+1] -= pos[i*3+1];
- v[j*3+2] -= pos[i*3+2];
- }
- vb.put(v).position(0);
- gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb);
- gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3);
- }
-
- // draw the 2nd batch this time with transforms
- v[0] = -1; v[1] =-1; v[2] = -10;
- v[3] = 0; v[4] = 1; v[5] = -10;
- v[6] = 1; v[7] =-1; v[8] = -10;
- vb.put(v).position(0);
- gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb);
-
- // draw lower left triangle
- gl.glPushMatrix();
- gl.glTranslatef(pos[0], pos[1], pos[2]);
- gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3);
- gl.glPopMatrix();
-
- // draw lower middle triangle
- gl.glPushMatrix();
- gl.glTranslatef(pos[3], pos[4], pos[5]);
- gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3);
- gl.glPopMatrix();
-
- // draw lower right triangle
- gl.glPushMatrix();
- gl.glTranslatef(pos[6], pos[7], pos[8]);
- gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3);
- gl.glPopMatrix();
- }
-
- public int[] getConfigSpec() {
- int[] configSpec = { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
- return configSpec;
- }
-}
-
diff --git a/opengl/tests/linetex/Android.mk b/opengl/tests/linetex/Android.mk
deleted file mode 100644
index 5b6384e..0000000
--- a/opengl/tests/linetex/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- linetex.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-linetex
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/linetex/linetex.cpp b/opengl/tests/linetex/linetex.cpp
deleted file mode 100644
index 8669492..0000000
--- a/opengl/tests/linetex/linetex.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#define LOG_TAG "fillrate"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- EGLint configAttribs[] = {
- EGL_DEPTH_SIZE, 0,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
-
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
- return 0;
- }
-
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- context = eglCreateContext(dpy, config, NULL, NULL);
- eglMakeCurrent(dpy, surface, surface, context);
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
-
- printf("w=%d, h=%d\n", w, h);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glDisable(GL_DITHER);
- glDisable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
-
-
- // default pack-alignment is 4
- const uint16_t t16[64] = { 0xFFFF, 0, 0xF800, 0, 0x07E0, 0, 0x001F, 0 };
-
- const GLfloat vertices[4][2] = {
- { w/2, 0 },
- { w/2, h }
- };
-
- const GLfloat texCoords[4][2] = {
- { 0, 0 },
- { 1, 1 }
- };
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 4, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, t16);
-
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrthof(0, w, 0, h, 0, 1);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
-
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- glDrawArrays(GL_LINES, 0, 2);
- eglSwapBuffers(dpy, surface);
-
- usleep(5*1000000);
-
- eglTerminate(dpy);
-
- return 0;
-}
diff --git a/opengl/tests/swapinterval/Android.mk b/opengl/tests/swapinterval/Android.mk
deleted file mode 100644
index 5517f60..0000000
--- a/opengl/tests/swapinterval/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- swapinterval.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-swapinterval
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/swapinterval/swapinterval.cpp b/opengl/tests/swapinterval/swapinterval.cpp
deleted file mode 100644
index a0f4bc4..0000000
--- a/opengl/tests/swapinterval/swapinterval.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- **
- ** Copyright 2006, The Android Open Source Project
- **
- ** 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLint numConfigs=0;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
-
-
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
- printf("# configs = %d\n", numConfigs);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "error: %s", EGLUtils::strerror(eglGetError()));
- eglTerminate(dpy);
- return 0;
- }
-
- EGLint r,g,b,a, vid;
- eglGetConfigAttrib(dpy, config, EGL_RED_SIZE, &r);
- eglGetConfigAttrib(dpy, config, EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(dpy, config, EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(dpy, config, EGL_ALPHA_SIZE, &a);
- eglGetConfigAttrib(dpy, config, EGL_NATIVE_VISUAL_ID, &vid);
-
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- if (surface == EGL_NO_SURFACE) {
- EGLint err = eglGetError();
- fprintf(stderr, "error: %s, config=%p, format = %d-%d-%d-%d, visual-id = %d\n",
- EGLUtils::strerror(err), config, r,g,b,a, vid);
- eglTerminate(dpy);
- return 0;
- } else {
- printf("config=%p, format = %d-%d-%d-%d, visual-id = %d\n",
- config, r,g,b,a, vid);
- }
-
- context = eglCreateContext(dpy, config, NULL, NULL);
- eglMakeCurrent(dpy, surface, surface, context);
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
-
- printf("w=%d, h=%d\n", w, h);
-
- glDisable(GL_DITHER);
- glEnable(GL_BLEND);
-
- glViewport(0, 0, w, h);
- glOrthof(0, w, 0, h, 0, 1);
-
- eglSwapInterval(dpy, 1);
-
- glClearColor(1,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(dpy, surface);
-
-
- int time = 10;
- printf("screen should flash red/green quickly for %d s...\n", time);
-
- int c = 0;
- nsecs_t start = systemTime();
- nsecs_t t;
- do {
- glClearColor(1,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(dpy, surface);
- glClearColor(0,1,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(dpy, surface);
- t = systemTime() - start;
- c += 2;
- } while (int(ns2s(t))<=time);
-
- double p = (double(t) / c) / 1000000000.0;
- printf("refresh-rate is %f fps (%f ms)\n", 1.0f/p, p*1000.0);
-
- eglTerminate(dpy);
-
- return 0;
-}
diff --git a/opengl/tests/testFramerate/Android.mk b/opengl/tests/testFramerate/Android.mk
deleted file mode 100644
index 500abf3..0000000
--- a/opengl/tests/testFramerate/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#########################################################################
-# Test framerate and look for hiccups
-#########################################################################
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := TestFramerate
-
-include $(BUILD_PACKAGE)
diff --git a/opengl/tests/testFramerate/AndroidManifest.xml b/opengl/tests/testFramerate/AndroidManifest.xml
deleted file mode 100644
index 85617f4..0000000
--- a/opengl/tests/testFramerate/AndroidManifest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.testframerate">
- <uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8" />
-
- <application
- android:label="@string/testFramerate_activity">
- <activity android:name="TestFramerateActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/testFramerate/res/values/strings.xml b/opengl/tests/testFramerate/res/values/strings.xml
deleted file mode 100644
index baadf0e..0000000
--- a/opengl/tests/testFramerate/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="testFramerate_activity">TestFramerate</string>
-
-</resources>
-
diff --git a/opengl/tests/testFramerate/src/com/android/testframerate/TestFramerateActivity.java b/opengl/tests/testFramerate/src/com/android/testframerate/TestFramerateActivity.java
deleted file mode 100644
index cbe279b..0000000
--- a/opengl/tests/testFramerate/src/com/android/testframerate/TestFramerateActivity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.testframerate;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-import java.io.File;
-
-
-public class TestFramerateActivity extends Activity {
-
- TestFramerateView mView;
-
- @Override protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new TestFramerateView(getApplication());
- setContentView(mView);
- mView.setFocusableInTouchMode(true);
- }
-
- @Override protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/testFramerate/src/com/android/testframerate/TestFramerateView.java b/opengl/tests/testFramerate/src/com/android/testframerate/TestFramerateView.java
deleted file mode 100644
index f3fb5de..0000000
--- a/opengl/tests/testFramerate/src/com/android/testframerate/TestFramerateView.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.testframerate;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.os.SystemProperties;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.opengl.GLES20;
-
-class TestFramerateView extends GLSurfaceView {
- private static String TAG = "TestFramerateView";
-
- public TestFramerateView(Context context) {
- super(context);
- setEGLContextClientVersion(2);
- setRenderer(new Renderer());
- }
-
- private long mLastTime_us = 0;
- private long mNumShortFramesElapsed = 0;
- private void registerTime(long now_us) {
- long longFrameTime_ms = Integer.parseInt(SystemProperties.get("debug.longframe_ms", "16"));
- long elapsedTime_us = now_us - mLastTime_us;
- float fps = 1000000.f / elapsedTime_us;
- if (mLastTime_us > 0 && elapsedTime_us > longFrameTime_ms*1000) {
- Log.v(TAG, "Long frame: " + elapsedTime_us/1000.f + " ms (" + fps + " fps)");
- if (mNumShortFramesElapsed > 0) {
- Log.v(TAG, " Short frames since last long frame: " + mNumShortFramesElapsed);
- mNumShortFramesElapsed = 0;
- }
- } else {
- ++mNumShortFramesElapsed;
- }
-
- mLastTime_us = now_us;
- }
-
- private class Renderer implements GLSurfaceView.Renderer {
- public Renderer() {
- }
-
-
- public void onDrawFrame(GL10 gl) {
- long now_us = System.nanoTime() / 1000;
- registerTime(now_us);
-
- float red = (now_us % 1000000) / 1000000.f;
- float green = (now_us % 2000000) / 2000000.f;
- float blue = (now_us % 3000000) / 3000000.f;
- GLES20.glClearColor(red, green, blue, 1.0f);
- GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GLES20.glViewport(0, 0, width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- }
-
- }
-}
diff --git a/opengl/tests/testLatency/Android.mk b/opengl/tests/testLatency/Android.mk
deleted file mode 100644
index 96417c7..0000000
--- a/opengl/tests/testLatency/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-#########################################################################
-# Test end-to-end latency.
-#########################################################################
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SDK_VERSION := 8
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := TestLatency
-
-include $(BUILD_PACKAGE)
diff --git a/opengl/tests/testLatency/AndroidManifest.xml b/opengl/tests/testLatency/AndroidManifest.xml
deleted file mode 100644
index 59f2643..0000000
--- a/opengl/tests/testLatency/AndroidManifest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.testlatency">
- <uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8" />
-
- <application
- android:label="@string/testLatency_activity">
- <activity android:name="TestLatencyActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/testLatency/res/values/strings.xml b/opengl/tests/testLatency/res/values/strings.xml
deleted file mode 100644
index d80b77c..0000000
--- a/opengl/tests/testLatency/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="testLatency_activity">TestLatency</string>
-
-</resources>
-
diff --git a/opengl/tests/testLatency/src/com/android/testlatency/TestLatencyActivity.java b/opengl/tests/testLatency/src/com/android/testlatency/TestLatencyActivity.java
deleted file mode 100644
index ed993cb..0000000
--- a/opengl/tests/testLatency/src/com/android/testlatency/TestLatencyActivity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.testlatency;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-import java.io.File;
-
-
-public class TestLatencyActivity extends Activity {
-
- TestLatencyView mView;
-
- @Override protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new TestLatencyView(getApplication());
- setContentView(mView);
- mView.setFocusableInTouchMode(true);
- }
-
- @Override protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/testLatency/src/com/android/testlatency/TestLatencyView.java b/opengl/tests/testLatency/src/com/android/testlatency/TestLatencyView.java
deleted file mode 100644
index d62bf17..0000000
--- a/opengl/tests/testLatency/src/com/android/testlatency/TestLatencyView.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.testlatency;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.opengl.GLES20;
-
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class TestLatencyView extends GLSurfaceView {
- private static String TAG = "TestLatencyiew";
- private float mX;
- private float mY;
- private float mDX;
- private float mDY;
- private long mT;
- private long mDT;
-
- public TestLatencyView(Context context) {
- super(context);
- setEGLContextClientVersion(2);
- setRenderer(new Renderer());
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_MOVE:
- float x = event.getX();
- float y = event.getY();
- long t = event.getEventTime();
- synchronized(this) {
- mDT = t - mT;
- mT = t;
- mDX = x - mX;
- mX = x;
- mDY = y - mY;
- mY = y;
- }
- break;
- default:
- break;
- }
- return true;
- }
-
- private class Renderer implements GLSurfaceView.Renderer {
- private float mScaleX, mScaleY, mOffsetX, mOffsetY;
- private final float MS_PER_FRAME = 1000 / 60;
- public Renderer() {
- mTriangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length * 4)
- .order(ByteOrder.nativeOrder()).asFloatBuffer();
- }
-
-
- public void onDrawFrame(GL10 gl) {
- GLES20.glClearColor(0.4f, 0.4f, 0.4f, 1.0f);
- GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
- GLES20.glUseProgram(mProgram);
- checkGlError("glUseProgram");
-
- float x, y, dx, dy;
- long t, dt;
- synchronized(TestLatencyView.this) {
- x = mX;
- y = mY;
- dx = mDX;
- dy = mDY;
- dt = mDT;
- }
-
- if (dt > 0) {
- dx = dx * MS_PER_FRAME / dt;
- dy = dy * MS_PER_FRAME / dt;
- }
-
- GLES20.glEnableVertexAttribArray(mvPositionHandle);
- checkGlError("glEnableVertexAttribArray");
- GLES20.glEnableVertexAttribArray(mvColorHandle);
- checkGlError("glEnableVertexAttribArray");
- for(int step = 0; step < 8; step++) {
- float sx = (x + dx * step) * mScaleX + mOffsetX;
- float sy = (y + dy * step) * mScaleY + mOffsetY;
- int cbase = step * 4;
-
- for (int i = 0; i < mTriangleVerticesData.length; i += 6) {
- mTriangleVerticesData2[i] = sx + mTriangleVerticesData[i];
- mTriangleVerticesData2[i+1] = -sy + mTriangleVerticesData[i+1];
- mTriangleVerticesData2[i+2] = mColors[cbase];
- mTriangleVerticesData2[i+3] = mColors[cbase+1];
- mTriangleVerticesData2[i+4] = mColors[cbase+2];
- mTriangleVerticesData2[i+5] = mColors[cbase+3];
- }
- mTriangleVertices.position(0);
- mTriangleVertices.put(mTriangleVerticesData2).position(0);
-
- GLES20.glVertexAttribPointer(mvPositionHandle, 2, GLES20.GL_FLOAT, false, 6*4, mTriangleVertices);
- checkGlError("glVertexAttribPointer mvPosition");
- mTriangleVertices.put(mTriangleVerticesData2).position(2);
- GLES20.glVertexAttribPointer(mvColorHandle, 4, GLES20.GL_FLOAT, false, 6*4, mTriangleVertices);
- checkGlError("glVertexAttribPointer mvColor");
- GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
- checkGlError("glDrawArrays");
- }
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- GLES20.glViewport(0, 0, width, height);
- mScaleX = 2.0f / width;
- mScaleY = 2.0f / height;
- mOffsetX = -1f;
- mOffsetY = -1f;
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- mProgram = createProgram(mVertexShader, mFragmentShader);
- if (mProgram == 0) {
- return;
- }
- mvPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
- checkGlError("glGetAttribLocation");
- if (mvPositionHandle == -1) {
- throw new RuntimeException("Could not get attrib location for vPosition");
- }
- mvColorHandle = GLES20.glGetAttribLocation(mProgram, "aColor");
- checkGlError("glGetAttribLocation");
- if (mvColorHandle == -1) {
- throw new RuntimeException("Could not get attrib location for vColor");
- }
- }
-
- private int loadShader(int shaderType, String source) {
- int shader = GLES20.glCreateShader(shaderType);
- if (shader != 0) {
- GLES20.glShaderSource(shader, source);
- GLES20.glCompileShader(shader);
- int[] compiled = new int[1];
- GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
- if (compiled[0] == 0) {
- Log.e(TAG, "Could not compile shader " + shaderType + ":");
- Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
- GLES20.glDeleteShader(shader);
- shader = 0;
- }
- }
- return shader;
- }
-
- private int createProgram(String vertexSource, String fragmentSource) {
- int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
- if (vertexShader == 0) {
- return 0;
- }
-
- int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
- if (pixelShader == 0) {
- return 0;
- }
-
- int program = GLES20.glCreateProgram();
- if (program != 0) {
- GLES20.glAttachShader(program, vertexShader);
- checkGlError("glAttachShader vertexShader");
- GLES20.glAttachShader(program, pixelShader);
- checkGlError("glAttachShader pixelShader");
- GLES20.glLinkProgram(program);
- int[] linkStatus = new int[1];
- GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
- if (linkStatus[0] != GLES20.GL_TRUE) {
- Log.e(TAG, "Could not link program: ");
- Log.e(TAG, GLES20.glGetProgramInfoLog(program));
- GLES20.glDeleteProgram(program);
- program = 0;
- }
- }
- return program;
- }
-
- private void checkGlError(String op) {
- int error;
- while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
- Log.e(TAG, op + ": glError " + error);
- throw new RuntimeException(op + ": glError " + error);
- }
- }
-
- // X, Y, R G B A
- private final float[] mTriangleVerticesData = {
- -0.025f, 0.3f, 0.0f, 1.0f, 0.0f, 1.0f,
- 0.0f , 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,
- 0.025f, 0.3f, 1.0f, 1.0f, 255.0f, 1.0f
- };
-
- // Color cascade:
- private final float[] mColors = {
- 0.0f, 0.0f, 0.0f, 1.0f,
- 0.5f, 0.0f, 0.0f, 1.0f,
- 0.0f, 0.5f, 0.0f, 1.0f,
- 0.5f, 0.5f, 0.0f, 1.0f,
-
- 0.0f, 0.0f, 0.5f, 1.0f,
- 1.0f, 0.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 1.0f, 1.0f,
- 0.0f, 1.0f, 0.0f, 1.0f
- };
-
- private float[] mTriangleVerticesData2 = new float[mTriangleVerticesData.length];
- private FloatBuffer mTriangleVertices;
-
- private final String mVertexShader = "attribute vec4 aPosition;\n"
- + "attribute vec4 aColor;\n"
- + "varying vec4 vColor;\n"
- + "void main() {\n"
- + " gl_Position = aPosition;\n"
- + " vColor = aColor;\n"
- + "}\n";
-
- private final String mFragmentShader = "precision mediump float;\n"
- + "varying vec4 vColor;\n"
- + "void main() {\n"
- + " gl_FragColor = vColor;\n"
- + "}\n";
-
- private int mProgram;
- private int mvPositionHandle;
- private int mvColorHandle;
-
- }
-}
-
diff --git a/opengl/tests/testPauseResume/Android.mk b/opengl/tests/testPauseResume/Android.mk
deleted file mode 100644
index cf8bdc3..0000000
--- a/opengl/tests/testPauseResume/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#########################################################################
-# OpenGL ES JNI sample
-# This makefile builds both an activity and a shared library.
-#########################################################################
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := TestEGL
-
-include $(BUILD_PACKAGE)
diff --git a/opengl/tests/testPauseResume/AndroidManifest.xml b/opengl/tests/testPauseResume/AndroidManifest.xml
deleted file mode 100644
index 1879bc3..0000000
--- a/opengl/tests/testPauseResume/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.test">
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <application
- android:label="@string/test_activity">
- <activity android:name="TestActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:launchMode="singleTask"
- android:screenOrientation="landscape"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/testPauseResume/README b/opengl/tests/testPauseResume/README
deleted file mode 100644
index 87db74a..0000000
--- a/opengl/tests/testPauseResume/README
+++ /dev/null
@@ -1,37 +0,0 @@
-Repro steps:
-
-build, install and run the attached test program TestEgl.apk
-
-The program does not draw anything to the screen, it just prints to the log, so use adb logcat to watch the output.
-
-Expected behavior:
-
-constantly increasing "step" count:
-
-
-W/TestActivity( 1885): ****** step 235 resume
-W/TestActivity( 1885): step 236 pause
-W/TestActivity( 1885): ****** step 236 resume
-
-and so on.
-
-Actual behavior:
-
-W/TestActivity( 1466): ****** step 25 resume
-W/TestActivity( 1466): step 26 pause
-W/TestActivity( 1466): ****** step 26 resume
-W/dalvikvm( 1466): threadid=8: thread exiting with uncaught exception (group=0x4001d7f0)
-E/AndroidRuntime( 1466): FATAL EXCEPTION: GLThread 9
-E/AndroidRuntime( 1466): java.lang.RuntimeException: createContext failed: EGL_BAD_ALLOC
-E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1067)
-E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1059)
-E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:925)
-E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1236)
-E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1106)
-W/TestActivity( 1466): step 27 pause
-W/TestActivity( 1466): ****** step 27 resume
-W/TestActivity( 1466): step 28 pause
-W/TestActivity( 1466): ****** step 28 resume
-
-
-See http://b/issue?id=2550745 for further details.
diff --git a/opengl/tests/testPauseResume/res/values/strings.xml b/opengl/tests/testPauseResume/res/values/strings.xml
deleted file mode 100644
index b4c98fe2..0000000
--- a/opengl/tests/testPauseResume/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="test_activity">Test Egl</string>
-
-</resources>
-
diff --git a/opengl/tests/testPauseResume/src/com/android/test/TestActivity.java b/opengl/tests/testPauseResume/src/com/android/test/TestActivity.java
deleted file mode 100644
index 9dc71321..0000000
--- a/opengl/tests/testPauseResume/src/com/android/test/TestActivity.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.test;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-
-public class TestActivity extends Activity {
- private final static String TAG = "TestActivity";
- TestView mView;
- boolean mToggle;
- int mCount;
- final static int PAUSE_DELAY = 100;
- Runnable mRunnable = new Runnable() {
- public void run() {
- if (mToggle) {
- Log.w(TAG, "****** step " + mCount + " resume");
- mCount++;
- mView.onResume();
- } else {
- Log.w(TAG, "step " + mCount + " pause");
- mView.onPause();
- }
- mToggle = ! mToggle;
- mView.postDelayed(mRunnable, PAUSE_DELAY);
- }
- };
-
- @Override
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new TestView(getApplication());
- mView.setFocusableInTouchMode(true);
- setContentView(mView);
- mView.postDelayed(mRunnable, PAUSE_DELAY);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/testPauseResume/src/com/android/test/TestView.java b/opengl/tests/testPauseResume/src/com/android/test/TestView.java
deleted file mode 100644
index 8c28f13..0000000
--- a/opengl/tests/testPauseResume/src/com/android/test/TestView.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.test;
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class TestView extends GLSurfaceView {
- TestView(Context context) {
- super(context);
- init();
- }
-
- public TestView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
- }
-
- private void init() {
- setRenderer(new Renderer());
- }
-
- private class Renderer implements GLSurfaceView.Renderer {
- private static final String TAG = "Renderer";
- public void onDrawFrame(GL10 gl) {
- // Do nothing.
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- // Do nothing.
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing.
- }
- }
-}
-
diff --git a/opengl/tests/testViewport/Android.mk b/opengl/tests/testViewport/Android.mk
deleted file mode 100644
index 9980e7d..0000000
--- a/opengl/tests/testViewport/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#########################################################################
-# OpenGL ES JNI sample
-# This makefile builds both an activity and a shared library.
-#########################################################################
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := TestViewport
-
-# Set a specific SDK version so we can run on Froyo.
-
-LOCAL_SDK_VERSION := 8
-
-include $(BUILD_PACKAGE)
diff --git a/opengl/tests/testViewport/AndroidManifest.xml b/opengl/tests/testViewport/AndroidManifest.xml
deleted file mode 100644
index ba178bb..0000000
--- a/opengl/tests/testViewport/AndroidManifest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.test">
- <uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8" />
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <application
- android:label="@string/test_activity">
- <activity android:name="TestActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/opengl/tests/testViewport/README b/opengl/tests/testViewport/README
deleted file mode 100644
index c06abc9..0000000
--- a/opengl/tests/testViewport/README
+++ /dev/null
@@ -1,28 +0,0 @@
-Repro steps:
-
-build, install and run the attached test program TestViewport.apk
-
-Run on Sapphire with Froyo.
-
-The program clears the screen to blue, then draws a full screen white quad that
-is alligned to the screen.
-(Therefore the whole screen should appear to be white.)
-
-
-Note that screen is all white.
-
-Rotate screen 90 degrees.
-
-Expected: screen is still all white.
-
-Actual: screen is blue with offset white rectangle.
-
-This bug only happens on Sapphire, it works correctly on Passion.
-
-What happens:
-
-I think the bug is that the gl.glViewport() call in onSurfaceChanged() is
-being ignored by the OpenGL driver.
-
-NOTE: If a gl.glViewport call is added at the beginning of the onDrawFrame()
-call (which means it is called before every draw), the program runs correctly.
diff --git a/opengl/tests/testViewport/res/values/strings.xml b/opengl/tests/testViewport/res/values/strings.xml
deleted file mode 100644
index c037a7c..0000000
--- a/opengl/tests/testViewport/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 The Android Open Source Project
-
- 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="test_activity">Test Viewport</string>
-
-</resources>
-
diff --git a/opengl/tests/testViewport/src/com/android/test/TestActivity.java b/opengl/tests/testViewport/src/com/android/test/TestActivity.java
deleted file mode 100644
index cc7e450..0000000
--- a/opengl/tests/testViewport/src/com/android/test/TestActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.test;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-
-public class TestActivity extends Activity {
- private final static String TAG = "TestActivity";
- TestView mView;
-
- @Override
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mView = new TestView(getApplication());
- mView.setFocusableInTouchMode(true);
- setContentView(mView);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-}
diff --git a/opengl/tests/testViewport/src/com/android/test/TestView.java b/opengl/tests/testViewport/src/com/android/test/TestView.java
deleted file mode 100644
index 23cc37d..0000000
--- a/opengl/tests/testViewport/src/com/android/test/TestView.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-package com.android.test;
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.CharBuffer;
-import java.nio.FloatBuffer;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL;
-import javax.microedition.khronos.opengles.GL10;
-import javax.microedition.khronos.opengles.GL11;
-/**
- * An implementation of SurfaceView that uses the dedicated surface for
- * displaying an OpenGL animation. This allows the animation to run in a
- * separate thread, without requiring that it be driven by the update mechanism
- * of the view hierarchy.
- *
- * The application-specific rendering code is delegated to a GLView.Renderer
- * instance.
- */
-class TestView extends GLSurfaceView {
- TestView(Context context) {
- super(context);
- init();
- }
-
- public TestView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
- }
-
- private void init() {
- setRenderer(new Renderer());
- setRenderMode(RENDERMODE_WHEN_DIRTY);
- }
-
- /** A grid is a topologically rectangular array of vertices.
- *
- * The vertex and index data are held in VBO objects because on most
- * GPUs VBO objects are the fastest way of rendering static vertex
- * and index data.
- *
- */
-
- private static class Grid {
- // Size of vertex data elements in bytes:
- final static int FLOAT_SIZE = 4;
- final static int CHAR_SIZE = 2;
-
- // Vertex structure:
- // float x, y, z;
-
- final static int VERTEX_SIZE = 3 * FLOAT_SIZE;
-
- private int mVertexBufferObjectId;
- private int mElementBufferObjectId;
-
- // These buffers are used to hold the vertex and index data while
- // constructing the grid. Once createBufferObjects() is called
- // the buffers are nulled out to save memory.
-
- private ByteBuffer mVertexByteBuffer;
- private FloatBuffer mVertexBuffer;
- private CharBuffer mIndexBuffer;
-
- private int mW;
- private int mH;
- private int mIndexCount;
-
- public Grid(int w, int h) {
- if (w < 0 || w >= 65536) {
- throw new IllegalArgumentException("w");
- }
- if (h < 0 || h >= 65536) {
- throw new IllegalArgumentException("h");
- }
- if (w * h >= 65536) {
- throw new IllegalArgumentException("w * h >= 65536");
- }
-
- mW = w;
- mH = h;
- int size = w * h;
-
- mVertexByteBuffer = ByteBuffer.allocateDirect(VERTEX_SIZE * size)
- .order(ByteOrder.nativeOrder());
- mVertexBuffer = mVertexByteBuffer.asFloatBuffer();
-
- int quadW = mW - 1;
- int quadH = mH - 1;
- int quadCount = quadW * quadH;
- int indexCount = quadCount * 6;
- mIndexCount = indexCount;
- mIndexBuffer = ByteBuffer.allocateDirect(CHAR_SIZE * indexCount)
- .order(ByteOrder.nativeOrder()).asCharBuffer();
-
- /*
- * Initialize triangle list mesh.
- *
- * [0]-----[ 1] ...
- * | / |
- * | / |
- * | / |
- * [w]-----[w+1] ...
- * | |
- *
- */
-
- {
- int i = 0;
- for (int y = 0; y < quadH; y++) {
- for (int x = 0; x < quadW; x++) {
- char a = (char) (y * mW + x);
- char b = (char) (y * mW + x + 1);
- char c = (char) ((y + 1) * mW + x);
- char d = (char) ((y + 1) * mW + x + 1);
-
- mIndexBuffer.put(i++, a);
- mIndexBuffer.put(i++, c);
- mIndexBuffer.put(i++, b);
-
- mIndexBuffer.put(i++, b);
- mIndexBuffer.put(i++, c);
- mIndexBuffer.put(i++, d);
- }
- }
- }
-
- }
-
- public void set(int i, int j, float x, float y, float z) {
- if (i < 0 || i >= mW) {
- throw new IllegalArgumentException("i");
- }
- if (j < 0 || j >= mH) {
- throw new IllegalArgumentException("j");
- }
-
- int index = mW * j + i;
-
- mVertexBuffer.position(index * VERTEX_SIZE / FLOAT_SIZE);
- mVertexBuffer.put(x);
- mVertexBuffer.put(y);
- mVertexBuffer.put(z);
- }
-
- public void createBufferObjects(GL gl) {
- // Generate a the vertex and element buffer IDs
- int[] vboIds = new int[2];
- GL11 gl11 = (GL11) gl;
- gl11.glGenBuffers(2, vboIds, 0);
- mVertexBufferObjectId = vboIds[0];
- mElementBufferObjectId = vboIds[1];
-
- // Upload the vertex data
- gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId);
- mVertexByteBuffer.position(0);
- gl11.glBufferData(GL11.GL_ARRAY_BUFFER, mVertexByteBuffer.capacity(), mVertexByteBuffer, GL11.GL_STATIC_DRAW);
-
- gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId);
- mIndexBuffer.position(0);
- gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer.capacity() * CHAR_SIZE, mIndexBuffer, GL11.GL_STATIC_DRAW);
-
- // We don't need the in-memory data any more
- mVertexBuffer = null;
- mVertexByteBuffer = null;
- mIndexBuffer = null;
- }
-
- public void draw(GL10 gl) {
- GL11 gl11 = (GL11) gl;
-
- gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
-
- gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId);
- gl11.glVertexPointer(3, GL10.GL_FLOAT, VERTEX_SIZE, 0);
-
- gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId);
- gl11.glDrawElements(GL10.GL_TRIANGLES, mIndexCount, GL10.GL_UNSIGNED_SHORT, 0);
- gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
- gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
- gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
- }
- }
-
-
- private class Renderer implements GLSurfaceView.Renderer {
- private static final String TAG = "Renderer";
- private Grid mGrid;
-
- public void onDrawFrame(GL10 gl) {
- gl.glClearColor(0,0,1,1);
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
- mGrid.draw(gl);
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- gl.glViewport(0, 0, width, height);
- gl.glMatrixMode(GL11.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glOrthof(0, width, height, 0, -1, 1);
- gl.glMatrixMode(GL11.GL_MODELVIEW);
- createGrid(gl, width, height);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- }
-
- private void createGrid(GL10 gl, float w, float h) {
- mGrid = new Grid(2, 2);
- for (int j = 0; j < 2; j++) {
- for (int i = 0; i < 2; i++) {
- float x = w * i;
- float y = h * j;
- float z = 0.0f;
- mGrid.set(i,j, x, y, z);
- }
- }
- mGrid.createBufferObjects(gl);
- }
- }
-}
-
diff --git a/opengl/tests/textures/Android.mk b/opengl/tests/textures/Android.mk
deleted file mode 100644
index 97697d7..0000000
--- a/opengl/tests/textures/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- textures.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-textures
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/textures/textures.cpp b/opengl/tests/textures/textures.cpp
deleted file mode 100644
index 5d3d94e..0000000
--- a/opengl/tests/textures/textures.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- EGLint configAttribs[] = {
- EGL_DEPTH_SIZE, 0,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
-
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
- return 0;
- }
-
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- context = eglCreateContext(dpy, config, NULL, NULL);
- eglMakeCurrent(dpy, surface, surface, context);
- eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
- GLint dim = w<h ? w : h;
-
-
- GLint crop[4] = { 0, 4, 4, -4 };
- glBindTexture(GL_TEXTURE_2D, 0);
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
-
- // packing is always 4
- uint8_t t8[] = {
- 0x00, 0x55, 0x00, 0x55,
- 0xAA, 0xFF, 0xAA, 0xFF,
- 0x00, 0x55, 0x00, 0x55,
- 0xAA, 0xFF, 0xAA, 0xFF };
-
- uint16_t t16[] = {
- 0x0000, 0x5555, 0x0000, 0x5555,
- 0xAAAA, 0xFFFF, 0xAAAA, 0xFFFF,
- 0x0000, 0x5555, 0x0000, 0x5555,
- 0xAAAA, 0xFFFF, 0xAAAA, 0xFFFF };
-
- uint16_t t5551[] = {
- 0x0000, 0xFFFF, 0x0000, 0xFFFF,
- 0xFFFF, 0x0000, 0xFFFF, 0x0000,
- 0x0000, 0xFFFF, 0x0000, 0xFFFF,
- 0xFFFF, 0x0000, 0xFFFF, 0x0000 };
-
- uint32_t t32[] = {
- 0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFFFF0000,
- 0xFF00FF00, 0xFFFF0000, 0xFF000000, 0xFF0000FF,
- 0xFF00FFFF, 0xFF00FF00, 0x00FF00FF, 0xFFFFFF00,
- 0xFF000000, 0xFFFF00FF, 0xFF00FFFF, 0xFFFFFFFF
- };
-
-
- glClear(GL_COLOR_BUFFER_BIT);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, t8);
- glDrawTexiOES(0, 0, 0, dim/2, dim/2);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, t16);
- glDrawTexiOES(dim/2, 0, 0, dim/2, dim/2);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, t16);
- glDrawTexiOES(0, dim/2, 0, dim/2, dim/2);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, t32);
- glDrawTexiOES(dim/2, dim/2, 0, dim/2, dim/2);
-
- eglSwapBuffers(dpy, surface);
- return 0;
-}
diff --git a/opengl/tests/tritex/Android.mk b/opengl/tests/tritex/Android.mk
deleted file mode 100644
index 89faa87..0000000
--- a/opengl/tests/tritex/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- tritex.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-tritex
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/tritex/tritex.cpp b/opengl/tests/tritex/tritex.cpp
deleted file mode 100644
index f183483..0000000
--- a/opengl/tests/tritex/tritex.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-// Calls glDrawElements() the number of times specified by
-// ITERATIONS. Should draw a checkerboard on the screen after
-// a few seconds.
-//
-// Ported from a Java version by Google.
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-using namespace android;
-
-EGLDisplay eglDisplay;
-EGLSurface eglSurface;
-EGLContext eglContext;
-GLuint texture;
-
-#define FIXED_ONE 0x10000
-#define ITERATIONS 50
-
-int init_gl_surface(void);
-void free_gl_surface(void);
-void init_scene(void);
-void render(int quads);
-void create_texture(void);
-int readTimer(void);
-
-static void gluLookAt(float eyeX, float eyeY, float eyeZ,
- float centerX, float centerY, float centerZ, float upX, float upY,
- float upZ)
-{
- // See the OpenGL GLUT documentation for gluLookAt for a description
- // of the algorithm. We implement it in a straightforward way:
-
- float fx = centerX - eyeX;
- float fy = centerY - eyeY;
- float fz = centerZ - eyeZ;
-
- // Normalize f
- float rlf = 1.0f / sqrtf(fx*fx + fy*fy + fz*fz);
- fx *= rlf;
- fy *= rlf;
- fz *= rlf;
-
- // Normalize up
- float rlup = 1.0f / sqrtf(upX*upX + upY*upY + upZ*upZ);
- upX *= rlup;
- upY *= rlup;
- upZ *= rlup;
-
- // compute s = f x up (x means "cross product")
-
- float sx = fy * upZ - fz * upY;
- float sy = fz * upX - fx * upZ;
- float sz = fx * upY - fy * upX;
-
- // compute u = s x f
- float ux = sy * fz - sz * fy;
- float uy = sz * fx - sx * fz;
- float uz = sx * fy - sy * fx;
-
- float m[16] ;
- m[0] = sx;
- m[1] = ux;
- m[2] = -fx;
- m[3] = 0.0f;
-
- m[4] = sy;
- m[5] = uy;
- m[6] = -fy;
- m[7] = 0.0f;
-
- m[8] = sz;
- m[9] = uz;
- m[10] = -fz;
- m[11] = 0.0f;
-
- m[12] = 0.0f;
- m[13] = 0.0f;
- m[14] = 0.0f;
- m[15] = 1.0f;
-
- glMultMatrixf(m);
- glTranslatef(-eyeX, -eyeY, -eyeZ);
-}
-
-int main(int argc, char **argv)
-{
- int q;
- int start, end;
-
- printf("Initializing EGL...\n");
-
- if(!init_gl_surface())
- {
- printf("GL initialisation failed - exiting\n");
- return 0;
- }
-
- init_scene();
-
- create_texture();
-
- printf("Start test...\n");
-
- render(argc==2 ? atoi(argv[1]) : ITERATIONS);
-
- free_gl_surface();
-
- return 0;
-}
-
-int init_gl_surface(void)
-{
- EGLint numConfigs = 1;
- EGLConfig myConfig = {0};
- EGLint attrib[] =
- {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_DEPTH_SIZE, 16,
- EGL_NONE
- };
-
- if ( (eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY )
- {
- printf("eglGetDisplay failed\n");
- return 0;
- }
-
- if ( eglInitialize(eglDisplay, NULL, NULL) != EGL_TRUE )
- {
- printf("eglInitialize failed\n");
- return 0;
- }
-
- EGLNativeWindowType window = android_createDisplaySurface();
- EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
-
- if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,
- window, 0)) == EGL_NO_SURFACE )
- {
- printf("eglCreateWindowSurface failed\n");
- return 0;
- }
-
- if ( (eglContext = eglCreateContext(eglDisplay, myConfig, 0, 0)) == EGL_NO_CONTEXT )
- {
- printf("eglCreateContext failed\n");
- return 0;
- }
-
- if ( eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) != EGL_TRUE )
- {
- printf("eglMakeCurrent failed\n");
- return 0;
- }
-
- return 1;
-}
-
-void free_gl_surface(void)
-{
- if (eglDisplay != EGL_NO_DISPLAY)
- {
- eglMakeCurrent( EGL_NO_DISPLAY, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT );
- eglDestroyContext( eglDisplay, eglContext );
- eglDestroySurface( eglDisplay, eglSurface );
- eglTerminate( eglDisplay );
- eglDisplay = EGL_NO_DISPLAY;
- }
-}
-
-void init_scene(void)
-{
- glDisable(GL_DITHER);
- glEnable(GL_CULL_FACE);
-
- float ratio = 320.0f / 480.0f;
- glViewport(0, 0, 320, 480);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustumf(-ratio, ratio, -1, 1, 1, 10);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(
- 0, 0, 3, // eye
- 0, 0, 0, // center
- 0, 1, 0); // up
-
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-void create_texture(void)
-{
- const unsigned int on = 0xff0000ff;
- const unsigned int off = 0xffffffff;
- const unsigned int pixels[] =
- {
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- on, off, on, off, on, off, on, off,
- off, on, off, on, off, on, off, on,
- };
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
-void render(int quads)
-{
- int i, j;
-
- const GLfloat vertices[] = {
- -1, -1, 0,
- 1, -1, 0,
- 1, 1, 0,
- -1, 1, 0
- };
-
- const GLfixed texCoords[] = {
- 0, 0,
- FIXED_ONE, 0,
- FIXED_ONE, FIXED_ONE,
- 0, FIXED_ONE
- };
-
- const GLushort quadIndices[] = { 0, 1, 2, 0, 2, 3 };
-
-
- GLushort* indices = (GLushort*)malloc(quads*sizeof(quadIndices));
- for (i=0 ; i<quads ; i++)
- memcpy(indices+(sizeof(quadIndices)/sizeof(indices[0]))*i, quadIndices, sizeof(quadIndices));
-
- glVertexPointer(3, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FIXED, 0, texCoords);
-
- // make sure to do a couple eglSwapBuffers to make sure there are
- // no problems with the very first ones (who knows)
- glClearColor(0.4, 0.4, 0.4, 0.4);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(eglDisplay, eglSurface);
- glClearColor(0.6, 0.6, 0.6, 0.6);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(eglDisplay, eglSurface);
- glClearColor(1.0, 1.0, 1.0, 1.0);
-
- for (j=0 ; j<10 ; j++) {
- printf("loop %d / 10 (%d quads / loop)\n", j, quads);
-
- int nelem = sizeof(quadIndices)/sizeof(quadIndices[0]);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glDrawElements(GL_TRIANGLES, nelem*quads, GL_UNSIGNED_SHORT, indices);
- eglSwapBuffers(eglDisplay, eglSurface);
- }
-
- free(indices);
-}
-
diff --git a/opengl/tools/glgen/.gitignore b/opengl/tools/glgen/.gitignore
deleted file mode 100644
index 007ec65..0000000
--- a/opengl/tools/glgen/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-generated
-out
diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen
deleted file mode 100755
index 31f4190..0000000
--- a/opengl/tools/glgen/gen
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/bash
-set -u
-set -e
-rm -rf out generated
-
-mkdir out
-
-# Create dummy Java files for Android APIs that are used by the code we generate.
-# This allows us to test the generated code without building the rest of Android.
-
-mkdir -p out/javax/microedition/khronos/opengles
-mkdir -p out/com/google/android/gles_jni
-mkdir -p out/android/app
-mkdir -p out/android/graphics
-mkdir -p out/android/opengl
-mkdir -p out/android/content
-mkdir -p out/android/content/pm
-mkdir -p out/android/os
-mkdir -p out/android/util
-
-echo "package android.graphics;" > out/android/graphics/Canvas.java
-echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
-
-echo "package android.app; import android.content.pm.IPackageManager; public class AppGlobals { public static IPackageManager getPackageManager() { return null;} }" > out/android/app/AppGlobals.java
-# echo "package android.content; import android.content.pm.PackageManager; public interface Context { public PackageManager getPackageManager(); }" > out/android/content/Context.java
-echo "package android.content.pm; public class ApplicationInfo {public int targetSdkVersion;}" > out/android/content/pm/ApplicationInfo.java
-echo "package android.content.pm; public interface IPackageManager {ApplicationInfo getApplicationInfo(java.lang.String packageName, int flags) throws android.os.RemoteException;}" > out/android/content/pm/IPackageManager.java
-echo "package android.os; public class Build {public static class VERSION_CODES { public static final int CUPCAKE = 3;}; }" > out/android/os/Build.java
-echo "package android.os; public class RemoteException extends Exception {}" > out/android/os/RemoteException.java
-echo "package android.util; public class Log {public static void w(String a, String b) {} public static void e(String a, String b) {}}" > out/android/util/Log.java
-
-GLFILE=out/javax/microedition/khronos/opengles/GL.java
-cp stubs/jsr239/GLHeader.java-if $GLFILE
-
-GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
-
-pushd src > /dev/null
-javac ${GLGEN_FILES}
-JAVAC_RESULT=$?
-if [ $JAVAC_RESULT -ne 0 ]; then
- echo "Could not compile glgen."
- exit $JAVAC_RESULT
-fi
-popd > /dev/null
-
-echo "Generating JSR239-like APIs"
-java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 specs/jsr239/glspec-1.0ext specs/jsr239/glspec-1.1 specs/jsr239/glspec-1.1ext specs/jsr239/glspec-1.1extpack specs/jsr239/glspec-checks
-JAVA_RESULT=$?
-if [ $JAVA_RESULT -ne 0 ]; then
- echo "Could not run GenerateGL."
- exit $JAVA_RESULT
-fi
-
-echo "Generating static OpenGLES 1.1 bindings"
-java -classpath src GenerateGLES
-JAVA_RESULT=$?
-if [ $JAVA_RESULT -ne 0 ]; then
- echo "Could not run GenerateGLES."
- exit $JAVA_RESULT
-fi
-
-rm src/*.class
-
-pushd out > /dev/null
-mkdir classes
-javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java android/opengl/GLES20.java
-popd > /dev/null
-JAVA_RESULT=$?
-if [ $JAVA_RESULT -ne 0 ]; then
- echo "Could not compile generated classes."
- exit $JAVA_RESULT
-fi
-
-rm -rf generated
-mkdir -p generated/C
-cp out/com_google_android_gles_jni_GLImpl.cpp generated/C
-cp -r out/com generated
-cp -r out/javax generated
-
-cp out/android_opengl_*.cpp generated/C
-mkdir -p generated/android/opengl
-cp -r out/android/opengl generated/android
-
-rm -rf out
-KEEP_GENERATED=0
-SAID_PLEASE=0
-
-# compareGenerated destDir generatedDir file
-compareGenerated() {
- if cmp -s $1/$3 $2/$3 ; then
- echo "# " $3 unchanged
- else
- if [ $SAID_PLEASE == "0" ] ; then
- echo Please evaluate the following commands:
- echo
- SAID_PLEASE=1
- fi
- echo " " cp $2/$3 $1
- echo " " git add $1/$3
- KEEP_GENERATED=1
- fi
-}
-
-compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp
-compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java
-
-for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java
-do
- compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x
-done
-
-for x in GLES10 GLES10Ext GLES11 GLES11Ext GLES20
-do
- compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java
- compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp
-done
-
-if [ $KEEP_GENERATED == "0" ] ; then
- rm -rf generated
-fi
diff --git a/opengl/tools/glgen/specs/gles11/GLES10.spec b/opengl/tools/glgen/specs/gles11/GLES10.spec
deleted file mode 100644
index 8e1152d..0000000
--- a/opengl/tools/glgen/specs/gles11/GLES10.spec
+++ /dev/null
@@ -1,106 +0,0 @@
-void glActiveTexture ( GLenum texture )
-void glAlphaFunc ( GLenum func, GLclampf ref )
-void glAlphaFuncx ( GLenum func, GLclampx ref )
-void glBindTexture ( GLenum target, GLuint texture )
-void glBlendFunc ( GLenum sfactor, GLenum dfactor )
-void glClear ( GLbitfield mask )
-void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
-void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
-void glClearDepthf ( GLclampf depth )
-void glClearDepthx ( GLclampx depth )
-void glClearStencil ( GLint s )
-void glClientActiveTexture ( GLenum texture )
-void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
-void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
-void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
-void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
-void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
-void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
-void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
-void glCullFace ( GLenum mode )
-void glDeleteTextures ( GLsizei n, const GLuint *textures )
-void glDepthFunc ( GLenum func )
-void glDepthMask ( GLboolean flag )
-void glDepthRangef ( GLclampf zNear, GLclampf zFar )
-void glDepthRangex ( GLclampx zNear, GLclampx zFar )
-void glDisable ( GLenum cap )
-void glDisableClientState ( GLenum array )
-void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
-void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
-void glEnable ( GLenum cap )
-void glEnableClientState ( GLenum array )
-void glFinish ( void )
-void glFlush ( void )
-void glFogf ( GLenum pname, GLfloat param )
-void glFogfv ( GLenum pname, const GLfloat *params )
-void glFogx ( GLenum pname, GLfixed param )
-void glFogxv ( GLenum pname, const GLfixed *params )
-void glFrontFace ( GLenum mode )
-void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
-void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
-void glGenTextures ( GLsizei n, GLuint *textures )
-GLenum glGetError ( void )
-void glGetIntegerv ( GLenum pname, GLint *params )
-const GLubyte * glGetString ( GLenum name )
-void glHint ( GLenum target, GLenum mode )
-void glLightModelf ( GLenum pname, GLfloat param )
-void glLightModelfv ( GLenum pname, const GLfloat *params )
-void glLightModelx ( GLenum pname, GLfixed param )
-void glLightModelxv ( GLenum pname, const GLfixed *params )
-void glLightf ( GLenum light, GLenum pname, GLfloat param )
-void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
-void glLightx ( GLenum light, GLenum pname, GLfixed param )
-void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
-void glLineWidth ( GLfloat width )
-void glLineWidthx ( GLfixed width )
-void glLoadIdentity ( void )
-void glLoadMatrixf ( const GLfloat *m )
-void glLoadMatrixx ( const GLfixed *m )
-void glLogicOp ( GLenum opcode )
-void glMaterialf ( GLenum face, GLenum pname, GLfloat param )
-void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
-void glMaterialx ( GLenum face, GLenum pname, GLfixed param )
-void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
-void glMatrixMode ( GLenum mode )
-void glMultMatrixf ( const GLfloat *m )
-void glMultMatrixx ( const GLfixed *m )
-void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
-void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
-void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz )
-void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz )
-void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer )
-void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
-void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
-void glPixelStorei ( GLenum pname, GLint param )
-void glPointSize ( GLfloat size )
-void glPointSizex ( GLfixed size )
-void glPolygonOffset ( GLfloat factor, GLfloat units )
-void glPolygonOffsetx ( GLfixed factor, GLfixed units )
-void glPopMatrix ( void )
-void glPushMatrix ( void )
-void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
-void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
-void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
-void glSampleCoverage ( GLclampf value, GLboolean invert )
-void glSampleCoveragex ( GLclampx value, GLboolean invert )
-void glScalef ( GLfloat x, GLfloat y, GLfloat z )
-void glScalex ( GLfixed x, GLfixed y, GLfixed z )
-void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
-void glShadeModel ( GLenum mode )
-void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
-void glStencilMask ( GLuint mask )
-void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
-void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
-void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
-void glTexEnvx ( GLenum target, GLenum pname, GLfixed param )
-void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
-void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
-void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
-void glTexParameterx ( GLenum target, GLenum pname, GLfixed param )
-void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
-void glTranslatef ( GLfloat x, GLfloat y, GLfloat z )
-void glTranslatex ( GLfixed x, GLfixed y, GLfixed z )
-void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/specs/gles11/GLES10Ext.spec b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec
deleted file mode 100644
index 53f6c65..0000000
--- a/opengl/tools/glgen/specs/gles11/GLES10Ext.spec
+++ /dev/null
@@ -1 +0,0 @@
-GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
diff --git a/opengl/tools/glgen/specs/gles11/GLES11.spec b/opengl/tools/glgen/specs/gles11/GLES11.spec
deleted file mode 100644
index 5527c18..0000000
--- a/opengl/tools/glgen/specs/gles11/GLES11.spec
+++ /dev/null
@@ -1,44 +0,0 @@
-void glBindBuffer ( GLenum target, GLuint buffer )
-void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
-void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
-void glClipPlanef ( GLenum plane, const GLfloat *equation )
-void glClipPlanex ( GLenum plane, const GLfixed *equation )
-void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
-void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
-void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
-void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
-void glGenBuffers ( GLsizei n, GLuint *buffers )
-void glGetBooleanv ( GLenum pname, GLboolean *params )
-void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
-void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
-void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
-void glGetFixedv ( GLenum pname, GLfixed *params )
-void glGetFloatv ( GLenum pname, GLfloat *params )
-void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
-void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
-void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
-void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
-// void glGetPointerv ( GLenum pname, void **params )
-void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
-void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
-void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
-void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
-void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
-void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
-GLboolean glIsBuffer ( GLuint buffer )
-GLboolean glIsEnabled ( GLenum cap )
-GLboolean glIsTexture ( GLuint texture )
-void glNormalPointer ( GLenum type, GLsizei stride, GLint offset )
-void glPointParameterf ( GLenum pname, GLfloat param )
-void glPointParameterfv ( GLenum pname, const GLfloat *params )
-void glPointParameterx ( GLenum pname, GLfixed param )
-void glPointParameterxv ( GLenum pname, const GLfixed *params )
-void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
-void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
-void glTexEnvi ( GLenum target, GLenum pname, GLint param )
-void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
-void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
-void glTexParameteri ( GLenum target, GLenum pname, GLint param )
-void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
-void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
-void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
diff --git a/opengl/tools/glgen/specs/gles11/GLES11Ext.spec b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec
deleted file mode 100644
index cd7333a..0000000
--- a/opengl/tools/glgen/specs/gles11/GLES11Ext.spec
+++ /dev/null
@@ -1,90 +0,0 @@
-void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
-void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
-void glBlendEquationOES ( GLenum mode )
-void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height )
-void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height )
-void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height )
-void glDrawTexsvOES ( const GLshort *coords )
-void glDrawTexivOES ( const GLint *coords )
-void glDrawTexxvOES ( const GLfixed *coords )
-void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height )
-void glDrawTexfvOES ( const GLfloat *coords )
-void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image )
-void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image )
-void glAlphaFuncxOES ( GLenum func, GLclampx ref )
-void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
-void glClearDepthxOES ( GLclampx depth )
-void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
-void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
-void glDepthRangexOES ( GLclampx zNear, GLclampx zFar )
-void glFogxOES ( GLenum pname, GLfixed param )
-void glFogxvOES ( GLenum pname, const GLfixed *params )
-void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
-void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
-void glGetFixedvOES ( GLenum pname, GLfixed *params )
-void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
-void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
-void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
-void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
-void glLightModelxOES ( GLenum pname, GLfixed param )
-void glLightModelxvOES ( GLenum pname, const GLfixed *params )
-void glLightxOES ( GLenum light, GLenum pname, GLfixed param )
-void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
-void glLineWidthxOES ( GLfixed width )
-void glLoadMatrixxOES ( const GLfixed *m )
-void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param )
-void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
-void glMultMatrixxOES ( const GLfixed *m )
-void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
-void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz )
-void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
-void glPointParameterxOES ( GLenum pname, GLfixed param )
-void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
-void glPointSizexOES ( GLfixed size )
-void glPolygonOffsetxOES ( GLfixed factor, GLfixed units )
-void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
-void glSampleCoveragexOES ( GLclampx value, GLboolean invert )
-void glScalexOES ( GLfixed x, GLfixed y, GLfixed z )
-void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param )
-void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
-void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param )
-void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
-void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z )
-GLboolean glIsRenderbufferOES ( GLuint renderbuffer )
-void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer )
-void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
-void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
-void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
-void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
-GLboolean glIsFramebufferOES ( GLuint framebuffer )
-void glBindFramebufferOES ( GLenum target, GLuint framebuffer )
-void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
-void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
-GLenum glCheckFramebufferStatusOES ( GLenum target )
-void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
-void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
-void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
-void glGenerateMipmapOES ( GLenum target )
-// Hard to export to Java:
-// void *glMapBufferOES ( GLenum target, GLenum access )
-// GLboolean glUnmapBufferOES ( GLenum target )
-// void glGetBufferPointervOES ( GLenum target, GLenum pname, void **params )
-void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex )
-void glLoadPaletteFromModelViewMatrixOES ( void )
-void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
-void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
-void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
-void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
-void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
-void glClearDepthfOES ( GLclampf depth )
-void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param )
-void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
-void glTexGeniOES ( GLenum coord, GLenum pname, GLint param )
-void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
-void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param )
-void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
-void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
-void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
-void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
diff --git a/opengl/tools/glgen/specs/gles11/GLES20.spec b/opengl/tools/glgen/specs/gles11/GLES20.spec
deleted file mode 100644
index ee88f59..0000000
--- a/opengl/tools/glgen/specs/gles11/GLES20.spec
+++ /dev/null
@@ -1,144 +0,0 @@
-void glActiveTexture ( GLenum texture )
-void glAttachShader ( GLuint program, GLuint shader )
-void glBindAttribLocation ( GLuint program, GLuint index, const char *name )
-void glBindBuffer ( GLenum target, GLuint buffer )
-void glBindFramebuffer ( GLenum target, GLuint framebuffer )
-void glBindRenderbuffer ( GLenum target, GLuint renderbuffer )
-void glBindTexture ( GLenum target, GLuint texture )
-void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
-void glBlendEquation ( GLenum mode )
-void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha )
-void glBlendFunc ( GLenum sfactor, GLenum dfactor )
-void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
-void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
-void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
-GLenum glCheckFramebufferStatus ( GLenum target )
-void glClear ( GLbitfield mask )
-void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
-void glClearDepthf ( GLclampf depth )
-void glClearStencil ( GLint s )
-void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
-void glCompileShader ( GLuint shader )
-void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
-void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
-void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
-void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
-GLuint glCreateProgram ( void )
-GLuint glCreateShader ( GLenum type )
-void glCullFace ( GLenum mode )
-void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
-void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers )
-void glDeleteProgram ( GLuint program )
-void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers )
-void glDeleteShader ( GLuint shader )
-void glDeleteTextures ( GLsizei n, const GLuint *textures )
-void glDepthFunc ( GLenum func )
-void glDepthMask ( GLboolean flag )
-void glDepthRangef ( GLclampf zNear, GLclampf zFar )
-void glDetachShader ( GLuint program, GLuint shader )
-void glDisable ( GLenum cap )
-void glDisableVertexAttribArray ( GLuint index )
-void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
-void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
-void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
-void glEnable ( GLenum cap )
-void glEnableVertexAttribArray ( GLuint index )
-void glFinish ( void )
-void glFlush ( void )
-void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
-void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
-void glFrontFace ( GLenum mode )
-void glGenBuffers ( GLsizei n, GLuint *buffers )
-void glGenerateMipmap ( GLenum target )
-void glGenFramebuffers ( GLsizei n, GLuint *framebuffers )
-void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers )
-void glGenTextures ( GLsizei n, GLuint *textures )
-void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
-void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
-void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders )
-int glGetAttribLocation ( GLuint program, const char *name )
-void glGetBooleanv ( GLenum pname, GLboolean *params )
-void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
-GLenum glGetError ( void )
-void glGetFloatv ( GLenum pname, GLfloat *params )
-void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
-void glGetIntegerv ( GLenum pname, GLint *params )
-void glGetProgramiv ( GLuint program, GLenum pname, GLint *params )
-void glGetProgramInfoLog ( GLuint program, GLsizei bufsize, GLsizei *length, char *infolog )
-void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params )
-void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params )
-void glGetShaderInfoLog ( GLuint shader, GLsizei bufsize, GLsizei *length, char *infolog )
-void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision )
-void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
-const GLubyte * glGetString ( GLenum name )
-void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
-void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
-void glGetUniformfv ( GLuint program, GLint location, GLfloat *params )
-void glGetUniformiv ( GLuint program, GLint location, GLint *params )
-int glGetUniformLocation ( GLuint program, const char *name )
-void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params )
-void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params )
-// void glGetVertexAttribPointerv ( GLuint index, GLenum pname, void **pointer )
-void glHint ( GLenum target, GLenum mode )
-GLboolean glIsBuffer ( GLuint buffer )
-GLboolean glIsEnabled ( GLenum cap )
-GLboolean glIsFramebuffer ( GLuint framebuffer )
-GLboolean glIsProgram ( GLuint program )
-GLboolean glIsRenderbuffer ( GLuint renderbuffer )
-GLboolean glIsShader ( GLuint shader )
-GLboolean glIsTexture ( GLuint texture )
-void glLineWidth ( GLfloat width )
-void glLinkProgram ( GLuint program )
-void glPixelStorei ( GLenum pname, GLint param )
-void glPolygonOffset ( GLfloat factor, GLfloat units )
-void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
-void glReleaseShaderCompiler ( void )
-void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
-void glSampleCoverage ( GLclampf value, GLboolean invert )
-void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
-void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length )
-void glShaderSource ( GLuint shader )
-void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
-void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask )
-void glStencilMask ( GLuint mask )
-void glStencilMaskSeparate ( GLenum face, GLuint mask )
-void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
-void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass )
-void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
-void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
-void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
-void glTexParameteri ( GLenum target, GLenum pname, GLint param )
-void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
-void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
-void glUniform1f ( GLint location, GLfloat x )
-void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v )
-void glUniform1i ( GLint location, GLint x )
-void glUniform1iv ( GLint location, GLsizei count, const GLint *v )
-void glUniform2f ( GLint location, GLfloat x, GLfloat y )
-void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v )
-void glUniform2i ( GLint location, GLint x, GLint y )
-void glUniform2iv ( GLint location, GLsizei count, const GLint *v )
-void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z )
-void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v )
-void glUniform3i ( GLint location, GLint x, GLint y, GLint z )
-void glUniform3iv ( GLint location, GLsizei count, const GLint *v )
-void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v )
-void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w )
-void glUniform4iv ( GLint location, GLsizei count, const GLint *v )
-void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
-void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
-void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
-void glUseProgram ( GLuint program )
-void glValidateProgram ( GLuint program )
-void glVertexAttrib1f ( GLuint indx, GLfloat x )
-void glVertexAttrib1fv ( GLuint indx, const GLfloat *values )
-void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y )
-void glVertexAttrib2fv ( GLuint indx, const GLfloat *values )
-void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z )
-void glVertexAttrib3fv ( GLuint indx, const GLfloat *values )
-void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-void glVertexAttrib4fv ( GLuint indx, const GLfloat *values )
-void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset )
-void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr )
-void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
deleted file mode 100644
index f478a32..0000000
--- a/opengl/tools/glgen/specs/gles11/checks.spec
+++ /dev/null
@@ -1,42 +0,0 @@
-glClipPlanef check eqn 4
-glClipPlanex check eqn 4
-glGetClipPlanefOES check eqn 4
-glGetClipPlanexOES check eqn 4
-glDeleteBuffers check buffers n
-glDeleteTextures check textures n
-glDrawElements check_AIOOBE indices count
-glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR
-glGenBuffers check buffers n
-glGenTextures check textures n
-glGetClipPlane check eqn 4
-glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS
-glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
-glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
-glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
-glGetTexParameter check params 1
-glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT
-glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
-glLoadMatrix check m 16
-glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
-glMultMatrix check m 16
-glPointParameter check params 1
-glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
-glTexImage2D nullAllowed
-glTexSubImage2D nullAllowed
-glBufferData nullAllowed check data size
-glBufferSubData check data size
-glTexParameter check params 1
-glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
-glDrawTexfvOES check coords 5
-glDrawTexivOES check coords 5
-glDrawTexsvOES check coords 5
-glDrawTexxvOES check coords 5
-glDeleteFramebuffersOES check framebuffers n
-glDeleteRenderbuffersOES check renderbuffers n
-glGenFramebuffersOES check framebuffers n
-glGenRenderbuffersOES check renderbuffers n
-glGetBufferParameter check params 1
-glGetFramebufferAttachmentParameterivOES check params 1
-glGetRenderbufferParameterivOES check params 1
-glGetTexGen ifcheck params 1 pname GL_TEXTURE_GEN_MODE ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE
-
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.0 b/opengl/tools/glgen/specs/jsr239/glspec-1.0
deleted file mode 100644
index c442320..0000000
--- a/opengl/tools/glgen/specs/jsr239/glspec-1.0
+++ /dev/null
@@ -1,106 +0,0 @@
-void glActiveTexture ( GLenum texture )
-void glAlphaFunc ( GLenum func, GLclampf ref )
-void glAlphaFuncx ( GLenum func, GLclampx ref )
-void glBindTexture ( GLenum target, GLuint texture )
-void glBlendFunc ( GLenum sfactor, GLenum dfactor )
-void glClear ( GLbitfield mask )
-void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
-void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
-void glClearDepthf ( GLclampf depth )
-void glClearDepthx ( GLclampx depth )
-void glClearStencil ( GLint s )
-void glClientActiveTexture ( GLenum texture )
-void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
-void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
-void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
-void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
-void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
-void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
-void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
-void glCullFace ( GLenum mode )
-void glDeleteTextures ( GLsizei n, const GLuint *textures )
-void glDepthFunc ( GLenum func )
-void glDepthMask ( GLboolean flag )
-void glDepthRangef ( GLclampf zNear, GLclampf zFar )
-void glDepthRangex ( GLclampx zNear, GLclampx zFar )
-void glDisable ( GLenum cap )
-void glDisableClientState ( GLenum array )
-void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
-void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
-void glEnable ( GLenum cap )
-void glEnableClientState ( GLenum array )
-void glFinish ( void )
-void glFlush ( void )
-void glFogf ( GLenum pname, GLfloat param )
-void glFogfv ( GLenum pname, const GLfloat *params )
-void glFogx ( GLenum pname, GLfixed param )
-void glFogxv ( GLenum pname, const GLfixed *params )
-void glFrontFace ( GLenum mode )
-void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
-void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
-void glGenTextures ( GLsizei n, GLuint *textures )
-GLenum glGetError ( void )
-void glGetIntegerv ( GLenum pname, GLint *params )
-const GLubyte * glGetString ( GLenum name )
-void glHint ( GLenum target, GLenum mode )
-void glLightModelf ( GLenum pname, GLfloat param )
-void glLightModelfv ( GLenum pname, const GLfloat *params )
-void glLightModelx ( GLenum pname, GLfixed param )
-void glLightModelxv ( GLenum pname, const GLfixed *params )
-void glLightf ( GLenum light, GLenum pname, GLfloat param )
-void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
-void glLightx ( GLenum light, GLenum pname, GLfixed param )
-void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
-void glLineWidth ( GLfloat width )
-void glLineWidthx ( GLfixed width )
-void glLoadIdentity ( void )
-void glLoadMatrixf ( const GLfloat *m )
-void glLoadMatrixx ( const GLfixed *m )
-void glLogicOp ( GLenum opcode )
-void glMaterialf ( GLenum face, GLenum pname, GLfloat param )
-void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
-void glMaterialx ( GLenum face, GLenum pname, GLfixed param )
-void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
-void glMatrixMode ( GLenum mode )
-void glMultMatrixf ( const GLfloat *m )
-void glMultMatrixx ( const GLfixed *m )
-void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
-void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
-void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz )
-void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz )
-void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer )
-void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
-void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
-void glPixelStorei ( GLenum pname, GLint param )
-void glPointSize ( GLfloat size )
-void glPointSizex ( GLfixed size )
-void glPolygonOffset ( GLfloat factor, GLfloat units )
-void glPolygonOffsetx ( GLfixed factor, GLfixed units )
-void glPopMatrix ( void )
-void glPushMatrix ( void )
-void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
-void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
-void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
-void glSampleCoverage ( GLclampf value, GLboolean invert )
-void glSampleCoveragex ( GLclampx value, GLboolean invert )
-void glScalef ( GLfloat x, GLfloat y, GLfloat z )
-void glScalex ( GLfixed x, GLfixed y, GLfixed z )
-void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
-void glShadeModel ( GLenum mode )
-void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
-void glStencilMask ( GLuint mask )
-void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
-void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
-void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
-void glTexEnvx ( GLenum target, GLenum pname, GLfixed param )
-void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
-void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
-void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
-void glTexParameterx ( GLenum target, GLenum pname, GLfixed param )
-void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
-void glTranslatef ( GLfloat x, GLfloat y, GLfloat z )
-void glTranslatex ( GLfixed x, GLfixed y, GLfixed z )
-void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.0ext b/opengl/tools/glgen/specs/jsr239/glspec-1.0ext
deleted file mode 100644
index 7d19758..0000000
--- a/opengl/tools/glgen/specs/jsr239/glspec-1.0ext
+++ /dev/null
@@ -1 +0,0 @@
-GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1 b/opengl/tools/glgen/specs/jsr239/glspec-1.1
deleted file mode 100644
index 9149a7f9..0000000
--- a/opengl/tools/glgen/specs/jsr239/glspec-1.1
+++ /dev/null
@@ -1,42 +0,0 @@
-void glBindBuffer ( GLenum target, GLuint buffer )
-void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
-void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
-void glClipPlanef ( GLenum plane, const GLfloat *equation )
-void glClipPlanex ( GLenum plane, const GLfixed *equation )
-void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
-void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
-void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
-void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
-void glGenBuffers ( GLsizei n, GLuint *buffers )
-void glGetBooleanv ( GLenum pname, GLboolean *params )
-void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
-void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
-void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
-void glGetFixedv ( GLenum pname, GLfixed *params )
-void glGetFloatv ( GLenum pname, GLfloat *params )
-void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
-void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
-void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
-void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
-void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
-void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
-void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
-void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
-void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
-GLboolean glIsBuffer ( GLuint buffer )
-GLboolean glIsEnabled ( GLenum cap )
-GLboolean glIsTexture ( GLuint texture )
-void glNormalPointer ( GLenum type, GLsizei stride, GLint offset )
-void glPointParameterf ( GLenum pname, GLfloat param )
-void glPointParameterfv ( GLenum pname, const GLfloat *params )
-void glPointParameterx ( GLenum pname, GLfixed param )
-void glPointParameterxv ( GLenum pname, const GLfixed *params )
-void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
-void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
-void glTexEnvi ( GLenum target, GLenum pname, GLint param )
-void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
-void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
-void glTexParameteri ( GLenum target, GLenum pname, GLint param )
-void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
-void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
-void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1ext b/opengl/tools/glgen/specs/jsr239/glspec-1.1ext
deleted file mode 100644
index cc08c735..0000000
--- a/opengl/tools/glgen/specs/jsr239/glspec-1.1ext
+++ /dev/null
@@ -1,16 +0,0 @@
-void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex )
-void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height )
-void glDrawTexfvOES ( const GLfloat *coords )
-void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height )
-void glDrawTexivOES ( const GLint *coords )
-void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height )
-void glDrawTexsvOES ( const GLshort *coords )
-void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height )
-void glDrawTexxvOES ( const GLfixed *coords )
-void glEnable ( GLenum cap )
-void glEnableClientState ( GLenum array )
-void glLoadPaletteFromModelViewMatrixOES ( void )
-void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset )
-void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
-void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset )
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
deleted file mode 100644
index d6012d9..0000000
--- a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
+++ /dev/null
@@ -1,38 +0,0 @@
-void glBindFramebufferOES ( GLint target, GLint framebuffer )
-void glBindRenderbufferOES ( GLint target, GLint renderbuffer )
-void glBindTexture ( GLint target, GLint texture )
-void glBlendEquation ( GLint mode )
-void glBlendEquationSeparate ( GLint modeRGB, GLint modeAlpha )
-void glBlendFuncSeparate ( GLint srcRGB, GLint dstRGB, GLint srcAlpha, GLint dstAlpha )
-GLint glCheckFramebufferStatusOES ( GLint target )
-void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
-void glCopyTexImage2D ( GLint target, GLint level, GLint internalformat, GLint x, GLint y, GLint width, GLint height, GLint border )
-void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers )
-void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers )
-void glEnable ( GLint cap )
-void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer )
-void glFramebufferTexture2DOES ( GLint target, GLint attachment, GLint textarget, GLint texture, GLint level )
-void glGenerateMipmapOES ( GLint target )
-void glGenFramebuffersOES ( GLint n, GLuint *framebuffers )
-void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers )
-void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params )
-void glGetIntegerv ( GLint pname, GLint *params )
-void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params )
-void glGetTexGenfv ( GLint coord, GLint pname, GLfloat *params )
-void glGetTexGeniv ( GLint coord, GLint pname, GLint *params )
-void glGetTexGenxv ( GLint coord, GLint pname, GLint *params )
-GLboolean glIsFramebufferOES ( GLint framebuffer )
-GLboolean glIsRenderbufferOES ( GLint renderbuffer )
-void glRenderbufferStorageOES ( GLint target, GLint internalformat, GLint width, GLint height )
-void glStencilOp ( GLint fail, GLint zfail, GLint zpass )
-void glTexEnvf ( GLint target, GLint pname, GLfloat param )
-void glTexEnvfv ( GLint target, GLint pname, GLfloat *params )
-void glTexEnvx ( GLint target, GLint pname, GLint param )
-void glTexEnvxv ( GLint target, GLint pname, GLint *params )
-void glTexGenf ( GLint coord, GLint pname, GLfloat param )
-void glTexGenfv ( GLint coord, GLint pname, GLfloat *params )
-void glTexGeni ( GLint coord, GLint pname, GLint param )
-void glTexGeniv ( GLint coord, GLint pname, GLint *params )
-void glTexGenx ( GLint coord, GLint pname, GLint param )
-void glTexGenxv ( GLint coord, GLint pname, GLint *params )
-void glTexParameterf ( GLint target, GLint pname, GLfloat param )
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
deleted file mode 100644
index 9f8a793..0000000
--- a/opengl/tools/glgen/specs/jsr239/glspec-checks
+++ /dev/null
@@ -1,56 +0,0 @@
-glClipPlanef check equation 4
-glClipPlanex check equation 4
-glDeleteBuffers check buffers n
-glDeleteTextures check textures n
-glDrawElements check_AIOOBE indices count
-glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR
-glGenBuffers check buffers n
-glGenTextures check textures n
-glGetClipPlane check eqn 4
-glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS
-glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
-glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
-glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
-glGetTexParameter check params 1
-glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT
-glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
-glLoadMatrix check m 16
-glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
-glMultMatrix check m 16
-glPointParameter check params 1
-glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
-glTexImage2D nullAllowed
-glTexSubImage2D nullAllowed
-glBufferData nullAllowed check data size
-glBufferSubData check data size
-glTexParameter check params 1
-glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
-glDrawTexfvOES check coords 5
-glDrawTexivOES check coords 5
-glDrawTexsvOES check coords 5
-glDrawTexxvOES check coords 5
-glBindFramebufferOES requires OES_framebuffer_object
-glBindRenderbufferOES requires OES_framebuffer_object
-glBlendEquation requires OES_blend_subtract
-glBlendEquationSeparate requires OES_blend_equation_separate
-glBlendFuncSeparate requires OES_blend_equation_separate
-glCheckFramebufferStatusOES requires OES_framebuffer_object return 0
-glDeleteFramebuffersOES requires OES_framebuffer_object check framebuffers n
-glDeleteRenderbuffersOES requires OES_framebuffer_object check renderbuffers n
-glFramebufferRenderbufferOES requires OES_framebuffer_object
-glFramebufferStorageOES requires OES_framebuffer_object
-glFramebufferTexture2DOES requires OES_framebuffer_object
-glGenFramebuffersOES requires OES_framebuffer_object check framebuffers n
-glGenRenderbuffersOES requires OES_framebuffer_object check renderbuffers n
-glGenerateMipmapOES requires OES_framebuffer_object
-glGetFramebufferAttachmentParameterivOES requires OES_framebuffer_object
-glGetRenderbufferParameterivOES requires OES_framebuffer_object
-glIsFramebufferOES requires OES_framebuffer_object return JNI_FALSE
-glIsRenderbufferOES requires OES_framebuffer_object return JNI_FALSE
-glRenderbufferStorageOES requires OES_framebuffer_object
-glGetTexGen requires OES_texture_cube_map
-glTexGen requires OES_texture_cube_map
-glTexGenf requires OES_texture_cube_map
-glTexGeni requires OES_texture_cube_map
-glTexGenx requires OES_texture_cube_map
-glGetBufferParameter unsupported
diff --git a/opengl/tools/glgen/src/.gitignore b/opengl/tools/glgen/src/.gitignore
deleted file mode 100644
index 6b468b6..0000000
--- a/opengl/tools/glgen/src/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.class
diff --git a/opengl/tools/glgen/src/CFunc.java b/opengl/tools/glgen/src/CFunc.java
deleted file mode 100644
index 4847694..0000000
--- a/opengl/tools/glgen/src/CFunc.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-import java.util.*;
-
-public class CFunc {
-
- String original;
-
- CType ftype;
- String fname;
-
- List<String> argNames = new ArrayList<String>();
- List<CType> argTypes = new ArrayList<CType>();
-
- boolean hasPointerArg = false;
- boolean hasTypedPointerArg = false;
-
- public CFunc(String original) {
- this.original = original;
- }
-
- public String getOriginal() {
- return original;
- }
-
- public void setName(String fname) {
- this.fname = fname;
- }
-
- public String getName() {
- return fname;
- }
-
- public void setType(CType ftype) {
- this.ftype = ftype;
- }
-
- public CType getType() {
- return ftype;
- }
-
- public void addArgument(String argName, CType argType) {
- argNames.add(argName);
- argTypes.add(argType);
-
- if (argType.isPointer()) {
- hasPointerArg = true;
- }
- if (argType.isTypedPointer()) {
- hasTypedPointerArg = true;
- }
- }
-
- public int getNumArgs() {
- return argNames.size();
- }
-
- public int getArgIndex(String name) {
- int len = argNames.size();
- for (int i = 0; i < len; i++) {
- if (name.equals(argNames.get(i))) {
- return i;
- }
- }
- return -1;
- }
-
- public String getArgName(int index) {
- return argNames.get(index);
- }
-
- public CType getArgType(int index) {
- return argTypes.get(index);
- }
-
- public boolean hasPointerArg() {
- return hasPointerArg;
- }
-
- public boolean hasTypedPointerArg() {
- return hasTypedPointerArg;
- }
-
- @Override
- public String toString() {
- String s = "Function " + fname + " returns " + ftype + ": ";
- for (int i = 0; i < argNames.size(); i++) {
- if (i > 0) {
- s += ", ";
- }
- s += argTypes.get(i) + " " + argNames.get(i);
- }
- return s;
- }
-
- public static CFunc parseCFunc(String s) {
- CFunc cfunc = new CFunc(s);
- String[] tokens = s.split("\\s");
-
- int i = 0;
- CType ftype = new CType();
- String ftypeName = tokens[i++];
- if (ftypeName.equals("const")) {
- ftype.setIsConst(true);
- ftypeName = tokens[i++];
- }
- ftype.setBaseType(ftypeName);
-
- String fname = tokens[i++];
- if (fname.equals("*")) {
- ftype.setIsPointer(true);
- fname = tokens[i++];
- }
-
- cfunc.setName(fname);
- cfunc.setType(ftype);
-
- while (i < tokens.length) {
- String tok = tokens[i++];
-
- if (tok.equals("(")) {
- continue;
- }
- if (tok.equals(")")) {
- break;
- }
-
- CType argType = new CType();
-
- String argTypeName = tok;
- String argName = "";
-
- if (argTypeName.equals("const")) {
- argType.setIsConst(true);
- argTypeName = tokens[i++];
- }
- argType.setBaseType(argTypeName);
-
- if (argTypeName.equals("void")) {
- break;
- }
-
- argName = tokens[i++];
- if (argName.startsWith("*")) {
- argType.setIsPointer(true);
- argName = argName.substring(1, argName.length());
- }
- if (argName.endsWith(",")) {
- argName = argName.substring(0, argName.length() - 1);
- }
-
- cfunc.addArgument(argName, argType);
- }
-
- return cfunc;
- }
-}
diff --git a/opengl/tools/glgen/src/CType.java b/opengl/tools/glgen/src/CType.java
deleted file mode 100644
index e0f0ca6..0000000
--- a/opengl/tools/glgen/src/CType.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-public class CType {
-
- String baseType;
- boolean isConst;
- boolean isPointer;
-
- public CType() {
- }
-
- public CType(String baseType) {
- setBaseType(baseType);
- }
-
- public CType(String baseType, boolean isConst, boolean isPointer) {
- setBaseType(baseType);
- setIsConst(isConst);
- setIsPointer(isPointer);
- }
-
- public String getDeclaration() {
- return baseType + (isPointer ? " *" : "");
- }
-
- public void setIsConst(boolean isConst) {
- this.isConst = isConst;
- }
-
- public boolean isConst() {
- return isConst;
- }
-
- public void setIsPointer(boolean isPointer) {
- this.isPointer = isPointer;
- }
-
- public boolean isPointer() {
- return isPointer;
- }
-
- boolean isVoid() {
- String baseType = getBaseType();
- return baseType.equals("GLvoid") ||
- baseType.equals("void");
- }
-
- public boolean isConstCharPointer() {
- return isConst && isPointer && baseType.equals("char");
- }
-
- public boolean isTypedPointer() {
- return isPointer() && !isVoid() && !isConstCharPointer();
- }
-
- public void setBaseType(String baseType) {
- this.baseType = baseType;
- }
-
- public String getBaseType() {
- return baseType;
- }
-
- @Override
- public String toString() {
- String s = "";
- if (isConst()) {
- s += "const ";
- }
- s += baseType;
- if (isPointer()) {
- s += "*";
- }
-
- return s;
- }
-
- @Override
- public int hashCode() {
- return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o != null && o instanceof CType) {
- CType c = (CType)o;
- return baseType.equals(c.baseType) &&
- isPointer() == c.isPointer() &&
- isConst() == c.isConst();
- }
- return false;
- }
-}
diff --git a/opengl/tools/glgen/src/CodeEmitter.java b/opengl/tools/glgen/src/CodeEmitter.java
deleted file mode 100644
index 3a4834e..0000000
--- a/opengl/tools/glgen/src/CodeEmitter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-public interface CodeEmitter {
-
- void setVersion(int version, boolean ext, boolean pack);
- void emitCode(CFunc cfunc, String original);
- void addNativeRegistration(String fname);
- void emitNativeRegistration();
-}
diff --git a/opengl/tools/glgen/src/GLESCodeEmitter.java b/opengl/tools/glgen/src/GLESCodeEmitter.java
deleted file mode 100644
index d138250..0000000
--- a/opengl/tools/glgen/src/GLESCodeEmitter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-import java.io.PrintStream;
-
-/**
- * Emits a Java interface and Java & C implementation for a C function.
- *
- * <p> The Java interface will have Buffer and array variants for functions that
- * have a typed pointer argument. The array variant will convert a single "<type> *data"
- * argument to a pair of arguments "<type>[] data, int offset".
- */
-public class GLESCodeEmitter extends JniCodeEmitter {
-
- PrintStream mJavaImplStream;
- PrintStream mCStream;
-
- PrintStream mJavaInterfaceStream;
-
- /**
- */
- public GLESCodeEmitter(String classPathName,
- ParameterChecker checker,
- PrintStream javaImplStream,
- PrintStream cStream) {
- mClassPathName = classPathName;
- mChecker = checker;
-
- mJavaImplStream = javaImplStream;
- mCStream = cStream;
- mUseContextPointer = false;
- mUseStaticMethods = true;
- }
-
- public void emitCode(CFunc cfunc, String original) {
- emitCode(cfunc, original, null, mJavaImplStream,
- mCStream);
- }
-
- public void emitNativeRegistration(String nativeRegistrationName) {
- emitNativeRegistration(nativeRegistrationName, mCStream);
- }
-}
diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java
deleted file mode 100644
index 500cf0b..0000000
--- a/opengl/tools/glgen/src/GenerateGL.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintStream;
-
-public class GenerateGL {
-
- static void copy(String filename, PrintStream out) throws IOException {
- BufferedReader br = new BufferedReader(new FileReader(filename));
- String s;
- while ((s = br.readLine()) != null) {
- out.println(s);
- }
- }
-
- private static void emit(int version, boolean ext, boolean pack,
- CodeEmitter emitter,
- BufferedReader specReader,
- PrintStream glStream,
- PrintStream glImplStream,
- PrintStream cStream) throws Exception {
- String s = null;
- while ((s = specReader.readLine()) != null) {
- if (s.trim().startsWith("//")) {
- continue;
- }
-
- CFunc cfunc = CFunc.parseCFunc(s);
-
- String fname = cfunc.getName();
- File f = new File("stubs/jsr239/" + fname +
- ".java-1" + version + "-if");
- if (f.exists()) {
- System.out.println("Special-casing function " + fname);
- copy("stubs/jsr239/" + fname +
- ".java-1" + version + "-if", glStream);
- copy("stubs/jsr239/" + fname + ".java-impl", glImplStream);
- copy("stubs/jsr239/" + fname + ".cpp", cStream);
-
- // Register native function names
- // This should be improved to require fewer discrete files
- String filename = "stubs/jsr239/" + fname + ".nativeReg";
- BufferedReader br =
- new BufferedReader(new FileReader(filename));
- String nfunc;
- while ((nfunc = br.readLine()) != null) {
- emitter.addNativeRegistration(nfunc);
- }
- } else {
- emitter.setVersion(version, ext, pack);
- emitter.emitCode(cfunc, s);
- }
- }
- }
-
- public static void main(String[] args) throws Exception {
- String classPathName = "com/google/android/gles_jni/GLImpl";
- boolean useContextPointer = true;
-
- int aidx = 0;
- while (args[aidx].charAt(0) == '-') {
- switch (args[aidx].charAt(1)) {
- case 'c':
- useContextPointer = false;
- break;
-
- default:
- System.err.println("Unknown flag: " + args[aidx]);
- System.exit(1);
- }
-
- aidx++;
- }
-
- System.out.println("useContextPointer = " + useContextPointer);
-
- BufferedReader spec10Reader =
- new BufferedReader(new FileReader(args[aidx++]));
- BufferedReader spec10ExtReader =
- new BufferedReader(new FileReader(args[aidx++]));
- BufferedReader spec11Reader =
- new BufferedReader(new FileReader(args[aidx++]));
- BufferedReader spec11ExtReader =
- new BufferedReader(new FileReader(args[aidx++]));
- BufferedReader spec11ExtPackReader =
- new BufferedReader(new FileReader(args[aidx++]));
- BufferedReader checksReader =
- new BufferedReader(new FileReader(args[aidx++]));
-
- String gl10Filename = "javax/microedition/khronos/opengles/GL10.java";
- String gl10ExtFilename =
- "javax/microedition/khronos/opengles/GL10Ext.java";
- String gl11Filename = "javax/microedition/khronos/opengles/GL11.java";
- String gl11ExtFilename =
- "javax/microedition/khronos/opengles/GL11Ext.java";
- String gl11ExtPackFilename =
- "javax/microedition/khronos/opengles/GL11ExtensionPack.java";
- String glImplFilename = "com/google/android/gles_jni/GLImpl.java";
- String cFilename = "com_google_android_gles_jni_GLImpl.cpp";
-
- PrintStream gl10Stream =
- new PrintStream(new FileOutputStream("out/" + gl10Filename));
- PrintStream gl10ExtStream =
- new PrintStream(new FileOutputStream("out/" + gl10ExtFilename));
- PrintStream gl11Stream =
- new PrintStream(new FileOutputStream("out/" + gl11Filename));
- PrintStream gl11ExtStream =
- new PrintStream(new FileOutputStream("out/" + gl11ExtFilename));
- PrintStream gl11ExtPackStream =
- new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename));
- PrintStream glImplStream =
- new PrintStream(new FileOutputStream("out/" + glImplFilename));
- PrintStream cStream =
- new PrintStream(new FileOutputStream("out/" + cFilename));
-
- ParameterChecker checker = new ParameterChecker(checksReader);
-
- CodeEmitter emitter =
- new Jsr239CodeEmitter(classPathName,
- checker,
- gl10Stream, gl10ExtStream,
- gl11Stream, gl11ExtStream, gl11ExtPackStream,
- glImplStream, cStream,
- useContextPointer);
-
- gl10Stream.println("/* //device/java/android/" + gl10Filename);
- gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename);
- gl11Stream.println("/* //device/java/android/" + gl11Filename);
- gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename);
- gl11ExtPackStream.println("/* //device/java/android/" +
- gl11ExtPackFilename);
- glImplStream.println("/* //device/java/android/" + glImplFilename);
- cStream.println("/* //device/libs/android_runtime/" + cFilename);
-
- copy("stubs/jsr239/GL10Header.java-if", gl10Stream);
- copy("stubs/jsr239/GL10ExtHeader.java-if", gl10ExtStream);
- copy("stubs/jsr239/GL11Header.java-if", gl11Stream);
- copy("stubs/jsr239/GL11ExtHeader.java-if", gl11ExtStream);
- copy("stubs/jsr239/GL11ExtensionPackHeader.java-if", gl11ExtPackStream);
- copy("stubs/jsr239/GLImplHeader.java-impl", glImplStream);
- copy("stubs/jsr239/GLCHeader.cpp", cStream);
-
- emit(0, false, false,
- emitter, spec10Reader, gl10Stream, glImplStream, cStream);
- emit(0, true, false,
- emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream);
- emit(1, false, false,
- emitter, spec11Reader, gl11Stream, glImplStream, cStream);
- emit(1, true, false,
- emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream);
- emit(1, true, true,
- emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream,
- cStream);
-
- emitter.emitNativeRegistration();
-
- gl10Stream.println("}");
- gl10ExtStream.println("}");
- gl11Stream.println("}");
- gl11ExtStream.println("}");
- gl11ExtPackStream.println("}");
- glImplStream.println("}");
- }
-}
diff --git a/opengl/tools/glgen/src/GenerateGLES.java b/opengl/tools/glgen/src/GenerateGLES.java
deleted file mode 100644
index 6468957..0000000
--- a/opengl/tools/glgen/src/GenerateGLES.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintStream;
-
-public class GenerateGLES {
-
- static void copy(String filename, PrintStream out) throws IOException {
- BufferedReader br = new BufferedReader(new FileReader(filename));
- String s;
- while ((s = br.readLine()) != null) {
- out.println(s);
- }
- }
-
- private static void emit(GLESCodeEmitter emitter,
- BufferedReader specReader,
- PrintStream glStream,
- PrintStream cStream) throws Exception {
- String s = null;
- while ((s = specReader.readLine()) != null) {
- if (s.trim().startsWith("//")) {
- continue;
- }
-
- CFunc cfunc = CFunc.parseCFunc(s);
-
- String fname = cfunc.getName();
- String stubRoot = "stubs/gles11/" + fname;
- String javaPath = stubRoot + ".java";
- File f = new File(javaPath);
- if (f.exists()) {
- System.out.println("Special-casing function " + fname);
- copy(javaPath, glStream);
- copy(stubRoot + ".cpp", cStream);
-
- // Register native function names
- // This should be improved to require fewer discrete files
- String filename = stubRoot + ".nativeReg";
- BufferedReader br =
- new BufferedReader(new FileReader(filename));
- String nfunc;
- while ((nfunc = br.readLine()) != null) {
- emitter.addNativeRegistration(nfunc);
- }
- } else {
- emitter.emitCode(cfunc, s);
- }
- }
- }
-
- public static void main(String[] args) throws Exception {
- int aidx = 0;
- while ((aidx < args.length) && (args[aidx].charAt(0) == '-')) {
- switch (args[aidx].charAt(1)) {
- default:
- System.err.println("Unknown flag: " + args[aidx]);
- System.exit(1);
- }
-
- aidx++;
- }
-
- BufferedReader checksReader =
- new BufferedReader(new FileReader("specs/gles11/checks.spec"));
- ParameterChecker checker = new ParameterChecker(checksReader);
-
- // Generate files
- for(String suffix: new String[] {"GLES10", "GLES10Ext",
- "GLES11", "GLES11Ext", "GLES20"})
- {
- BufferedReader spec11Reader =
- new BufferedReader(new FileReader("specs/gles11/"
- + suffix + ".spec"));
- String gl11Filename = "android/opengl/" + suffix + ".java";
- String gl11cFilename = "android_opengl_" + suffix + ".cpp";
- PrintStream gl11Stream =
- new PrintStream(new FileOutputStream("out/" + gl11Filename));
- PrintStream gl11cStream =
- new PrintStream(new FileOutputStream("out/" + gl11cFilename));
- gl11Stream.println("/*");
- gl11cStream.println("/*");
- copy("stubs/gles11/" + suffix + "Header.java-if", gl11Stream);
- copy("stubs/gles11/" + suffix + "cHeader.cpp", gl11cStream);
- GLESCodeEmitter emitter = new GLESCodeEmitter(
- "android/opengl/" + suffix,
- checker, gl11Stream, gl11cStream);
- emit(emitter, spec11Reader, gl11Stream, gl11cStream);
- emitter.emitNativeRegistration("register_android_opengl_jni_"
- + suffix);
- gl11Stream.println("}");
- gl11Stream.close();
- gl11cStream.close();
- }
- }
-}
diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java
deleted file mode 100644
index e3d73b6..0000000
--- a/opengl/tools/glgen/src/JFunc.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class JFunc {
-
- String className = "com.google.android.gles_jni.GL11Impl";
-
- CFunc cfunc;
- JType ftype;
- String fname;
-
- List<String> argNames = new ArrayList<String>();
- List<JType> argTypes = new ArrayList<JType>();
- List<Integer> argCIndices = new ArrayList<Integer>();
-
- boolean hasBufferArg = false;
- boolean hasTypedBufferArg = false;
- ArrayList<String> bufferArgNames = new ArrayList<String>();
-
- public JFunc(CFunc cfunc) {
- this.cfunc = cfunc;
- }
-
- public CFunc getCFunc() {
- return cfunc;
- }
-
- public void setName(String fname) {
- this.fname = fname;
- }
-
- public String getName() {
- return fname;
- }
-
- public void setType(JType ftype) {
- this.ftype = ftype;
- }
-
- public JType getType() {
- return ftype;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public String getClassName() {
- return className;
- }
-
- public boolean hasBufferArg() {
- return hasBufferArg;
- }
-
- public boolean hasTypedBufferArg() {
- return hasTypedBufferArg;
- }
-
- public String getBufferArgName(int index) {
- return bufferArgNames.get(index);
- }
-
- public void addArgument(String argName, JType argType, int cindex) {
- argNames.add(argName);
- argTypes.add(argType);
- argCIndices.add(new Integer(cindex));
-
- if (argType.isBuffer()) {
- hasBufferArg = true;
- bufferArgNames.add(argName);
- }
- if (argType.isTypedBuffer()) {
- hasTypedBufferArg = true;
- bufferArgNames.add(argName);
- }
- }
-
- public int getNumArgs() {
- return argNames.size();
- }
-
- public int getArgIndex(String name) {
- int len = argNames.size();
- for (int i = 0; i < len; i++) {
- if (name.equals(argNames.get(i))) {
- return i;
- }
- }
- return -1;
- }
-
- public String getArgName(int index) {
- return argNames.get(index);
- }
-
- public JType getArgType(int index) {
- return argTypes.get(index);
- }
-
- public int getArgCIndex(int index) {
- return argCIndices.get(index).intValue();
- }
-
- public static JFunc convert(CFunc cfunc, boolean useArray) {
- try {
- JFunc jfunc = new JFunc(cfunc);
- jfunc.setName(cfunc.getName());
- jfunc.setType(JType.convert(cfunc.getType(), false));
-
- int numArgs = cfunc.getNumArgs();
- int numOffsets = 0;
- for (int i = 0; i < numArgs; i++) {
- CType cArgType = cfunc.getArgType(i);
- if (cArgType.isTypedPointer() && useArray) {
- ++numOffsets;
- }
- }
-
- for (int i = 0; i < numArgs; i++) {
- String cArgName = cfunc.getArgName(i);
- CType cArgType = cfunc.getArgType(i);
-
- jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i);
- if (cArgType.isTypedPointer() && useArray) {
- if (numOffsets > 1) {
- jfunc.addArgument(cArgName + "Offset", new JType("int"), i);
- } else {
- jfunc.addArgument("offset", new JType("int"), i);
- }
- }
- }
-
- return jfunc;
- } catch (RuntimeException e) {
- System.err.println("Failed to convert function " + cfunc);
- throw e;
- }
- }
-
- @Override
- public String toString() {
- String s = "Function " + fname + " returns " + ftype + ": ";
- for (int i = 0; i < argNames.size(); i++) {
- if (i > 0) {
- s += ", ";
- }
- s += argTypes.get(i) + " " + argNames.get(i);
- }
- return s;
- }
-
-}
diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java
deleted file mode 100644
index deb2f01..0000000
--- a/opengl/tools/glgen/src/JType.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-import java.util.HashMap;
-
-public class JType {
-
- String baseType;
- boolean isArray;
- boolean isClass;
- boolean isString;
-
- static HashMap<CType,JType> typeMapping = new HashMap<CType,JType>();
- static HashMap<CType,JType> arrayTypeMapping = new HashMap<CType,JType>();
-
- static {
- // Primitive types
- typeMapping.put(new CType("GLbitfield"), new JType("int"));
- typeMapping.put(new CType("GLboolean"), new JType("boolean"));
- typeMapping.put(new CType("GLclampf"), new JType("float"));
- typeMapping.put(new CType("GLclampx"), new JType("int"));
- typeMapping.put(new CType("GLenum"), new JType("int"));
- typeMapping.put(new CType("GLfloat"), new JType("float"));
- typeMapping.put(new CType("GLfixed"), new JType("int"));
- typeMapping.put(new CType("GLint"), new JType("int"));
- typeMapping.put(new CType("GLintptr"), new JType("int"));
- typeMapping.put(new CType("GLshort"), new JType("short"));
- typeMapping.put(new CType("GLsizei"), new JType("int"));
- typeMapping.put(new CType("GLsizeiptr"), new JType("int"));
- typeMapping.put(new CType("GLubyte"), new JType("byte"));
- typeMapping.put(new CType("GLuint"), new JType("int"));
- typeMapping.put(new CType("void"), new JType("void"));
- typeMapping.put(new CType("GLubyte", true, true), new JType("String", false, false));
- typeMapping.put(new CType("char", false, true), new JType("byte"));
- typeMapping.put(new CType("char", true, true), new JType("String", false, false));
- typeMapping.put(new CType("int"), new JType("int"));
-
- // Untyped pointers map to untyped Buffers
- typeMapping.put(new CType("GLvoid", true, true),
- new JType("java.nio.Buffer", true, false));
- typeMapping.put(new CType("GLvoid", false, true),
- new JType("java.nio.Buffer", true, false));
- typeMapping.put(new CType("void", false, true),
- new JType("java.nio.Buffer", true, false));
- typeMapping.put(new CType("GLeglImageOES", false, false),
- new JType("java.nio.Buffer", true, false));
-
- // Typed pointers map to typed Buffers
- typeMapping.put(new CType("GLboolean", false, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLenum", false, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLfixed", false, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLfixed", true, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLfloat", false, true),
- new JType("java.nio.FloatBuffer", true, false));
- typeMapping.put(new CType("GLfloat", true, true),
- new JType("java.nio.FloatBuffer", true, false));
- typeMapping.put(new CType("GLint", false, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLint", true, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLsizei", false, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLuint", false, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLuint", true, true),
- new JType("java.nio.IntBuffer", true, false));
- typeMapping.put(new CType("GLshort", true, true),
- new JType("java.nio.ShortBuffer", true, false));
-
- // Typed pointers map to arrays + offsets
- arrayTypeMapping.put(new CType("char", false, true),
- new JType("byte", false, true));
- arrayTypeMapping.put(new CType("GLboolean", false, true),
- new JType("boolean", false, true));
- arrayTypeMapping.put(new CType("GLenum", false, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true));
- arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true));
- arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true));
- arrayTypeMapping.put(new CType("GLsizei", false, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLsizei", true, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true));
- arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true));
- }
-
- public JType() {
- }
-
- public JType(String primitiveTypeName) {
- this.baseType = primitiveTypeName;
- this.isClass = false;
- this.isArray = false;
- }
-
- public JType(String primitiveTypeName, boolean isClass, boolean isArray) {
- this.baseType = primitiveTypeName;
- this.isClass = isClass;
- this.isArray = isArray;
- }
-
- public String getBaseType() {
- return baseType;
- }
-
- @Override
- public String toString() {
- return baseType + (isArray ? "[]" : "");
- }
-
- public boolean isArray() {
- return isArray;
- }
-
- public boolean isClass() {
- return isClass;
- }
-
- public boolean isString() {
- return baseType.equals("String");
- }
-
- public boolean isPrimitive() {
- return !isClass() && !isArray();
- }
-
- public boolean isVoid() {
- return baseType.equals("void");
- }
-
- public boolean isBuffer() {
- return baseType.indexOf("Buffer") != -1;
- }
-
- public boolean isTypedBuffer() {
- return !baseType.equals("java.nio.Buffer") &&
- (baseType.indexOf("Buffer") != -1);
- }
-
- public static JType convert(CType ctype, boolean useArray) {
- JType javaType = null;
- if (useArray) {
- javaType = arrayTypeMapping.get(ctype);
- }
- if (javaType == null) {
- javaType = typeMapping.get(ctype);
- }
- if (javaType == null) {
- throw new RuntimeException("Unsupported C type: " + ctype);
- }
- return javaType;
- }
-}
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
deleted file mode 100644
index 9fa2b74..0000000
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ /dev/null
@@ -1,1180 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-public class JniCodeEmitter {
-
- static final boolean mUseCPlusPlus = true;
- protected boolean mUseContextPointer = true;
- protected boolean mUseStaticMethods = false;
- protected String mClassPathName;
- protected ParameterChecker mChecker;
- protected List<String> nativeRegistrations = new ArrayList<String>();
- boolean needsExit;
- protected static String indent = " ";
- HashSet<String> mFunctionsEmitted = new HashSet<String>();
-
- public static String getJniName(JType jType) {
- String jniName = "";
- if (jType.isClass()) {
- return "L" + jType.getBaseType() + ";";
- } else if (jType.isArray()) {
- jniName = "[";
- }
-
- String baseType = jType.getBaseType();
- if (baseType.equals("int")) {
- jniName += "I";
- } else if (baseType.equals("float")) {
- jniName += "F";
- } else if (baseType.equals("boolean")) {
- jniName += "Z";
- } else if (baseType.equals("short")) {
- jniName += "S";
- } else if (baseType.equals("long")) {
- jniName += "L";
- } else if (baseType.equals("byte")) {
- jniName += "B";
- } else if (baseType.equals("String")) {
- jniName += "Ljava/lang/String;";
- } else if (baseType.equals("void")) {
- // nothing.
- } else {
- throw new RuntimeException("Unknown primitive basetype " + baseType);
- }
- return jniName;
- }
-
-
- public void emitCode(CFunc cfunc, String original,
- PrintStream javaInterfaceStream,
- PrintStream javaImplStream,
- PrintStream cStream) {
- JFunc jfunc;
- String signature;
- boolean duplicate;
-
- if (cfunc.hasTypedPointerArg()) {
- jfunc = JFunc.convert(cfunc, true);
-
- // Don't emit duplicate functions
- // These may appear because they are defined in multiple
- // Java interfaces (e.g., GL11/GL11ExtensionPack)
- signature = jfunc.toString();
- duplicate = false;
- if (mFunctionsEmitted.contains(signature)) {
- duplicate = true;
- } else {
- mFunctionsEmitted.add(signature);
- }
-
- if (!duplicate) {
- emitNativeDeclaration(jfunc, javaImplStream);
- emitJavaCode(jfunc, javaImplStream);
- }
- if (javaInterfaceStream != null) {
- emitJavaInterfaceCode(jfunc, javaInterfaceStream);
- }
- if (!duplicate) {
- emitJniCode(jfunc, cStream);
- }
- }
-
- jfunc = JFunc.convert(cfunc, false);
-
- signature = jfunc.toString();
- duplicate = false;
- if (mFunctionsEmitted.contains(signature)) {
- duplicate = true;
- } else {
- mFunctionsEmitted.add(signature);
- }
-
- if (!duplicate) {
- emitNativeDeclaration(jfunc, javaImplStream);
- }
- if (javaInterfaceStream != null) {
- emitJavaInterfaceCode(jfunc, javaInterfaceStream);
- }
- if (!duplicate) {
- emitJavaCode(jfunc, javaImplStream);
- emitJniCode(jfunc, cStream);
- }
- }
-
- public void emitNativeDeclaration(JFunc jfunc, PrintStream out) {
- out.println(" // C function " + jfunc.getCFunc().getOriginal());
- out.println();
-
- emitFunction(jfunc, out, true, false);
- }
-
- public void emitJavaInterfaceCode(JFunc jfunc, PrintStream out) {
- emitFunction(jfunc, out, false, true);
- }
-
- public void emitJavaCode(JFunc jfunc, PrintStream out) {
- 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 = isPointerFunc(jfunc);
-
- if (!isVoid) {
- out.println(iii +
- jfunc.getType() + " _returnValue;");
- }
- out.println(iii +
- (isVoid ? "" : "_returnValue = ") +
- jfunc.getName() +
- (isPointerFunc ? "Bounds" : "" ) +
- "(");
-
- int numArgs = jfunc.getNumArgs();
- for (int i = 0; i < numArgs; i++) {
- String argName = jfunc.getArgName(i);
- JType argType = jfunc.getArgType(i);
-
- if (grabArray && argType.isTypedBuffer()) {
- String typeName = argType.getBaseType();
- typeName = typeName.substring(9, typeName.length() - 6);
- out.println(iii + indent + "get" + typeName + "Array(" + argName + "),");
- out.print(iii + indent + "getOffset(" + argName + ")");
- } else {
- out.print(iii + indent + argName);
- }
- if (i == numArgs - 1) {
- if (isPointerFunc) {
- out.println(",");
- out.println(iii + indent + argName + ".remaining()");
- } else {
- out.println();
- }
- } else {
- out.println(",");
- }
- }
-
- out.println(iii + ");");
- }
-
- void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
- String iii) {
- printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
- "offset", "_remaining", iii);
- }
-
- void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
- String offset, String remaining, String iii) {
- out.println(iii + " default:");
- out.println(iii + " _needed = 0;");
- out.println(iii + " break;");
- out.println(iii + "}");
-
- out.println(iii + "if (" + remaining + " < _needed) {");
- if (emitExceptionCheck) {
- out.println(iii + indent + "_exception = 1;");
- }
- out.println(iii + indent + "jniThrowException(_env, " +
- "\"java/lang/IllegalArgumentException\", " +
- "\"" + (isBuffer ? "remaining()" : "length - " + offset) + " < needed\");");
- out.println(iii + indent + "goto exit;");
- needsExit = true;
- out.println(iii + "}");
- }
-
- boolean isNullAllowed(CFunc cfunc) {
- String[] checks = mChecker.getChecks(cfunc.getName());
- int index = 1;
- if (checks != null) {
- while (index < checks.length) {
- if (checks[index].equals("return")) {
- index += 2;
- } else if (checks[index].startsWith("check")) {
- index += 3;
- } else if (checks[index].equals("ifcheck")) {
- index += 5;
- } else if (checks[index].equals("unsupported")) {
- index += 1;
- } else if (checks[index].equals("requires")) {
- index += 2;
- } else if (checks[index].equals("nullAllowed")) {
- return true;
- } else {
- System.out.println("Error: unknown keyword \"" +
- checks[index] + "\"");
- System.exit(0);
- }
- }
- }
- return false;
- }
-
- String getErrorReturnValue(CFunc cfunc) {
- CType returnType = cfunc.getType();
- boolean isVoid = returnType.isVoid();
- if (isVoid) {
- return null;
- }
-
- String[] checks = mChecker.getChecks(cfunc.getName());
-
- int index = 1;
- if (checks != null) {
- while (index < checks.length) {
- if (checks[index].equals("return")) {
- return checks[index + 1];
- } else if (checks[index].startsWith("check")) {
- index += 3;
- } else if (checks[index].equals("ifcheck")) {
- index += 5;
- } else if (checks[index].equals("unsupported")) {
- index += 1;
- } else if (checks[index].equals("requires")) {
- index += 2;
- } else if (checks[index].equals("nullAllowed")) {
- index += 1;
- } else {
- System.out.println("Error: unknown keyword \"" +
- checks[index] + "\"");
- System.exit(0);
- }
- }
- }
-
- return null;
- }
-
- boolean isUnsupportedFunc(CFunc cfunc) {
- String[] checks = mChecker.getChecks(cfunc.getName());
- int index = 1;
- if (checks != null) {
- while (index < checks.length) {
- if (checks[index].equals("unsupported")) {
- return true;
- } else if (checks[index].equals("requires")) {
- index += 2;
- } else if (checks[index].equals("return")) {
- index += 2;
- } else if (checks[index].startsWith("check")) {
- index += 3;
- } else if (checks[index].equals("ifcheck")) {
- index += 5;
- } else if (checks[index].equals("nullAllowed")) {
- index += 1;
- } else {
- System.out.println("Error: unknown keyword \"" +
- checks[index] + "\"");
- System.exit(0);
- }
- }
- }
- return false;
- }
-
- String isRequiresFunc(CFunc cfunc) {
- String[] checks = mChecker.getChecks(cfunc.getName());
- int index = 1;
- if (checks != null) {
- while (index < checks.length) {
- if (checks[index].equals("unsupported")) {
- index += 1;
- } else if (checks[index].equals("requires")) {
- return checks[index+1];
- } else if (checks[index].equals("return")) {
- index += 2;
- } else if (checks[index].startsWith("check")) {
- index += 3;
- } else if (checks[index].equals("ifcheck")) {
- index += 5;
- } else if (checks[index].equals("nullAllowed")) {
- index += 1;
- } else {
- System.out.println("Error: unknown keyword \"" +
- checks[index] + "\"");
- System.exit(0);
- }
- }
- }
- return null;
- }
-
- void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out,
- boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) {
-
- String[] checks = mChecker.getChecks(cfunc.getName());
-
- boolean lastWasIfcheck = false;
-
- int index = 1;
- if (checks != null) {
- while (index < checks.length) {
- if (checks[index].startsWith("check")) {
- if (lastWasIfcheck) {
- printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
- offset, remaining, iii);
- }
- lastWasIfcheck = false;
- if (cname != null && !cname.equals(checks[index + 1])) {
- index += 3;
- continue;
- }
- out.println(iii + "if (" + remaining + " < " + checks[index + 2] + ") {");
- if (emitExceptionCheck) {
- out.println(iii + indent + "_exception = 1;");
- }
- String exceptionClassName = "java/lang/IllegalArgumentException";
- // If the "check" keyword was of the form
- // "check_<class name>", use the class name in the
- // exception to be thrown
- int underscore = checks[index].indexOf('_');
- if (underscore >= 0) {
- String abbr = checks[index].substring(underscore + 1);
- if (abbr.equals("AIOOBE")) {
- exceptionClassName = "java/lang/ArrayIndexOutOfBoundsException";
- } else {
- throw new RuntimeException("unknown exception abbreviation: " + abbr);
- }
- }
- out.println(iii + indent + "jniThrowException(_env, " +
- "\"" + exceptionClassName + "\", " +
- "\"" + (isBuffer ? "remaining()" : "length - " + offset) + " < " + checks[index + 2] + "\");");
-
- out.println(iii + indent + "goto exit;");
- needsExit = true;
- out.println(iii + "}");
-
- index += 3;
- } else if (checks[index].equals("ifcheck")) {
- String[] matches = checks[index + 4].split(",");
-
- if (!lastWasIfcheck) {
- out.println(iii + "int _needed;");
- out.println(iii + "switch (" + checks[index + 3] + ") {");
- }
-
- for (int i = 0; i < matches.length; i++) {
- out.println("#if defined(" + matches[i] + ")");
- out.println(iii + " case " + matches[i] + ":");
- out.println("#endif // defined(" + matches[i] + ")");
- }
- out.println(iii + " _needed = " + checks[index + 2] + ";");
- out.println(iii + " break;");
-
- lastWasIfcheck = true;
- index += 5;
- } else if (checks[index].equals("return")) {
- // ignore
- index += 2;
- } else if (checks[index].equals("unsupported")) {
- // ignore
- index += 1;
- } else if (checks[index].equals("requires")) {
- // ignore
- index += 2;
- } else if (checks[index].equals("nullAllowed")) {
- // ignore
- index += 1;
- } else {
- System.out.println("Error: unknown keyword \"" + checks[index] + "\"");
- System.exit(0);
- }
- }
- }
-
- if (lastWasIfcheck) {
- printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
- }
- }
-
- boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, List<Integer> nonPrimitiveArgs) {
- if (nonPrimitiveArgs.size() > 0) {
- for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) {
- int idx = nonPrimitiveArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
- if (jfunc.getArgType(idx).isArray()) {
- if (!cfunc.getArgType(cIndex).isConst()) {
- return true;
- }
- } else if (jfunc.getArgType(idx).isBuffer()) {
- if (!cfunc.getArgType(cIndex).isConst()) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- /**
- * Emit a function in several variants:
- *
- * if nativeDecl: public native <returntype> func(args);
- *
- * if !nativeDecl:
- * if interfaceDecl: public <returntype> func(args);
- * if !interfaceDecl: public <returntype> func(args) { body }
- */
- void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) {
- boolean isPointerFunc = isPointerFunc(jfunc);
-
- if (!nativeDecl && !interfaceDecl && !isPointerFunc) {
- // If it's not a pointer function, we've already emitted it
- // with nativeDecl == true
- return;
- }
-
- String maybeStatic = mUseStaticMethods ? "static " : "";
-
- if (isPointerFunc) {
- out.println(indent +
- (nativeDecl ? "private " + maybeStatic +"native " :
- (interfaceDecl ? "" : "public ") + maybeStatic) +
- jfunc.getType() + " " +
- jfunc.getName() +
- (nativeDecl ? "Bounds" : "") +
- "(");
- } else {
- out.println(indent +
- (nativeDecl ? "public " + maybeStatic +"native " :
- (interfaceDecl ? "" : "public ") + maybeStatic) +
- jfunc.getType() + " " +
- jfunc.getName() +
- "(");
- }
-
- int numArgs = jfunc.getNumArgs();
- for (int i = 0; i < numArgs; i++) {
- String argName = jfunc.getArgName(i);
- JType argType = jfunc.getArgType(i);
-
- out.print(indent + indent + argType + " " + argName);
- if (i == numArgs - 1) {
- if (isPointerFunc && nativeDecl) {
- out.println(",");
- out.println(indent + indent + "int remaining");
- } else {
- out.println();
- }
- } else {
- out.println(",");
- }
- }
-
- if (nativeDecl || interfaceDecl) {
- out.println(indent + ");");
- } else {
- out.println(indent + ") {");
-
- String iii = indent + indent;
-
- // emitBoundsChecks(jfunc, out, iii);
- emitFunctionCall(jfunc, out, iii, false);
-
- // Set the pointer after we call the native code, so that if
- // the native code throws an exception we don't modify the
- // pointer. We assume that the native code is written so that
- // if an exception is thrown, then the underlying glXXXPointer
- // function will not have been called.
-
- String fname = jfunc.getName();
- if (isPointerFunc) {
- // TODO - deal with VBO variants
- if (fname.equals("glColorPointer")) {
- out.println(iii + "if ((size == 4) &&");
- out.println(iii + " ((type == GL_FLOAT) ||");
- out.println(iii + " (type == GL_UNSIGNED_BYTE) ||");
- out.println(iii + " (type == GL_FIXED)) &&");
- out.println(iii + " (stride >= 0)) {");
- out.println(iii + indent + "_colorPointer = pointer;");
- out.println(iii + "}");
- } else if (fname.equals("glNormalPointer")) {
- out.println(iii + "if (((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 + "_normalPointer = pointer;");
- out.println(iii + "}");
- } else if (fname.equals("glTexCoordPointer")) {
- 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 + "_texCoordPointer = pointer;");
- out.println(iii + "}");
- } else if (fname.equals("glVertexPointer")) {
- 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 + "_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 + "}");
- }
- }
-
- boolean isVoid = jfunc.getType().isVoid();
-
- if (!isVoid) {
- out.println(indent + indent + "return _returnValue;");
- }
- out.println(indent + "}");
- }
- out.println();
- }
-
- public void addNativeRegistration(String s) {
- nativeRegistrations.add(s);
- }
-
- public void emitNativeRegistration(String registrationFunctionName,
- PrintStream cStream) {
- cStream.println("static const char *classPathName = \"" +
- mClassPathName +
- "\";");
- cStream.println();
-
- cStream.println("static JNINativeMethod methods[] = {");
-
- cStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
-
- Iterator<String> i = nativeRegistrations.iterator();
- while (i.hasNext()) {
- cStream.println(i.next());
- }
-
- cStream.println("};");
- cStream.println();
-
-
- cStream.println("int " + registrationFunctionName + "(JNIEnv *_env)");
- cStream.println("{");
- cStream.println(indent +
- "int err;");
-
- cStream.println(indent +
- "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
-
- cStream.println(indent + "return err;");
- cStream.println("}");
- }
-
- public JniCodeEmitter() {
- super();
- }
-
- String getJniType(JType jType) {
- if (jType.isVoid()) {
- return "void";
- }
-
- String baseType = jType.getBaseType();
- if (jType.isPrimitive()) {
- if (baseType.equals("String")) {
- return "jstring";
- } else {
- return "j" + baseType;
- }
- } else if (jType.isArray()) {
- return "j" + baseType + "Array";
- } else {
- return "jobject";
- }
- }
-
- String getJniMangledName(String name) {
- name = name.replaceAll("_", "_1");
- name = name.replaceAll(";", "_2");
- name = name.replaceAll("\\[", "_3");
- return name;
- }
-
- public void emitJniCode(JFunc jfunc, PrintStream out) {
- CFunc cfunc = jfunc.getCFunc();
-
- // Emit comment identifying original C function
- //
- // Example:
- //
- // /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
- //
- out.println("/* " + cfunc.getOriginal() + " */");
-
- // Emit JNI signature (name)
- //
- // Example:
- //
- // void
- // android_glClipPlanef__I_3FI
- //
-
- String outName = "android_" + jfunc.getName();
- boolean isPointerFunc = isPointerFunc(jfunc);
- boolean isVBOPointerFunc = (outName.endsWith("Pointer") ||
- outName.endsWith("PointerOES") ||
- outName.endsWith("DrawElements") || outName.endsWith("VertexAttribPointer")) &&
- !jfunc.getCFunc().hasPointerArg();
- if (isPointerFunc) {
- outName += "Bounds";
- }
-
- out.print("static ");
- out.println(getJniType(jfunc.getType()));
- out.print(outName);
-
- String rsignature = getJniName(jfunc.getType());
-
- String signature = "";
- int numArgs = jfunc.getNumArgs();
- for (int i = 0; i < numArgs; i++) {
- JType argType = jfunc.getArgType(i);
- signature += getJniName(argType);
- }
- if (isPointerFunc) {
- signature += "I";
- }
-
- // Append signature to function name
- String sig = getJniMangledName(signature).replace('.', '_').replace('/', '_');
- out.print("__" + sig);
- outName += "__" + sig;
-
- signature = signature.replace('.', '/');
- rsignature = rsignature.replace('.', '/');
-
- out.println();
- if (rsignature.length() == 0) {
- rsignature = "V";
- }
-
- String s = "{\"" +
- jfunc.getName() +
- (isPointerFunc ? "Bounds" : "") +
- "\", \"(" + signature +")" +
- rsignature +
- "\", (void *) " +
- outName +
- " },";
- nativeRegistrations.add(s);
-
- List<Integer> nonPrimitiveArgs = new ArrayList<Integer>();
- List<Integer> stringArgs = new ArrayList<Integer>();
- int numBufferArgs = 0;
- List<String> bufferArgNames = new ArrayList<String>();
-
- // Emit JNI signature (arguments)
- //
- // Example:
- //
- // (JNIEnv *_env, jobject this, jint plane, jfloatArray equation_ref, jint offset) {
- //
- out.print(" (JNIEnv *_env, jobject _this");
- for (int i = 0; i < numArgs; i++) {
- out.print(", ");
- JType argType = jfunc.getArgType(i);
- String suffix;
- if (!argType.isPrimitive()) {
- if (argType.isArray()) {
- suffix = "_ref";
- } else {
- suffix = "_buf";
- }
- nonPrimitiveArgs.add(new Integer(i));
- if (jfunc.getArgType(i).isBuffer()) {
- int cIndex = jfunc.getArgCIndex(i);
- String cname = cfunc.getArgName(cIndex);
- bufferArgNames.add(cname);
- numBufferArgs++;
- }
- } else {
- suffix = "";
- }
- if (argType.isString()) {
- stringArgs.add(new Integer(i));
- }
-
- out.print(getJniType(argType) + " " + jfunc.getArgName(i) + suffix);
- }
- if (isPointerFunc) {
- out.print(", jint remaining");
- }
- out.println(") {");
-
- int numArrays = 0;
- int numBuffers = 0;
- int numStrings = 0;
- for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
- int idx = nonPrimitiveArgs.get(i).intValue();
- JType argType = jfunc.getArgType(idx);
- if (argType.isArray()) {
- ++numArrays;
- }
- if (argType.isBuffer()) {
- ++numBuffers;
- }
- if (argType.isString()) {
- ++numStrings;
- }
- }
-
- // Emit method body
-
- // Emit local variable declarations for _exception and _returnValue
- //
- // Example:
- //
- // android::gl::ogles_context_t *ctx;
- //
- // jint _exception;
- // GLenum _returnValue;
- //
- CType returnType = cfunc.getType();
- boolean isVoid = returnType.isVoid();
-
- boolean isUnsupported = isUnsupportedFunc(cfunc);
- if (isUnsupported) {
- out.println(indent +
- "jniThrowException(_env, \"java/lang/UnsupportedOperationException\",");
- out.println(indent +
- " \"" + cfunc.getName() + "\");");
- if (!isVoid) {
- String retval = getErrorReturnValue(cfunc);
- out.println(indent + "return " + retval + ";");
- }
- out.println("}");
- out.println();
- return;
- }
-
- String requiresExtension = isRequiresFunc(cfunc);
- if (requiresExtension != null) {
- out.println(indent +
- "if (! supportsExtension(_env, _this, have_" + requiresExtension + "ID)) {");
- out.println(indent + indent +
- "jniThrowException(_env, \"java/lang/UnsupportedOperationException\",");
- out.println(indent + indent +
- " \"" + cfunc.getName() + "\");");
- if (isVoid) {
- out.println(indent + indent + " return;");
- } else {
- String retval = getErrorReturnValue(cfunc);
- out.println(indent + indent + " return " + retval + ";");
- }
- out.println(indent + "}");
- }
- if (mUseContextPointer) {
- out.println(indent +
- "android::gl::ogles_context_t *ctx = getContext(_env, _this);");
- }
-
- boolean initializeReturnValue = stringArgs.size() > 0;
-
- boolean emitExceptionCheck = (numArrays > 0 || numBuffers > 0 || numStrings > 0) &&
- hasNonConstArg(jfunc, cfunc, nonPrimitiveArgs);
- // mChecker.getChecks(cfunc.getName()) != null
-
- // Emit an _exeption variable if there will be error checks
- if (emitExceptionCheck) {
- out.println(indent + "jint _exception = 0;");
- }
-
- // Emit a single _array or multiple _XXXArray variables
- if (numBufferArgs == 1) {
- out.println(indent + "jarray _array = (jarray) 0;");
- } else {
- for (int i = 0; i < numBufferArgs; i++) {
- out.println(indent + "jarray _" + bufferArgNames.get(i) +
- "Array = (jarray) 0;");
- }
- }
- if (!isVoid) {
- String retval = getErrorReturnValue(cfunc);
- if (retval != null) {
- out.println(indent + returnType.getDeclaration() +
- " _returnValue = " + retval + ";");
- } else if (initializeReturnValue) {
- out.println(indent + returnType.getDeclaration() +
- " _returnValue = 0;");
- } else {
- out.println(indent + returnType.getDeclaration() +
- " _returnValue;");
- }
- }
-
- // Emit local variable declarations for pointer arguments
- //
- // Example:
- //
- // GLfixed *eqn_base;
- // GLfixed *eqn;
- //
- String offset = "offset";
- String remaining = "_remaining";
- if (nonPrimitiveArgs.size() > 0) {
- for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
- int idx = nonPrimitiveArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
- String cname = cfunc.getArgName(cIndex);
-
- CType type = cfunc.getArgType(jfunc.getArgCIndex(idx));
- String decl = type.getDeclaration();
- if (jfunc.getArgType(idx).isArray()) {
- out.println(indent +
- decl +
- (decl.endsWith("*") ? "" : " ") +
- jfunc.getArgName(idx) +
- "_base = (" + decl + ") 0;");
- }
- remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" :
- "_" + cname + "Remaining";
- out.println(indent +
- "jint " + remaining + ";");
- out.println(indent +
- decl +
- (decl.endsWith("*") ? "" : " ") +
- jfunc.getArgName(idx) +
- " = (" + decl + ") 0;");
- }
-
- out.println();
- }
-
- // Emit local variable declaration for strings
- if (stringArgs.size() > 0) {
- for (int i = 0; i < stringArgs.size(); i++) {
- int idx = stringArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
- String cname = cfunc.getArgName(cIndex);
-
- out.println(indent + "const char* _native" + cname + " = 0;");
- }
-
- out.println();
- }
-
- // Null pointer checks and GetStringUTFChars
- if (stringArgs.size() > 0) {
- for (int i = 0; i < stringArgs.size(); i++) {
- int idx = stringArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
- String cname = cfunc.getArgName(cIndex);
-
- CType type = cfunc.getArgType(jfunc.getArgCIndex(idx));
- String decl = type.getDeclaration();
- out.println(indent + "if (!" + cname + ") {");
- out.println(indent + " jniThrowException(_env, " +
- "\"java/lang/IllegalArgumentException\", \"" + cname + " == null\");");
- out.println(indent + " goto exit;");
- needsExit = true;
- out.println(indent + "}");
-
- out.println(indent + "_native" + cname + " = _env->GetStringUTFChars(" + cname + ", 0);");
- }
-
- out.println();
- }
-
- // Emit 'GetPrimitiveArrayCritical' for arrays
- // Emit 'GetPointer' calls for Buffer pointers
- int bufArgIdx = 0;
- if (nonPrimitiveArgs.size() > 0) {
- for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
- int idx = nonPrimitiveArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
-
- String cname = cfunc.getArgName(cIndex);
- offset = numArrays <= 1 ? "offset" :
- cname + "Offset";
- remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" :
- "_" + cname + "Remaining";
-
- if (jfunc.getArgType(idx).isArray()) {
- out.println(indent +
- "if (!" +
- cname +
- "_ref) {");
- if (emitExceptionCheck) {
- out.println(indent + indent + "_exception = 1;");
- }
- out.println(indent + " jniThrowException(_env, " +
- "\"java/lang/IllegalArgumentException\", " +
- "\"" + cname + " == null\");");
- out.println(indent + " goto exit;");
- needsExit = true;
- out.println(indent + "}");
-
- out.println(indent + "if (" + offset + " < 0) {");
- if (emitExceptionCheck) {
- out.println(indent + indent + "_exception = 1;");
- }
- out.println(indent + " jniThrowException(_env, " +
- "\"java/lang/IllegalArgumentException\", \"" + offset + " < 0\");");
- out.println(indent + " goto exit;");
- needsExit = true;
- out.println(indent + "}");
-
- out.println(indent + remaining + " = " +
- (mUseCPlusPlus ? "_env" : "(*_env)") +
- "->GetArrayLength(" +
- (mUseCPlusPlus ? "" : "_env, ") +
- cname + "_ref) - " + offset + ";");
-
- emitNativeBoundsChecks(cfunc, cname, out, false,
- emitExceptionCheck,
- offset, remaining, " ");
-
- out.println(indent +
- cname +
- "_base = (" +
- cfunc.getArgType(cIndex).getDeclaration() +
- ")");
- out.println(indent + " " +
- (mUseCPlusPlus ? "_env" : "(*_env)") +
- "->GetPrimitiveArrayCritical(" +
- (mUseCPlusPlus ? "" : "_env, ") +
- jfunc.getArgName(idx) +
- "_ref, (jboolean *)0);");
- out.println(indent +
- cname + " = " + cname + "_base + " + offset +
- ";");
- out.println();
- } else {
- String array = numBufferArgs <= 1 ? "_array" :
- "_" + bufferArgNames.get(bufArgIdx++) + "Array";
-
- boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
- if (nullAllowed) {
- out.println(indent + "if (" + cname + "_buf) {");
- out.print(indent);
- }
-
- if (isPointerFunc) {
- out.println(indent +
- cname +
- " = (" +
- cfunc.getArgType(cIndex).getDeclaration() +
- ") getDirectBufferPointer(_env, " +
- cname + "_buf);");
- String iii = " ";
- out.println(iii + indent + "if ( ! " + cname + " ) {");
- out.println(iii + iii + indent + "return;");
- out.println(iii + indent + "}");
- } else {
- out.println(indent +
- cname +
- " = (" +
- cfunc.getArgType(cIndex).getDeclaration() +
- ")getPointer(_env, " +
- cname +
- "_buf, &" + array + ", &" + remaining +
- ");");
- }
-
- emitNativeBoundsChecks(cfunc, cname, out, true,
- emitExceptionCheck,
- offset, remaining, nullAllowed ? " " : " ");
-
- if (nullAllowed) {
- out.println(indent + "}");
- }
- }
- }
- }
-
- if (!isVoid) {
- out.print(indent + "_returnValue = ");
- } else {
- out.print(indent);
- }
- String name = cfunc.getName();
-
- if (mUseContextPointer) {
- name = name.substring(2, name.length()); // Strip off 'gl' prefix
- name = name.substring(0, 1).toLowerCase() +
- name.substring(1, name.length());
- out.print("ctx->procs.");
- }
-
- out.print(name + (isPointerFunc ? "Bounds" : "") + "(");
-
- numArgs = cfunc.getNumArgs();
- if (numArgs == 0) {
- if (mUseContextPointer) {
- out.println("ctx);");
- } else {
- out.println(");");
- }
- } else {
- if (mUseContextPointer) {
- out.println("ctx,");
- } else {
- out.println();
- }
- for (int i = 0; i < numArgs; i++) {
- String typecast;
- if (i == numArgs - 1 && isVBOPointerFunc) {
- typecast = "const GLvoid *";
- } else {
- typecast = cfunc.getArgType(i).getDeclaration();
- }
- out.print(indent + indent +
- "(" +
- typecast +
- ")");
- if (cfunc.getArgType(i).isConstCharPointer()) {
- out.print("_native");
- }
- out.print(cfunc.getArgName(i));
-
- if (i == numArgs - 1) {
- if (isPointerFunc) {
- out.println(",");
- out.println(indent + indent + "(GLsizei)remaining");
- } else {
- out.println();
- }
- } else {
- out.println(",");
- }
- }
- out.println(indent + ");");
- }
-
- if (needsExit) {
- out.println();
- out.println("exit:");
- needsExit = false;
- }
-
- bufArgIdx = 0;
- if (nonPrimitiveArgs.size() > 0) {
- for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) {
- int idx = nonPrimitiveArgs.get(i).intValue();
-
- int cIndex = jfunc.getArgCIndex(idx);
- if (jfunc.getArgType(idx).isArray()) {
-
- // If the argument is 'const', GL will not write to it.
- // In this case, we can use the 'JNI_ABORT' flag to avoid
- // the need to write back to the Java array
- out.println(indent +
- "if (" + jfunc.getArgName(idx) + "_base) {");
- out.println(indent + indent +
- (mUseCPlusPlus ? "_env" : "(*_env)") +
- "->ReleasePrimitiveArrayCritical(" +
- (mUseCPlusPlus ? "" : "_env, ") +
- jfunc.getArgName(idx) + "_ref, " +
- cfunc.getArgName(cIndex) +
- "_base,");
- out.println(indent + indent + indent +
- (cfunc.getArgType(cIndex).isConst() ?
- "JNI_ABORT" :
- "_exception ? JNI_ABORT: 0") +
- ");");
- out.println(indent + "}");
- } else if (jfunc.getArgType(idx).isBuffer()) {
- if (! isPointerFunc) {
- String array = numBufferArgs <= 1 ? "_array" :
- "_" + bufferArgNames.get(bufArgIdx++) + "Array";
- out.println(indent + "if (" + array + ") {");
- out.println(indent + indent +
- "releasePointer(_env, " + array + ", " +
- cfunc.getArgName(cIndex) +
- ", " +
- (cfunc.getArgType(cIndex).isConst() ?
- "JNI_FALSE" : "_exception ? JNI_FALSE :" +
- " JNI_TRUE") +
- ");");
- out.println(indent + "}");
- }
- }
- }
- }
-
- // Emit local variable declaration for strings
- if (stringArgs.size() > 0) {
- for (int i = 0; i < stringArgs.size(); i++) {
- int idx = stringArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
- String cname = cfunc.getArgName(cIndex);
-
- out.println(indent + "if (_native" + cname + ") {");
- out.println(indent + " _env->ReleaseStringUTFChars(" + cname + ", _native" + cname + ");");
- out.println(indent + "}");
- }
-
- out.println();
- }
-
-
- if (!isVoid) {
- out.println(indent + "return _returnValue;");
- }
-
- out.println("}");
- out.println();
- }
-
-}
diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
deleted file mode 100644
index c10efe3..0000000
--- a/opengl/tools/glgen/src/Jsr239CodeEmitter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-import java.io.PrintStream;
-
-/**
- * Emits a Java interface and Java & C implementation for a C function.
- *
- * <p> The Java interface will have Buffer and array variants for functions that
- * have a typed pointer argument. The array variant will convert a single "<type> *data"
- * argument to a pair of arguments "<type>[] data, int offset".
- */
-public class Jsr239CodeEmitter extends JniCodeEmitter implements CodeEmitter {
-
- PrintStream mJava10InterfaceStream;
- PrintStream mJava10ExtInterfaceStream;
- PrintStream mJava11InterfaceStream;
- PrintStream mJava11ExtInterfaceStream;
- PrintStream mJava11ExtPackInterfaceStream;
- PrintStream mJavaImplStream;
- PrintStream mCStream;
-
- PrintStream mJavaInterfaceStream;
-
- /**
- * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
- * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
- * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions
- * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
- * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
- * @param javaImplStream the PrintStream to which to emit the Java implementation
- * @param cStream the PrintStream to which to emit the C implementation
- */
- public Jsr239CodeEmitter(String classPathName,
- ParameterChecker checker,
- PrintStream java10InterfaceStream,
- PrintStream java10ExtInterfaceStream,
- PrintStream java11InterfaceStream,
- PrintStream java11ExtInterfaceStream,
- PrintStream java11ExtPackInterfaceStream,
- PrintStream javaImplStream,
- PrintStream cStream,
- boolean useContextPointer) {
- mClassPathName = classPathName;
- mChecker = checker;
- mJava10InterfaceStream = java10InterfaceStream;
- mJava10ExtInterfaceStream = java10ExtInterfaceStream;
- mJava11InterfaceStream = java11InterfaceStream;
- mJava11ExtInterfaceStream = java11ExtInterfaceStream;
- mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
- mJavaImplStream = javaImplStream;
- mCStream = cStream;
- mUseContextPointer = useContextPointer;
- }
-
- public void setVersion(int version, boolean ext, boolean pack) {
- if (version == 0) {
- mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
- mJava10InterfaceStream;
- } else if (version == 1) {
- mJavaInterfaceStream = ext ?
- (pack ? mJava11ExtPackInterfaceStream :
- mJava11ExtInterfaceStream) :
- mJava11InterfaceStream;
- } else {
- throw new RuntimeException("Bad version: " + version);
- }
- }
-
- public void emitCode(CFunc cfunc, String original) {
- emitCode(cfunc, original, mJavaInterfaceStream, mJavaImplStream, mCStream);
- }
-
- public void emitNativeRegistration() {
- emitNativeRegistration("register_com_google_android_gles_jni_GLImpl", mCStream);
- }
-}
diff --git a/opengl/tools/glgen/src/ParameterChecker.java b/opengl/tools/glgen/src/ParameterChecker.java
deleted file mode 100644
index bff6d86..0000000
--- a/opengl/tools/glgen/src/ParameterChecker.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * 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.
- */
-
-import java.io.BufferedReader;
-import java.util.HashMap;
-
-public class ParameterChecker {
-
- HashMap<String,String[]> map = new HashMap<String,String[]>();
-
- public ParameterChecker(BufferedReader reader) throws Exception {
- String s;
- while ((s = reader.readLine()) != null) {
- String[] tokens = s.split("\\s");
- map.put(tokens[0], tokens);
- }
- }
-
- public String[] getChecks(String functionName) {
- String[] checks = map.get(functionName);
- if (checks == null &&
- (functionName.endsWith("fv") ||
- functionName.endsWith("xv") ||
- functionName.endsWith("iv"))) {
- functionName = functionName.substring(0, functionName.length() - 2);
- checks = map.get(functionName);
- }
- return checks;
- }
-}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if
deleted file mode 100644
index 42891ea..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if
+++ /dev/null
@@ -1,26 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package android.opengl;
-
-public class GLES10Ext {
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
-
\ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
deleted file mode 100644
index 5d418d7..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-
-#include <assert.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-static int initialized = 0;
-
-static jclass nioAccessClass;
-static jclass bufferClass;
-static jmethodID getBasePointerID;
-static jmethodID getBaseArrayID;
-static jmethodID getBaseArrayOffsetID;
-static jfieldID positionID;
-static jfieldID limitID;
-static jfieldID elementSizeShiftID;
-
-/* Cache method IDs each time the class is loaded. */
-
-static void
-nativeClassInit(JNIEnv *_env, jclass glImplClass)
-{
- jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
- nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
-
- jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
- bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
-
- getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
- "getBasePointer", "(Ljava/nio/Buffer;)J");
- getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
- getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
-
- positionID = _env->GetFieldID(bufferClass, "position", "I");
- limitID = _env->GetFieldID(bufferClass, "limit", "I");
- elementSizeShiftID =
- _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
-}
-
-
-static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
-{
- jint position;
- jint limit;
- jint elementSizeShift;
- jlong pointer;
- jint offset;
- void *data;
-
- position = _env->GetIntField(buffer, positionID);
- limit = _env->GetIntField(buffer, limitID);
- elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- *remaining = (limit - position) << elementSizeShift;
- pointer = _env->CallStaticLongMethod(nioAccessClass,
- getBasePointerID, buffer);
- if (pointer != 0L) {
- *array = NULL;
- return (void *) (jint) pointer;
- }
-
- *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
- getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
- getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
-}
-
-
-static void
-releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
-{
- _env->ReleasePrimitiveArrayCritical(array, data,
- commit ? 0 : JNI_ABORT);
-}
-
-// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if
deleted file mode 100644
index 4b2a831..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if
+++ /dev/null
@@ -1,271 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package android.opengl;
-
-import java.nio.Buffer;
-
-public class GLES10 {
- public static final int GL_ADD = 0x0104;
- public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E;
- public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846D;
- public static final int GL_ALPHA = 0x1906;
- public static final int GL_ALPHA_BITS = 0x0D55;
- public static final int GL_ALPHA_TEST = 0x0BC0;
- public static final int GL_ALWAYS = 0x0207;
- public static final int GL_AMBIENT = 0x1200;
- public static final int GL_AMBIENT_AND_DIFFUSE = 0x1602;
- public static final int GL_AND = 0x1501;
- public static final int GL_AND_INVERTED = 0x1504;
- public static final int GL_AND_REVERSE = 0x1502;
- public static final int GL_BACK = 0x0405;
- public static final int GL_BLEND = 0x0BE2;
- public static final int GL_BLUE_BITS = 0x0D54;
- public static final int GL_BYTE = 0x1400;
- public static final int GL_CCW = 0x0901;
- public static final int GL_CLAMP_TO_EDGE = 0x812F;
- public static final int GL_CLEAR = 0x1500;
- public static final int GL_COLOR_ARRAY = 0x8076;
- public static final int GL_COLOR_BUFFER_BIT = 0x4000;
- public static final int GL_COLOR_LOGIC_OP = 0x0BF2;
- public static final int GL_COLOR_MATERIAL = 0x0B57;
- public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3;
- public static final int GL_CONSTANT_ATTENUATION = 0x1207;
- public static final int GL_COPY = 0x1503;
- public static final int GL_COPY_INVERTED = 0x150C;
- public static final int GL_CULL_FACE = 0x0B44;
- public static final int GL_CW = 0x0900;
- public static final int GL_DECAL = 0x2101;
- public static final int GL_DECR = 0x1E03;
- public static final int GL_DEPTH_BITS = 0x0D56;
- public static final int GL_DEPTH_BUFFER_BIT = 0x0100;
- public static final int GL_DEPTH_TEST = 0x0B71;
- public static final int GL_DIFFUSE = 0x1201;
- public static final int GL_DITHER = 0x0BD0;
- public static final int GL_DONT_CARE = 0x1100;
- public static final int GL_DST_ALPHA = 0x0304;
- public static final int GL_DST_COLOR = 0x0306;
- public static final int GL_EMISSION = 0x1600;
- public static final int GL_EQUAL = 0x0202;
- public static final int GL_EQUIV = 0x1509;
- public static final int GL_EXP = 0x0800;
- public static final int GL_EXP2 = 0x0801;
- public static final int GL_EXTENSIONS = 0x1F03;
- public static final int GL_FALSE = 0;
- public static final int GL_FASTEST = 0x1101;
- public static final int GL_FIXED = 0x140C;
- public static final int GL_FLAT = 0x1D00;
- public static final int GL_FLOAT = 0x1406;
- public static final int GL_FOG = 0x0B60;
- public static final int GL_FOG_COLOR = 0x0B66;
- public static final int GL_FOG_DENSITY = 0x0B62;
- public static final int GL_FOG_END = 0x0B64;
- public static final int GL_FOG_HINT = 0x0C54;
- public static final int GL_FOG_MODE = 0x0B65;
- public static final int GL_FOG_START = 0x0B63;
- public static final int GL_FRONT = 0x0404;
- public static final int GL_FRONT_AND_BACK = 0x0408;
- public static final int GL_GEQUAL = 0x0206;
- public static final int GL_GREATER = 0x0204;
- public static final int GL_GREEN_BITS = 0x0D53;
- public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B;
- public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A;
- public static final int GL_INCR = 0x1E02;
- public static final int GL_INVALID_ENUM = 0x0500;
- public static final int GL_INVALID_OPERATION = 0x0502;
- public static final int GL_INVALID_VALUE = 0x0501;
- public static final int GL_INVERT = 0x150A;
- public static final int GL_KEEP = 0x1E00;
- public static final int GL_LEQUAL = 0x0203;
- public static final int GL_LESS = 0x0201;
- public static final int GL_LIGHT_MODEL_AMBIENT = 0x0B53;
- public static final int GL_LIGHT_MODEL_TWO_SIDE = 0x0B52;
- public static final int GL_LIGHT0 = 0x4000;
- public static final int GL_LIGHT1 = 0x4001;
- public static final int GL_LIGHT2 = 0x4002;
- public static final int GL_LIGHT3 = 0x4003;
- public static final int GL_LIGHT4 = 0x4004;
- public static final int GL_LIGHT5 = 0x4005;
- public static final int GL_LIGHT6 = 0x4006;
- public static final int GL_LIGHT7 = 0x4007;
- public static final int GL_LIGHTING = 0x0B50;
- public static final int GL_LINE_LOOP = 0x0002;
- public static final int GL_LINE_SMOOTH = 0x0B20;
- public static final int GL_LINE_SMOOTH_HINT = 0x0C52;
- public static final int GL_LINE_STRIP = 0x0003;
- public static final int GL_LINEAR = 0x2601;
- public static final int GL_LINEAR_ATTENUATION = 0x1208;
- public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703;
- public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
- public static final int GL_LINES = 0x0001;
- public static final int GL_LUMINANCE = 0x1909;
- public static final int GL_LUMINANCE_ALPHA = 0x190A;
- public static final int GL_MAX_ELEMENTS_INDICES = 0x80E9;
- public static final int GL_MAX_ELEMENTS_VERTICES = 0x80E8;
- public static final int GL_MAX_LIGHTS = 0x0D31;
- public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36;
- public static final int GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38;
- public static final int GL_MAX_TEXTURE_SIZE = 0x0D33;
- public static final int GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39;
- public static final int GL_MAX_TEXTURE_UNITS = 0x84E2;
- public static final int GL_MAX_VIEWPORT_DIMS = 0x0D3A;
- public static final int GL_MODELVIEW = 0x1700;
- public static final int GL_MODULATE = 0x2100;
- public static final int GL_MULTISAMPLE = 0x809D;
- public static final int GL_NAND = 0x150E;
- public static final int GL_NEAREST = 0x2600;
- public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702;
- public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
- public static final int GL_NEVER = 0x0200;
- public static final int GL_NICEST = 0x1102;
- public static final int GL_NO_ERROR = 0;
- public static final int GL_NOOP = 0x1505;
- public static final int GL_NOR = 0x1508;
- public static final int GL_NORMAL_ARRAY = 0x8075;
- public static final int GL_NORMALIZE = 0x0BA1;
- public static final int GL_NOTEQUAL = 0x0205;
- public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
- public static final int GL_ONE = 1;
- public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305;
- public static final int GL_ONE_MINUS_DST_COLOR = 0x0307;
- public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303;
- public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301;
- public static final int GL_OR = 0x1507;
- public static final int GL_OR_INVERTED = 0x150D;
- public static final int GL_OR_REVERSE = 0x150B;
- public static final int GL_OUT_OF_MEMORY = 0x0505;
- public static final int GL_PACK_ALIGNMENT = 0x0D05;
- public static final int GL_PALETTE4_R5_G6_B5_OES = 0x8B92;
- public static final int GL_PALETTE4_RGB5_A1_OES = 0x8B94;
- public static final int GL_PALETTE4_RGB8_OES = 0x8B90;
- public static final int GL_PALETTE4_RGBA4_OES = 0x8B93;
- public static final int GL_PALETTE4_RGBA8_OES = 0x8B91;
- public static final int GL_PALETTE8_R5_G6_B5_OES = 0x8B97;
- public static final int GL_PALETTE8_RGB5_A1_OES = 0x8B99;
- public static final int GL_PALETTE8_RGB8_OES = 0x8B95;
- public static final int GL_PALETTE8_RGBA4_OES = 0x8B98;
- public static final int GL_PALETTE8_RGBA8_OES = 0x8B96;
- public static final int GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50;
- public static final int GL_POINT_SMOOTH = 0x0B10;
- public static final int GL_POINT_SMOOTH_HINT = 0x0C51;
- public static final int GL_POINTS = 0x0000;
- public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128;
- public static final int GL_POINT_SIZE = 0x0B11;
- public static final int GL_POLYGON_OFFSET_FILL = 0x8037;
- public static final int GL_POLYGON_SMOOTH_HINT = 0x0C53;
- public static final int GL_POSITION = 0x1203;
- public static final int GL_PROJECTION = 0x1701;
- public static final int GL_QUADRATIC_ATTENUATION = 0x1209;
- public static final int GL_RED_BITS = 0x0D52;
- public static final int GL_RENDERER = 0x1F01;
- public static final int GL_REPEAT = 0x2901;
- public static final int GL_REPLACE = 0x1E01;
- public static final int GL_RESCALE_NORMAL = 0x803A;
- public static final int GL_RGB = 0x1907;
- public static final int GL_RGBA = 0x1908;
- public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
- public static final int GL_SAMPLE_ALPHA_TO_ONE = 0x809F;
- public static final int GL_SAMPLE_COVERAGE = 0x80A0;
- public static final int GL_SCISSOR_TEST = 0x0C11;
- public static final int GL_SET = 0x150F;
- public static final int GL_SHININESS = 0x1601;
- public static final int GL_SHORT = 0x1402;
- public static final int GL_SMOOTH = 0x1D01;
- public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22;
- public static final int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12;
- public static final int GL_SPECULAR = 0x1202;
- public static final int GL_SPOT_CUTOFF = 0x1206;
- public static final int GL_SPOT_DIRECTION = 0x1204;
- public static final int GL_SPOT_EXPONENT = 0x1205;
- public static final int GL_SRC_ALPHA = 0x0302;
- public static final int GL_SRC_ALPHA_SATURATE = 0x0308;
- public static final int GL_SRC_COLOR = 0x0300;
- public static final int GL_STACK_OVERFLOW = 0x0503;
- public static final int GL_STACK_UNDERFLOW = 0x0504;
- public static final int GL_STENCIL_BITS = 0x0D57;
- public static final int GL_STENCIL_BUFFER_BIT = 0x0400;
- public static final int GL_STENCIL_TEST = 0x0B90;
- public static final int GL_SUBPIXEL_BITS = 0x0D50;
- public static final int GL_TEXTURE = 0x1702;
- public static final int GL_TEXTURE_2D = 0x0DE1;
- public static final int GL_TEXTURE_COORD_ARRAY = 0x8078;
- public static final int GL_TEXTURE_ENV = 0x2300;
- public static final int GL_TEXTURE_ENV_COLOR = 0x2201;
- public static final int GL_TEXTURE_ENV_MODE = 0x2200;
- public static final int GL_TEXTURE_MAG_FILTER = 0x2800;
- public static final int GL_TEXTURE_MIN_FILTER = 0x2801;
- public static final int GL_TEXTURE_WRAP_S = 0x2802;
- public static final int GL_TEXTURE_WRAP_T = 0x2803;
- public static final int GL_TEXTURE0 = 0x84C0;
- public static final int GL_TEXTURE1 = 0x84C1;
- public static final int GL_TEXTURE2 = 0x84C2;
- public static final int GL_TEXTURE3 = 0x84C3;
- public static final int GL_TEXTURE4 = 0x84C4;
- public static final int GL_TEXTURE5 = 0x84C5;
- public static final int GL_TEXTURE6 = 0x84C6;
- public static final int GL_TEXTURE7 = 0x84C7;
- public static final int GL_TEXTURE8 = 0x84C8;
- public static final int GL_TEXTURE9 = 0x84C9;
- public static final int GL_TEXTURE10 = 0x84CA;
- public static final int GL_TEXTURE11 = 0x84CB;
- public static final int GL_TEXTURE12 = 0x84CC;
- public static final int GL_TEXTURE13 = 0x84CD;
- public static final int GL_TEXTURE14 = 0x84CE;
- public static final int GL_TEXTURE15 = 0x84CF;
- public static final int GL_TEXTURE16 = 0x84D0;
- public static final int GL_TEXTURE17 = 0x84D1;
- public static final int GL_TEXTURE18 = 0x84D2;
- public static final int GL_TEXTURE19 = 0x84D3;
- public static final int GL_TEXTURE20 = 0x84D4;
- public static final int GL_TEXTURE21 = 0x84D5;
- public static final int GL_TEXTURE22 = 0x84D6;
- public static final int GL_TEXTURE23 = 0x84D7;
- public static final int GL_TEXTURE24 = 0x84D8;
- public static final int GL_TEXTURE25 = 0x84D9;
- public static final int GL_TEXTURE26 = 0x84DA;
- public static final int GL_TEXTURE27 = 0x84DB;
- public static final int GL_TEXTURE28 = 0x84DC;
- public static final int GL_TEXTURE29 = 0x84DD;
- public static final int GL_TEXTURE30 = 0x84DE;
- public static final int GL_TEXTURE31 = 0x84DF;
- public static final int GL_TRIANGLE_FAN = 0x0006;
- public static final int GL_TRIANGLE_STRIP = 0x0005;
- public static final int GL_TRIANGLES = 0x0004;
- public static final int GL_TRUE = 1;
- public static final int GL_UNPACK_ALIGNMENT = 0x0CF5;
- public static final int GL_UNSIGNED_BYTE = 0x1401;
- public static final int GL_UNSIGNED_SHORT = 0x1403;
- public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
- public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
- public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
- public static final int GL_VENDOR = 0x1F00;
- public static final int GL_VERSION = 0x1F02;
- public static final int GL_VERTEX_ARRAY = 0x8074;
- public static final int GL_XOR = 0x1506;
- public static final int GL_ZERO = 0;
-
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
-
- private static Buffer _colorPointer;
- private static Buffer _normalPointer;
- private static Buffer _texCoordPointer;
- private static Buffer _vertexPointer;
-
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
deleted file mode 100644
index 35a3c33..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-
-#include <assert.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-/* special calls implemented in Android's GLES wrapper used to more
- * efficiently bound-check passed arrays */
-extern "C" {
-GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count);
-GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
- const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-}
-
-static int initialized = 0;
-
-static jclass nioAccessClass;
-static jclass bufferClass;
-static jmethodID getBasePointerID;
-static jmethodID getBaseArrayID;
-static jmethodID getBaseArrayOffsetID;
-static jfieldID positionID;
-static jfieldID limitID;
-static jfieldID elementSizeShiftID;
-
-/* Cache method IDs each time the class is loaded. */
-
-static void
-nativeClassInit(JNIEnv *_env, jclass glImplClass)
-{
- jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
- nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
-
- jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
- bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
-
- getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
- "getBasePointer", "(Ljava/nio/Buffer;)J");
- getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
- getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
-
- positionID = _env->GetFieldID(bufferClass, "position", "I");
- limitID = _env->GetFieldID(bufferClass, "limit", "I");
- elementSizeShiftID =
- _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
-}
-
-static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
-{
- jint position;
- jint limit;
- jint elementSizeShift;
- jlong pointer;
- jint offset;
- void *data;
-
- position = _env->GetIntField(buffer, positionID);
- limit = _env->GetIntField(buffer, limitID);
- elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- *remaining = (limit - position) << elementSizeShift;
- pointer = _env->CallStaticLongMethod(nioAccessClass,
- getBasePointerID, buffer);
- if (pointer != 0L) {
- *array = NULL;
- return (void *) (jint) pointer;
- }
-
- *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
- getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
- getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
-}
-
-static void
-releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
-{
- _env->ReleasePrimitiveArrayCritical(array, data,
- commit ? 0 : JNI_ABORT);
-}
-
-static void *
-getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
- char* buf = (char*) _env->GetDirectBufferAddress(buffer);
- if (buf) {
- jint position = _env->GetIntField(buffer, positionID);
- jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- buf += position << elementSizeShift;
- } else {
- jniThrowException(_env, "java/lang/IllegalArgumentException",
- "Must use a native order direct Buffer");
- }
- return (void*) buf;
-}
-
-static int
-getNumCompressedTextureFormats() {
- int numCompressedTextureFormats = 0;
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
- return numCompressedTextureFormats;
-}
-
-// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
deleted file mode 100644
index 0c5fa04..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
+++ /dev/null
@@ -1,142 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package android.opengl;
-
-import java.nio.Buffer;
-
-public class GLES11Ext {
- public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009;
- public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
- public static final int GL_BLEND_DST_RGB_OES = 0x80C8;
- public static final int GL_BLEND_SRC_RGB_OES = 0x80C9;
- public static final int GL_BLEND_DST_ALPHA_OES = 0x80CA;
- public static final int GL_BLEND_SRC_ALPHA_OES = 0x80CB;
- public static final int GL_BLEND_EQUATION_OES = 0x8009;
- public static final int GL_FUNC_ADD_OES = 0x8006;
- public static final int GL_FUNC_SUBTRACT_OES = 0x800A;
- public static final int GL_FUNC_REVERSE_SUBTRACT_OES = 0x800B;
- public static final int GL_ETC1_RGB8_OES = 0x8D64;
- public static final int GL_DEPTH_COMPONENT24_OES = 0x81A6;
- public static final int GL_DEPTH_COMPONENT32_OES = 0x81A7;
- public static final int GL_TEXTURE_CROP_RECT_OES = 0x8B9D;
- public static final int GL_FIXED_OES = 0x140C;
- public static final int GL_NONE_OES = 0;
- public static final int GL_FRAMEBUFFER_OES = 0x8D40;
- public static final int GL_RENDERBUFFER_OES = 0x8D41;
- public static final int GL_RGBA4_OES = 0x8056;
- public static final int GL_RGB5_A1_OES = 0x8057;
- public static final int GL_RGB565_OES = 0x8D62;
- public static final int GL_DEPTH_COMPONENT16_OES = 0x81A5;
- public static final int GL_RENDERBUFFER_WIDTH_OES = 0x8D42;
- public static final int GL_RENDERBUFFER_HEIGHT_OES = 0x8D43;
- public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44;
- public static final int GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50;
- public static final int GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51;
- public static final int GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52;
- public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53;
- public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54;
- public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3;
- public static final int GL_COLOR_ATTACHMENT0_OES = 0x8CE0;
- public static final int GL_DEPTH_ATTACHMENT_OES = 0x8D00;
- public static final int GL_STENCIL_ATTACHMENT_OES = 0x8D20;
- public static final int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA;
- public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD;
- public static final int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6;
- public static final int GL_RENDERBUFFER_BINDING_OES = 0x8CA7;
- public static final int GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8;
- public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506;
- public static final int GL_WRITE_ONLY_OES = 0x88B9;
- public static final int GL_BUFFER_ACCESS_OES = 0x88BB;
- public static final int GL_BUFFER_MAPPED_OES = 0x88BC;
- public static final int GL_BUFFER_MAP_POINTER_OES = 0x88BD;
- public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D;
- public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E;
- public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F;
- public static final int GL_MAX_VERTEX_UNITS_OES = 0x86A4;
- public static final int GL_MAX_PALETTE_MATRICES_OES = 0x8842;
- public static final int GL_MATRIX_PALETTE_OES = 0x8840;
- public static final int GL_MATRIX_INDEX_ARRAY_OES = 0x8844;
- public static final int GL_WEIGHT_ARRAY_OES = 0x86AD;
- public static final int GL_CURRENT_PALETTE_MATRIX_OES = 0x8843;
- public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 0x8846;
- public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 0x8847;
- public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 0x8848;
- public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 0x8849;
- public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 0x8B9E;
- public static final int GL_WEIGHT_ARRAY_SIZE_OES = 0x86AB;
- public static final int GL_WEIGHT_ARRAY_TYPE_OES = 0x86A9;
- public static final int GL_WEIGHT_ARRAY_STRIDE_OES = 0x86AA;
- public static final int GL_WEIGHT_ARRAY_POINTER_OES = 0x86AC;
- public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 0x889E;
- public static final int GL_DEPTH_STENCIL_OES = 0x84F9;
- public static final int GL_UNSIGNED_INT_24_8_OES = 0x84FA;
- public static final int GL_DEPTH24_STENCIL8_OES = 0x88F0;
- public static final int GL_RGB8_OES = 0x8051;
- public static final int GL_RGBA8_OES = 0x8058;
- public static final int GL_STENCIL_INDEX1_OES = 0x8D46;
- public static final int GL_STENCIL_INDEX4_OES = 0x8D47;
- public static final int GL_STENCIL_INDEX8_OES = 0x8D48;
- public static final int GL_INCR_WRAP_OES = 0x8507;
- public static final int GL_DECR_WRAP_OES = 0x8508;
- public static final int GL_NORMAL_MAP_OES = 0x8511;
- public static final int GL_REFLECTION_MAP_OES = 0x8512;
- public static final int GL_TEXTURE_CUBE_MAP_OES = 0x8513;
- public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES = 0x8514;
- public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES = 0x8515;
- public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES = 0x8516;
- public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES = 0x8517;
- public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES = 0x8518;
- public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES = 0x8519;
- public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES = 0x851A;
- public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES = 0x851C;
- public static final int GL_TEXTURE_GEN_MODE_OES = 0x2500;
- public static final int GL_TEXTURE_GEN_STR_OES = 0x8D60;
- public static final int GL_MIRRORED_REPEAT_OES = 0x8370;
- public static final int GL_3DC_X_AMD = 0x87F9;
- public static final int GL_3DC_XY_AMD = 0x87FA;
- public static final int GL_ATC_RGB_AMD = 0x8C92;
- public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8C93;
- public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87EE;
- public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
- public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
- public static final int GL_BGRA = 0x80E1;
- public static final int GL_TEXTURE_EXTERNAL_OES = 0x8D65;
- public static final int GL_SAMPLER_EXTERNAL_OES = 0x8D66;
- public static final int GL_TEXTURE_BINDING_EXTERNAL_OES = 0x8D67;
- public static final int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8D68;
-
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
-
- private static final int GL_BYTE = GLES10.GL_BYTE;
- private static final int GL_FIXED = GLES10.GL_FIXED;
- private static final int GL_FLOAT = GLES10.GL_FLOAT;
- private static final int GL_SHORT = GLES10.GL_SHORT;
-
- private static Buffer _matrixIndexPointerOES;
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
deleted file mode 100644
index 9b29a44..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-
-#include <assert.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-/* special calls implemented in Android's GLES wrapper used to more
- * efficiently bound-check passed arrays */
-extern "C" {
-GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count);
-GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count);
-}
-
-static int initialized = 0;
-
-static jclass nioAccessClass;
-static jclass bufferClass;
-static jmethodID getBasePointerID;
-static jmethodID getBaseArrayID;
-static jmethodID getBaseArrayOffsetID;
-static jfieldID positionID;
-static jfieldID limitID;
-static jfieldID elementSizeShiftID;
-
-/* Cache method IDs each time the class is loaded. */
-
-static void
-nativeClassInit(JNIEnv *_env, jclass glImplClass)
-{
- jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
- nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
-
- jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
- bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
-
- getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
- "getBasePointer", "(Ljava/nio/Buffer;)J");
- getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
- getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
-
- positionID = _env->GetFieldID(bufferClass, "position", "I");
- limitID = _env->GetFieldID(bufferClass, "limit", "I");
- elementSizeShiftID =
- _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
-}
-
-
-static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
-{
- jint position;
- jint limit;
- jint elementSizeShift;
- jlong pointer;
- jint offset;
- void *data;
-
- position = _env->GetIntField(buffer, positionID);
- limit = _env->GetIntField(buffer, limitID);
- elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- *remaining = (limit - position) << elementSizeShift;
- pointer = _env->CallStaticLongMethod(nioAccessClass,
- getBasePointerID, buffer);
- if (pointer != 0L) {
- *array = NULL;
- return (void *) (jint) pointer;
- }
-
- *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
- getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
- getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
-}
-
-
-static void
-releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
-{
- _env->ReleasePrimitiveArrayCritical(array, data,
- commit ? 0 : JNI_ABORT);
-}
-
-static void *
-getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
- char* buf = (char*) _env->GetDirectBufferAddress(buffer);
- if (buf) {
- jint position = _env->GetIntField(buffer, positionID);
- jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- buf += position << elementSizeShift;
- } else {
- jniThrowException(_env, "java/lang/IllegalArgumentException",
- "Must use a native order direct Buffer");
- }
- return (void*) buf;
-}
-// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
deleted file mode 100644
index 81572d2..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
+++ /dev/null
@@ -1,152 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package android.opengl;
-
-import java.nio.Buffer;
-
-public class GLES11 extends GLES10 {
- public static final int GL_ACTIVE_TEXTURE = 0x84E0;
- public static final int GL_ADD_SIGNED = 0x8574;
- public static final int GL_ALPHA_SCALE = 0x0D1C;
- public static final int GL_ALPHA_TEST_FUNC = 0x0BC1;
- public static final int GL_ALPHA_TEST_REF = 0x0BC2;
- public static final int GL_ARRAY_BUFFER = 0x8892;
- public static final int GL_ARRAY_BUFFER_BINDING = 0x8894;
- public static final int GL_BLEND_DST = 0x0BE0;
- public static final int GL_BLEND_SRC = 0x0BE1;
- public static final int GL_BUFFER_ACCESS = 0x88BB;
- public static final int GL_BUFFER_SIZE = 0x8764;
- public static final int GL_BUFFER_USAGE = 0x8765;
- public static final int GL_CLIENT_ACTIVE_TEXTURE = 0x84E1;
- public static final int GL_CLIP_PLANE0 = 0x3000;
- public static final int GL_CLIP_PLANE1 = 0x3001;
- public static final int GL_CLIP_PLANE2 = 0x3002;
- public static final int GL_CLIP_PLANE3 = 0x3003;
- public static final int GL_CLIP_PLANE4 = 0x3004;
- public static final int GL_CLIP_PLANE5 = 0x3005;
- public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898;
- public static final int GL_COLOR_ARRAY_POINTER = 0x8090;
- public static final int GL_COLOR_ARRAY_SIZE = 0x8081;
- public static final int GL_COLOR_ARRAY_STRIDE = 0x8083;
- public static final int GL_COLOR_ARRAY_TYPE = 0x8082;
- public static final int GL_COLOR_CLEAR_VALUE = 0x0C22;
- public static final int GL_COLOR_WRITEMASK = 0x0C23;
- public static final int GL_COMBINE = 0x8570;
- public static final int GL_COMBINE_ALPHA = 0x8572;
- public static final int GL_COMBINE_RGB = 0x8571;
- public static final int GL_CONSTANT = 0x8576;
- public static final int GL_COORD_REPLACE_OES = 0x8862;
- public static final int GL_CULL_FACE_MODE = 0x0B45;
- public static final int GL_CURRENT_COLOR = 0x0B00;
- public static final int GL_CURRENT_NORMAL = 0x0B02;
- public static final int GL_CURRENT_TEXTURE_COORDS = 0x0B03;
- public static final int GL_DEPTH_CLEAR_VALUE = 0x0B73;
- public static final int GL_DEPTH_FUNC = 0x0B74;
- public static final int GL_DEPTH_RANGE = 0x0B70;
- public static final int GL_DEPTH_WRITEMASK = 0x0B72;
- public static final int GL_DOT3_RGB = 0x86AE;
- public static final int GL_DOT3_RGBA = 0x86AF;
- public static final int GL_DYNAMIC_DRAW = 0x88E8;
- public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
- public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
- public static final int GL_FRONT_FACE = 0x0B46;
- public static final int GL_GENERATE_MIPMAP = 0x8191;
- public static final int GL_GENERATE_MIPMAP_HINT = 0x8192;
- public static final int GL_INTERPOLATE = 0x8575;
- public static final int GL_LINE_WIDTH = 0x0B21;
- public static final int GL_LOGIC_OP_MODE = 0x0BF0;
- public static final int GL_MATRIX_MODE = 0x0BA0;
- public static final int GL_MAX_CLIP_PLANES = 0x0D32;
- public static final int GL_MODELVIEW_MATRIX = 0x0BA6;
- public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D;
- public static final int GL_MODELVIEW_STACK_DEPTH = 0x0BA3;
- public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897;
- public static final int GL_NORMAL_ARRAY_POINTER = 0x808F;
- public static final int GL_NORMAL_ARRAY_STRIDE = 0x807F;
- public static final int GL_NORMAL_ARRAY_TYPE = 0x807E;
- public static final int GL_OPERAND0_ALPHA = 0x8598;
- public static final int GL_OPERAND0_RGB = 0x8590;
- public static final int GL_OPERAND1_ALPHA = 0x8599;
- public static final int GL_OPERAND1_RGB = 0x8591;
- public static final int GL_OPERAND2_ALPHA = 0x859A;
- public static final int GL_OPERAND2_RGB = 0x8592;
- public static final int GL_POINT_DISTANCE_ATTENUATION = 0x8129;
- public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128;
- public static final int GL_POINT_SIZE = 0x0B11;
- public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 0x8B9F;
- public static final int GL_POINT_SIZE_ARRAY_OES = 0x8B9C;
- public static final int GL_POINT_SIZE_ARRAY_POINTER_OES = 0x898C;
- public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES = 0x898B;
- public static final int GL_POINT_SIZE_ARRAY_TYPE_OES = 0x898A;
- public static final int GL_POINT_SIZE_MAX = 0x8127;
- public static final int GL_POINT_SIZE_MIN = 0x8126;
- public static final int GL_POINT_SPRITE_OES = 0x8861;
- public static final int GL_POLYGON_OFFSET_FACTOR = 0x8038;
- public static final int GL_POLYGON_OFFSET_UNITS = 0x2A00;
- public static final int GL_PREVIOUS = 0x8578;
- public static final int GL_PRIMARY_COLOR = 0x8577;
- public static final int GL_PROJECTION_MATRIX = 0x0BA7;
- public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E;
- public static final int GL_PROJECTION_STACK_DEPTH = 0x0BA4;
- public static final int GL_RGB_SCALE = 0x8573;
- public static final int GL_SAMPLE_BUFFERS = 0x80A8;
- public static final int GL_SAMPLE_COVERAGE_INVERT = 0x80AB;
- public static final int GL_SAMPLE_COVERAGE_VALUE = 0x80AA;
- public static final int GL_SAMPLES = 0x80A9;
- public static final int GL_SCISSOR_BOX = 0x0C10;
- public static final int GL_SHADE_MODEL = 0x0B54;
- public static final int GL_SRC0_ALPHA = 0x8588;
- public static final int GL_SRC0_RGB = 0x8580;
- public static final int GL_SRC1_ALPHA = 0x8589;
- public static final int GL_SRC1_RGB = 0x8581;
- public static final int GL_SRC2_ALPHA = 0x858A;
- public static final int GL_SRC2_RGB = 0x8582;
- public static final int GL_STATIC_DRAW = 0x88E4;
- public static final int GL_STENCIL_CLEAR_VALUE = 0x0B91;
- public static final int GL_STENCIL_FAIL = 0x0B94;
- public static final int GL_STENCIL_FUNC = 0x0B92;
- public static final int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95;
- public static final int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96;
- public static final int GL_STENCIL_REF = 0x0B97;
- public static final int GL_STENCIL_VALUE_MASK = 0x0B93;
- public static final int GL_STENCIL_WRITEMASK = 0x0B98;
- public static final int GL_SUBTRACT = 0x84E7;
- public static final int GL_TEXTURE_BINDING_2D = 0x8069;
- public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A;
- public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092;
- public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088;
- public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A;
- public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089;
- public static final int GL_TEXTURE_MATRIX = 0x0BA8;
- public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F;
- public static final int GL_TEXTURE_STACK_DEPTH = 0x0BA5;
- public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896;
- public static final int GL_VERTEX_ARRAY_POINTER = 0x808E;
- public static final int GL_VERTEX_ARRAY_SIZE = 0x807A;
- public static final int GL_VERTEX_ARRAY_STRIDE = 0x807C;
- public static final int GL_VERTEX_ARRAY_TYPE = 0x807B;
- public static final int GL_VIEWPORT = 0x0BA2;
- public static final int GL_WRITE_ONLY = 0x88B9;
-
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
-
- private static Buffer _pointSizePointerOES;
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
deleted file mode 100644
index 823079f..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-
-#include <assert.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-/* special calls implemented in Android's GLES wrapper used to more
- * efficiently bound-check passed arrays */
-extern "C" {
-GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count);
-}
-
-static int initialized = 0;
-
-static jclass nioAccessClass;
-static jclass bufferClass;
-static jmethodID getBasePointerID;
-static jmethodID getBaseArrayID;
-static jmethodID getBaseArrayOffsetID;
-static jfieldID positionID;
-static jfieldID limitID;
-static jfieldID elementSizeShiftID;
-
-/* Cache method IDs each time the class is loaded. */
-
-static void
-nativeClassInit(JNIEnv *_env, jclass glImplClass)
-{
- jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
- nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
-
- jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
- bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
-
- getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
- "getBasePointer", "(Ljava/nio/Buffer;)J");
- getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
- getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
-
- positionID = _env->GetFieldID(bufferClass, "position", "I");
- limitID = _env->GetFieldID(bufferClass, "limit", "I");
- elementSizeShiftID =
- _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
-}
-
-
-static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
-{
- jint position;
- jint limit;
- jint elementSizeShift;
- jlong pointer;
- jint offset;
- void *data;
-
- position = _env->GetIntField(buffer, positionID);
- limit = _env->GetIntField(buffer, limitID);
- elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- *remaining = (limit - position) << elementSizeShift;
- pointer = _env->CallStaticLongMethod(nioAccessClass,
- getBasePointerID, buffer);
- if (pointer != 0L) {
- *array = NULL;
- return (void *) (jint) pointer;
- }
-
- *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
- getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
- getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
-}
-
-
-static void
-releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
-{
- _env->ReleasePrimitiveArrayCritical(array, data,
- commit ? 0 : JNI_ABORT);
-}
-
-static void *
-getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
- char* buf = (char*) _env->GetDirectBufferAddress(buffer);
- if (buf) {
- jint position = _env->GetIntField(buffer, positionID);
- jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- buf += position << elementSizeShift;
- } else {
- jniThrowException(_env, "java/lang/IllegalArgumentException",
- "Must use a native order direct Buffer");
- }
- return (void*) buf;
-}
-
-// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if
deleted file mode 100644
index b615e0a..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if
+++ /dev/null
@@ -1,330 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package android.opengl;
-
-/** OpenGL ES 2.0
- */
-public class GLES20 {
- public static final int GL_ACTIVE_TEXTURE = 0x84E0;
- public static final int GL_DEPTH_BUFFER_BIT = 0x00000100;
- public static final int GL_STENCIL_BUFFER_BIT = 0x00000400;
- public static final int GL_COLOR_BUFFER_BIT = 0x00004000;
- public static final int GL_FALSE = 0;
- public static final int GL_TRUE = 1;
- public static final int GL_POINTS = 0x0000;
- public static final int GL_LINES = 0x0001;
- public static final int GL_LINE_LOOP = 0x0002;
- public static final int GL_LINE_STRIP = 0x0003;
- public static final int GL_TRIANGLES = 0x0004;
- public static final int GL_TRIANGLE_STRIP = 0x0005;
- public static final int GL_TRIANGLE_FAN = 0x0006;
- public static final int GL_ZERO = 0;
- public static final int GL_ONE = 1;
- public static final int GL_SRC_COLOR = 0x0300;
- public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301;
- public static final int GL_SRC_ALPHA = 0x0302;
- public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303;
- public static final int GL_DST_ALPHA = 0x0304;
- public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305;
- public static final int GL_DST_COLOR = 0x0306;
- public static final int GL_ONE_MINUS_DST_COLOR = 0x0307;
- public static final int GL_SRC_ALPHA_SATURATE = 0x0308;
- public static final int GL_FUNC_ADD = 0x8006;
- public static final int GL_BLEND_EQUATION = 0x8009;
- public static final int GL_BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
- public static final int GL_BLEND_EQUATION_ALPHA = 0x883D;
- public static final int GL_FUNC_SUBTRACT = 0x800A;
- public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B;
- public static final int GL_BLEND_DST_RGB = 0x80C8;
- public static final int GL_BLEND_SRC_RGB = 0x80C9;
- public static final int GL_BLEND_DST_ALPHA = 0x80CA;
- public static final int GL_BLEND_SRC_ALPHA = 0x80CB;
- public static final int GL_CONSTANT_COLOR = 0x8001;
- public static final int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002;
- public static final int GL_CONSTANT_ALPHA = 0x8003;
- public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004;
- public static final int GL_BLEND_COLOR = 0x8005;
- public static final int GL_ARRAY_BUFFER = 0x8892;
- public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
- public static final int GL_ARRAY_BUFFER_BINDING = 0x8894;
- public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
- public static final int GL_STREAM_DRAW = 0x88E0;
- public static final int GL_STATIC_DRAW = 0x88E4;
- public static final int GL_DYNAMIC_DRAW = 0x88E8;
- public static final int GL_BUFFER_SIZE = 0x8764;
- public static final int GL_BUFFER_USAGE = 0x8765;
- public static final int GL_CURRENT_VERTEX_ATTRIB = 0x8626;
- public static final int GL_FRONT = 0x0404;
- public static final int GL_BACK = 0x0405;
- public static final int GL_FRONT_AND_BACK = 0x0408;
- public static final int GL_TEXTURE_2D = 0x0DE1;
- public static final int GL_CULL_FACE = 0x0B44;
- public static final int GL_BLEND = 0x0BE2;
- public static final int GL_DITHER = 0x0BD0;
- public static final int GL_STENCIL_TEST = 0x0B90;
- public static final int GL_DEPTH_TEST = 0x0B71;
- public static final int GL_SCISSOR_TEST = 0x0C11;
- public static final int GL_POLYGON_OFFSET_FILL = 0x8037;
- public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
- public static final int GL_SAMPLE_COVERAGE = 0x80A0;
- public static final int GL_NO_ERROR = 0;
- public static final int GL_INVALID_ENUM = 0x0500;
- public static final int GL_INVALID_VALUE = 0x0501;
- public static final int GL_INVALID_OPERATION = 0x0502;
- public static final int GL_OUT_OF_MEMORY = 0x0505;
- public static final int GL_CW = 0x0900;
- public static final int GL_CCW = 0x0901;
- public static final int GL_LINE_WIDTH = 0x0B21;
- public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846D;
- public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E;
- public static final int GL_CULL_FACE_MODE = 0x0B45;
- public static final int GL_FRONT_FACE = 0x0B46;
- public static final int GL_DEPTH_RANGE = 0x0B70;
- public static final int GL_DEPTH_WRITEMASK = 0x0B72;
- public static final int GL_DEPTH_CLEAR_VALUE = 0x0B73;
- public static final int GL_DEPTH_FUNC = 0x0B74;
- public static final int GL_STENCIL_CLEAR_VALUE = 0x0B91;
- public static final int GL_STENCIL_FUNC = 0x0B92;
- public static final int GL_STENCIL_FAIL = 0x0B94;
- public static final int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95;
- public static final int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96;
- public static final int GL_STENCIL_REF = 0x0B97;
- public static final int GL_STENCIL_VALUE_MASK = 0x0B93;
- public static final int GL_STENCIL_WRITEMASK = 0x0B98;
- public static final int GL_STENCIL_BACK_FUNC = 0x8800;
- public static final int GL_STENCIL_BACK_FAIL = 0x8801;
- public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
- public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
- public static final int GL_STENCIL_BACK_REF = 0x8CA3;
- public static final int GL_STENCIL_BACK_VALUE_MASK = 0x8CA4;
- public static final int GL_STENCIL_BACK_WRITEMASK = 0x8CA5;
- public static final int GL_VIEWPORT = 0x0BA2;
- public static final int GL_SCISSOR_BOX = 0x0C10;
- public static final int GL_COLOR_CLEAR_VALUE = 0x0C22;
- public static final int GL_COLOR_WRITEMASK = 0x0C23;
- public static final int GL_UNPACK_ALIGNMENT = 0x0CF5;
- public static final int GL_PACK_ALIGNMENT = 0x0D05;
- public static final int GL_MAX_TEXTURE_SIZE = 0x0D33;
- public static final int GL_MAX_VIEWPORT_DIMS = 0x0D3A;
- public static final int GL_SUBPIXEL_BITS = 0x0D50;
- public static final int GL_RED_BITS = 0x0D52;
- public static final int GL_GREEN_BITS = 0x0D53;
- public static final int GL_BLUE_BITS = 0x0D54;
- public static final int GL_ALPHA_BITS = 0x0D55;
- public static final int GL_DEPTH_BITS = 0x0D56;
- public static final int GL_STENCIL_BITS = 0x0D57;
- public static final int GL_POLYGON_OFFSET_UNITS = 0x2A00;
- public static final int GL_POLYGON_OFFSET_FACTOR = 0x8038;
- public static final int GL_TEXTURE_BINDING_2D = 0x8069;
- public static final int GL_SAMPLE_BUFFERS = 0x80A8;
- public static final int GL_SAMPLES = 0x80A9;
- public static final int GL_SAMPLE_COVERAGE_VALUE = 0x80AA;
- public static final int GL_SAMPLE_COVERAGE_INVERT = 0x80AB;
- public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
- public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3;
- public static final int GL_DONT_CARE = 0x1100;
- public static final int GL_FASTEST = 0x1101;
- public static final int GL_NICEST = 0x1102;
- public static final int GL_GENERATE_MIPMAP_HINT = 0x8192;
- public static final int GL_BYTE = 0x1400;
- public static final int GL_UNSIGNED_BYTE = 0x1401;
- public static final int GL_SHORT = 0x1402;
- public static final int GL_UNSIGNED_SHORT = 0x1403;
- public static final int GL_INT = 0x1404;
- public static final int GL_UNSIGNED_INT = 0x1405;
- public static final int GL_FLOAT = 0x1406;
- public static final int GL_FIXED = 0x140C;
- public static final int GL_DEPTH_COMPONENT = 0x1902;
- public static final int GL_ALPHA = 0x1906;
- public static final int GL_RGB = 0x1907;
- public static final int GL_RGBA = 0x1908;
- public static final int GL_LUMINANCE = 0x1909;
- public static final int GL_LUMINANCE_ALPHA = 0x190A;
- public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
- public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
- public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
- public static final int GL_FRAGMENT_SHADER = 0x8B30;
- public static final int GL_VERTEX_SHADER = 0x8B31;
- public static final int GL_MAX_VERTEX_ATTRIBS = 0x8869;
- public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
- public static final int GL_MAX_VARYING_VECTORS = 0x8DFC;
- public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
- public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
- public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872;
- public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
- public static final int GL_SHADER_TYPE = 0x8B4F;
- public static final int GL_DELETE_STATUS = 0x8B80;
- public static final int GL_LINK_STATUS = 0x8B82;
- public static final int GL_VALIDATE_STATUS = 0x8B83;
- public static final int GL_ATTACHED_SHADERS = 0x8B85;
- public static final int GL_ACTIVE_UNIFORMS = 0x8B86;
- public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87;
- public static final int GL_ACTIVE_ATTRIBUTES = 0x8B89;
- public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A;
- public static final int GL_SHADING_LANGUAGE_VERSION = 0x8B8C;
- public static final int GL_CURRENT_PROGRAM = 0x8B8D;
- public static final int GL_NEVER = 0x0200;
- public static final int GL_LESS = 0x0201;
- public static final int GL_EQUAL = 0x0202;
- public static final int GL_LEQUAL = 0x0203;
- public static final int GL_GREATER = 0x0204;
- public static final int GL_NOTEQUAL = 0x0205;
- public static final int GL_GEQUAL = 0x0206;
- public static final int GL_ALWAYS = 0x0207;
- public static final int GL_KEEP = 0x1E00;
- public static final int GL_REPLACE = 0x1E01;
- public static final int GL_INCR = 0x1E02;
- public static final int GL_DECR = 0x1E03;
- public static final int GL_INVERT = 0x150A;
- public static final int GL_INCR_WRAP = 0x8507;
- public static final int GL_DECR_WRAP = 0x8508;
- public static final int GL_VENDOR = 0x1F00;
- public static final int GL_RENDERER = 0x1F01;
- public static final int GL_VERSION = 0x1F02;
- public static final int GL_EXTENSIONS = 0x1F03;
- public static final int GL_NEAREST = 0x2600;
- public static final int GL_LINEAR = 0x2601;
- public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
- public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
- public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702;
- public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703;
- public static final int GL_TEXTURE_MAG_FILTER = 0x2800;
- public static final int GL_TEXTURE_MIN_FILTER = 0x2801;
- public static final int GL_TEXTURE_WRAP_S = 0x2802;
- public static final int GL_TEXTURE_WRAP_T = 0x2803;
- public static final int GL_TEXTURE = 0x1702;
- public static final int GL_TEXTURE_CUBE_MAP = 0x8513;
- public static final int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514;
- public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
- public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
- public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
- public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
- public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
- public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
- public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
- public static final int GL_TEXTURE0 = 0x84C0;
- public static final int GL_TEXTURE1 = 0x84C1;
- public static final int GL_TEXTURE2 = 0x84C2;
- public static final int GL_TEXTURE3 = 0x84C3;
- public static final int GL_TEXTURE4 = 0x84C4;
- public static final int GL_TEXTURE5 = 0x84C5;
- public static final int GL_TEXTURE6 = 0x84C6;
- public static final int GL_TEXTURE7 = 0x84C7;
- public static final int GL_TEXTURE8 = 0x84C8;
- public static final int GL_TEXTURE9 = 0x84C9;
- public static final int GL_TEXTURE10 = 0x84CA;
- public static final int GL_TEXTURE11 = 0x84CB;
- public static final int GL_TEXTURE12 = 0x84CC;
- public static final int GL_TEXTURE13 = 0x84CD;
- public static final int GL_TEXTURE14 = 0x84CE;
- public static final int GL_TEXTURE15 = 0x84CF;
- public static final int GL_TEXTURE16 = 0x84D0;
- public static final int GL_TEXTURE17 = 0x84D1;
- public static final int GL_TEXTURE18 = 0x84D2;
- public static final int GL_TEXTURE19 = 0x84D3;
- public static final int GL_TEXTURE20 = 0x84D4;
- public static final int GL_TEXTURE21 = 0x84D5;
- public static final int GL_TEXTURE22 = 0x84D6;
- public static final int GL_TEXTURE23 = 0x84D7;
- public static final int GL_TEXTURE24 = 0x84D8;
- public static final int GL_TEXTURE25 = 0x84D9;
- public static final int GL_TEXTURE26 = 0x84DA;
- public static final int GL_TEXTURE27 = 0x84DB;
- public static final int GL_TEXTURE28 = 0x84DC;
- public static final int GL_TEXTURE29 = 0x84DD;
- public static final int GL_TEXTURE30 = 0x84DE;
- public static final int GL_TEXTURE31 = 0x84DF;
- public static final int GL_REPEAT = 0x2901;
- public static final int GL_CLAMP_TO_EDGE = 0x812F;
- public static final int GL_MIRRORED_REPEAT = 0x8370;
- public static final int GL_FLOAT_VEC2 = 0x8B50;
- public static final int GL_FLOAT_VEC3 = 0x8B51;
- public static final int GL_FLOAT_VEC4 = 0x8B52;
- public static final int GL_INT_VEC2 = 0x8B53;
- public static final int GL_INT_VEC3 = 0x8B54;
- public static final int GL_INT_VEC4 = 0x8B55;
- public static final int GL_BOOL = 0x8B56;
- public static final int GL_BOOL_VEC2 = 0x8B57;
- public static final int GL_BOOL_VEC3 = 0x8B58;
- public static final int GL_BOOL_VEC4 = 0x8B59;
- public static final int GL_FLOAT_MAT2 = 0x8B5A;
- public static final int GL_FLOAT_MAT3 = 0x8B5B;
- public static final int GL_FLOAT_MAT4 = 0x8B5C;
- public static final int GL_SAMPLER_2D = 0x8B5E;
- public static final int GL_SAMPLER_CUBE = 0x8B60;
- public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
- public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
- public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
- public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
- public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
- public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
- public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
- public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
- public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
- public static final int GL_COMPILE_STATUS = 0x8B81;
- public static final int GL_INFO_LOG_LENGTH = 0x8B84;
- public static final int GL_SHADER_SOURCE_LENGTH = 0x8B88;
- public static final int GL_SHADER_COMPILER = 0x8DFA;
- public static final int GL_SHADER_BINARY_FORMATS = 0x8DF8;
- public static final int GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9;
- public static final int GL_LOW_FLOAT = 0x8DF0;
- public static final int GL_MEDIUM_FLOAT = 0x8DF1;
- public static final int GL_HIGH_FLOAT = 0x8DF2;
- public static final int GL_LOW_INT = 0x8DF3;
- public static final int GL_MEDIUM_INT = 0x8DF4;
- public static final int GL_HIGH_INT = 0x8DF5;
- public static final int GL_FRAMEBUFFER = 0x8D40;
- public static final int GL_RENDERBUFFER = 0x8D41;
- public static final int GL_RGBA4 = 0x8056;
- public static final int GL_RGB5_A1 = 0x8057;
- public static final int GL_RGB565 = 0x8D62;
- public static final int GL_DEPTH_COMPONENT16 = 0x81A5;
- public static final int GL_STENCIL_INDEX = 0x1901;
- public static final int GL_STENCIL_INDEX8 = 0x8D48;
- public static final int GL_RENDERBUFFER_WIDTH = 0x8D42;
- public static final int GL_RENDERBUFFER_HEIGHT = 0x8D43;
- public static final int GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
- public static final int GL_RENDERBUFFER_RED_SIZE = 0x8D50;
- public static final int GL_RENDERBUFFER_GREEN_SIZE = 0x8D51;
- public static final int GL_RENDERBUFFER_BLUE_SIZE = 0x8D52;
- public static final int GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53;
- public static final int GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54;
- public static final int GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
- public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
- public static final int GL_COLOR_ATTACHMENT0 = 0x8CE0;
- public static final int GL_DEPTH_ATTACHMENT = 0x8D00;
- public static final int GL_STENCIL_ATTACHMENT = 0x8D20;
- public static final int GL_NONE = 0;
- public static final int GL_FRAMEBUFFER_COMPLETE = 0x8CD5;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
- public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
- public static final int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
- public static final int GL_FRAMEBUFFER_BINDING = 0x8CA6;
- public static final int GL_RENDERBUFFER_BINDING = 0x8CA7;
- public static final int GL_MAX_RENDERBUFFER_SIZE = 0x84E8;
- public static final int GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506;
-
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
diff --git a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp
deleted file mode 100644
index 13a2577..0000000
--- a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-**
-** Copyright 2009, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-
-#include <assert.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-static int initialized = 0;
-
-static jclass nioAccessClass;
-static jclass bufferClass;
-static jmethodID getBasePointerID;
-static jmethodID getBaseArrayID;
-static jmethodID getBaseArrayOffsetID;
-static jfieldID positionID;
-static jfieldID limitID;
-static jfieldID elementSizeShiftID;
-
-/* Cache method IDs each time the class is loaded. */
-
-static void
-nativeClassInit(JNIEnv *_env, jclass glImplClass)
-{
- jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
- nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
-
- jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
- bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
-
- getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
- "getBasePointer", "(Ljava/nio/Buffer;)J");
- getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
- getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
-
- positionID = _env->GetFieldID(bufferClass, "position", "I");
- limitID = _env->GetFieldID(bufferClass, "limit", "I");
- elementSizeShiftID =
- _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
-}
-
-
-static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
-{
- jint position;
- jint limit;
- jint elementSizeShift;
- jlong pointer;
- jint offset;
- void *data;
-
- position = _env->GetIntField(buffer, positionID);
- limit = _env->GetIntField(buffer, limitID);
- elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- *remaining = (limit - position) << elementSizeShift;
- pointer = _env->CallStaticLongMethod(nioAccessClass,
- getBasePointerID, buffer);
- if (pointer != 0L) {
- *array = NULL;
- return (void *) (jint) pointer;
- }
-
- *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
- getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
- getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
-}
-
-
-static void
-releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
-{
- _env->ReleasePrimitiveArrayCritical(array, data,
- commit ? 0 : JNI_ABORT);
-}
-
-static void *
-getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
- char* buf = (char*) _env->GetDirectBufferAddress(buffer);
- if (buf) {
- jint position = _env->GetIntField(buffer, positionID);
- jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- buf += position << elementSizeShift;
- } else {
- jniThrowException(_env, "java/lang/IllegalArgumentException",
- "Must use a native order direct Buffer");
- }
- return (void*) buf;
-}
-
-static int
-getNumCompressedTextureFormats() {
- int numCompressedTextureFormats = 0;
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
- return numCompressedTextureFormats;
-}
-
-static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
- glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
-}
-
-// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp
deleted file mode 100644
index ce6ab24..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdlib.h>
-
-/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
-static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
- GLint infoLen = 0;
- glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (!infoLen) {
- return _env->NewStringUTF("");
- }
- char* buf = (char*) malloc(infoLen);
- if (buf == NULL) {
- jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
- return NULL;
- }
- glGetProgramInfoLog(shader, infoLen, NULL, buf);
- jstring result = _env->NewStringUTF(buf);
- free(buf);
- return result;
-}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java
deleted file mode 100644
index 762df39..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
- // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
- // GLchar * infoLog);
-
- public static native String glGetProgramInfoLog(
- int program
- );
diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.nativeReg
deleted file mode 100644
index 8553f2d..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.nativeReg
+++ /dev/null
@@ -1 +0,0 @@
-{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp
deleted file mode 100644
index dd656b6..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdlib.h>
-
-/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
-static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
- GLint infoLen = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
- if (!infoLen) {
- return _env->NewStringUTF("");
- }
- char* buf = (char*) malloc(infoLen);
- if (buf == NULL) {
- jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
- return NULL;
- }
- glGetShaderInfoLog(shader, infoLen, NULL, buf);
- jstring result = _env->NewStringUTF(buf);
- free(buf);
- return result;
-}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java
deleted file mode 100644
index af529c0..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
- // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
- // GLchar * infoLog);
-
- public static native String glGetShaderInfoLog(
- int shader
- );
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.nativeReg
deleted file mode 100644
index 71163c3..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.nativeReg
+++ /dev/null
@@ -1 +0,0 @@
-{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.cpp b/opengl/tools/glgen/stubs/gles11/glGetString.cpp
deleted file mode 100644
index 239fe4a..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetString.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-/* const GLubyte * glGetString ( GLenum name ) */
-static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
- const char* chars = (const char*) glGetString((GLenum) name);
- return _env->NewStringUTF(chars);
-}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java
deleted file mode 100644
index b02a0d1..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetString.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
- // C function const GLubyte * glGetString ( GLenum name )
-
- public static native String glGetString(
- int name
- );
diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg
deleted file mode 100644
index a4af31f..0000000
--- a/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg
+++ /dev/null
@@ -1 +0,0 @@
-{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp
deleted file mode 100644
index 125fd0f..0000000
--- a/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-
-/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
-static
-void
-android_glShaderSource
- (JNIEnv *_env, jobject _this, jint shader, jstring string) {
-
- if (!string) {
- jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
- return;
- }
-
- const char* nativeString = _env->GetStringUTFChars(string, 0);
- const char* strings[] = {nativeString};
- glShaderSource(shader, 1, strings, 0);
- _env->ReleaseStringUTFChars(string, nativeString);
-}
diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.java b/opengl/tools/glgen/stubs/gles11/glShaderSource.java
deleted file mode 100644
index e9fcef3..0000000
--- a/opengl/tools/glgen/stubs/gles11/glShaderSource.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
- // C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length )
-
- public static native void glShaderSource(
- int shader,
- String string
- );
diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.nativeReg b/opengl/tools/glgen/stubs/gles11/glShaderSource.nativeReg
deleted file mode 100644
index b17783a..0000000
--- a/opengl/tools/glgen/stubs/gles11/glShaderSource.nativeReg
+++ /dev/null
@@ -1 +0,0 @@
-{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
diff --git a/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if
deleted file mode 100644
index b0999c2..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if
+++ /dev/null
@@ -1,22 +0,0 @@
-**
-** Copyright 2007, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package javax.microedition.khronos.opengles;
-
-public interface GL10Ext extends GL {
-
diff --git a/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if
deleted file mode 100644
index 8392821..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if
+++ /dev/null
@@ -1,259 +0,0 @@
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package javax.microedition.khronos.opengles;
-
-public interface GL10 extends GL {
- int GL_ADD = 0x0104;
- int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E;
- int GL_ALIASED_POINT_SIZE_RANGE = 0x846D;
- int GL_ALPHA = 0x1906;
- int GL_ALPHA_BITS = 0x0D55;
- int GL_ALPHA_TEST = 0x0BC0;
- int GL_ALWAYS = 0x0207;
- int GL_AMBIENT = 0x1200;
- int GL_AMBIENT_AND_DIFFUSE = 0x1602;
- int GL_AND = 0x1501;
- int GL_AND_INVERTED = 0x1504;
- int GL_AND_REVERSE = 0x1502;
- int GL_BACK = 0x0405;
- int GL_BLEND = 0x0BE2;
- int GL_BLUE_BITS = 0x0D54;
- int GL_BYTE = 0x1400;
- int GL_CCW = 0x0901;
- int GL_CLAMP_TO_EDGE = 0x812F;
- int GL_CLEAR = 0x1500;
- int GL_COLOR_ARRAY = 0x8076;
- int GL_COLOR_BUFFER_BIT = 0x4000;
- int GL_COLOR_LOGIC_OP = 0x0BF2;
- int GL_COLOR_MATERIAL = 0x0B57;
- int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3;
- int GL_CONSTANT_ATTENUATION = 0x1207;
- int GL_COPY = 0x1503;
- int GL_COPY_INVERTED = 0x150C;
- int GL_CULL_FACE = 0x0B44;
- int GL_CW = 0x0900;
- int GL_DECAL = 0x2101;
- int GL_DECR = 0x1E03;
- int GL_DEPTH_BITS = 0x0D56;
- int GL_DEPTH_BUFFER_BIT = 0x0100;
- int GL_DEPTH_TEST = 0x0B71;
- int GL_DIFFUSE = 0x1201;
- int GL_DITHER = 0x0BD0;
- int GL_DONT_CARE = 0x1100;
- int GL_DST_ALPHA = 0x0304;
- int GL_DST_COLOR = 0x0306;
- int GL_EMISSION = 0x1600;
- int GL_EQUAL = 0x0202;
- int GL_EQUIV = 0x1509;
- int GL_EXP = 0x0800;
- int GL_EXP2 = 0x0801;
- int GL_EXTENSIONS = 0x1F03;
- int GL_FALSE = 0;
- int GL_FASTEST = 0x1101;
- int GL_FIXED = 0x140C;
- int GL_FLAT = 0x1D00;
- int GL_FLOAT = 0x1406;
- int GL_FOG = 0x0B60;
- int GL_FOG_COLOR = 0x0B66;
- int GL_FOG_DENSITY = 0x0B62;
- int GL_FOG_END = 0x0B64;
- int GL_FOG_HINT = 0x0C54;
- int GL_FOG_MODE = 0x0B65;
- int GL_FOG_START = 0x0B63;
- int GL_FRONT = 0x0404;
- int GL_FRONT_AND_BACK = 0x0408;
- int GL_GEQUAL = 0x0206;
- int GL_GREATER = 0x0204;
- int GL_GREEN_BITS = 0x0D53;
- int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B;
- int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A;
- int GL_INCR = 0x1E02;
- int GL_INVALID_ENUM = 0x0500;
- int GL_INVALID_OPERATION = 0x0502;
- int GL_INVALID_VALUE = 0x0501;
- int GL_INVERT = 0x150A;
- int GL_KEEP = 0x1E00;
- int GL_LEQUAL = 0x0203;
- int GL_LESS = 0x0201;
- int GL_LIGHT_MODEL_AMBIENT = 0x0B53;
- int GL_LIGHT_MODEL_TWO_SIDE = 0x0B52;
- int GL_LIGHT0 = 0x4000;
- int GL_LIGHT1 = 0x4001;
- int GL_LIGHT2 = 0x4002;
- int GL_LIGHT3 = 0x4003;
- int GL_LIGHT4 = 0x4004;
- int GL_LIGHT5 = 0x4005;
- int GL_LIGHT6 = 0x4006;
- int GL_LIGHT7 = 0x4007;
- int GL_LIGHTING = 0x0B50;
- int GL_LINE_LOOP = 0x0002;
- int GL_LINE_SMOOTH = 0x0B20;
- int GL_LINE_SMOOTH_HINT = 0x0C52;
- int GL_LINE_STRIP = 0x0003;
- int GL_LINEAR = 0x2601;
- int GL_LINEAR_ATTENUATION = 0x1208;
- int GL_LINEAR_MIPMAP_LINEAR = 0x2703;
- int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
- int GL_LINES = 0x0001;
- int GL_LUMINANCE = 0x1909;
- int GL_LUMINANCE_ALPHA = 0x190A;
- int GL_MAX_ELEMENTS_INDICES = 0x80E9;
- int GL_MAX_ELEMENTS_VERTICES = 0x80E8;
- int GL_MAX_LIGHTS = 0x0D31;
- int GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36;
- int GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38;
- int GL_MAX_TEXTURE_SIZE = 0x0D33;
- int GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39;
- int GL_MAX_TEXTURE_UNITS = 0x84E2;
- int GL_MAX_VIEWPORT_DIMS = 0x0D3A;
- int GL_MODELVIEW = 0x1700;
- int GL_MODULATE = 0x2100;
- int GL_MULTISAMPLE = 0x809D;
- int GL_NAND = 0x150E;
- int GL_NEAREST = 0x2600;
- int GL_NEAREST_MIPMAP_LINEAR = 0x2702;
- int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
- int GL_NEVER = 0x0200;
- int GL_NICEST = 0x1102;
- int GL_NO_ERROR = 0;
- int GL_NOOP = 0x1505;
- int GL_NOR = 0x1508;
- int GL_NORMAL_ARRAY = 0x8075;
- int GL_NORMALIZE = 0x0BA1;
- int GL_NOTEQUAL = 0x0205;
- int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
- int GL_ONE = 1;
- int GL_ONE_MINUS_DST_ALPHA = 0x0305;
- int GL_ONE_MINUS_DST_COLOR = 0x0307;
- int GL_ONE_MINUS_SRC_ALPHA = 0x0303;
- int GL_ONE_MINUS_SRC_COLOR = 0x0301;
- int GL_OR = 0x1507;
- int GL_OR_INVERTED = 0x150D;
- int GL_OR_REVERSE = 0x150B;
- int GL_OUT_OF_MEMORY = 0x0505;
- int GL_PACK_ALIGNMENT = 0x0D05;
- int GL_PALETTE4_R5_G6_B5_OES = 0x8B92;
- int GL_PALETTE4_RGB5_A1_OES = 0x8B94;
- int GL_PALETTE4_RGB8_OES = 0x8B90;
- int GL_PALETTE4_RGBA4_OES = 0x8B93;
- int GL_PALETTE4_RGBA8_OES = 0x8B91;
- int GL_PALETTE8_R5_G6_B5_OES = 0x8B97;
- int GL_PALETTE8_RGB5_A1_OES = 0x8B99;
- int GL_PALETTE8_RGB8_OES = 0x8B95;
- int GL_PALETTE8_RGBA4_OES = 0x8B98;
- int GL_PALETTE8_RGBA8_OES = 0x8B96;
- int GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50;
- int GL_POINT_SMOOTH = 0x0B10;
- int GL_POINT_SMOOTH_HINT = 0x0C51;
- int GL_POINTS = 0x0000;
- int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128;
- int GL_POINT_SIZE = 0x0B11;
- int GL_POLYGON_OFFSET_FILL = 0x8037;
- int GL_POLYGON_SMOOTH_HINT = 0x0C53;
- int GL_POSITION = 0x1203;
- int GL_PROJECTION = 0x1701;
- int GL_QUADRATIC_ATTENUATION = 0x1209;
- int GL_RED_BITS = 0x0D52;
- int GL_RENDERER = 0x1F01;
- int GL_REPEAT = 0x2901;
- int GL_REPLACE = 0x1E01;
- int GL_RESCALE_NORMAL = 0x803A;
- int GL_RGB = 0x1907;
- int GL_RGBA = 0x1908;
- int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
- int GL_SAMPLE_ALPHA_TO_ONE = 0x809F;
- int GL_SAMPLE_COVERAGE = 0x80A0;
- int GL_SCISSOR_TEST = 0x0C11;
- int GL_SET = 0x150F;
- int GL_SHININESS = 0x1601;
- int GL_SHORT = 0x1402;
- int GL_SMOOTH = 0x1D01;
- int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22;
- int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12;
- int GL_SPECULAR = 0x1202;
- int GL_SPOT_CUTOFF = 0x1206;
- int GL_SPOT_DIRECTION = 0x1204;
- int GL_SPOT_EXPONENT = 0x1205;
- int GL_SRC_ALPHA = 0x0302;
- int GL_SRC_ALPHA_SATURATE = 0x0308;
- int GL_SRC_COLOR = 0x0300;
- int GL_STACK_OVERFLOW = 0x0503;
- int GL_STACK_UNDERFLOW = 0x0504;
- int GL_STENCIL_BITS = 0x0D57;
- int GL_STENCIL_BUFFER_BIT = 0x0400;
- int GL_STENCIL_TEST = 0x0B90;
- int GL_SUBPIXEL_BITS = 0x0D50;
- int GL_TEXTURE = 0x1702;
- int GL_TEXTURE_2D = 0x0DE1;
- int GL_TEXTURE_COORD_ARRAY = 0x8078;
- int GL_TEXTURE_ENV = 0x2300;
- int GL_TEXTURE_ENV_COLOR = 0x2201;
- int GL_TEXTURE_ENV_MODE = 0x2200;
- int GL_TEXTURE_MAG_FILTER = 0x2800;
- int GL_TEXTURE_MIN_FILTER = 0x2801;
- int GL_TEXTURE_WRAP_S = 0x2802;
- int GL_TEXTURE_WRAP_T = 0x2803;
- int GL_TEXTURE0 = 0x84C0;
- int GL_TEXTURE1 = 0x84C1;
- int GL_TEXTURE2 = 0x84C2;
- int GL_TEXTURE3 = 0x84C3;
- int GL_TEXTURE4 = 0x84C4;
- int GL_TEXTURE5 = 0x84C5;
- int GL_TEXTURE6 = 0x84C6;
- int GL_TEXTURE7 = 0x84C7;
- int GL_TEXTURE8 = 0x84C8;
- int GL_TEXTURE9 = 0x84C9;
- int GL_TEXTURE10 = 0x84CA;
- int GL_TEXTURE11 = 0x84CB;
- int GL_TEXTURE12 = 0x84CC;
- int GL_TEXTURE13 = 0x84CD;
- int GL_TEXTURE14 = 0x84CE;
- int GL_TEXTURE15 = 0x84CF;
- int GL_TEXTURE16 = 0x84D0;
- int GL_TEXTURE17 = 0x84D1;
- int GL_TEXTURE18 = 0x84D2;
- int GL_TEXTURE19 = 0x84D3;
- int GL_TEXTURE20 = 0x84D4;
- int GL_TEXTURE21 = 0x84D5;
- int GL_TEXTURE22 = 0x84D6;
- int GL_TEXTURE23 = 0x84D7;
- int GL_TEXTURE24 = 0x84D8;
- int GL_TEXTURE25 = 0x84D9;
- int GL_TEXTURE26 = 0x84DA;
- int GL_TEXTURE27 = 0x84DB;
- int GL_TEXTURE28 = 0x84DC;
- int GL_TEXTURE29 = 0x84DD;
- int GL_TEXTURE30 = 0x84DE;
- int GL_TEXTURE31 = 0x84DF;
- int GL_TRIANGLE_FAN = 0x0006;
- int GL_TRIANGLE_STRIP = 0x0005;
- int GL_TRIANGLES = 0x0004;
- int GL_TRUE = 1;
- int GL_UNPACK_ALIGNMENT = 0x0CF5;
- int GL_UNSIGNED_BYTE = 0x1401;
- int GL_UNSIGNED_SHORT = 0x1403;
- int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
- int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
- int GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
- int GL_VENDOR = 0x1F00;
- int GL_VERSION = 0x1F02;
- int GL_VERTEX_ARRAY = 0x8074;
- int GL_XOR = 0x1506;
- int GL_ZERO = 0;
-
diff --git a/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if
deleted file mode 100644
index 7be2164..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if
+++ /dev/null
@@ -1,40 +0,0 @@
-**
-** Copyright 2007, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package javax.microedition.khronos.opengles;
-
-public interface GL11Ext extends GL {
- int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 0x8B9E;
- int GL_MATRIX_INDEX_ARRAY_OES = 0x8844;
- int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 0x8849;
- int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 0x8846;
- int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 0x8848;
- int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 0x8847;
- int GL_MATRIX_PALETTE_OES = 0x8840;
- int GL_MAX_PALETTE_MATRICES_OES = 0x8842;
- int GL_MAX_VERTEX_UNITS_OES = 0x86A4;
- int GL_TEXTURE_CROP_RECT_OES = 0x8B9D;
- int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 0x889E;
- int GL_WEIGHT_ARRAY_OES = 0x86AD;
- int GL_WEIGHT_ARRAY_POINTER_OES = 0x86AC;
- int GL_WEIGHT_ARRAY_SIZE_OES = 0x86AB;
- int GL_WEIGHT_ARRAY_STRIDE_OES = 0x86AA;
- int GL_WEIGHT_ARRAY_TYPE_OES = 0x86A9;
-
- void glTexParameterfv(int target, int pname, float[] param, int offset);
-
diff --git a/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if
deleted file mode 100644
index a800191..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if
+++ /dev/null
@@ -1,108 +0,0 @@
-**
-** Copyright 2007, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package javax.microedition.khronos.opengles;
-
-public interface GL11ExtensionPack extends GL {
- int GL_BLEND_DST_ALPHA = 0x80CA;
- int GL_BLEND_DST_RGB = 0x80C8;
- int GL_BLEND_EQUATION = 0x8009;
- int GL_BLEND_EQUATION_ALPHA = 0x883D;
- int GL_BLEND_EQUATION_RGB = 0x8009;
- int GL_BLEND_SRC_ALPHA = 0x80CB;
- int GL_BLEND_SRC_RGB = 0x80C9;
- int GL_COLOR_ATTACHMENT0_OES = 0x8CE0;
- int GL_COLOR_ATTACHMENT1_OES = 0x8CE1;
- int GL_COLOR_ATTACHMENT2_OES = 0x8CE2;
- int GL_COLOR_ATTACHMENT3_OES = 0x8CE3;
- int GL_COLOR_ATTACHMENT4_OES = 0x8CE4;
- int GL_COLOR_ATTACHMENT5_OES = 0x8CE5;
- int GL_COLOR_ATTACHMENT6_OES = 0x8CE6;
- int GL_COLOR_ATTACHMENT7_OES = 0x8CE7;
- int GL_COLOR_ATTACHMENT8_OES = 0x8CE8;
- int GL_COLOR_ATTACHMENT9_OES = 0x8CE9;
- int GL_COLOR_ATTACHMENT10_OES = 0x8CEA;
- int GL_COLOR_ATTACHMENT11_OES = 0x8CEB;
- int GL_COLOR_ATTACHMENT12_OES = 0x8CEC;
- int GL_COLOR_ATTACHMENT13_OES = 0x8CED;
- int GL_COLOR_ATTACHMENT14_OES = 0x8CEE;
- int GL_COLOR_ATTACHMENT15_OES = 0x8CEF;
- int GL_DECR_WRAP = 0x8508;
- int GL_DEPTH_ATTACHMENT_OES = 0x8D00;
- int GL_DEPTH_COMPONENT = 0x1902;
- int GL_DEPTH_COMPONENT16 = 0x81A5;
- int GL_DEPTH_COMPONENT24 = 0x81A6;
- int GL_DEPTH_COMPONENT32 = 0x81A7;
- int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1;
- int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0;
- int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3;
- int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2;
- int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6;
- int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5;
- int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6;
- int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9;
- int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 0x8CDB;
- int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA;
- int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7;
- int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 0x8CDC;
- int GL_FRAMEBUFFER_OES = 0x8D40;
- int GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD;
- int GL_FUNC_ADD = 0x8006;
- int GL_FUNC_REVERSE_SUBTRACT = 0x800B;
- int GL_FUNC_SUBTRACT = 0x800A;
- int GL_INCR_WRAP = 0x8507;
- int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506;
- int GL_MAX_COLOR_ATTACHMENTS_OES = 0x8CDF;
- int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
- int GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8;
- int GL_MIRRORED_REPEAT = 0x8370;
- int GL_NORMAL_MAP = 0x8511;
- int GL_REFLECTION_MAP = 0x8512;
- int GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53;
- int GL_RENDERBUFFER_BINDING_OES = 0x8CA7;
- int GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52;
- int GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54;
- int GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51;
- int GL_RENDERBUFFER_HEIGHT_OES = 0x8D43;
- int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44;
- int GL_RENDERBUFFER_OES = 0x8D41;
- int GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50;
- int GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55;
- int GL_RENDERBUFFER_WIDTH_OES = 0x8D42;
- int GL_RGB5_A1 = 0x8057;
- int GL_RGB565_OES = 0x8D62;
- int GL_RGB8 = 0x8051;
- int GL_RGBA4 = 0x8056;
- int GL_RGBA8 = 0x8058;
- int GL_STENCIL_ATTACHMENT_OES = 0x8D20;
- int GL_STENCIL_INDEX = 0x1901;
- int GL_STENCIL_INDEX1_OES = 0x8D46;
- int GL_STENCIL_INDEX4_OES = 0x8D47;
- int GL_STENCIL_INDEX8_OES = 0x8D48;
- int GL_STR = -1;
- int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514;
- int GL_TEXTURE_CUBE_MAP = 0x8513;
- int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
- int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
- int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
- int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
- int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
- int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
- int GL_TEXTURE_GEN_MODE = 0x2500;
- int GL_TEXTURE_GEN_STR = 0x8D60;
-
diff --git a/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if
deleted file mode 100644
index b0e5a6b..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if
+++ /dev/null
@@ -1,145 +0,0 @@
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package javax.microedition.khronos.opengles;
-
-public interface GL11 extends GL10 {
- int GL_ACTIVE_TEXTURE = 0x84E0;
- int GL_ADD_SIGNED = 0x8574;
- int GL_ALPHA_SCALE = 0x0D1C;
- int GL_ALPHA_TEST_FUNC = 0x0BC1;
- int GL_ALPHA_TEST_REF = 0x0BC2;
- int GL_ARRAY_BUFFER = 0x8892;
- int GL_ARRAY_BUFFER_BINDING = 0x8894;
- int GL_BLEND_DST = 0x0BE0;
- int GL_BLEND_SRC = 0x0BE1;
- int GL_BUFFER_ACCESS = 0x88BB;
- int GL_BUFFER_SIZE = 0x8764;
- int GL_BUFFER_USAGE = 0x8765;
- int GL_CLIENT_ACTIVE_TEXTURE = 0x84E1;
- int GL_CLIP_PLANE0 = 0x3000;
- int GL_CLIP_PLANE1 = 0x3001;
- int GL_CLIP_PLANE2 = 0x3002;
- int GL_CLIP_PLANE3 = 0x3003;
- int GL_CLIP_PLANE4 = 0x3004;
- int GL_CLIP_PLANE5 = 0x3005;
- int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898;
- int GL_COLOR_ARRAY_POINTER = 0x8090;
- int GL_COLOR_ARRAY_SIZE = 0x8081;
- int GL_COLOR_ARRAY_STRIDE = 0x8083;
- int GL_COLOR_ARRAY_TYPE = 0x8082;
- int GL_COLOR_CLEAR_VALUE = 0x0C22;
- int GL_COLOR_WRITEMASK = 0x0C23;
- int GL_COMBINE = 0x8570;
- int GL_COMBINE_ALPHA = 0x8572;
- int GL_COMBINE_RGB = 0x8571;
- int GL_CONSTANT = 0x8576;
- int GL_COORD_REPLACE_OES = 0x8862;
- int GL_CULL_FACE_MODE = 0x0B45;
- int GL_CURRENT_COLOR = 0x0B00;
- int GL_CURRENT_NORMAL = 0x0B02;
- int GL_CURRENT_TEXTURE_COORDS = 0x0B03;
- int GL_DEPTH_CLEAR_VALUE = 0x0B73;
- int GL_DEPTH_FUNC = 0x0B74;
- int GL_DEPTH_RANGE = 0x0B70;
- int GL_DEPTH_WRITEMASK = 0x0B72;
- int GL_DOT3_RGB = 0x86AE;
- int GL_DOT3_RGBA = 0x86AF;
- int GL_DYNAMIC_DRAW = 0x88E8;
- int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
- int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
- int GL_FRONT_FACE = 0x0B46;
- int GL_GENERATE_MIPMAP = 0x8191;
- int GL_GENERATE_MIPMAP_HINT = 0x8192;
- int GL_INTERPOLATE = 0x8575;
- int GL_LINE_WIDTH = 0x0B21;
- int GL_LOGIC_OP_MODE = 0x0BF0;
- int GL_MATRIX_MODE = 0x0BA0;
- int GL_MAX_CLIP_PLANES = 0x0D32;
- int GL_MODELVIEW_MATRIX = 0x0BA6;
- int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D;
- int GL_MODELVIEW_STACK_DEPTH = 0x0BA3;
- int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897;
- int GL_NORMAL_ARRAY_POINTER = 0x808F;
- int GL_NORMAL_ARRAY_STRIDE = 0x807F;
- int GL_NORMAL_ARRAY_TYPE = 0x807E;
- int GL_OPERAND0_ALPHA = 0x8598;
- int GL_OPERAND0_RGB = 0x8590;
- int GL_OPERAND1_ALPHA = 0x8599;
- int GL_OPERAND1_RGB = 0x8591;
- int GL_OPERAND2_ALPHA = 0x859A;
- int GL_OPERAND2_RGB = 0x8592;
- int GL_POINT_DISTANCE_ATTENUATION = 0x8129;
- int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128;
- int GL_POINT_SIZE = 0x0B11;
- int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 0x8B9F;
- int GL_POINT_SIZE_ARRAY_OES = 0x8B9C;
- int GL_POINT_SIZE_ARRAY_POINTER_OES = 0x898C;
- int GL_POINT_SIZE_ARRAY_STRIDE_OES = 0x898B;
- int GL_POINT_SIZE_ARRAY_TYPE_OES = 0x898A;
- int GL_POINT_SIZE_MAX = 0x8127;
- int GL_POINT_SIZE_MIN = 0x8126;
- int GL_POINT_SPRITE_OES = 0x8861;
- int GL_POLYGON_OFFSET_FACTOR = 0x8038;
- int GL_POLYGON_OFFSET_UNITS = 0x2A00;
- int GL_PREVIOUS = 0x8578;
- int GL_PRIMARY_COLOR = 0x8577;
- int GL_PROJECTION_MATRIX = 0x0BA7;
- int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E;
- int GL_PROJECTION_STACK_DEPTH = 0x0BA4;
- int GL_RGB_SCALE = 0x8573;
- int GL_SAMPLE_BUFFERS = 0x80A8;
- int GL_SAMPLE_COVERAGE_INVERT = 0x80AB;
- int GL_SAMPLE_COVERAGE_VALUE = 0x80AA;
- int GL_SAMPLES = 0x80A9;
- int GL_SCISSOR_BOX = 0x0C10;
- int GL_SHADE_MODEL = 0x0B54;
- int GL_SRC0_ALPHA = 0x8588;
- int GL_SRC0_RGB = 0x8580;
- int GL_SRC1_ALPHA = 0x8589;
- int GL_SRC1_RGB = 0x8581;
- int GL_SRC2_ALPHA = 0x858A;
- int GL_SRC2_RGB = 0x8582;
- int GL_STATIC_DRAW = 0x88E4;
- int GL_STENCIL_CLEAR_VALUE = 0x0B91;
- int GL_STENCIL_FAIL = 0x0B94;
- int GL_STENCIL_FUNC = 0x0B92;
- int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95;
- int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96;
- int GL_STENCIL_REF = 0x0B97;
- int GL_STENCIL_VALUE_MASK = 0x0B93;
- int GL_STENCIL_WRITEMASK = 0x0B98;
- int GL_SUBTRACT = 0x84E7;
- int GL_TEXTURE_BINDING_2D = 0x8069;
- int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A;
- int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092;
- int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088;
- int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A;
- int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089;
- int GL_TEXTURE_MATRIX = 0x0BA8;
- int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F;
- int GL_TEXTURE_STACK_DEPTH = 0x0BA5;
- int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896;
- int GL_VERTEX_ARRAY_POINTER = 0x808E;
- int GL_VERTEX_ARRAY_SIZE = 0x807A;
- int GL_VERTEX_ARRAY_STRIDE = 0x807C;
- int GL_VERTEX_ARRAY_TYPE = 0x807B;
- int GL_VIEWPORT = 0x0BA2;
- int GL_WRITE_ONLY = 0x88B9;
-
- void glGetPointerv(int pname, java.nio.Buffer[] params);
diff --git a/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl
deleted file mode 100644
index 501be65..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2006 The Android Open Source Project
-
-// All Rights Reserved.
-
-// This source file is automatically generated
-
-package com.google.android.gles_jni;
-
-import java.nio.Buffer;
-import javax.microedition.khronos.opengles.GL11;
-import android.graphics.Canvas;
-
-public class GL11Impl implements GL11 {
-
- // Private accessors for native code
-
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
-
- Buffer _colorPointer = null;
- Buffer _normalPointer = null;
- Buffer _texCoordPointer = null;
- Buffer _vertexPointer = null;
-
- public GL11Impl() {
- }
-
-
diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
deleted file mode 100644
index f7315ee..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-
-#include <assert.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-// Work around differences between the generated name and the actual name.
-
-#define glBlendEquation glBlendEquationOES
-#define glBlendEquationSeparate glBlendEquationSeparateOES
-#define glBlendFuncSeparate glBlendFuncSeparateOES
-#define glGetTexGenfv glGetTexGenfvOES
-#define glGetTexGeniv glGetTexGenivOES
-#define glGetTexGenxv glGetTexGenxvOES
-#define glTexGenf glTexGenfOES
-#define glTexGenfv glTexGenfvOES
-#define glTexGeni glTexGeniOES
-#define glTexGeniv glTexGenivOES
-#define glTexGenx glTexGenxOES
-#define glTexGenxv glTexGenxvOES
-
-
-
-/* special calls implemented in Android's GLES wrapper used to more
- * efficiently bound-check passed arrays */
-extern "C" {
-GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr, GLsizei count);
-GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
- const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer, GLsizei count);
-}
-
-static int initialized = 0;
-
-static jclass nioAccessClass;
-static jclass bufferClass;
-static jclass G11ImplClass;
-static jmethodID getBasePointerID;
-static jmethodID getBaseArrayID;
-static jmethodID getBaseArrayOffsetID;
-static jmethodID allowIndirectBuffersID;
-static jfieldID positionID;
-static jfieldID limitID;
-static jfieldID elementSizeShiftID;
-static jfieldID haveCheckedExtensionsID;
-static jfieldID have_OES_blend_equation_separateID;
-static jfieldID have_OES_blend_subtractID;
-static jfieldID have_OES_framebuffer_objectID;
-static jfieldID have_OES_texture_cube_mapID;
-
-/* Cache method IDs each time the class is loaded. */
-
-static void
-nativeClassInit(JNIEnv *_env, jclass glImplClass)
-{
- jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
- nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
-
- jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
- bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
-
- jclass g11impClassLocal = _env->FindClass("com/google/android/gles_jni/GLImpl");
- G11ImplClass = (jclass) _env->NewGlobalRef(g11impClassLocal);
- haveCheckedExtensionsID = _env->GetFieldID(G11ImplClass, "haveCheckedExtensions", "Z");
- have_OES_blend_equation_separateID = _env->GetFieldID(G11ImplClass, "have_OES_blend_equation_separate", "Z");
- have_OES_blend_subtractID = _env->GetFieldID(G11ImplClass, "have_OES_blend_subtract", "Z");
- have_OES_framebuffer_objectID = _env->GetFieldID(G11ImplClass, "have_OES_framebuffer_object", "Z");
- have_OES_texture_cube_mapID = _env->GetFieldID(G11ImplClass, "have_OES_texture_cube_map", "Z");
-
- getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
- "getBasePointer", "(Ljava/nio/Buffer;)J");
- getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
- getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
- "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
- allowIndirectBuffersID = _env->GetStaticMethodID(g11impClassLocal,
- "allowIndirectBuffers", "(Ljava/lang/String;)Z");
- positionID = _env->GetFieldID(bufferClass, "position", "I");
- limitID = _env->GetFieldID(bufferClass, "limit", "I");
- elementSizeShiftID =
- _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
-}
-
-static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
-{
- jint position;
- jint limit;
- jint elementSizeShift;
- jlong pointer;
- jint offset;
- void *data;
-
- position = _env->GetIntField(buffer, positionID);
- limit = _env->GetIntField(buffer, limitID);
- elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- *remaining = (limit - position) << elementSizeShift;
- pointer = _env->CallStaticLongMethod(nioAccessClass,
- getBasePointerID, buffer);
- if (pointer != 0L) {
- *array = NULL;
- return (void *) (jint) pointer;
- }
-
- *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
- getBaseArrayID, buffer);
- if (*array == NULL) {
- return (void*) NULL;
- }
- offset = _env->CallStaticIntMethod(nioAccessClass,
- getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
-}
-
-static void
-releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
-{
- _env->ReleasePrimitiveArrayCritical(array, data,
- commit ? 0 : JNI_ABORT);
-}
-
-extern "C" {
-extern char* __progname;
-}
-
-static bool
-allowIndirectBuffers(JNIEnv *_env) {
- static jint sIndirectBufferCompatability;
- if (sIndirectBufferCompatability == 0) {
- jobject appName = _env->NewStringUTF(::__progname);
- sIndirectBufferCompatability = _env->CallStaticBooleanMethod(G11ImplClass, allowIndirectBuffersID, appName) ? 2 : 1;
- }
- return sIndirectBufferCompatability == 2;
-}
-
-static void *
-getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
- if (!buffer) {
- return NULL;
- }
- void* buf = _env->GetDirectBufferAddress(buffer);
- if (buf) {
- jint position = _env->GetIntField(buffer, positionID);
- jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
- buf = ((char*) buf) + (position << elementSizeShift);
- } else {
- if (allowIndirectBuffers(_env)) {
- jarray array = 0;
- jint remaining;
- buf = getPointer(_env, buffer, &array, &remaining);
- if (array) {
- releasePointer(_env, array, buf, 0);
- }
- } else {
- jniThrowException(_env, "java/lang/IllegalArgumentException",
- "Must use a native order direct Buffer");
- }
- }
- return buf;
-}
-
-static int
-getNumCompressedTextureFormats() {
- int numCompressedTextureFormats = 0;
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
- return numCompressedTextureFormats;
-}
-
-// Check if the extension at the head of pExtensions is pExtension. Note that pExtensions is
-// terminated by either 0 or space, while pExtension is terminated by 0.
-
-static bool
-extensionEqual(const GLubyte* pExtensions, const GLubyte* pExtension) {
- while (true) {
- char a = *pExtensions++;
- char b = *pExtension++;
- bool aEnd = a == '\0' || a == ' ';
- bool bEnd = b == '\0';
- if ( aEnd || bEnd) {
- return aEnd == bEnd;
- }
- if ( a != b ) {
- return false;
- }
- }
-}
-
-static const GLubyte*
-nextExtension(const GLubyte* pExtensions) {
- while (true) {
- char a = *pExtensions++;
- if ( a == '\0') {
- return pExtensions-1;
- } else if ( a == ' ') {
- return pExtensions;
- }
- }
-}
-
-static bool
-checkForExtension(const GLubyte* pExtensions, const GLubyte* pExtension) {
- for (;*pExtensions != '\0'; pExtensions = nextExtension(pExtensions)) {
- if (extensionEqual(pExtensions, pExtension)) {
- return true;
- }
- }
- return false;
-}
-
-static bool
-supportsExtension(JNIEnv *_env, jobject impl, jfieldID fieldId) {
- if (!_env->GetBooleanField(impl, haveCheckedExtensionsID)) {
- _env->SetBooleanField(impl, haveCheckedExtensionsID, true);
- const GLubyte* sExtensions = glGetString(GL_EXTENSIONS);
- _env->SetBooleanField(impl, have_OES_blend_equation_separateID,
- checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_equation_separate"));
- _env->SetBooleanField(impl, have_OES_blend_subtractID,
- checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_subtract"));
- _env->SetBooleanField(impl, have_OES_framebuffer_objectID,
- checkForExtension(sExtensions, (const GLubyte*) "GL_OES_framebuffer_object"));
- _env->SetBooleanField(impl, have_OES_texture_cube_mapID,
- checkForExtension(sExtensions, (const GLubyte*) "GL_OES_texture_cube_map"));
- }
- return _env->GetBooleanField(impl, fieldId);
-}
-
-// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if
deleted file mode 100644
index 3b78f3d..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if
+++ /dev/null
@@ -1,22 +0,0 @@
-/* //device/java/android/javax/microedition/khronos/opengles/GL.java
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-package javax.microedition.khronos.opengles;
-
-public interface GL {
-}
-
diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
deleted file mode 100644
index cd730aa..0000000
--- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
+++ /dev/null
@@ -1,84 +0,0 @@
-**
-** Copyright 2006, The Android Open Source Project
-**
-** 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.
-*/
-
-// This source file is automatically generated
-
-package com.google.android.gles_jni;
-
-import android.app.AppGlobals;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.IPackageManager;
-import android.os.Build;
-import android.util.Log;
-
-import java.nio.Buffer;
-import javax.microedition.khronos.opengles.GL10;
-import javax.microedition.khronos.opengles.GL10Ext;
-import javax.microedition.khronos.opengles.GL11;
-import javax.microedition.khronos.opengles.GL11Ext;
-import javax.microedition.khronos.opengles.GL11ExtensionPack;
-
-public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
-
- // Private accessors for native code
-
- native private static void _nativeClassInit();
- static {
- _nativeClassInit();
- }
-
- Buffer _colorPointer = null;
- Buffer _normalPointer = null;
- Buffer _texCoordPointer = null;
- Buffer _vertexPointer = null;
- Buffer _pointSizePointerOES = null;
- Buffer _matrixIndexPointerOES = null;
- Buffer _weightPointerOES = null;
-
- private boolean haveCheckedExtensions;
- private boolean have_OES_blend_equation_separate;
- private boolean have_OES_blend_subtract;
- private boolean have_OES_framebuffer_object;
- private boolean have_OES_texture_cube_map;
-
- public GLImpl() {
- }
-
- public void glGetPointerv(int pname, java.nio.Buffer[] params) {
- throw new UnsupportedOperationException("glGetPointerv");
- }
-
- private static boolean allowIndirectBuffers(String appName) {
- boolean result = false;
- int version = 0;
- IPackageManager pm = AppGlobals.getPackageManager();
- try {
- ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0);
- if (applicationInfo != null) {
- version = applicationInfo.targetSdkVersion;
- }
- } catch (android.os.RemoteException e) {
- // ignore
- }
- Log.e("OpenGLES", String.format(
- "Application %s (SDK target %d) called a GL11 Pointer method with an indirect Buffer.",
- appName, version));
- if (version <= Build.VERSION_CODES.CUPCAKE) {
- result = true;
- }
- return result;
- }
-
diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.cpp b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp
deleted file mode 100644
index cd6e3f3..0000000
--- a/opengl/tools/glgen/stubs/jsr239/glGetString.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-/* const GLubyte * glGetString ( GLenum name ) */
-static jstring android_glGetString(JNIEnv *_env, jobject, jint name) {
- const char* chars = (const char*) glGetString((GLenum) name);
- return _env->NewStringUTF(chars);
-}
diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if
deleted file mode 100644
index 898fabc..0000000
--- a/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if
+++ /dev/null
@@ -1,4 +0,0 @@
- public String glGetString(
- int name
- );
-
diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.java-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-if
deleted file mode 100644
index 898fabc..0000000
--- a/opengl/tools/glgen/stubs/jsr239/glGetString.java-if
+++ /dev/null
@@ -1,4 +0,0 @@
- public String glGetString(
- int name
- );
-
diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl b/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl
deleted file mode 100644
index 8c7881c..0000000
--- a/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl
+++ /dev/null
@@ -1,16 +0,0 @@
- // C function const GLubyte * glGetString ( GLenum name )
-
- public native String _glGetString(
- int name
- );
-
- public String glGetString(
- int name
- ) {
- String returnValue;
- returnValue = _glGetString(
- name
- );
- return returnValue;
- }
-
diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg b/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg
deleted file mode 100644
index e64187c..0000000
--- a/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg
+++ /dev/null
@@ -1 +0,0 @@
-{"_glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index b8c44d9..0574405 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -477,7 +477,8 @@
: bs.filterStats.entrySet()) {
pw.print(" "); pw.print(fe.getValue().count);
pw.print(" alarms: ");
- pw.println(fe.getKey().getIntent().toShortString(false, true, false));
+ pw.println(fe.getKey().getIntent().toShortString(
+ false, true, false, true));
}
}
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 4ea2f04..ce597ad 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -49,10 +49,10 @@
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
-import android.app.WallpaperManager;
import android.app.backup.IBackupManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
+import android.content.ClipData;
import android.content.ComponentCallbacks2;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -4657,9 +4657,11 @@
* if callingUid is not allowed to do this. Returns the uid of the target
* if the URI permission grant should be performed; returns -1 if it is not
* needed (for example targetPkg already has permission to access the URI).
+ * If you already know the uid of the target, you can supply it in
+ * lastTargetUid else set that to -1.
*/
int checkGrantUriPermissionLocked(int callingUid, String targetPkg,
- Uri uri, int modeFlags) {
+ Uri uri, int modeFlags, int lastTargetUid) {
modeFlags &= (Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
if (modeFlags == 0) {
@@ -4698,8 +4700,8 @@
return -1;
}
- int targetUid;
- if (targetPkg != null) {
+ int targetUid = lastTargetUid;
+ if (targetUid < 0 && targetPkg != null) {
try {
targetUid = pm.getPackageUid(targetPkg);
if (targetUid < 0) {
@@ -4710,8 +4712,6 @@
} catch (RemoteException ex) {
return -1;
}
- } else {
- targetUid = -1;
}
if (targetUid >= 0) {
@@ -4783,7 +4783,7 @@
Uri uri, int modeFlags) {
enforceNotIsolatedCaller("checkGrantUriPermission");
synchronized(this) {
- return checkGrantUriPermissionLocked(callingUid, targetPkg, uri, modeFlags);
+ return checkGrantUriPermissionLocked(callingUid, targetPkg, uri, modeFlags, -1);
}
}
@@ -4830,13 +4830,13 @@
}
}
- void grantUriPermissionLocked(int callingUid,
- String targetPkg, Uri uri, int modeFlags, UriPermissionOwner owner) {
+ void grantUriPermissionLocked(int callingUid, String targetPkg, Uri uri,
+ int modeFlags, UriPermissionOwner owner) {
if (targetPkg == null) {
throw new NullPointerException("targetPkg");
}
- int targetUid = checkGrantUriPermissionLocked(callingUid, targetPkg, uri, modeFlags);
+ int targetUid = checkGrantUriPermissionLocked(callingUid, targetPkg, uri, modeFlags, -1);
if (targetUid < 0) {
return;
}
@@ -4844,13 +4844,26 @@
grantUriPermissionUncheckedLocked(targetUid, targetPkg, uri, modeFlags, owner);
}
+ static class NeededUriGrants extends ArrayList<Uri> {
+ final String targetPkg;
+ final int targetUid;
+ final int flags;
+
+ NeededUriGrants(String _targetPkg, int _targetUid, int _flags) {
+ targetPkg = _targetPkg;
+ targetUid = _targetUid;
+ flags = _flags;
+ }
+ }
+
/**
* Like checkGrantUriPermissionLocked, but takes an Intent.
*/
- int checkGrantUriPermissionFromIntentLocked(int callingUid,
- String targetPkg, Intent intent) {
+ NeededUriGrants checkGrantUriPermissionFromIntentLocked(int callingUid,
+ String targetPkg, Intent intent, int mode, NeededUriGrants needed) {
if (DEBUG_URI_PERMISSION) Slog.v(TAG,
- "Checking URI perm to " + (intent != null ? intent.getData() : null)
+ "Checking URI perm to data=" + (intent != null ? intent.getData() : null)
+ + " clip=" + (intent != null ? intent.getClipData() : null)
+ " from " + intent + "; flags=0x"
+ Integer.toHexString(intent != null ? intent.getFlags() : 0));
@@ -4859,33 +4872,74 @@
}
if (intent == null) {
- return -1;
+ return null;
}
Uri data = intent.getData();
- if (data == null) {
- return -1;
+ ClipData clip = intent.getClipData();
+ if (data == null && clip == null) {
+ return null;
}
- return checkGrantUriPermissionLocked(callingUid, targetPkg, data,
- intent.getFlags());
+ if (data != null) {
+ int target = checkGrantUriPermissionLocked(callingUid, targetPkg, data,
+ mode, needed != null ? needed.targetUid : -1);
+ if (target > 0) {
+ if (needed == null) {
+ needed = new NeededUriGrants(targetPkg, target, mode);
+ }
+ needed.add(data);
+ }
+ }
+ if (clip != null) {
+ for (int i=0; i<clip.getItemCount(); i++) {
+ Uri uri = clip.getItemAt(i).getUri();
+ if (uri != null) {
+ int target = -1;
+ target = checkGrantUriPermissionLocked(callingUid, targetPkg, uri,
+ mode, needed != null ? needed.targetUid : -1);
+ if (target > 0) {
+ if (needed == null) {
+ needed = new NeededUriGrants(targetPkg, target, mode);
+ }
+ needed.add(uri);
+ }
+ } else {
+ Intent clipIntent = clip.getItemAt(i).getIntent();
+ if (clipIntent != null) {
+ NeededUriGrants newNeeded = checkGrantUriPermissionFromIntentLocked(
+ callingUid, targetPkg, clipIntent, mode, needed);
+ if (newNeeded != null) {
+ needed = newNeeded;
+ }
+ }
+ }
+ }
+ }
+
+ return needed;
}
/**
* Like grantUriPermissionUncheckedLocked, but takes an Intent.
*/
- void grantUriPermissionUncheckedFromIntentLocked(int targetUid,
- String targetPkg, Intent intent, UriPermissionOwner owner) {
- grantUriPermissionUncheckedLocked(targetUid, targetPkg, intent.getData(),
- intent.getFlags(), owner);
+ void grantUriPermissionUncheckedFromIntentLocked(NeededUriGrants needed,
+ UriPermissionOwner owner) {
+ if (needed != null) {
+ for (int i=0; i<needed.size(); i++) {
+ grantUriPermissionUncheckedLocked(needed.targetUid, needed.targetPkg,
+ needed.get(i), needed.flags, owner);
+ }
+ }
}
void grantUriPermissionFromIntentLocked(int callingUid,
String targetPkg, Intent intent, UriPermissionOwner owner) {
- int targetUid = checkGrantUriPermissionFromIntentLocked(callingUid, targetPkg, intent);
- if (targetUid < 0) {
+ NeededUriGrants needed = checkGrantUriPermissionFromIntentLocked(callingUid, targetPkg,
+ intent, intent.getFlags(), null);
+ if (needed == null) {
return;
}
- grantUriPermissionUncheckedFromIntentLocked(targetUid, targetPkg, intent, owner);
+ grantUriPermissionUncheckedFromIntentLocked(needed, owner);
}
public void grantUriPermission(IApplicationThread caller, String targetPkg,
@@ -5406,7 +5460,7 @@
stopServiceLocked(sr);
} else {
sr.pendingStarts.add(new ServiceRecord.StartItem(sr, true,
- sr.makeNextStartId(), baseIntent, -1));
+ sr.makeNextStartId(), baseIntent, null));
if (sr.app != null && sr.app.thread != null) {
sendServiceArgsLocked(sr, false);
}
@@ -9044,7 +9098,7 @@
for (int i=0; i<N; i++) {
sb.setLength(0);
sb.append(" Intent: ");
- intents.get(i).toShortString(sb, false, true, false);
+ intents.get(i).toShortString(sb, false, true, false, false);
pw.println(sb.toString());
Bundle bundle = intents.get(i).getExtras();
if (bundle != null) {
@@ -9129,7 +9183,7 @@
ConnectionRecord conn = clist.get(i);
pw.print(" ");
pw.print(conn.binding.intent.intent.getIntent()
- .toShortString(false, false, false));
+ .toShortString(false, false, false, false));
pw.print(" -> ");
ProcessRecord proc = conn.binding.client;
pw.println(proc != null ? proc.toShortString() : "null");
@@ -9380,7 +9434,7 @@
// Complete + brief == give a summary. Isn't that obvious?!?
if (lastTask.intent != null) {
pw.print(prefix); pw.print(" ");
- pw.println(lastTask.intent.toInsecureString());
+ pw.println(lastTask.intent.toInsecureStringWithClip());
}
}
}
@@ -10692,9 +10746,9 @@
si.deliveredTime = SystemClock.uptimeMillis();
r.deliveredStarts.add(si);
si.deliveryCount++;
- if (si.targetPermissionUid >= 0 && si.intent != null) {
- grantUriPermissionUncheckedFromIntentLocked(si.targetPermissionUid,
- r.packageName, si.intent, si.getUriPermissionsLocked());
+ if (si.neededGrants != null) {
+ grantUriPermissionUncheckedFromIntentLocked(si.neededGrants,
+ si.getUriPermissionsLocked());
}
bumpServiceExecutingLocked(r, "start");
if (!oomAdjusted) {
@@ -10772,7 +10826,7 @@
boolean created = false;
try {
mStringBuilder.setLength(0);
- r.intent.getIntent().toShortString(mStringBuilder, true, false, true);
+ r.intent.getIntent().toShortString(mStringBuilder, true, false, true, false);
EventLog.writeEvent(EventLogTags.AM_CREATE_SERVICE,
System.identityHashCode(r), r.shortName,
mStringBuilder.toString(), r.app.pid);
@@ -10798,7 +10852,7 @@
// be called.
if (r.startRequested && r.callStart && r.pendingStarts.size() == 0) {
r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(),
- null, -1));
+ null, null));
}
sendServiceArgsLocked(r, true);
@@ -11170,15 +11224,15 @@
? res.permission : "private to package");
}
ServiceRecord r = res.record;
- int targetPermissionUid = checkGrantUriPermissionFromIntentLocked(
- callingUid, r.packageName, service);
+ NeededUriGrants neededGrants = checkGrantUriPermissionFromIntentLocked(
+ callingUid, r.packageName, service, service.getFlags(), null);
if (unscheduleServiceRestartLocked(r)) {
if (DEBUG_SERVICE) Slog.v(TAG, "START SERVICE WHILE RESTART PENDING: " + r);
}
r.startRequested = true;
r.callStart = false;
r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(),
- service, targetPermissionUid));
+ service, neededGrants));
r.lastActivity = SystemClock.uptimeMillis();
synchronized (r.stats.getBatteryStats()) {
r.stats.startRunningLocked();
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index cdab6c6..a337b40 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -127,26 +127,27 @@
pw.print(prefix); pw.print("packageName="); pw.print(packageName);
pw.print(" processName="); pw.println(processName);
pw.print(prefix); pw.print("launchedFromUid="); pw.print(launchedFromUid);
- pw.print(prefix); pw.print("userId="); pw.print(userId);
- pw.print(" app="); pw.println(app);
- pw.print(prefix); pw.println(intent.toInsecureString());
+ pw.print(" userId="); pw.println(userId);
+ pw.print(prefix); pw.print("app="); pw.println(app);
+ pw.print(prefix); pw.println(intent.toInsecureStringWithClip());
pw.print(prefix); pw.print("frontOfTask="); pw.print(frontOfTask);
pw.print(" task="); pw.println(task);
pw.print(prefix); pw.print("taskAffinity="); pw.println(taskAffinity);
pw.print(prefix); pw.print("realActivity=");
pw.println(realActivity.flattenToShortString());
- pw.print(prefix); pw.print("base="); pw.print(baseDir);
- if (!resDir.equals(baseDir)) pw.print(" res="); pw.print(resDir);
- pw.print(" data="); pw.println(dataDir);
- pw.print(prefix); pw.print("labelRes=0x");
- pw.print(Integer.toHexString(labelRes));
- pw.print(" icon=0x"); pw.print(Integer.toHexString(icon));
- pw.print(" theme=0x"); pw.println(Integer.toHexString(theme));
+ pw.print(prefix); pw.print("baseDir="); pw.println(baseDir);
+ if (!resDir.equals(baseDir)) {
+ pw.print(prefix); pw.print("resDir="); pw.println(resDir);
+ }
+ pw.print(prefix); pw.print("dataDir="); pw.println(dataDir);
pw.print(prefix); pw.print("stateNotNeeded="); pw.print(stateNotNeeded);
pw.print(" componentSpecified="); pw.print(componentSpecified);
pw.print(" isHomeActivity="); pw.println(isHomeActivity);
+ pw.print(prefix); pw.print("compat="); pw.print(compat);
+ pw.print(" labelRes=0x"); pw.print(Integer.toHexString(labelRes));
+ pw.print(" icon=0x"); pw.print(Integer.toHexString(icon));
+ pw.print(" theme=0x"); pw.println(Integer.toHexString(theme));
pw.print(prefix); pw.print("config="); pw.println(configuration);
- pw.print(prefix); pw.print("compat="); pw.println(compat);
if (resultTo != null || resultWho != null) {
pw.print(prefix); pw.print("resultTo="); pw.print(resultTo);
pw.print(" resultWho="); pw.print(resultWho);
@@ -193,13 +194,11 @@
TimeUtils.formatDuration(launchTime, pw); pw.print(" startTime=");
TimeUtils.formatDuration(startTime, pw); pw.println("");
}
- if (lastVisibleTime != 0) {
- pw.print(prefix); pw.print("lastVisibleTime=");
- TimeUtils.formatDuration(lastVisibleTime, pw); pw.println("");
- }
- if (waitingVisible || nowVisible) {
+ if (lastVisibleTime != 0 || waitingVisible || nowVisible) {
pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible);
- pw.print(" nowVisible="); pw.println(nowVisible);
+ pw.print(" nowVisible="); pw.print(nowVisible);
+ pw.print("lastVisibleTime=");
+ TimeUtils.formatDuration(lastVisibleTime, pw); pw.println("");
}
if (configDestroy || configChangeFlags != 0) {
pw.print(prefix); pw.print("configDestroy="); pw.print(configDestroy);
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index f9641eb..19fe1bf 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -2290,8 +2290,8 @@
}
if (err == START_SUCCESS) {
- Slog.i(TAG, "START {" + intent.toShortString(true, true, true) + "} from pid "
- + (callerApp != null ? callerApp.pid : callingPid));
+ Slog.i(TAG, "START {" + intent.toShortString(true, true, true, false)
+ + "} from pid " + (callerApp != null ? callerApp.pid : callingPid));
}
ActivityRecord sourceRecord = null;
diff --git a/services/java/com/android/server/am/IntentBindRecord.java b/services/java/com/android/server/am/IntentBindRecord.java
index 2618c77..c94f714 100644
--- a/services/java/com/android/server/am/IntentBindRecord.java
+++ b/services/java/com/android/server/am/IntentBindRecord.java
@@ -54,7 +54,7 @@
void dumpInService(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("intent={");
- pw.print(intent.getIntent().toShortString(false, true, false));
+ pw.print(intent.getIntent().toShortString(false, true, false, false));
pw.println('}');
pw.print(prefix); pw.print("binder="); pw.println(binder);
pw.print(prefix); pw.print("requested="); pw.print(requested);
@@ -89,7 +89,7 @@
sb.append(service.shortName);
sb.append(':');
if (intent != null) {
- intent.getIntent().toShortString(sb, false, false, false);
+ intent.getIntent().toShortString(sb, false, false, false, false);
}
sb.append('}');
return stringName = sb.toString();
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index 3b6a97c..0043874 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -152,7 +152,7 @@
return "Key{" + typeName() + " pkg=" + packageName
+ " intent="
+ (requestIntent != null
- ? requestIntent.toShortString(false, true, false) : "<null>")
+ ? requestIntent.toShortString(false, true, false, false) : "<null>")
+ " flags=0x" + Integer.toHexString(flags) + "}";
}
@@ -320,7 +320,7 @@
}
if (key.requestIntent != null) {
pw.print(prefix); pw.print("requestIntent=");
- pw.println(key.requestIntent.toShortString(false, true, true));
+ pw.println(key.requestIntent.toShortString(false, true, true, true));
}
if (sent || canceled) {
pw.print(prefix); pw.print("sent="); pw.print(sent);
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index daa3653..828eef7 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -106,7 +106,7 @@
final boolean taskRemoved;
final int id;
final Intent intent;
- final int targetPermissionUid;
+ final ActivityManagerService.NeededUriGrants neededGrants;
long deliveredTime;
int deliveryCount;
int doneExecutingCount;
@@ -115,12 +115,12 @@
String stringName; // caching of toString
StartItem(ServiceRecord _sr, boolean _taskRemoved, int _id, Intent _intent,
- int _targetPermissionUid) {
+ ActivityManagerService.NeededUriGrants _neededGrants) {
sr = _sr;
taskRemoved = _taskRemoved;
id = _id;
intent = _intent;
- targetPermissionUid = _targetPermissionUid;
+ neededGrants = _neededGrants;
}
UriPermissionOwner getUriPermissionsLocked() {
@@ -177,9 +177,9 @@
pw.print(prefix); pw.print(" intent=");
if (si.intent != null) pw.println(si.intent.toString());
else pw.println("null");
- if (si.targetPermissionUid >= 0) {
- pw.print(prefix); pw.print(" targetPermissionUid=");
- pw.println(si.targetPermissionUid);
+ if (si.neededGrants != null) {
+ pw.print(prefix); pw.print(" neededGrants=");
+ pw.println(si.neededGrants);
}
if (si.uriPermissions != null) {
if (si.uriPermissions.readUriPermissions != null) {
@@ -196,7 +196,7 @@
void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("intent={");
- pw.print(intent.getIntent().toShortString(false, true, false));
+ pw.print(intent.getIntent().toShortString(false, true, false, true));
pw.println('}');
pw.print(prefix); pw.print("packageName="); pw.println(packageName);
pw.print(prefix); pw.print("processName="); pw.println(processName);
diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java
index 47ec218..67873cc 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -111,14 +111,14 @@
if (intent != null) {
StringBuilder sb = new StringBuilder(128);
sb.append(prefix); sb.append("intent={");
- intent.toShortString(sb, false, true, false);
+ intent.toShortString(sb, false, true, false, true);
sb.append('}');
pw.println(sb.toString());
}
if (affinityIntent != null) {
StringBuilder sb = new StringBuilder(128);
sb.append(prefix); sb.append("affinityIntent={");
- affinityIntent.toShortString(sb, false, true, false);
+ affinityIntent.toShortString(sb, false, true, false, true);
sb.append('}');
pw.println(sb.toString());
}
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
deleted file mode 100644
index aa1e426..0000000
--- a/services/surfaceflinger/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- EventThread.cpp \
- Layer.cpp \
- LayerBase.cpp \
- LayerDim.cpp \
- LayerScreenshot.cpp \
- DdmConnection.cpp \
- DisplayHardware/DisplayHardware.cpp \
- DisplayHardware/DisplayHardwareBase.cpp \
- DisplayHardware/HWComposer.cpp \
- DisplayHardware/VSyncBarrier.cpp \
- DisplayEventConnection.cpp \
- GLExtensions.cpp \
- MessageQueue.cpp \
- SurfaceFlinger.cpp \
- SurfaceTextureLayer.cpp \
- Transform.cpp \
-
-
-LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
-LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-ifeq ($(TARGET_HAS_WAITFORVSYNC), true)
- LOCAL_CFLAGS += -DHAS_WAITFORVSYNC
-endif
-
-ifeq ($(TARGET_BOARD_PLATFORM), omap3)
- LOCAL_CFLAGS += -DNO_RGBX_8888
-endif
-ifeq ($(TARGET_BOARD_PLATFORM), omap4)
- LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
- LOCAL_CFLAGS += -DUSE_TRIPLE_BUFFERING
-endif
-ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
- LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE
-endif
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libhardware \
- libutils \
- libEGL \
- libGLESv1_CM \
- libbinder \
- libui \
- libgui
-
-# this is only needed for DDMS debugging
-LOCAL_SHARED_LIBRARIES += libdvm libandroid_runtime
-
-LOCAL_MODULE:= libsurfaceflinger
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/services/surfaceflinger/Barrier.h b/services/surfaceflinger/Barrier.h
deleted file mode 100644
index 6f8507e..0000000
--- a/services/surfaceflinger/Barrier.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_BARRIER_H
-#define ANDROID_BARRIER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/threads.h>
-
-namespace android {
-
-class Barrier
-{
-public:
- inline Barrier() : state(CLOSED) { }
- inline ~Barrier() { }
- void open() {
- Mutex::Autolock _l(lock);
- state = OPENED;
- cv.broadcast();
- }
- void close() {
- Mutex::Autolock _l(lock);
- state = CLOSED;
- }
- void wait() const {
- Mutex::Autolock _l(lock);
- while (state == CLOSED) {
- cv.wait(lock);
- }
- }
-private:
- enum { OPENED, CLOSED };
- mutable Mutex lock;
- mutable Condition cv;
- volatile int state;
-};
-
-}; // namespace android
-
-#endif // ANDROID_BARRIER_H
diff --git a/services/surfaceflinger/DdmConnection.cpp b/services/surfaceflinger/DdmConnection.cpp
deleted file mode 100644
index 467a915..0000000
--- a/services/surfaceflinger/DdmConnection.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <android_runtime/AndroidRuntime.h>
-
-#include "jni.h"
-#include "DdmConnection.h"
-
-extern "C" jint Java_com_android_internal_util_WithFramework_registerNatives(
- JNIEnv* env, jclass clazz);
-
-namespace android {
-
-void DdmConnection::start(const char* name) {
- JavaVM* vm;
- JNIEnv* env;
-
- // start a VM
- JavaVMInitArgs args;
- JavaVMOption opt;
-
- opt.optionString =
- "-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y";
-
- args.version = JNI_VERSION_1_4;
- args.options = &opt;
- args.nOptions = 1;
- args.ignoreUnrecognized = JNI_FALSE;
-
- if (JNI_CreateJavaVM(&vm, &env, &args) == 0) {
- jclass startClass;
- jmethodID startMeth;
-
- // register native code
- if (Java_com_android_internal_util_WithFramework_registerNatives(env, 0) == 0) {
- // set our name by calling DdmHandleAppName.setAppName()
- startClass = env->FindClass("android/ddm/DdmHandleAppName");
- if (startClass) {
- startMeth = env->GetStaticMethodID(startClass,
- "setAppName", "(Ljava/lang/String;)V");
- if (startMeth) {
- jstring str = env->NewStringUTF(name);
- env->CallStaticVoidMethod(startClass, startMeth, str);
- env->DeleteLocalRef(str);
- }
- }
-
- // initialize DDMS communication by calling
- // DdmRegister.registerHandlers()
- startClass = env->FindClass("android/ddm/DdmRegister");
- if (startClass) {
- startMeth = env->GetStaticMethodID(startClass,
- "registerHandlers", "()V");
- if (startMeth) {
- env->CallStaticVoidMethod(startClass, startMeth);
- }
- }
- }
- }
-}
-
-}; // namespace android
diff --git a/services/surfaceflinger/DdmConnection.h b/services/surfaceflinger/DdmConnection.h
deleted file mode 100644
index 91b737c..0000000
--- a/services/surfaceflinger/DdmConnection.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SF_DDM_CONNECTION
-#define ANDROID_SF_DDM_CONNECTION
-
-namespace android {
-
-class DdmConnection {
-public:
- static void start(const char* name);
-};
-
-}; // namespace android
-
-#endif /* ANDROID_SF_DDM_CONNECTION */
diff --git a/services/surfaceflinger/DisplayEventConnection.cpp b/services/surfaceflinger/DisplayEventConnection.cpp
deleted file mode 100644
index 77ecbd2..0000000
--- a/services/surfaceflinger/DisplayEventConnection.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <gui/IDisplayEventConnection.h>
-#include <gui/BitTube.h>
-#include <gui/DisplayEventReceiver.h>
-
-#include <utils/Errors.h>
-
-#include "SurfaceFlinger.h"
-#include "DisplayEventConnection.h"
-#include "EventThread.h"
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-DisplayEventConnection::DisplayEventConnection(
- const sp<EventThread>& eventThread)
- : mEventThread(eventThread), mChannel(new BitTube())
-{
-}
-
-DisplayEventConnection::~DisplayEventConnection() {
- mEventThread->unregisterDisplayEventConnection(this);
-}
-
-void DisplayEventConnection::onFirstRef() {
- // NOTE: mEventThread doesn't hold a strong reference on us
- mEventThread->registerDisplayEventConnection(this);
-}
-
-sp<BitTube> DisplayEventConnection::getDataChannel() const {
- return mChannel;
-}
-
-void DisplayEventConnection::setVsyncRate(uint32_t count) {
- mEventThread->setVsyncRate(count, this);
-}
-
-void DisplayEventConnection::requestNextVsync() {
- mEventThread->requestNextVsync(this);
-}
-
-status_t DisplayEventConnection::postEvent(const DisplayEventReceiver::Event& event)
-{
- ssize_t size = mChannel->write(&event, sizeof(DisplayEventReceiver::Event));
- return size < 0 ? status_t(size) : status_t(NO_ERROR);
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/DisplayEventConnection.h b/services/surfaceflinger/DisplayEventConnection.h
deleted file mode 100644
index cc3ee36..0000000
--- a/services/surfaceflinger/DisplayEventConnection.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SURFACE_FLINGER_DISPLAY_EVENT_CONNECTION_H
-#define ANDROID_SURFACE_FLINGER_DISPLAY_EVENT_CONNECTION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <gui/IDisplayEventConnection.h>
-
-#include <utils/Errors.h>
-#include <gui/DisplayEventReceiver.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class BitTube;
-class EventThread;
-
-// ---------------------------------------------------------------------------
-
-class DisplayEventConnection : public BnDisplayEventConnection {
-public:
- DisplayEventConnection(const sp<EventThread>& flinger);
-
- status_t postEvent(const DisplayEventReceiver::Event& event);
-
-private:
- virtual ~DisplayEventConnection();
- virtual void onFirstRef();
- virtual sp<BitTube> getDataChannel() const;
- virtual void setVsyncRate(uint32_t count);
- virtual void requestNextVsync(); // asynchronous
-
- sp<EventThread> const mEventThread;
- sp<BitTube> const mChannel;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif /* ANDROID_SURFACE_FLINGER_DISPLAY_EVENT_CONNECTION_H */
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
deleted file mode 100644
index 9baae80..0000000
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <cutils/properties.h>
-
-#include <utils/RefBase.h>
-#include <utils/Log.h>
-
-#include <ui/PixelFormat.h>
-#include <ui/FramebufferNativeWindow.h>
-
-#include <GLES/gl.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "DisplayHardware/DisplayHardware.h"
-
-#include <hardware/gralloc.h>
-
-#include "GLExtensions.h"
-#include "HWComposer.h"
-#include "SurfaceFlinger.h"
-
-using namespace android;
-
-
-static __attribute__((noinline))
-void checkGLErrors()
-{
- do {
- // there could be more than one error flag
- GLenum error = glGetError();
- if (error == GL_NO_ERROR)
- break;
- ALOGE("GL error 0x%04x", int(error));
- } while(true);
-}
-
-static __attribute__((noinline))
-void checkEGLErrors(const char* token)
-{
- struct EGLUtils {
- static const char *strerror(EGLint err) {
- switch (err){
- case EGL_SUCCESS: return "EGL_SUCCESS";
- case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
- case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
- case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
- case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
- case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
- case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
- case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
- case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
- case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
- case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
- case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
- case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
- case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
- default: return "UNKNOWN";
- }
- }
- };
-
- EGLint error = eglGetError();
- if (error && error != EGL_SUCCESS) {
- ALOGE("%s: EGL error 0x%04x (%s)",
- token, int(error), EGLUtils::strerror(error));
- }
-}
-
-/*
- * Initialize the display to the specified values.
- *
- */
-
-DisplayHardware::DisplayHardware(
- const sp<SurfaceFlinger>& flinger,
- uint32_t dpy)
- : DisplayHardwareBase(flinger, dpy),
- mFlinger(flinger), mFlags(0), mHwc(0)
-{
- init(dpy);
-}
-
-DisplayHardware::~DisplayHardware()
-{
- fini();
-}
-
-float DisplayHardware::getDpiX() const { return mDpiX; }
-float DisplayHardware::getDpiY() const { return mDpiY; }
-float DisplayHardware::getDensity() const { return mDensity; }
-float DisplayHardware::getRefreshRate() const { return mRefreshRate; }
-int DisplayHardware::getWidth() const { return mWidth; }
-int DisplayHardware::getHeight() const { return mHeight; }
-PixelFormat DisplayHardware::getFormat() const { return mFormat; }
-uint32_t DisplayHardware::getMaxTextureSize() const { return mMaxTextureSize; }
-
-uint32_t DisplayHardware::getMaxViewportDims() const {
- return mMaxViewportDims[0] < mMaxViewportDims[1] ?
- mMaxViewportDims[0] : mMaxViewportDims[1];
-}
-
-static status_t selectConfigForPixelFormat(
- EGLDisplay dpy,
- EGLint const* attrs,
- PixelFormat format,
- EGLConfig* outConfig)
-{
- EGLConfig config = NULL;
- EGLint numConfigs = -1, n=0;
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
- EGLConfig* const configs = new EGLConfig[numConfigs];
- eglChooseConfig(dpy, attrs, configs, numConfigs, &n);
- for (int i=0 ; i<n ; i++) {
- EGLint nativeVisualId = 0;
- eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
- if (nativeVisualId>0 && format == nativeVisualId) {
- *outConfig = configs[i];
- delete [] configs;
- return NO_ERROR;
- }
- }
- delete [] configs;
- return NAME_NOT_FOUND;
-}
-
-
-void DisplayHardware::init(uint32_t dpy)
-{
- mNativeWindow = new FramebufferNativeWindow();
- framebuffer_device_t const * fbDev = mNativeWindow->getDevice();
- if (!fbDev) {
- ALOGE("Display subsystem failed to initialize. check logs. exiting...");
- exit(0);
- }
-
- int format;
- ANativeWindow const * const window = mNativeWindow.get();
- window->query(window, NATIVE_WINDOW_FORMAT, &format);
- mDpiX = mNativeWindow->xdpi;
- mDpiY = mNativeWindow->ydpi;
- mRefreshRate = fbDev->fps;
- mNextFakeVSync = 0;
-
-
-/* FIXME: this is a temporary HACK until we are able to report the refresh rate
- * properly from the HAL. The WindowManagerService now relies on this value.
- */
-#ifndef REFRESH_RATE
- mRefreshRate = fbDev->fps;
-#else
- mRefreshRate = REFRESH_RATE;
-#warning "refresh rate set via makefile to REFRESH_RATE"
-#endif
-
- mRefreshPeriod = nsecs_t(1e9 / mRefreshRate);
-
- EGLint w, h, dummy;
- EGLint numConfigs=0;
- EGLSurface surface;
- EGLContext context;
- EGLBoolean result;
- status_t err;
-
- // initialize EGL
- EGLint attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE, 0,
- EGL_NONE
- };
-
- // debug: disable h/w rendering
- char property[PROPERTY_VALUE_MAX];
- if (property_get("debug.sf.hw", property, NULL) > 0) {
- if (atoi(property) == 0) {
- ALOGW("H/W composition disabled");
- attribs[2] = EGL_CONFIG_CAVEAT;
- attribs[3] = EGL_SLOW_CONFIG;
- }
- }
-
- // TODO: all the extensions below should be queried through
- // eglGetProcAddress().
-
- EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(display, NULL, NULL);
- eglGetConfigs(display, NULL, 0, &numConfigs);
-
- EGLConfig config = NULL;
- err = selectConfigForPixelFormat(display, attribs, format, &config);
- ALOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
-
- EGLint r,g,b,a;
- eglGetConfigAttrib(display, config, EGL_RED_SIZE, &r);
- eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &a);
-
- if (mNativeWindow->isUpdateOnDemand()) {
- mFlags |= PARTIAL_UPDATES;
- }
-
- if (eglGetConfigAttrib(display, config, EGL_CONFIG_CAVEAT, &dummy) == EGL_TRUE) {
- if (dummy == EGL_SLOW_CONFIG)
- mFlags |= SLOW_CONFIG;
- }
-
- /*
- * Create our main surface
- */
-
- surface = eglCreateWindowSurface(display, config, mNativeWindow.get(), NULL);
- eglQuerySurface(display, surface, EGL_WIDTH, &mWidth);
- eglQuerySurface(display, surface, EGL_HEIGHT, &mHeight);
-
- if (mFlags & PARTIAL_UPDATES) {
- // if we have partial updates, we definitely don't need to
- // preserve the backbuffer, which may be costly.
- eglSurfaceAttrib(display, surface,
- EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
- }
-
- if (eglQuerySurface(display, surface, EGL_SWAP_BEHAVIOR, &dummy) == EGL_TRUE) {
- if (dummy == EGL_BUFFER_PRESERVED) {
- mFlags |= BUFFER_PRESERVED;
- }
- }
-
- /* Read density from build-specific ro.sf.lcd_density property
- * except if it is overridden by qemu.sf.lcd_density.
- */
- if (property_get("qemu.sf.lcd_density", property, NULL) <= 0) {
- if (property_get("ro.sf.lcd_density", property, NULL) <= 0) {
- ALOGW("ro.sf.lcd_density not defined, using 160 dpi by default.");
- strcpy(property, "160");
- }
- } else {
- /* for the emulator case, reset the dpi values too */
- mDpiX = mDpiY = atoi(property);
- }
- mDensity = atoi(property) * (1.0f/160.0f);
-
-
- /*
- * Create our OpenGL ES context
- */
-
-
- EGLint contextAttributes[] = {
-#ifdef EGL_IMG_context_priority
-#ifdef HAS_CONTEXT_PRIORITY
-#warning "using EGL_IMG_context_priority"
- EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
-#endif
-#endif
- EGL_NONE, EGL_NONE
- };
- context = eglCreateContext(display, config, NULL, contextAttributes);
-
- mDisplay = display;
- mConfig = config;
- mSurface = surface;
- mContext = context;
- mFormat = fbDev->format;
- mPageFlipCount = 0;
-
- /*
- * Gather OpenGL ES extensions
- */
-
- result = eglMakeCurrent(display, surface, surface, context);
- if (!result) {
- ALOGE("Couldn't create a working GLES context. check logs. exiting...");
- exit(0);
- }
-
- GLExtensions& extensions(GLExtensions::getInstance());
- extensions.initWithGLStrings(
- glGetString(GL_VENDOR),
- glGetString(GL_RENDERER),
- glGetString(GL_VERSION),
- glGetString(GL_EXTENSIONS),
- eglQueryString(display, EGL_VENDOR),
- eglQueryString(display, EGL_VERSION),
- eglQueryString(display, EGL_EXTENSIONS));
-
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
- glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims);
-
- ALOGI("EGL informations:");
- ALOGI("# of configs : %d", numConfigs);
- ALOGI("vendor : %s", extensions.getEglVendor());
- ALOGI("version : %s", extensions.getEglVersion());
- ALOGI("extensions: %s", extensions.getEglExtension());
- ALOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported");
- ALOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config);
-
- ALOGI("OpenGL informations:");
- ALOGI("vendor : %s", extensions.getVendor());
- ALOGI("renderer : %s", extensions.getRenderer());
- ALOGI("version : %s", extensions.getVersion());
- ALOGI("extensions: %s", extensions.getExtension());
- ALOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize);
- ALOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]);
- ALOGI("flags = %08x", mFlags);
-
- // Unbind the context from this thread
- eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
-
- // initialize the H/W composer
- mHwc = new HWComposer(mFlinger);
- if (mHwc->initCheck() == NO_ERROR) {
- mHwc->setFrameBuffer(mDisplay, mSurface);
- }
-}
-
-HWComposer& DisplayHardware::getHwComposer() const {
- return *mHwc;
-}
-
-/*
- * Clean up. Throw out our local state.
- *
- * (It's entirely possible we'll never get here, since this is meant
- * for real hardware, which doesn't restart.)
- */
-
-void DisplayHardware::fini()
-{
- eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- eglTerminate(mDisplay);
-}
-
-void DisplayHardware::releaseScreen() const
-{
- DisplayHardwareBase::releaseScreen();
- if (mHwc->initCheck() == NO_ERROR) {
- mHwc->release();
- }
-}
-
-void DisplayHardware::acquireScreen() const
-{
- DisplayHardwareBase::acquireScreen();
-}
-
-uint32_t DisplayHardware::getPageFlipCount() const {
- return mPageFlipCount;
-}
-
-// this needs to be thread safe
-nsecs_t DisplayHardware::waitForRefresh() const {
- nsecs_t timestamp;
- if (mVSync.wait(×tamp) < 0) {
- // vsync not supported!
- usleep( getDelayToNextVSyncUs(×tamp) );
- }
- mLastHwVSync = timestamp; // FIXME: Not thread safe
- return timestamp;
-}
-
-nsecs_t DisplayHardware::getRefreshTimestamp() const {
- // this returns the last refresh timestamp.
- // if the last one is not available, we estimate it based on
- // the refresh period and whatever closest timestamp we have.
- nsecs_t now = systemTime();
- return now - ((now - mLastHwVSync) % mRefreshPeriod);
-}
-
-nsecs_t DisplayHardware::getRefreshPeriod() const {
- return mRefreshPeriod;
-}
-
-int32_t DisplayHardware::getDelayToNextVSyncUs(nsecs_t* timestamp) const {
- Mutex::Autolock _l(mFakeVSyncMutex);
- const nsecs_t period = mRefreshPeriod;
- const nsecs_t now = systemTime(CLOCK_MONOTONIC);
- nsecs_t next_vsync = mNextFakeVSync;
- nsecs_t sleep = next_vsync - now;
- if (sleep < 0) {
- // we missed, find where the next vsync should be
- sleep = (period - ((now - next_vsync) % period));
- next_vsync = now + sleep;
- }
- mNextFakeVSync = next_vsync + period;
- timestamp[0] = next_vsync;
-
- // round to next microsecond
- int32_t sleep_us = (sleep + 999LL) / 1000LL;
-
- // guaranteed to be > 0
- return sleep_us;
-}
-
-status_t DisplayHardware::compositionComplete() const {
- return mNativeWindow->compositionComplete();
-}
-
-void DisplayHardware::flip(const Region& dirty) const
-{
- checkGLErrors();
-
- EGLDisplay dpy = mDisplay;
- EGLSurface surface = mSurface;
-
-#ifdef EGL_ANDROID_swap_rectangle
- if (mFlags & SWAP_RECTANGLE) {
- const Region newDirty(dirty.intersect(bounds()));
- const Rect b(newDirty.getBounds());
- eglSetSwapRectangleANDROID(dpy, surface,
- b.left, b.top, b.width(), b.height());
- }
-#endif
-
- if (mFlags & PARTIAL_UPDATES) {
- mNativeWindow->setUpdateRectangle(dirty.getBounds());
- }
-
- mPageFlipCount++;
-
- if (mHwc->initCheck() == NO_ERROR) {
- mHwc->commit();
- } else {
- eglSwapBuffers(dpy, surface);
- }
- checkEGLErrors("eglSwapBuffers");
-
- // for debugging
- //glClearColor(1,0,0,0);
- //glClear(GL_COLOR_BUFFER_BIT);
-}
-
-uint32_t DisplayHardware::getFlags() const
-{
- return mFlags;
-}
-
-void DisplayHardware::makeCurrent() const
-{
- eglMakeCurrent(mDisplay, mSurface, mSurface, mContext);
-}
-
-void DisplayHardware::dump(String8& res) const
-{
- mNativeWindow->dump(res);
-}
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
deleted file mode 100644
index 0a828b3..0000000
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_DISPLAY_HARDWARE_H
-#define ANDROID_DISPLAY_HARDWARE_H
-
-#include <stdlib.h>
-
-#include <ui/PixelFormat.h>
-#include <ui/Region.h>
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "GLExtensions.h"
-
-#include "DisplayHardware/DisplayHardwareBase.h"
-#include "DisplayHardware/VSyncBarrier.h"
-
-namespace android {
-
-class FramebufferNativeWindow;
-class HWComposer;
-
-class DisplayHardware : public DisplayHardwareBase
-{
-public:
- enum {
- COPY_BITS_EXTENSION = 0x00000008,
- BUFFER_PRESERVED = 0x00010000,
- PARTIAL_UPDATES = 0x00020000, // video driver feature
- SLOW_CONFIG = 0x00040000, // software
- SWAP_RECTANGLE = 0x00080000,
- };
-
- DisplayHardware(
- const sp<SurfaceFlinger>& flinger,
- uint32_t displayIndex);
-
- ~DisplayHardware();
-
- void releaseScreen() const;
- void acquireScreen() const;
-
- // Flip the front and back buffers if the back buffer is "dirty". Might
- // be instantaneous, might involve copying the frame buffer around.
- void flip(const Region& dirty) const;
-
- float getDpiX() const;
- float getDpiY() const;
- float getRefreshRate() const;
- float getDensity() const;
- int getWidth() const;
- int getHeight() const;
- PixelFormat getFormat() const;
- uint32_t getFlags() const;
- void makeCurrent() const;
- uint32_t getMaxTextureSize() const;
- uint32_t getMaxViewportDims() const;
-
- // waits for the next vsync and returns the timestamp of when it happened
- nsecs_t waitForRefresh() const;
- nsecs_t getRefreshPeriod() const;
- nsecs_t getRefreshTimestamp() const;
-
- uint32_t getPageFlipCount() const;
- EGLDisplay getEGLDisplay() const { return mDisplay; }
-
- void dump(String8& res) const;
-
- // Hardware Composer
- HWComposer& getHwComposer() const;
-
- status_t compositionComplete() const;
-
- Rect getBounds() const {
- return Rect(mWidth, mHeight);
- }
- inline Rect bounds() const { return getBounds(); }
-
-private:
- void init(uint32_t displayIndex) __attribute__((noinline));
- void fini() __attribute__((noinline));
- int32_t getDelayToNextVSyncUs(nsecs_t* timestamp) const;
-
- sp<SurfaceFlinger> mFlinger;
- EGLDisplay mDisplay;
- EGLSurface mSurface;
- EGLContext mContext;
- EGLConfig mConfig;
- float mDpiX;
- float mDpiY;
- float mRefreshRate;
- float mDensity;
- int mWidth;
- int mHeight;
- PixelFormat mFormat;
- uint32_t mFlags;
- mutable uint32_t mPageFlipCount;
- GLint mMaxViewportDims[2];
- GLint mMaxTextureSize;
- VSyncBarrier mVSync;
-
- mutable Mutex mFakeVSyncMutex;
- mutable nsecs_t mNextFakeVSync;
- nsecs_t mRefreshPeriod;
- mutable nsecs_t mLastHwVSync;
-
- HWComposer* mHwc;
-
- sp<FramebufferNativeWindow> mNativeWindow;
-};
-
-}; // namespace android
-
-#endif // ANDROID_DISPLAY_HARDWARE_H
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
deleted file mode 100644
index 69f1aca..0000000
--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <utils/Log.h>
-
-#include "DisplayHardware/DisplayHardwareBase.h"
-#include "SurfaceFlinger.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-
-static char const * const kSleepFileName = "/sys/power/wait_for_fb_sleep";
-static char const * const kWakeFileName = "/sys/power/wait_for_fb_wake";
-
-// ----------------------------------------------------------------------------
-
-DisplayHardwareBase::DisplayEventThread::DisplayEventThread(
- const sp<SurfaceFlinger>& flinger)
- : Thread(false), mFlinger(flinger) {
-}
-
-DisplayHardwareBase::DisplayEventThread::~DisplayEventThread() {
-}
-
-status_t DisplayHardwareBase::DisplayEventThread::initCheck() const {
- return ((access(kSleepFileName, R_OK) == 0 &&
- access(kWakeFileName, R_OK) == 0)) ? NO_ERROR : NO_INIT;
-}
-
-bool DisplayHardwareBase::DisplayEventThread::threadLoop() {
-
- if (waitForFbSleep() == NO_ERROR) {
- sp<SurfaceFlinger> flinger = mFlinger.promote();
- ALOGD("About to give-up screen, flinger = %p", flinger.get());
- if (flinger != 0) {
- mBarrier.close();
- flinger->screenReleased(0);
- mBarrier.wait();
- }
- if (waitForFbWake() == NO_ERROR) {
- sp<SurfaceFlinger> flinger = mFlinger.promote();
- ALOGD("Screen about to return, flinger = %p", flinger.get());
- if (flinger != 0) {
- flinger->screenAcquired(0);
- }
- return true;
- }
- }
-
- // error, exit the thread
- return false;
-}
-
-status_t DisplayHardwareBase::DisplayEventThread::waitForFbSleep() {
- int err = 0;
- char buf;
- int fd = open(kSleepFileName, O_RDONLY, 0);
- // if the file doesn't exist, the error will be caught in read() below
- do {
- err = read(fd, &buf, 1);
- } while (err < 0 && errno == EINTR);
- close(fd);
- ALOGE_IF(err<0, "*** ANDROID_WAIT_FOR_FB_SLEEP failed (%s)", strerror(errno));
- return err < 0 ? -errno : int(NO_ERROR);
-}
-
-status_t DisplayHardwareBase::DisplayEventThread::waitForFbWake() {
- int err = 0;
- char buf;
- int fd = open(kWakeFileName, O_RDONLY, 0);
- // if the file doesn't exist, the error will be caught in read() below
- do {
- err = read(fd, &buf, 1);
- } while (err < 0 && errno == EINTR);
- close(fd);
- ALOGE_IF(err<0, "*** ANDROID_WAIT_FOR_FB_WAKE failed (%s)", strerror(errno));
- return err < 0 ? -errno : int(NO_ERROR);
-}
-
-status_t DisplayHardwareBase::DisplayEventThread::releaseScreen() const {
- mBarrier.open();
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-DisplayHardwareBase::DisplayHardwareBase(const sp<SurfaceFlinger>& flinger,
- uint32_t displayIndex)
- : mScreenAcquired(true)
-{
- mDisplayEventThread = new DisplayEventThread(flinger);
-}
-
-void DisplayHardwareBase::startSleepManagement() const {
- if (mDisplayEventThread->initCheck() == NO_ERROR) {
- mDisplayEventThread->run("DisplayEventThread", PRIORITY_URGENT_DISPLAY);
- } else {
- ALOGW("/sys/power/wait_for_fb_{wake|sleep} don't exist");
- }
-}
-
-DisplayHardwareBase::~DisplayHardwareBase() {
- // request exit
- mDisplayEventThread->requestExitAndWait();
-}
-
-bool DisplayHardwareBase::canDraw() const {
- return mScreenAcquired;
-}
-
-void DisplayHardwareBase::releaseScreen() const {
- status_t err = mDisplayEventThread->releaseScreen();
- if (err >= 0) {
- mScreenAcquired = false;
- }
-}
-
-void DisplayHardwareBase::acquireScreen() const {
- mScreenAcquired = true;
-}
-
-bool DisplayHardwareBase::isScreenAcquired() const {
- return mScreenAcquired;
-}
-
-}; // namespace android
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h
deleted file mode 100644
index fba211b..0000000
--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_DISPLAY_HARDWARE_BASE_H
-#define ANDROID_DISPLAY_HARDWARE_BASE_H
-
-#include <stdint.h>
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-#include "Barrier.h"
-
-namespace android {
-
-class SurfaceFlinger;
-
-class DisplayHardwareBase
-{
-public:
- DisplayHardwareBase(
- const sp<SurfaceFlinger>& flinger,
- uint32_t displayIndex);
-
- ~DisplayHardwareBase();
-
- void startSleepManagement() const;
-
- // console management
- void releaseScreen() const;
- void acquireScreen() const;
- bool isScreenAcquired() const;
-
- bool canDraw() const;
-
-
-private:
- class DisplayEventThread : public Thread {
- wp<SurfaceFlinger> mFlinger;
- mutable Barrier mBarrier;
- status_t waitForFbSleep();
- status_t waitForFbWake();
- public:
- DisplayEventThread(const sp<SurfaceFlinger>& flinger);
- virtual ~DisplayEventThread();
- virtual bool threadLoop();
- status_t releaseScreen() const;
- status_t initCheck() const;
- };
-
- sp<DisplayEventThread> mDisplayEventThread;
- mutable int mScreenAcquired;
-};
-
-}; // namespace android
-
-#endif // ANDROID_DISPLAY_HARDWARE_BASE_H
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
deleted file mode 100644
index f17bf43..0000000
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/String8.h>
-#include <utils/Vector.h>
-
-#include <hardware/hardware.h>
-
-#include <cutils/log.h>
-
-#include <EGL/egl.h>
-
-#include "LayerBase.h"
-#include "HWComposer.h"
-#include "SurfaceFlinger.h"
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-HWComposer::HWComposer(const sp<SurfaceFlinger>& flinger)
- : mFlinger(flinger),
- mModule(0), mHwc(0), mList(0), mCapacity(0),
- mNumOVLayers(0), mNumFBLayers(0),
- mDpy(EGL_NO_DISPLAY), mSur(EGL_NO_SURFACE)
-{
- int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule);
- ALOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID);
- if (err == 0) {
- err = hwc_open(mModule, &mHwc);
- ALOGE_IF(err, "%s device failed to initialize (%s)",
- HWC_HARDWARE_COMPOSER, strerror(-err));
- if (err == 0) {
- if (mHwc->registerProcs) {
- mCBContext.hwc = this;
- mCBContext.procs.invalidate = &hook_invalidate;
- mHwc->registerProcs(mHwc, &mCBContext.procs);
- }
- }
- }
-}
-
-HWComposer::~HWComposer() {
- free(mList);
- if (mHwc) {
- hwc_close(mHwc);
- }
-}
-
-status_t HWComposer::initCheck() const {
- return mHwc ? NO_ERROR : NO_INIT;
-}
-
-void HWComposer::hook_invalidate(struct hwc_procs* procs) {
- reinterpret_cast<cb_context *>(procs)->hwc->invalidate();
-}
-
-void HWComposer::invalidate() {
- mFlinger->repaintEverything();
-}
-
-void HWComposer::setFrameBuffer(EGLDisplay dpy, EGLSurface sur) {
- mDpy = (hwc_display_t)dpy;
- mSur = (hwc_surface_t)sur;
-}
-
-status_t HWComposer::createWorkList(size_t numLayers) {
- if (mHwc) {
- if (!mList || mCapacity < numLayers) {
- free(mList);
- size_t size = sizeof(hwc_layer_list) + numLayers*sizeof(hwc_layer_t);
- mList = (hwc_layer_list_t*)malloc(size);
- mCapacity = numLayers;
- }
- mList->flags = HWC_GEOMETRY_CHANGED;
- mList->numHwLayers = numLayers;
- }
- return NO_ERROR;
-}
-
-status_t HWComposer::prepare() const {
- int err = mHwc->prepare(mHwc, mList);
- if (err == NO_ERROR) {
- size_t numOVLayers = 0;
- size_t numFBLayers = 0;
- size_t count = mList->numHwLayers;
- for (size_t i=0 ; i<count ; i++) {
- hwc_layer& l(mList->hwLayers[i]);
- if (l.flags & HWC_SKIP_LAYER) {
- l.compositionType = HWC_FRAMEBUFFER;
- }
- switch (l.compositionType) {
- case HWC_OVERLAY:
- numOVLayers++;
- break;
- case HWC_FRAMEBUFFER:
- numFBLayers++;
- break;
- }
- }
- mNumOVLayers = numOVLayers;
- mNumFBLayers = numFBLayers;
- }
- return (status_t)err;
-}
-
-size_t HWComposer::getLayerCount(int type) const {
- switch (type) {
- case HWC_OVERLAY:
- return mNumOVLayers;
- case HWC_FRAMEBUFFER:
- return mNumFBLayers;
- }
- return 0;
-}
-
-status_t HWComposer::commit() const {
- int err = mHwc->set(mHwc, mDpy, mSur, mList);
- if (mList) {
- mList->flags &= ~HWC_GEOMETRY_CHANGED;
- }
- return (status_t)err;
-}
-
-status_t HWComposer::release() const {
- if (mHwc) {
- int err = mHwc->set(mHwc, NULL, NULL, NULL);
- return (status_t)err;
- }
- return NO_ERROR;
-}
-
-status_t HWComposer::disable() {
- if (mHwc) {
- free(mList);
- mList = NULL;
- int err = mHwc->prepare(mHwc, NULL);
- return (status_t)err;
- }
- return NO_ERROR;
-}
-
-size_t HWComposer::getNumLayers() const {
- return mList ? mList->numHwLayers : 0;
-}
-
-hwc_layer_t* HWComposer::getLayers() const {
- return mList ? mList->hwLayers : 0;
-}
-
-void HWComposer::dump(String8& result, char* buffer, size_t SIZE,
- const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const {
- if (mHwc && mList) {
- result.append("Hardware Composer state:\n");
-
- snprintf(buffer, SIZE, " numHwLayers=%u, flags=%08x\n",
- mList->numHwLayers, mList->flags);
- result.append(buffer);
- result.append(
- " type | handle | hints | flags | tr | blend | format | source crop | frame name \n"
- "----------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n");
- // " ________ | ________ | ________ | ________ | __ | _____ | ________ | [_____,_____,_____,_____] | [_____,_____,_____,_____]
- for (size_t i=0 ; i<mList->numHwLayers ; i++) {
- const hwc_layer_t& l(mList->hwLayers[i]);
- const sp<LayerBase> layer(visibleLayersSortedByZ[i]);
- int32_t format = -1;
- if (layer->getLayer() != NULL) {
- const sp<GraphicBuffer>& buffer(layer->getLayer()->getActiveBuffer());
- if (buffer != NULL) {
- format = buffer->getPixelFormat();
- }
- }
- snprintf(buffer, SIZE,
- " %8s | %08x | %08x | %08x | %02x | %05x | %08x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n",
- l.compositionType ? "OVERLAY" : "FB",
- intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, format,
- l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom,
- l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom,
- layer->getName().string());
- result.append(buffer);
- }
- }
- if (mHwc && mHwc->common.version >= 1 && mHwc->dump) {
- mHwc->dump(mHwc, buffer, SIZE);
- result.append(buffer);
- }
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
deleted file mode 100644
index aa8ebe1..0000000
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SF_HWCOMPOSER_H
-#define ANDROID_SF_HWCOMPOSER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-
-#include <hardware/hwcomposer.h>
-
-#include <utils/StrongPointer.h>
-#include <utils/Vector.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-class SurfaceFlinger;
-class LayerBase;
-
-class HWComposer
-{
-public:
-
- HWComposer(const sp<SurfaceFlinger>& flinger);
- ~HWComposer();
-
- status_t initCheck() const;
-
- // tells the HAL what the framebuffer is
- void setFrameBuffer(EGLDisplay dpy, EGLSurface sur);
-
- // create a work list for numLayers layer
- status_t createWorkList(size_t numLayers);
-
- // Asks the HAL what it can do
- status_t prepare() const;
-
- // disable hwc until next createWorkList
- status_t disable();
-
- // commits the list
- status_t commit() const;
-
- // release hardware resources
- status_t release() const;
-
- size_t getNumLayers() const;
- hwc_layer_t* getLayers() const;
-
- // updated in preapre()
- size_t getLayerCount(int type) const;
-
- // for debugging
- void dump(String8& out, char* scratch, size_t SIZE,
- const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const;
-
-private:
- struct cb_context {
- hwc_procs_t procs;
- HWComposer* hwc;
- };
- static void hook_invalidate(struct hwc_procs* procs);
- void invalidate();
-
- sp<SurfaceFlinger> mFlinger;
- hw_module_t const* mModule;
- hwc_composer_device_t* mHwc;
- hwc_layer_list_t* mList;
- size_t mCapacity;
- mutable size_t mNumOVLayers;
- mutable size_t mNumFBLayers;
- hwc_display_t mDpy;
- hwc_surface_t mSur;
- cb_context mCBContext;
-};
-
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_SF_HWCOMPOSER_H
diff --git a/services/surfaceflinger/DisplayHardware/VSyncBarrier.cpp b/services/surfaceflinger/DisplayHardware/VSyncBarrier.cpp
deleted file mode 100644
index 187da20..0000000
--- a/services/surfaceflinger/DisplayHardware/VSyncBarrier.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/fb.h>
-
-#include "DisplayHardware/VSyncBarrier.h"
-
-#ifndef FBIO_WAITFORVSYNC
-#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
-#endif
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-VSyncBarrier::VSyncBarrier() : mFd(-EINVAL) {
-#if HAS_WAITFORVSYNC
- mFd = open("/dev/graphics/fb0", O_RDWR);
- if (mFd < 0) {
- mFd = -errno;
- }
- // try to see if FBIO_WAITFORVSYNC is supported
- uint32_t crt = 0;
- int err = ioctl(mFd, FBIO_WAITFORVSYNC, &crt);
- if (err < 0) {
- close(mFd);
- mFd = -EINVAL;
- }
-#endif
-}
-
-VSyncBarrier::~VSyncBarrier() {
- if (mFd >= 0) {
- close(mFd);
- }
-}
-
-status_t VSyncBarrier::initCheck() const {
- return mFd < 0 ? mFd : status_t(NO_ERROR);
-}
-
-// this must be thread-safe
-status_t VSyncBarrier::wait(nsecs_t* timestamp) const {
- if (mFd < 0) {
- return mFd;
- }
-
- int err;
- uint32_t crt = 0;
- do {
- err = ioctl(mFd, FBIO_WAITFORVSYNC, &crt);
- } while (err<0 && errno==EINTR);
- if (err < 0) {
- return -errno;
- }
- // ideally this would come from the driver
- timestamp[0] = systemTime();
- return NO_ERROR;
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/services/surfaceflinger/DisplayHardware/VSyncBarrier.h b/services/surfaceflinger/DisplayHardware/VSyncBarrier.h
deleted file mode 100644
index 3c32950..0000000
--- a/services/surfaceflinger/DisplayHardware/VSyncBarrier.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SURFACE_FLINGER_VSYNCBARRIER_H_
-#define ANDROID_SURFACE_FLINGER_VSYNCBARRIER_H_
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Timers.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class VSyncBarrier {
- int mFd;
-public:
- VSyncBarrier();
- ~VSyncBarrier();
- status_t initCheck() const;
- status_t wait(nsecs_t* timestamp) const;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif /* ANDROID_SURFACE_FLINGER_VSYNCBARRIER_H_ */
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp
deleted file mode 100644
index 3c045d7..0000000
--- a/services/surfaceflinger/EventThread.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <gui/IDisplayEventConnection.h>
-#include <gui/DisplayEventReceiver.h>
-
-#include <utils/Errors.h>
-#include <utils/Trace.h>
-
-#include "DisplayHardware/DisplayHardware.h"
-#include "DisplayEventConnection.h"
-#include "EventThread.h"
-#include "SurfaceFlinger.h"
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-EventThread::EventThread(const sp<SurfaceFlinger>& flinger)
- : mFlinger(flinger),
- mHw(flinger->graphicPlane(0).displayHardware()),
- mLastVSyncTimestamp(0),
- mDeliveredEvents(0)
-{
-}
-
-void EventThread::onFirstRef() {
- run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
-}
-
-sp<DisplayEventConnection> EventThread::createEventConnection() const {
- return new DisplayEventConnection(const_cast<EventThread*>(this));
-}
-
-nsecs_t EventThread::getLastVSyncTimestamp() const {
- Mutex::Autolock _l(mLock);
- return mLastVSyncTimestamp;
-}
-
-nsecs_t EventThread::getVSyncPeriod() const {
- return mHw.getRefreshPeriod();
-
-}
-
-status_t EventThread::registerDisplayEventConnection(
- const sp<DisplayEventConnection>& connection) {
- Mutex::Autolock _l(mLock);
- ConnectionInfo info;
- mDisplayEventConnections.add(connection, info);
- mCondition.signal();
- return NO_ERROR;
-}
-
-status_t EventThread::unregisterDisplayEventConnection(
- const wp<DisplayEventConnection>& connection) {
- Mutex::Autolock _l(mLock);
- mDisplayEventConnections.removeItem(connection);
- mCondition.signal();
- return NO_ERROR;
-}
-
-void EventThread::removeDisplayEventConnection(
- const wp<DisplayEventConnection>& connection) {
- Mutex::Autolock _l(mLock);
- mDisplayEventConnections.removeItem(connection);
-}
-
-EventThread::ConnectionInfo* EventThread::getConnectionInfoLocked(
- const wp<DisplayEventConnection>& connection) {
- ssize_t index = mDisplayEventConnections.indexOfKey(connection);
- if (index < 0) return NULL;
- return &mDisplayEventConnections.editValueAt(index);
-}
-
-void EventThread::setVsyncRate(uint32_t count,
- const wp<DisplayEventConnection>& connection) {
- if (int32_t(count) >= 0) { // server must protect against bad params
- Mutex::Autolock _l(mLock);
- ConnectionInfo* info = getConnectionInfoLocked(connection);
- if (info) {
- const int32_t new_count = (count == 0) ? -1 : count;
- if (info->count != new_count) {
- info->count = new_count;
- mCondition.signal();
- }
- }
- }
-}
-
-void EventThread::requestNextVsync(
- const wp<DisplayEventConnection>& connection) {
- Mutex::Autolock _l(mLock);
- ConnectionInfo* info = getConnectionInfoLocked(connection);
- if (info && info->count < 0) {
- info->count = 0;
- mCondition.signal();
- }
-}
-
-bool EventThread::threadLoop() {
-
- nsecs_t timestamp;
- DisplayEventReceiver::Event vsync;
- Vector< wp<DisplayEventConnection> > displayEventConnections;
-
- { // scope for the lock
- Mutex::Autolock _l(mLock);
- do {
- // see if we need to wait for the VSYNC at all
- do {
- bool waitForNextVsync = false;
- size_t count = mDisplayEventConnections.size();
- for (size_t i=0 ; i<count ; i++) {
- const ConnectionInfo& info(
- mDisplayEventConnections.valueAt(i));
- if (info.count >= 0) {
- // at least one continuous mode or active one-shot event
- waitForNextVsync = true;
- break;
- }
- }
-
- if (waitForNextVsync)
- break;
-
- mCondition.wait(mLock);
- } while(true);
-
- // at least one listener requested VSYNC
- mLock.unlock();
- timestamp = mHw.waitForRefresh();
- ATRACE_INT("VSYNC", mDeliveredEvents&1);
- mLock.lock();
- mDeliveredEvents++;
- mLastVSyncTimestamp = timestamp;
-
- // now see if we still need to report this VSYNC event
- const size_t count = mDisplayEventConnections.size();
- for (size_t i=0 ; i<count ; i++) {
- bool reportVsync = false;
- const ConnectionInfo& info(
- mDisplayEventConnections.valueAt(i));
- if (info.count >= 1) {
- if (info.count==1 || (mDeliveredEvents % info.count) == 0) {
- // continuous event, and time to report it
- reportVsync = true;
- }
- } else if (info.count >= -1) {
- ConnectionInfo& info(
- mDisplayEventConnections.editValueAt(i));
- if (info.count == 0) {
- // fired this time around
- reportVsync = true;
- }
- info.count--;
- }
- if (reportVsync) {
- displayEventConnections.add(mDisplayEventConnections.keyAt(i));
- }
- }
- } while (!displayEventConnections.size());
-
- // dispatch vsync events to listeners...
- vsync.header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
- vsync.header.timestamp = timestamp;
- vsync.vsync.count = mDeliveredEvents;
- }
-
- const size_t count = displayEventConnections.size();
- for (size_t i=0 ; i<count ; i++) {
- sp<DisplayEventConnection> conn(displayEventConnections[i].promote());
- // make sure the connection didn't die
- if (conn != NULL) {
- status_t err = conn->postEvent(vsync);
- if (err == -EAGAIN || err == -EWOULDBLOCK) {
- // The destination doesn't accept events anymore, it's probably
- // full. For now, we just drop the events on the floor.
- // Note that some events cannot be dropped and would have to be
- // re-sent later. Right-now we don't have the ability to do
- // this, but it doesn't matter for VSYNC.
- } else if (err < 0) {
- // handle any other error on the pipe as fatal. the only
- // reasonable thing to do is to clean-up this connection.
- // The most common error we'll get here is -EPIPE.
- removeDisplayEventConnection(displayEventConnections[i]);
- }
- } else {
- // somehow the connection is dead, but we still have it in our list
- // just clean the list.
- removeDisplayEventConnection(displayEventConnections[i]);
- }
- }
-
- // clear all our references without holding mLock
- displayEventConnections.clear();
-
- return true;
-}
-
-status_t EventThread::readyToRun() {
- ALOGI("EventThread ready to run.");
- return NO_ERROR;
-}
-
-void EventThread::dump(String8& result, char* buffer, size_t SIZE) const {
- Mutex::Autolock _l(mLock);
- result.append("VSYNC state:\n");
- snprintf(buffer, SIZE, " numListeners=%u, events-delivered: %u\n",
- mDisplayEventConnections.size(), mDeliveredEvents);
- result.append(buffer);
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h
deleted file mode 100644
index 3a3071e..0000000
--- a/services/surfaceflinger/EventThread.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SURFACE_FLINGER_EVENT_THREAD_H
-#define ANDROID_SURFACE_FLINGER_EVENT_THREAD_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <gui/IDisplayEventConnection.h>
-
-#include <utils/Errors.h>
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-
-#include "DisplayEventConnection.h"
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class SurfaceFlinger;
-class DisplayHardware;
-class DisplayEventConnection;
-
-// ---------------------------------------------------------------------------
-
-class EventThread : public Thread {
- friend class DisplayEventConnection;
-
-public:
- EventThread(const sp<SurfaceFlinger>& flinger);
-
- sp<DisplayEventConnection> createEventConnection() const;
-
- status_t registerDisplayEventConnection(
- const sp<DisplayEventConnection>& connection);
-
- status_t unregisterDisplayEventConnection(
- const wp<DisplayEventConnection>& connection);
-
- void setVsyncRate(uint32_t count,
- const wp<DisplayEventConnection>& connection);
-
- void requestNextVsync(const wp<DisplayEventConnection>& connection);
-
- nsecs_t getLastVSyncTimestamp() const;
-
- nsecs_t getVSyncPeriod() const;
-
- void dump(String8& result, char* buffer, size_t SIZE) const;
-
-private:
- virtual bool threadLoop();
- virtual status_t readyToRun();
- virtual void onFirstRef();
-
- struct ConnectionInfo {
- ConnectionInfo() : count(-1) { }
-
- // count >= 1 : continuous event. count is the vsync rate
- // count == 0 : one-shot event that has not fired
- // count ==-1 : one-shot event that fired this round / disabled
- // count ==-2 : one-shot event that fired the round before
- int32_t count;
- };
-
- void removeDisplayEventConnection(
- const wp<DisplayEventConnection>& connection);
-
- ConnectionInfo* getConnectionInfoLocked(
- const wp<DisplayEventConnection>& connection);
-
- // constants
- sp<SurfaceFlinger> mFlinger;
- const DisplayHardware& mHw;
-
- mutable Mutex mLock;
- mutable Condition mCondition;
-
- // protected by mLock
- KeyedVector< wp<DisplayEventConnection>, ConnectionInfo > mDisplayEventConnections;
- nsecs_t mLastVSyncTimestamp;
-
- // main thread only
- size_t mDeliveredEvents;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif /* ANDROID_SURFACE_FLINGER_EVENT_THREAD_H */
diff --git a/services/surfaceflinger/GLExtensions.cpp b/services/surfaceflinger/GLExtensions.cpp
deleted file mode 100644
index 493122d..0000000
--- a/services/surfaceflinger/GLExtensions.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include "GLExtensions.h"
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-ANDROID_SINGLETON_STATIC_INSTANCE( GLExtensions )
-
-GLExtensions::GLExtensions()
- : mHaveTextureExternal(false),
- mHaveNpot(false),
- mHaveDirectTexture(false)
-{
-}
-
-void GLExtensions::initWithGLStrings(
- GLubyte const* vendor,
- GLubyte const* renderer,
- GLubyte const* version,
- GLubyte const* extensions,
- char const* egl_vendor,
- char const* egl_version,
- char const* egl_extensions)
-{
- mVendor = (char const*)vendor;
- mRenderer = (char const*)renderer;
- mVersion = (char const*)version;
- mExtensions = (char const*)extensions;
- mEglVendor = egl_vendor;
- mEglVersion = egl_version;
- mEglExtensions = egl_extensions;
-
- char const* curr = (char const*)extensions;
- char const* head = curr;
- do {
- head = strchr(curr, ' ');
- String8 s(curr, head ? head-curr : strlen(curr));
- if (s.length()) {
- mExtensionList.add(s);
- }
- curr = head+1;
- } while (head);
-
- curr = egl_extensions;
- head = curr;
- do {
- head = strchr(curr, ' ');
- String8 s(curr, head ? head-curr : strlen(curr));
- if (s.length()) {
- mExtensionList.add(s);
- }
- curr = head+1;
- } while (head);
-
-#ifdef EGL_ANDROID_image_native_buffer
- if (hasExtension("GL_OES_EGL_image") &&
- (hasExtension("EGL_KHR_image_base") || hasExtension("EGL_KHR_image")) &&
- hasExtension("EGL_ANDROID_image_native_buffer"))
- {
- mHaveDirectTexture = true;
- }
-#else
-#warning "EGL_ANDROID_image_native_buffer not supported"
-#endif
-
- if (hasExtension("GL_ARB_texture_non_power_of_two")) {
- mHaveNpot = true;
- }
-
- if (hasExtension("GL_OES_EGL_image_external")) {
- mHaveTextureExternal = true;
- } else if (strstr(mRenderer.string(), "Adreno")) {
- // hack for Adreno 200
- mHaveTextureExternal = true;
- }
-
- if (hasExtension("GL_OES_framebuffer_object")) {
- mHaveFramebufferObject = true;
- }
-}
-
-bool GLExtensions::hasExtension(char const* extension) const
-{
- const String8 s(extension);
- return mExtensionList.indexOf(s) >= 0;
-}
-
-char const* GLExtensions::getVendor() const {
- return mVendor.string();
-}
-
-char const* GLExtensions::getRenderer() const {
- return mRenderer.string();
-}
-
-char const* GLExtensions::getVersion() const {
- return mVersion.string();
-}
-
-char const* GLExtensions::getExtension() const {
- return mExtensions.string();
-}
-
-char const* GLExtensions::getEglVendor() const {
- return mEglVendor.string();
-}
-
-char const* GLExtensions::getEglVersion() const {
- return mEglVersion.string();
-}
-
-char const* GLExtensions::getEglExtension() const {
- return mEglExtensions.string();
-}
-
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/services/surfaceflinger/GLExtensions.h b/services/surfaceflinger/GLExtensions.h
deleted file mode 100644
index c86c66a..0000000
--- a/services/surfaceflinger/GLExtensions.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SF_GLEXTENSION_H
-#define ANDROID_SF_GLEXTENSION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/String8.h>
-#include <utils/SortedVector.h>
-#include <utils/Singleton.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class GLExtensions : public Singleton<GLExtensions>
-{
- friend class Singleton<GLExtensions>;
-
- bool mHaveTextureExternal : 1;
- bool mHaveNpot : 1;
- bool mHaveDirectTexture : 1;
- bool mHaveFramebufferObject : 1;
-
- String8 mVendor;
- String8 mRenderer;
- String8 mVersion;
- String8 mExtensions;
- String8 mEglVendor;
- String8 mEglVersion;
- String8 mEglExtensions;
- SortedVector<String8> mExtensionList;
-
- GLExtensions(const GLExtensions&);
- GLExtensions& operator = (const GLExtensions&);
-
-protected:
- GLExtensions();
-
-public:
- inline bool haveTextureExternal() const {
- return mHaveTextureExternal;
- }
- inline bool haveNpot() const {
- return mHaveNpot;
- }
- inline bool haveDirectTexture() const {
- return mHaveDirectTexture;
- }
-
- inline bool haveFramebufferObject() const {
- return mHaveFramebufferObject;
- }
-
- void initWithGLStrings(
- GLubyte const* vendor,
- GLubyte const* renderer,
- GLubyte const* version,
- GLubyte const* extensions,
- char const* egl_vendor,
- char const* egl_version,
- char const* egl_extensions);
-
- char const* getVendor() const;
- char const* getRenderer() const;
- char const* getVersion() const;
- char const* getExtension() const;
-
- char const* getEglVendor() const;
- char const* getEglVersion() const;
- char const* getEglExtension() const;
-
- bool hasExtension(char const* extension) const;
-};
-
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_SF_GLEXTENSION_H
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
deleted file mode 100644
index df7fe5c..0000000
--- a/services/surfaceflinger/Layer.cpp
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <math.h>
-
-#include <cutils/compiler.h>
-#include <cutils/native_handle.h>
-#include <cutils/properties.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <utils/StopWatch.h>
-#include <utils/Trace.h>
-
-#include <ui/GraphicBuffer.h>
-#include <ui/PixelFormat.h>
-
-#include <gui/Surface.h>
-
-#include "clz.h"
-#include "DisplayHardware/DisplayHardware.h"
-#include "DisplayHardware/HWComposer.h"
-#include "GLExtensions.h"
-#include "Layer.h"
-#include "SurfaceFlinger.h"
-#include "SurfaceTextureLayer.h"
-
-#define DEBUG_RESIZE 0
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-Layer::Layer(SurfaceFlinger* flinger,
- DisplayID display, const sp<Client>& client)
- : LayerBaseClient(flinger, display, client),
- mTextureName(-1U),
- mQueuedFrames(0),
- mCurrentTransform(0),
- mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
- mCurrentOpacity(true),
- mRefreshPending(false),
- mFrameLatencyNeeded(false),
- mFrameLatencyOffset(0),
- mFormat(PIXEL_FORMAT_NONE),
- mGLExtensions(GLExtensions::getInstance()),
- mOpaqueLayer(true),
- mNeedsDithering(false),
- mSecure(false),
- mProtectedByApp(false)
-{
- mCurrentCrop.makeInvalid();
- glGenTextures(1, &mTextureName);
-}
-
-void Layer::onLayerDisplayed() {
- if (mFrameLatencyNeeded) {
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- mFrameStats[mFrameLatencyOffset].timestamp = mSurfaceTexture->getTimestamp();
- mFrameStats[mFrameLatencyOffset].set = systemTime();
- mFrameStats[mFrameLatencyOffset].vsync = hw.getRefreshTimestamp();
- mFrameLatencyOffset = (mFrameLatencyOffset + 1) % 128;
- mFrameLatencyNeeded = false;
- }
-}
-
-void Layer::onFirstRef()
-{
- LayerBaseClient::onFirstRef();
-
- struct FrameQueuedListener : public SurfaceTexture::FrameAvailableListener {
- FrameQueuedListener(Layer* layer) : mLayer(layer) { }
- private:
- wp<Layer> mLayer;
- virtual void onFrameAvailable() {
- sp<Layer> that(mLayer.promote());
- if (that != 0) {
- that->onFrameQueued();
- }
- }
- };
- mSurfaceTexture = new SurfaceTextureLayer(mTextureName, this);
- mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this));
- mSurfaceTexture->setSynchronousMode(true);
-#ifdef USE_TRIPLE_BUFFERING
-#warning "using triple buffering"
- mSurfaceTexture->setBufferCountServer(3);
-#else
- mSurfaceTexture->setBufferCountServer(2);
-#endif
-}
-
-Layer::~Layer()
-{
- mFlinger->postMessageAsync(
- new SurfaceFlinger::MessageDestroyGLTexture(mTextureName) );
-}
-
-void Layer::onFrameQueued() {
- android_atomic_inc(&mQueuedFrames);
- mFlinger->signalLayerUpdate();
-}
-
-// called with SurfaceFlinger::mStateLock as soon as the layer is entered
-// in the purgatory list
-void Layer::onRemoved()
-{
- mSurfaceTexture->abandon();
-}
-
-void Layer::setName(const String8& name) {
- LayerBase::setName(name);
- mSurfaceTexture->setName(name);
-}
-
-sp<ISurface> Layer::createSurface()
-{
- class BSurface : public BnSurface, public LayerCleaner {
- wp<const Layer> mOwner;
- virtual sp<ISurfaceTexture> getSurfaceTexture() const {
- sp<ISurfaceTexture> res;
- sp<const Layer> that( mOwner.promote() );
- if (that != NULL) {
- res = that->mSurfaceTexture;
- }
- return res;
- }
- public:
- BSurface(const sp<SurfaceFlinger>& flinger,
- const sp<Layer>& layer)
- : LayerCleaner(flinger, layer), mOwner(layer) { }
- };
- sp<ISurface> sur(new BSurface(mFlinger, this));
- return sur;
-}
-
-wp<IBinder> Layer::getSurfaceTextureBinder() const
-{
- return mSurfaceTexture->asBinder();
-}
-
-status_t Layer::setBuffers( uint32_t w, uint32_t h,
- PixelFormat format, uint32_t flags)
-{
- // this surfaces pixel format
- PixelFormatInfo info;
- status_t err = getPixelFormatInfo(format, &info);
- if (err) {
- ALOGE("unsupported pixelformat %d", format);
- return err;
- }
-
- // the display's pixel format
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- uint32_t const maxSurfaceDims = min(
- hw.getMaxTextureSize(), hw.getMaxViewportDims());
-
- // never allow a surface larger than what our underlying GL implementation
- // can handle.
- if ((uint32_t(w)>maxSurfaceDims) || (uint32_t(h)>maxSurfaceDims)) {
- ALOGE("dimensions too large %u x %u", uint32_t(w), uint32_t(h));
- return BAD_VALUE;
- }
-
- PixelFormatInfo displayInfo;
- getPixelFormatInfo(hw.getFormat(), &displayInfo);
- const uint32_t hwFlags = hw.getFlags();
-
- mFormat = format;
-
- mSecure = (flags & ISurfaceComposer::eSecure) ? true : false;
- mProtectedByApp = (flags & ISurfaceComposer::eProtectedByApp) ? true : false;
- mOpaqueLayer = (flags & ISurfaceComposer::eOpaque);
- mCurrentOpacity = getOpacityForFormat(format);
-
- mSurfaceTexture->setDefaultBufferSize(w, h);
- mSurfaceTexture->setDefaultBufferFormat(format);
-
- // we use the red index
- int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED);
- int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
- mNeedsDithering = layerRedsize > displayRedSize;
-
- return NO_ERROR;
-}
-
-void Layer::setGeometry(hwc_layer_t* hwcl)
-{
- LayerBaseClient::setGeometry(hwcl);
-
- hwcl->flags &= ~HWC_SKIP_LAYER;
-
- // we can't do alpha-fade with the hwc HAL
- const State& s(drawingState());
- if (s.alpha < 0xFF) {
- hwcl->flags = HWC_SKIP_LAYER;
- }
-
- /*
- * Transformations are applied in this order:
- * 1) buffer orientation/flip/mirror
- * 2) state transformation (window manager)
- * 3) layer orientation (screen orientation)
- * mTransform is already the composition of (2) and (3)
- * (NOTE: the matrices are multiplied in reverse order)
- */
-
- const Transform bufferOrientation(mCurrentTransform);
- const Transform tr(mTransform * bufferOrientation);
-
- // this gives us only the "orientation" component of the transform
- const uint32_t finalTransform = tr.getOrientation();
-
- // we can only handle simple transformation
- if (finalTransform & Transform::ROT_INVALID) {
- hwcl->flags = HWC_SKIP_LAYER;
- } else {
- hwcl->transform = finalTransform;
- }
-
- if (isCropped()) {
- hwcl->sourceCrop.left = mCurrentCrop.left;
- hwcl->sourceCrop.top = mCurrentCrop.top;
- hwcl->sourceCrop.right = mCurrentCrop.right;
- hwcl->sourceCrop.bottom = mCurrentCrop.bottom;
- } else {
- const sp<GraphicBuffer>& buffer(mActiveBuffer);
- hwcl->sourceCrop.left = 0;
- hwcl->sourceCrop.top = 0;
- if (buffer != NULL) {
- hwcl->sourceCrop.right = buffer->width;
- hwcl->sourceCrop.bottom = buffer->height;
- } else {
- hwcl->sourceCrop.right = mTransformedBounds.width();
- hwcl->sourceCrop.bottom = mTransformedBounds.height();
- }
- }
-}
-
-void Layer::setPerFrameData(hwc_layer_t* hwcl) {
- const sp<GraphicBuffer>& buffer(mActiveBuffer);
- if (buffer == NULL) {
- // this can happen if the client never drew into this layer yet,
- // or if we ran out of memory. In that case, don't let
- // HWC handle it.
- hwcl->flags |= HWC_SKIP_LAYER;
- hwcl->handle = NULL;
- } else {
- hwcl->handle = buffer->handle;
- }
-}
-
-void Layer::onDraw(const Region& clip) const
-{
- ATRACE_CALL();
-
- if (CC_UNLIKELY(mActiveBuffer == 0)) {
- // the texture has not been created yet, this Layer has
- // in fact never been drawn into. This happens frequently with
- // SurfaceView because the WindowManager can't know when the client
- // has drawn the first time.
-
- // If there is nothing under us, we paint the screen in black, otherwise
- // we just skip this update.
-
- // figure out if there is something below us
- Region under;
- const SurfaceFlinger::LayerVector& drawingLayers(
- mFlinger->mDrawingState.layersSortedByZ);
- const size_t count = drawingLayers.size();
- for (size_t i=0 ; i<count ; ++i) {
- const sp<LayerBase>& layer(drawingLayers[i]);
- if (layer.get() == static_cast<LayerBase const*>(this))
- break;
- under.orSelf(layer->visibleRegionScreen);
- }
- // if not everything below us is covered, we plug the holes!
- Region holes(clip.subtract(under));
- if (!holes.isEmpty()) {
- clearWithOpenGL(holes, 0, 0, 0, 1);
- }
- return;
- }
-
- if (!isProtected()) {
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureName);
- GLenum filter = GL_NEAREST;
- if (getFiltering() || needsFiltering() || isFixedSize() || isCropped()) {
- // TODO: we could be more subtle with isFixedSize()
- filter = GL_LINEAR;
- }
- glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, filter);
- glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, filter);
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf(mTextureMatrix);
- glMatrixMode(GL_MODELVIEW);
- glDisable(GL_TEXTURE_2D);
- glEnable(GL_TEXTURE_EXTERNAL_OES);
- } else {
- glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName());
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glEnable(GL_TEXTURE_2D);
- }
-
- drawWithOpenGL(clip);
-
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glDisable(GL_TEXTURE_2D);
-}
-
-// As documented in libhardware header, formats in the range
-// 0x100 - 0x1FF are specific to the HAL implementation, and
-// are known to have no alpha channel
-// TODO: move definition for device-specific range into
-// hardware.h, instead of using hard-coded values here.
-#define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF)
-
-bool Layer::getOpacityForFormat(uint32_t format)
-{
- if (HARDWARE_IS_DEVICE_FORMAT(format)) {
- return true;
- }
- PixelFormatInfo info;
- status_t err = getPixelFormatInfo(PixelFormat(format), &info);
- // in case of error (unknown format), we assume no blending
- return (err || info.h_alpha <= info.l_alpha);
-}
-
-
-bool Layer::isOpaque() const
-{
- // if we don't have a buffer yet, we're translucent regardless of the
- // layer's opaque flag.
- if (mActiveBuffer == 0) {
- return false;
- }
-
- // if the layer has the opaque flag, then we're always opaque,
- // otherwise we use the current buffer's format.
- return mOpaqueLayer || mCurrentOpacity;
-}
-
-bool Layer::isProtected() const
-{
- const sp<GraphicBuffer>& activeBuffer(mActiveBuffer);
- return (activeBuffer != 0) &&
- (activeBuffer->getUsage() & GRALLOC_USAGE_PROTECTED);
-}
-
-uint32_t Layer::doTransaction(uint32_t flags)
-{
- ATRACE_CALL();
-
- const Layer::State& front(drawingState());
- const Layer::State& temp(currentState());
-
- const bool sizeChanged = (front.requested_w != temp.requested_w) ||
- (front.requested_h != temp.requested_h);
-
- if (sizeChanged) {
- // the size changed, we need to ask our client to request a new buffer
- ALOGD_IF(DEBUG_RESIZE,
- "doTransaction: "
- "resize (layer=%p), requested (%dx%d), drawing (%d,%d), "
- "scalingMode=%d",
- this,
- int(temp.requested_w), int(temp.requested_h),
- int(front.requested_w), int(front.requested_h),
- mCurrentScalingMode);
-
- if (!isFixedSize()) {
- // this will make sure LayerBase::doTransaction doesn't update
- // the drawing state's size
- Layer::State& editDraw(mDrawingState);
- editDraw.requested_w = temp.requested_w;
- editDraw.requested_h = temp.requested_h;
- }
-
- // record the new size, form this point on, when the client request
- // a buffer, it'll get the new size.
- mSurfaceTexture->setDefaultBufferSize(temp.requested_w,
- temp.requested_h);
- }
-
- return LayerBase::doTransaction(flags);
-}
-
-bool Layer::isFixedSize() const {
- return mCurrentScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE;
-}
-
-bool Layer::isCropped() const {
- return !mCurrentCrop.isEmpty();
-}
-
-// ----------------------------------------------------------------------------
-// pageflip handling...
-// ----------------------------------------------------------------------------
-
-bool Layer::onPreComposition() {
- mRefreshPending = false;
- return mQueuedFrames > 0;
-}
-
-void Layer::lockPageFlip(bool& recomputeVisibleRegions)
-{
- ATRACE_CALL();
-
- if (mQueuedFrames > 0) {
-
- // if we've already called updateTexImage() without going through
- // a composition step, we have to skip this layer at this point
- // because we cannot call updateTeximage() without a corresponding
- // compositionComplete() call.
- // we'll trigger an update in onPreComposition().
- if (mRefreshPending) {
- mPostedDirtyRegion.clear();
- return;
- }
- mRefreshPending = true;
-
- // Capture the old state of the layer for comparisons later
- const bool oldOpacity = isOpaque();
- sp<GraphicBuffer> oldActiveBuffer = mActiveBuffer;
-
- // signal another event if we have more frames pending
- if (android_atomic_dec(&mQueuedFrames) > 1) {
- mFlinger->signalLayerUpdate();
- }
-
- if (mSurfaceTexture->updateTexImage() < NO_ERROR) {
- // something happened!
- recomputeVisibleRegions = true;
- return;
- }
-
- // update the active buffer
- mActiveBuffer = mSurfaceTexture->getCurrentBuffer();
- mFrameLatencyNeeded = true;
-
- if (oldActiveBuffer == NULL && mActiveBuffer != NULL) {
- // the first time we receive a buffer, we need to trigger a
- // geometry invalidation.
- mFlinger->invalidateHwcGeometry();
- }
-
- const Rect crop(mSurfaceTexture->getCurrentCrop());
- const uint32_t transform(mSurfaceTexture->getCurrentTransform());
- const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode());
- if ((crop != mCurrentCrop) ||
- (transform != mCurrentTransform) ||
- (scalingMode != mCurrentScalingMode))
- {
- mCurrentCrop = crop;
- mCurrentTransform = transform;
- mCurrentScalingMode = scalingMode;
- mFlinger->invalidateHwcGeometry();
- }
-
- GLfloat textureMatrix[16];
- mSurfaceTexture->getTransformMatrix(textureMatrix);
- if (memcmp(textureMatrix, mTextureMatrix, sizeof(textureMatrix))) {
- memcpy(mTextureMatrix, textureMatrix, sizeof(textureMatrix));
- mFlinger->invalidateHwcGeometry();
- }
-
- uint32_t bufWidth = mActiveBuffer->getWidth();
- uint32_t bufHeight = mActiveBuffer->getHeight();
- if (oldActiveBuffer != NULL) {
- if (bufWidth != uint32_t(oldActiveBuffer->width) ||
- bufHeight != uint32_t(oldActiveBuffer->height)) {
- mFlinger->invalidateHwcGeometry();
- }
- }
-
- mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format);
- if (oldOpacity != isOpaque()) {
- recomputeVisibleRegions = true;
- }
-
- glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- // update the layer size if needed
- const Layer::State& front(drawingState());
-
- // FIXME: mPostedDirtyRegion = dirty & bounds
- mPostedDirtyRegion.set(front.w, front.h);
-
- if ((front.w != front.requested_w) ||
- (front.h != front.requested_h))
- {
- // check that we received a buffer of the right size
- // (Take the buffer's orientation into account)
- if (mCurrentTransform & Transform::ROT_90) {
- swap(bufWidth, bufHeight);
- }
-
- if (isFixedSize() ||
- (bufWidth == front.requested_w &&
- bufHeight == front.requested_h))
- {
- // Here we pretend the transaction happened by updating the
- // current and drawing states. Drawing state is only accessed
- // in this thread, no need to have it locked
- Layer::State& editDraw(mDrawingState);
- editDraw.w = editDraw.requested_w;
- editDraw.h = editDraw.requested_h;
-
- // We also need to update the current state so that we don't
- // end-up doing too much work during the next transaction.
- // NOTE: We actually don't need hold the transaction lock here
- // because State::w and State::h are only accessed from
- // this thread
- Layer::State& editTemp(currentState());
- editTemp.w = editDraw.w;
- editTemp.h = editDraw.h;
-
- // recompute visible region
- recomputeVisibleRegions = true;
- }
-
- ALOGD_IF(DEBUG_RESIZE,
- "lockPageFlip : "
- " (layer=%p), buffer (%ux%u, tr=%02x), "
- "requested (%dx%d)",
- this,
- bufWidth, bufHeight, mCurrentTransform,
- front.requested_w, front.requested_h);
- }
- }
-}
-
-void Layer::unlockPageFlip(
- const Transform& planeTransform, Region& outDirtyRegion)
-{
- ATRACE_CALL();
-
- Region postedRegion(mPostedDirtyRegion);
- if (!postedRegion.isEmpty()) {
- mPostedDirtyRegion.clear();
- if (!visibleRegionScreen.isEmpty()) {
- // The dirty region is given in the layer's coordinate space
- // transform the dirty region by the surface's transformation
- // and the global transformation.
- const Layer::State& s(drawingState());
- const Transform tr(planeTransform * s.transform);
- postedRegion = tr.transform(postedRegion);
-
- // At this point, the dirty region is in screen space.
- // Make sure it's constrained by the visible region (which
- // is in screen space as well).
- postedRegion.andSelf(visibleRegionScreen);
- outDirtyRegion.orSelf(postedRegion);
- }
- }
-}
-
-void Layer::dump(String8& result, char* buffer, size_t SIZE) const
-{
- LayerBaseClient::dump(result, buffer, SIZE);
-
- sp<const GraphicBuffer> buf0(mActiveBuffer);
- uint32_t w0=0, h0=0, s0=0, f0=0;
- if (buf0 != 0) {
- w0 = buf0->getWidth();
- h0 = buf0->getHeight();
- s0 = buf0->getStride();
- f0 = buf0->format;
- }
- snprintf(buffer, SIZE,
- " "
- "format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
- " transform-hint=0x%02x, queued-frames=%d, mRefreshPending=%d\n",
- mFormat, w0, h0, s0,f0,
- getTransformHint(), mQueuedFrames, mRefreshPending);
-
- result.append(buffer);
-
- if (mSurfaceTexture != 0) {
- mSurfaceTexture->dump(result, " ", buffer, SIZE);
- }
-}
-
-void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const
-{
- LayerBaseClient::dumpStats(result, buffer, SIZE);
- const size_t o = mFrameLatencyOffset;
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const nsecs_t period = hw.getRefreshPeriod();
- result.appendFormat("%lld\n", period);
- for (size_t i=0 ; i<128 ; i++) {
- const size_t index = (o+i) % 128;
- const nsecs_t time_app = mFrameStats[index].timestamp;
- const nsecs_t time_set = mFrameStats[index].set;
- const nsecs_t time_vsync = mFrameStats[index].vsync;
- result.appendFormat("%lld\t%lld\t%lld\n",
- time_app,
- time_vsync,
- time_set);
- }
- result.append("\n");
-}
-
-void Layer::clearStats()
-{
- LayerBaseClient::clearStats();
- memset(mFrameStats, 0, sizeof(mFrameStats));
-}
-
-uint32_t Layer::getEffectiveUsage(uint32_t usage) const
-{
- // TODO: should we do something special if mSecure is set?
- if (mProtectedByApp) {
- // need a hardware-protected path to external video sink
- usage |= GraphicBuffer::USAGE_PROTECTED;
- }
- usage |= GraphicBuffer::USAGE_HW_COMPOSER;
- return usage;
-}
-
-uint32_t Layer::getTransformHint() const {
- uint32_t orientation = 0;
- if (!mFlinger->mDebugDisableTransformHint) {
- orientation = getPlaneOrientation();
- if (orientation & Transform::ROT_INVALID) {
- orientation = 0;
- }
- }
- return orientation;
-}
-
-// ---------------------------------------------------------------------------
-
-
-}; // namespace android
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
deleted file mode 100644
index 8d508c2..0000000
--- a/services/surfaceflinger/Layer.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_LAYER_H
-#define ANDROID_LAYER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <gui/SurfaceTexture.h>
-
-#include <utils/Timers.h>
-
-#include <ui/GraphicBuffer.h>
-#include <ui/PixelFormat.h>
-
-#include <gui/ISurfaceComposerClient.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include "LayerBase.h"
-#include "SurfaceTextureLayer.h"
-#include "Transform.h"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class Client;
-class GLExtensions;
-
-// ---------------------------------------------------------------------------
-
-class Layer : public LayerBaseClient
-{
-public:
- Layer(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client);
-
- virtual ~Layer();
-
- virtual const char* getTypeId() const { return "Layer"; }
-
- // the this layer's size and format
- status_t setBuffers(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t flags=0);
-
- bool isFixedSize() const;
-
- // LayerBase interface
- virtual void setGeometry(hwc_layer_t* hwcl);
- virtual void setPerFrameData(hwc_layer_t* hwcl);
- virtual void onDraw(const Region& clip) const;
- virtual uint32_t doTransaction(uint32_t transactionFlags);
- virtual void lockPageFlip(bool& recomputeVisibleRegions);
- virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
- virtual bool isOpaque() const;
- virtual bool needsDithering() const { return mNeedsDithering; }
- virtual bool isSecure() const { return mSecure; }
- virtual bool isProtected() const;
- virtual void onRemoved();
- virtual sp<Layer> getLayer() const { return const_cast<Layer*>(this); }
- virtual void setName(const String8& name);
-
- // LayerBaseClient interface
- virtual wp<IBinder> getSurfaceTextureBinder() const;
-
- virtual void onLayerDisplayed();
- virtual bool onPreComposition();
-
- // only for debugging
- inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; }
-
-protected:
- virtual void onFirstRef();
- virtual void dump(String8& result, char* scratch, size_t size) const;
- virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const;
- virtual void clearStats();
-
-private:
- friend class SurfaceTextureLayer;
- void onFrameQueued();
- virtual sp<ISurface> createSurface();
- uint32_t getEffectiveUsage(uint32_t usage) const;
- uint32_t getTransformHint() const;
- bool isCropped() const;
- static bool getOpacityForFormat(uint32_t format);
-
- // -----------------------------------------------------------------------
-
- // constants
- sp<SurfaceTextureLayer> mSurfaceTexture;
- GLuint mTextureName;
-
- // thread-safe
- volatile int32_t mQueuedFrames;
-
- // main thread
- sp<GraphicBuffer> mActiveBuffer;
- GLfloat mTextureMatrix[16];
- Rect mCurrentCrop;
- uint32_t mCurrentTransform;
- uint32_t mCurrentScalingMode;
- bool mCurrentOpacity;
- bool mRefreshPending;
- bool mFrameLatencyNeeded;
- int mFrameLatencyOffset;
-
- struct Statistics {
- Statistics() : timestamp(0), set(0), vsync(0) { }
- nsecs_t timestamp; // buffer timestamp
- nsecs_t set; // buffer displayed timestamp
- nsecs_t vsync; // vsync immediately before set
- };
-
- // protected by mLock
- Statistics mFrameStats[128];
-
- // constants
- PixelFormat mFormat;
- const GLExtensions& mGLExtensions;
- bool mOpaqueLayer;
- bool mNeedsDithering;
-
- // page-flip thread (currently main thread)
- bool mSecure; // no screenshots
- bool mProtectedByApp; // application requires protected path to external sink
- Region mPostedDirtyRegion;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_LAYER_H
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
deleted file mode 100644
index e764001..0000000
--- a/services/surfaceflinger/LayerBase.cpp
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <hardware/hardware.h>
-
-#include "clz.h"
-#include "LayerBase.h"
-#include "SurfaceFlinger.h"
-#include "DisplayHardware/DisplayHardware.h"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-int32_t LayerBase::sSequence = 1;
-
-LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display)
- : dpy(display), contentDirty(false),
- sequence(uint32_t(android_atomic_inc(&sSequence))),
- mFlinger(flinger), mFiltering(false),
- mNeedsFiltering(false), mInOverlay(false),
- mOrientation(0),
- mPlaneOrientation(0),
- mTransactionFlags(0),
- mPremultipliedAlpha(true), mName("unnamed"), mDebug(false)
-{
- const DisplayHardware& hw(flinger->graphicPlane(0).displayHardware());
- mFlags = hw.getFlags();
-}
-
-LayerBase::~LayerBase()
-{
-}
-
-void LayerBase::setName(const String8& name) {
- mName = name;
-}
-
-String8 LayerBase::getName() const {
- return mName;
-}
-
-const GraphicPlane& LayerBase::graphicPlane(int dpy) const
-{
- return mFlinger->graphicPlane(dpy);
-}
-
-GraphicPlane& LayerBase::graphicPlane(int dpy)
-{
- return mFlinger->graphicPlane(dpy);
-}
-
-void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags)
-{
- uint32_t layerFlags = 0;
- if (flags & ISurfaceComposer::eHidden)
- layerFlags = ISurfaceComposer::eLayerHidden;
-
- if (flags & ISurfaceComposer::eNonPremultiplied)
- mPremultipliedAlpha = false;
-
- mCurrentState.z = 0;
- mCurrentState.w = w;
- mCurrentState.h = h;
- mCurrentState.requested_w = w;
- mCurrentState.requested_h = h;
- mCurrentState.alpha = 0xFF;
- mCurrentState.flags = layerFlags;
- mCurrentState.sequence = 0;
- mCurrentState.transform.set(0, 0);
-
- // drawing state & current state are identical
- mDrawingState = mCurrentState;
-}
-
-void LayerBase::commitTransaction() {
- mDrawingState = mCurrentState;
-}
-void LayerBase::forceVisibilityTransaction() {
- // this can be called without SurfaceFlinger.mStateLock, but if we
- // can atomically increment the sequence number, it doesn't matter.
- android_atomic_inc(&mCurrentState.sequence);
- requestTransaction();
-}
-bool LayerBase::requestTransaction() {
- int32_t old = setTransactionFlags(eTransactionNeeded);
- return ((old & eTransactionNeeded) == 0);
-}
-uint32_t LayerBase::getTransactionFlags(uint32_t flags) {
- return android_atomic_and(~flags, &mTransactionFlags) & flags;
-}
-uint32_t LayerBase::setTransactionFlags(uint32_t flags) {
- return android_atomic_or(flags, &mTransactionFlags);
-}
-
-bool LayerBase::setPosition(float x, float y) {
- if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y)
- return false;
- mCurrentState.sequence++;
- mCurrentState.transform.set(x, y);
- requestTransaction();
- return true;
-}
-bool LayerBase::setLayer(uint32_t z) {
- if (mCurrentState.z == z)
- return false;
- mCurrentState.sequence++;
- mCurrentState.z = z;
- requestTransaction();
- return true;
-}
-bool LayerBase::setSize(uint32_t w, uint32_t h) {
- if (mCurrentState.requested_w == w && mCurrentState.requested_h == h)
- return false;
- mCurrentState.requested_w = w;
- mCurrentState.requested_h = h;
- requestTransaction();
- return true;
-}
-bool LayerBase::setAlpha(uint8_t alpha) {
- if (mCurrentState.alpha == alpha)
- return false;
- mCurrentState.sequence++;
- mCurrentState.alpha = alpha;
- requestTransaction();
- return true;
-}
-bool LayerBase::setMatrix(const layer_state_t::matrix22_t& matrix) {
- mCurrentState.sequence++;
- mCurrentState.transform.set(
- matrix.dsdx, matrix.dsdy, matrix.dtdx, matrix.dtdy);
- requestTransaction();
- return true;
-}
-bool LayerBase::setTransparentRegionHint(const Region& transparent) {
- mCurrentState.sequence++;
- mCurrentState.transparentRegion = transparent;
- requestTransaction();
- return true;
-}
-bool LayerBase::setFlags(uint8_t flags, uint8_t mask) {
- const uint32_t newFlags = (mCurrentState.flags & ~mask) | (flags & mask);
- if (mCurrentState.flags == newFlags)
- return false;
- mCurrentState.sequence++;
- mCurrentState.flags = newFlags;
- requestTransaction();
- return true;
-}
-
-Rect LayerBase::visibleBounds() const
-{
- return mTransformedBounds;
-}
-
-void LayerBase::setVisibleRegion(const Region& visibleRegion) {
- // always called from main thread
- visibleRegionScreen = visibleRegion;
-}
-
-void LayerBase::setCoveredRegion(const Region& coveredRegion) {
- // always called from main thread
- coveredRegionScreen = coveredRegion;
-}
-
-uint32_t LayerBase::doTransaction(uint32_t flags)
-{
- const Layer::State& front(drawingState());
- const Layer::State& temp(currentState());
-
- if ((front.requested_w != temp.requested_w) ||
- (front.requested_h != temp.requested_h)) {
- // resize the layer, set the physical size to the requested size
- Layer::State& editTemp(currentState());
- editTemp.w = temp.requested_w;
- editTemp.h = temp.requested_h;
- }
-
- if ((front.w != temp.w) || (front.h != temp.h)) {
- // invalidate and recompute the visible regions if needed
- flags |= Layer::eVisibleRegion;
- }
-
- if (temp.sequence != front.sequence) {
- // invalidate and recompute the visible regions if needed
- flags |= eVisibleRegion;
- this->contentDirty = true;
-
- // we may use linear filtering, if the matrix scales us
- const uint8_t type = temp.transform.getType();
- mNeedsFiltering = (!temp.transform.preserveRects() ||
- (type >= Transform::SCALE));
- }
-
- // Commit the transaction
- commitTransaction();
- return flags;
-}
-
-void LayerBase::validateVisibility(const Transform& planeTransform)
-{
- const Layer::State& s(drawingState());
- const Transform tr(planeTransform * s.transform);
- const bool transformed = tr.transformed();
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const uint32_t hw_h = hw.getHeight();
-
- uint32_t w = s.w;
- uint32_t h = s.h;
- tr.transform(mVertices[0], 0, 0);
- tr.transform(mVertices[1], 0, h);
- tr.transform(mVertices[2], w, h);
- tr.transform(mVertices[3], w, 0);
- for (size_t i=0 ; i<4 ; i++)
- mVertices[i][1] = hw_h - mVertices[i][1];
-
- if (CC_UNLIKELY(transformed)) {
- // NOTE: here we could also punt if we have too many rectangles
- // in the transparent region
- if (tr.preserveRects()) {
- // transform the transparent region
- transparentRegionScreen = tr.transform(s.transparentRegion);
- } else {
- // transformation too complex, can't do the transparent region
- // optimization.
- transparentRegionScreen.clear();
- }
- } else {
- transparentRegionScreen = s.transparentRegion;
- }
-
- // cache a few things...
- mOrientation = tr.getOrientation();
- mPlaneOrientation = planeTransform.getOrientation();
- mTransform = tr;
- mTransformedBounds = tr.makeBounds(w, h);
-}
-
-void LayerBase::lockPageFlip(bool& recomputeVisibleRegions) {
-}
-
-void LayerBase::unlockPageFlip(
- const Transform& planeTransform, Region& outDirtyRegion) {
-}
-
-void LayerBase::drawRegion(const Region& reg) const
-{
- Region::const_iterator it = reg.begin();
- Region::const_iterator const end = reg.end();
- if (it != end) {
- Rect r;
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const int32_t fbWidth = hw.getWidth();
- const int32_t fbHeight = hw.getHeight();
- const GLshort vertices[][2] = { { 0, 0 }, { fbWidth, 0 },
- { fbWidth, fbHeight }, { 0, fbHeight } };
- glVertexPointer(2, GL_SHORT, 0, vertices);
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- }
-}
-
-void LayerBase::setGeometry(hwc_layer_t* hwcl)
-{
- hwcl->compositionType = HWC_FRAMEBUFFER;
- hwcl->hints = 0;
- hwcl->flags = HWC_SKIP_LAYER;
- hwcl->transform = 0;
- hwcl->blending = HWC_BLENDING_NONE;
-
- // this gives us only the "orientation" component of the transform
- const State& s(drawingState());
- const uint32_t finalTransform = s.transform.getOrientation();
- // we can only handle simple transformation
- if (finalTransform & Transform::ROT_INVALID) {
- hwcl->flags = HWC_SKIP_LAYER;
- } else {
- hwcl->transform = finalTransform;
- }
-
- if (!isOpaque()) {
- hwcl->blending = mPremultipliedAlpha ?
- HWC_BLENDING_PREMULT : HWC_BLENDING_COVERAGE;
- }
-
- // scaling is already applied in mTransformedBounds
- hwcl->displayFrame.left = mTransformedBounds.left;
- hwcl->displayFrame.top = mTransformedBounds.top;
- hwcl->displayFrame.right = mTransformedBounds.right;
- hwcl->displayFrame.bottom = mTransformedBounds.bottom;
- hwcl->visibleRegionScreen.rects =
- reinterpret_cast<hwc_rect_t const *>(
- visibleRegionScreen.getArray(
- &hwcl->visibleRegionScreen.numRects));
-
- hwcl->sourceCrop.left = 0;
- hwcl->sourceCrop.top = 0;
- hwcl->sourceCrop.right = mTransformedBounds.width();
- hwcl->sourceCrop.bottom = mTransformedBounds.height();
-}
-
-void LayerBase::setPerFrameData(hwc_layer_t* hwcl) {
- hwcl->compositionType = HWC_FRAMEBUFFER;
- hwcl->handle = NULL;
-}
-
-void LayerBase::setOverlay(bool inOverlay) {
- mInOverlay = inOverlay;
-}
-
-bool LayerBase::isOverlay() const {
- return mInOverlay;
-}
-
-void LayerBase::setFiltering(bool filtering)
-{
- mFiltering = filtering;
-}
-
-bool LayerBase::getFiltering() const
-{
- return mFiltering;
-}
-
-void LayerBase::draw(const Region& clip) const
-{
- // reset GL state
- glEnable(GL_SCISSOR_TEST);
-
- onDraw(clip);
-}
-
-void LayerBase::drawForSreenShot()
-{
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- setFiltering(true);
- onDraw( Region(hw.bounds()) );
- setFiltering(false);
-}
-
-void LayerBase::clearWithOpenGL(const Region& clip, GLclampf red,
- GLclampf green, GLclampf blue,
- GLclampf alpha) const
-{
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const uint32_t fbHeight = hw.getHeight();
- glColor4f(red,green,blue,alpha);
-
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
-
- Region::const_iterator it = clip.begin();
- Region::const_iterator const end = clip.end();
- glEnable(GL_SCISSOR_TEST);
- glVertexPointer(2, GL_FLOAT, 0, mVertices);
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
-}
-
-void LayerBase::clearWithOpenGL(const Region& clip) const
-{
- clearWithOpenGL(clip,0,0,0,0);
-}
-
-void LayerBase::drawWithOpenGL(const Region& clip) const
-{
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const uint32_t fbHeight = hw.getHeight();
- const State& s(drawingState());
-
- GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA;
- if (CC_UNLIKELY(s.alpha < 0xFF)) {
- const GLfloat alpha = s.alpha * (1.0f/255.0f);
- if (mPremultipliedAlpha) {
- glColor4f(alpha, alpha, alpha, alpha);
- } else {
- glColor4f(1, 1, 1, alpha);
- }
- glEnable(GL_BLEND);
- glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- } else {
- glColor4f(1, 1, 1, 1);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- if (!isOpaque()) {
- glEnable(GL_BLEND);
- glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA);
- } else {
- glDisable(GL_BLEND);
- }
- }
-
- struct TexCoords {
- GLfloat u;
- GLfloat v;
- };
-
- TexCoords texCoords[4];
- texCoords[0].u = 0;
- texCoords[0].v = 1;
- texCoords[1].u = 0;
- texCoords[1].v = 0;
- texCoords[2].u = 1;
- texCoords[2].v = 0;
- texCoords[3].u = 1;
- texCoords[3].v = 1;
-
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, mVertices);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
-
- Region::const_iterator it = clip.begin();
- Region::const_iterator const end = clip.end();
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisable(GL_BLEND);
-}
-
-void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const
-{
- const Layer::State& s(drawingState());
-
- snprintf(buffer, SIZE,
- "+ %s %p (%s)\n",
- getTypeId(), this, getName().string());
- result.append(buffer);
-
- s.transparentRegion.dump(result, "transparentRegion");
- transparentRegionScreen.dump(result, "transparentRegionScreen");
- visibleRegionScreen.dump(result, "visibleRegionScreen");
-
- snprintf(buffer, SIZE,
- " "
- "z=%9d, pos=(%g,%g), size=(%4d,%4d), "
- "isOpaque=%1d, needsDithering=%1d, invalidate=%1d, "
- "alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n",
- s.z, s.transform.tx(), s.transform.ty(), s.w, s.h,
- isOpaque(), needsDithering(), contentDirty,
- s.alpha, s.flags,
- s.transform[0][0], s.transform[0][1],
- s.transform[1][0], s.transform[1][1]);
- result.append(buffer);
-}
-
-void LayerBase::shortDump(String8& result, char* scratch, size_t size) const {
- LayerBase::dump(result, scratch, size);
-}
-
-void LayerBase::dumpStats(String8& result, char* scratch, size_t SIZE) const {
-}
-
-void LayerBase::clearStats() {
-}
-
-// ---------------------------------------------------------------------------
-
-int32_t LayerBaseClient::sIdentity = 1;
-
-LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client)
- : LayerBase(flinger, display),
- mHasSurface(false),
- mClientRef(client),
- mIdentity(uint32_t(android_atomic_inc(&sIdentity)))
-{
-}
-
-LayerBaseClient::~LayerBaseClient()
-{
- sp<Client> c(mClientRef.promote());
- if (c != 0) {
- c->detachLayer(this);
- }
-}
-
-sp<ISurface> LayerBaseClient::createSurface()
-{
- class BSurface : public BnSurface, public LayerCleaner {
- virtual sp<ISurfaceTexture> getSurfaceTexture() const { return 0; }
- public:
- BSurface(const sp<SurfaceFlinger>& flinger,
- const sp<LayerBaseClient>& layer)
- : LayerCleaner(flinger, layer) { }
- };
- sp<ISurface> sur(new BSurface(mFlinger, this));
- return sur;
-}
-
-sp<ISurface> LayerBaseClient::getSurface()
-{
- sp<ISurface> s;
- Mutex::Autolock _l(mLock);
-
- LOG_ALWAYS_FATAL_IF(mHasSurface,
- "LayerBaseClient::getSurface() has already been called");
-
- mHasSurface = true;
- s = createSurface();
- mClientSurfaceBinder = s->asBinder();
- return s;
-}
-
-wp<IBinder> LayerBaseClient::getSurfaceBinder() const {
- return mClientSurfaceBinder;
-}
-
-wp<IBinder> LayerBaseClient::getSurfaceTextureBinder() const {
- return 0;
-}
-
-void LayerBaseClient::dump(String8& result, char* buffer, size_t SIZE) const
-{
- LayerBase::dump(result, buffer, SIZE);
-
- sp<Client> client(mClientRef.promote());
- snprintf(buffer, SIZE,
- " client=%p, identity=%u\n",
- client.get(), getIdentity());
-
- result.append(buffer);
-}
-
-
-void LayerBaseClient::shortDump(String8& result, char* scratch, size_t size) const
-{
- LayerBaseClient::dump(result, scratch, size);
-}
-
-// ---------------------------------------------------------------------------
-
-LayerBaseClient::LayerCleaner::LayerCleaner(const sp<SurfaceFlinger>& flinger,
- const sp<LayerBaseClient>& layer)
- : mFlinger(flinger), mLayer(layer) {
-}
-
-LayerBaseClient::LayerCleaner::~LayerCleaner() {
- // destroy client resources
- mFlinger->destroySurface(mLayer);
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
deleted file mode 100644
index cd6efdd..0000000
--- a/services/surfaceflinger/LayerBase.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_LAYER_BASE_H
-#define ANDROID_LAYER_BASE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-
-#include <utils/RefBase.h>
-
-#include <ui/Region.h>
-
-#include <gui/ISurfaceComposerClient.h>
-
-#include <private/gui/LayerState.h>
-
-#include <hardware/hwcomposer.h>
-
-#include "DisplayHardware/DisplayHardware.h"
-#include "Transform.h"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class Client;
-class DisplayHardware;
-class GraphicBuffer;
-class GraphicPlane;
-class Layer;
-class LayerBaseClient;
-class SurfaceFlinger;
-
-// ---------------------------------------------------------------------------
-
-class LayerBase : public RefBase
-{
- static int32_t sSequence;
-
-public:
- LayerBase(SurfaceFlinger* flinger, DisplayID display);
-
- DisplayID dpy;
- mutable bool contentDirty;
- Region visibleRegionScreen;
- Region transparentRegionScreen;
- Region coveredRegionScreen;
- int32_t sequence;
-
- struct State {
- uint32_t w;
- uint32_t h;
- uint32_t requested_w;
- uint32_t requested_h;
- uint32_t z;
- uint8_t alpha;
- uint8_t flags;
- uint8_t reserved[2];
- int32_t sequence; // changes when visible regions can change
- uint32_t tint;
- Transform transform;
- Region transparentRegion;
- };
-
- virtual void setName(const String8& name);
- String8 getName() const;
-
- // modify current state
- bool setPosition(float x, float y);
- bool setLayer(uint32_t z);
- bool setSize(uint32_t w, uint32_t h);
- bool setAlpha(uint8_t alpha);
- bool setMatrix(const layer_state_t::matrix22_t& matrix);
- bool setTransparentRegionHint(const Region& opaque);
- bool setFlags(uint8_t flags, uint8_t mask);
-
- void commitTransaction();
- bool requestTransaction();
- void forceVisibilityTransaction();
-
- uint32_t getTransactionFlags(uint32_t flags);
- uint32_t setTransactionFlags(uint32_t flags);
-
- Rect visibleBounds() const;
- void drawRegion(const Region& reg) const;
-
- virtual sp<LayerBaseClient> getLayerBaseClient() const { return 0; }
- virtual sp<Layer> getLayer() const { return 0; }
-
- virtual const char* getTypeId() const { return "LayerBase"; }
-
- virtual void setGeometry(hwc_layer_t* hwcl);
- virtual void setPerFrameData(hwc_layer_t* hwcl);
- void setOverlay(bool inOverlay);
- bool isOverlay() const;
-
-
- /**
- * draw - performs some global clipping optimizations
- * and calls onDraw().
- * Typically this method is not overridden, instead implement onDraw()
- * to perform the actual drawing.
- */
- virtual void draw(const Region& clip) const;
- virtual void drawForSreenShot();
-
- /**
- * onDraw - draws the surface.
- */
- virtual void onDraw(const Region& clip) const = 0;
-
- /**
- * initStates - called just after construction
- */
- virtual void initStates(uint32_t w, uint32_t h, uint32_t flags);
-
- /**
- * doTransaction - process the transaction. This is a good place to figure
- * out which attributes of the surface have changed.
- */
- virtual uint32_t doTransaction(uint32_t transactionFlags);
-
- /**
- * setVisibleRegion - called to set the new visible region. This gives
- * a chance to update the new visible region or record the fact it changed.
- */
- virtual void setVisibleRegion(const Region& visibleRegion);
-
- /**
- * setCoveredRegion - called when the covered region changes. The covered
- * region corresponds to any area of the surface that is covered
- * (transparently or not) by another surface.
- */
- virtual void setCoveredRegion(const Region& coveredRegion);
-
- /**
- * validateVisibility - cache a bunch of things
- */
- virtual void validateVisibility(const Transform& globalTransform);
-
- /**
- * lockPageFlip - called each time the screen is redrawn and returns whether
- * the visible regions need to be recomputed (this is a fairly heavy
- * operation, so this should be set only if needed). Typically this is used
- * to figure out if the content or size of a surface has changed.
- */
- virtual void lockPageFlip(bool& recomputeVisibleRegions);
-
- /**
- * unlockPageFlip - called each time the screen is redrawn. updates the
- * final dirty region wrt the planeTransform.
- * At this point, all visible regions, surface position and size, etc... are
- * correct.
- */
- virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
-
- /**
- * isOpaque - true if this surface is opaque
- */
- virtual bool isOpaque() const { return true; }
-
- /**
- * needsDithering - true if this surface needs dithering
- */
- virtual bool needsDithering() const { return false; }
-
- /**
- * needsLinearFiltering - true if this surface's state requires filtering
- */
- virtual bool needsFiltering() const { return mNeedsFiltering; }
-
- /**
- * isSecure - true if this surface is secure, that is if it prevents
- * screenshots or VNC servers.
- */
- virtual bool isSecure() const { return false; }
-
- /**
- * isProtected - true if the layer may contain protected content in the
- * GRALLOC_USAGE_PROTECTED sense.
- */
- virtual bool isProtected() const { return false; }
-
- /** called with the state lock when the surface is removed from the
- * current list */
- virtual void onRemoved() { }
-
- /** called after page-flip
- */
- virtual void onLayerDisplayed() { }
-
- /** called before composition.
- * returns true if the layer has pending updates.
- */
- virtual bool onPreComposition() { return false; }
-
- /** always call base class first */
- virtual void dump(String8& result, char* scratch, size_t size) const;
- virtual void shortDump(String8& result, char* scratch, size_t size) const;
- virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const;
- virtual void clearStats();
-
-
- enum { // flags for doTransaction()
- eVisibleRegion = 0x00000002,
- };
-
-
- inline const State& drawingState() const { return mDrawingState; }
- inline const State& currentState() const { return mCurrentState; }
- inline State& currentState() { return mCurrentState; }
-
- int32_t getOrientation() const { return mOrientation; }
- int32_t getPlaneOrientation() const { return mPlaneOrientation; }
-
-protected:
- const GraphicPlane& graphicPlane(int dpy) const;
- GraphicPlane& graphicPlane(int dpy);
-
- void clearWithOpenGL(const Region& clip, GLclampf r, GLclampf g,
- GLclampf b, GLclampf alpha) const;
- void clearWithOpenGL(const Region& clip) const;
- void drawWithOpenGL(const Region& clip) const;
-
- void setFiltering(bool filtering);
- bool getFiltering() const;
-
- sp<SurfaceFlinger> mFlinger;
- uint32_t mFlags;
-
-private:
- // accessed only in the main thread
- // Whether filtering is forced on or not
- bool mFiltering;
-
- // cached during validateVisibility()
- // Whether filtering is needed b/c of the drawingstate
- bool mNeedsFiltering;
-
- // this layer is currently handled by the hwc. this is
- // updated at composition time, always frmo the composition
- // thread.
- bool mInOverlay;
-
-protected:
- // cached during validateVisibility()
- int32_t mOrientation;
- int32_t mPlaneOrientation;
- Transform mTransform;
- GLfloat mVertices[4][2];
- Rect mTransformedBounds;
-
- // these are protected by an external lock
- State mCurrentState;
- State mDrawingState;
- volatile int32_t mTransactionFlags;
-
- // don't change, don't need a lock
- bool mPremultipliedAlpha;
- String8 mName;
- mutable bool mDebug;
-
-
-public:
- // called from class SurfaceFlinger
- virtual ~LayerBase();
-
-private:
- LayerBase(const LayerBase& rhs);
-};
-
-
-// ---------------------------------------------------------------------------
-
-class LayerBaseClient : public LayerBase
-{
-public:
- LayerBaseClient(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client);
-
- virtual ~LayerBaseClient();
-
- sp<ISurface> getSurface();
- wp<IBinder> getSurfaceBinder() const;
- virtual wp<IBinder> getSurfaceTextureBinder() const;
-
- virtual sp<LayerBaseClient> getLayerBaseClient() const {
- return const_cast<LayerBaseClient*>(this); }
-
- virtual const char* getTypeId() const { return "LayerBaseClient"; }
-
- uint32_t getIdentity() const { return mIdentity; }
-
-protected:
- virtual void dump(String8& result, char* scratch, size_t size) const;
- virtual void shortDump(String8& result, char* scratch, size_t size) const;
-
- class LayerCleaner {
- sp<SurfaceFlinger> mFlinger;
- wp<LayerBaseClient> mLayer;
- protected:
- ~LayerCleaner();
- public:
- LayerCleaner(const sp<SurfaceFlinger>& flinger,
- const sp<LayerBaseClient>& layer);
- };
-
-private:
- virtual sp<ISurface> createSurface();
-
- mutable Mutex mLock;
- mutable bool mHasSurface;
- wp<IBinder> mClientSurfaceBinder;
- const wp<Client> mClientRef;
- // only read
- const uint32_t mIdentity;
- static int32_t sIdentity;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_LAYER_BASE_H
diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp
deleted file mode 100644
index e665d7a..0000000
--- a/services/surfaceflinger/LayerDim.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include "LayerDim.h"
-#include "SurfaceFlinger.h"
-#include "DisplayHardware/DisplayHardware.h"
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-LayerDim::LayerDim(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client)
- : LayerBaseClient(flinger, display, client)
-{
-}
-
-LayerDim::~LayerDim()
-{
-}
-
-void LayerDim::onDraw(const Region& clip) const
-{
- const State& s(drawingState());
- Region::const_iterator it = clip.begin();
- Region::const_iterator const end = clip.end();
- if (s.alpha>0 && (it != end)) {
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const GLfloat alpha = s.alpha/255.0f;
- const uint32_t fbHeight = hw.getHeight();
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glDisable(GL_TEXTURE_2D);
-
- if (s.alpha == 0xFF) {
- glDisable(GL_BLEND);
- } else {
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- }
-
- glColor4f(0, 0, 0, alpha);
-
- glVertexPointer(2, GL_FLOAT, 0, mVertices);
-
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- glDisable(GL_BLEND);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- }
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/LayerDim.h b/services/surfaceflinger/LayerDim.h
deleted file mode 100644
index 8770e6d..0000000
--- a/services/surfaceflinger/LayerDim.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_LAYER_DIM_H
-#define ANDROID_LAYER_DIM_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "LayerBase.h"
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class LayerDim : public LayerBaseClient
-{
-public:
- LayerDim(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client);
- virtual ~LayerDim();
-
- virtual void onDraw(const Region& clip) const;
- virtual bool isOpaque() const { return false; }
- virtual bool isSecure() const { return false; }
- virtual bool isProtectedByApp() const { return false; }
- virtual bool isProtectedByDRM() const { return false; }
- virtual const char* getTypeId() const { return "LayerDim"; }
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_LAYER_DIM_H
diff --git a/services/surfaceflinger/LayerScreenshot.cpp b/services/surfaceflinger/LayerScreenshot.cpp
deleted file mode 100644
index c7cf46e..0000000
--- a/services/surfaceflinger/LayerScreenshot.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include "LayerScreenshot.h"
-#include "SurfaceFlinger.h"
-#include "DisplayHardware/DisplayHardware.h"
-
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-LayerScreenshot::LayerScreenshot(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client)
- : LayerBaseClient(flinger, display, client),
- mTextureName(0), mFlinger(flinger)
-{
-}
-
-LayerScreenshot::~LayerScreenshot()
-{
- if (mTextureName) {
- mFlinger->postMessageAsync(
- new SurfaceFlinger::MessageDestroyGLTexture(mTextureName) );
- }
-}
-
-status_t LayerScreenshot::captureLocked() {
- GLfloat u, v;
- status_t result = mFlinger->renderScreenToTextureLocked(0, &mTextureName, &u, &v);
- if (result != NO_ERROR) {
- return result;
- }
- initTexture(u, v);
- return NO_ERROR;
-}
-
-status_t LayerScreenshot::capture() {
- GLfloat u, v;
- status_t result = mFlinger->renderScreenToTexture(0, &mTextureName, &u, &v);
- if (result != NO_ERROR) {
- return result;
- }
- initTexture(u, v);
- return NO_ERROR;
-}
-
-void LayerScreenshot::initTexture(GLfloat u, GLfloat v) {
- glBindTexture(GL_TEXTURE_2D, mTextureName);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- mTexCoords[0] = 0; mTexCoords[1] = v;
- mTexCoords[2] = 0; mTexCoords[3] = 0;
- mTexCoords[4] = u; mTexCoords[5] = 0;
- mTexCoords[6] = u; mTexCoords[7] = v;
-}
-
-void LayerScreenshot::initStates(uint32_t w, uint32_t h, uint32_t flags) {
- LayerBaseClient::initStates(w, h, flags);
- if (!(flags & ISurfaceComposer::eHidden)) {
- capture();
- }
-}
-
-uint32_t LayerScreenshot::doTransaction(uint32_t flags)
-{
- const Layer::State& draw(drawingState());
- const Layer::State& curr(currentState());
-
- if (draw.flags & ISurfaceComposer::eLayerHidden) {
- if (!(curr.flags & ISurfaceComposer::eLayerHidden)) {
- // we're going from hidden to visible
- status_t err = captureLocked();
- if (err != NO_ERROR) {
- ALOGW("createScreenshotSurface failed (%s)", strerror(-err));
- }
- }
- } else if (curr.flags & ISurfaceComposer::eLayerHidden) {
- // we're going from visible to hidden
- if (mTextureName) {
- glDeleteTextures(1, &mTextureName);
- mTextureName = 0;
- }
- }
- return LayerBaseClient::doTransaction(flags);
-}
-
-void LayerScreenshot::onDraw(const Region& clip) const
-{
- const State& s(drawingState());
- Region::const_iterator it = clip.begin();
- Region::const_iterator const end = clip.end();
- if (s.alpha>0 && (it != end)) {
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const GLfloat alpha = s.alpha/255.0f;
- const uint32_t fbHeight = hw.getHeight();
-
- if (s.alpha == 0xFF) {
- glDisable(GL_BLEND);
- } else {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
-
- glColor4f(0, 0, 0, alpha);
-
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glEnable(GL_TEXTURE_2D);
-
- glBindTexture(GL_TEXTURE_2D, mTextureName);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, mTexCoords);
- glVertexPointer(2, GL_FLOAT, 0, mVertices);
-
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
-
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- }
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/LayerScreenshot.h b/services/surfaceflinger/LayerScreenshot.h
deleted file mode 100644
index ab90047..0000000
--- a/services/surfaceflinger/LayerScreenshot.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_LAYER_SCREENSHOT_H
-#define ANDROID_LAYER_SCREENSHOT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "LayerBase.h"
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class LayerScreenshot : public LayerBaseClient
-{
- GLuint mTextureName;
- GLfloat mTexCoords[8];
- sp<SurfaceFlinger> mFlinger;
-public:
- LayerScreenshot(SurfaceFlinger* flinger, DisplayID display,
- const sp<Client>& client);
- virtual ~LayerScreenshot();
-
- status_t capture();
-
- virtual void initStates(uint32_t w, uint32_t h, uint32_t flags);
- virtual uint32_t doTransaction(uint32_t flags);
- virtual void onDraw(const Region& clip) const;
- virtual bool isOpaque() const { return false; }
- virtual bool isSecure() const { return false; }
- virtual bool isProtectedByApp() const { return false; }
- virtual bool isProtectedByDRM() const { return false; }
- virtual const char* getTypeId() const { return "LayerScreenshot"; }
-
-private:
- status_t captureLocked();
- void initTexture(GLfloat u, GLfloat v);
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_LAYER_SCREENSHOT_H
diff --git a/services/surfaceflinger/MODULE_LICENSE_APACHE2 b/services/surfaceflinger/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/services/surfaceflinger/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
deleted file mode 100644
index 290fff4..0000000
--- a/services/surfaceflinger/MessageQueue.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#include <binder/IPCThreadState.h>
-
-#include <utils/threads.h>
-#include <utils/Timers.h>
-#include <utils/Log.h>
-
-#include <gui/IDisplayEventConnection.h>
-#include <gui/BitTube.h>
-
-#include "MessageQueue.h"
-#include "EventThread.h"
-#include "SurfaceFlinger.h"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-MessageBase::MessageBase()
- : MessageHandler() {
-}
-
-MessageBase::~MessageBase() {
-}
-
-void MessageBase::handleMessage(const Message&) {
- this->handler();
- barrier.open();
-};
-
-// ---------------------------------------------------------------------------
-
-void MessageQueue::Handler::signalRefresh() {
- if ((android_atomic_or(eventMaskRefresh, &mEventMask) & eventMaskRefresh) == 0) {
- mQueue.mLooper->sendMessage(this, Message(MessageQueue::REFRESH));
- }
-}
-
-void MessageQueue::Handler::signalInvalidate() {
- if ((android_atomic_or(eventMaskInvalidate, &mEventMask) & eventMaskInvalidate) == 0) {
- mQueue.mLooper->sendMessage(this, Message(MessageQueue::INVALIDATE));
- }
-}
-
-void MessageQueue::Handler::handleMessage(const Message& message) {
- switch (message.what) {
- case INVALIDATE:
- android_atomic_and(~eventMaskInvalidate, &mEventMask);
- mQueue.mFlinger->onMessageReceived(message.what);
- break;
- case REFRESH:
- android_atomic_and(~eventMaskRefresh, &mEventMask);
- mQueue.mFlinger->onMessageReceived(message.what);
- break;
- }
-}
-
-// ---------------------------------------------------------------------------
-
-MessageQueue::MessageQueue()
-{
-}
-
-MessageQueue::~MessageQueue() {
-}
-
-void MessageQueue::init(const sp<SurfaceFlinger>& flinger)
-{
- mFlinger = flinger;
- mLooper = new Looper(true);
- mHandler = new Handler(*this);
-}
-
-void MessageQueue::setEventThread(const sp<EventThread>& eventThread)
-{
- mEventThread = eventThread;
- mEvents = eventThread->createEventConnection();
- mEventTube = mEvents->getDataChannel();
- mLooper->addFd(mEventTube->getFd(), 0, ALOOPER_EVENT_INPUT,
- MessageQueue::cb_eventReceiver, this);
-}
-
-void MessageQueue::waitMessage() {
- do {
- IPCThreadState::self()->flushCommands();
- int32_t ret = mLooper->pollOnce(-1);
- switch (ret) {
- case ALOOPER_POLL_WAKE:
- case ALOOPER_POLL_CALLBACK:
- continue;
- case ALOOPER_POLL_ERROR:
- ALOGE("ALOOPER_POLL_ERROR");
- case ALOOPER_POLL_TIMEOUT:
- // timeout (should not happen)
- continue;
- default:
- // should not happen
- ALOGE("Looper::pollOnce() returned unknown status %d", ret);
- continue;
- }
- } while (true);
-}
-
-status_t MessageQueue::postMessage(
- const sp<MessageBase>& messageHandler, nsecs_t relTime)
-{
- const Message dummyMessage;
- if (relTime > 0) {
- mLooper->sendMessageDelayed(relTime, messageHandler, dummyMessage);
- } else {
- mLooper->sendMessage(messageHandler, dummyMessage);
- }
- return NO_ERROR;
-}
-
-void MessageQueue::invalidate() {
-// mHandler->signalInvalidate();
- mEvents->requestNextVsync();
-}
-
-void MessageQueue::refresh() {
- mEvents->requestNextVsync();
-}
-
-int MessageQueue::cb_eventReceiver(int fd, int events, void* data) {
- MessageQueue* queue = reinterpret_cast<MessageQueue *>(data);
- return queue->eventReceiver(fd, events);
-}
-
-int MessageQueue::eventReceiver(int fd, int events) {
- ssize_t n;
- DisplayEventReceiver::Event buffer[8];
- while ((n = DisplayEventReceiver::getEvents(mEventTube, buffer, 8)) > 0) {
- for (int i=0 ; i<n ; i++) {
- if (buffer[i].header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) {
- mHandler->signalRefresh();
- break;
- }
- }
- }
- return 1;
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h
deleted file mode 100644
index ea29e7e..0000000
--- a/services/surfaceflinger/MessageQueue.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_MESSAGE_QUEUE_H
-#define ANDROID_MESSAGE_QUEUE_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#include <utils/threads.h>
-#include <utils/Timers.h>
-#include <utils/Looper.h>
-
-#include <gui/DisplayEventReceiver.h>
-
-#include "Barrier.h"
-
-namespace android {
-
-class IDisplayEventConnection;
-class EventThread;
-class SurfaceFlinger;
-
-// ---------------------------------------------------------------------------
-
-class MessageBase : public MessageHandler
-{
-public:
- MessageBase();
-
- // return true if message has a handler
- virtual bool handler() = 0;
-
- // waits for the handler to be processed
- void wait() const { barrier.wait(); }
-
-protected:
- virtual ~MessageBase();
-
-private:
- virtual void handleMessage(const Message& message);
-
- mutable Barrier barrier;
-};
-
-// ---------------------------------------------------------------------------
-
-class MessageQueue {
- class Handler : public MessageHandler {
- enum {
- eventMaskInvalidate = 0x1,
- eventMaskRefresh = 0x2
- };
- MessageQueue& mQueue;
- int32_t mEventMask;
- public:
- Handler(MessageQueue& queue) : mQueue(queue), mEventMask(0) { }
- virtual void handleMessage(const Message& message);
- void signalRefresh();
- void signalInvalidate();
- };
-
- friend class Handler;
-
- sp<SurfaceFlinger> mFlinger;
- sp<Looper> mLooper;
- sp<EventThread> mEventThread;
- sp<IDisplayEventConnection> mEvents;
- sp<BitTube> mEventTube;
- sp<Handler> mHandler;
-
-
- static int cb_eventReceiver(int fd, int events, void* data);
- int eventReceiver(int fd, int events);
-
-public:
- enum {
- INVALIDATE = 0,
- REFRESH = 1,
- };
-
- MessageQueue();
- ~MessageQueue();
- void init(const sp<SurfaceFlinger>& flinger);
- void setEventThread(const sp<EventThread>& events);
-
- void waitMessage();
- status_t postMessage(const sp<MessageBase>& message, nsecs_t reltime=0);
- void invalidate();
- void refresh();
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif /* ANDROID_MESSAGE_QUEUE_H */
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
deleted file mode 100644
index 7f61fe4..0000000
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ /dev/null
@@ -1,2812 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-#include <binder/MemoryHeapBase.h>
-#include <binder/PermissionCache.h>
-
-#include <gui/IDisplayEventConnection.h>
-
-#include <utils/String8.h>
-#include <utils/String16.h>
-#include <utils/StopWatch.h>
-#include <utils/Trace.h>
-
-#include <ui/GraphicBufferAllocator.h>
-#include <ui/PixelFormat.h>
-
-#include <GLES/gl.h>
-
-#include "clz.h"
-#include "DdmConnection.h"
-#include "DisplayEventConnection.h"
-#include "EventThread.h"
-#include "GLExtensions.h"
-#include "Layer.h"
-#include "LayerDim.h"
-#include "LayerScreenshot.h"
-#include "SurfaceFlinger.h"
-
-#include "DisplayHardware/DisplayHardware.h"
-#include "DisplayHardware/HWComposer.h"
-
-#include <private/android_filesystem_config.h>
-#include <private/gui/SharedBufferStack.h>
-
-#define EGL_VERSION_HW_ANDROID 0x3143
-
-#define DISPLAY_COUNT 1
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-const String16 sHardwareTest("android.permission.HARDWARE_TEST");
-const String16 sAccessSurfaceFlinger("android.permission.ACCESS_SURFACE_FLINGER");
-const String16 sReadFramebuffer("android.permission.READ_FRAME_BUFFER");
-const String16 sDump("android.permission.DUMP");
-
-// ---------------------------------------------------------------------------
-
-SurfaceFlinger::SurfaceFlinger()
- : BnSurfaceComposer(), Thread(false),
- mTransactionFlags(0),
- mTransationPending(false),
- mLayersRemoved(false),
- mBootTime(systemTime()),
- mVisibleRegionsDirty(false),
- mHwWorkListDirty(false),
- mElectronBeamAnimationMode(0),
- mDebugRegion(0),
- mDebugBackground(0),
- mDebugDDMS(0),
- mDebugDisableHWC(0),
- mDebugDisableTransformHint(0),
- mDebugInSwapBuffers(0),
- mLastSwapBufferTime(0),
- mDebugInTransaction(0),
- mLastTransactionTime(0),
- mBootFinished(false),
- mConsoleSignals(0),
- mSecureFrameBuffer(0)
-{
- init();
-}
-
-void SurfaceFlinger::init()
-{
- ALOGI("SurfaceFlinger is starting");
-
- // debugging stuff...
- char value[PROPERTY_VALUE_MAX];
-
- property_get("debug.sf.showupdates", value, "0");
- mDebugRegion = atoi(value);
-
- property_get("debug.sf.showbackground", value, "0");
- mDebugBackground = atoi(value);
-
- property_get("debug.sf.ddms", value, "0");
- mDebugDDMS = atoi(value);
- if (mDebugDDMS) {
- DdmConnection::start(getServiceName());
- }
-
- ALOGI_IF(mDebugRegion, "showupdates enabled");
- ALOGI_IF(mDebugBackground, "showbackground enabled");
- ALOGI_IF(mDebugDDMS, "DDMS debugging enabled");
-}
-
-void SurfaceFlinger::onFirstRef()
-{
- mEventQueue.init(this);
-
- run("SurfaceFlinger", PRIORITY_URGENT_DISPLAY);
-
- // Wait for the main thread to be done with its initialization
- mReadyToRunBarrier.wait();
-}
-
-
-SurfaceFlinger::~SurfaceFlinger()
-{
- glDeleteTextures(1, &mWormholeTexName);
-}
-
-void SurfaceFlinger::binderDied(const wp<IBinder>& who)
-{
- // the window manager died on us. prepare its eulogy.
-
- // reset screen orientation
- Vector<ComposerState> state;
- setTransactionState(state, eOrientationDefault, 0);
-
- // restart the boot-animation
- property_set("ctl.start", "bootanim");
-}
-
-sp<IMemoryHeap> SurfaceFlinger::getCblk() const
-{
- return mServerHeap;
-}
-
-sp<ISurfaceComposerClient> SurfaceFlinger::createConnection()
-{
- sp<ISurfaceComposerClient> bclient;
- sp<Client> client(new Client(this));
- status_t err = client->initCheck();
- if (err == NO_ERROR) {
- bclient = client;
- }
- return bclient;
-}
-
-sp<IGraphicBufferAlloc> SurfaceFlinger::createGraphicBufferAlloc()
-{
- sp<GraphicBufferAlloc> gba(new GraphicBufferAlloc());
- return gba;
-}
-
-const GraphicPlane& SurfaceFlinger::graphicPlane(int dpy) const
-{
- ALOGE_IF(uint32_t(dpy) >= DISPLAY_COUNT, "Invalid DisplayID %d", dpy);
- const GraphicPlane& plane(mGraphicPlanes[dpy]);
- return plane;
-}
-
-GraphicPlane& SurfaceFlinger::graphicPlane(int dpy)
-{
- return const_cast<GraphicPlane&>(
- const_cast<SurfaceFlinger const *>(this)->graphicPlane(dpy));
-}
-
-void SurfaceFlinger::bootFinished()
-{
- const nsecs_t now = systemTime();
- const nsecs_t duration = now - mBootTime;
- ALOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) );
- mBootFinished = true;
-
- // wait patiently for the window manager death
- const String16 name("window");
- sp<IBinder> window(defaultServiceManager()->getService(name));
- if (window != 0) {
- window->linkToDeath(this);
- }
-
- // stop boot animation
- property_set("ctl.stop", "bootanim");
-}
-
-static inline uint16_t pack565(int r, int g, int b) {
- return (r<<11)|(g<<5)|b;
-}
-
-status_t SurfaceFlinger::readyToRun()
-{
- ALOGI( "SurfaceFlinger's main thread ready to run. "
- "Initializing graphics H/W...");
-
- // we only support one display currently
- int dpy = 0;
-
- {
- // initialize the main display
- GraphicPlane& plane(graphicPlane(dpy));
- DisplayHardware* const hw = new DisplayHardware(this, dpy);
- plane.setDisplayHardware(hw);
- }
-
- // create the shared control-block
- mServerHeap = new MemoryHeapBase(4096,
- MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap");
- ALOGE_IF(mServerHeap==0, "can't create shared memory dealer");
-
- mServerCblk = static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase());
- ALOGE_IF(mServerCblk==0, "can't get to shared control block's address");
-
- new(mServerCblk) surface_flinger_cblk_t;
-
- // initialize primary screen
- // (other display should be initialized in the same manner, but
- // asynchronously, as they could come and go. None of this is supported
- // yet).
- const GraphicPlane& plane(graphicPlane(dpy));
- const DisplayHardware& hw = plane.displayHardware();
- const uint32_t w = hw.getWidth();
- const uint32_t h = hw.getHeight();
- const uint32_t f = hw.getFormat();
- hw.makeCurrent();
-
- // initialize the shared control block
- mServerCblk->connected |= 1<<dpy;
- display_cblk_t* dcblk = mServerCblk->displays + dpy;
- memset(dcblk, 0, sizeof(display_cblk_t));
- dcblk->w = plane.getWidth();
- dcblk->h = plane.getHeight();
- dcblk->format = f;
- dcblk->orientation = ISurfaceComposer::eOrientationDefault;
- dcblk->xdpi = hw.getDpiX();
- dcblk->ydpi = hw.getDpiY();
- dcblk->fps = hw.getRefreshRate();
- dcblk->density = hw.getDensity();
-
- // Initialize OpenGL|ES
- glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- glPixelStorei(GL_PACK_ALIGNMENT, 4);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnable(GL_SCISSOR_TEST);
- glShadeModel(GL_FLAT);
- glDisable(GL_DITHER);
- glDisable(GL_CULL_FACE);
-
- const uint16_t g0 = pack565(0x0F,0x1F,0x0F);
- const uint16_t g1 = pack565(0x17,0x2f,0x17);
- const uint16_t wormholeTexData[4] = { g0, g1, g1, g0 };
- glGenTextures(1, &mWormholeTexName);
- glBindTexture(GL_TEXTURE_2D, mWormholeTexName);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0,
- GL_RGB, GL_UNSIGNED_SHORT_5_6_5, wormholeTexData);
-
- const uint16_t protTexData[] = { pack565(0x03, 0x03, 0x03) };
- glGenTextures(1, &mProtectedTexName);
- glBindTexture(GL_TEXTURE_2D, mProtectedTexName);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_SHORT_5_6_5, protTexData);
-
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- // put the origin in the left-bottom corner
- glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h
-
-
- // start the EventThread
- mEventThread = new EventThread(this);
- mEventQueue.setEventThread(mEventThread);
- hw.startSleepManagement();
-
- /*
- * We're now ready to accept clients...
- */
-
- mReadyToRunBarrier.open();
-
- // start boot animation
- property_set("ctl.start", "bootanim");
-
- return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-bool SurfaceFlinger::authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture) const {
- Mutex::Autolock _l(mStateLock);
- sp<IBinder> surfaceTextureBinder(surfaceTexture->asBinder());
-
- // Check the visible layer list for the ISurface
- const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
- size_t count = currentLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(currentLayers[i]);
- sp<LayerBaseClient> lbc(layer->getLayerBaseClient());
- if (lbc != NULL) {
- wp<IBinder> lbcBinder = lbc->getSurfaceTextureBinder();
- if (lbcBinder == surfaceTextureBinder) {
- return true;
- }
- }
- }
-
- // Check the layers in the purgatory. This check is here so that if a
- // SurfaceTexture gets destroyed before all the clients are done using it,
- // the error will not be reported as "surface XYZ is not authenticated", but
- // will instead fail later on when the client tries to use the surface,
- // which should be reported as "surface XYZ returned an -ENODEV". The
- // purgatorized layers are no less authentic than the visible ones, so this
- // should not cause any harm.
- size_t purgatorySize = mLayerPurgatory.size();
- for (size_t i=0 ; i<purgatorySize ; i++) {
- const sp<LayerBase>& layer(mLayerPurgatory.itemAt(i));
- sp<LayerBaseClient> lbc(layer->getLayerBaseClient());
- if (lbc != NULL) {
- wp<IBinder> lbcBinder = lbc->getSurfaceTextureBinder();
- if (lbcBinder == surfaceTextureBinder) {
- return true;
- }
- }
- }
-
- return false;
-}
-
-// ----------------------------------------------------------------------------
-
-sp<IDisplayEventConnection> SurfaceFlinger::createDisplayEventConnection() {
- return mEventThread->createEventConnection();
-}
-
-// ----------------------------------------------------------------------------
-
-void SurfaceFlinger::waitForEvent() {
- mEventQueue.waitMessage();
-}
-
-void SurfaceFlinger::signalTransaction() {
- mEventQueue.invalidate();
-}
-
-void SurfaceFlinger::signalLayerUpdate() {
- mEventQueue.invalidate();
-}
-
-void SurfaceFlinger::signalRefresh() {
- mEventQueue.refresh();
-}
-
-status_t SurfaceFlinger::postMessageAsync(const sp<MessageBase>& msg,
- nsecs_t reltime, uint32_t flags) {
- return mEventQueue.postMessage(msg, reltime);
-}
-
-status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg,
- nsecs_t reltime, uint32_t flags) {
- status_t res = mEventQueue.postMessage(msg, reltime);
- if (res == NO_ERROR) {
- msg->wait();
- }
- return res;
-}
-
-bool SurfaceFlinger::threadLoop()
-{
- waitForEvent();
- return true;
-}
-
-void SurfaceFlinger::onMessageReceived(int32_t what)
-{
- ATRACE_CALL();
- switch (what) {
- case MessageQueue::REFRESH: {
-// case MessageQueue::INVALIDATE: {
- // check for transactions
- if (CC_UNLIKELY(mConsoleSignals)) {
- handleConsoleEvents();
- }
-
- // if we're in a global transaction, don't do anything.
- const uint32_t mask = eTransactionNeeded | eTraversalNeeded;
- uint32_t transactionFlags = peekTransactionFlags(mask);
- if (CC_UNLIKELY(transactionFlags)) {
- handleTransaction(transactionFlags);
- }
-
- // post surfaces (if needed)
- handlePageFlip();
-
-// signalRefresh();
-//
-// } break;
-//
-// case MessageQueue::REFRESH: {
-
- handleRefresh();
-
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
-
-// if (mDirtyRegion.isEmpty()) {
-// return;
-// }
-
- if (CC_UNLIKELY(mHwWorkListDirty)) {
- // build the h/w work list
- handleWorkList();
- }
-
- if (CC_LIKELY(hw.canDraw())) {
- // repaint the framebuffer (if needed)
- handleRepaint();
- // inform the h/w that we're done compositing
- hw.compositionComplete();
- postFramebuffer();
- } else {
- // pretend we did the post
- hw.compositionComplete();
- }
-
- } break;
- }
-}
-
-void SurfaceFlinger::postFramebuffer()
-{
- ATRACE_CALL();
- // mSwapRegion can be empty here is some cases, for instance if a hidden
- // or fully transparent window is updating.
- // in that case, we need to flip anyways to not risk a deadlock with
- // h/w composer.
-
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const nsecs_t now = systemTime();
- mDebugInSwapBuffers = now;
- hw.flip(mSwapRegion);
-
- size_t numLayers = mVisibleLayersSortedByZ.size();
- for (size_t i = 0; i < numLayers; i++) {
- mVisibleLayersSortedByZ[i]->onLayerDisplayed();
- }
-
- mLastSwapBufferTime = systemTime() - now;
- mDebugInSwapBuffers = 0;
- mSwapRegion.clear();
-}
-
-void SurfaceFlinger::handleConsoleEvents()
-{
- // something to do with the console
- const DisplayHardware& hw = graphicPlane(0).displayHardware();
-
- int what = android_atomic_and(0, &mConsoleSignals);
- if (what & eConsoleAcquired) {
- hw.acquireScreen();
- // this is a temporary work-around, eventually this should be called
- // by the power-manager
- SurfaceFlinger::turnElectronBeamOn(mElectronBeamAnimationMode);
- }
-
- if (what & eConsoleReleased) {
- if (hw.isScreenAcquired()) {
- hw.releaseScreen();
- }
- }
-
- mDirtyRegion.set(hw.bounds());
-}
-
-void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)
-{
- ATRACE_CALL();
-
- Mutex::Autolock _l(mStateLock);
- const nsecs_t now = systemTime();
- mDebugInTransaction = now;
-
- // Here we're guaranteed that some transaction flags are set
- // so we can call handleTransactionLocked() unconditionally.
- // We call getTransactionFlags(), which will also clear the flags,
- // with mStateLock held to guarantee that mCurrentState won't change
- // until the transaction is committed.
-
- const uint32_t mask = eTransactionNeeded | eTraversalNeeded;
- transactionFlags = getTransactionFlags(mask);
- handleTransactionLocked(transactionFlags);
-
- mLastTransactionTime = systemTime() - now;
- mDebugInTransaction = 0;
- invalidateHwcGeometry();
- // here the transaction has been committed
-}
-
-void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
-{
- const LayerVector& currentLayers(mCurrentState.layersSortedByZ);
- const size_t count = currentLayers.size();
-
- /*
- * Traversal of the children
- * (perform the transaction for each of them if needed)
- */
-
- const bool layersNeedTransaction = transactionFlags & eTraversalNeeded;
- if (layersNeedTransaction) {
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer = currentLayers[i];
- uint32_t trFlags = layer->getTransactionFlags(eTransactionNeeded);
- if (!trFlags) continue;
-
- const uint32_t flags = layer->doTransaction(0);
- if (flags & Layer::eVisibleRegion)
- mVisibleRegionsDirty = true;
- }
- }
-
- /*
- * Perform our own transaction if needed
- */
-
- if (transactionFlags & eTransactionNeeded) {
- if (mCurrentState.orientation != mDrawingState.orientation) {
- // the orientation has changed, recompute all visible regions
- // and invalidate everything.
-
- const int dpy = 0;
- const int orientation = mCurrentState.orientation;
- // Currently unused: const uint32_t flags = mCurrentState.orientationFlags;
- GraphicPlane& plane(graphicPlane(dpy));
- plane.setOrientation(orientation);
-
- // update the shared control block
- const DisplayHardware& hw(plane.displayHardware());
- volatile display_cblk_t* dcblk = mServerCblk->displays + dpy;
- dcblk->orientation = orientation;
- dcblk->w = plane.getWidth();
- dcblk->h = plane.getHeight();
-
- mVisibleRegionsDirty = true;
- mDirtyRegion.set(hw.bounds());
- }
-
- if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) {
- // layers have been added
- mVisibleRegionsDirty = true;
- }
-
- // some layers might have been removed, so
- // we need to update the regions they're exposing.
- if (mLayersRemoved) {
- mLayersRemoved = false;
- mVisibleRegionsDirty = true;
- const LayerVector& previousLayers(mDrawingState.layersSortedByZ);
- const size_t count = previousLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(previousLayers[i]);
- if (currentLayers.indexOf( layer ) < 0) {
- // this layer is not visible anymore
- mDirtyRegionRemovedLayer.orSelf(layer->visibleRegionScreen);
- }
- }
- }
- }
-
- commitTransaction();
-}
-
-void SurfaceFlinger::computeVisibleRegions(
- const LayerVector& currentLayers, Region& dirtyRegion, Region& opaqueRegion)
-{
- ATRACE_CALL();
-
- const GraphicPlane& plane(graphicPlane(0));
- const Transform& planeTransform(plane.transform());
- const DisplayHardware& hw(plane.displayHardware());
- const Region screenRegion(hw.bounds());
-
- Region aboveOpaqueLayers;
- Region aboveCoveredLayers;
- Region dirty;
-
- bool secureFrameBuffer = false;
-
- size_t i = currentLayers.size();
- while (i--) {
- const sp<LayerBase>& layer = currentLayers[i];
- layer->validateVisibility(planeTransform);
-
- // start with the whole surface at its current location
- const Layer::State& s(layer->drawingState());
-
- /*
- * opaqueRegion: area of a surface that is fully opaque.
- */
- Region opaqueRegion;
-
- /*
- * visibleRegion: area of a surface that is visible on screen
- * and not fully transparent. This is essentially the layer's
- * footprint minus the opaque regions above it.
- * Areas covered by a translucent surface are considered visible.
- */
- Region visibleRegion;
-
- /*
- * coveredRegion: area of a surface that is covered by all
- * visible regions above it (which includes the translucent areas).
- */
- Region coveredRegion;
-
-
- // handle hidden surfaces by setting the visible region to empty
- if (CC_LIKELY(!(s.flags & ISurfaceComposer::eLayerHidden) && s.alpha)) {
- const bool translucent = !layer->isOpaque();
- const Rect bounds(layer->visibleBounds());
- visibleRegion.set(bounds);
- visibleRegion.andSelf(screenRegion);
- if (!visibleRegion.isEmpty()) {
- // Remove the transparent area from the visible region
- if (translucent) {
- visibleRegion.subtractSelf(layer->transparentRegionScreen);
- }
-
- // compute the opaque region
- const int32_t layerOrientation = layer->getOrientation();
- if (s.alpha==255 && !translucent &&
- ((layerOrientation & Transform::ROT_INVALID) == false)) {
- // the opaque region is the layer's footprint
- opaqueRegion = visibleRegion;
- }
- }
- }
-
- // Clip the covered region to the visible region
- coveredRegion = aboveCoveredLayers.intersect(visibleRegion);
-
- // Update aboveCoveredLayers for next (lower) layer
- aboveCoveredLayers.orSelf(visibleRegion);
-
- // subtract the opaque region covered by the layers above us
- visibleRegion.subtractSelf(aboveOpaqueLayers);
-
- // compute this layer's dirty region
- if (layer->contentDirty) {
- // we need to invalidate the whole region
- dirty = visibleRegion;
- // as well, as the old visible region
- dirty.orSelf(layer->visibleRegionScreen);
- layer->contentDirty = false;
- } else {
- /* compute the exposed region:
- * the exposed region consists of two components:
- * 1) what's VISIBLE now and was COVERED before
- * 2) what's EXPOSED now less what was EXPOSED before
- *
- * note that (1) is conservative, we start with the whole
- * visible region but only keep what used to be covered by
- * something -- which mean it may have been exposed.
- *
- * (2) handles areas that were not covered by anything but got
- * exposed because of a resize.
- */
- const Region newExposed = visibleRegion - coveredRegion;
- const Region oldVisibleRegion = layer->visibleRegionScreen;
- const Region oldCoveredRegion = layer->coveredRegionScreen;
- const Region oldExposed = oldVisibleRegion - oldCoveredRegion;
- dirty = (visibleRegion&oldCoveredRegion) | (newExposed-oldExposed);
- }
- dirty.subtractSelf(aboveOpaqueLayers);
-
- // accumulate to the screen dirty region
- dirtyRegion.orSelf(dirty);
-
- // Update aboveOpaqueLayers for next (lower) layer
- aboveOpaqueLayers.orSelf(opaqueRegion);
-
- // Store the visible region is screen space
- layer->setVisibleRegion(visibleRegion);
- layer->setCoveredRegion(coveredRegion);
-
- // If a secure layer is partially visible, lock-down the screen!
- if (layer->isSecure() && !visibleRegion.isEmpty()) {
- secureFrameBuffer = true;
- }
- }
-
- // invalidate the areas where a layer was removed
- dirtyRegion.orSelf(mDirtyRegionRemovedLayer);
- mDirtyRegionRemovedLayer.clear();
-
- mSecureFrameBuffer = secureFrameBuffer;
- opaqueRegion = aboveOpaqueLayers;
-}
-
-
-void SurfaceFlinger::commitTransaction()
-{
- if (!mLayersPendingRemoval.isEmpty()) {
- // Notify removed layers now that they can't be drawn from
- for (size_t i = 0; i < mLayersPendingRemoval.size(); i++) {
- mLayersPendingRemoval[i]->onRemoved();
- }
- mLayersPendingRemoval.clear();
- }
-
- mDrawingState = mCurrentState;
- mTransationPending = false;
- mTransactionCV.broadcast();
-}
-
-void SurfaceFlinger::handlePageFlip()
-{
- ATRACE_CALL();
- const DisplayHardware& hw = graphicPlane(0).displayHardware();
- const Region screenRegion(hw.bounds());
-
- const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
- const bool visibleRegions = lockPageFlip(currentLayers);
-
- if (visibleRegions || mVisibleRegionsDirty) {
- Region opaqueRegion;
- computeVisibleRegions(currentLayers, mDirtyRegion, opaqueRegion);
-
- /*
- * rebuild the visible layer list
- */
- const size_t count = currentLayers.size();
- mVisibleLayersSortedByZ.clear();
- mVisibleLayersSortedByZ.setCapacity(count);
- for (size_t i=0 ; i<count ; i++) {
- if (!currentLayers[i]->visibleRegionScreen.isEmpty())
- mVisibleLayersSortedByZ.add(currentLayers[i]);
- }
-
- mWormholeRegion = screenRegion.subtract(opaqueRegion);
- mVisibleRegionsDirty = false;
- invalidateHwcGeometry();
- }
-
- unlockPageFlip(currentLayers);
-
- mDirtyRegion.orSelf(getAndClearInvalidateRegion());
- mDirtyRegion.andSelf(screenRegion);
-}
-
-void SurfaceFlinger::invalidateHwcGeometry()
-{
- mHwWorkListDirty = true;
-}
-
-bool SurfaceFlinger::lockPageFlip(const LayerVector& currentLayers)
-{
- bool recomputeVisibleRegions = false;
- size_t count = currentLayers.size();
- sp<LayerBase> const* layers = currentLayers.array();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(layers[i]);
- layer->lockPageFlip(recomputeVisibleRegions);
- }
- return recomputeVisibleRegions;
-}
-
-void SurfaceFlinger::unlockPageFlip(const LayerVector& currentLayers)
-{
- const GraphicPlane& plane(graphicPlane(0));
- const Transform& planeTransform(plane.transform());
- const size_t count = currentLayers.size();
- sp<LayerBase> const* layers = currentLayers.array();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(layers[i]);
- layer->unlockPageFlip(planeTransform, mDirtyRegion);
- }
-}
-
-void SurfaceFlinger::handleRefresh()
-{
- bool needInvalidate = false;
- const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
- const size_t count = currentLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(currentLayers[i]);
- if (layer->onPreComposition()) {
- needInvalidate = true;
- }
- }
- if (needInvalidate) {
- signalLayerUpdate();
- }
-}
-
-
-void SurfaceFlinger::handleWorkList()
-{
- mHwWorkListDirty = false;
- HWComposer& hwc(graphicPlane(0).displayHardware().getHwComposer());
- if (hwc.initCheck() == NO_ERROR) {
- const Vector< sp<LayerBase> >& currentLayers(mVisibleLayersSortedByZ);
- const size_t count = currentLayers.size();
- hwc.createWorkList(count);
- hwc_layer_t* const cur(hwc.getLayers());
- for (size_t i=0 ; cur && i<count ; i++) {
- currentLayers[i]->setGeometry(&cur[i]);
- if (mDebugDisableHWC || mDebugRegion) {
- cur[i].compositionType = HWC_FRAMEBUFFER;
- cur[i].flags |= HWC_SKIP_LAYER;
- }
- }
- }
-}
-
-void SurfaceFlinger::handleRepaint()
-{
- ATRACE_CALL();
-
- // compute the invalid region
- mSwapRegion.orSelf(mDirtyRegion);
-
- if (CC_UNLIKELY(mDebugRegion)) {
- debugFlashRegions();
- }
-
- // set the frame buffer
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- uint32_t flags = hw.getFlags();
- if ((flags & DisplayHardware::SWAP_RECTANGLE) ||
- (flags & DisplayHardware::BUFFER_PRESERVED))
- {
- // we can redraw only what's dirty, but since SWAP_RECTANGLE only
- // takes a rectangle, we must make sure to update that whole
- // rectangle in that case
- if (flags & DisplayHardware::SWAP_RECTANGLE) {
- // TODO: we really should be able to pass a region to
- // SWAP_RECTANGLE so that we don't have to redraw all this.
- mDirtyRegion.set(mSwapRegion.bounds());
- } else {
- // in the BUFFER_PRESERVED case, obviously, we can update only
- // what's needed and nothing more.
- // NOTE: this is NOT a common case, as preserving the backbuffer
- // is costly and usually involves copying the whole update back.
- }
- } else {
- if (flags & DisplayHardware::PARTIAL_UPDATES) {
- // We need to redraw the rectangle that will be updated
- // (pushed to the framebuffer).
- // This is needed because PARTIAL_UPDATES only takes one
- // rectangle instead of a region (see DisplayHardware::flip())
- mDirtyRegion.set(mSwapRegion.bounds());
- } else {
- // we need to redraw everything (the whole screen)
- mDirtyRegion.set(hw.bounds());
- mSwapRegion = mDirtyRegion;
- }
- }
-
- setupHardwareComposer(mDirtyRegion);
- composeSurfaces(mDirtyRegion);
-
- // update the swap region and clear the dirty region
- mSwapRegion.orSelf(mDirtyRegion);
- mDirtyRegion.clear();
-}
-
-void SurfaceFlinger::setupHardwareComposer(Region& dirtyInOut)
-{
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- HWComposer& hwc(hw.getHwComposer());
- hwc_layer_t* const cur(hwc.getLayers());
- if (!cur) {
- return;
- }
-
- const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
- size_t count = layers.size();
-
- ALOGE_IF(hwc.getNumLayers() != count,
- "HAL number of layers (%d) doesn't match surfaceflinger (%d)",
- hwc.getNumLayers(), count);
-
- // just to be extra-safe, use the smallest count
- if (hwc.initCheck() == NO_ERROR) {
- count = count < hwc.getNumLayers() ? count : hwc.getNumLayers();
- }
-
- /*
- * update the per-frame h/w composer data for each layer
- * and build the transparent region of the FB
- */
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(layers[i]);
- layer->setPerFrameData(&cur[i]);
- }
- const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER);
- status_t err = hwc.prepare();
- ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
-
- if (err == NO_ERROR) {
- // what's happening here is tricky.
- // we want to clear all the layers with the CLEAR_FB flags
- // that are opaque.
- // however, since some GPU are efficient at preserving
- // the backbuffer, we want to take advantage of that so we do the
- // clear only in the dirty region (other areas will be preserved
- // on those GPUs).
- // NOTE: on non backbuffer preserving GPU, the dirty region
- // has already been expanded as needed, so the code is correct
- // there too.
- //
- // However, the content of the framebuffer cannot be trusted when
- // we switch to/from FB/OVERLAY, in which case we need to
- // expand the dirty region to those areas too.
- //
- // Note also that there is a special case when switching from
- // "no layers in FB" to "some layers in FB", where we need to redraw
- // the entire FB, since some areas might contain uninitialized
- // data.
- //
- // Also we want to make sure to not clear areas that belong to
- // layers above that won't redraw (we would just be erasing them),
- // that is, we can't erase anything outside the dirty region.
-
- Region transparent;
-
- if (!fbLayerCount && hwc.getLayerCount(HWC_FRAMEBUFFER)) {
- transparent.set(hw.getBounds());
- dirtyInOut = transparent;
- } else {
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(layers[i]);
- if ((cur[i].hints & HWC_HINT_CLEAR_FB) && layer->isOpaque()) {
- transparent.orSelf(layer->visibleRegionScreen);
- }
- bool isOverlay = (cur[i].compositionType != HWC_FRAMEBUFFER);
- if (isOverlay != layer->isOverlay()) {
- // we transitioned to/from overlay, so add this layer
- // to the dirty region so the framebuffer can be either
- // cleared or redrawn.
- dirtyInOut.orSelf(layer->visibleRegionScreen);
- }
- layer->setOverlay(isOverlay);
- }
- // don't erase stuff outside the dirty region
- transparent.andSelf(dirtyInOut);
- }
-
- /*
- * clear the area of the FB that need to be transparent
- */
- if (!transparent.isEmpty()) {
- glClearColor(0,0,0,0);
- Region::const_iterator it = transparent.begin();
- Region::const_iterator const end = transparent.end();
- const int32_t height = hw.getHeight();
- while (it != end) {
- const Rect& r(*it++);
- const GLint sy = height - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glClear(GL_COLOR_BUFFER_BIT);
- }
- }
- }
-}
-
-void SurfaceFlinger::composeSurfaces(const Region& dirty)
-{
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- HWComposer& hwc(hw.getHwComposer());
-
- const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER);
- if (CC_UNLIKELY(fbLayerCount && !mWormholeRegion.isEmpty())) {
- // should never happen unless the window manager has a bug
- // draw something...
- drawWormhole();
- }
-
- // FIXME: workaroud for b/6020860
- glEnable(GL_SCISSOR_TEST);
- glScissor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- // end-workaround
-
- /*
- * and then, render the layers targeted at the framebuffer
- */
- hwc_layer_t* const cur(hwc.getLayers());
- const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
- size_t count = layers.size();
- for (size_t i=0 ; i<count ; i++) {
- if (cur && (cur[i].compositionType != HWC_FRAMEBUFFER)) {
- continue;
- }
- const sp<LayerBase>& layer(layers[i]);
- const Region clip(dirty.intersect(layer->visibleRegionScreen));
- if (!clip.isEmpty()) {
- layer->draw(clip);
- }
- }
-}
-
-void SurfaceFlinger::debugFlashRegions()
-{
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const uint32_t flags = hw.getFlags();
- const int32_t height = hw.getHeight();
- if (mSwapRegion.isEmpty()) {
- return;
- }
-
- if (!((flags & DisplayHardware::SWAP_RECTANGLE) ||
- (flags & DisplayHardware::BUFFER_PRESERVED))) {
- const Region repaint((flags & DisplayHardware::PARTIAL_UPDATES) ?
- mDirtyRegion.bounds() : hw.bounds());
- composeSurfaces(repaint);
- }
-
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
- glDisable(GL_SCISSOR_TEST);
-
- static int toggle = 0;
- toggle = 1 - toggle;
- if (toggle) {
- glColor4f(1, 0, 1, 1);
- } else {
- glColor4f(1, 1, 0, 1);
- }
-
- Region::const_iterator it = mDirtyRegion.begin();
- Region::const_iterator const end = mDirtyRegion.end();
- while (it != end) {
- const Rect& r = *it++;
- GLfloat vertices[][2] = {
- { r.left, height - r.top },
- { r.left, height - r.bottom },
- { r.right, height - r.bottom },
- { r.right, height - r.top }
- };
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
-
- hw.flip(mSwapRegion);
-
- if (mDebugRegion > 1)
- usleep(mDebugRegion * 1000);
-
- glEnable(GL_SCISSOR_TEST);
-}
-
-void SurfaceFlinger::drawWormhole() const
-{
- const Region region(mWormholeRegion.intersect(mDirtyRegion));
- if (region.isEmpty())
- return;
-
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const int32_t width = hw.getWidth();
- const int32_t height = hw.getHeight();
-
- if (CC_LIKELY(!mDebugBackground)) {
- glClearColor(0,0,0,0);
- Region::const_iterator it = region.begin();
- Region::const_iterator const end = region.end();
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = height - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glClear(GL_COLOR_BUFFER_BIT);
- }
- } else {
- const GLshort vertices[][2] = { { 0, 0 }, { width, 0 },
- { width, height }, { 0, height } };
- const GLshort tcoords[][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
-
- glVertexPointer(2, GL_SHORT, 0, vertices);
- glTexCoordPointer(2, GL_SHORT, 0, tcoords);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, mWormholeTexName);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-
- glDisable(GL_BLEND);
-
- glScalef(width*(1.0f/32.0f), height*(1.0f/32.0f), 1);
- Region::const_iterator it = region.begin();
- Region::const_iterator const end = region.end();
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = height - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisable(GL_TEXTURE_2D);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- }
-}
-
-status_t SurfaceFlinger::addLayer(const sp<LayerBase>& layer)
-{
- Mutex::Autolock _l(mStateLock);
- addLayer_l(layer);
- setTransactionFlags(eTransactionNeeded|eTraversalNeeded);
- return NO_ERROR;
-}
-
-status_t SurfaceFlinger::addLayer_l(const sp<LayerBase>& layer)
-{
- ssize_t i = mCurrentState.layersSortedByZ.add(layer);
- return (i < 0) ? status_t(i) : status_t(NO_ERROR);
-}
-
-ssize_t SurfaceFlinger::addClientLayer(const sp<Client>& client,
- const sp<LayerBaseClient>& lbc)
-{
- // attach this layer to the client
- size_t name = client->attachLayer(lbc);
-
- Mutex::Autolock _l(mStateLock);
-
- // add this layer to the current state list
- addLayer_l(lbc);
-
- return ssize_t(name);
-}
-
-status_t SurfaceFlinger::removeLayer(const sp<LayerBase>& layer)
-{
- Mutex::Autolock _l(mStateLock);
- status_t err = purgatorizeLayer_l(layer);
- if (err == NO_ERROR)
- setTransactionFlags(eTransactionNeeded);
- return err;
-}
-
-status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase)
-{
- sp<LayerBaseClient> lbc(layerBase->getLayerBaseClient());
- if (lbc != 0) {
- mLayerMap.removeItem( lbc->getSurfaceBinder() );
- }
- ssize_t index = mCurrentState.layersSortedByZ.remove(layerBase);
- if (index >= 0) {
- mLayersRemoved = true;
- return NO_ERROR;
- }
- return status_t(index);
-}
-
-status_t SurfaceFlinger::purgatorizeLayer_l(const sp<LayerBase>& layerBase)
-{
- // First add the layer to the purgatory list, which makes sure it won't
- // go away, then remove it from the main list (through a transaction).
- ssize_t err = removeLayer_l(layerBase);
- if (err >= 0) {
- mLayerPurgatory.add(layerBase);
- }
-
- mLayersPendingRemoval.push(layerBase);
-
- // it's possible that we don't find a layer, because it might
- // have been destroyed already -- this is not technically an error
- // from the user because there is a race between Client::destroySurface(),
- // ~Client() and ~ISurface().
- return (err == NAME_NOT_FOUND) ? status_t(NO_ERROR) : err;
-}
-
-status_t SurfaceFlinger::invalidateLayerVisibility(const sp<LayerBase>& layer)
-{
- layer->forceVisibilityTransaction();
- setTransactionFlags(eTraversalNeeded);
- return NO_ERROR;
-}
-
-uint32_t SurfaceFlinger::peekTransactionFlags(uint32_t flags)
-{
- return android_atomic_release_load(&mTransactionFlags);
-}
-
-uint32_t SurfaceFlinger::getTransactionFlags(uint32_t flags)
-{
- return android_atomic_and(~flags, &mTransactionFlags) & flags;
-}
-
-uint32_t SurfaceFlinger::setTransactionFlags(uint32_t flags)
-{
- uint32_t old = android_atomic_or(flags, &mTransactionFlags);
- if ((old & flags)==0) { // wake the server up
- signalTransaction();
- }
- return old;
-}
-
-
-void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state,
- int orientation, uint32_t flags) {
- Mutex::Autolock _l(mStateLock);
-
- uint32_t transactionFlags = 0;
- if (mCurrentState.orientation != orientation) {
- if (uint32_t(orientation)<=eOrientation270 || orientation==42) {
- mCurrentState.orientation = orientation;
- transactionFlags |= eTransactionNeeded;
- } else if (orientation != eOrientationUnchanged) {
- ALOGW("setTransactionState: ignoring unrecognized orientation: %d",
- orientation);
- }
- }
-
- const size_t count = state.size();
- for (size_t i=0 ; i<count ; i++) {
- const ComposerState& s(state[i]);
- sp<Client> client( static_cast<Client *>(s.client.get()) );
- transactionFlags |= setClientStateLocked(client, s.state);
- }
-
- if (transactionFlags) {
- // this triggers the transaction
- setTransactionFlags(transactionFlags);
-
- // if this is a synchronous transaction, wait for it to take effect
- // before returning.
- if (flags & eSynchronous) {
- mTransationPending = true;
- }
- while (mTransationPending) {
- status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
- if (CC_UNLIKELY(err != NO_ERROR)) {
- // just in case something goes wrong in SF, return to the
- // called after a few seconds.
- ALOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
- mTransationPending = false;
- break;
- }
- }
- }
-}
-
-sp<ISurface> SurfaceFlinger::createSurface(
- ISurfaceComposerClient::surface_data_t* params,
- const String8& name,
- const sp<Client>& client,
- DisplayID d, uint32_t w, uint32_t h, PixelFormat format,
- uint32_t flags)
-{
- sp<LayerBaseClient> layer;
- sp<ISurface> surfaceHandle;
-
- if (int32_t(w|h) < 0) {
- ALOGE("createSurface() failed, w or h is negative (w=%d, h=%d)",
- int(w), int(h));
- return surfaceHandle;
- }
-
- //ALOGD("createSurface for (%d x %d), name=%s", w, h, name.string());
- sp<Layer> normalLayer;
- switch (flags & eFXSurfaceMask) {
- case eFXSurfaceNormal:
- normalLayer = createNormalSurface(client, d, w, h, flags, format);
- layer = normalLayer;
- break;
- case eFXSurfaceBlur:
- // for now we treat Blur as Dim, until we can implement it
- // efficiently.
- case eFXSurfaceDim:
- layer = createDimSurface(client, d, w, h, flags);
- break;
- case eFXSurfaceScreenshot:
- layer = createScreenshotSurface(client, d, w, h, flags);
- break;
- }
-
- if (layer != 0) {
- layer->initStates(w, h, flags);
- layer->setName(name);
- ssize_t token = addClientLayer(client, layer);
-
- surfaceHandle = layer->getSurface();
- if (surfaceHandle != 0) {
- params->token = token;
- params->identity = layer->getIdentity();
- if (normalLayer != 0) {
- Mutex::Autolock _l(mStateLock);
- mLayerMap.add(layer->getSurfaceBinder(), normalLayer);
- }
- }
-
- setTransactionFlags(eTransactionNeeded);
- }
-
- return surfaceHandle;
-}
-
-sp<Layer> SurfaceFlinger::createNormalSurface(
- const sp<Client>& client, DisplayID display,
- uint32_t w, uint32_t h, uint32_t flags,
- PixelFormat& format)
-{
- // initialize the surfaces
- switch (format) { // TODO: take h/w into account
- case PIXEL_FORMAT_TRANSPARENT:
- case PIXEL_FORMAT_TRANSLUCENT:
- format = PIXEL_FORMAT_RGBA_8888;
- break;
- case PIXEL_FORMAT_OPAQUE:
-#ifdef NO_RGBX_8888
- format = PIXEL_FORMAT_RGB_565;
-#else
- format = PIXEL_FORMAT_RGBX_8888;
-#endif
- break;
- }
-
-#ifdef NO_RGBX_8888
- if (format == PIXEL_FORMAT_RGBX_8888)
- format = PIXEL_FORMAT_RGBA_8888;
-#endif
-
- sp<Layer> layer = new Layer(this, display, client);
- status_t err = layer->setBuffers(w, h, format, flags);
- if (CC_LIKELY(err != NO_ERROR)) {
- ALOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
- layer.clear();
- }
- return layer;
-}
-
-sp<LayerDim> SurfaceFlinger::createDimSurface(
- const sp<Client>& client, DisplayID display,
- uint32_t w, uint32_t h, uint32_t flags)
-{
- sp<LayerDim> layer = new LayerDim(this, display, client);
- return layer;
-}
-
-sp<LayerScreenshot> SurfaceFlinger::createScreenshotSurface(
- const sp<Client>& client, DisplayID display,
- uint32_t w, uint32_t h, uint32_t flags)
-{
- sp<LayerScreenshot> layer = new LayerScreenshot(this, display, client);
- return layer;
-}
-
-status_t SurfaceFlinger::removeSurface(const sp<Client>& client, SurfaceID sid)
-{
- /*
- * called by the window manager, when a surface should be marked for
- * destruction.
- *
- * The surface is removed from the current and drawing lists, but placed
- * in the purgatory queue, so it's not destroyed right-away (we need
- * to wait for all client's references to go away first).
- */
-
- status_t err = NAME_NOT_FOUND;
- Mutex::Autolock _l(mStateLock);
- sp<LayerBaseClient> layer = client->getLayerUser(sid);
- if (layer != 0) {
- err = purgatorizeLayer_l(layer);
- if (err == NO_ERROR) {
- setTransactionFlags(eTransactionNeeded);
- }
- }
- return err;
-}
-
-status_t SurfaceFlinger::destroySurface(const wp<LayerBaseClient>& layer)
-{
- // called by ~ISurface() when all references are gone
- status_t err = NO_ERROR;
- sp<LayerBaseClient> l(layer.promote());
- if (l != NULL) {
- Mutex::Autolock _l(mStateLock);
- err = removeLayer_l(l);
- if (err == NAME_NOT_FOUND) {
- // The surface wasn't in the current list, which means it was
- // removed already, which means it is in the purgatory,
- // and need to be removed from there.
- ssize_t idx = mLayerPurgatory.remove(l);
- ALOGE_IF(idx < 0,
- "layer=%p is not in the purgatory list", l.get());
- }
- ALOGE_IF(err<0 && err != NAME_NOT_FOUND,
- "error removing layer=%p (%s)", l.get(), strerror(-err));
- }
- return err;
-}
-
-uint32_t SurfaceFlinger::setClientStateLocked(
- const sp<Client>& client,
- const layer_state_t& s)
-{
- uint32_t flags = 0;
- sp<LayerBaseClient> layer(client->getLayerUser(s.surface));
- if (layer != 0) {
- const uint32_t what = s.what;
- if (what & ePositionChanged) {
- if (layer->setPosition(s.x, s.y))
- flags |= eTraversalNeeded;
- }
- if (what & eLayerChanged) {
- ssize_t idx = mCurrentState.layersSortedByZ.indexOf(layer);
- if (layer->setLayer(s.z)) {
- mCurrentState.layersSortedByZ.removeAt(idx);
- mCurrentState.layersSortedByZ.add(layer);
- // we need traversal (state changed)
- // AND transaction (list changed)
- flags |= eTransactionNeeded|eTraversalNeeded;
- }
- }
- if (what & eSizeChanged) {
- if (layer->setSize(s.w, s.h)) {
- flags |= eTraversalNeeded;
- }
- }
- if (what & eAlphaChanged) {
- if (layer->setAlpha(uint8_t(255.0f*s.alpha+0.5f)))
- flags |= eTraversalNeeded;
- }
- if (what & eMatrixChanged) {
- if (layer->setMatrix(s.matrix))
- flags |= eTraversalNeeded;
- }
- if (what & eTransparentRegionChanged) {
- if (layer->setTransparentRegionHint(s.transparentRegion))
- flags |= eTraversalNeeded;
- }
- if (what & eVisibilityChanged) {
- if (layer->setFlags(s.flags, s.mask))
- flags |= eTraversalNeeded;
- }
- }
- return flags;
-}
-
-void SurfaceFlinger::screenReleased(int dpy)
-{
- // this may be called by a signal handler, we can't do too much in here
- android_atomic_or(eConsoleReleased, &mConsoleSignals);
- signalTransaction();
-}
-
-void SurfaceFlinger::screenAcquired(int dpy)
-{
- // this may be called by a signal handler, we can't do too much in here
- android_atomic_or(eConsoleAcquired, &mConsoleSignals);
- signalTransaction();
-}
-
-status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
-{
- const size_t SIZE = 4096;
- char buffer[SIZE];
- String8 result;
-
- if (!PermissionCache::checkCallingPermission(sDump)) {
- snprintf(buffer, SIZE, "Permission Denial: "
- "can't dump SurfaceFlinger from pid=%d, uid=%d\n",
- IPCThreadState::self()->getCallingPid(),
- IPCThreadState::self()->getCallingUid());
- result.append(buffer);
- } else {
- // Try to get the main lock, but don't insist if we can't
- // (this would indicate SF is stuck, but we want to be able to
- // print something in dumpsys).
- int retry = 3;
- while (mStateLock.tryLock()<0 && --retry>=0) {
- usleep(1000000);
- }
- const bool locked(retry >= 0);
- if (!locked) {
- snprintf(buffer, SIZE,
- "SurfaceFlinger appears to be unresponsive, "
- "dumping anyways (no locks held)\n");
- result.append(buffer);
- }
-
- bool dumpAll = true;
- size_t index = 0;
- size_t numArgs = args.size();
- if (numArgs) {
- dumpAll = false;
-
- if ((index < numArgs) &&
- (args[index] == String16("--list"))) {
- index++;
- listLayersLocked(args, index, result, buffer, SIZE);
- }
-
- if ((index < numArgs) &&
- (args[index] == String16("--latency"))) {
- index++;
- dumpStatsLocked(args, index, result, buffer, SIZE);
- }
-
- if ((index < numArgs) &&
- (args[index] == String16("--latency-clear"))) {
- index++;
- clearStatsLocked(args, index, result, buffer, SIZE);
- }
- }
-
- if (dumpAll) {
- dumpAllLocked(result, buffer, SIZE);
- }
-
- if (locked) {
- mStateLock.unlock();
- }
- }
- write(fd, result.string(), result.size());
- return NO_ERROR;
-}
-
-void SurfaceFlinger::listLayersLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const
-{
- const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
- const size_t count = currentLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(currentLayers[i]);
- snprintf(buffer, SIZE, "%s\n", layer->getName().string());
- result.append(buffer);
- }
-}
-
-void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const
-{
- String8 name;
- if (index < args.size()) {
- name = String8(args[index]);
- index++;
- }
-
- const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
- const size_t count = currentLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(currentLayers[i]);
- if (name.isEmpty()) {
- snprintf(buffer, SIZE, "%s\n", layer->getName().string());
- result.append(buffer);
- }
- if (name.isEmpty() || (name == layer->getName())) {
- layer->dumpStats(result, buffer, SIZE);
- }
- }
-}
-
-void SurfaceFlinger::clearStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const
-{
- String8 name;
- if (index < args.size()) {
- name = String8(args[index]);
- index++;
- }
-
- const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
- const size_t count = currentLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(currentLayers[i]);
- if (name.isEmpty() || (name == layer->getName())) {
- layer->clearStats();
- }
- }
-}
-
-void SurfaceFlinger::dumpAllLocked(
- String8& result, char* buffer, size_t SIZE) const
-{
- // figure out if we're stuck somewhere
- const nsecs_t now = systemTime();
- const nsecs_t inSwapBuffers(mDebugInSwapBuffers);
- const nsecs_t inTransaction(mDebugInTransaction);
- nsecs_t inSwapBuffersDuration = (inSwapBuffers) ? now-inSwapBuffers : 0;
- nsecs_t inTransactionDuration = (inTransaction) ? now-inTransaction : 0;
-
- /*
- * Dump the visible layer list
- */
- const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
- const size_t count = currentLayers.size();
- snprintf(buffer, SIZE, "Visible layers (count = %d)\n", count);
- result.append(buffer);
- for (size_t i=0 ; i<count ; i++) {
- const sp<LayerBase>& layer(currentLayers[i]);
- layer->dump(result, buffer, SIZE);
- }
-
- /*
- * Dump the layers in the purgatory
- */
-
- const size_t purgatorySize = mLayerPurgatory.size();
- snprintf(buffer, SIZE, "Purgatory state (%d entries)\n", purgatorySize);
- result.append(buffer);
- for (size_t i=0 ; i<purgatorySize ; i++) {
- const sp<LayerBase>& layer(mLayerPurgatory.itemAt(i));
- layer->shortDump(result, buffer, SIZE);
- }
-
- /*
- * Dump SurfaceFlinger global state
- */
-
- snprintf(buffer, SIZE, "SurfaceFlinger global state:\n");
- result.append(buffer);
-
- const GLExtensions& extensions(GLExtensions::getInstance());
- snprintf(buffer, SIZE, "GLES: %s, %s, %s\n",
- extensions.getVendor(),
- extensions.getRenderer(),
- extensions.getVersion());
- result.append(buffer);
-
- snprintf(buffer, SIZE, "EGL : %s\n",
- eglQueryString(graphicPlane(0).getEGLDisplay(),
- EGL_VERSION_HW_ANDROID));
- result.append(buffer);
-
- snprintf(buffer, SIZE, "EXTS: %s\n", extensions.getExtension());
- result.append(buffer);
-
- mWormholeRegion.dump(result, "WormholeRegion");
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- snprintf(buffer, SIZE,
- " orientation=%d, canDraw=%d\n",
- mCurrentState.orientation, hw.canDraw());
- result.append(buffer);
- snprintf(buffer, SIZE,
- " last eglSwapBuffers() time: %f us\n"
- " last transaction time : %f us\n"
- " transaction-flags : %08x\n"
- " refresh-rate : %f fps\n"
- " x-dpi : %f\n"
- " y-dpi : %f\n",
- mLastSwapBufferTime/1000.0,
- mLastTransactionTime/1000.0,
- mTransactionFlags,
- hw.getRefreshRate(),
- hw.getDpiX(),
- hw.getDpiY());
- result.append(buffer);
-
- snprintf(buffer, SIZE, " eglSwapBuffers time: %f us\n",
- inSwapBuffersDuration/1000.0);
- result.append(buffer);
-
- snprintf(buffer, SIZE, " transaction time: %f us\n",
- inTransactionDuration/1000.0);
- result.append(buffer);
-
- /*
- * VSYNC state
- */
- mEventThread->dump(result, buffer, SIZE);
-
- /*
- * Dump HWComposer state
- */
- HWComposer& hwc(hw.getHwComposer());
- snprintf(buffer, SIZE, "h/w composer state:\n");
- result.append(buffer);
- snprintf(buffer, SIZE, " h/w composer %s and %s\n",
- hwc.initCheck()==NO_ERROR ? "present" : "not present",
- (mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled");
- result.append(buffer);
- hwc.dump(result, buffer, SIZE, mVisibleLayersSortedByZ);
-
- /*
- * Dump gralloc state
- */
- const GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
- alloc.dump(result);
- hw.dump(result);
-}
-
-status_t SurfaceFlinger::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch (code) {
- case CREATE_CONNECTION:
- case SET_TRANSACTION_STATE:
- case SET_ORIENTATION:
- case BOOT_FINISHED:
- case TURN_ELECTRON_BEAM_OFF:
- case TURN_ELECTRON_BEAM_ON:
- {
- // codes that require permission check
- IPCThreadState* ipc = IPCThreadState::self();
- const int pid = ipc->getCallingPid();
- const int uid = ipc->getCallingUid();
- if ((uid != AID_GRAPHICS) &&
- !PermissionCache::checkPermission(sAccessSurfaceFlinger, pid, uid)) {
- ALOGE("Permission Denial: "
- "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid);
- return PERMISSION_DENIED;
- }
- break;
- }
- case CAPTURE_SCREEN:
- {
- // codes that require permission check
- IPCThreadState* ipc = IPCThreadState::self();
- const int pid = ipc->getCallingPid();
- const int uid = ipc->getCallingUid();
- if ((uid != AID_GRAPHICS) &&
- !PermissionCache::checkPermission(sReadFramebuffer, pid, uid)) {
- ALOGE("Permission Denial: "
- "can't read framebuffer pid=%d, uid=%d", pid, uid);
- return PERMISSION_DENIED;
- }
- break;
- }
- }
-
- status_t err = BnSurfaceComposer::onTransact(code, data, reply, flags);
- if (err == UNKNOWN_TRANSACTION || err == PERMISSION_DENIED) {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- if (CC_UNLIKELY(!PermissionCache::checkCallingPermission(sHardwareTest))) {
- IPCThreadState* ipc = IPCThreadState::self();
- const int pid = ipc->getCallingPid();
- const int uid = ipc->getCallingUid();
- ALOGE("Permission Denial: "
- "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid);
- return PERMISSION_DENIED;
- }
- int n;
- switch (code) {
- case 1000: // SHOW_CPU, NOT SUPPORTED ANYMORE
- case 1001: // SHOW_FPS, NOT SUPPORTED ANYMORE
- return NO_ERROR;
- case 1002: // SHOW_UPDATES
- n = data.readInt32();
- mDebugRegion = n ? n : (mDebugRegion ? 0 : 1);
- invalidateHwcGeometry();
- repaintEverything();
- return NO_ERROR;
- case 1003: // SHOW_BACKGROUND
- n = data.readInt32();
- mDebugBackground = n ? 1 : 0;
- return NO_ERROR;
- case 1004:{ // repaint everything
- repaintEverything();
- return NO_ERROR;
- }
- case 1005:{ // force transaction
- setTransactionFlags(eTransactionNeeded|eTraversalNeeded);
- return NO_ERROR;
- }
- case 1006:{ // send empty update
- signalRefresh();
- return NO_ERROR;
- }
- case 1008: // toggle use of hw composer
- n = data.readInt32();
- mDebugDisableHWC = n ? 1 : 0;
- invalidateHwcGeometry();
- repaintEverything();
- return NO_ERROR;
- case 1009: // toggle use of transform hint
- n = data.readInt32();
- mDebugDisableTransformHint = n ? 1 : 0;
- invalidateHwcGeometry();
- repaintEverything();
- return NO_ERROR;
- case 1010: // interrogate.
- reply->writeInt32(0);
- reply->writeInt32(0);
- reply->writeInt32(mDebugRegion);
- reply->writeInt32(mDebugBackground);
- reply->writeInt32(mDebugDisableHWC);
- return NO_ERROR;
- case 1013: {
- Mutex::Autolock _l(mStateLock);
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- reply->writeInt32(hw.getPageFlipCount());
- }
- return NO_ERROR;
- }
- }
- return err;
-}
-
-void SurfaceFlinger::repaintEverything() {
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const Rect bounds(hw.getBounds());
- setInvalidateRegion(Region(bounds));
- signalTransaction();
-}
-
-void SurfaceFlinger::setInvalidateRegion(const Region& reg) {
- Mutex::Autolock _l(mInvalidateLock);
- mInvalidateRegion = reg;
-}
-
-Region SurfaceFlinger::getAndClearInvalidateRegion() {
- Mutex::Autolock _l(mInvalidateLock);
- Region reg(mInvalidateRegion);
- mInvalidateRegion.clear();
- return reg;
-}
-
-// ---------------------------------------------------------------------------
-
-status_t SurfaceFlinger::renderScreenToTexture(DisplayID dpy,
- GLuint* textureName, GLfloat* uOut, GLfloat* vOut)
-{
- Mutex::Autolock _l(mStateLock);
- return renderScreenToTextureLocked(dpy, textureName, uOut, vOut);
-}
-
-status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy,
- GLuint* textureName, GLfloat* uOut, GLfloat* vOut)
-{
- if (!GLExtensions::getInstance().haveFramebufferObject())
- return INVALID_OPERATION;
-
- // get screen geometry
- const DisplayHardware& hw(graphicPlane(dpy).displayHardware());
- const uint32_t hw_w = hw.getWidth();
- const uint32_t hw_h = hw.getHeight();
- GLfloat u = 1;
- GLfloat v = 1;
-
- // make sure to clear all GL error flags
- while ( glGetError() != GL_NO_ERROR ) ;
-
- // create a FBO
- GLuint name, tname;
- glGenTextures(1, &tname);
- glBindTexture(GL_TEXTURE_2D, tname);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- hw_w, hw_h, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
- if (glGetError() != GL_NO_ERROR) {
- while ( glGetError() != GL_NO_ERROR ) ;
- GLint tw = (2 << (31 - clz(hw_w)));
- GLint th = (2 << (31 - clz(hw_h)));
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- tw, th, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
- u = GLfloat(hw_w) / tw;
- v = GLfloat(hw_h) / th;
- }
- glGenFramebuffersOES(1, &name);
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, name);
- glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES,
- GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tname, 0);
-
- // redraw the screen entirely...
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_SCISSOR_TEST);
- glClearColor(0,0,0,1);
- glClear(GL_COLOR_BUFFER_BIT);
- glEnable(GL_SCISSOR_TEST);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
- const size_t count = layers.size();
- for (size_t i=0 ; i<count ; ++i) {
- const sp<LayerBase>& layer(layers[i]);
- layer->drawForSreenShot();
- }
-
- hw.compositionComplete();
-
- // back to main framebuffer
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
- glDisable(GL_SCISSOR_TEST);
- glDeleteFramebuffersOES(1, &name);
-
- *textureName = tname;
- *uOut = u;
- *vOut = v;
- return NO_ERROR;
-}
-
-// ---------------------------------------------------------------------------
-
-status_t SurfaceFlinger::electronBeamOffAnimationImplLocked()
-{
- // get screen geometry
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const uint32_t hw_w = hw.getWidth();
- const uint32_t hw_h = hw.getHeight();
- const Region screenBounds(hw.getBounds());
-
- GLfloat u, v;
- GLuint tname;
- status_t result = renderScreenToTextureLocked(0, &tname, &u, &v);
- if (result != NO_ERROR) {
- return result;
- }
-
- GLfloat vtx[8];
- const GLfloat texCoords[4][2] = { {0,0}, {0,v}, {u,v}, {u,0} };
- glBindTexture(GL_TEXTURE_2D, tname);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vtx);
-
- /*
- * Texture coordinate mapping
- *
- * u
- * 1 +----------+---+
- * | | | | image is inverted
- * | V | | w.r.t. the texture
- * 1-v +----------+ | coordinates
- * | |
- * | |
- * | |
- * 0 +--------------+
- * 0 1
- *
- */
-
- class s_curve_interpolator {
- const float nbFrames, s, v;
- public:
- s_curve_interpolator(int nbFrames, float s)
- : nbFrames(1.0f / (nbFrames-1)), s(s),
- v(1.0f + expf(-s + 0.5f*s)) {
- }
- float operator()(int f) {
- const float x = f * nbFrames;
- return ((1.0f/(1.0f + expf(-x*s + 0.5f*s))) - 0.5f) * v + 0.5f;
- }
- };
-
- class v_stretch {
- const GLfloat hw_w, hw_h;
- public:
- v_stretch(uint32_t hw_w, uint32_t hw_h)
- : hw_w(hw_w), hw_h(hw_h) {
- }
- void operator()(GLfloat* vtx, float v) {
- const GLfloat w = hw_w + (hw_w * v);
- const GLfloat h = hw_h - (hw_h * v);
- const GLfloat x = (hw_w - w) * 0.5f;
- const GLfloat y = (hw_h - h) * 0.5f;
- vtx[0] = x; vtx[1] = y;
- vtx[2] = x; vtx[3] = y + h;
- vtx[4] = x + w; vtx[5] = y + h;
- vtx[6] = x + w; vtx[7] = y;
- }
- };
-
- class h_stretch {
- const GLfloat hw_w, hw_h;
- public:
- h_stretch(uint32_t hw_w, uint32_t hw_h)
- : hw_w(hw_w), hw_h(hw_h) {
- }
- void operator()(GLfloat* vtx, float v) {
- const GLfloat w = hw_w - (hw_w * v);
- const GLfloat h = 1.0f;
- const GLfloat x = (hw_w - w) * 0.5f;
- const GLfloat y = (hw_h - h) * 0.5f;
- vtx[0] = x; vtx[1] = y;
- vtx[2] = x; vtx[3] = y + h;
- vtx[4] = x + w; vtx[5] = y + h;
- vtx[6] = x + w; vtx[7] = y;
- }
- };
-
- // the full animation is 24 frames
- char value[PROPERTY_VALUE_MAX];
- property_get("debug.sf.electron_frames", value, "24");
- int nbFrames = (atoi(value) + 1) >> 1;
- if (nbFrames <= 0) // just in case
- nbFrames = 24;
-
- s_curve_interpolator itr(nbFrames, 7.5f);
- s_curve_interpolator itg(nbFrames, 8.0f);
- s_curve_interpolator itb(nbFrames, 8.5f);
-
- v_stretch vverts(hw_w, hw_h);
-
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
- for (int i=0 ; i<nbFrames ; i++) {
- float x, y, w, h;
- const float vr = itr(i);
- const float vg = itg(i);
- const float vb = itb(i);
-
- // clear screen
- glColorMask(1,1,1,1);
- glClear(GL_COLOR_BUFFER_BIT);
- glEnable(GL_TEXTURE_2D);
-
- // draw the red plane
- vverts(vtx, vr);
- glColorMask(1,0,0,1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- // draw the green plane
- vverts(vtx, vg);
- glColorMask(0,1,0,1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- // draw the blue plane
- vverts(vtx, vb);
- glColorMask(0,0,1,1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- // draw the white highlight (we use the last vertices)
- glDisable(GL_TEXTURE_2D);
- glColorMask(1,1,1,1);
- glColor4f(vg, vg, vg, 1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- hw.flip(screenBounds);
- }
-
- h_stretch hverts(hw_w, hw_h);
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glColorMask(1,1,1,1);
- for (int i=0 ; i<nbFrames ; i++) {
- const float v = itg(i);
- hverts(vtx, v);
- glClear(GL_COLOR_BUFFER_BIT);
- glColor4f(1-v, 1-v, 1-v, 1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- hw.flip(screenBounds);
- }
-
- glColorMask(1,1,1,1);
- glEnable(GL_SCISSOR_TEST);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDeleteTextures(1, &tname);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
- return NO_ERROR;
-}
-
-status_t SurfaceFlinger::electronBeamOnAnimationImplLocked()
-{
- status_t result = PERMISSION_DENIED;
-
- if (!GLExtensions::getInstance().haveFramebufferObject())
- return INVALID_OPERATION;
-
-
- // get screen geometry
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const uint32_t hw_w = hw.getWidth();
- const uint32_t hw_h = hw.getHeight();
- const Region screenBounds(hw.bounds());
-
- GLfloat u, v;
- GLuint tname;
- result = renderScreenToTextureLocked(0, &tname, &u, &v);
- if (result != NO_ERROR) {
- return result;
- }
-
- GLfloat vtx[8];
- const GLfloat texCoords[4][2] = { {0,v}, {0,0}, {u,0}, {u,v} };
- glBindTexture(GL_TEXTURE_2D, tname);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vtx);
-
- class s_curve_interpolator {
- const float nbFrames, s, v;
- public:
- s_curve_interpolator(int nbFrames, float s)
- : nbFrames(1.0f / (nbFrames-1)), s(s),
- v(1.0f + expf(-s + 0.5f*s)) {
- }
- float operator()(int f) {
- const float x = f * nbFrames;
- return ((1.0f/(1.0f + expf(-x*s + 0.5f*s))) - 0.5f) * v + 0.5f;
- }
- };
-
- class v_stretch {
- const GLfloat hw_w, hw_h;
- public:
- v_stretch(uint32_t hw_w, uint32_t hw_h)
- : hw_w(hw_w), hw_h(hw_h) {
- }
- void operator()(GLfloat* vtx, float v) {
- const GLfloat w = hw_w + (hw_w * v);
- const GLfloat h = hw_h - (hw_h * v);
- const GLfloat x = (hw_w - w) * 0.5f;
- const GLfloat y = (hw_h - h) * 0.5f;
- vtx[0] = x; vtx[1] = y;
- vtx[2] = x; vtx[3] = y + h;
- vtx[4] = x + w; vtx[5] = y + h;
- vtx[6] = x + w; vtx[7] = y;
- }
- };
-
- class h_stretch {
- const GLfloat hw_w, hw_h;
- public:
- h_stretch(uint32_t hw_w, uint32_t hw_h)
- : hw_w(hw_w), hw_h(hw_h) {
- }
- void operator()(GLfloat* vtx, float v) {
- const GLfloat w = hw_w - (hw_w * v);
- const GLfloat h = 1.0f;
- const GLfloat x = (hw_w - w) * 0.5f;
- const GLfloat y = (hw_h - h) * 0.5f;
- vtx[0] = x; vtx[1] = y;
- vtx[2] = x; vtx[3] = y + h;
- vtx[4] = x + w; vtx[5] = y + h;
- vtx[6] = x + w; vtx[7] = y;
- }
- };
-
- // the full animation is 12 frames
- int nbFrames = 8;
- s_curve_interpolator itr(nbFrames, 7.5f);
- s_curve_interpolator itg(nbFrames, 8.0f);
- s_curve_interpolator itb(nbFrames, 8.5f);
-
- h_stretch hverts(hw_w, hw_h);
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glColorMask(1,1,1,1);
- for (int i=nbFrames-1 ; i>=0 ; i--) {
- const float v = itg(i);
- hverts(vtx, v);
- glClear(GL_COLOR_BUFFER_BIT);
- glColor4f(1-v, 1-v, 1-v, 1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- hw.flip(screenBounds);
- }
-
- nbFrames = 4;
- v_stretch vverts(hw_w, hw_h);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
- for (int i=nbFrames-1 ; i>=0 ; i--) {
- float x, y, w, h;
- const float vr = itr(i);
- const float vg = itg(i);
- const float vb = itb(i);
-
- // clear screen
- glColorMask(1,1,1,1);
- glClear(GL_COLOR_BUFFER_BIT);
- glEnable(GL_TEXTURE_2D);
-
- // draw the red plane
- vverts(vtx, vr);
- glColorMask(1,0,0,1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- // draw the green plane
- vverts(vtx, vg);
- glColorMask(0,1,0,1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- // draw the blue plane
- vverts(vtx, vb);
- glColorMask(0,0,1,1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- hw.flip(screenBounds);
- }
-
- glColorMask(1,1,1,1);
- glEnable(GL_SCISSOR_TEST);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDeleteTextures(1, &tname);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
-
- return NO_ERROR;
-}
-
-// ---------------------------------------------------------------------------
-
-status_t SurfaceFlinger::turnElectronBeamOffImplLocked(int32_t mode)
-{
- DisplayHardware& hw(graphicPlane(0).editDisplayHardware());
- if (!hw.canDraw()) {
- // we're already off
- return NO_ERROR;
- }
-
- // turn off hwc while we're doing the animation
- hw.getHwComposer().disable();
- // and make sure to turn it back on (if needed) next time we compose
- invalidateHwcGeometry();
-
- if (mode & ISurfaceComposer::eElectronBeamAnimationOff) {
- electronBeamOffAnimationImplLocked();
- }
-
- // always clear the whole screen at the end of the animation
- glClearColor(0,0,0,1);
- glDisable(GL_SCISSOR_TEST);
- glClear(GL_COLOR_BUFFER_BIT);
- glEnable(GL_SCISSOR_TEST);
- hw.flip( Region(hw.bounds()) );
-
- return NO_ERROR;
-}
-
-status_t SurfaceFlinger::turnElectronBeamOff(int32_t mode)
-{
- class MessageTurnElectronBeamOff : public MessageBase {
- SurfaceFlinger* flinger;
- int32_t mode;
- status_t result;
- public:
- MessageTurnElectronBeamOff(SurfaceFlinger* flinger, int32_t mode)
- : flinger(flinger), mode(mode), result(PERMISSION_DENIED) {
- }
- status_t getResult() const {
- return result;
- }
- virtual bool handler() {
- Mutex::Autolock _l(flinger->mStateLock);
- result = flinger->turnElectronBeamOffImplLocked(mode);
- return true;
- }
- };
-
- sp<MessageBase> msg = new MessageTurnElectronBeamOff(this, mode);
- status_t res = postMessageSync(msg);
- if (res == NO_ERROR) {
- res = static_cast<MessageTurnElectronBeamOff*>( msg.get() )->getResult();
-
- // work-around: when the power-manager calls us we activate the
- // animation. eventually, the "on" animation will be called
- // by the power-manager itself
- mElectronBeamAnimationMode = mode;
- }
- return res;
-}
-
-// ---------------------------------------------------------------------------
-
-status_t SurfaceFlinger::turnElectronBeamOnImplLocked(int32_t mode)
-{
- DisplayHardware& hw(graphicPlane(0).editDisplayHardware());
- if (hw.canDraw()) {
- // we're already on
- return NO_ERROR;
- }
- if (mode & ISurfaceComposer::eElectronBeamAnimationOn) {
- electronBeamOnAnimationImplLocked();
- }
-
- // make sure to redraw the whole screen when the animation is done
- mDirtyRegion.set(hw.bounds());
- signalTransaction();
-
- return NO_ERROR;
-}
-
-status_t SurfaceFlinger::turnElectronBeamOn(int32_t mode)
-{
- class MessageTurnElectronBeamOn : public MessageBase {
- SurfaceFlinger* flinger;
- int32_t mode;
- status_t result;
- public:
- MessageTurnElectronBeamOn(SurfaceFlinger* flinger, int32_t mode)
- : flinger(flinger), mode(mode), result(PERMISSION_DENIED) {
- }
- status_t getResult() const {
- return result;
- }
- virtual bool handler() {
- Mutex::Autolock _l(flinger->mStateLock);
- result = flinger->turnElectronBeamOnImplLocked(mode);
- return true;
- }
- };
-
- postMessageAsync( new MessageTurnElectronBeamOn(this, mode) );
- return NO_ERROR;
-}
-
-// ---------------------------------------------------------------------------
-
-status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* w, uint32_t* h, PixelFormat* f,
- uint32_t sw, uint32_t sh,
- uint32_t minLayerZ, uint32_t maxLayerZ)
-{
- status_t result = PERMISSION_DENIED;
-
- // only one display supported for now
- if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
- return BAD_VALUE;
-
- if (!GLExtensions::getInstance().haveFramebufferObject())
- return INVALID_OPERATION;
-
- // get screen geometry
- const DisplayHardware& hw(graphicPlane(dpy).displayHardware());
- const uint32_t hw_w = hw.getWidth();
- const uint32_t hw_h = hw.getHeight();
-
- if ((sw > hw_w) || (sh > hw_h))
- return BAD_VALUE;
-
- sw = (!sw) ? hw_w : sw;
- sh = (!sh) ? hw_h : sh;
- const size_t size = sw * sh * 4;
-
- //ALOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d",
- // sw, sh, minLayerZ, maxLayerZ);
-
- // make sure to clear all GL error flags
- while ( glGetError() != GL_NO_ERROR ) ;
-
- // create a FBO
- GLuint name, tname;
- glGenRenderbuffersOES(1, &tname);
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, tname);
- glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGBA8_OES, sw, sh);
- glGenFramebuffersOES(1, &name);
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, name);
- glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES,
- GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, tname);
-
- GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
-
- if (status == GL_FRAMEBUFFER_COMPLETE_OES) {
-
- // invert everything, b/c glReadPixel() below will invert the FB
- glViewport(0, 0, sw, sh);
- glScissor(0, 0, sw, sh);
- glEnable(GL_SCISSOR_TEST);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrthof(0, hw_w, hw_h, 0, 0, 1);
- glMatrixMode(GL_MODELVIEW);
-
- // redraw the screen entirely...
- glClearColor(0,0,0,1);
- glClear(GL_COLOR_BUFFER_BIT);
-
- const LayerVector& layers(mDrawingState.layersSortedByZ);
- const size_t count = layers.size();
- for (size_t i=0 ; i<count ; ++i) {
- const sp<LayerBase>& layer(layers[i]);
- const uint32_t flags = layer->drawingState().flags;
- if (!(flags & ISurfaceComposer::eLayerHidden)) {
- const uint32_t z = layer->drawingState().z;
- if (z >= minLayerZ && z <= maxLayerZ) {
- layer->drawForSreenShot();
- }
- }
- }
-
- // XXX: this is needed on tegra
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, 0, sw, sh);
-
- // check for errors and return screen capture
- if (glGetError() != GL_NO_ERROR) {
- // error while rendering
- result = INVALID_OPERATION;
- } else {
- // allocate shared memory large enough to hold the
- // screen capture
- sp<MemoryHeapBase> base(
- new MemoryHeapBase(size, 0, "screen-capture") );
- void* const ptr = base->getBase();
- if (ptr) {
- // capture the screen with glReadPixels()
- glReadPixels(0, 0, sw, sh, GL_RGBA, GL_UNSIGNED_BYTE, ptr);
- if (glGetError() == GL_NO_ERROR) {
- *heap = base;
- *w = sw;
- *h = sh;
- *f = PIXEL_FORMAT_RGBA_8888;
- result = NO_ERROR;
- }
- } else {
- result = NO_MEMORY;
- }
- }
- glEnable(GL_SCISSOR_TEST);
- glViewport(0, 0, hw_w, hw_h);
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- } else {
- result = BAD_VALUE;
- }
-
- // release FBO resources
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
- glDeleteRenderbuffersOES(1, &tname);
- glDeleteFramebuffersOES(1, &name);
-
- hw.compositionComplete();
-
- // ALOGD("screenshot: result = %s", result<0 ? strerror(result) : "OK");
-
- return result;
-}
-
-
-status_t SurfaceFlinger::captureScreen(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* width, uint32_t* height, PixelFormat* format,
- uint32_t sw, uint32_t sh,
- uint32_t minLayerZ, uint32_t maxLayerZ)
-{
- // only one display supported for now
- if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
- return BAD_VALUE;
-
- if (!GLExtensions::getInstance().haveFramebufferObject())
- return INVALID_OPERATION;
-
- class MessageCaptureScreen : public MessageBase {
- SurfaceFlinger* flinger;
- DisplayID dpy;
- sp<IMemoryHeap>* heap;
- uint32_t* w;
- uint32_t* h;
- PixelFormat* f;
- uint32_t sw;
- uint32_t sh;
- uint32_t minLayerZ;
- uint32_t maxLayerZ;
- status_t result;
- public:
- MessageCaptureScreen(SurfaceFlinger* flinger, DisplayID dpy,
- sp<IMemoryHeap>* heap, uint32_t* w, uint32_t* h, PixelFormat* f,
- uint32_t sw, uint32_t sh,
- uint32_t minLayerZ, uint32_t maxLayerZ)
- : flinger(flinger), dpy(dpy),
- heap(heap), w(w), h(h), f(f), sw(sw), sh(sh),
- minLayerZ(minLayerZ), maxLayerZ(maxLayerZ),
- result(PERMISSION_DENIED)
- {
- }
- status_t getResult() const {
- return result;
- }
- virtual bool handler() {
- Mutex::Autolock _l(flinger->mStateLock);
-
- // if we have secure windows, never allow the screen capture
- if (flinger->mSecureFrameBuffer)
- return true;
-
- result = flinger->captureScreenImplLocked(dpy,
- heap, w, h, f, sw, sh, minLayerZ, maxLayerZ);
-
- return true;
- }
- };
-
- sp<MessageBase> msg = new MessageCaptureScreen(this,
- dpy, heap, width, height, format, sw, sh, minLayerZ, maxLayerZ);
- status_t res = postMessageSync(msg);
- if (res == NO_ERROR) {
- res = static_cast<MessageCaptureScreen*>( msg.get() )->getResult();
- }
- return res;
-}
-
-// ---------------------------------------------------------------------------
-
-sp<Layer> SurfaceFlinger::getLayer(const sp<ISurface>& sur) const
-{
- sp<Layer> result;
- Mutex::Autolock _l(mStateLock);
- result = mLayerMap.valueFor( sur->asBinder() ).promote();
- return result;
-}
-
-// ---------------------------------------------------------------------------
-
-Client::Client(const sp<SurfaceFlinger>& flinger)
- : mFlinger(flinger), mNameGenerator(1)
-{
-}
-
-Client::~Client()
-{
- const size_t count = mLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- sp<LayerBaseClient> layer(mLayers.valueAt(i).promote());
- if (layer != 0) {
- mFlinger->removeLayer(layer);
- }
- }
-}
-
-status_t Client::initCheck() const {
- return NO_ERROR;
-}
-
-size_t Client::attachLayer(const sp<LayerBaseClient>& layer)
-{
- Mutex::Autolock _l(mLock);
- size_t name = mNameGenerator++;
- mLayers.add(name, layer);
- return name;
-}
-
-void Client::detachLayer(const LayerBaseClient* layer)
-{
- Mutex::Autolock _l(mLock);
- // we do a linear search here, because this doesn't happen often
- const size_t count = mLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- if (mLayers.valueAt(i) == layer) {
- mLayers.removeItemsAt(i, 1);
- break;
- }
- }
-}
-sp<LayerBaseClient> Client::getLayerUser(int32_t i) const
-{
- Mutex::Autolock _l(mLock);
- sp<LayerBaseClient> lbc;
- wp<LayerBaseClient> layer(mLayers.valueFor(i));
- if (layer != 0) {
- lbc = layer.promote();
- ALOGE_IF(lbc==0, "getLayerUser(name=%d) is dead", int(i));
- }
- return lbc;
-}
-
-
-status_t Client::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- // these must be checked
- IPCThreadState* ipc = IPCThreadState::self();
- const int pid = ipc->getCallingPid();
- const int uid = ipc->getCallingUid();
- const int self_pid = getpid();
- if (CC_UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != 0)) {
- // we're called from a different process, do the real check
- if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger))
- {
- ALOGE("Permission Denial: "
- "can't openGlobalTransaction pid=%d, uid=%d", pid, uid);
- return PERMISSION_DENIED;
- }
- }
- return BnSurfaceComposerClient::onTransact(code, data, reply, flags);
-}
-
-
-sp<ISurface> Client::createSurface(
- ISurfaceComposerClient::surface_data_t* params,
- const String8& name,
- DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
- uint32_t flags)
-{
- /*
- * createSurface must be called from the GL thread so that it can
- * have access to the GL context.
- */
-
- class MessageCreateSurface : public MessageBase {
- sp<ISurface> result;
- SurfaceFlinger* flinger;
- ISurfaceComposerClient::surface_data_t* params;
- Client* client;
- const String8& name;
- DisplayID display;
- uint32_t w, h;
- PixelFormat format;
- uint32_t flags;
- public:
- MessageCreateSurface(SurfaceFlinger* flinger,
- ISurfaceComposerClient::surface_data_t* params,
- const String8& name, Client* client,
- DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
- uint32_t flags)
- : flinger(flinger), params(params), client(client), name(name),
- display(display), w(w), h(h), format(format), flags(flags)
- {
- }
- sp<ISurface> getResult() const { return result; }
- virtual bool handler() {
- result = flinger->createSurface(params, name, client,
- display, w, h, format, flags);
- return true;
- }
- };
-
- sp<MessageBase> msg = new MessageCreateSurface(mFlinger.get(),
- params, name, this, display, w, h, format, flags);
- mFlinger->postMessageSync(msg);
- return static_cast<MessageCreateSurface*>( msg.get() )->getResult();
-}
-status_t Client::destroySurface(SurfaceID sid) {
- return mFlinger->removeSurface(this, sid);
-}
-
-// ---------------------------------------------------------------------------
-
-GraphicBufferAlloc::GraphicBufferAlloc() {}
-
-GraphicBufferAlloc::~GraphicBufferAlloc() {}
-
-sp<GraphicBuffer> GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t usage, status_t* error) {
- sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(w, h, format, usage));
- status_t err = graphicBuffer->initCheck();
- *error = err;
- if (err != 0 || graphicBuffer->handle == 0) {
- if (err == NO_MEMORY) {
- GraphicBuffer::dumpAllocationsToSystemLog();
- }
- ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) "
- "failed (%s), handle=%p",
- w, h, strerror(-err), graphicBuffer->handle);
- return 0;
- }
- return graphicBuffer;
-}
-
-// ---------------------------------------------------------------------------
-
-GraphicPlane::GraphicPlane()
- : mHw(0)
-{
-}
-
-GraphicPlane::~GraphicPlane() {
- delete mHw;
-}
-
-bool GraphicPlane::initialized() const {
- return mHw ? true : false;
-}
-
-int GraphicPlane::getWidth() const {
- return mWidth;
-}
-
-int GraphicPlane::getHeight() const {
- return mHeight;
-}
-
-void GraphicPlane::setDisplayHardware(DisplayHardware *hw)
-{
- mHw = hw;
-
- // initialize the display orientation transform.
- // it's a constant that should come from the display driver.
- int displayOrientation = ISurfaceComposer::eOrientationDefault;
- char property[PROPERTY_VALUE_MAX];
- if (property_get("ro.sf.hwrotation", property, NULL) > 0) {
- //displayOrientation
- switch (atoi(property)) {
- case 90:
- displayOrientation = ISurfaceComposer::eOrientation90;
- break;
- case 270:
- displayOrientation = ISurfaceComposer::eOrientation270;
- break;
- }
- }
-
- const float w = hw->getWidth();
- const float h = hw->getHeight();
- GraphicPlane::orientationToTransfrom(displayOrientation, w, h,
- &mDisplayTransform);
- if (displayOrientation & ISurfaceComposer::eOrientationSwapMask) {
- mDisplayWidth = h;
- mDisplayHeight = w;
- } else {
- mDisplayWidth = w;
- mDisplayHeight = h;
- }
-
- setOrientation(ISurfaceComposer::eOrientationDefault);
-}
-
-status_t GraphicPlane::orientationToTransfrom(
- int orientation, int w, int h, Transform* tr)
-{
- uint32_t flags = 0;
- switch (orientation) {
- case ISurfaceComposer::eOrientationDefault:
- flags = Transform::ROT_0;
- break;
- case ISurfaceComposer::eOrientation90:
- flags = Transform::ROT_90;
- break;
- case ISurfaceComposer::eOrientation180:
- flags = Transform::ROT_180;
- break;
- case ISurfaceComposer::eOrientation270:
- flags = Transform::ROT_270;
- break;
- default:
- return BAD_VALUE;
- }
- tr->set(flags, w, h);
- return NO_ERROR;
-}
-
-status_t GraphicPlane::setOrientation(int orientation)
-{
- // If the rotation can be handled in hardware, this is where
- // the magic should happen.
-
- const DisplayHardware& hw(displayHardware());
- const float w = mDisplayWidth;
- const float h = mDisplayHeight;
- mWidth = int(w);
- mHeight = int(h);
-
- Transform orientationTransform;
- GraphicPlane::orientationToTransfrom(orientation, w, h,
- &orientationTransform);
- if (orientation & ISurfaceComposer::eOrientationSwapMask) {
- mWidth = int(h);
- mHeight = int(w);
- }
-
- mOrientation = orientation;
- mGlobalTransform = mDisplayTransform * orientationTransform;
- return NO_ERROR;
-}
-
-const DisplayHardware& GraphicPlane::displayHardware() const {
- return *mHw;
-}
-
-DisplayHardware& GraphicPlane::editDisplayHardware() {
- return *mHw;
-}
-
-const Transform& GraphicPlane::transform() const {
- return mGlobalTransform;
-}
-
-EGLDisplay GraphicPlane::getEGLDisplay() const {
- return mHw->getEGLDisplay();
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
deleted file mode 100644
index b507877..0000000
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SURFACE_FLINGER_H
-#define ANDROID_SURFACE_FLINGER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <cutils/compiler.h>
-
-#include <utils/Atomic.h>
-#include <utils/Errors.h>
-#include <utils/KeyedVector.h>
-#include <utils/RefBase.h>
-#include <utils/SortedVector.h>
-#include <utils/threads.h>
-
-#include <binder/BinderService.h>
-#include <binder/IMemory.h>
-
-#include <ui/PixelFormat.h>
-#include <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceComposer.h>
-#include <gui/ISurfaceComposerClient.h>
-
-#include "Barrier.h"
-#include "Layer.h"
-
-#include "MessageQueue.h"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class Client;
-class DisplayHardware;
-class DisplayEventConnection;
-class EventThread;
-class Layer;
-class LayerDim;
-class LayerScreenshot;
-struct surface_flinger_cblk_t;
-
-// ---------------------------------------------------------------------------
-
-class Client : public BnSurfaceComposerClient
-{
-public:
- Client(const sp<SurfaceFlinger>& flinger);
- ~Client();
-
- status_t initCheck() const;
-
- // protected by SurfaceFlinger::mStateLock
- size_t attachLayer(const sp<LayerBaseClient>& layer);
- void detachLayer(const LayerBaseClient* layer);
- sp<LayerBaseClient> getLayerUser(int32_t i) const;
-
-private:
- // ISurfaceComposerClient interface
- virtual sp<ISurface> createSurface(
- surface_data_t* params, const String8& name,
- DisplayID display, uint32_t w, uint32_t h,PixelFormat format,
- uint32_t flags);
- virtual status_t destroySurface(SurfaceID surfaceId);
- virtual status_t onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
-
- // constant
- sp<SurfaceFlinger> mFlinger;
-
- // protected by mLock
- DefaultKeyedVector< size_t, wp<LayerBaseClient> > mLayers;
- size_t mNameGenerator;
-
- // thread-safe
- mutable Mutex mLock;
-};
-
-class GraphicBufferAlloc : public BnGraphicBufferAlloc
-{
-public:
- GraphicBufferAlloc();
- virtual ~GraphicBufferAlloc();
- virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t usage, status_t* error);
-};
-
-// ---------------------------------------------------------------------------
-
-class GraphicPlane
-{
-public:
- static status_t orientationToTransfrom(int orientation, int w, int h,
- Transform* tr);
-
- GraphicPlane();
- ~GraphicPlane();
-
- bool initialized() const;
-
- void setDisplayHardware(DisplayHardware *);
- status_t setOrientation(int orientation);
- int getOrientation() const { return mOrientation; }
- int getWidth() const;
- int getHeight() const;
-
- const DisplayHardware& displayHardware() const;
- DisplayHardware& editDisplayHardware();
- const Transform& transform() const;
- EGLDisplay getEGLDisplay() const;
-
-private:
- GraphicPlane(const GraphicPlane&);
- GraphicPlane operator = (const GraphicPlane&);
-
- DisplayHardware* mHw;
- Transform mGlobalTransform;
- Transform mDisplayTransform;
- int mOrientation;
- float mDisplayWidth;
- float mDisplayHeight;
- int mWidth;
- int mHeight;
-};
-
-// ---------------------------------------------------------------------------
-
-enum {
- eTransactionNeeded = 0x01,
- eTraversalNeeded = 0x02
-};
-
-class SurfaceFlinger :
- public BinderService<SurfaceFlinger>,
- public BnSurfaceComposer,
- public IBinder::DeathRecipient,
- protected Thread
-{
-public:
- static char const* getServiceName() { return "SurfaceFlinger"; }
-
- SurfaceFlinger();
- virtual ~SurfaceFlinger();
- void init();
-
- virtual status_t onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
-
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- // ISurfaceComposer interface
- virtual sp<ISurfaceComposerClient> createConnection();
- virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc();
- virtual sp<IMemoryHeap> getCblk() const;
- virtual void bootFinished();
- virtual void setTransactionState(const Vector<ComposerState>& state,
- int orientation, uint32_t flags);
- virtual bool authenticateSurfaceTexture(const sp<ISurfaceTexture>& surface) const;
- virtual sp<IDisplayEventConnection> createDisplayEventConnection();
-
- virtual status_t captureScreen(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* width, uint32_t* height,
- PixelFormat* format, uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ);
-
- virtual status_t turnElectronBeamOff(int32_t mode);
- virtual status_t turnElectronBeamOn(int32_t mode);
-
- void screenReleased(DisplayID dpy);
- void screenAcquired(DisplayID dpy);
-
- status_t renderScreenToTexture(DisplayID dpy,
- GLuint* textureName, GLfloat* uOut, GLfloat* vOut);
- status_t renderScreenToTextureLocked(DisplayID dpy,
- GLuint* textureName, GLfloat* uOut, GLfloat* vOut);
-
- void onMessageReceived(int32_t what);
-
- status_t postMessageAsync(const sp<MessageBase>& msg,
- nsecs_t reltime=0, uint32_t flags = 0);
-
- status_t postMessageSync(const sp<MessageBase>& msg,
- nsecs_t reltime=0, uint32_t flags = 0);
-
- status_t removeLayer(const sp<LayerBase>& layer);
- status_t addLayer(const sp<LayerBase>& layer);
- status_t invalidateLayerVisibility(const sp<LayerBase>& layer);
- void invalidateHwcGeometry();
-
- sp<Layer> getLayer(const sp<ISurface>& sur) const;
-
- GLuint getProtectedTexName() const { return mProtectedTexName; }
-
-
- class MessageDestroyGLTexture : public MessageBase {
- GLuint texture;
- public:
- MessageDestroyGLTexture(GLuint texture) : texture(texture) { }
- virtual bool handler() {
- glDeleteTextures(1, &texture);
- return true;
- }
- };
-
-
-private:
- // DeathRecipient interface
- virtual void binderDied(const wp<IBinder>& who);
-
-private:
- friend class Client;
- friend class DisplayEventConnection;
- friend class LayerBase;
- friend class LayerBaseClient;
- friend class Layer;
-
- sp<ISurface> createSurface(
- ISurfaceComposerClient::surface_data_t* params,
- const String8& name,
- const sp<Client>& client,
- DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
- uint32_t flags);
-
- sp<Layer> createNormalSurface(
- const sp<Client>& client, DisplayID display,
- uint32_t w, uint32_t h, uint32_t flags,
- PixelFormat& format);
-
- sp<LayerDim> createDimSurface(
- const sp<Client>& client, DisplayID display,
- uint32_t w, uint32_t h, uint32_t flags);
-
- sp<LayerScreenshot> createScreenshotSurface(
- const sp<Client>& client, DisplayID display,
- uint32_t w, uint32_t h, uint32_t flags);
-
- status_t removeSurface(const sp<Client>& client, SurfaceID sid);
- status_t destroySurface(const wp<LayerBaseClient>& layer);
- uint32_t setClientStateLocked(const sp<Client>& client, const layer_state_t& s);
-
- class LayerVector : public SortedVector< sp<LayerBase> > {
- public:
- LayerVector() { }
- LayerVector(const LayerVector& rhs) : SortedVector< sp<LayerBase> >(rhs) { }
- virtual int do_compare(const void* lhs, const void* rhs) const {
- const sp<LayerBase>& l(*reinterpret_cast<const sp<LayerBase>*>(lhs));
- const sp<LayerBase>& r(*reinterpret_cast<const sp<LayerBase>*>(rhs));
- // sort layers by Z order
- uint32_t lz = l->currentState().z;
- uint32_t rz = r->currentState().z;
- // then by sequence, so we get a stable ordering
- return (lz != rz) ? (lz - rz) : (l->sequence - r->sequence);
- }
- };
-
- struct State {
- State() {
- orientation = ISurfaceComposer::eOrientationDefault;
- }
- LayerVector layersSortedByZ;
- uint8_t orientation;
- uint8_t orientationFlags;
- };
-
- virtual bool threadLoop();
- virtual status_t readyToRun();
- virtual void onFirstRef();
-
-public: // hack to work around gcc 4.0.3 bug
- const GraphicPlane& graphicPlane(int dpy) const;
- GraphicPlane& graphicPlane(int dpy);
-
- void signalTransaction();
- void signalLayerUpdate();
- void signalRefresh();
- void repaintEverything();
-
-private:
- void waitForEvent();
- void handleConsoleEvents();
- void handleTransaction(uint32_t transactionFlags);
- void handleTransactionLocked(uint32_t transactionFlags);
-
- void computeVisibleRegions(
- const LayerVector& currentLayers,
- Region& dirtyRegion,
- Region& wormholeRegion);
-
- void handlePageFlip();
- bool lockPageFlip(const LayerVector& currentLayers);
- void unlockPageFlip(const LayerVector& currentLayers);
- void handleRefresh();
- void handleWorkList();
- void handleRepaint();
- void postFramebuffer();
- void setupHardwareComposer(Region& dirtyInOut);
- void composeSurfaces(const Region& dirty);
-
-
- void setInvalidateRegion(const Region& reg);
- Region getAndClearInvalidateRegion();
-
- ssize_t addClientLayer(const sp<Client>& client,
- const sp<LayerBaseClient>& lbc);
- status_t addLayer_l(const sp<LayerBase>& layer);
- status_t removeLayer_l(const sp<LayerBase>& layer);
- status_t purgatorizeLayer_l(const sp<LayerBase>& layer);
-
- uint32_t getTransactionFlags(uint32_t flags);
- uint32_t peekTransactionFlags(uint32_t flags);
- uint32_t setTransactionFlags(uint32_t flags);
- void commitTransaction();
-
-
- status_t captureScreenImplLocked(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* width, uint32_t* height, PixelFormat* format,
- uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ);
-
- status_t turnElectronBeamOffImplLocked(int32_t mode);
- status_t turnElectronBeamOnImplLocked(int32_t mode);
- status_t electronBeamOffAnimationImplLocked();
- status_t electronBeamOnAnimationImplLocked();
-
- void debugFlashRegions();
- void drawWormhole() const;
-
- void listLayersLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const;
- void dumpStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const;
- void clearStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const;
- void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const;
-
- mutable MessageQueue mEventQueue;
-
- // access must be protected by mStateLock
- mutable Mutex mStateLock;
- State mCurrentState;
- volatile int32_t mTransactionFlags;
- Condition mTransactionCV;
- SortedVector< sp<LayerBase> > mLayerPurgatory;
- bool mTransationPending;
- Vector< sp<LayerBase> > mLayersPendingRemoval;
-
- // protected by mStateLock (but we could use another lock)
- GraphicPlane mGraphicPlanes[1];
- bool mLayersRemoved;
- DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayerMap;
-
- // access must be protected by mInvalidateLock
- mutable Mutex mInvalidateLock;
- Region mInvalidateRegion;
-
- // constant members (no synchronization needed for access)
- sp<IMemoryHeap> mServerHeap;
- surface_flinger_cblk_t* mServerCblk;
- GLuint mWormholeTexName;
- GLuint mProtectedTexName;
- nsecs_t mBootTime;
- sp<EventThread> mEventThread;
-
- // Can only accessed from the main thread, these members
- // don't need synchronization
- State mDrawingState;
- Region mDirtyRegion;
- Region mDirtyRegionRemovedLayer;
- Region mSwapRegion;
- Region mWormholeRegion;
- bool mVisibleRegionsDirty;
- bool mHwWorkListDirty;
- int32_t mElectronBeamAnimationMode;
- Vector< sp<LayerBase> > mVisibleLayersSortedByZ;
-
-
- // don't use a lock for these, we don't care
- int mDebugRegion;
- int mDebugBackground;
- int mDebugDDMS;
- int mDebugDisableHWC;
- int mDebugDisableTransformHint;
- volatile nsecs_t mDebugInSwapBuffers;
- nsecs_t mLastSwapBufferTime;
- volatile nsecs_t mDebugInTransaction;
- nsecs_t mLastTransactionTime;
- bool mBootFinished;
-
- // these are thread safe
- mutable Barrier mReadyToRunBarrier;
-
-
- // protected by mDestroyedLayerLock;
- mutable Mutex mDestroyedLayerLock;
- Vector<LayerBase const *> mDestroyedLayers;
-
- // atomic variables
- enum {
- eConsoleReleased = 1,
- eConsoleAcquired = 2
- };
- volatile int32_t mConsoleSignals;
-
- // only written in the main thread, only read in other threads
- volatile int32_t mSecureFrameBuffer;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_SURFACE_FLINGER_H
diff --git a/services/surfaceflinger/SurfaceTextureLayer.cpp b/services/surfaceflinger/SurfaceTextureLayer.cpp
deleted file mode 100644
index 49e8e63..0000000
--- a/services/surfaceflinger/SurfaceTextureLayer.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-
-#include "Layer.h"
-#include "SurfaceTextureLayer.h"
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-
-SurfaceTextureLayer::SurfaceTextureLayer(GLuint tex, const sp<Layer>& layer)
- : SurfaceTexture(tex, true, GL_TEXTURE_EXTERNAL_OES, false), mLayer(layer) {
-}
-
-SurfaceTextureLayer::~SurfaceTextureLayer() {
-}
-
-
-status_t SurfaceTextureLayer::setDefaultBufferSize(uint32_t w, uint32_t h)
-{
- //ALOGD("%s, w=%u, h=%u", __PRETTY_FUNCTION__, w, h);
- return SurfaceTexture::setDefaultBufferSize(w, h);
-}
-
-status_t SurfaceTextureLayer::setDefaultBufferFormat(uint32_t format)
-{
- mDefaultFormat = format;
- return NO_ERROR;
-}
-
-status_t SurfaceTextureLayer::setBufferCount(int bufferCount) {
- status_t res = SurfaceTexture::setBufferCount(bufferCount);
- return res;
-}
-
-status_t SurfaceTextureLayer::queueBuffer(int buf, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
-
- status_t res = SurfaceTexture::queueBuffer(buf, timestamp,
- outWidth, outHeight, outTransform);
- sp<Layer> layer(mLayer.promote());
- if (layer != NULL) {
- *outTransform = layer->getTransformHint();
- }
- return res;
-}
-
-status_t SurfaceTextureLayer::dequeueBuffer(int *buf,
- uint32_t w, uint32_t h, uint32_t format, uint32_t usage) {
-
- status_t res(NO_INIT);
- sp<Layer> layer(mLayer.promote());
- if (layer != NULL) {
- if (format == 0)
- format = mDefaultFormat;
- uint32_t effectiveUsage = layer->getEffectiveUsage(usage);
- //ALOGD("%s, w=%u, h=%u, format=%u, usage=%08x, effectiveUsage=%08x",
- // __PRETTY_FUNCTION__, w, h, format, usage, effectiveUsage);
- res = SurfaceTexture::dequeueBuffer(buf, w, h, format, effectiveUsage);
- }
- return res;
-}
-
-status_t SurfaceTextureLayer::connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
- status_t err = SurfaceTexture::connect(api,
- outWidth, outHeight, outTransform);
- if (err == NO_ERROR) {
- sp<Layer> layer(mLayer.promote());
- if (layer != NULL) {
- uint32_t orientation = layer->getOrientation();
- if (orientation & Transform::ROT_INVALID) {
- orientation = 0;
- }
- *outTransform = orientation;
- }
- switch(api) {
- case NATIVE_WINDOW_API_CPU:
- // SurfaceTextureClient supports only 2 buffers for CPU connections
- this->setBufferCountServer(2);
- break;
- case NATIVE_WINDOW_API_MEDIA:
- case NATIVE_WINDOW_API_CAMERA:
- // Camera preview and videos are rate-limited on the producer
- // side. If enabled for this build, we use async mode to always
- // show the most recent frame at the cost of requiring an
- // additional buffer.
-#ifndef NEVER_DEFAULT_TO_ASYNC_MODE
- err = setSynchronousMode(false);
- break;
-#endif
- // fall through to set synchronous mode when not defaulting to
- // async mode.
- deafult:
- err = setSynchronousMode(true);
- break;
- }
- if (err != NO_ERROR) {
- disconnect(api);
- }
- }
- return err;
-}
-
-// ---------------------------------------------------------------------------
-}; // namespace android
diff --git a/services/surfaceflinger/SurfaceTextureLayer.h b/services/surfaceflinger/SurfaceTextureLayer.h
deleted file mode 100644
index 9508524..0000000
--- a/services/surfaceflinger/SurfaceTextureLayer.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SURFACE_TEXTURE_LAYER_H
-#define ANDROID_SURFACE_TEXTURE_LAYER_H
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <gui/SurfaceTexture.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Layer;
-
-class SurfaceTextureLayer : public SurfaceTexture
-{
- wp<Layer> mLayer;
- uint32_t mDefaultFormat;
-
-public:
- SurfaceTextureLayer(GLuint tex, const sp<Layer>& layer);
- ~SurfaceTextureLayer();
-
- status_t setDefaultBufferSize(uint32_t w, uint32_t h);
- status_t setDefaultBufferFormat(uint32_t format);
-
-public:
- virtual status_t setBufferCount(int bufferCount);
-
-protected:
- virtual status_t queueBuffer(int buf, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
-
- virtual status_t dequeueBuffer(int *buf, uint32_t w, uint32_t h,
- uint32_t format, uint32_t usage);
-
- virtual status_t connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_SURFACE_TEXTURE_LAYER_H
diff --git a/services/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp
deleted file mode 100644
index ca3fa6e..0000000
--- a/services/surfaceflinger/Transform.cpp
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <math.h>
-
-#include <cutils/compiler.h>
-#include <utils/String8.h>
-#include <ui/Region.h>
-
-#include "clz.h"
-#include "Transform.h"
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-Transform::Transform() {
- reset();
-}
-
-Transform::Transform(const Transform& other)
- : mMatrix(other.mMatrix), mType(other.mType) {
-}
-
-Transform::Transform(uint32_t orientation) {
- set(orientation, 0, 0);
-}
-
-Transform::~Transform() {
-}
-
-static const float EPSILON = 0.0f;
-
-bool Transform::isZero(float f) {
- return fabs(f) <= EPSILON;
-}
-
-bool Transform::absIsOne(float f) {
- return isZero(fabs(f) - 1.0f);
-}
-
-Transform Transform::operator * (const Transform& rhs) const
-{
- if (CC_LIKELY(mType == IDENTITY))
- return rhs;
-
- Transform r(*this);
- if (rhs.mType == IDENTITY)
- return r;
-
- // TODO: we could use mType to optimize the matrix multiply
- const mat33& A(mMatrix);
- const mat33& B(rhs.mMatrix);
- mat33& D(r.mMatrix);
- for (int i=0 ; i<3 ; i++) {
- const float v0 = A[0][i];
- const float v1 = A[1][i];
- const float v2 = A[2][i];
- D[0][i] = v0*B[0][0] + v1*B[0][1] + v2*B[0][2];
- D[1][i] = v0*B[1][0] + v1*B[1][1] + v2*B[1][2];
- D[2][i] = v0*B[2][0] + v1*B[2][1] + v2*B[2][2];
- }
- r.mType |= rhs.mType;
-
- // TODO: we could recompute this value from r and rhs
- r.mType &= 0xFF;
- r.mType |= UNKNOWN_TYPE;
- return r;
-}
-
-float const* Transform::operator [] (int i) const {
- return mMatrix[i].v;
-}
-
-bool Transform::transformed() const {
- return type() > TRANSLATE;
-}
-
-float Transform::tx() const {
- return mMatrix[2][0];
-}
-
-float Transform::ty() const {
- return mMatrix[2][1];
-}
-
-void Transform::reset() {
- mType = IDENTITY;
- for(int i=0 ; i<3 ; i++) {
- vec3& v(mMatrix[i]);
- for (int j=0 ; j<3 ; j++)
- v[j] = ((i==j) ? 1.0f : 0.0f);
- }
-}
-
-void Transform::set(float tx, float ty)
-{
- mMatrix[2][0] = tx;
- mMatrix[2][1] = ty;
- mMatrix[2][2] = 1.0f;
-
- if (isZero(tx) && isZero(ty)) {
- mType &= ~TRANSLATE;
- } else {
- mType |= TRANSLATE;
- }
-}
-
-void Transform::set(float a, float b, float c, float d)
-{
- mat33& M(mMatrix);
- M[0][0] = a; M[1][0] = b;
- M[0][1] = c; M[1][1] = d;
- M[0][2] = 0; M[1][2] = 0;
- mType = UNKNOWN_TYPE;
-}
-
-status_t Transform::set(uint32_t flags, float w, float h)
-{
- if (flags & ROT_INVALID) {
- // that's not allowed!
- reset();
- return BAD_VALUE;
- }
-
- Transform H, V, R;
- if (flags & ROT_90) {
- // w & h are inverted when rotating by 90 degrees
- swap(w, h);
- }
-
- if (flags & FLIP_H) {
- H.mType = (FLIP_H << 8) | SCALE;
- H.mType |= isZero(w) ? IDENTITY : TRANSLATE;
- mat33& M(H.mMatrix);
- M[0][0] = -1;
- M[2][0] = w;
- }
-
- if (flags & FLIP_V) {
- V.mType = (FLIP_V << 8) | SCALE;
- V.mType |= isZero(h) ? IDENTITY : TRANSLATE;
- mat33& M(V.mMatrix);
- M[1][1] = -1;
- M[2][1] = h;
- }
-
- if (flags & ROT_90) {
- const float original_w = h;
- R.mType = (ROT_90 << 8) | ROTATE;
- R.mType |= isZero(original_w) ? IDENTITY : TRANSLATE;
- mat33& M(R.mMatrix);
- M[0][0] = 0; M[1][0] =-1; M[2][0] = original_w;
- M[0][1] = 1; M[1][1] = 0;
- }
-
- *this = (R*(H*V));
- return NO_ERROR;
-}
-
-Transform::vec2 Transform::transform(const vec2& v) const {
- vec2 r;
- const mat33& M(mMatrix);
- r[0] = M[0][0]*v[0] + M[1][0]*v[1] + M[2][0];
- r[1] = M[0][1]*v[0] + M[1][1]*v[1] + M[2][1];
- return r;
-}
-
-Transform::vec3 Transform::transform(const vec3& v) const {
- vec3 r;
- const mat33& M(mMatrix);
- r[0] = M[0][0]*v[0] + M[1][0]*v[1] + M[2][0]*v[2];
- r[1] = M[0][1]*v[0] + M[1][1]*v[1] + M[2][1]*v[2];
- r[2] = M[0][2]*v[0] + M[1][2]*v[1] + M[2][2]*v[2];
- return r;
-}
-
-void Transform::transform(float* point, int x, int y) const
-{
- const mat33& M(mMatrix);
- vec2 v(x, y);
- v = transform(v);
- point[0] = v[0];
- point[1] = v[1];
-}
-
-Rect Transform::makeBounds(int w, int h) const
-{
- return transform( Rect(w, h) );
-}
-
-Rect Transform::transform(const Rect& bounds) const
-{
- Rect r;
- vec2 lt( bounds.left, bounds.top );
- vec2 rt( bounds.right, bounds.top );
- vec2 lb( bounds.left, bounds.bottom );
- vec2 rb( bounds.right, bounds.bottom );
-
- lt = transform(lt);
- rt = transform(rt);
- lb = transform(lb);
- rb = transform(rb);
-
- r.left = floorf(min(lt[0], rt[0], lb[0], rb[0]) + 0.5f);
- r.top = floorf(min(lt[1], rt[1], lb[1], rb[1]) + 0.5f);
- r.right = floorf(max(lt[0], rt[0], lb[0], rb[0]) + 0.5f);
- r.bottom = floorf(max(lt[1], rt[1], lb[1], rb[1]) + 0.5f);
-
- return r;
-}
-
-Region Transform::transform(const Region& reg) const
-{
- Region out;
- if (CC_UNLIKELY(transformed())) {
- if (CC_LIKELY(preserveRects())) {
- Region::const_iterator it = reg.begin();
- Region::const_iterator const end = reg.end();
- while (it != end) {
- out.orSelf(transform(*it++));
- }
- } else {
- out.set(transform(reg.bounds()));
- }
- } else {
- int xpos = floorf(tx() + 0.5f);
- int ypos = floorf(ty() + 0.5f);
- out = reg.translate(xpos, ypos);
- }
- return out;
-}
-
-uint32_t Transform::type() const
-{
- if (mType & UNKNOWN_TYPE) {
- // recompute what this transform is
-
- const mat33& M(mMatrix);
- const float a = M[0][0];
- const float b = M[1][0];
- const float c = M[0][1];
- const float d = M[1][1];
- const float x = M[2][0];
- const float y = M[2][1];
-
- bool scale = false;
- uint32_t flags = ROT_0;
- if (isZero(b) && isZero(c)) {
- if (a<0) flags |= FLIP_H;
- if (d<0) flags |= FLIP_V;
- if (!absIsOne(a) || !absIsOne(d)) {
- scale = true;
- }
- } else if (isZero(a) && isZero(d)) {
- flags |= ROT_90;
- if (b>0) flags |= FLIP_V;
- if (c<0) flags |= FLIP_H;
- if (!absIsOne(b) || !absIsOne(c)) {
- scale = true;
- }
- } else {
- // there is a skew component and/or a non 90 degrees rotation
- flags = ROT_INVALID;
- }
-
- mType = flags << 8;
- if (flags & ROT_INVALID) {
- mType |= UNKNOWN;
- } else {
- if ((flags & ROT_90) || ((flags & ROT_180) == ROT_180))
- mType |= ROTATE;
- if (flags & FLIP_H)
- mType ^= SCALE;
- if (flags & FLIP_V)
- mType ^= SCALE;
- if (scale)
- mType |= SCALE;
- }
-
- if (!isZero(x) || !isZero(y))
- mType |= TRANSLATE;
- }
- return mType;
-}
-
-uint32_t Transform::getType() const {
- return type() & 0xFF;
-}
-
-uint32_t Transform::getOrientation() const
-{
- return (type() >> 8) & 0xFF;
-}
-
-bool Transform::preserveRects() const
-{
- return (getOrientation() & ROT_INVALID) ? false : true;
-}
-
-void Transform::dump(const char* name) const
-{
- type(); // updates the type
-
- String8 flags, type;
- const mat33& m(mMatrix);
- uint32_t orient = mType >> 8;
-
- if (orient&ROT_INVALID) {
- flags.append("ROT_INVALID ");
- } else {
- if (orient&ROT_90) {
- flags.append("ROT_90 ");
- } else {
- flags.append("ROT_0 ");
- }
- if (orient&FLIP_V)
- flags.append("FLIP_V ");
- if (orient&FLIP_H)
- flags.append("FLIP_H ");
- }
-
- if (!(mType&(SCALE|ROTATE|TRANSLATE)))
- type.append("IDENTITY ");
- if (mType&SCALE)
- type.append("SCALE ");
- if (mType&ROTATE)
- type.append("ROTATE ");
- if (mType&TRANSLATE)
- type.append("TRANSLATE ");
-
- ALOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string());
- ALOGD("%.4f %.4f %.4f", m[0][0], m[1][0], m[2][0]);
- ALOGD("%.4f %.4f %.4f", m[0][1], m[1][1], m[2][1]);
- ALOGD("%.4f %.4f %.4f", m[0][2], m[1][2], m[2][2]);
-}
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/services/surfaceflinger/Transform.h b/services/surfaceflinger/Transform.h
deleted file mode 100644
index ec74243..0000000
--- a/services/surfaceflinger/Transform.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_TRANSFORM_H
-#define ANDROID_TRANSFORM_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/Point.h>
-#include <ui/Rect.h>
-
-#include <hardware/hardware.h>
-
-namespace android {
-
-class Region;
-
-// ---------------------------------------------------------------------------
-
-class Transform
-{
-public:
- Transform();
- Transform(const Transform& other);
- explicit Transform(uint32_t orientation);
- ~Transform();
-
- enum orientation_flags {
- ROT_0 = 0x00000000,
- FLIP_H = HAL_TRANSFORM_FLIP_H,
- FLIP_V = HAL_TRANSFORM_FLIP_V,
- ROT_90 = HAL_TRANSFORM_ROT_90,
- ROT_180 = FLIP_H|FLIP_V,
- ROT_270 = ROT_180|ROT_90,
- ROT_INVALID = 0x80
- };
-
- enum type_mask {
- IDENTITY = 0,
- TRANSLATE = 0x1,
- ROTATE = 0x2,
- SCALE = 0x4,
- UNKNOWN = 0x8
- };
-
- // query the transform
- bool transformed() const;
- bool preserveRects() const;
- uint32_t getType() const;
- uint32_t getOrientation() const;
-
- float const* operator [] (int i) const; // returns column i
- float tx() const;
- float ty() const;
-
- // modify the transform
- void reset();
- void set(float tx, float ty);
- void set(float a, float b, float c, float d);
- status_t set(uint32_t flags, float w, float h);
-
- // transform data
- Rect makeBounds(int w, int h) const;
- void transform(float* point, int x, int y) const;
- Region transform(const Region& reg) const;
- Transform operator * (const Transform& rhs) const;
-
- // for debugging
- void dump(const char* name) const;
-
-private:
- struct vec3 {
- float v[3];
- inline vec3() { }
- inline vec3(float a, float b, float c) {
- v[0] = a; v[1] = b; v[2] = c;
- }
- inline float operator [] (int i) const { return v[i]; }
- inline float& operator [] (int i) { return v[i]; }
- };
- struct vec2 {
- float v[2];
- inline vec2() { }
- inline vec2(float a, float b) {
- v[0] = a; v[1] = b;
- }
- inline float operator [] (int i) const { return v[i]; }
- inline float& operator [] (int i) { return v[i]; }
- };
- struct mat33 {
- vec3 v[3];
- inline const vec3& operator [] (int i) const { return v[i]; }
- inline vec3& operator [] (int i) { return v[i]; }
- };
-
- enum { UNKNOWN_TYPE = 0x80000000 };
-
- // assumes the last row is < 0 , 0 , 1 >
- vec2 transform(const vec2& v) const;
- vec3 transform(const vec3& v) const;
- Rect transform(const Rect& bounds) const;
- uint32_t type() const;
- static bool absIsOne(float f);
- static bool isZero(float f);
-
- mat33 mMatrix;
- mutable uint32_t mType;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif /* ANDROID_TRANSFORM_H */
diff --git a/services/surfaceflinger/clz.cpp b/services/surfaceflinger/clz.cpp
deleted file mode 100644
index 2456b86..0000000
--- a/services/surfaceflinger/clz.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include "clz.h"
-
-namespace android {
-
-int clz_impl(int32_t x)
-{
-#if defined(__arm__) && !defined(__thumb__)
- return __builtin_clz(x);
-#else
- if (!x) return 32;
- int e = 31;
- if (x&0xFFFF0000) { e -=16; x >>=16; }
- if (x&0x0000FF00) { e -= 8; x >>= 8; }
- if (x&0x000000F0) { e -= 4; x >>= 4; }
- if (x&0x0000000C) { e -= 2; x >>= 2; }
- if (x&0x00000002) { e -= 1; }
- return e;
-#endif
-}
-
-}; // namespace android
diff --git a/services/surfaceflinger/clz.h b/services/surfaceflinger/clz.h
deleted file mode 100644
index a4c5262..0000000
--- a/services/surfaceflinger/clz.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#ifndef ANDROID_SURFACE_FLINGER_CLZ_H
-
-#include <stdint.h>
-
-namespace android {
-
-int inline clz(int32_t x) {
- return __builtin_clz(x);
-}
-
-template <typename T>
-static inline T min(T a, T b) {
- return a<b ? a : b;
-}
-template <typename T>
-static inline T min(T a, T b, T c) {
- return min(a, min(b, c));
-}
-template <typename T>
-static inline T min(T a, T b, T c, T d) {
- return min(a, b, min(c, d));
-}
-
-template <typename T>
-static inline T max(T a, T b) {
- return a>b ? a : b;
-}
-template <typename T>
-static inline T max(T a, T b, T c) {
- return max(a, max(b, c));
-}
-template <typename T>
-static inline T max(T a, T b, T c, T d) {
- return max(a, b, max(c, d));
-}
-
-template <typename T>
-static inline
-void swap(T& a, T& b) {
- T t(a);
- a = b;
- b = t;
-}
-
-
-}; // namespace android
-
-#endif /* ANDROID_SURFACE_FLINGER_CLZ_H */
diff --git a/services/surfaceflinger/tests/Android.mk b/services/surfaceflinger/tests/Android.mk
deleted file mode 100644
index b655648..0000000
--- a/services/surfaceflinger/tests/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Build the unit tests,
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := SurfaceFlinger_test
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- Transaction_test.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- libEGL \
- libGLESv2 \
- libandroid \
- libbinder \
- libcutils \
- libgui \
- libstlport \
- libui \
- libutils \
-
-LOCAL_C_INCLUDES := \
- bionic \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport \
-
-# Build the binary to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
-# to integrate with auto-test framework.
-include $(BUILD_NATIVE_TEST)
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
deleted file mode 100644
index 84ae0d9..0000000
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <binder/IMemory.h>
-
-#include <gui/ISurfaceComposer.h>
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-#include <private/gui/ComposerService.h>
-
-#include <utils/String8.h>
-
-namespace android {
-
-// Fill an RGBA_8888 formatted surface with a single color.
-static void fillSurfaceRGBA8(const sp<SurfaceControl>& sc,
- uint8_t r, uint8_t g, uint8_t b) {
- Surface::SurfaceInfo info;
- sp<Surface> s = sc->getSurface();
- ASSERT_TRUE(s != NULL);
- ASSERT_EQ(NO_ERROR, s->lock(&info));
- uint8_t* img = reinterpret_cast<uint8_t*>(info.bits);
- for (uint32_t y = 0; y < info.h; y++) {
- for (uint32_t x = 0; x < info.w; x++) {
- uint8_t* pixel = img + (4 * (y*info.s + x));
- pixel[0] = r;
- pixel[1] = g;
- pixel[2] = b;
- pixel[3] = 255;
- }
- }
- ASSERT_EQ(NO_ERROR, s->unlockAndPost());
-}
-
-// A ScreenCapture is a screenshot from SurfaceFlinger that can be used to check
-// individual pixel values for testing purposes.
-class ScreenCapture : public RefBase {
-public:
- static void captureScreen(sp<ScreenCapture>* sc) {
- sp<IMemoryHeap> heap;
- uint32_t w=0, h=0;
- PixelFormat fmt=0;
- sp<ISurfaceComposer> sf(ComposerService::getComposerService());
- ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt, 0, 0,
- 0, INT_MAX));
- ASSERT_TRUE(heap != NULL);
- ASSERT_EQ(PIXEL_FORMAT_RGBA_8888, fmt);
- *sc = new ScreenCapture(w, h, heap);
- }
-
- void checkPixel(uint32_t x, uint32_t y, uint8_t r, uint8_t g, uint8_t b) {
- const uint8_t* img = reinterpret_cast<const uint8_t*>(mHeap->base());
- const uint8_t* pixel = img + (4 * (y*mWidth + x));
- if (r != pixel[0] || g != pixel[1] || b != pixel[2]) {
- String8 err(String8::format("pixel @ (%3d, %3d): "
- "expected [%3d, %3d, %3d], got [%3d, %3d, %3d]",
- x, y, r, g, b, pixel[0], pixel[1], pixel[2]));
- EXPECT_EQ(String8(), err);
- }
- }
-
-private:
- ScreenCapture(uint32_t w, uint32_t h, const sp<IMemoryHeap>& heap) :
- mWidth(w),
- mHeight(h),
- mHeap(heap)
- {}
-
- const uint32_t mWidth;
- const uint32_t mHeight;
- sp<IMemoryHeap> mHeap;
-};
-
-class LayerUpdateTest : public ::testing::Test {
-protected:
- virtual void SetUp() {
- mComposerClient = new SurfaceComposerClient;
- ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
-
- ssize_t displayWidth = mComposerClient->getDisplayWidth(0);
- ssize_t displayHeight = mComposerClient->getDisplayHeight(0);
-
- // Background surface
- mBGSurfaceControl = mComposerClient->createSurface(
- String8("BG Test Surface"), 0, displayWidth, displayHeight,
- PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mBGSurfaceControl != NULL);
- ASSERT_TRUE(mBGSurfaceControl->isValid());
- fillSurfaceRGBA8(mBGSurfaceControl, 63, 63, 195);
-
- // Foreground surface
- mFGSurfaceControl = mComposerClient->createSurface(
- String8("FG Test Surface"), 0, 64, 64, PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mFGSurfaceControl != NULL);
- ASSERT_TRUE(mFGSurfaceControl->isValid());
-
- fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
-
- // Synchronization surface
- mSyncSurfaceControl = mComposerClient->createSurface(
- String8("Sync Test Surface"), 0, 1, 1, PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mSyncSurfaceControl != NULL);
- ASSERT_TRUE(mSyncSurfaceControl->isValid());
-
- fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
-
- SurfaceComposerClient::openGlobalTransaction();
-
- ASSERT_EQ(NO_ERROR, mBGSurfaceControl->setLayer(INT_MAX-2));
- ASSERT_EQ(NO_ERROR, mBGSurfaceControl->show());
-
- ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setLayer(INT_MAX-1));
- ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setPosition(64, 64));
- ASSERT_EQ(NO_ERROR, mFGSurfaceControl->show());
-
- ASSERT_EQ(NO_ERROR, mSyncSurfaceControl->setLayer(INT_MAX-1));
- ASSERT_EQ(NO_ERROR, mSyncSurfaceControl->setPosition(displayWidth-2,
- displayHeight-2));
- ASSERT_EQ(NO_ERROR, mSyncSurfaceControl->show());
-
- SurfaceComposerClient::closeGlobalTransaction(true);
- }
-
- virtual void TearDown() {
- mComposerClient->dispose();
- mBGSurfaceControl = 0;
- mFGSurfaceControl = 0;
- mSyncSurfaceControl = 0;
- mComposerClient = 0;
- }
-
- void waitForPostedBuffers() {
- // Since the sync surface is in synchronous mode (i.e. double buffered)
- // posting three buffers to it should ensure that at least two
- // SurfaceFlinger::handlePageFlip calls have been made, which should
- // guaranteed that a buffer posted to another Surface has been retired.
- fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
- fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
- fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
- }
-
- sp<SurfaceComposerClient> mComposerClient;
- sp<SurfaceControl> mBGSurfaceControl;
- sp<SurfaceControl> mFGSurfaceControl;
-
- // This surface is used to ensure that the buffers posted to
- // mFGSurfaceControl have been picked up by SurfaceFlinger.
- sp<SurfaceControl> mSyncSurfaceControl;
-};
-
-TEST_F(LayerUpdateTest, LayerMoveWorks) {
- sp<ScreenCapture> sc;
- {
- SCOPED_TRACE("before move");
- ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 0, 12, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
- }
-
- SurfaceComposerClient::openGlobalTransaction();
- ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setPosition(128, 128));
- SurfaceComposerClient::closeGlobalTransaction(true);
- {
- // This should reflect the new position, but not the new color.
- SCOPED_TRACE("after move, before redraw");
- ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 195, 63, 63);
- }
-
- fillSurfaceRGBA8(mFGSurfaceControl, 63, 195, 63);
- waitForPostedBuffers();
- {
- // This should reflect the new position and the new color.
- SCOPED_TRACE("after redraw");
- ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 195, 63);
- }
-}
-
-TEST_F(LayerUpdateTest, LayerResizeWorks) {
- sp<ScreenCapture> sc;
- {
- SCOPED_TRACE("before resize");
- ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 0, 12, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
- }
-
- ALOGD("resizing");
- SurfaceComposerClient::openGlobalTransaction();
- ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setSize(128, 128));
- SurfaceComposerClient::closeGlobalTransaction(true);
- ALOGD("resized");
- {
- // This should not reflect the new size or color because SurfaceFlinger
- // has not yet received a buffer of the correct size.
- SCOPED_TRACE("after resize, before redraw");
- ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 0, 12, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
- }
-
- ALOGD("drawing");
- fillSurfaceRGBA8(mFGSurfaceControl, 63, 195, 63);
- waitForPostedBuffers();
- ALOGD("drawn");
- {
- // This should reflect the new size and the new color.
- SCOPED_TRACE("after redraw");
- ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 195, 63);
- sc->checkPixel(145, 145, 63, 195, 63);
- }
-}
-
-}
diff --git a/services/surfaceflinger/tests/resize/Android.mk b/services/surfaceflinger/tests/resize/Android.mk
deleted file mode 100644
index d81679e..0000000
--- a/services/surfaceflinger/tests/resize/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- resize.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui \
- libgui
-
-LOCAL_MODULE:= test-resize
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/resize/resize.cpp b/services/surfaceflinger/tests/resize/resize.cpp
deleted file mode 100644
index c143b3d..0000000
--- a/services/surfaceflinger/tests/resize/resize.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <cutils/memory.h>
-
-#include <utils/Log.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-
-using namespace android;
-
-namespace android {
-
-int main(int argc, char** argv)
-{
- // set up the thread-pool
- sp<ProcessState> proc(ProcessState::self());
- ProcessState::self()->startThreadPool();
-
- // create a client to surfaceflinger
- sp<SurfaceComposerClient> client = new SurfaceComposerClient();
-
- sp<Surface> surface = client->createSurface(0, 160, 240,
- PIXEL_FORMAT_RGB_565);
-
-
- SurfaceComposerClient::openGlobalTransaction();
- surface->setLayer(100000);
- SurfaceComposerClient::closeGlobalTransaction();
-
- Surface::SurfaceInfo info;
- surface->lock(&info);
- ssize_t bpr = info.s * bytesPerPixel(info.format);
- android_memset16((uint16_t*)info.bits, 0xF800, bpr*info.h);
- surface->unlockAndPost();
-
- surface->lock(&info);
- android_memset16((uint16_t*)info.bits, 0x07E0, bpr*info.h);
- surface->unlockAndPost();
-
- SurfaceComposerClient::openGlobalTransaction();
- surface->setSize(320, 240);
- SurfaceComposerClient::closeGlobalTransaction();
-
-
- IPCThreadState::self()->joinThreadPool();
-
- return 0;
-}
diff --git a/services/surfaceflinger/tests/screencap/Android.mk b/services/surfaceflinger/tests/screencap/Android.mk
deleted file mode 100644
index 5cdd1a8..0000000
--- a/services/surfaceflinger/tests/screencap/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- screencap.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libbinder \
- libskia \
- libui \
- libgui
-
-LOCAL_MODULE:= test-screencap
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_C_INCLUDES += \
- external/skia/include/core \
- external/skia/include/effects \
- external/skia/include/images \
- external/skia/src/ports \
- external/skia/include/utils
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/screencap/screencap.cpp b/services/surfaceflinger/tests/screencap/screencap.cpp
deleted file mode 100644
index 53566e0..0000000
--- a/services/surfaceflinger/tests/screencap/screencap.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/Log.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-#include <binder/IMemory.h>
-#include <gui/ISurfaceComposer.h>
-
-#include <SkImageEncoder.h>
-#include <SkBitmap.h>
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- if (argc != 2) {
- printf("usage: %s path\n", argv[0]);
- exit(0);
- }
-
- const String16 name("SurfaceFlinger");
- sp<ISurfaceComposer> composer;
- getService(name, &composer);
-
- sp<IMemoryHeap> heap;
- uint32_t w, h;
- PixelFormat f;
- status_t err = composer->captureScreen(0, &heap, &w, &h, &f, 0, 0);
- if (err != NO_ERROR) {
- fprintf(stderr, "screen capture failed: %s\n", strerror(-err));
- exit(0);
- }
-
- printf("screen capture success: w=%u, h=%u, pixels=%p\n",
- w, h, heap->getBase());
-
- printf("saving file as PNG in %s ...\n", argv[1]);
-
- SkBitmap b;
- b.setConfig(SkBitmap::kARGB_8888_Config, w, h);
- b.setPixels(heap->getBase());
- SkImageEncoder::EncodeFile(argv[1], b,
- SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality);
-
- return 0;
-}
diff --git a/services/surfaceflinger/tests/surface/Android.mk b/services/surfaceflinger/tests/surface/Android.mk
deleted file mode 100644
index c59060e..0000000
--- a/services/surfaceflinger/tests/surface/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- surface.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libbinder \
- libui \
- libgui
-
-LOCAL_MODULE:= test-surface
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/surface/surface.cpp b/services/surfaceflinger/tests/surface/surface.cpp
deleted file mode 100644
index a8878f7..0000000
--- a/services/surfaceflinger/tests/surface/surface.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <cutils/memory.h>
-
-#include <utils/Log.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- // set up the thread-pool
- sp<ProcessState> proc(ProcessState::self());
- ProcessState::self()->startThreadPool();
-
- // create a client to surfaceflinger
- sp<SurfaceComposerClient> client = new SurfaceComposerClient();
-
- sp<SurfaceControl> surfaceControl = client->createSurface(
- 0, 160, 240, PIXEL_FORMAT_RGB_565);
- SurfaceComposerClient::openGlobalTransaction();
- surfaceControl->setLayer(100000);
- SurfaceComposerClient::closeGlobalTransaction();
-
- // pretend it went cross-process
- Parcel parcel;
- SurfaceControl::writeSurfaceToParcel(surfaceControl, &parcel);
- parcel.setDataPosition(0);
- sp<Surface> surface = Surface::readFromParcel(parcel);
- ANativeWindow* window = surface.get();
-
- printf("window=%p\n", window);
-
- int err = native_window_set_buffer_count(window, 8);
- ANativeWindowBuffer* buffer;
-
- for (int i=0 ; i<8 ; i++) {
- window->dequeueBuffer(window, &buffer);
- printf("buffer %d: %p\n", i, buffer);
- }
-
- printf("test complete. CTRL+C to finish.\n");
-
- IPCThreadState::self()->joinThreadPool();
- return 0;
-}
diff --git a/services/surfaceflinger/tests/transform/Android.mk b/services/surfaceflinger/tests/transform/Android.mk
deleted file mode 100644
index 6219dae..0000000
--- a/services/surfaceflinger/tests/transform/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- TransformTest.cpp \
- ../../Transform.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui \
-
-LOCAL_MODULE:= test-transform
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_C_INCLUDES += ../..
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/transform/TransformTest.cpp b/services/surfaceflinger/tests/transform/TransformTest.cpp
deleted file mode 100644
index e112c4e..0000000
--- a/services/surfaceflinger/tests/transform/TransformTest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * 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.
- */
-
-#include <utils/Errors.h>
-#include "../../Transform.h"
-
-using namespace android;
-
-int main(int argc, char **argv)
-{
- Transform tr90(Transform::ROT_90);
- Transform trFH(Transform::FLIP_H);
- Transform trFV(Transform::FLIP_V);
-
- Transform tr90FH(Transform::ROT_90 | Transform::FLIP_H);
- Transform tr90FV(Transform::ROT_90 | Transform::FLIP_V);
-
- tr90.dump("tr90");
- trFH.dump("trFH");
- trFV.dump("trFV");
-
- tr90FH.dump("tr90FH");
- tr90FV.dump("tr90FV");
-
- (trFH*tr90).dump("trFH*tr90");
- (trFV*tr90).dump("trFV*tr90");
-
- (tr90*trFH).dump("tr90*trFH");
- (tr90*trFV).dump("tr90*trFV");
-
- return 0;
-}
diff --git a/services/surfaceflinger/tests/vsync/Android.mk b/services/surfaceflinger/tests/vsync/Android.mk
deleted file mode 100644
index 9181760..0000000
--- a/services/surfaceflinger/tests/vsync/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- vsync.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libbinder \
- libui \
- libgui
-
-LOCAL_MODULE:= test-vsync-events
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/vsync/vsync.cpp b/services/surfaceflinger/tests/vsync/vsync.cpp
deleted file mode 100644
index b0d54c4..0000000
--- a/services/surfaceflinger/tests/vsync/vsync.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * 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.
- */
-
-#include <gui/DisplayEventReceiver.h>
-#include <utils/Looper.h>
-
-using namespace android;
-
-int receiver(int fd, int events, void* data)
-{
- DisplayEventReceiver* q = (DisplayEventReceiver*)data;
-
- ssize_t n;
- DisplayEventReceiver::Event buffer[1];
-
- static nsecs_t oldTimeStamp = 0;
-
- while ((n = q->getEvents(buffer, 1)) > 0) {
- for (int i=0 ; i<n ; i++) {
- if (buffer[i].header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) {
- printf("event vsync: count=%d\t", buffer[i].vsync.count);
- }
- if (oldTimeStamp) {
- float t = float(buffer[i].header.timestamp - oldTimeStamp) / s2ns(1);
- printf("%f ms (%f Hz)\n", t*1000, 1.0/t);
- }
- oldTimeStamp = buffer[i].header.timestamp;
- }
- }
- if (n<0) {
- printf("error reading events (%s)\n", strerror(-n));
- }
- return 1;
-}
-
-int main(int argc, char** argv)
-{
- DisplayEventReceiver myDisplayEvent;
-
-
- sp<Looper> loop = new Looper(false);
- loop->addFd(myDisplayEvent.getFd(), 0, ALOOPER_EVENT_INPUT, receiver,
- &myDisplayEvent);
-
- myDisplayEvent.setVsyncRate(1);
-
- do {
- //printf("about to poll...\n");
- int32_t ret = loop->pollOnce(-1);
- switch (ret) {
- case ALOOPER_POLL_WAKE:
- //("ALOOPER_POLL_WAKE\n");
- break;
- case ALOOPER_POLL_CALLBACK:
- //("ALOOPER_POLL_CALLBACK\n");
- break;
- case ALOOPER_POLL_TIMEOUT:
- printf("ALOOPER_POLL_TIMEOUT\n");
- break;
- case ALOOPER_POLL_ERROR:
- printf("ALOOPER_POLL_TIMEOUT\n");
- break;
- default:
- printf("ugh? poll returned %d\n", ret);
- break;
- }
- } while (1);
-
- return 0;
-}
diff --git a/services/surfaceflinger/tests/waitforvsync/Android.mk b/services/surfaceflinger/tests/waitforvsync/Android.mk
deleted file mode 100644
index c25f5ab..0000000
--- a/services/surfaceflinger/tests/waitforvsync/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- waitforvsync.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
-
-LOCAL_MODULE:= test-waitforvsync
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp b/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp
deleted file mode 100644
index 279b88b..0000000
--- a/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/fb.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifndef FBIO_WAITFORVSYNC
-#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
-#endif
-
-int main(int argc, char** argv) {
- int fd = open("/dev/graphics/fb0", O_RDWR);
- if (fd >= 0) {
- do {
- uint32_t crt = 0;
- int err = ioctl(fd, FBIO_WAITFORVSYNC, &crt);
- if (err < 0) {
- printf("FBIO_WAITFORVSYNC error: %s\n", strerror(errno));
- break;
- }
- } while(1);
- close(fd);
- }
- return 0;
-}
diff --git a/tests/RenderScriptTests/Fountain_v11/Android.mk b/tests/RenderScriptTests/Fountain_v11/Android.mk
new file mode 100644
index 0000000..e51115c
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/Android.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# 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.
+#
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
+#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
+
+LOCAL_PACKAGE_NAME := Fountain_v11
+LOCAL_SDK_VERSION := 11
+
+include $(BUILD_PACKAGE)
+
+endif
diff --git a/tests/RenderScriptTests/Fountain_v11/AndroidManifest.xml b/tests/RenderScriptTests/Fountain_v11/AndroidManifest.xml
new file mode 100644
index 0000000..fcb4faf
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/AndroidManifest.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.fountain_v11">
+ <uses-sdk android:minSdkVersion="11" />
+ <application
+ android:label="Fountain_v11"
+ android:icon="@drawable/test_pattern">
+ <activity android:name="Fountain_v11">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/tests/RenderScriptTests/Fountain_v11/_index.html b/tests/RenderScriptTests/Fountain_v11/_index.html
new file mode 100644
index 0000000..223242f
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/_index.html
@@ -0,0 +1,5 @@
+<p>An example that renders many dots on the screen that follow a user's touch. The dots fall
+to the bottom of the screen when the user releases the finger.</p>
+
+
+
diff --git a/tests/RenderScriptTests/Fountain_v11/res/drawable/test_pattern.png b/tests/RenderScriptTests/Fountain_v11/res/drawable/test_pattern.png
new file mode 100644
index 0000000..e7d1455
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/res/drawable/test_pattern.png
Binary files differ
diff --git a/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/FountainRS.java b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/FountainRS.java
new file mode 100644
index 0000000..e858100
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/FountainRS.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.fountain_v11;
+
+import android.content.res.Resources;
+import android.renderscript.*;
+import android.util.Log;
+
+
+public class FountainRS {
+ public static final int PART_COUNT = 50000;
+
+ public FountainRS() {
+ }
+
+ private Resources mRes;
+ private RenderScriptGL mRS;
+ private ScriptC_fountain mScript;
+ public void init(RenderScriptGL rs, Resources res, int width, int height) {
+ mRS = rs;
+ mRes = res;
+
+ ProgramFragmentFixedFunction.Builder pfb = new ProgramFragmentFixedFunction.Builder(rs);
+ pfb.setVaryingColor(true);
+ rs.bindProgramFragment(pfb.create());
+
+ ScriptField_Point points = new ScriptField_Point(mRS, PART_COUNT);//
+ // Allocation.USAGE_GRAPHICS_VERTEX);
+
+ Mesh.AllocationBuilder smb = new Mesh.AllocationBuilder(mRS);
+ smb.addVertexAllocation(points.getAllocation());
+ smb.addIndexSetType(Mesh.Primitive.POINT);
+ Mesh sm = smb.create();
+
+ mScript = new ScriptC_fountain(mRS, mRes, R.raw.fountain);
+ mScript.set_partMesh(sm);
+ mScript.bind_point(points);
+ mRS.bindRootScript(mScript);
+ }
+
+ boolean holdingColor[] = new boolean[10];
+ public void newTouchPosition(float x, float y, float pressure, int id) {
+ if (id >= holdingColor.length) {
+ return;
+ }
+ int rate = (int)(pressure * pressure * 500.f);
+ if (rate > 500) {
+ rate = 500;
+ }
+ if (rate > 0) {
+ mScript.invoke_addParticles(rate, x, y, id, !holdingColor[id]);
+ holdingColor[id] = true;
+ } else {
+ holdingColor[id] = false;
+ }
+
+ }
+}
diff --git a/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/FountainView.java b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/FountainView.java
new file mode 100644
index 0000000..e82376c
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/FountainView.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.fountain_v11;
+
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.concurrent.Semaphore;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+import android.renderscript.RenderScriptGL;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+public class FountainView extends RSSurfaceView {
+
+ public FountainView(Context context) {
+ super(context);
+ //setFocusable(true);
+ }
+
+ private RenderScriptGL mRS;
+ private FountainRS mRender;
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
+ if (mRS == null) {
+ RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
+ mRS = createRenderScriptGL(sc);
+ mRS.setSurface(holder, w, h);
+ mRender = new FountainRS();
+ mRender.init(mRS, getResources(), w, h);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ if (mRS != null) {
+ mRS = null;
+ destroyRenderScriptGL();
+ }
+ }
+
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev)
+ {
+ int act = ev.getActionMasked();
+ if (act == ev.ACTION_UP) {
+ mRender.newTouchPosition(0, 0, 0, ev.getPointerId(0));
+ return false;
+ } else if (act == MotionEvent.ACTION_POINTER_UP) {
+ // only one pointer going up, we can get the index like this
+ int pointerIndex = ev.getActionIndex();
+ int pointerId = ev.getPointerId(pointerIndex);
+ mRender.newTouchPosition(0, 0, 0, pointerId);
+ }
+ int count = ev.getHistorySize();
+ int pcount = ev.getPointerCount();
+
+ for (int p=0; p < pcount; p++) {
+ int id = ev.getPointerId(p);
+ mRender.newTouchPosition(ev.getX(p),
+ ev.getY(p),
+ ev.getPressure(p),
+ id);
+
+ for (int i=0; i < count; i++) {
+ mRender.newTouchPosition(ev.getHistoricalX(p, i),
+ ev.getHistoricalY(p, i),
+ ev.getHistoricalPressure(p, i),
+ id);
+ }
+ }
+ return true;
+ }
+}
+
+
diff --git a/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/Fountain_v11.java b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/Fountain_v11.java
new file mode 100644
index 0000000..2c07b27
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/Fountain_v11.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.fountain_v11;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.provider.Settings.System;
+import android.util.Config;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ListView;
+
+import java.lang.Runtime;
+
+public class Fountain_v11 extends Activity {
+ //EventListener mListener = new EventListener();
+
+ private static final String LOG_TAG = "libRS_jni";
+ private static final boolean DEBUG = false;
+ private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
+
+ private FountainView mView;
+
+ // get the current looper (from your Activity UI thread for instance
+
+
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ // Create our Preview view and set it as the content of our
+ // Activity
+ mView = new FountainView(this);
+ setContentView(mView);
+ }
+
+ @Override
+ protected void onResume() {
+ Log.e("rs", "onResume");
+
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity looses focus
+ super.onResume();
+ mView.resume();
+ }
+
+ @Override
+ protected void onPause() {
+ Log.e("rs", "onPause");
+
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity looses focus
+ super.onPause();
+ mView.pause();
+
+
+
+ //Runtime.getRuntime().exit(0);
+ }
+
+
+ static void log(String message) {
+ if (LOG_ENABLED) {
+ Log.v(LOG_TAG, message);
+ }
+ }
+
+
+}
+
diff --git a/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/fountain.rs b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/fountain.rs
new file mode 100644
index 0000000..3b6c89a
--- /dev/null
+++ b/tests/RenderScriptTests/Fountain_v11/src/com/android/fountain/fountain.rs
@@ -0,0 +1,69 @@
+// Fountain test script
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.fountain_v11)
+
+#pragma stateFragment(parent)
+
+#include "rs_graphics.rsh"
+
+static int newPart = 0;
+rs_mesh partMesh;
+
+typedef struct __attribute__((packed, aligned(4))) Point {
+ float2 delta;
+ float2 position;
+ uchar4 color;
+} Point_t;
+Point_t *point;
+
+int root() {
+ float dt = min(rsGetDt(), 0.1f);
+ rsgClearColor(0.f, 0.f, 0.f, 1.f);
+ const float height = rsgGetHeight();
+ const int size = rsAllocationGetDimX(rsGetAllocation(point));
+ float dy2 = dt * (10.f);
+ Point_t * p = point;
+ for (int ct=0; ct < size; ct++) {
+ p->delta.y += dy2;
+ p->position += p->delta;
+ if ((p->position.y > height) && (p->delta.y > 0)) {
+ p->delta.y *= -0.3f;
+ }
+ p++;
+ }
+
+ rsgDrawMesh(partMesh);
+ return 1;
+}
+
+static float4 partColor[10];
+void addParticles(int rate, float x, float y, int index, bool newColor)
+{
+ if (newColor) {
+ partColor[index].x = rsRand(0.5f, 1.0f);
+ partColor[index].y = rsRand(1.0f);
+ partColor[index].z = rsRand(1.0f);
+ }
+ float rMax = ((float)rate) * 0.02f;
+ int size = rsAllocationGetDimX(rsGetAllocation(point));
+ uchar4 c = rsPackColorTo8888(partColor[index]);
+
+ Point_t * np = &point[newPart];
+ float2 p = {x, y};
+ while (rate--) {
+ float angle = rsRand(3.14f * 2.f);
+ float len = rsRand(rMax);
+ np->delta.x = len * sin(angle);
+ np->delta.y = len * cos(angle);
+ np->position = p;
+ np->color = c;
+ newPart++;
+ np++;
+ if (newPart >= size) {
+ newPart = 0;
+ np = &point[newPart];
+ }
+ }
+}
+
diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl
new file mode 100644
index 0000000..ef93e1c
--- /dev/null
+++ b/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl
@@ -0,0 +1,22 @@
+varying vec3 varWorldPos;
+varying vec3 varWorldNormal;
+varying vec2 varTex0;
+
+void main() {
+
+ vec3 V = normalize(UNI_cameraPos.xyz - varWorldPos.xyz);
+ vec3 worldNorm = normalize(varWorldNormal);
+
+ vec3 light0Vec = normalize(UNI_lightPos_0.xyz - varWorldPos.xyz);
+ float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0);
+
+ vec3 light1Vec = normalize(UNI_lightPos_1.xyz - varWorldPos.xyz);
+ float light1_Diffuse = clamp(dot(worldNorm, light1Vec), 0.0, 1.0);
+
+ vec2 t0 = varTex0.xy;
+ lowp vec4 col = UNI_diffuse;
+ col.xyz = col.xyz * (light0_Diffuse * UNI_lightColor_0.xyz +
+ light1_Diffuse * UNI_lightColor_1.xyz);
+ gl_FragColor = col;
+}
+
diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl
index 1ea234f..7910a54 100644
--- a/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl
+++ b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl
@@ -1,3 +1,8 @@
+/*
+ rs_matrix4x4 model;
+ rs_matrix4x4 viewProj;
+*/
+
varying vec3 varWorldPos;
varying vec3 varWorldNormal;
varying vec2 varTex0;
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppView.java b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppView.java
index 053e545..2112181 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppView.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppView.java
@@ -41,6 +41,7 @@
if (mRS == null) {
RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
sc.setDepth(16, 24);
+ sc.setSamples(1, 2, 1);
mRS = createRenderScriptGL(sc);
mRS.setSurface(holder, w, h);
mRender = new SimpleAppRS();
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppRS.java b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppRS.java
index f159e85..3aa80f4 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppRS.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppRS.java
@@ -65,6 +65,7 @@
// Shaders
private FragmentShader mPaintF;
private FragmentShader mLightsF;
+ private FragmentShader mLightsDiffF;
private FragmentShader mAluminumF;
private FragmentShader mPlasticF;
private FragmentShader mDiffuseF;
@@ -173,6 +174,11 @@
fb.setShader(mRes, R.raw.plastic_lights);
mLightsF = fb.create();
+ fb = new FragmentShader.Builder(mRS);
+ fb.setObjectConst(lightParams.getAllocation().getType());
+ fb.setShader(mRes, R.raw.diffuse_lights);
+ mLightsDiffF = fb.create();
+
FullscreenBlur.initShaders(mRes, mRS);
}
@@ -203,6 +209,7 @@
private void addShadersToScene() {
mActiveScene.appendShader(mPaintF);
mActiveScene.appendShader(mLightsF);
+ mActiveScene.appendShader(mLightsDiffF);
mActiveScene.appendShader(mAluminumF);
mActiveScene.appendShader(mPlasticF);
mActiveScene.appendShader(mDiffuseF);
@@ -219,8 +226,12 @@
RenderState paint = new RenderState(mGenericV, mPaintF, null, null);
RenderState aluminum = new RenderState(mGenericV, mAluminumF, null, null);
RenderState lights = new RenderState(mGenericV, mLightsF, null, null);
+ RenderState diff_lights = new RenderState(mGenericV, mLightsDiffF, null, null);
+ RenderState diff_lights_no_cull = new RenderState(mGenericV, mLightsDiffF, null,
+ ProgramRaster.CULL_NONE(mRS));
RenderState glassTransp = new RenderState(mGenericV, mPaintF,
ProgramStore.BLEND_ALPHA_DEPTH_TEST(mRS), null);
+ RenderState texState = new RenderState(mGenericV, mTextureF, null, null);
initRenderPasses();
@@ -239,10 +250,12 @@
mActiveScene.assignRenderStateToMaterial(glassTransp, "^GlassLight");
mActiveScene.assignRenderStateToMaterial(lights, "^LightBlinn");
+ mActiveScene.assignRenderStateToMaterial(diff_lights, "^LightLambert");
+ mActiveScene.assignRenderStateToMaterial(diff_lights_no_cull, "^LightLambertNoCull");
+ mActiveScene.assignRenderStateToMaterial(texState, "^TextureOnly");
Renderable plane = (Renderable)mActiveScene.getRenderableByName("pPlaneShape1");
if (plane != null) {
- RenderState texState = new RenderState(mGenericV, mTextureF, null, null);
plane.setRenderState(texState);
plane.setVisible(!mUseBlur);
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppView.java b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppView.java
index 687f35b..33ca1b8 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppView.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TestAppView.java
@@ -59,6 +59,7 @@
if (mRS == null) {
RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
sc.setDepth(16, 24);
+ sc.setSamples(1, 2, 1);
mRS = createRenderScriptGL(sc);
mRS.setSurface(holder, w, h);
mRender = new TestAppRS();
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TouchHandler.java b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TouchHandler.java
index e272cc5..d0f9797 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TouchHandler.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/TouchHandler.java
@@ -43,7 +43,7 @@
public void init(Scene scene) {
// Some initial values for camera position
mRotateXValue = -20;
- mRotateYValue = 45;
+ mRotateYValue = 0;
mDistValue = new Float3(0, 0, 45);
mPosValue = new Float3(0, 4, 0);
diff --git a/tests/RenderScriptTests/tests_v11/Android.mk b/tests/RenderScriptTests/tests_v11/Android.mk
new file mode 100644
index 0000000..93a429b
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# 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.
+#
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
+
+LOCAL_PACKAGE_NAME := RSTest_v11
+LOCAL_SDK_VERSION := 11
+
+include $(BUILD_PACKAGE)
+
+endif
diff --git a/tests/RenderScriptTests/tests_v11/AndroidManifest.xml b/tests/RenderScriptTests/tests_v11/AndroidManifest.xml
new file mode 100644
index 0000000..f4aeda2
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.rs.test_v11">
+ <uses-sdk android:minSdkVersion="11" />
+ <application
+ android:label="_RS_Test_v11"
+ android:icon="@drawable/test_pattern">
+ <activity android:name="RSTest_v11"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/tests/RenderScriptTests/tests_v11/res/drawable/test_pattern.png b/tests/RenderScriptTests/tests_v11/res/drawable/test_pattern.png
new file mode 100644
index 0000000..e7d1455
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/res/drawable/test_pattern.png
Binary files differ
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestCore.java
new file mode 100644
index 0000000..888cfe4
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestCore.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+import android.util.Log;
+import java.util.ArrayList;
+import java.util.ListIterator;
+import java.util.Timer;
+import java.util.TimerTask;
+
+
+public class RSTestCore {
+ int mWidth;
+ int mHeight;
+ Context mCtx;
+
+ public RSTestCore(Context ctx) {
+ mCtx = ctx;
+ }
+
+ private Resources mRes;
+ private RenderScriptGL mRS;
+
+ private Font mFont;
+ ScriptField_ListAllocs_s mListAllocs;
+ int mLastX;
+ int mLastY;
+ private ScriptC_rslist mScript;
+
+ private ArrayList<UnitTest> unitTests;
+ private ListIterator<UnitTest> test_iter;
+ private UnitTest activeTest;
+ private boolean stopTesting;
+
+ /* Periodic timer for ensuring future tests get scheduled */
+ private Timer mTimer;
+ public static final int RS_TIMER_PERIOD = 100;
+
+ public void init(RenderScriptGL rs, Resources res, int width, int height) {
+ mRS = rs;
+ mRes = res;
+ mWidth = width;
+ mHeight = height;
+ stopTesting = false;
+
+ mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);
+
+ unitTests = new ArrayList<UnitTest>();
+
+ unitTests.add(new UT_primitives(this, mRes, mCtx));
+ unitTests.add(new UT_rsdebug(this, mRes, mCtx));
+ unitTests.add(new UT_rstime(this, mRes, mCtx));
+ unitTests.add(new UT_rstypes(this, mRes, mCtx));
+ unitTests.add(new UT_math(this, mRes, mCtx));
+ unitTests.add(new UT_fp_mad(this, mRes, mCtx));
+ /*
+ unitTests.add(new UnitTest(null, "<Pass>", 1));
+ unitTests.add(new UnitTest());
+ unitTests.add(new UnitTest(null, "<Fail>", -1));
+
+ for (int i = 0; i < 20; i++) {
+ unitTests.add(new UnitTest(null, "<Pass>", 1));
+ }
+ */
+
+ UnitTest [] uta = new UnitTest[unitTests.size()];
+ uta = unitTests.toArray(uta);
+
+ mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
+ for (int i = 0; i < uta.length; i++) {
+ ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
+ listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
+ listElem.result = uta[i].result;
+ mListAllocs.set(listElem, i, false);
+ uta[i].setItem(listElem);
+ }
+
+ mListAllocs.copyAll();
+
+ mScript.bind_gList(mListAllocs);
+
+ mFont = Font.create(mRS, mRes, "serif", Font.Style.BOLD, 8);
+ mScript.set_gFont(mFont);
+
+ mRS.bindRootScript(mScript);
+
+ test_iter = unitTests.listIterator();
+ refreshTestResults(); /* Kick off the first test */
+
+ TimerTask pTask = new TimerTask() {
+ public void run() {
+ refreshTestResults();
+ }
+ };
+
+ mTimer = new Timer();
+ mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
+ }
+
+ public void checkAndRunNextTest() {
+ if (activeTest != null) {
+ if (!activeTest.isAlive()) {
+ /* Properly clean up on our last test */
+ try {
+ activeTest.join();
+ }
+ catch (InterruptedException e) {
+ }
+ activeTest = null;
+ }
+ }
+
+ if (!stopTesting && activeTest == null) {
+ if (test_iter.hasNext()) {
+ activeTest = test_iter.next();
+ activeTest.start();
+ /* This routine will only get called once when a new test
+ * should start running. The message handler in UnitTest.java
+ * ensures this. */
+ }
+ else {
+ if (mTimer != null) {
+ mTimer.cancel();
+ mTimer.purge();
+ mTimer = null;
+ }
+ }
+ }
+ }
+
+ public void refreshTestResults() {
+ checkAndRunNextTest();
+
+ if (mListAllocs != null && mScript != null && mRS != null) {
+ mListAllocs.copyAll();
+
+ mScript.bind_gList(mListAllocs);
+ mRS.bindRootScript(mScript);
+ }
+ }
+
+ public void cleanup() {
+ stopTesting = true;
+ UnitTest t = activeTest;
+
+ /* Stop periodic refresh of testing */
+ if (mTimer != null) {
+ mTimer.cancel();
+ mTimer.purge();
+ mTimer = null;
+ }
+
+ /* Wait to exit until we finish the current test */
+ if (t != null) {
+ try {
+ t.join();
+ }
+ catch (InterruptedException e) {
+ }
+ t = null;
+ }
+
+ }
+
+ public void newTouchPosition(float x, float y, float pressure, int id) {
+ }
+
+ public void onActionDown(int x, int y) {
+ mScript.set_gDY(0.0f);
+ mLastX = x;
+ mLastY = y;
+ refreshTestResults();
+ }
+
+ public void onActionMove(int x, int y) {
+ int dx = mLastX - x;
+ int dy = mLastY - y;
+
+ if (Math.abs(dy) <= 2) {
+ dy = 0;
+ }
+
+ mScript.set_gDY(dy);
+
+ mLastX = x;
+ mLastY = y;
+ refreshTestResults();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestView.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestView.java
new file mode 100644
index 0000000..b5bebe9
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestView.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.concurrent.Semaphore;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+import android.renderscript.RenderScriptGL;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+public class RSTestView extends RSSurfaceView {
+
+ private Context mCtx;
+
+ public RSTestView(Context context) {
+ super(context);
+ mCtx = context;
+ //setFocusable(true);
+ }
+
+ private RenderScriptGL mRS;
+ private RSTestCore mRender;
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
+ if (mRS == null) {
+ RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
+ mRS = createRenderScriptGL(sc);
+ mRS.setSurface(holder, w, h);
+ mRender = new RSTestCore(mCtx);
+ mRender.init(mRS, getResources(), w, h);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ if(mRS != null) {
+ mRender.cleanup();
+ mRS = null;
+ destroyRenderScriptGL();
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event)
+ {
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev)
+ {
+ boolean ret = false;
+ int act = ev.getAction();
+ if (act == ev.ACTION_DOWN) {
+ mRender.onActionDown((int)ev.getX(), (int)ev.getY());
+ ret = true;
+ }
+ else if (act == ev.ACTION_MOVE) {
+ mRender.onActionMove((int)ev.getX(), (int)ev.getY());
+ ret = true;
+ }
+
+ return ret;
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTest_v11.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTest_v11.java
new file mode 100644
index 0000000..1dedfce
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTest_v11.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.provider.Settings.System;
+import android.util.Config;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ListView;
+
+import java.lang.Runtime;
+
+public class RSTest_v11 extends Activity {
+ //EventListener mListener = new EventListener();
+
+ private static final String LOG_TAG = "libRS_jni";
+ private static final boolean DEBUG = false;
+ private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
+
+ private RSTestView mView;
+
+ // get the current looper (from your Activity UI thread for instance
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ // Create our Preview view and set it as the content of our
+ // Activity
+ mView = new RSTestView(this);
+ setContentView(mView);
+ }
+
+ @Override
+ protected void onResume() {
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity loses focus
+ super.onResume();
+ mView.resume();
+ }
+
+ @Override
+ protected void onPause() {
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity loses focus
+ super.onPause();
+ mView.pause();
+ }
+
+ static void log(String message) {
+ if (LOG_ENABLED) {
+ Log.v(LOG_TAG, message);
+ }
+ }
+
+
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_fp_mad.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_fp_mad.java
new file mode 100644
index 0000000..5d72aa6
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_fp_mad.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_fp_mad extends UnitTest {
+ private Resources mRes;
+
+ protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Fp_Mad", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_fp_mad s = new ScriptC_fp_mad(pRS, mRes, R.raw.fp_mad);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_fp_mad_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_math.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_math.java
new file mode 100644
index 0000000..7e356f8
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_math.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_math extends UnitTest {
+ private Resources mRes;
+
+ protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Math", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_math s = new ScriptC_math(pRS, mRes, R.raw.math);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_math_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_primitives.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_primitives.java
new file mode 100644
index 0000000..dc3efbc
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_primitives.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_primitives extends UnitTest {
+ private Resources mRes;
+
+ protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Primitives", ctx);
+ mRes = res;
+ }
+
+ private boolean initializeGlobals(ScriptC_primitives s) {
+ float pF = s.get_floatTest();
+ if (pF != 1.99f) {
+ return false;
+ }
+ s.set_floatTest(2.99f);
+
+ double pD = s.get_doubleTest();
+ if (pD != 2.05) {
+ return false;
+ }
+ s.set_doubleTest(3.05);
+
+ byte pC = s.get_charTest();
+ if (pC != -8) {
+ return false;
+ }
+ s.set_charTest((byte)-16);
+
+ short pS = s.get_shortTest();
+ if (pS != -16) {
+ return false;
+ }
+ s.set_shortTest((short)-32);
+
+ int pI = s.get_intTest();
+ if (pI != -32) {
+ return false;
+ }
+ s.set_intTest(-64);
+
+ long pL = s.get_longTest();
+ if (pL != 17179869184l) {
+ return false;
+ }
+ s.set_longTest(17179869185l);
+
+ long puL = s.get_ulongTest();
+ if (puL != 4611686018427387904L) {
+ return false;
+ }
+ s.set_ulongTest(4611686018427387903L);
+
+
+ long pLL = s.get_longlongTest();
+ if (pLL != 68719476736L) {
+ return false;
+ }
+ s.set_longlongTest(68719476735L);
+
+ long pu64 = s.get_uint64_tTest();
+ if (pu64 != 117179869184l) {
+ return false;
+ }
+ s.set_uint64_tTest(117179869185l);
+
+ return true;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
+ pRS.setMessageHandler(mRsMessage);
+ if (!initializeGlobals(s)) {
+ // initializeGlobals failed
+ result = -1;
+ } else {
+ s.invoke_primitives_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ }
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rsdebug.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rsdebug.java
new file mode 100644
index 0000000..00dbaf5
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rsdebug.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_rsdebug extends UnitTest {
+ private Resources mRes;
+
+ protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "rsDebug", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_rsdebug s = new ScriptC_rsdebug(pRS, mRes, R.raw.rsdebug);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_test_rsdebug(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstime.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstime.java
new file mode 100644
index 0000000..5b4c399
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstime.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_rstime extends UnitTest {
+ private Resources mRes;
+
+ protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "rsTime", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_rstime s = new ScriptC_rstime(pRS, mRes, R.raw.rstime);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_test_rstime(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstypes.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstypes.java
new file mode 100644
index 0000000..72a97c9
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstypes.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_rstypes extends UnitTest {
+ private Resources mRes;
+
+ protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "rsTypes", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_rstypes s = new ScriptC_rstypes(pRS, mRes, R.raw.rstypes);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_test_rstypes(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UnitTest.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UnitTest.java
new file mode 100644
index 0000000..b62e535
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UnitTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v11;
+import android.content.Context;
+import android.renderscript.RenderScript.RSMessageHandler;
+import android.util.Log;
+
+public class UnitTest extends Thread {
+ public String name;
+ public int result;
+ private ScriptField_ListAllocs_s.Item mItem;
+ private RSTestCore mRSTC;
+ private boolean msgHandled;
+ protected Context mCtx;
+
+ /* These constants must match those in shared.rsh */
+ public static final int RS_MSG_TEST_PASSED = 100;
+ public static final int RS_MSG_TEST_FAILED = 101;
+
+ private static int numTests = 0;
+ public int testID;
+
+ protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
+ super();
+ mRSTC = rstc;
+ name = n;
+ msgHandled = false;
+ mCtx = ctx;
+ result = initResult;
+ testID = numTests++;
+ }
+
+ protected UnitTest(RSTestCore rstc, String n, Context ctx) {
+ this(rstc, n, 0, ctx);
+ }
+
+ protected UnitTest(RSTestCore rstc, Context ctx) {
+ this (rstc, "<Unknown>", ctx);
+ }
+
+ protected UnitTest(Context ctx) {
+ this (null, ctx);
+ }
+
+ protected RSMessageHandler mRsMessage = new RSMessageHandler() {
+ public void run() {
+ if (result == 0) {
+ switch (mID) {
+ case RS_MSG_TEST_PASSED:
+ result = 1;
+ break;
+ case RS_MSG_TEST_FAILED:
+ result = -1;
+ break;
+ default:
+ android.util.Log.v("RenderScript", "Unit test got unexpected message");
+ return;
+ }
+ }
+
+ if (mItem != null) {
+ mItem.result = result;
+ msgHandled = true;
+ try {
+ mRSTC.refreshTestResults();
+ }
+ catch (IllegalStateException e) {
+ /* Ignore the case where our message receiver has been
+ disconnected. This happens when we leave the application
+ before it finishes running all of the unit tests. */
+ }
+ }
+ }
+ };
+
+ public void waitForMessage() {
+ while (!msgHandled) {
+ yield();
+ }
+ }
+
+ public void setItem(ScriptField_ListAllocs_s.Item item) {
+ mItem = item;
+ }
+
+ public void run() {
+ /* This method needs to be implemented for each subclass */
+ if (mRSTC != null) {
+ mRSTC.refreshTestResults();
+ }
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/fp_mad.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/fp_mad.rs
new file mode 100644
index 0000000..b6f2b2a6
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/fp_mad.rs
@@ -0,0 +1,174 @@
+#include "shared.rsh"
+
+const int TEST_COUNT = 1;
+
+static float data_f1[1025];
+static float4 data_f4[1025];
+
+static void test_mad4(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~1 billion ops
+ for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = (data_f4[i] * 0.02f +
+ data_f4[i+1] * 0.04f +
+ data_f4[i+2] * 0.05f +
+ data_f4[i+3] * 0.1f +
+ data_f4[i+4] * 0.2f +
+ data_f4[i+5] * 0.2f +
+ data_f4[i+6] * 0.1f +
+ data_f4[i+7] * 0.05f +
+ data_f4[i+8] * 0.04f +
+ data_f4[i+9] * 0.02f + 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_mad4 M ops", 1000.f / time);
+}
+
+static void test_mad(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~1 billion ops
+ for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f1[i] = (data_f1[i] * 0.02f +
+ data_f1[i+1] * 0.04f +
+ data_f1[i+2] * 0.05f +
+ data_f1[i+3] * 0.1f +
+ data_f1[i+4] * 0.2f +
+ data_f1[i+5] * 0.2f +
+ data_f1[i+6] * 0.1f +
+ data_f1[i+7] * 0.05f +
+ data_f1[i+8] * 0.04f +
+ data_f1[i+9] * 0.02f + 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_mad M ops", 1000.f / time);
+}
+
+static void test_norm(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~10 M ops
+ for (int ct=0; ct < 1000 * 10; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = normalize(data_f4[i]);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_norm M ops", 10.f / time);
+}
+
+static void test_sincos4(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~10 M ops
+ for (int ct=0; ct < 1000 * 10 / 4; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_sincos4 M ops", 10.f / time);
+}
+
+static void test_sincos(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~10 M ops
+ for (int ct=0; ct < 1000 * 10; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_sincos M ops", 10.f / time);
+}
+
+static void test_clamp(uint32_t index) {
+ start();
+
+ // Do ~100 M ops
+ for (int ct=0; ct < 1000 * 100; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_clamp M ops", 100.f / time);
+
+ start();
+ // Do ~100 M ops
+ for (int ct=0; ct < 1000 * 100; ct++) {
+ for (int i=0; i < (1000); i++) {
+ if (data_f1[i] < -1.f) data_f1[i] = -1.f;
+ if (data_f1[i] > -1.f) data_f1[i] = 1.f;
+ }
+ }
+
+ time = end(index);
+ rsDebug("fp_clamp ref M ops", 100.f / time);
+}
+
+static void test_clamp4(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~100 M ops
+ for (int ct=0; ct < 1000 * 100 /4; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_clamp4 M ops", 100.f / time);
+}
+
+void fp_mad_test(uint32_t index, int test_num) {
+ int x;
+ for (x=0; x < 1025; x++) {
+ data_f1[x] = (x & 0xf) * 0.1f;
+ data_f4[x].x = (x & 0xf) * 0.1f;
+ data_f4[x].y = (x & 0xf0) * 0.1f;
+ data_f4[x].z = (x & 0x33) * 0.1f;
+ data_f4[x].w = (x & 0x77) * 0.1f;
+ }
+
+ test_mad4(index);
+ test_mad(index);
+
+ for (x=0; x < 1025; x++) {
+ data_f1[x] = (x & 0xf) * 0.1f + 1.f;
+ data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
+ data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
+ data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
+ data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
+ }
+
+ test_norm(index);
+ test_sincos4(index);
+ test_sincos(index);
+ test_clamp4(index);
+ test_clamp(index);
+
+ // TODO Actually verify test result accuracy
+ rsDebug("fp_mad_test PASSED", 0);
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+}
+
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/math.rs
new file mode 100644
index 0000000..2867be1
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/math.rs
@@ -0,0 +1,348 @@
+#include "shared.rsh"
+
+// Testing math library
+
+volatile float f1;
+volatile float2 f2;
+volatile float3 f3;
+volatile float4 f4;
+
+volatile int i1;
+volatile int2 i2;
+volatile int3 i3;
+volatile int4 i4;
+
+volatile uint ui1;
+volatile uint2 ui2;
+volatile uint3 ui3;
+volatile uint4 ui4;
+
+volatile short s1;
+volatile short2 s2;
+volatile short3 s3;
+volatile short4 s4;
+
+volatile ushort us1;
+volatile ushort2 us2;
+volatile ushort3 us3;
+volatile ushort4 us4;
+
+volatile char c1;
+volatile char2 c2;
+volatile char3 c3;
+volatile char4 c4;
+
+volatile uchar uc1;
+volatile uchar2 uc2;
+volatile uchar3 uc3;
+volatile uchar4 uc4;
+
+#define TEST_FN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f2 = fnc(f2); \
+ f3 = fnc(f3); \
+ f4 = fnc(f4);
+
+#define TEST_FN_FUNC_FN_PFN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (float*) &f1); \
+ f2 = fnc(f2, (float2*) &f2); \
+ f3 = fnc(f3, (float3*) &f3); \
+ f4 = fnc(f4, (float4*) &f4);
+
+#define TEST_FN_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f2); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f1); \
+ f3 = fnc(f3, f1); \
+ f4 = fnc(f4, f1);
+
+#define TEST_FN_FUNC_FN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i2); \
+ f3 = fnc(f3, i3); \
+ f4 = fnc(f4, i4);
+
+#define TEST_FN_FUNC_FN_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i1); \
+ f3 = fnc(f3, i1); \
+ f4 = fnc(f4, i1);
+
+#define TEST_FN_FUNC_FN_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f2, f2); \
+ f3 = fnc(f3, f3, f3); \
+ f4 = fnc(f4, f4, f4);
+
+#define TEST_FN_FUNC_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (int*) &i1); \
+ f2 = fnc(f2, (int2*) &i2); \
+ f3 = fnc(f3, (int3*) &i3); \
+ f4 = fnc(f4, (int4*) &i4);
+
+#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, (int*) &i1); \
+ f2 = fnc(f2, f2, (int2*) &i2); \
+ f3 = fnc(f3, f3, (int3*) &i3); \
+ f4 = fnc(f4, f4, (int4*) &i4);
+
+#define TEST_IN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ i1 = fnc(f1); \
+ i2 = fnc(f2); \
+ i3 = fnc(f3); \
+ i4 = fnc(f4);
+
+
+static bool test_fp_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_FN_FUNC_FN(acos);
+ TEST_FN_FUNC_FN(acosh);
+ TEST_FN_FUNC_FN(acospi);
+ TEST_FN_FUNC_FN(asin);
+ TEST_FN_FUNC_FN(asinh);
+ TEST_FN_FUNC_FN(asinpi);
+ TEST_FN_FUNC_FN(atan);
+ TEST_FN_FUNC_FN_FN(atan2);
+ TEST_FN_FUNC_FN(atanh);
+ TEST_FN_FUNC_FN(atanpi);
+ TEST_FN_FUNC_FN_FN(atan2pi);
+ TEST_FN_FUNC_FN(cbrt);
+ TEST_FN_FUNC_FN(ceil);
+ TEST_FN_FUNC_FN_FN(copysign);
+ TEST_FN_FUNC_FN(cos);
+ TEST_FN_FUNC_FN(cosh);
+ TEST_FN_FUNC_FN(cospi);
+ TEST_FN_FUNC_FN(erfc);
+ TEST_FN_FUNC_FN(erf);
+ TEST_FN_FUNC_FN(exp);
+ TEST_FN_FUNC_FN(exp2);
+ TEST_FN_FUNC_FN(exp10);
+ TEST_FN_FUNC_FN(expm1);
+ TEST_FN_FUNC_FN(fabs);
+ TEST_FN_FUNC_FN_FN(fdim);
+ TEST_FN_FUNC_FN(floor);
+ TEST_FN_FUNC_FN_FN_FN(fma);
+ TEST_FN_FUNC_FN_FN(fmax);
+ TEST_FN_FUNC_FN_F(fmax);
+ TEST_FN_FUNC_FN_FN(fmin);
+ TEST_FN_FUNC_FN_F(fmin);
+ TEST_FN_FUNC_FN_FN(fmod);
+ TEST_FN_FUNC_FN_PFN(fract);
+ TEST_FN_FUNC_FN_PIN(frexp);
+ TEST_FN_FUNC_FN_FN(hypot);
+ TEST_IN_FUNC_FN(ilogb);
+ TEST_FN_FUNC_FN_IN(ldexp);
+ TEST_FN_FUNC_FN_I(ldexp);
+ TEST_FN_FUNC_FN(lgamma);
+ TEST_FN_FUNC_FN_PIN(lgamma);
+ TEST_FN_FUNC_FN(log);
+ TEST_FN_FUNC_FN(log2);
+ TEST_FN_FUNC_FN(log10);
+ TEST_FN_FUNC_FN(log1p);
+ TEST_FN_FUNC_FN(logb);
+ TEST_FN_FUNC_FN_FN_FN(mad);
+ TEST_FN_FUNC_FN_PFN(modf);
+ // nan
+ TEST_FN_FUNC_FN_FN(nextafter);
+ TEST_FN_FUNC_FN_FN(pow);
+ TEST_FN_FUNC_FN_IN(pown);
+ TEST_FN_FUNC_FN_FN(powr);
+ TEST_FN_FUNC_FN_FN(remainder);
+ TEST_FN_FUNC_FN_FN_PIN(remquo);
+ TEST_FN_FUNC_FN(rint);
+ TEST_FN_FUNC_FN_IN(rootn);
+ TEST_FN_FUNC_FN(round);
+ TEST_FN_FUNC_FN(rsqrt);
+ TEST_FN_FUNC_FN(sin);
+ TEST_FN_FUNC_FN_PFN(sincos);
+ TEST_FN_FUNC_FN(sinh);
+ TEST_FN_FUNC_FN(sinpi);
+ TEST_FN_FUNC_FN(sqrt);
+ TEST_FN_FUNC_FN(tan);
+ TEST_FN_FUNC_FN(tanh);
+ TEST_FN_FUNC_FN(tanpi);
+ TEST_FN_FUNC_FN(tgamma);
+ TEST_FN_FUNC_FN(trunc);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_fp_math FAILED", time);
+ }
+ else {
+ rsDebug("test_fp_math PASSED", time);
+ }
+
+ return failed;
+}
+
+#define DECL_INT(prefix) \
+volatile char prefix##_c_1 = 1; \
+volatile char2 prefix##_c_2 = 1; \
+volatile char3 prefix##_c_3 = 1; \
+volatile char4 prefix##_c_4 = 1; \
+volatile uchar prefix##_uc_1 = 1; \
+volatile uchar2 prefix##_uc_2 = 1; \
+volatile uchar3 prefix##_uc_3 = 1; \
+volatile uchar4 prefix##_uc_4 = 1; \
+volatile short prefix##_s_1 = 1; \
+volatile short2 prefix##_s_2 = 1; \
+volatile short3 prefix##_s_3 = 1; \
+volatile short4 prefix##_s_4 = 1; \
+volatile ushort prefix##_us_1 = 1; \
+volatile ushort2 prefix##_us_2 = 1; \
+volatile ushort3 prefix##_us_3 = 1; \
+volatile ushort4 prefix##_us_4 = 1; \
+volatile int prefix##_i_1 = 1; \
+volatile int2 prefix##_i_2 = 1; \
+volatile int3 prefix##_i_3 = 1; \
+volatile int4 prefix##_i_4 = 1; \
+volatile uint prefix##_ui_1 = 1; \
+volatile uint2 prefix##_ui_2 = 1; \
+volatile uint3 prefix##_ui_3 = 1; \
+volatile uint4 prefix##_ui_4 = 1; \
+volatile long prefix##_l_1 = 1; \
+volatile ulong prefix##_ul_1 = 1;
+
+#define TEST_INT_OP_TYPE(op, type) \
+rsDebug("Testing " #op " for " #type "1", i++); \
+res_##type##_1 = src1_##type##_1 op src2_##type##_1; \
+rsDebug("Testing " #op " for " #type "2", i++); \
+res_##type##_2 = src1_##type##_2 op src2_##type##_2; \
+rsDebug("Testing " #op " for " #type "3", i++); \
+res_##type##_3 = src1_##type##_3 op src2_##type##_3; \
+rsDebug("Testing " #op " for " #type "4", i++); \
+res_##type##_4 = src1_##type##_4 op src2_##type##_4;
+
+#define TEST_INT_OP(op) \
+TEST_INT_OP_TYPE(op, c) \
+TEST_INT_OP_TYPE(op, uc) \
+TEST_INT_OP_TYPE(op, s) \
+TEST_INT_OP_TYPE(op, us) \
+TEST_INT_OP_TYPE(op, i) \
+TEST_INT_OP_TYPE(op, ui) \
+rsDebug("Testing " #op " for l1", i++); \
+res_l_1 = src1_l_1 op src2_l_1; \
+rsDebug("Testing " #op " for ul1", i++); \
+res_ul_1 = src1_ul_1 op src2_ul_1;
+
+DECL_INT(res)
+DECL_INT(src1)
+DECL_INT(src2)
+
+static bool test_basic_operators() {
+ bool failed = false;
+ int i = 0;
+
+ TEST_INT_OP(+);
+ TEST_INT_OP(-);
+ TEST_INT_OP(*);
+ TEST_INT_OP(/);
+ TEST_INT_OP(%);
+ TEST_INT_OP(<<);
+ TEST_INT_OP(>>);
+
+ if (failed) {
+ rsDebug("test_basic_operators FAILED", 0);
+ }
+ else {
+ rsDebug("test_basic_operators PASSED", 0);
+ }
+
+ return failed;
+}
+
+#define TEST_CVT(to, from, type) \
+rsDebug("Testing convert from " #from " to " #to, 0); \
+to##1 = from##1; \
+to##2 = convert_##type##2(from##2); \
+to##3 = convert_##type##3(from##3); \
+to##4 = convert_##type##4(from##4);
+
+#define TEST_CVT_MATRIX(to, type) \
+TEST_CVT(to, c, type); \
+TEST_CVT(to, uc, type); \
+TEST_CVT(to, s, type); \
+TEST_CVT(to, us, type); \
+TEST_CVT(to, i, type); \
+TEST_CVT(to, ui, type); \
+TEST_CVT(to, f, type); \
+
+static bool test_convert() {
+ bool failed = false;
+
+ TEST_CVT_MATRIX(c, char);
+ TEST_CVT_MATRIX(uc, uchar);
+ TEST_CVT_MATRIX(s, short);
+ TEST_CVT_MATRIX(us, ushort);
+ TEST_CVT_MATRIX(i, int);
+ TEST_CVT_MATRIX(ui, uint);
+ TEST_CVT_MATRIX(f, float);
+
+ if (failed) {
+ rsDebug("test_convert FAILED", 0);
+ }
+ else {
+ rsDebug("test_convert PASSED", 0);
+ }
+
+ return failed;
+}
+
+#define INIT_PREFIX_TYPE(prefix, type) \
+prefix##_##type##_1 = 1; \
+prefix##_##type##_2.x = 1; \
+prefix##_##type##_2.y = 1; \
+prefix##_##type##_3.x = 1; \
+prefix##_##type##_3.y = 1; \
+prefix##_##type##_3.z = 1; \
+prefix##_##type##_4.x = 1; \
+prefix##_##type##_4.y = 1; \
+prefix##_##type##_4.z = 1; \
+prefix##_##type##_4.w = 1;
+
+#define INIT_TYPE(type) \
+INIT_PREFIX_TYPE(src1, type) \
+INIT_PREFIX_TYPE(src2, type) \
+INIT_PREFIX_TYPE(res, type)
+
+#define INIT_ALL \
+INIT_TYPE(c); \
+INIT_TYPE(uc); \
+INIT_TYPE(s); \
+INIT_TYPE(us); \
+INIT_TYPE(i); \
+INIT_TYPE(ui);
+
+void math_test(uint32_t index, int test_num) {
+ bool failed = false;
+ INIT_ALL;
+ failed |= test_convert();
+ failed |= test_fp_math(index);
+ failed |= test_basic_operators();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/primitives.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/primitives.rs
new file mode 100644
index 0000000..ce451da
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/primitives.rs
@@ -0,0 +1,61 @@
+#include "shared.rsh"
+
+// Testing primitive types
+float floatTest = 1.99f;
+double doubleTest = 2.05;
+char charTest = -8;
+short shortTest = -16;
+int intTest = -32;
+long longTest = 17179869184l; // 1 << 34
+long long longlongTest = 68719476736l; // 1 << 36
+
+uchar ucharTest = 8;
+ushort ushortTest = 16;
+uint uintTest = 32;
+ulong ulongTest = 4611686018427387904L;
+int64_t int64_tTest = -17179869184l; // - 1 << 34
+uint64_t uint64_tTest = 117179869184l;
+
+static bool test_primitive_types(uint32_t index) {
+ bool failed = false;
+ start();
+
+ _RS_ASSERT(floatTest == 2.99f);
+ _RS_ASSERT(doubleTest == 3.05);
+ _RS_ASSERT(charTest == -16);
+ _RS_ASSERT(shortTest == -32);
+ _RS_ASSERT(intTest == -64);
+ _RS_ASSERT(longTest == 17179869185l);
+ _RS_ASSERT(longlongTest == 68719476735l);
+
+ _RS_ASSERT(ucharTest == 8);
+ _RS_ASSERT(ushortTest == 16);
+ _RS_ASSERT(uintTest == 32);
+ _RS_ASSERT(ulongTest == 4611686018427387903L);
+ _RS_ASSERT(int64_tTest == -17179869184l);
+ _RS_ASSERT(uint64_tTest == 117179869185l);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_primitives FAILED", time);
+ }
+ else {
+ rsDebug("test_primitives PASSED", time);
+ }
+
+ return failed;
+}
+
+void primitives_test(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= test_primitive_types(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rsdebug.rs
new file mode 100644
index 0000000..f7942a5
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rsdebug.rs
@@ -0,0 +1,56 @@
+#include "shared.rsh"
+
+// Testing primitive types
+float floatTest = 1.99f;
+double doubleTest = 2.05;
+char charTest = -8;
+short shortTest = -16;
+int intTest = -32;
+long longTest = 17179869184l; // 1 << 34
+long long longlongTest = 68719476736l; // 1 << 36
+
+uchar ucharTest = 8;
+ushort ushortTest = 16;
+uint uintTest = 32;
+ulong ulongTest = 4611686018427387904L;
+int64_t int64_tTest = -17179869184l; // - 1 << 34
+uint64_t uint64_tTest = 117179869184l;
+
+static bool basic_test(uint32_t index) {
+ bool failed = false;
+
+ // This test focuses primarily on compilation-time, not run-time.
+ // For this reason, none of the outputs are actually checked.
+
+ rsDebug("floatTest", floatTest);
+ rsDebug("doubleTest", doubleTest);
+ rsDebug("charTest", charTest);
+ rsDebug("shortTest", shortTest);
+ rsDebug("intTest", intTest);
+ rsDebug("longTest", longTest);
+ rsDebug("longlongTest", longlongTest);
+
+ rsDebug("ucharTest", ucharTest);
+ rsDebug("ushortTest", ushortTest);
+ rsDebug("uintTest", uintTest);
+ rsDebug("ulongTest", ulongTest);
+ rsDebug("int64_tTest", int64_tTest);
+ rsDebug("uint64_tTest", uint64_tTest);
+
+ return failed;
+}
+
+void test_rsdebug(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= basic_test(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ rsDebug("rsdebug_test FAILED", -1);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ rsDebug("rsdebug_test PASSED", 0);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rslist.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rslist.rs
new file mode 100644
index 0000000..5b2501f
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rslist.rs
@@ -0,0 +1,107 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// 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.
+
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.rs.test_v11)
+
+#include "rs_graphics.rsh"
+
+float gDY;
+
+rs_font gFont;
+
+typedef struct ListAllocs_s {
+ rs_allocation text;
+ int result;
+} ListAllocs;
+
+ListAllocs *gList;
+
+void init() {
+ gDY = 0.0f;
+}
+
+int textPos = 0;
+
+int root(int launchID) {
+
+ rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ rsgClearDepth(1.0f);
+
+ textPos -= (int)gDY*2;
+ gDY *= 0.95;
+
+ rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
+ rsgBindFont(gFont);
+
+ rs_allocation listAlloc;
+ rsSetObject(&listAlloc, rsGetAllocation(gList));
+ int allocSize = rsAllocationGetDimX(listAlloc);
+
+ int width = rsgGetWidth();
+ int height = rsgGetHeight();
+
+ int itemHeight = 80;
+ int totalItemHeight = itemHeight * allocSize;
+
+ /* Prevent scrolling above the top of the list */
+ int firstItem = height - totalItemHeight;
+ if (firstItem < 0) {
+ firstItem = 0;
+ }
+
+ /* Prevent scrolling past the last line of the list */
+ int lastItem = -1 * (totalItemHeight - height);
+ if (lastItem > 0) {
+ lastItem = 0;
+ }
+
+ if (textPos > firstItem) {
+ textPos = firstItem;
+ }
+ else if (textPos < lastItem) {
+ textPos = lastItem;
+ }
+
+ int currentYPos = itemHeight + textPos;
+
+ for(int i = 0; i < allocSize; i ++) {
+ if(currentYPos - itemHeight > height) {
+ break;
+ }
+
+ if(currentYPos > 0) {
+ switch(gList[i].result) {
+ case 1: /* Passed */
+ rsgFontColor(0.5f, 0.9f, 0.5f, 1.0f);
+ break;
+ case -1: /* Failed */
+ rsgFontColor(0.9f, 0.5f, 0.5f, 1.0f);
+ break;
+ case 0: /* Still Testing */
+ rsgFontColor(0.9f, 0.9f, 0.5f, 1.0f);
+ break;
+ default: /* Unknown */
+ rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
+ break;
+ }
+ rsgDrawRect(0, currentYPos - 1, width, currentYPos, 0);
+ rsgDrawText(gList[i].text, 30, currentYPos - 32);
+ }
+ currentYPos += itemHeight;
+ }
+
+ return 10;
+}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstime.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstime.rs
new file mode 100644
index 0000000..5e3e078
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstime.rs
@@ -0,0 +1,52 @@
+#include "shared.rsh"
+
+static bool basic_test(uint32_t index) {
+ bool failed = false;
+
+ rs_time_t curTime = rsTime(0);
+ rs_tm tm;
+ rsDebug("curTime", curTime);
+
+ rsLocaltime(&tm, &curTime);
+
+ rsDebug("tm.tm_sec", tm.tm_sec);
+ rsDebug("tm.tm_min", tm.tm_min);
+ rsDebug("tm.tm_hour", tm.tm_hour);
+ rsDebug("tm.tm_mday", tm.tm_mday);
+ rsDebug("tm.tm_mon", tm.tm_mon);
+ rsDebug("tm.tm_year", tm.tm_year);
+ rsDebug("tm.tm_wday", tm.tm_wday);
+ rsDebug("tm.tm_yday", tm.tm_yday);
+ rsDebug("tm.tm_isdst", tm.tm_isdst);
+
+ // Test a specific time (only valid for PST localtime)
+ curTime = 1294438893;
+ rsLocaltime(&tm, &curTime);
+
+ _RS_ASSERT(tm.tm_sec == 33);
+ _RS_ASSERT(tm.tm_min == 21);
+ _RS_ASSERT(tm.tm_hour == 14);
+ _RS_ASSERT(tm.tm_mday == 7);
+ _RS_ASSERT(tm.tm_mon == 0);
+ _RS_ASSERT(tm.tm_year == 111);
+ _RS_ASSERT(tm.tm_wday == 5);
+ _RS_ASSERT(tm.tm_yday == 6);
+ _RS_ASSERT(tm.tm_isdst == 0);
+
+ return failed;
+}
+
+void test_rstime(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= basic_test(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ rsDebug("rstime_test FAILED", -1);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ rsDebug("rstime_test PASSED", 0);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstypes.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstypes.rs
new file mode 100644
index 0000000..f3bf244
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstypes.rs
@@ -0,0 +1,79 @@
+#include "shared.rsh"
+#include "rs_graphics.rsh"
+
+rs_element elementTest;
+rs_type typeTest;
+rs_allocation allocationTest;
+rs_sampler samplerTest;
+rs_script scriptTest;
+rs_mesh meshTest;
+rs_program_fragment program_fragmentTest;
+rs_program_vertex program_vertexTest;
+rs_program_raster program_rasterTest;
+rs_program_store program_storeTest;
+rs_font fontTest;
+
+rs_matrix4x4 matrix4x4Test;
+rs_matrix3x3 matrix3x3Test;
+rs_matrix2x2 matrix2x2Test;
+
+struct my_struct {
+ int i;
+ rs_font fontTestStruct;
+};
+
+static bool basic_test(uint32_t index) {
+ bool failed = false;
+
+ rs_matrix4x4 matrix4x4TestLocal;
+ rs_matrix3x3 matrix3x3TestLocal;
+ rs_matrix2x2 matrix2x2TestLocal;
+
+ // This test focuses primarily on compilation-time, not run-time.
+ rs_element elementTestLocal;
+ rs_type typeTestLocal;
+ rs_allocation allocationTestLocal;
+ rs_sampler samplerTestLocal;
+ rs_script scriptTestLocal;
+ rs_mesh meshTestLocal;
+ rs_program_fragment program_fragmentTestLocal;
+ rs_program_vertex program_vertexTestLocal;
+ rs_program_raster program_rasterTestLocal;
+ rs_program_store program_storeTestLocal;
+ rs_font fontTestLocal;
+
+ rs_font fontTestLocalArray[4];
+
+ rs_font fontTestLocalPreInit = fontTest;
+
+ struct my_struct structTest;
+
+ rsSetObject(&fontTestLocal, fontTest);
+ //allocationTestLocal = allocationTest;
+
+ rsSetObject(&fontTest, fontTestLocal);
+ //allocationTest = allocationTestLocal;
+
+ /*for (int i = 0; i < 4; i++) {
+ rsSetObject(&fontTestLocalArray[i], fontTestLocal);
+ }*/
+
+ /*rsSetObject(&fontTest, fontTestLocalArray[3]);*/
+
+ return failed;
+}
+
+void test_rstypes(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= basic_test(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ rsDebug("rstypes_test FAILED", -1);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ rsDebug("rstypes_test PASSED", 0);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/shared.rsh b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/shared.rsh
new file mode 100644
index 0000000..6d34481
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/shared.rsh
@@ -0,0 +1,38 @@
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.rs.test_v11)
+
+typedef struct TestResult_s {
+ rs_allocation name;
+ bool pass;
+ float score;
+ int64_t time;
+} TestResult;
+//TestResult *g_results;
+
+static int64_t g_time;
+
+static void start(void) {
+ g_time = rsUptimeMillis();
+}
+
+static float end(uint32_t idx) {
+ int64_t t = rsUptimeMillis() - g_time;
+ //g_results[idx].time = t;
+ //rsDebug("test time", (int)t);
+ return ((float)t) / 1000.f;
+}
+
+#define _RS_ASSERT(b) \
+do { \
+ if (!(b)) { \
+ failed = true; \
+ rsDebug(#b " FAILED", 0); \
+ } \
+\
+} while (0)
+
+/* These constants must match those in UnitTest.java */
+static const int RS_MSG_TEST_PASSED = 100;
+static const int RS_MSG_TEST_FAILED = 101;
+
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/test_root.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/test_root.rs
new file mode 100644
index 0000000..6dc83ba
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/test_root.rs
@@ -0,0 +1,23 @@
+// Fountain test script
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.rs.test)
+
+#pragma stateFragment(parent)
+
+#include "rs_graphics.rsh"
+
+
+typedef struct TestResult {
+ rs_allocation name;
+ bool pass;
+ float score;
+} TestResult_t;
+TestResult_t *results;
+
+int root() {
+
+ return 0;
+}
+
+
diff --git a/tests/RenderScriptTests/tests_v14/Android.mk b/tests/RenderScriptTests/tests_v14/Android.mk
new file mode 100644
index 0000000..c4c3a37
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/Android.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
+
+LOCAL_PACKAGE_NAME := RSTest_v14
+LOCAL_SDK_VERSION := 14
+
+include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/tests_v14/AndroidManifest.xml b/tests/RenderScriptTests/tests_v14/AndroidManifest.xml
new file mode 100644
index 0000000..1cd9bbd
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.rs.test_v14">
+ <uses-sdk android:minSdkVersion="14" />
+ <application
+ android:label="_RS_Test_v14"
+ android:icon="@drawable/test_pattern">
+ <activity android:name="RSTest_v14"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/tests/RenderScriptTests/tests_v14/res/drawable-nodpi/test_pattern.png b/tests/RenderScriptTests/tests_v14/res/drawable-nodpi/test_pattern.png
new file mode 100644
index 0000000..e7d1455
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/res/drawable-nodpi/test_pattern.png
Binary files differ
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestCore.java
new file mode 100644
index 0000000..f1e81a4
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestCore.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2008-2011 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+import android.util.Log;
+import java.util.ArrayList;
+import java.util.ListIterator;
+import java.util.Timer;
+import java.util.TimerTask;
+
+
+public class RSTestCore {
+ int mWidth;
+ int mHeight;
+ Context mCtx;
+
+ public RSTestCore(Context ctx) {
+ mCtx = ctx;
+ }
+
+ private Resources mRes;
+ private RenderScriptGL mRS;
+
+ private Font mFont;
+ ScriptField_ListAllocs_s mListAllocs;
+ int mLastX;
+ int mLastY;
+ private ScriptC_rslist mScript;
+
+ private ArrayList<UnitTest> unitTests;
+ private ListIterator<UnitTest> test_iter;
+ private UnitTest activeTest;
+ private boolean stopTesting;
+
+ /* Periodic timer for ensuring future tests get scheduled */
+ private Timer mTimer;
+ public static final int RS_TIMER_PERIOD = 100;
+
+ public void init(RenderScriptGL rs, Resources res, int width, int height) {
+ mRS = rs;
+ mRes = res;
+ mWidth = width;
+ mHeight = height;
+ stopTesting = false;
+
+ mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);
+
+ unitTests = new ArrayList<UnitTest>();
+
+ unitTests.add(new UT_primitives(this, mRes, mCtx));
+ unitTests.add(new UT_vector(this, mRes, mCtx));
+ unitTests.add(new UT_rsdebug(this, mRes, mCtx));
+ unitTests.add(new UT_rstime(this, mRes, mCtx));
+ unitTests.add(new UT_rstypes(this, mRes, mCtx));
+ unitTests.add(new UT_alloc(this, mRes, mCtx));
+ unitTests.add(new UT_refcount(this, mRes, mCtx));
+ unitTests.add(new UT_foreach(this, mRes, mCtx));
+ unitTests.add(new UT_math(this, mRes, mCtx));
+ unitTests.add(new UT_fp_mad(this, mRes, mCtx));
+ /*
+ unitTests.add(new UnitTest(null, "<Pass>", 1));
+ unitTests.add(new UnitTest());
+ unitTests.add(new UnitTest(null, "<Fail>", -1));
+
+ for (int i = 0; i < 20; i++) {
+ unitTests.add(new UnitTest(null, "<Pass>", 1));
+ }
+ */
+
+ UnitTest [] uta = new UnitTest[unitTests.size()];
+ uta = unitTests.toArray(uta);
+
+ mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
+ for (int i = 0; i < uta.length; i++) {
+ ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
+ listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
+ listElem.result = uta[i].result;
+ mListAllocs.set(listElem, i, false);
+ uta[i].setItem(listElem);
+ }
+
+ mListAllocs.copyAll();
+
+ mScript.bind_gList(mListAllocs);
+
+ mFont = Font.create(mRS, mRes, "serif", Font.Style.BOLD, 8);
+ mScript.set_gFont(mFont);
+
+ mRS.bindRootScript(mScript);
+
+ test_iter = unitTests.listIterator();
+ refreshTestResults(); /* Kick off the first test */
+
+ TimerTask pTask = new TimerTask() {
+ public void run() {
+ refreshTestResults();
+ }
+ };
+
+ mTimer = new Timer();
+ mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
+ }
+
+ public void checkAndRunNextTest() {
+ if (activeTest != null) {
+ if (!activeTest.isAlive()) {
+ /* Properly clean up on our last test */
+ try {
+ activeTest.join();
+ }
+ catch (InterruptedException e) {
+ }
+ activeTest = null;
+ }
+ }
+
+ if (!stopTesting && activeTest == null) {
+ if (test_iter.hasNext()) {
+ activeTest = test_iter.next();
+ activeTest.start();
+ /* This routine will only get called once when a new test
+ * should start running. The message handler in UnitTest.java
+ * ensures this. */
+ }
+ else {
+ if (mTimer != null) {
+ mTimer.cancel();
+ mTimer.purge();
+ mTimer = null;
+ }
+ }
+ }
+ }
+
+ public void refreshTestResults() {
+ checkAndRunNextTest();
+
+ if (mListAllocs != null && mScript != null && mRS != null) {
+ mListAllocs.copyAll();
+
+ mScript.bind_gList(mListAllocs);
+ mRS.bindRootScript(mScript);
+ }
+ }
+
+ public void cleanup() {
+ stopTesting = true;
+ UnitTest t = activeTest;
+
+ /* Stop periodic refresh of testing */
+ if (mTimer != null) {
+ mTimer.cancel();
+ mTimer.purge();
+ mTimer = null;
+ }
+
+ /* Wait to exit until we finish the current test */
+ if (t != null) {
+ try {
+ t.join();
+ }
+ catch (InterruptedException e) {
+ }
+ t = null;
+ }
+
+ }
+
+ public void newTouchPosition(float x, float y, float pressure, int id) {
+ }
+
+ public void onActionDown(int x, int y) {
+ mScript.set_gDY(0.0f);
+ mLastX = x;
+ mLastY = y;
+ refreshTestResults();
+ }
+
+ public void onActionMove(int x, int y) {
+ int dx = mLastX - x;
+ int dy = mLastY - y;
+
+ if (Math.abs(dy) <= 2) {
+ dy = 0;
+ }
+
+ mScript.set_gDY(dy);
+
+ mLastX = x;
+ mLastY = y;
+ refreshTestResults();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestView.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestView.java
new file mode 100644
index 0000000..40192e4
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestView.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.concurrent.Semaphore;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+import android.renderscript.RenderScriptGL;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+public class RSTestView extends RSSurfaceView {
+
+ private Context mCtx;
+
+ public RSTestView(Context context) {
+ super(context);
+ mCtx = context;
+ //setFocusable(true);
+ }
+
+ private RenderScriptGL mRS;
+ private RSTestCore mRender;
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
+ if (mRS == null) {
+ RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
+ mRS = createRenderScriptGL(sc);
+ mRS.setSurface(holder, w, h);
+ mRender = new RSTestCore(mCtx);
+ mRender.init(mRS, getResources(), w, h);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ if(mRS != null) {
+ mRender.cleanup();
+ mRS = null;
+ destroyRenderScriptGL();
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event)
+ {
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev)
+ {
+ boolean ret = false;
+ int act = ev.getAction();
+ if (act == ev.ACTION_DOWN) {
+ mRender.onActionDown((int)ev.getX(), (int)ev.getY());
+ ret = true;
+ }
+ else if (act == ev.ACTION_MOVE) {
+ mRender.onActionMove((int)ev.getX(), (int)ev.getY());
+ ret = true;
+ }
+
+ return ret;
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTest_v14.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTest_v14.java
new file mode 100644
index 0000000..da09691
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTest_v14.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.provider.Settings.System;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ListView;
+
+import java.lang.Runtime;
+
+public class RSTest_v14 extends Activity {
+ //EventListener mListener = new EventListener();
+
+ private static final String LOG_TAG = "RSTest_v14";
+ private static final boolean DEBUG = false;
+ private static final boolean LOG_ENABLED = false;
+
+ private RSTestView mView;
+
+ // get the current looper (from your Activity UI thread for instance
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ // Create our Preview view and set it as the content of our
+ // Activity
+ mView = new RSTestView(this);
+ setContentView(mView);
+ }
+
+ @Override
+ protected void onResume() {
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity loses focus
+ super.onResume();
+ mView.resume();
+ }
+
+ @Override
+ protected void onPause() {
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity loses focus
+ super.onPause();
+ mView.pause();
+ }
+
+ @Override
+ protected void onStop() {
+ // Actually kill the app if we are stopping. We don't want to
+ // continue/resume this test ever. It should always start fresh.
+ finish();
+ super.onStop();
+ }
+
+ static void log(String message) {
+ if (LOG_ENABLED) {
+ Log.v(LOG_TAG, message);
+ }
+ }
+
+
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java
new file mode 100644
index 0000000..da42b29
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_alloc extends UnitTest {
+ private Resources mRes;
+
+ protected UT_alloc(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Alloc", ctx);
+ mRes = res;
+ }
+
+ private void initializeGlobals(RenderScript RS, ScriptC_alloc s) {
+ Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
+ int X = 5;
+ int Y = 7;
+ int Z = 0;
+ s.set_dimX(X);
+ s.set_dimY(Y);
+ s.set_dimZ(Z);
+ typeBuilder.setX(X).setY(Y);
+ Allocation A = Allocation.createTyped(RS, typeBuilder.create());
+ s.bind_a(A);
+
+ typeBuilder = new Type.Builder(RS, Element.I32(RS));
+ typeBuilder.setX(X).setY(Y).setFaces(true);
+ Allocation AFaces = Allocation.createTyped(RS, typeBuilder.create());
+ s.set_aFaces(AFaces);
+ typeBuilder.setFaces(false).setMipmaps(true);
+ Allocation ALOD = Allocation.createTyped(RS, typeBuilder.create());
+ s.set_aLOD(ALOD);
+ typeBuilder.setFaces(true).setMipmaps(true);
+ Allocation AFacesLOD = Allocation.createTyped(RS, typeBuilder.create());
+ s.set_aFacesLOD(AFacesLOD);
+
+ return;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_alloc s = new ScriptC_alloc(pRS, mRes, R.raw.alloc);
+ pRS.setMessageHandler(mRsMessage);
+ initializeGlobals(pRS, s);
+ s.invoke_alloc_test();
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java
new file mode 100644
index 0000000..aeb5bb7
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_foreach extends UnitTest {
+ private Resources mRes;
+ private Allocation A;
+
+ protected UT_foreach(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "ForEach", ctx);
+ mRes = res;
+ }
+
+ private void initializeGlobals(RenderScript RS, ScriptC_foreach s) {
+ Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
+ int X = 5;
+ int Y = 7;
+ s.set_dimX(X);
+ s.set_dimY(Y);
+ typeBuilder.setX(X).setY(Y);
+ A = Allocation.createTyped(RS, typeBuilder.create());
+ s.bind_a(A);
+
+ return;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_foreach s = new ScriptC_foreach(pRS, mRes, R.raw.foreach);
+ pRS.setMessageHandler(mRsMessage);
+ initializeGlobals(pRS, s);
+ s.forEach_root(A);
+ s.invoke_foreach_test();
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_fp_mad.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_fp_mad.java
new file mode 100644
index 0000000..239496a
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_fp_mad.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_fp_mad extends UnitTest {
+ private Resources mRes;
+
+ protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Fp_Mad", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_fp_mad s = new ScriptC_fp_mad(pRS, mRes, R.raw.fp_mad);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_fp_mad_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_math.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_math.java
new file mode 100644
index 0000000..7b135c4
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_math.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_math extends UnitTest {
+ private Resources mRes;
+
+ protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Math", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_math s = new ScriptC_math(pRS, mRes, R.raw.math);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_math_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_primitives.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_primitives.java
new file mode 100644
index 0000000..d3c56f3
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_primitives.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_primitives extends UnitTest {
+ private Resources mRes;
+
+ protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Primitives", ctx);
+ mRes = res;
+ }
+
+ private boolean initializeGlobals(ScriptC_primitives s) {
+ float pF = s.get_floatTest();
+ if (pF != 1.99f) {
+ return false;
+ }
+ s.set_floatTest(2.99f);
+
+ double pD = s.get_doubleTest();
+ if (pD != 2.05) {
+ return false;
+ }
+ s.set_doubleTest(3.05);
+
+ byte pC = s.get_charTest();
+ if (pC != -8) {
+ return false;
+ }
+ s.set_charTest((byte)-16);
+
+ short pS = s.get_shortTest();
+ if (pS != -16) {
+ return false;
+ }
+ s.set_shortTest((short)-32);
+
+ int pI = s.get_intTest();
+ if (pI != -32) {
+ return false;
+ }
+ s.set_intTest(-64);
+
+ long pL = s.get_longTest();
+ if (pL != 17179869184l) {
+ return false;
+ }
+ s.set_longTest(17179869185l);
+
+ long puL = s.get_ulongTest();
+ if (puL != 4611686018427387904L) {
+ return false;
+ }
+ s.set_ulongTest(4611686018427387903L);
+
+
+ long pLL = s.get_longlongTest();
+ if (pLL != 68719476736L) {
+ return false;
+ }
+ s.set_longlongTest(68719476735L);
+
+ long pu64 = s.get_uint64_tTest();
+ if (pu64 != 117179869184l) {
+ return false;
+ }
+ s.set_uint64_tTest(117179869185l);
+
+ return true;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
+ pRS.setMessageHandler(mRsMessage);
+ if (!initializeGlobals(s)) {
+ // initializeGlobals failed
+ result = -1;
+ } else {
+ s.invoke_primitives_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ }
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_refcount.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_refcount.java
new file mode 100644
index 0000000..05a516b
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_refcount.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_refcount extends UnitTest {
+ private Resources mRes;
+
+ protected UT_refcount(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Refcount", ctx);
+ mRes = res;
+ }
+
+ private void initializeGlobals(RenderScript RS, ScriptC_refcount s) {
+ Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
+ int X = 500;
+ int Y = 700;
+ typeBuilder.setX(X).setY(Y);
+ Allocation A = Allocation.createTyped(RS, typeBuilder.create());
+ s.set_globalA(A);
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ pRS.setMessageHandler(mRsMessage);
+ ScriptC_refcount s = new ScriptC_refcount(pRS, mRes, R.raw.refcount);
+ initializeGlobals(pRS, s);
+ s.invoke_refcount_test();
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rsdebug.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rsdebug.java
new file mode 100644
index 0000000..95e92ee
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rsdebug.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_rsdebug extends UnitTest {
+ private Resources mRes;
+
+ protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "rsDebug", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_rsdebug s = new ScriptC_rsdebug(pRS, mRes, R.raw.rsdebug);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_test_rsdebug(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstime.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstime.java
new file mode 100644
index 0000000..a72ede9
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstime.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_rstime extends UnitTest {
+ private Resources mRes;
+
+ protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "rsTime", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_rstime s = new ScriptC_rstime(pRS, mRes, R.raw.rstime);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_test_rstime(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstypes.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstypes.java
new file mode 100644
index 0000000..ab96867
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstypes.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_rstypes extends UnitTest {
+ private Resources mRes;
+
+ protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "rsTypes", ctx);
+ mRes = res;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_rstypes s = new ScriptC_rstypes(pRS, mRes, R.raw.rstypes);
+ pRS.setMessageHandler(mRsMessage);
+ s.invoke_test_rstypes(0, 0);
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_vector.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_vector.java
new file mode 100644
index 0000000..657413e
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_vector.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+public class UT_vector extends UnitTest {
+ private Resources mRes;
+
+ protected UT_vector(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Vector", ctx);
+ mRes = res;
+ }
+
+ private boolean initializeGlobals(ScriptC_vector s) {
+ Float2 F2 = s.get_f2();
+ if (F2.x != 1.0f || F2.y != 2.0f) {
+ return false;
+ }
+ F2.x = 2.99f;
+ F2.y = 3.99f;
+ s.set_f2(F2);
+
+ Float3 F3 = s.get_f3();
+ if (F3.x != 1.0f || F3.y != 2.0f || F3.z != 3.0f) {
+ return false;
+ }
+ F3.x = 2.99f;
+ F3.y = 3.99f;
+ F3.z = 4.99f;
+ s.set_f3(F3);
+
+ Float4 F4 = s.get_f4();
+ if (F4.x != 1.0f || F4.y != 2.0f || F4.z != 3.0f || F4.w != 4.0f) {
+ return false;
+ }
+ F4.x = 2.99f;
+ F4.y = 3.99f;
+ F4.z = 4.99f;
+ F4.w = 5.99f;
+ s.set_f4(F4);
+
+ Double2 D2 = s.get_d2();
+ if (D2.x != 1.0 || D2.y != 2.0) {
+ return false;
+ }
+ D2.x = 2.99;
+ D2.y = 3.99;
+ s.set_d2(D2);
+
+ Double3 D3 = s.get_d3();
+ if (D3.x != 1.0 || D3.y != 2.0 || D3.z != 3.0) {
+ return false;
+ }
+ D3.x = 2.99;
+ D3.y = 3.99;
+ D3.z = 4.99;
+ s.set_d3(D3);
+
+ Double4 D4 = s.get_d4();
+ if (D4.x != 1.0 || D4.y != 2.0 || D4.z != 3.0 || D4.w != 4.0) {
+ return false;
+ }
+ D4.x = 2.99;
+ D4.y = 3.99;
+ D4.z = 4.99;
+ D4.w = 5.99;
+ s.set_d4(D4);
+
+ Byte2 B2 = s.get_i8_2();
+ if (B2.x != 1 || B2.y != 2) {
+ return false;
+ }
+ B2.x = 2;
+ B2.y = 3;
+ s.set_i8_2(B2);
+
+ Byte3 B3 = s.get_i8_3();
+ if (B3.x != 1 || B3.y != 2 || B3.z != 3) {
+ return false;
+ }
+ B3.x = 2;
+ B3.y = 3;
+ B3.z = 4;
+ s.set_i8_3(B3);
+
+ Byte4 B4 = s.get_i8_4();
+ if (B4.x != 1 || B4.y != 2 || B4.z != 3 || B4.w != 4) {
+ return false;
+ }
+ B4.x = 2;
+ B4.y = 3;
+ B4.z = 4;
+ B4.w = 5;
+ s.set_i8_4(B4);
+
+ Short2 S2 = s.get_u8_2();
+ if (S2.x != 1 || S2.y != 2) {
+ return false;
+ }
+ S2.x = 2;
+ S2.y = 3;
+ s.set_u8_2(S2);
+
+ Short3 S3 = s.get_u8_3();
+ if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
+ return false;
+ }
+ S3.x = 2;
+ S3.y = 3;
+ S3.z = 4;
+ s.set_u8_3(S3);
+
+ Short4 S4 = s.get_u8_4();
+ if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
+ return false;
+ }
+ S4.x = 2;
+ S4.y = 3;
+ S4.z = 4;
+ S4.w = 5;
+ s.set_u8_4(S4);
+
+ S2 = s.get_i16_2();
+ if (S2.x != 1 || S2.y != 2) {
+ return false;
+ }
+ S2.x = 2;
+ S2.y = 3;
+ s.set_i16_2(S2);
+
+ S3 = s.get_i16_3();
+ if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
+ return false;
+ }
+ S3.x = 2;
+ S3.y = 3;
+ S3.z = 4;
+ s.set_i16_3(S3);
+
+ S4 = s.get_i16_4();
+ if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
+ return false;
+ }
+ S4.x = 2;
+ S4.y = 3;
+ S4.z = 4;
+ S4.w = 5;
+ s.set_i16_4(S4);
+
+ Int2 I2 = s.get_u16_2();
+ if (I2.x != 1 || I2.y != 2) {
+ return false;
+ }
+ I2.x = 2;
+ I2.y = 3;
+ s.set_u16_2(I2);
+
+ Int3 I3 = s.get_u16_3();
+ if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
+ return false;
+ }
+ I3.x = 2;
+ I3.y = 3;
+ I3.z = 4;
+ s.set_u16_3(I3);
+
+ Int4 I4 = s.get_u16_4();
+ if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
+ return false;
+ }
+ I4.x = 2;
+ I4.y = 3;
+ I4.z = 4;
+ I4.w = 5;
+ s.set_u16_4(I4);
+
+ I2 = s.get_i32_2();
+ if (I2.x != 1 || I2.y != 2) {
+ return false;
+ }
+ I2.x = 2;
+ I2.y = 3;
+ s.set_i32_2(I2);
+
+ I3 = s.get_i32_3();
+ if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
+ return false;
+ }
+ I3.x = 2;
+ I3.y = 3;
+ I3.z = 4;
+ s.set_i32_3(I3);
+
+ I4 = s.get_i32_4();
+ if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
+ return false;
+ }
+ I4.x = 2;
+ I4.y = 3;
+ I4.z = 4;
+ I4.w = 5;
+ s.set_i32_4(I4);
+
+ Long2 L2 = s.get_u32_2();
+ if (L2.x != 1 || L2.y != 2) {
+ return false;
+ }
+ L2.x = 2;
+ L2.y = 3;
+ s.set_u32_2(L2);
+
+ Long3 L3 = s.get_u32_3();
+ if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
+ return false;
+ }
+ L3.x = 2;
+ L3.y = 3;
+ L3.z = 4;
+ s.set_u32_3(L3);
+
+ Long4 L4 = s.get_u32_4();
+ if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
+ return false;
+ }
+ L4.x = 2;
+ L4.y = 3;
+ L4.z = 4;
+ L4.w = 5;
+ s.set_u32_4(L4);
+
+ L2 = s.get_i64_2();
+ if (L2.x != 1 || L2.y != 2) {
+ return false;
+ }
+ L2.x = 2;
+ L2.y = 3;
+ s.set_i64_2(L2);
+
+ L3 = s.get_i64_3();
+ if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
+ return false;
+ }
+ L3.x = 2;
+ L3.y = 3;
+ L3.z = 4;
+ s.set_i64_3(L3);
+
+ L4 = s.get_i64_4();
+ if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
+ return false;
+ }
+ L4.x = 2;
+ L4.y = 3;
+ L4.z = 4;
+ L4.w = 5;
+ s.set_i64_4(L4);
+
+ L2 = s.get_u64_2();
+ if (L2.x != 1 || L2.y != 2) {
+ return false;
+ }
+ L2.x = 2;
+ L2.y = 3;
+ s.set_u64_2(L2);
+
+ L3 = s.get_u64_3();
+ if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
+ return false;
+ }
+ L3.x = 2;
+ L3.y = 3;
+ L3.z = 4;
+ s.set_u64_3(L3);
+
+ L4 = s.get_u64_4();
+ if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
+ return false;
+ }
+ L4.x = 2;
+ L4.y = 3;
+ L4.z = 4;
+ L4.w = 5;
+ s.set_u64_4(L4);
+
+ return true;
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_vector s = new ScriptC_vector(pRS, mRes, R.raw.vector);
+ pRS.setMessageHandler(mRsMessage);
+ if (!initializeGlobals(s)) {
+ result = -1;
+ } else {
+ s.invoke_vector_test();
+ pRS.finish();
+ waitForMessage();
+ }
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UnitTest.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UnitTest.java
new file mode 100644
index 0000000..558a252
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UnitTest.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.rs.test_v14;
+import android.content.Context;
+import android.util.Log;
+import android.renderscript.RenderScript.RSMessageHandler;
+
+public class UnitTest extends Thread {
+ public String name;
+ public int result;
+ private ScriptField_ListAllocs_s.Item mItem;
+ private RSTestCore mRSTC;
+ private boolean msgHandled;
+ protected Context mCtx;
+
+ /* These constants must match those in shared.rsh */
+ public static final int RS_MSG_TEST_PASSED = 100;
+ public static final int RS_MSG_TEST_FAILED = 101;
+
+ private static int numTests = 0;
+ public int testID;
+
+ protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
+ super();
+ mRSTC = rstc;
+ name = n;
+ msgHandled = false;
+ mCtx = ctx;
+ result = initResult;
+ testID = numTests++;
+ }
+
+ protected UnitTest(RSTestCore rstc, String n, Context ctx) {
+ this(rstc, n, 0, ctx);
+ }
+
+ protected UnitTest(RSTestCore rstc, Context ctx) {
+ this (rstc, "<Unknown>", ctx);
+ }
+
+ protected UnitTest(Context ctx) {
+ this (null, ctx);
+ }
+
+ protected void _RS_ASSERT(String message, boolean b) {
+ if(b == false) {
+ result = -1;
+ Log.e(name, message + " FAILED");
+ }
+ }
+
+ protected void updateUI() {
+ if (mItem != null) {
+ mItem.result = result;
+ msgHandled = true;
+ try {
+ mRSTC.refreshTestResults();
+ }
+ catch (IllegalStateException e) {
+ /* Ignore the case where our message receiver has been
+ disconnected. This happens when we leave the application
+ before it finishes running all of the unit tests. */
+ }
+ }
+ }
+
+ protected RSMessageHandler mRsMessage = new RSMessageHandler() {
+ public void run() {
+ if (result == 0) {
+ switch (mID) {
+ case RS_MSG_TEST_PASSED:
+ result = 1;
+ break;
+ case RS_MSG_TEST_FAILED:
+ result = -1;
+ break;
+ default:
+ RSTest_v14.log("Unit test got unexpected message");
+ return;
+ }
+ }
+
+ updateUI();
+ }
+ };
+
+ public void waitForMessage() {
+ while (!msgHandled) {
+ yield();
+ }
+ }
+
+ public void setItem(ScriptField_ListAllocs_s.Item item) {
+ mItem = item;
+ }
+
+ public void run() {
+ /* This method needs to be implemented for each subclass */
+ if (mRSTC != null) {
+ mRSTC.refreshTestResults();
+ }
+ }
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs
new file mode 100644
index 0000000..3116e5a
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs
@@ -0,0 +1,94 @@
+#include "shared.rsh"
+
+int *a;
+int dimX;
+int dimY;
+int dimZ;
+
+rs_allocation aFaces;
+rs_allocation aLOD;
+rs_allocation aFacesLOD;
+
+static bool test_alloc_dims() {
+ bool failed = false;
+ int i, j;
+
+ for (j = 0; j < dimY; j++) {
+ for (i = 0; i < dimX; i++) {
+ a[i + j * dimX] = i + j * dimX;
+ }
+ }
+
+ rs_allocation alloc = rsGetAllocation(a);
+ _RS_ASSERT(rsAllocationGetDimX(alloc) == dimX);
+ _RS_ASSERT(rsAllocationGetDimY(alloc) == dimY);
+ _RS_ASSERT(rsAllocationGetDimZ(alloc) == dimZ);
+
+ // Test 2D addressing
+ for (j = 0; j < dimY; j++) {
+ for (i = 0; i < dimX; i++) {
+ rsDebug("Verifying ", i + j * dimX);
+ const void *p = rsGetElementAt(alloc, i, j);
+ int val = *(const int *)p;
+ _RS_ASSERT(val == (i + j * dimX));
+ }
+ }
+
+ // Test 1D addressing
+ for (i = 0; i < dimX * dimY; i++) {
+ rsDebug("Verifying ", i);
+ const void *p = rsGetElementAt(alloc, i);
+ int val = *(const int *)p;
+ _RS_ASSERT(val == i);
+ }
+
+ // Test 3D addressing
+ for (j = 0; j < dimY; j++) {
+ for (i = 0; i < dimX; i++) {
+ rsDebug("Verifying ", i + j * dimX);
+ const void *p = rsGetElementAt(alloc, i, j, 0);
+ int val = *(const int *)p;
+ _RS_ASSERT(val == (i + j * dimX));
+ }
+ }
+
+ _RS_ASSERT(rsAllocationGetDimX(aFaces) == dimX);
+ _RS_ASSERT(rsAllocationGetDimY(aFaces) == dimY);
+ _RS_ASSERT(rsAllocationGetDimZ(aFaces) == dimZ);
+ _RS_ASSERT(rsAllocationGetDimFaces(aFaces) != 0);
+ _RS_ASSERT(rsAllocationGetDimLOD(aFaces) == 0);
+
+ _RS_ASSERT(rsAllocationGetDimX(aLOD) == dimX);
+ _RS_ASSERT(rsAllocationGetDimY(aLOD) == dimY);
+ _RS_ASSERT(rsAllocationGetDimZ(aLOD) == dimZ);
+ _RS_ASSERT(rsAllocationGetDimFaces(aLOD) == 0);
+ _RS_ASSERT(rsAllocationGetDimLOD(aLOD) != 0);
+
+ _RS_ASSERT(rsAllocationGetDimX(aFacesLOD) == dimX);
+ _RS_ASSERT(rsAllocationGetDimY(aFacesLOD) == dimY);
+ _RS_ASSERT(rsAllocationGetDimZ(aFacesLOD) == dimZ);
+ _RS_ASSERT(rsAllocationGetDimFaces(aFacesLOD) != 0);
+ _RS_ASSERT(rsAllocationGetDimLOD(aFacesLOD) != 0);
+
+ if (failed) {
+ rsDebug("test_alloc_dims FAILED", 0);
+ }
+ else {
+ rsDebug("test_alloc_dims PASSED", 0);
+ }
+
+ return failed;
+}
+
+void alloc_test() {
+ bool failed = false;
+ failed |= test_alloc_dims();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs
new file mode 100644
index 0000000..3ba3eef
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs
@@ -0,0 +1,42 @@
+#include "shared.rsh"
+
+int *a;
+int dimX;
+int dimY;
+
+void root(int *out, uint32_t x, uint32_t y) {
+ *out = x + y * dimX;
+}
+
+static bool test_foreach_output() {
+ bool failed = false;
+ int i, j;
+
+ for (j = 0; j < dimY; j++) {
+ for (i = 0; i < dimX; i++) {
+ _RS_ASSERT(a[i + j * dimX] == (i + j * dimX));
+ }
+ }
+
+ if (failed) {
+ rsDebug("test_foreach_output FAILED", 0);
+ }
+ else {
+ rsDebug("test_foreach_output PASSED", 0);
+ }
+
+ return failed;
+}
+
+void foreach_test() {
+ bool failed = false;
+ failed |= test_foreach_output();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/fp_mad.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/fp_mad.rs
new file mode 100644
index 0000000..b6f2b2a6
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/fp_mad.rs
@@ -0,0 +1,174 @@
+#include "shared.rsh"
+
+const int TEST_COUNT = 1;
+
+static float data_f1[1025];
+static float4 data_f4[1025];
+
+static void test_mad4(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~1 billion ops
+ for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = (data_f4[i] * 0.02f +
+ data_f4[i+1] * 0.04f +
+ data_f4[i+2] * 0.05f +
+ data_f4[i+3] * 0.1f +
+ data_f4[i+4] * 0.2f +
+ data_f4[i+5] * 0.2f +
+ data_f4[i+6] * 0.1f +
+ data_f4[i+7] * 0.05f +
+ data_f4[i+8] * 0.04f +
+ data_f4[i+9] * 0.02f + 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_mad4 M ops", 1000.f / time);
+}
+
+static void test_mad(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~1 billion ops
+ for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f1[i] = (data_f1[i] * 0.02f +
+ data_f1[i+1] * 0.04f +
+ data_f1[i+2] * 0.05f +
+ data_f1[i+3] * 0.1f +
+ data_f1[i+4] * 0.2f +
+ data_f1[i+5] * 0.2f +
+ data_f1[i+6] * 0.1f +
+ data_f1[i+7] * 0.05f +
+ data_f1[i+8] * 0.04f +
+ data_f1[i+9] * 0.02f + 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_mad M ops", 1000.f / time);
+}
+
+static void test_norm(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~10 M ops
+ for (int ct=0; ct < 1000 * 10; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = normalize(data_f4[i]);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_norm M ops", 10.f / time);
+}
+
+static void test_sincos4(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~10 M ops
+ for (int ct=0; ct < 1000 * 10 / 4; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_sincos4 M ops", 10.f / time);
+}
+
+static void test_sincos(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~10 M ops
+ for (int ct=0; ct < 1000 * 10; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_sincos M ops", 10.f / time);
+}
+
+static void test_clamp(uint32_t index) {
+ start();
+
+ // Do ~100 M ops
+ for (int ct=0; ct < 1000 * 100; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_clamp M ops", 100.f / time);
+
+ start();
+ // Do ~100 M ops
+ for (int ct=0; ct < 1000 * 100; ct++) {
+ for (int i=0; i < (1000); i++) {
+ if (data_f1[i] < -1.f) data_f1[i] = -1.f;
+ if (data_f1[i] > -1.f) data_f1[i] = 1.f;
+ }
+ }
+
+ time = end(index);
+ rsDebug("fp_clamp ref M ops", 100.f / time);
+}
+
+static void test_clamp4(uint32_t index) {
+ start();
+
+ float total = 0;
+ // Do ~100 M ops
+ for (int ct=0; ct < 1000 * 100 /4; ct++) {
+ for (int i=0; i < (1000); i++) {
+ data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
+ }
+ }
+
+ float time = end(index);
+ rsDebug("fp_clamp4 M ops", 100.f / time);
+}
+
+void fp_mad_test(uint32_t index, int test_num) {
+ int x;
+ for (x=0; x < 1025; x++) {
+ data_f1[x] = (x & 0xf) * 0.1f;
+ data_f4[x].x = (x & 0xf) * 0.1f;
+ data_f4[x].y = (x & 0xf0) * 0.1f;
+ data_f4[x].z = (x & 0x33) * 0.1f;
+ data_f4[x].w = (x & 0x77) * 0.1f;
+ }
+
+ test_mad4(index);
+ test_mad(index);
+
+ for (x=0; x < 1025; x++) {
+ data_f1[x] = (x & 0xf) * 0.1f + 1.f;
+ data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
+ data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
+ data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
+ data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
+ }
+
+ test_norm(index);
+ test_sincos4(index);
+ test_sincos(index);
+ test_clamp4(index);
+ test_clamp(index);
+
+ // TODO Actually verify test result accuracy
+ rsDebug("fp_mad_test PASSED", 0);
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+}
+
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs
new file mode 100644
index 0000000..e6b37f6
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs
@@ -0,0 +1,462 @@
+#include "shared.rsh"
+
+// Testing math library
+
+volatile float f1;
+volatile float2 f2;
+volatile float3 f3;
+volatile float4 f4;
+
+volatile int i1;
+volatile int2 i2;
+volatile int3 i3;
+volatile int4 i4;
+
+volatile uint ui1;
+volatile uint2 ui2;
+volatile uint3 ui3;
+volatile uint4 ui4;
+
+volatile short s1;
+volatile short2 s2;
+volatile short3 s3;
+volatile short4 s4;
+
+volatile ushort us1;
+volatile ushort2 us2;
+volatile ushort3 us3;
+volatile ushort4 us4;
+
+volatile char c1;
+volatile char2 c2;
+volatile char3 c3;
+volatile char4 c4;
+
+volatile uchar uc1;
+volatile uchar2 uc2;
+volatile uchar3 uc3;
+volatile uchar4 uc4;
+
+#define DECL_INT(prefix) \
+volatile char prefix##_c_1 = 1; \
+volatile char2 prefix##_c_2 = 1; \
+volatile char3 prefix##_c_3 = 1; \
+volatile char4 prefix##_c_4 = 1; \
+volatile uchar prefix##_uc_1 = 1; \
+volatile uchar2 prefix##_uc_2 = 1; \
+volatile uchar3 prefix##_uc_3 = 1; \
+volatile uchar4 prefix##_uc_4 = 1; \
+volatile short prefix##_s_1 = 1; \
+volatile short2 prefix##_s_2 = 1; \
+volatile short3 prefix##_s_3 = 1; \
+volatile short4 prefix##_s_4 = 1; \
+volatile ushort prefix##_us_1 = 1; \
+volatile ushort2 prefix##_us_2 = 1; \
+volatile ushort3 prefix##_us_3 = 1; \
+volatile ushort4 prefix##_us_4 = 1; \
+volatile int prefix##_i_1 = 1; \
+volatile int2 prefix##_i_2 = 1; \
+volatile int3 prefix##_i_3 = 1; \
+volatile int4 prefix##_i_4 = 1; \
+volatile uint prefix##_ui_1 = 1; \
+volatile uint2 prefix##_ui_2 = 1; \
+volatile uint3 prefix##_ui_3 = 1; \
+volatile uint4 prefix##_ui_4 = 1; \
+volatile long prefix##_l_1 = 1; \
+volatile ulong prefix##_ul_1 = 1;
+
+DECL_INT(res)
+DECL_INT(src1)
+DECL_INT(src2)
+
+#define TEST_INT_OP_TYPE(op, type) \
+rsDebug("Testing " #op " for " #type "1", i++); \
+res_##type##_1 = src1_##type##_1 op src2_##type##_1; \
+rsDebug("Testing " #op " for " #type "2", i++); \
+res_##type##_2 = src1_##type##_2 op src2_##type##_2; \
+rsDebug("Testing " #op " for " #type "3", i++); \
+res_##type##_3 = src1_##type##_3 op src2_##type##_3; \
+rsDebug("Testing " #op " for " #type "4", i++); \
+res_##type##_4 = src1_##type##_4 op src2_##type##_4;
+
+#define TEST_INT_OP(op) \
+TEST_INT_OP_TYPE(op, c) \
+TEST_INT_OP_TYPE(op, uc) \
+TEST_INT_OP_TYPE(op, s) \
+TEST_INT_OP_TYPE(op, us) \
+TEST_INT_OP_TYPE(op, i) \
+TEST_INT_OP_TYPE(op, ui) \
+rsDebug("Testing " #op " for l1", i++); \
+res_l_1 = src1_l_1 op src2_l_1; \
+rsDebug("Testing " #op " for ul1", i++); \
+res_ul_1 = src1_ul_1 op src2_ul_1;
+
+#define TEST_XN_FUNC_YN(typeout, fnc, typein) \
+ res_##typeout##_1 = fnc(src1_##typein##_1); \
+ res_##typeout##_2 = fnc(src1_##typein##_2); \
+ res_##typeout##_3 = fnc(src1_##typein##_3); \
+ res_##typeout##_4 = fnc(src1_##typein##_4);
+
+#define TEST_XN_FUNC_XN_XN(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
+ res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
+ res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
+ res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
+
+#define TEST_X_FUNC_X_X_X(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
+
+#define TEST_IN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, uc) \
+ TEST_XN_FUNC_YN(c, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, us) \
+ TEST_XN_FUNC_YN(s, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, ui) \
+ TEST_XN_FUNC_YN(i, fnc, i)
+
+#define TEST_UIN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, i) \
+
+#define TEST_IN_FUNC_IN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_XN_XN(uc, fnc) \
+ TEST_XN_FUNC_XN_XN(c, fnc) \
+ TEST_XN_FUNC_XN_XN(us, fnc) \
+ TEST_XN_FUNC_XN_XN(s, fnc) \
+ TEST_XN_FUNC_XN_XN(ui, fnc) \
+ TEST_XN_FUNC_XN_XN(i, fnc)
+
+#define TEST_I_FUNC_I_I_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_X_FUNC_X_X_X(uc, fnc) \
+ TEST_X_FUNC_X_X_X(c, fnc) \
+ TEST_X_FUNC_X_X_X(us, fnc) \
+ TEST_X_FUNC_X_X_X(s, fnc) \
+ TEST_X_FUNC_X_X_X(ui, fnc) \
+ TEST_X_FUNC_X_X_X(i, fnc)
+
+#define TEST_FN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f2 = fnc(f2); \
+ f3 = fnc(f3); \
+ f4 = fnc(f4);
+
+#define TEST_FN_FUNC_FN_PFN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (float*) &f1); \
+ f2 = fnc(f2, (float2*) &f2); \
+ f3 = fnc(f3, (float3*) &f3); \
+ f4 = fnc(f4, (float4*) &f4);
+
+#define TEST_FN_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f2); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_F34_FUNC_F34_F34(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f1); \
+ f3 = fnc(f3, f1); \
+ f4 = fnc(f4, f1);
+
+#define TEST_F_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f1 = fnc(f2); \
+ f1 = fnc(f3); \
+ f1 = fnc(f4);
+
+#define TEST_F_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f1 = fnc(f2, f2); \
+ f1 = fnc(f3, f3); \
+ f1 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i2); \
+ f3 = fnc(f3, i3); \
+ f4 = fnc(f4, i4);
+
+#define TEST_FN_FUNC_FN_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i1); \
+ f3 = fnc(f3, i1); \
+ f4 = fnc(f4, i1);
+
+#define TEST_FN_FUNC_FN_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f2, f2); \
+ f3 = fnc(f3, f3, f3); \
+ f4 = fnc(f4, f4, f4);
+
+#define TEST_FN_FUNC_FN_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f1, f1); \
+ f3 = fnc(f3, f1, f1); \
+ f4 = fnc(f4, f1, f1);
+
+#define TEST_FN_FUNC_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (int*) &i1); \
+ f2 = fnc(f2, (int2*) &i2); \
+ f3 = fnc(f3, (int3*) &i3); \
+ f4 = fnc(f4, (int4*) &i4);
+
+#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, (int*) &i1); \
+ f2 = fnc(f2, f2, (int2*) &i2); \
+ f3 = fnc(f3, f3, (int3*) &i3); \
+ f4 = fnc(f4, f4, (int4*) &i4);
+
+#define TEST_IN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ i1 = fnc(f1); \
+ i2 = fnc(f2); \
+ i3 = fnc(f3); \
+ i4 = fnc(f4);
+
+static bool test_fp_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_FN_FUNC_FN(acos);
+ TEST_FN_FUNC_FN(acosh);
+ TEST_FN_FUNC_FN(acospi);
+ TEST_FN_FUNC_FN(asin);
+ TEST_FN_FUNC_FN(asinh);
+ TEST_FN_FUNC_FN(asinpi);
+ TEST_FN_FUNC_FN(atan);
+ TEST_FN_FUNC_FN_FN(atan2);
+ TEST_FN_FUNC_FN(atanh);
+ TEST_FN_FUNC_FN(atanpi);
+ TEST_FN_FUNC_FN_FN(atan2pi);
+ TEST_FN_FUNC_FN(cbrt);
+ TEST_FN_FUNC_FN(ceil);
+ TEST_FN_FUNC_FN_FN_FN(clamp);
+ TEST_FN_FUNC_FN_FN_F(clamp);
+ TEST_FN_FUNC_FN_FN(copysign);
+ TEST_FN_FUNC_FN(cos);
+ TEST_FN_FUNC_FN(cosh);
+ TEST_FN_FUNC_FN(cospi);
+ TEST_F34_FUNC_F34_F34(cross);
+ TEST_FN_FUNC_FN(degrees);
+ TEST_F_FUNC_FN_FN(distance);
+ TEST_F_FUNC_FN_FN(dot);
+ TEST_FN_FUNC_FN(erfc);
+ TEST_FN_FUNC_FN(erf);
+ TEST_FN_FUNC_FN(exp);
+ TEST_FN_FUNC_FN(exp2);
+ TEST_FN_FUNC_FN(exp10);
+ TEST_FN_FUNC_FN(expm1);
+ TEST_FN_FUNC_FN(fabs);
+ TEST_FN_FUNC_FN_FN(fdim);
+ TEST_FN_FUNC_FN(floor);
+ TEST_FN_FUNC_FN_FN_FN(fma);
+ TEST_FN_FUNC_FN_FN(fmax);
+ TEST_FN_FUNC_FN_F(fmax);
+ TEST_FN_FUNC_FN_FN(fmin);
+ TEST_FN_FUNC_FN_F(fmin);
+ TEST_FN_FUNC_FN_FN(fmod);
+ TEST_FN_FUNC_FN_PFN(fract);
+ TEST_FN_FUNC_FN_PIN(frexp);
+ TEST_FN_FUNC_FN_FN(hypot);
+ TEST_IN_FUNC_FN(ilogb);
+ TEST_FN_FUNC_FN_IN(ldexp);
+ TEST_FN_FUNC_FN_I(ldexp);
+ TEST_F_FUNC_FN(length);
+ TEST_FN_FUNC_FN(lgamma);
+ TEST_FN_FUNC_FN_PIN(lgamma);
+ TEST_FN_FUNC_FN(log);
+ TEST_FN_FUNC_FN(log2);
+ TEST_FN_FUNC_FN(log10);
+ TEST_FN_FUNC_FN(log1p);
+ TEST_FN_FUNC_FN(logb);
+ TEST_FN_FUNC_FN_FN_FN(mad);
+ TEST_FN_FUNC_FN_FN(max);
+ TEST_FN_FUNC_FN_F(max);
+ TEST_FN_FUNC_FN_FN(min);
+ TEST_FN_FUNC_FN_F(min);
+ TEST_FN_FUNC_FN_FN_FN(mix);
+ TEST_FN_FUNC_FN_FN_F(mix);
+ TEST_FN_FUNC_FN_PFN(modf);
+ // nan
+ TEST_FN_FUNC_FN_FN(nextafter);
+ TEST_FN_FUNC_FN(normalize);
+ TEST_FN_FUNC_FN_FN(pow);
+ TEST_FN_FUNC_FN_IN(pown);
+ TEST_FN_FUNC_FN_FN(powr);
+ TEST_FN_FUNC_FN(radians);
+ TEST_FN_FUNC_FN_FN(remainder);
+ TEST_FN_FUNC_FN_FN_PIN(remquo);
+ TEST_FN_FUNC_FN(rint);
+ TEST_FN_FUNC_FN_IN(rootn);
+ TEST_FN_FUNC_FN(round);
+ TEST_FN_FUNC_FN(rsqrt);
+ TEST_FN_FUNC_FN(sign);
+ TEST_FN_FUNC_FN(sin);
+ TEST_FN_FUNC_FN_PFN(sincos);
+ TEST_FN_FUNC_FN(sinh);
+ TEST_FN_FUNC_FN(sinpi);
+ TEST_FN_FUNC_FN(sqrt);
+ TEST_FN_FUNC_FN_FN(step);
+ TEST_FN_FUNC_FN_F(step);
+ TEST_FN_FUNC_FN(tan);
+ TEST_FN_FUNC_FN(tanh);
+ TEST_FN_FUNC_FN(tanpi);
+ TEST_FN_FUNC_FN(tgamma);
+ TEST_FN_FUNC_FN(trunc);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_fp_math FAILED", time);
+ }
+ else {
+ rsDebug("test_fp_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_int_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_UIN_FUNC_IN(abs);
+ TEST_IN_FUNC_IN(clz);
+ TEST_IN_FUNC_IN_IN(min);
+ TEST_IN_FUNC_IN_IN(max);
+ TEST_I_FUNC_I_I_I(rsClamp);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_int_math FAILED", time);
+ }
+ else {
+ rsDebug("test_int_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_basic_operators() {
+ bool failed = false;
+ int i = 0;
+
+ TEST_INT_OP(+);
+ TEST_INT_OP(-);
+ TEST_INT_OP(*);
+ TEST_INT_OP(/);
+ TEST_INT_OP(%);
+ TEST_INT_OP(<<);
+ TEST_INT_OP(>>);
+
+ if (failed) {
+ rsDebug("test_basic_operators FAILED", 0);
+ }
+ else {
+ rsDebug("test_basic_operators PASSED", 0);
+ }
+
+ return failed;
+}
+
+#define TEST_CVT(to, from, type) \
+rsDebug("Testing convert from " #from " to " #to, 0); \
+to##1 = from##1; \
+to##2 = convert_##type##2(from##2); \
+to##3 = convert_##type##3(from##3); \
+to##4 = convert_##type##4(from##4);
+
+#define TEST_CVT_MATRIX(to, type) \
+TEST_CVT(to, c, type); \
+TEST_CVT(to, uc, type); \
+TEST_CVT(to, s, type); \
+TEST_CVT(to, us, type); \
+TEST_CVT(to, i, type); \
+TEST_CVT(to, ui, type); \
+TEST_CVT(to, f, type); \
+
+static bool test_convert() {
+ bool failed = false;
+
+ TEST_CVT_MATRIX(c, char);
+ TEST_CVT_MATRIX(uc, uchar);
+ TEST_CVT_MATRIX(s, short);
+ TEST_CVT_MATRIX(us, ushort);
+ TEST_CVT_MATRIX(i, int);
+ TEST_CVT_MATRIX(ui, uint);
+ TEST_CVT_MATRIX(f, float);
+
+ if (failed) {
+ rsDebug("test_convert FAILED", 0);
+ }
+ else {
+ rsDebug("test_convert PASSED", 0);
+ }
+
+ return failed;
+}
+
+#define INIT_PREFIX_TYPE(prefix, type) \
+prefix##_##type##_1 = 1; \
+prefix##_##type##_2.x = 1; \
+prefix##_##type##_2.y = 1; \
+prefix##_##type##_3.x = 1; \
+prefix##_##type##_3.y = 1; \
+prefix##_##type##_3.z = 1; \
+prefix##_##type##_4.x = 1; \
+prefix##_##type##_4.y = 1; \
+prefix##_##type##_4.z = 1; \
+prefix##_##type##_4.w = 1;
+
+#define INIT_TYPE(type) \
+INIT_PREFIX_TYPE(src1, type) \
+INIT_PREFIX_TYPE(src2, type) \
+INIT_PREFIX_TYPE(res, type)
+
+#define INIT_ALL \
+INIT_TYPE(c); \
+INIT_TYPE(uc); \
+INIT_TYPE(s); \
+INIT_TYPE(us); \
+INIT_TYPE(i); \
+INIT_TYPE(ui);
+
+void math_test(uint32_t index, int test_num) {
+ bool failed = false;
+ INIT_ALL;
+ failed |= test_convert();
+ failed |= test_fp_math(index);
+ failed |= test_int_math(index);
+ failed |= test_basic_operators();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.bak b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.bak
new file mode 100644
index 0000000..ad802ca
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.bak
@@ -0,0 +1,423 @@
+#include "shared.rsh"
+
+// Testing math library
+
+volatile float f1;
+volatile float2 f2;
+volatile float3 f3;
+volatile float4 f4;
+
+volatile int i1;
+volatile int2 i2;
+volatile int3 i3;
+volatile int4 i4;
+
+volatile uint ui1;
+volatile uint2 ui2;
+volatile uint3 ui3;
+volatile uint4 ui4;
+
+volatile short s1;
+volatile short2 s2;
+volatile short3 s3;
+volatile short4 s4;
+
+volatile ushort us1;
+volatile ushort2 us2;
+volatile ushort3 us3;
+volatile ushort4 us4;
+
+volatile char c1;
+volatile char2 c2;
+volatile char3 c3;
+volatile char4 c4;
+
+volatile uchar uc1;
+volatile uchar2 uc2;
+volatile uchar3 uc3;
+volatile uchar4 uc4;
+
+#define DECL_INT(prefix) \
+volatile char prefix##_c_1 = 1; \
+volatile char2 prefix##_c_2 = 1; \
+volatile char3 prefix##_c_3 = 1; \
+volatile char4 prefix##_c_4 = 1; \
+volatile uchar prefix##_uc_1 = 1; \
+volatile uchar2 prefix##_uc_2 = 1; \
+volatile uchar3 prefix##_uc_3 = 1; \
+volatile uchar4 prefix##_uc_4 = 1; \
+volatile short prefix##_s_1 = 1; \
+volatile short2 prefix##_s_2 = 1; \
+volatile short3 prefix##_s_3 = 1; \
+volatile short4 prefix##_s_4 = 1; \
+volatile ushort prefix##_us_1 = 1; \
+volatile ushort2 prefix##_us_2 = 1; \
+volatile ushort3 prefix##_us_3 = 1; \
+volatile ushort4 prefix##_us_4 = 1; \
+volatile int prefix##_i_1 = 1; \
+volatile int2 prefix##_i_2 = 1; \
+volatile int3 prefix##_i_3 = 1; \
+volatile int4 prefix##_i_4 = 1; \
+volatile uint prefix##_ui_1 = 1; \
+volatile uint2 prefix##_ui_2 = 1; \
+volatile uint3 prefix##_ui_3 = 1; \
+volatile uint4 prefix##_ui_4 = 1; \
+volatile long prefix##_l_1 = 1; \
+volatile ulong prefix##_ul_1 = 1;
+
+DECL_INT(res)
+DECL_INT(src1)
+DECL_INT(src2)
+
+#define TEST_INT_OP_TYPE(op, type) \
+rsDebug("Testing " #op " for " #type "3", i++); \
+res_##type##_3 = src1_##type##_3 op src2_##type##_3; \
+
+#define TEST_INT_OP(op) \
+TEST_INT_OP_TYPE(op, c) \
+TEST_INT_OP_TYPE(op, uc) \
+
+#define TEST_XN_FUNC_YN(typeout, fnc, typein) \
+ res_##typeout##_1 = fnc(src1_##typein##_1); \
+ res_##typeout##_2 = fnc(src1_##typein##_2); \
+ res_##typeout##_3 = fnc(src1_##typein##_3); \
+ res_##typeout##_4 = fnc(src1_##typein##_4);
+
+#define TEST_XN_FUNC_XN_XN(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
+ res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
+ res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
+ res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
+
+#define TEST_X_FUNC_X_X_X(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
+
+#define TEST_IN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, uc) \
+ TEST_XN_FUNC_YN(c, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, us) \
+ TEST_XN_FUNC_YN(s, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, ui) \
+ TEST_XN_FUNC_YN(i, fnc, i)
+
+#define TEST_UIN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, i) \
+
+#define TEST_IN_FUNC_IN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_XN_XN(uc, fnc) \
+ TEST_XN_FUNC_XN_XN(c, fnc) \
+ TEST_XN_FUNC_XN_XN(us, fnc) \
+ TEST_XN_FUNC_XN_XN(s, fnc) \
+ TEST_XN_FUNC_XN_XN(ui, fnc) \
+ TEST_XN_FUNC_XN_XN(i, fnc)
+
+#define TEST_I_FUNC_I_I_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_X_FUNC_X_X_X(uc, fnc) \
+ TEST_X_FUNC_X_X_X(c, fnc) \
+ TEST_X_FUNC_X_X_X(us, fnc) \
+ TEST_X_FUNC_X_X_X(s, fnc) \
+ TEST_X_FUNC_X_X_X(ui, fnc) \
+ TEST_X_FUNC_X_X_X(i, fnc)
+
+#define TEST_FN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f2 = fnc(f2); \
+ f3 = fnc(f3); \
+ f4 = fnc(f4);
+
+#define TEST_FN_FUNC_FN_PFN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (float*) &f1); \
+ f2 = fnc(f2, (float2*) &f2); \
+ f3 = fnc(f3, (float3*) &f3); \
+ f4 = fnc(f4, (float4*) &f4);
+
+#define TEST_FN_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f2); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_F34_FUNC_F34_F34(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f1); \
+ f3 = fnc(f3, f1); \
+ f4 = fnc(f4, f1);
+
+#define TEST_F_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f1 = fnc(f2); \
+ f1 = fnc(f3); \
+ f1 = fnc(f4);
+
+#define TEST_F_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f1 = fnc(f2, f2); \
+ f1 = fnc(f3, f3); \
+ f1 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i2); \
+ f3 = fnc(f3, i3); \
+ f4 = fnc(f4, i4);
+
+#define TEST_FN_FUNC_FN_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i1); \
+ f3 = fnc(f3, i1); \
+ f4 = fnc(f4, i1);
+
+#define TEST_FN_FUNC_FN_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f2, f2); \
+ f3 = fnc(f3, f3, f3); \
+ f4 = fnc(f4, f4, f4);
+
+#define TEST_FN_FUNC_FN_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f1, f1); \
+ f3 = fnc(f3, f1, f1); \
+ f4 = fnc(f4, f1, f1);
+
+#define TEST_FN_FUNC_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (int*) &i1); \
+ f2 = fnc(f2, (int2*) &i2); \
+ f3 = fnc(f3, (int3*) &i3); \
+ f4 = fnc(f4, (int4*) &i4);
+
+#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, (int*) &i1); \
+ f2 = fnc(f2, f2, (int2*) &i2); \
+ f3 = fnc(f3, f3, (int3*) &i3); \
+ f4 = fnc(f4, f4, (int4*) &i4);
+
+#define TEST_IN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ i1 = fnc(f1); \
+ i2 = fnc(f2); \
+ i3 = fnc(f3); \
+ i4 = fnc(f4);
+
+static bool test_fp_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_FN_FUNC_FN(acos);
+ TEST_FN_FUNC_FN(acosh);
+ TEST_FN_FUNC_FN(acospi);
+ TEST_FN_FUNC_FN(asin);
+ TEST_FN_FUNC_FN(asinh);
+ TEST_FN_FUNC_FN(asinpi);
+ TEST_FN_FUNC_FN(atan);
+ TEST_FN_FUNC_FN_FN(atan2);
+ TEST_FN_FUNC_FN(atanh);
+ TEST_FN_FUNC_FN(atanpi);
+ TEST_FN_FUNC_FN_FN(atan2pi);
+ TEST_FN_FUNC_FN(cbrt);
+ TEST_FN_FUNC_FN(ceil);
+ TEST_FN_FUNC_FN_FN_FN(clamp);
+ TEST_FN_FUNC_FN_FN_F(clamp);
+ TEST_FN_FUNC_FN_FN(copysign);
+ TEST_FN_FUNC_FN(cos);
+ TEST_FN_FUNC_FN(cosh);
+ TEST_FN_FUNC_FN(cospi);
+ TEST_F34_FUNC_F34_F34(cross);
+ TEST_FN_FUNC_FN(degrees);
+ TEST_F_FUNC_FN_FN(distance);
+ TEST_F_FUNC_FN_FN(dot);
+ TEST_FN_FUNC_FN(erfc);
+ TEST_FN_FUNC_FN(erf);
+ TEST_FN_FUNC_FN(exp);
+ TEST_FN_FUNC_FN(exp2);
+ TEST_FN_FUNC_FN(exp10);
+ TEST_FN_FUNC_FN(expm1);
+ TEST_FN_FUNC_FN(fabs);
+ TEST_FN_FUNC_FN_FN(fdim);
+ TEST_FN_FUNC_FN(floor);
+ TEST_FN_FUNC_FN_FN_FN(fma);
+ TEST_FN_FUNC_FN_FN(fmax);
+ TEST_FN_FUNC_FN_F(fmax);
+ TEST_FN_FUNC_FN_FN(fmin);
+ TEST_FN_FUNC_FN_F(fmin);
+ TEST_FN_FUNC_FN_FN(fmod);
+ TEST_FN_FUNC_FN_PFN(fract);
+ TEST_FN_FUNC_FN_PIN(frexp);
+ TEST_FN_FUNC_FN_FN(hypot);
+ TEST_IN_FUNC_FN(ilogb);
+ TEST_FN_FUNC_FN_IN(ldexp);
+ TEST_FN_FUNC_FN_I(ldexp);
+ TEST_F_FUNC_FN(length);
+ TEST_FN_FUNC_FN(lgamma);
+ TEST_FN_FUNC_FN_PIN(lgamma);
+ TEST_FN_FUNC_FN(log);
+ TEST_FN_FUNC_FN(log2);
+ TEST_FN_FUNC_FN(log10);
+ TEST_FN_FUNC_FN(log1p);
+ TEST_FN_FUNC_FN(logb);
+ TEST_FN_FUNC_FN_FN_FN(mad);
+ TEST_FN_FUNC_FN_FN(max);
+ TEST_FN_FUNC_FN_F(max);
+ TEST_FN_FUNC_FN_FN(min);
+ TEST_FN_FUNC_FN_F(min);
+ TEST_FN_FUNC_FN_FN_FN(mix);
+ TEST_FN_FUNC_FN_FN_F(mix);
+ TEST_FN_FUNC_FN_PFN(modf);
+ // nan
+ TEST_FN_FUNC_FN_FN(nextafter);
+ TEST_FN_FUNC_FN(normalize);
+ TEST_FN_FUNC_FN_FN(pow);
+ TEST_FN_FUNC_FN_IN(pown);
+ TEST_FN_FUNC_FN_FN(powr);
+ TEST_FN_FUNC_FN(radians);
+ TEST_FN_FUNC_FN_FN(remainder);
+ TEST_FN_FUNC_FN_FN_PIN(remquo);
+ TEST_FN_FUNC_FN(rint);
+ TEST_FN_FUNC_FN_IN(rootn);
+ TEST_FN_FUNC_FN(round);
+ TEST_FN_FUNC_FN(rsqrt);
+ TEST_FN_FUNC_FN(sign);
+ TEST_FN_FUNC_FN(sin);
+ TEST_FN_FUNC_FN_PFN(sincos);
+ TEST_FN_FUNC_FN(sinh);
+ TEST_FN_FUNC_FN(sinpi);
+ TEST_FN_FUNC_FN(sqrt);
+ TEST_FN_FUNC_FN_FN(step);
+ TEST_FN_FUNC_FN_F(step);
+ TEST_FN_FUNC_FN(tan);
+ TEST_FN_FUNC_FN(tanh);
+ TEST_FN_FUNC_FN(tanpi);
+ TEST_FN_FUNC_FN(tgamma);
+ TEST_FN_FUNC_FN(trunc);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_fp_math FAILED", time);
+ }
+ else {
+ rsDebug("test_fp_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_int_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_UIN_FUNC_IN(abs);
+ TEST_IN_FUNC_IN(clz);
+ TEST_IN_FUNC_IN_IN(min);
+ TEST_IN_FUNC_IN_IN(max);
+ TEST_I_FUNC_I_I_I(rsClamp);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_int_math FAILED", time);
+ }
+ else {
+ rsDebug("test_int_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_basic_operators() {
+ bool failed = false;
+ int i = 0;
+
+ TEST_INT_OP(+);
+ TEST_INT_OP(-);
+ TEST_INT_OP(*);
+ TEST_INT_OP(/);
+ TEST_INT_OP(%);
+ TEST_INT_OP(<<);
+ TEST_INT_OP(>>);
+
+ if (failed) {
+ rsDebug("test_basic_operators FAILED", 0);
+ }
+ else {
+ rsDebug("test_basic_operators PASSED", 0);
+ }
+
+ return failed;
+}
+
+#define TEST_CVT(to, from, type) \
+rsDebug("Testing convert from " #from " to " #to, 0); \
+to##1 = from##1; \
+to##2 = convert_##type##2(from##2); \
+to##3 = convert_##type##3(from##3); \
+to##4 = convert_##type##4(from##4);
+
+#define TEST_CVT_MATRIX(to, type) \
+TEST_CVT(to, c, type); \
+TEST_CVT(to, uc, type); \
+TEST_CVT(to, s, type); \
+TEST_CVT(to, us, type); \
+TEST_CVT(to, i, type); \
+TEST_CVT(to, ui, type); \
+TEST_CVT(to, f, type); \
+
+static bool test_convert() {
+ bool failed = false;
+
+ TEST_CVT_MATRIX(c, char);
+ TEST_CVT_MATRIX(uc, uchar);
+ TEST_CVT_MATRIX(s, short);
+ TEST_CVT_MATRIX(us, ushort);
+ TEST_CVT_MATRIX(i, int);
+ TEST_CVT_MATRIX(ui, uint);
+ TEST_CVT_MATRIX(f, float);
+
+ if (failed) {
+ rsDebug("test_convert FAILED", 0);
+ }
+ else {
+ rsDebug("test_convert PASSED", 0);
+ }
+
+ return failed;
+}
+
+void math_test(uint32_t index, int test_num) {
+ bool failed = false;
+ rsDebug("Here ", 1);
+ res_uc_3 = src1_uc_3 / src2_uc_3;
+ rsDebug("Here ", 2);
+ failed |= test_basic_operators();
+ rsDebug("Here ", 3);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.orig b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.orig
new file mode 100644
index 0000000..aae29a4
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.orig
@@ -0,0 +1,436 @@
+#include "shared.rsh"
+
+// Testing math library
+
+volatile float f1;
+volatile float2 f2;
+volatile float3 f3;
+volatile float4 f4;
+
+volatile int i1;
+volatile int2 i2;
+volatile int3 i3;
+volatile int4 i4;
+
+volatile uint ui1;
+volatile uint2 ui2;
+volatile uint3 ui3;
+volatile uint4 ui4;
+
+volatile short s1;
+volatile short2 s2;
+volatile short3 s3;
+volatile short4 s4;
+
+volatile ushort us1;
+volatile ushort2 us2;
+volatile ushort3 us3;
+volatile ushort4 us4;
+
+volatile char c1;
+volatile char2 c2;
+volatile char3 c3;
+volatile char4 c4;
+
+volatile uchar uc1;
+volatile uchar2 uc2;
+volatile uchar3 uc3;
+volatile uchar4 uc4;
+
+#define DECL_INT(prefix) \
+volatile char prefix##_c_1 = 1; \
+volatile char2 prefix##_c_2 = 1; \
+volatile char3 prefix##_c_3 = 1; \
+volatile char4 prefix##_c_4 = 1; \
+volatile uchar prefix##_uc_1 = 1; \
+volatile uchar2 prefix##_uc_2 = 1; \
+volatile uchar3 prefix##_uc_3 = 1; \
+volatile uchar4 prefix##_uc_4 = 1; \
+volatile short prefix##_s_1 = 1; \
+volatile short2 prefix##_s_2 = 1; \
+volatile short3 prefix##_s_3 = 1; \
+volatile short4 prefix##_s_4 = 1; \
+volatile ushort prefix##_us_1 = 1; \
+volatile ushort2 prefix##_us_2 = 1; \
+volatile ushort3 prefix##_us_3 = 1; \
+volatile ushort4 prefix##_us_4 = 1; \
+volatile int prefix##_i_1 = 1; \
+volatile int2 prefix##_i_2 = 1; \
+volatile int3 prefix##_i_3 = 1; \
+volatile int4 prefix##_i_4 = 1; \
+volatile uint prefix##_ui_1 = 1; \
+volatile uint2 prefix##_ui_2 = 1; \
+volatile uint3 prefix##_ui_3 = 1; \
+volatile uint4 prefix##_ui_4 = 1; \
+volatile long prefix##_l_1 = 1; \
+volatile ulong prefix##_ul_1 = 1;
+
+DECL_INT(res)
+DECL_INT(src1)
+DECL_INT(src2)
+
+#define TEST_INT_OP_TYPE(op, type) \
+rsDebug("Testing " #op " for " #type "1", i++); \
+res_##type##_1 = src1_##type##_1 op src2_##type##_1; \
+rsDebug("Testing " #op " for " #type "2", i++); \
+res_##type##_2 = src1_##type##_2 op src2_##type##_2; \
+rsDebug("Testing " #op " for " #type "3", i++); \
+res_##type##_3 = src1_##type##_3 op src2_##type##_3; \
+rsDebug("Testing " #op " for " #type "4", i++); \
+res_##type##_4 = src1_##type##_4 op src2_##type##_4;
+
+#define TEST_INT_OP(op) \
+TEST_INT_OP_TYPE(op, c) \
+TEST_INT_OP_TYPE(op, uc) \
+TEST_INT_OP_TYPE(op, s) \
+TEST_INT_OP_TYPE(op, us) \
+TEST_INT_OP_TYPE(op, i) \
+TEST_INT_OP_TYPE(op, ui) \
+rsDebug("Testing " #op " for l1", i++); \
+res_l_1 = src1_l_1 op src2_l_1; \
+rsDebug("Testing " #op " for ul1", i++); \
+res_ul_1 = src1_ul_1 op src2_ul_1;
+
+#define TEST_XN_FUNC_YN(typeout, fnc, typein) \
+ res_##typeout##_1 = fnc(src1_##typein##_1); \
+ res_##typeout##_2 = fnc(src1_##typein##_2); \
+ res_##typeout##_3 = fnc(src1_##typein##_3); \
+ res_##typeout##_4 = fnc(src1_##typein##_4);
+
+#define TEST_XN_FUNC_XN_XN(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
+ res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
+ res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
+ res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
+
+#define TEST_X_FUNC_X_X_X(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
+
+#define TEST_IN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, uc) \
+ TEST_XN_FUNC_YN(c, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, us) \
+ TEST_XN_FUNC_YN(s, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, ui) \
+ TEST_XN_FUNC_YN(i, fnc, i)
+
+#define TEST_UIN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, i) \
+
+#define TEST_IN_FUNC_IN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_XN_XN(uc, fnc) \
+ TEST_XN_FUNC_XN_XN(c, fnc) \
+ TEST_XN_FUNC_XN_XN(us, fnc) \
+ TEST_XN_FUNC_XN_XN(s, fnc) \
+ TEST_XN_FUNC_XN_XN(ui, fnc) \
+ TEST_XN_FUNC_XN_XN(i, fnc)
+
+#define TEST_I_FUNC_I_I_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_X_FUNC_X_X_X(uc, fnc) \
+ TEST_X_FUNC_X_X_X(c, fnc) \
+ TEST_X_FUNC_X_X_X(us, fnc) \
+ TEST_X_FUNC_X_X_X(s, fnc) \
+ TEST_X_FUNC_X_X_X(ui, fnc) \
+ TEST_X_FUNC_X_X_X(i, fnc)
+
+#define TEST_FN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f2 = fnc(f2); \
+ f3 = fnc(f3); \
+ f4 = fnc(f4);
+
+#define TEST_FN_FUNC_FN_PFN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (float*) &f1); \
+ f2 = fnc(f2, (float2*) &f2); \
+ f3 = fnc(f3, (float3*) &f3); \
+ f4 = fnc(f4, (float4*) &f4);
+
+#define TEST_FN_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f2); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_F34_FUNC_F34_F34(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f1); \
+ f3 = fnc(f3, f1); \
+ f4 = fnc(f4, f1);
+
+#define TEST_F_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f1 = fnc(f2); \
+ f1 = fnc(f3); \
+ f1 = fnc(f4);
+
+#define TEST_F_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f1 = fnc(f2, f2); \
+ f1 = fnc(f3, f3); \
+ f1 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i2); \
+ f3 = fnc(f3, i3); \
+ f4 = fnc(f4, i4);
+
+#define TEST_FN_FUNC_FN_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i1); \
+ f3 = fnc(f3, i1); \
+ f4 = fnc(f4, i1);
+
+#define TEST_FN_FUNC_FN_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f2, f2); \
+ f3 = fnc(f3, f3, f3); \
+ f4 = fnc(f4, f4, f4);
+
+#define TEST_FN_FUNC_FN_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f1, f1); \
+ f3 = fnc(f3, f1, f1); \
+ f4 = fnc(f4, f1, f1);
+
+#define TEST_FN_FUNC_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (int*) &i1); \
+ f2 = fnc(f2, (int2*) &i2); \
+ f3 = fnc(f3, (int3*) &i3); \
+ f4 = fnc(f4, (int4*) &i4);
+
+#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, (int*) &i1); \
+ f2 = fnc(f2, f2, (int2*) &i2); \
+ f3 = fnc(f3, f3, (int3*) &i3); \
+ f4 = fnc(f4, f4, (int4*) &i4);
+
+#define TEST_IN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ i1 = fnc(f1); \
+ i2 = fnc(f2); \
+ i3 = fnc(f3); \
+ i4 = fnc(f4);
+
+static bool test_fp_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_FN_FUNC_FN(acos);
+ TEST_FN_FUNC_FN(acosh);
+ TEST_FN_FUNC_FN(acospi);
+ TEST_FN_FUNC_FN(asin);
+ TEST_FN_FUNC_FN(asinh);
+ TEST_FN_FUNC_FN(asinpi);
+ TEST_FN_FUNC_FN(atan);
+ TEST_FN_FUNC_FN_FN(atan2);
+ TEST_FN_FUNC_FN(atanh);
+ TEST_FN_FUNC_FN(atanpi);
+ TEST_FN_FUNC_FN_FN(atan2pi);
+ TEST_FN_FUNC_FN(cbrt);
+ TEST_FN_FUNC_FN(ceil);
+ TEST_FN_FUNC_FN_FN_FN(clamp);
+ TEST_FN_FUNC_FN_FN_F(clamp);
+ TEST_FN_FUNC_FN_FN(copysign);
+ TEST_FN_FUNC_FN(cos);
+ TEST_FN_FUNC_FN(cosh);
+ TEST_FN_FUNC_FN(cospi);
+ TEST_F34_FUNC_F34_F34(cross);
+ TEST_FN_FUNC_FN(degrees);
+ TEST_F_FUNC_FN_FN(distance);
+ TEST_F_FUNC_FN_FN(dot);
+ TEST_FN_FUNC_FN(erfc);
+ TEST_FN_FUNC_FN(erf);
+ TEST_FN_FUNC_FN(exp);
+ TEST_FN_FUNC_FN(exp2);
+ TEST_FN_FUNC_FN(exp10);
+ TEST_FN_FUNC_FN(expm1);
+ TEST_FN_FUNC_FN(fabs);
+ TEST_FN_FUNC_FN_FN(fdim);
+ TEST_FN_FUNC_FN(floor);
+ TEST_FN_FUNC_FN_FN_FN(fma);
+ TEST_FN_FUNC_FN_FN(fmax);
+ TEST_FN_FUNC_FN_F(fmax);
+ TEST_FN_FUNC_FN_FN(fmin);
+ TEST_FN_FUNC_FN_F(fmin);
+ TEST_FN_FUNC_FN_FN(fmod);
+ TEST_FN_FUNC_FN_PFN(fract);
+ TEST_FN_FUNC_FN_PIN(frexp);
+ TEST_FN_FUNC_FN_FN(hypot);
+ TEST_IN_FUNC_FN(ilogb);
+ TEST_FN_FUNC_FN_IN(ldexp);
+ TEST_FN_FUNC_FN_I(ldexp);
+ TEST_F_FUNC_FN(length);
+ TEST_FN_FUNC_FN(lgamma);
+ TEST_FN_FUNC_FN_PIN(lgamma);
+ TEST_FN_FUNC_FN(log);
+ TEST_FN_FUNC_FN(log2);
+ TEST_FN_FUNC_FN(log10);
+ TEST_FN_FUNC_FN(log1p);
+ TEST_FN_FUNC_FN(logb);
+ TEST_FN_FUNC_FN_FN_FN(mad);
+ TEST_FN_FUNC_FN_FN(max);
+ TEST_FN_FUNC_FN_F(max);
+ TEST_FN_FUNC_FN_FN(min);
+ TEST_FN_FUNC_FN_F(min);
+ TEST_FN_FUNC_FN_FN_FN(mix);
+ TEST_FN_FUNC_FN_FN_F(mix);
+ TEST_FN_FUNC_FN_PFN(modf);
+ // nan
+ TEST_FN_FUNC_FN_FN(nextafter);
+ TEST_FN_FUNC_FN(normalize);
+ TEST_FN_FUNC_FN_FN(pow);
+ TEST_FN_FUNC_FN_IN(pown);
+ TEST_FN_FUNC_FN_FN(powr);
+ TEST_FN_FUNC_FN(radians);
+ TEST_FN_FUNC_FN_FN(remainder);
+ TEST_FN_FUNC_FN_FN_PIN(remquo);
+ TEST_FN_FUNC_FN(rint);
+ TEST_FN_FUNC_FN_IN(rootn);
+ TEST_FN_FUNC_FN(round);
+ TEST_FN_FUNC_FN(rsqrt);
+ TEST_FN_FUNC_FN(sign);
+ TEST_FN_FUNC_FN(sin);
+ TEST_FN_FUNC_FN_PFN(sincos);
+ TEST_FN_FUNC_FN(sinh);
+ TEST_FN_FUNC_FN(sinpi);
+ TEST_FN_FUNC_FN(sqrt);
+ TEST_FN_FUNC_FN_FN(step);
+ TEST_FN_FUNC_FN_F(step);
+ TEST_FN_FUNC_FN(tan);
+ TEST_FN_FUNC_FN(tanh);
+ TEST_FN_FUNC_FN(tanpi);
+ TEST_FN_FUNC_FN(tgamma);
+ TEST_FN_FUNC_FN(trunc);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_fp_math FAILED", time);
+ }
+ else {
+ rsDebug("test_fp_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_int_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_UIN_FUNC_IN(abs);
+ TEST_IN_FUNC_IN(clz);
+ TEST_IN_FUNC_IN_IN(min);
+ TEST_IN_FUNC_IN_IN(max);
+ TEST_I_FUNC_I_I_I(rsClamp);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_int_math FAILED", time);
+ }
+ else {
+ rsDebug("test_int_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_basic_operators() {
+ bool failed = false;
+ int i = 0;
+
+ TEST_INT_OP(+);
+ TEST_INT_OP(-);
+ TEST_INT_OP(*);
+ TEST_INT_OP(/);
+ TEST_INT_OP(%);
+ TEST_INT_OP(<<);
+ TEST_INT_OP(>>);
+
+ if (failed) {
+ rsDebug("test_basic_operators FAILED", 0);
+ }
+ else {
+ rsDebug("test_basic_operators PASSED", 0);
+ }
+
+ return failed;
+}
+
+#define TEST_CVT(to, from, type) \
+rsDebug("Testing convert from " #from " to " #to, 0); \
+to##1 = from##1; \
+to##2 = convert_##type##2(from##2); \
+to##3 = convert_##type##3(from##3); \
+to##4 = convert_##type##4(from##4);
+
+#define TEST_CVT_MATRIX(to, type) \
+TEST_CVT(to, c, type); \
+TEST_CVT(to, uc, type); \
+TEST_CVT(to, s, type); \
+TEST_CVT(to, us, type); \
+TEST_CVT(to, i, type); \
+TEST_CVT(to, ui, type); \
+TEST_CVT(to, f, type); \
+
+static bool test_convert() {
+ bool failed = false;
+
+ TEST_CVT_MATRIX(c, char);
+ TEST_CVT_MATRIX(uc, uchar);
+ TEST_CVT_MATRIX(s, short);
+ TEST_CVT_MATRIX(us, ushort);
+ TEST_CVT_MATRIX(i, int);
+ TEST_CVT_MATRIX(ui, uint);
+ TEST_CVT_MATRIX(f, float);
+
+ if (failed) {
+ rsDebug("test_convert FAILED", 0);
+ }
+ else {
+ rsDebug("test_convert PASSED", 0);
+ }
+
+ return failed;
+}
+
+void math_test(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= test_convert();
+ failed |= test_fp_math(index);
+ failed |= test_int_math(index);
+ failed |= test_basic_operators();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/primitives.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/primitives.rs
new file mode 100644
index 0000000..ce451da
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/primitives.rs
@@ -0,0 +1,61 @@
+#include "shared.rsh"
+
+// Testing primitive types
+float floatTest = 1.99f;
+double doubleTest = 2.05;
+char charTest = -8;
+short shortTest = -16;
+int intTest = -32;
+long longTest = 17179869184l; // 1 << 34
+long long longlongTest = 68719476736l; // 1 << 36
+
+uchar ucharTest = 8;
+ushort ushortTest = 16;
+uint uintTest = 32;
+ulong ulongTest = 4611686018427387904L;
+int64_t int64_tTest = -17179869184l; // - 1 << 34
+uint64_t uint64_tTest = 117179869184l;
+
+static bool test_primitive_types(uint32_t index) {
+ bool failed = false;
+ start();
+
+ _RS_ASSERT(floatTest == 2.99f);
+ _RS_ASSERT(doubleTest == 3.05);
+ _RS_ASSERT(charTest == -16);
+ _RS_ASSERT(shortTest == -32);
+ _RS_ASSERT(intTest == -64);
+ _RS_ASSERT(longTest == 17179869185l);
+ _RS_ASSERT(longlongTest == 68719476735l);
+
+ _RS_ASSERT(ucharTest == 8);
+ _RS_ASSERT(ushortTest == 16);
+ _RS_ASSERT(uintTest == 32);
+ _RS_ASSERT(ulongTest == 4611686018427387903L);
+ _RS_ASSERT(int64_tTest == -17179869184l);
+ _RS_ASSERT(uint64_tTest == 117179869185l);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_primitives FAILED", time);
+ }
+ else {
+ rsDebug("test_primitives PASSED", time);
+ }
+
+ return failed;
+}
+
+void primitives_test(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= test_primitive_types(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/refcount.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/refcount.rs
new file mode 100644
index 0000000..4ea70e2
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/refcount.rs
@@ -0,0 +1,13 @@
+#include "shared.rsh"
+
+// Testing reference counting of RS object types
+
+rs_allocation globalA;
+static rs_allocation staticGlobalA;
+
+void refcount_test() {
+ staticGlobalA = globalA;
+ rsClearObject(&globalA);
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rsdebug.rs
new file mode 100644
index 0000000..f7942a5
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rsdebug.rs
@@ -0,0 +1,56 @@
+#include "shared.rsh"
+
+// Testing primitive types
+float floatTest = 1.99f;
+double doubleTest = 2.05;
+char charTest = -8;
+short shortTest = -16;
+int intTest = -32;
+long longTest = 17179869184l; // 1 << 34
+long long longlongTest = 68719476736l; // 1 << 36
+
+uchar ucharTest = 8;
+ushort ushortTest = 16;
+uint uintTest = 32;
+ulong ulongTest = 4611686018427387904L;
+int64_t int64_tTest = -17179869184l; // - 1 << 34
+uint64_t uint64_tTest = 117179869184l;
+
+static bool basic_test(uint32_t index) {
+ bool failed = false;
+
+ // This test focuses primarily on compilation-time, not run-time.
+ // For this reason, none of the outputs are actually checked.
+
+ rsDebug("floatTest", floatTest);
+ rsDebug("doubleTest", doubleTest);
+ rsDebug("charTest", charTest);
+ rsDebug("shortTest", shortTest);
+ rsDebug("intTest", intTest);
+ rsDebug("longTest", longTest);
+ rsDebug("longlongTest", longlongTest);
+
+ rsDebug("ucharTest", ucharTest);
+ rsDebug("ushortTest", ushortTest);
+ rsDebug("uintTest", uintTest);
+ rsDebug("ulongTest", ulongTest);
+ rsDebug("int64_tTest", int64_tTest);
+ rsDebug("uint64_tTest", uint64_tTest);
+
+ return failed;
+}
+
+void test_rsdebug(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= basic_test(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ rsDebug("rsdebug_test FAILED", -1);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ rsDebug("rsdebug_test PASSED", 0);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rslist.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rslist.rs
new file mode 100644
index 0000000..b3d8b9e
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rslist.rs
@@ -0,0 +1,107 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// 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.
+
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.rs.test_v14)
+
+#include "rs_graphics.rsh"
+
+float gDY;
+
+rs_font gFont;
+
+typedef struct ListAllocs_s {
+ rs_allocation text;
+ int result;
+} ListAllocs;
+
+ListAllocs *gList;
+
+void init() {
+ gDY = 0.0f;
+}
+
+int textPos = 0;
+
+int root(void) {
+
+ rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ rsgClearDepth(1.0f);
+
+ textPos -= (int)gDY*2;
+ gDY *= 0.95;
+
+ rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
+ rsgBindFont(gFont);
+
+ rs_allocation listAlloc;
+ listAlloc = rsGetAllocation(gList);
+ int allocSize = rsAllocationGetDimX(listAlloc);
+
+ int width = rsgGetWidth();
+ int height = rsgGetHeight();
+
+ int itemHeight = 80;
+ int totalItemHeight = itemHeight * allocSize;
+
+ /* Prevent scrolling above the top of the list */
+ int firstItem = height - totalItemHeight;
+ if (firstItem < 0) {
+ firstItem = 0;
+ }
+
+ /* Prevent scrolling past the last line of the list */
+ int lastItem = -1 * (totalItemHeight - height);
+ if (lastItem > 0) {
+ lastItem = 0;
+ }
+
+ if (textPos > firstItem) {
+ textPos = firstItem;
+ }
+ else if (textPos < lastItem) {
+ textPos = lastItem;
+ }
+
+ int currentYPos = itemHeight + textPos;
+
+ for(int i = 0; i < allocSize; i ++) {
+ if(currentYPos - itemHeight > height) {
+ break;
+ }
+
+ if(currentYPos > 0) {
+ switch(gList[i].result) {
+ case 1: /* Passed */
+ rsgFontColor(0.5f, 0.9f, 0.5f, 1.0f);
+ break;
+ case -1: /* Failed */
+ rsgFontColor(0.9f, 0.5f, 0.5f, 1.0f);
+ break;
+ case 0: /* Still Testing */
+ rsgFontColor(0.9f, 0.9f, 0.5f, 1.0f);
+ break;
+ default: /* Unknown */
+ rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
+ break;
+ }
+ rsgDrawRect(0, currentYPos - 1, width, currentYPos, 0);
+ rsgDrawText(gList[i].text, 30, currentYPos - 32);
+ }
+ currentYPos += itemHeight;
+ }
+
+ return 10;
+}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstime.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstime.rs
new file mode 100644
index 0000000..5e3e078
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstime.rs
@@ -0,0 +1,52 @@
+#include "shared.rsh"
+
+static bool basic_test(uint32_t index) {
+ bool failed = false;
+
+ rs_time_t curTime = rsTime(0);
+ rs_tm tm;
+ rsDebug("curTime", curTime);
+
+ rsLocaltime(&tm, &curTime);
+
+ rsDebug("tm.tm_sec", tm.tm_sec);
+ rsDebug("tm.tm_min", tm.tm_min);
+ rsDebug("tm.tm_hour", tm.tm_hour);
+ rsDebug("tm.tm_mday", tm.tm_mday);
+ rsDebug("tm.tm_mon", tm.tm_mon);
+ rsDebug("tm.tm_year", tm.tm_year);
+ rsDebug("tm.tm_wday", tm.tm_wday);
+ rsDebug("tm.tm_yday", tm.tm_yday);
+ rsDebug("tm.tm_isdst", tm.tm_isdst);
+
+ // Test a specific time (only valid for PST localtime)
+ curTime = 1294438893;
+ rsLocaltime(&tm, &curTime);
+
+ _RS_ASSERT(tm.tm_sec == 33);
+ _RS_ASSERT(tm.tm_min == 21);
+ _RS_ASSERT(tm.tm_hour == 14);
+ _RS_ASSERT(tm.tm_mday == 7);
+ _RS_ASSERT(tm.tm_mon == 0);
+ _RS_ASSERT(tm.tm_year == 111);
+ _RS_ASSERT(tm.tm_wday == 5);
+ _RS_ASSERT(tm.tm_yday == 6);
+ _RS_ASSERT(tm.tm_isdst == 0);
+
+ return failed;
+}
+
+void test_rstime(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= basic_test(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ rsDebug("rstime_test FAILED", -1);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ rsDebug("rstime_test PASSED", 0);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstypes.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstypes.rs
new file mode 100644
index 0000000..22d9c13
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstypes.rs
@@ -0,0 +1,79 @@
+#include "shared.rsh"
+#include "rs_graphics.rsh"
+
+rs_element elementTest;
+rs_type typeTest;
+rs_allocation allocationTest;
+rs_sampler samplerTest;
+rs_script scriptTest;
+rs_mesh meshTest;
+rs_program_fragment program_fragmentTest;
+rs_program_vertex program_vertexTest;
+rs_program_raster program_rasterTest;
+rs_program_store program_storeTest;
+rs_font fontTest;
+
+rs_matrix4x4 matrix4x4Test;
+rs_matrix3x3 matrix3x3Test;
+rs_matrix2x2 matrix2x2Test;
+
+struct my_struct {
+ int i;
+ rs_font fontTestStruct;
+};
+
+static bool basic_test(uint32_t index) {
+ bool failed = false;
+
+ rs_matrix4x4 matrix4x4TestLocal;
+ rs_matrix3x3 matrix3x3TestLocal;
+ rs_matrix2x2 matrix2x2TestLocal;
+
+ // This test focuses primarily on compilation-time, not run-time.
+ rs_element elementTestLocal;
+ rs_type typeTestLocal;
+ rs_allocation allocationTestLocal;
+ rs_sampler samplerTestLocal;
+ rs_script scriptTestLocal;
+ rs_mesh meshTestLocal;
+ rs_program_fragment program_fragmentTestLocal;
+ rs_program_vertex program_vertexTestLocal;
+ rs_program_raster program_rasterTestLocal;
+ rs_program_store program_storeTestLocal;
+ rs_font fontTestLocal;
+
+ rs_font fontTestLocalArray[4];
+
+ rs_font fontTestLocalPreInit = fontTest;
+
+ struct my_struct structTest;
+
+ fontTestLocal = fontTest;
+ //allocationTestLocal = allocationTest;
+
+ fontTest = fontTestLocal;
+ //allocationTest = allocationTestLocal;
+
+ /*for (int i = 0; i < 4; i++) {
+ fontTestLocalArray[i] = fontTestLocal;
+ }*/
+
+ /*fontTest = fontTestLocalArray[3];*/
+
+ return failed;
+}
+
+void test_rstypes(uint32_t index, int test_num) {
+ bool failed = false;
+ failed |= basic_test(index);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ rsDebug("rstypes_test FAILED", -1);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ rsDebug("rstypes_test PASSED", 0);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/shared.rsh b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/shared.rsh
new file mode 100644
index 0000000..4a7151f
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/shared.rsh
@@ -0,0 +1,38 @@
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.rs.test_v14)
+
+typedef struct TestResult_s {
+ rs_allocation name;
+ bool pass;
+ float score;
+ int64_t time;
+} TestResult;
+//TestResult *g_results;
+
+static int64_t g_time;
+
+static void start(void) {
+ g_time = rsUptimeMillis();
+}
+
+static float end(uint32_t idx) {
+ int64_t t = rsUptimeMillis() - g_time;
+ //g_results[idx].time = t;
+ //rsDebug("test time", (int)t);
+ return ((float)t) / 1000.f;
+}
+
+#define _RS_ASSERT(b) \
+do { \
+ if (!(b)) { \
+ failed = true; \
+ rsDebug(#b " FAILED", 0); \
+ } \
+\
+} while (0)
+
+/* These constants must match those in UnitTest.java */
+static const int RS_MSG_TEST_PASSED = 100;
+static const int RS_MSG_TEST_FAILED = 101;
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/test_root.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/test_root.rs
new file mode 100644
index 0000000..88fe34a
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/test_root.rs
@@ -0,0 +1,23 @@
+// Fountain test script
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.rs.test_v14)
+
+#pragma stateFragment(parent)
+
+#include "rs_graphics.rsh"
+
+
+typedef struct TestResult {
+ rs_allocation name;
+ bool pass;
+ float score;
+} TestResult_t;
+TestResult_t *results;
+
+int root() {
+
+ return 0;
+}
+
+
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/vector.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/vector.rs
new file mode 100644
index 0000000..0430a2f
--- /dev/null
+++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/vector.rs
@@ -0,0 +1,198 @@
+#include "shared.rsh"
+
+// Testing vector types
+float2 f2 = { 1.0f, 2.0f };
+float3 f3 = { 1.0f, 2.0f, 3.0f };
+float4 f4 = { 1.0f, 2.0f, 3.0f, 4.0f };
+
+double2 d2 = { 1.0, 2.0 };
+double3 d3 = { 1.0, 2.0, 3.0 };
+double4 d4 = { 1.0, 2.0, 3.0, 4.0 };
+
+char2 i8_2 = { 1, 2 };
+char3 i8_3 = { 1, 2, 3 };
+char4 i8_4 = { 1, 2, 3, 4 };
+
+uchar2 u8_2 = { 1, 2 };
+uchar3 u8_3 = { 1, 2, 3 };
+uchar4 u8_4 = { 1, 2, 3, 4 };
+
+short2 i16_2 = { 1, 2 };
+short3 i16_3 = { 1, 2, 3 };
+short4 i16_4 = { 1, 2, 3, 4 };
+
+ushort2 u16_2 = { 1, 2 };
+ushort3 u16_3 = { 1, 2, 3 };
+ushort4 u16_4 = { 1, 2, 3, 4 };
+
+int2 i32_2 = { 1, 2 };
+int3 i32_3 = { 1, 2, 3 };
+int4 i32_4 = { 1, 2, 3, 4 };
+
+uint2 u32_2 = { 1, 2 };
+uint3 u32_3 = { 1, 2, 3 };
+uint4 u32_4 = { 1, 2, 3, 4 };
+
+long2 i64_2 = { 1, 2 };
+long3 i64_3 = { 1, 2, 3 };
+long4 i64_4 = { 1, 2, 3, 4 };
+
+ulong2 u64_2 = { 1, 2 };
+ulong3 u64_3 = { 1, 2, 3 };
+ulong4 u64_4 = { 1, 2, 3, 4 };
+
+static bool test_vector_types() {
+ bool failed = false;
+
+ rsDebug("Testing F32", 0);
+ _RS_ASSERT(f2.x == 2.99f);
+ _RS_ASSERT(f2.y == 3.99f);
+
+ _RS_ASSERT(f3.x == 2.99f);
+ _RS_ASSERT(f3.y == 3.99f);
+ _RS_ASSERT(f3.z == 4.99f);
+
+ _RS_ASSERT(f4.x == 2.99f);
+ _RS_ASSERT(f4.y == 3.99f);
+ _RS_ASSERT(f4.z == 4.99f);
+ _RS_ASSERT(f4.w == 5.99f);
+
+ rsDebug("Testing F64", 0);
+ _RS_ASSERT(d2.x == 2.99);
+ _RS_ASSERT(d2.y == 3.99);
+
+ _RS_ASSERT(d3.x == 2.99);
+ _RS_ASSERT(d3.y == 3.99);
+ _RS_ASSERT(d3.z == 4.99);
+
+ _RS_ASSERT(d4.x == 2.99);
+ _RS_ASSERT(d4.y == 3.99);
+ _RS_ASSERT(d4.z == 4.99);
+ _RS_ASSERT(d4.w == 5.99);
+
+ rsDebug("Testing I8", 0);
+ _RS_ASSERT(i8_2.x == 2);
+ _RS_ASSERT(i8_2.y == 3);
+
+ _RS_ASSERT(i8_3.x == 2);
+ _RS_ASSERT(i8_3.y == 3);
+ _RS_ASSERT(i8_3.z == 4);
+
+ _RS_ASSERT(i8_4.x == 2);
+ _RS_ASSERT(i8_4.y == 3);
+ _RS_ASSERT(i8_4.z == 4);
+ _RS_ASSERT(i8_4.w == 5);
+
+ rsDebug("Testing U8", 0);
+ _RS_ASSERT(u8_2.x == 2);
+ _RS_ASSERT(u8_2.y == 3);
+
+ _RS_ASSERT(u8_3.x == 2);
+ _RS_ASSERT(u8_3.y == 3);
+ _RS_ASSERT(u8_3.z == 4);
+
+ _RS_ASSERT(u8_4.x == 2);
+ _RS_ASSERT(u8_4.y == 3);
+ _RS_ASSERT(u8_4.z == 4);
+ _RS_ASSERT(u8_4.w == 5);
+
+ rsDebug("Testing I16", 0);
+ _RS_ASSERT(i16_2.x == 2);
+ _RS_ASSERT(i16_2.y == 3);
+
+ _RS_ASSERT(i16_3.x == 2);
+ _RS_ASSERT(i16_3.y == 3);
+ _RS_ASSERT(i16_3.z == 4);
+
+ _RS_ASSERT(i16_4.x == 2);
+ _RS_ASSERT(i16_4.y == 3);
+ _RS_ASSERT(i16_4.z == 4);
+ _RS_ASSERT(i16_4.w == 5);
+
+ rsDebug("Testing U16", 0);
+ _RS_ASSERT(u16_2.x == 2);
+ _RS_ASSERT(u16_2.y == 3);
+
+ _RS_ASSERT(u16_3.x == 2);
+ _RS_ASSERT(u16_3.y == 3);
+ _RS_ASSERT(u16_3.z == 4);
+
+ _RS_ASSERT(u16_4.x == 2);
+ _RS_ASSERT(u16_4.y == 3);
+ _RS_ASSERT(u16_4.z == 4);
+ _RS_ASSERT(u16_4.w == 5);
+
+ rsDebug("Testing I32", 0);
+ _RS_ASSERT(i32_2.x == 2);
+ _RS_ASSERT(i32_2.y == 3);
+
+ _RS_ASSERT(i32_3.x == 2);
+ _RS_ASSERT(i32_3.y == 3);
+ _RS_ASSERT(i32_3.z == 4);
+
+ _RS_ASSERT(i32_4.x == 2);
+ _RS_ASSERT(i32_4.y == 3);
+ _RS_ASSERT(i32_4.z == 4);
+ _RS_ASSERT(i32_4.w == 5);
+
+ rsDebug("Testing U32", 0);
+ _RS_ASSERT(u32_2.x == 2);
+ _RS_ASSERT(u32_2.y == 3);
+
+ _RS_ASSERT(u32_3.x == 2);
+ _RS_ASSERT(u32_3.y == 3);
+ _RS_ASSERT(u32_3.z == 4);
+
+ _RS_ASSERT(u32_4.x == 2);
+ _RS_ASSERT(u32_4.y == 3);
+ _RS_ASSERT(u32_4.z == 4);
+ _RS_ASSERT(u32_4.w == 5);
+
+ rsDebug("Testing I64", 0);
+ _RS_ASSERT(i64_2.x == 2);
+ _RS_ASSERT(i64_2.y == 3);
+
+ _RS_ASSERT(i64_3.x == 2);
+ _RS_ASSERT(i64_3.y == 3);
+ _RS_ASSERT(i64_3.z == 4);
+
+ _RS_ASSERT(i64_4.x == 2);
+ _RS_ASSERT(i64_4.y == 3);
+ _RS_ASSERT(i64_4.z == 4);
+ _RS_ASSERT(i64_4.w == 5);
+
+ rsDebug("Testing U64", 0);
+ _RS_ASSERT(u64_2.x == 2);
+ _RS_ASSERT(u64_2.y == 3);
+
+ _RS_ASSERT(u64_3.x == 2);
+ _RS_ASSERT(u64_3.y == 3);
+ _RS_ASSERT(u64_3.z == 4);
+
+ _RS_ASSERT(u64_4.x == 2);
+ _RS_ASSERT(u64_4.y == 3);
+ _RS_ASSERT(u64_4.z == 4);
+ _RS_ASSERT(u64_4.w == 5);
+
+ if (failed) {
+ rsDebug("test_vector FAILED", 0);
+ }
+ else {
+ rsDebug("test_vector PASSED", 0);
+ }
+
+ return failed;
+}
+
+void vector_test() {
+ bool failed = false;
+ failed |= test_vector_types();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index fe88e37..7f137ce 100644
--- a/tools/aapt/StringPool.cpp
+++ b/tools/aapt/StringPool.cpp
@@ -174,7 +174,9 @@
}
const bool first = vidx < 0;
- if (first || !mergeDuplicates) {
+ const bool styled = (pos >= 0 && (size_t)pos < mEntryStyleArray.size()) ?
+ mEntryStyleArray[pos].spans.size() : 0;
+ if (first || styled || !mergeDuplicates) {
pos = mEntryArray.add(eidx);
if (first) {
vidx = mValues.add(value, pos);