Test cases for OpenGL ES 2.0 compliance
Ported from Khoronos Test Framework
Attach Shader tests
Change-Id: Iaf794e58cbad9911b8b48bb581697d4d78715649
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index a085b14..2feb76b 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -73,6 +73,7 @@
CtsMediaTestCases \
CtsNdefTestCases \
CtsNetTestCases \
+ CtsOpenGLTestCases \
CtsOpenGlPerfTestCases \
CtsOsTestCases \
CtsPermissionTestCases \
diff --git a/tests/tests/opengl/Android.mk b/tests/tests/opengl/Android.mk
new file mode 100644
index 0000000..fbb3b2a
--- /dev/null
+++ b/tests/tests/opengl/Android.mk
@@ -0,0 +1,34 @@
+# 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := CtsOpenGLTestCases
+
+# Don't include this package in any target.
+LOCAL_MODULE_TAGS := optional
+
+# When built, explicitly put it in the data partition.
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+# All tests should include android.test.runner.
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/opengl/AndroidManifest.xml b/tests/tests/opengl/AndroidManifest.xml
new file mode 100644
index 0000000..c2f6078
--- /dev/null
+++ b/tests/tests/opengl/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.opengl"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk android:minSdkVersion="14" />
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.cts.opengl" />
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name" >
+
+ <activity
+ android:label="@string/app_name"
+ android:name="android.opengl.cts.OpenGLES20ActivityOne">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+</manifest>
diff --git a/tests/tests/opengl/res/drawable-hdpi/ic_launcher.png b/tests/tests/opengl/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..8074c4c
--- /dev/null
+++ b/tests/tests/opengl/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/tests/tests/opengl/res/drawable-ldpi/ic_launcher.png b/tests/tests/opengl/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..1095584
--- /dev/null
+++ b/tests/tests/opengl/res/drawable-ldpi/ic_launcher.png
Binary files differ
diff --git a/tests/tests/opengl/res/drawable-mdpi/ic_launcher.png b/tests/tests/opengl/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..a07c69f
--- /dev/null
+++ b/tests/tests/opengl/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/tests/tests/opengl/res/layout/main.xml b/tests/tests/opengl/res/layout/main.xml
new file mode 100644
index 0000000..be38c98
--- /dev/null
+++ b/tests/tests/opengl/res/layout/main.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tests/tests/opengl/res/values/strings.xml b/tests/tests/opengl/res/values/strings.xml
new file mode 100644
index 0000000..ba33379
--- /dev/null
+++ b/tests/tests/opengl/res/values/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<resources>
+ <string name="app_name">CtsOpenGLTestCases</string>
+
+</resources>
\ No newline at end of file
diff --git a/tests/tests/opengl/src/android/opengl/cts/AttachShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/AttachShaderTest.java
new file mode 100644
index 0000000..0ebfae0
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/AttachShaderTest.java
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import android.opengl.GLES20;
+import android.test.ActivityInstrumentationTestCase2;
+
+public class AttachShaderTest extends ActivityInstrumentationTestCase2<OpenGLES20ActivityOne> {
+ private static final long SLEEP_TIME = 1000l;
+ public AttachShaderTest(Class<OpenGLES20ActivityOne> activityClass) {
+ super(activityClass);
+ }
+
+ private OpenGLES20ActivityOne mActivity;
+
+ public AttachShaderTest() {
+ super(OpenGLES20ActivityOne.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mActivity = getActivity();
+ }
+ /**
+ *Test: Attach an two valid shaders to a program
+ * <pre>
+ * shader count : 2
+ * error : GLES20.GL_NO_ERROR
+ * </pre>
+ */
+ public void test_glAttachedShaders_validshader() throws Throwable {
+
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 1);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+ int shaderCount = mActivity.getNoOfAttachedShaders();
+ assertEquals(2,shaderCount);
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_NO_ERROR, error);
+ }
+
+ /**
+ * Test: Attach an invalid vertex shader to the program handle
+ * <pre>
+ * shader count : 1
+ * error : GLES20.GL_INVALID_VALUE
+ * </pre>
+ * @throws Throwable
+ */
+
+ public void test_glAttachedShaders_invalidshader() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 2);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+ int shaderCount = mActivity.getNoOfAttachedShaders();
+ assertEquals(1, shaderCount);
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_VALUE, error);
+ }
+
+ /**
+ * Test: Attach two shaders of the same type to the program
+ * <pre>
+ * shader count : 1
+ * error : GLES20.GL_INVALID_OPERATION
+ * </pre>
+ * @throws Throwable
+ */
+ public void test_glAttachedShaders_attach_same_shader() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 3);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_OPERATION, error);
+ }
+
+ /**
+ * Test: No shader is attached to a program, glGetAttachedShaders returns
+ * <pre>
+ * shader count : 0
+ * error : GLES20.GL_NO_ERROR
+ * </pre>
+ * @throws Throwable
+ */
+
+ public void test_glAttachedShaders_noshader() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 4);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+ int shaderCount = mActivity.getNoOfAttachedShaders();
+ assertEquals(0, shaderCount);
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_NO_ERROR, error);
+ }
+
+ public void test_glAttachShaders_emptyfragshader_emptyfragshader() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 5);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_OPERATION, error);
+ }
+
+ public void test_glAttachShaders_emptyfragshader_emptyvertexshader() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 6);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_NO_ERROR, error);
+ }
+
+ public void test_glAttachShaders_emptyvertexshader_emptyvertexshader() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 7);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_OPERATION, error);
+ }
+
+ public void test_glAttachShaders_programobject_attach_fragshaderobject() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 8);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_OPERATION, error);
+ }
+
+ public void test_glAttachShaders_invalidshader_attach_valid_handle() throws Throwable{
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 9);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_OPERATION, error);
+ }
+
+ public void test_glAttachShaders_successfulcompile_attach_frag() throws Throwable {
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.SHADER, 10);
+ }
+ });
+ Thread.sleep(SLEEP_TIME);
+
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_NO_ERROR, error);
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/Constants.java b/tests/tests/opengl/src/android/opengl/cts/Constants.java
new file mode 100644
index 0000000..bdc8de1
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/Constants.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+public class Constants {
+ public static final String SHADER = "shader";
+ public static final String PROGRAM = "program";
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityOne.java b/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityOne.java
new file mode 100644
index 0000000..d7530c9
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityOne.java
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import android.app.Activity;
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLSurfaceView.Renderer;
+import android.os.Bundle;
+
+public class OpenGLES20ActivityOne extends Activity {
+ OpenGLES20View view;
+ Renderer mRenderer;
+ int mRendererType;
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ }
+
+ public void setView(String type, int i ) {
+ view = new OpenGLES20View(this,type,i);
+ setContentView(view);
+ }
+
+ public int getNoOfAttachedShaders() {
+ return ((RendererBase)mRenderer).mShaderCount[0];
+ }
+
+ public int glGetError() {
+ return ((RendererBase)mRenderer).mError;
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ view.onPause();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if(view != null) {
+ view.onResume();
+ }
+ }
+
+ class OpenGLES20View extends GLSurfaceView {
+
+ public OpenGLES20View(Context context, String type, int index) {
+ super(context);
+ setEGLContextClientVersion(2);
+ if(type.equals(Constants.SHADER)) {
+ if(index == 1) {
+ mRenderer = new RendererOneShaderTest();
+ }else if(index == 2) {
+ mRenderer = new RendererTwoShaderTest();
+ }else if(index == 3) {
+ mRenderer = new RendererThreeShaderTest();
+ }else if(index == 4) {
+ mRenderer = new RendererFourShaderTest();
+ }else if(index == 5) {
+ mRenderer = new RendererFiveShaderTest();
+ }else if(index == 6) {
+ mRenderer = new RendererSixShaderTest();
+ }else if(index == 7) {
+ mRenderer = new RendererSevenShaderTest();
+ }else if(index == 8) {
+ mRenderer = new RendererEightShaderTest();
+ }else if(index == 9) {
+ mRenderer = new RendererNineShaderTest();
+ }else if(index == 10) {
+ mRenderer = new RendererTenShaderTest();
+ }else {
+ throw new RuntimeException();
+ }
+ }else if(type.equals(Constants.PROGRAM)) {
+ if(index == 1) {
+ mRenderer = new RendererOneProgramTest();
+ }
+ }
+ setRenderer(mRenderer);
+ }
+
+ @Override
+ public void setEGLContextClientVersion(int version) {
+ super.setEGLContextClientVersion(version);
+ }
+
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/ProgramTest.java b/tests/tests/opengl/src/android/opengl/cts/ProgramTest.java
new file mode 100644
index 0000000..ee9a835
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/ProgramTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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
+
+ */
+package android.opengl.cts;
+
+import android.opengl.GLES20;
+import android.test.ActivityInstrumentationTestCase2;
+
+public class ProgramTest extends ActivityInstrumentationTestCase2<OpenGLES20ActivityOne> {
+ public ProgramTest(Class<OpenGLES20ActivityOne> activityClass) {
+ super(activityClass);
+
+ }
+
+ private OpenGLES20ActivityOne mActivity;
+
+ public ProgramTest() {
+ super(OpenGLES20ActivityOne.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mActivity = getActivity();
+ }
+
+ public void test_glAttachShader_program() throws Throwable {
+
+ mActivity = getActivity();
+ this.runTestOnUiThread(new Runnable() {
+ public void run() {
+ mActivity.setView(Constants.PROGRAM,1);
+ }
+ });
+ Thread.sleep(1000);
+ int error = mActivity.glGetError();
+ assertEquals(GLES20.GL_INVALID_OPERATION, error);
+ }
+
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererBase.java b/tests/tests/opengl/src/android/opengl/cts/RendererBase.java
new file mode 100644
index 0000000..b64f47a
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererBase.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import java.nio.FloatBuffer;
+
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLSurfaceView.Renderer;
+
+public abstract class RendererBase implements GLSurfaceView.Renderer {
+
+ FloatBuffer floatBuffer;
+ int mProgram;
+ int maPositionHandle;
+
+ int[] mShaderCount;
+ int mError;
+
+ @Override
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+
+ }
+
+ public int loadShader(int type, String shaderCode) {
+ int shader = GLES20.glCreateShader(type);
+ GLES20.glShaderSource(shader, shaderCode);
+ GLES20.glCompileShader(shader);
+ return shader;
+ }
+
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererEightShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererEightShaderTest.java
new file mode 100644
index 0000000..eba7601
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererEightShaderTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+public class RendererEightShaderTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ int shaderOne = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
+
+ GLES20.glAttachShader(mProgram, shaderOne);
+
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererFiveShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererFiveShaderTest.java
new file mode 100644
index 0000000..0dce725
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererFiveShaderTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+import android.util.Log;
+
+
+public class RendererFiveShaderTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ int shaderOne = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
+ int shaderTwo = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
+ GLES20.glAttachShader(mProgram, shaderOne);
+ GLES20.glAttachShader(mProgram, shaderTwo);
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererFourShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererFourShaderTest.java
new file mode 100644
index 0000000..2382c6d
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererFourShaderTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+import android.util.Log;
+
+
+public class RendererFourShaderTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ try {
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ }catch(Exception e) {
+ Log.d("",e.toString());
+ }
+ mError = GLES20.glGetError();
+ GLES20.glLinkProgram(mProgram);
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererNineShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererNineShaderTest.java
new file mode 100644
index 0000000..64cc9d0
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererNineShaderTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+public class RendererNineShaderTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ //Invalid shader with value 0
+ int shaderOne = 0;
+
+ GLES20.glAttachShader(mProgram, shaderOne);
+
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererOneProgramTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererOneProgramTest.java
new file mode 100644
index 0000000..3aceeaa
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererOneProgramTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+import android.util.Log;
+
+public class RendererOneProgramTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ int mProgramTwo = GLES20.glCreateProgram();
+ GLES20.glAttachShader(mProgram, mProgramTwo);
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererOneShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererOneShaderTest.java
new file mode 100644
index 0000000..83f7f43
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererOneShaderTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+
+public class RendererOneShaderTest extends RendererBase {
+
+ private String vertexShaderCode =
+ "attribute vec4 vPosition; \n"
+ + "void main(){ \n" +
+ "gl_Position = vPosition; \n"
+ + "} \n";
+
+ private String fragmentShaderCode = "precision mediump float; \n"
+ + "void main(){ \n"
+ + " gl_FragColor = vec4 (0.63671875, 0.76953125, 0.22265625, 1.0); \n"
+ + "} \n";
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
+ GLES20.glUseProgram(mProgram);
+
+ GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT,
+ false, 12, floatBuffer);
+ GLES20.glEnableVertexAttribArray(maPositionHandle);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+ initShapes();
+ int vertexShaderOne = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
+ int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
+ mProgram = GLES20.glCreateProgram();
+ GLES20.glAttachShader(mProgram, vertexShaderOne);
+ GLES20.glAttachShader(mProgram, fragmentShader);
+ GLES20.glLinkProgram(mProgram);
+ int[] linkStatus = new int[1];
+ GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linkStatus, 0);
+ if (linkStatus[0] != GLES20.GL_TRUE) {
+ //do nothing
+ }
+
+ }
+ public void initShapes(){
+ float triangleCoords[] = { -0.5f, -0.25f, 0,
+ 0.5f, -0.25f, 0,
+ 0.0f, 0.559016994f, 0};
+ ByteBuffer byteBuffer = ByteBuffer.allocateDirect(triangleCoords.length * 4);
+ byteBuffer.order(ByteOrder.nativeOrder());
+ floatBuffer = byteBuffer.asFloatBuffer();
+ floatBuffer.put(triangleCoords);
+ floatBuffer.position(0);
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererSevenShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererSevenShaderTest.java
new file mode 100644
index 0000000..b225572
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererSevenShaderTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+public class RendererSevenShaderTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ int shaderOne = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
+ int shaderTwo = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
+ GLES20.glAttachShader(mProgram, shaderOne);
+ GLES20.glAttachShader(mProgram, shaderTwo);
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererSixShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererSixShaderTest.java
new file mode 100644
index 0000000..989bd7f
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererSixShaderTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+public class RendererSixShaderTest extends RendererBase {
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+
+ mProgram = GLES20.glCreateProgram();
+ int shaderOne = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
+ int shaderTwo = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
+ GLES20.glAttachShader(mProgram, shaderOne);
+ GLES20.glAttachShader(mProgram, shaderTwo);
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererTenShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererTenShaderTest.java
new file mode 100644
index 0000000..0d8e86e
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererTenShaderTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+public class RendererTenShaderTest extends RendererBase {
+ private String fragmentShaderCode = Shaders.successfulcompile_frag;
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+ int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
+ mProgram = GLES20.glCreateProgram();
+
+ GLES20.glAttachShader(mProgram, fragmentShader);
+ GLES20.glLinkProgram(mProgram);
+
+ mError = GLES20.glGetError();
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererThreeShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererThreeShaderTest.java
new file mode 100644
index 0000000..430c1a0
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererThreeShaderTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+
+public class RendererThreeShaderTest extends RendererBase {
+
+ private String vertexShaderCode =
+ "attribute vec4 vPosition; \n"
+ + "void main(){ \n" +
+ "gl_Position = vPosition; \n"
+ + "} \n";
+
+ private String fragmentShaderCode = "precision mediump float; \n"
+ + "void main(){ \n"
+ + " gl_FragColor = vec4 (0.63671875, 0.76953125, 0.22265625, 1.0); \n"
+ + "} \n";
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
+ GLES20.glUseProgram(mProgram);
+
+ GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT,
+ false, 12, floatBuffer);
+ GLES20.glEnableVertexAttribArray(maPositionHandle);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+ initShapes();
+ int vertexShaderOne = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
+ int vertexShaderTwo = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
+ int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
+ mProgram = GLES20.glCreateProgram();
+
+ GLES20.glAttachShader(mProgram, vertexShaderOne);
+ GLES20.glAttachShader(mProgram, vertexShaderTwo);
+ mError = GLES20.glGetError();
+ GLES20.glAttachShader(mProgram, fragmentShader);
+ GLES20.glLinkProgram(mProgram);
+ int[] linkStatus = new int[1];
+ GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linkStatus, 0);
+ if (linkStatus[0] != GLES20.GL_TRUE) {
+ //do nothing
+ }
+
+ }
+ public void initShapes(){
+ float triangleCoords[] = {-0.5f, -0.25f, 0,
+ 0.5f, -0.25f, 0,
+ 0.0f, 0.559016994f, 0};
+ ByteBuffer byteBuffer = ByteBuffer.allocateDirect(triangleCoords.length * 4);
+ byteBuffer.order(ByteOrder.nativeOrder());
+ floatBuffer = byteBuffer.asFloatBuffer();
+ floatBuffer.put(triangleCoords);
+ floatBuffer.position(0);
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererTwoShaderTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererTwoShaderTest.java
new file mode 100644
index 0000000..53d90af
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererTwoShaderTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+public class RendererTwoShaderTest extends RendererBase {
+ private final String fragmentShaderCode = "precision mediump float; \n"
+ + "void main(){ \n"
+ + " gl_FragColor = vec4 (0.63671875, 0.76953125, 0.22265625, 1.0); \n"
+ + "} \n";
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
+ GLES20.glUseProgram(mProgram);
+
+ GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT,
+ false, 12, floatBuffer);
+ GLES20.glEnableVertexAttribArray(maPositionHandle);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+ initShapes();
+ //give a wrong value
+ int vertexShaderOne = 9999;
+ int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
+ mProgram = GLES20.glCreateProgram();
+ GLES20.glAttachShader(mProgram, vertexShaderOne);
+ mError = GLES20.glGetError();
+ GLES20.glAttachShader(mProgram, fragmentShader);
+ GLES20.glLinkProgram(mProgram);
+ int[] linkStatus = new int[1];
+ GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linkStatus, 0);
+ mShaderCount = new int[1];
+ int[] shaders = new int[10];
+ GLES20.glGetAttachedShaders(mProgram, 10, mShaderCount, 0, shaders, 0);
+ if (linkStatus[0] != GLES20.GL_TRUE) {
+ //do nothing
+ }
+ }
+
+ public void initShapes(){
+ float triangleCoords[] = { -0.5f, -0.25f, 0,
+ 0.5f, -0.25f, 0,
+ 0.0f, 0.559016994f, 0};
+ ByteBuffer byteBuffer = ByteBuffer.allocateDirect(triangleCoords.length * 4);
+ byteBuffer.order(ByteOrder.nativeOrder());
+ floatBuffer = byteBuffer.asFloatBuffer();
+ floatBuffer.put(triangleCoords);
+ floatBuffer.position(0);
+ }
+}
diff --git a/tests/tests/opengl/src/android/opengl/cts/Shaders.java b/tests/tests/opengl/src/android/opengl/cts/Shaders.java
new file mode 100644
index 0000000..e8025fc
--- /dev/null
+++ b/tests/tests/opengl/src/android/opengl/cts/Shaders.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+package android.opengl.cts;
+
+public class Shaders {
+ public static String successfulcompile_frag =
+ "#ifdef GL_ES \n"
+ + "precision mediump float; \n"
+ + "#endif \n"
+ + "uniform float mortarThickness; \n"
+ + "uniform vec3 brickColor; \n"
+ + "uniform vec3 mortarColor; \n"
+
+ + "uniform float brickMortarWidth; \n"
+ + "uniform float brickMortarHeight; \n"
+ + "uniform float mwf; \n"
+ + "uniform float mhf; \n"
+
+ + "varying vec3 Position; \n"
+ + "varying float lightIntensity; \n"
+ + "\n"
+ + "void main (void){ \n"
+ + " vec3 ct; \n"
+ + " float ss, tt, w, h; \n"
+ + ""
+ + " vec3 pos = Position; \n"
+ + ""
+ + " ss = pos.x / brickMortarWidth; \n"
+ + " tt = pos.z / brickMortarHeight; \n"
+ + " if (fract (tt * 0.5) > 0.5) \n"
+ + " ss += 0.5; \n"
+
+ + " ss = fract (ss); \n"
+ + " tt = fract (tt); \n"
+
+ + " w = step (mwf, ss) - step (1.0 - mwf, ss); \n"
+ + " h = step (mhf, tt) - step (1.0 - mhf, tt); \n"
+
+ + " ct = clamp(mix (mortarColor, brickColor, w * h) * lightIntensity, 0.0, 1.0); \n"
+
+ + " gl_FragColor = vec4 (ct, 1.0); \n"
+ + "} \n";
+
+}