commit edea9cf3ec0d9af1f0d3c3707f80da5134e012f0
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Jun 29 15:51:36 2018 +0100

    In Distorted.onCreate(), catch and re-throw exceptions, so that even is some Program fails to compile, others will still compile.

diff --git a/src/main/java/org/distorted/library/main/Distorted.java b/src/main/java/org/distorted/library/main/Distorted.java
index 63f797f..a073c20 100644
--- a/src/main/java/org/distorted/library/main/Distorted.java
+++ b/src/main/java/org/distorted/library/main/Distorted.java
@@ -23,6 +23,7 @@ import android.app.ActivityManager;
 import android.content.Context;
 import android.content.pm.ConfigurationInfo;
 import android.content.res.Resources;
+import android.opengl.GLES31;
 
 import org.distorted.library.effect.Effect;
 import org.distorted.library.effect.FragmentEffect;
@@ -98,6 +99,39 @@ public class Distorted
 
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// ARM Mali driver r12 has problems when we keep swapping many FBOs (fixed in r22)
+// PowerVR GE8100 compiler fails to compile OIT programs.
+
+  static void detectBuggyDrivers()
+    {
+    String vendor  = GLES31.glGetString(GLES31.GL_VENDOR);
+    String version = GLES31.glGetString(GLES31.GL_VERSION);
+    String renderer= GLES31.glGetString(GLES31.GL_RENDERER);
+
+    /*
+    android.util.Log.e("DISTORTED", "GLSL Version "+GLES31.glGetString(GLES31.GL_SHADING_LANGUAGE_VERSION));
+    android.util.Log.e("DISTORTED", "GL Version "  +GLES31.glGetString(GLES31.GL_VERSION));
+    android.util.Log.e("DISTORTED", "GL Vendor "   +GLES31.glGetString(GLES31.GL_VENDOR));
+    android.util.Log.e("DISTORTED", "GL Renderer " +GLES31.glGetString(GLES31.GL_RENDERER));
+    */
+
+    if( vendor.contains("ARM") )
+      {
+      if( version.contains("r12") )
+        {
+        android.util.Log.e("DISTORTED", "You are running this on a ARM Mali driver r12. This is a buggy driver, please update to r22. Problems with flashing expected.");
+        }
+      }
+    else if( vendor.contains("Imagination") )
+      {
+      if( renderer.contains("GE8") )
+        {
+        android.util.Log.e("DISTORTED", "You are running this on a PowerVR GE8XXX. Due to a buggy compiler OIT rendering will not work");
+        }
+      }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Have we called onCreate yet, ie have we initialized the library?
@@ -117,25 +151,53 @@ public class Distorted
  *   
  * @param context Context of the App using the library - used to open up Resources and read Shader code.
  */
-  public static void onCreate(final Context context)
+  public static void onCreate(final Context context) throws Exception
     {
     final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
     final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
     android.util.Log.e("DISTORTED", "Using OpenGL ES "+configurationInfo.getGlEsVersion());
-    /*
-    android.util.Log.e("DISTORTED", "GLSL Version "+GLES31.glGetString(GLES31.GL_SHADING_LANGUAGE_VERSION));
-    android.util.Log.e("DISTORTED", "GL Version "  +GLES31.glGetString(GLES31.GL_VERSION));
-    android.util.Log.e("DISTORTED", "GL Vendor "   +GLES31.glGetString(GLES31.GL_VENDOR));
-    android.util.Log.e("DISTORTED", "GL Renderer " +GLES31.glGetString(GLES31.GL_RENDERER));
-    */
+
+    mInitialized = true;
+
+    detectBuggyDrivers();
+
     EffectMessageSender.startSending();
 
     final Resources resources = context.getResources();
-    DistortedEffects.createPrograms(resources);
-    DistortedEffects.createProgramsOIT(resources);
-    PostprocessEffect.createPrograms();
 
-    mInitialized = true;
+    Exception exception=null;
+
+    try
+      {
+      DistortedEffects.createPrograms(resources);
+      }
+    catch(Exception ex)
+      {
+      exception = ex;
+      }
+
+    try
+      {
+      DistortedEffects.createProgramsOIT(resources);
+      }
+    catch(Exception ex)
+      {
+      exception = ex;
+      }
+
+    try
+      {
+      PostprocessEffect.createPrograms();
+      }
+    catch(Exception ex)
+      {
+      exception = ex;
+      }
+
+    if( exception!=null)
+      {
+      throw exception;
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -170,13 +232,4 @@ public class Distorted
 
     mInitialized = false;
     }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Return 2 or 3 depending if we have OpenGL Es 2.0 or 3.x context created.
- */
-  public static int getGlVersion()
-    {
-    return GLSL == 300 ? 3:2;
-    }
   }
\ No newline at end of file
