commit d2dc25adfe20d25a2bb575f791a95846c29c06d5
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Apr 10 12:03:53 2022 +0200

    Properly detect which drivers are slow with compilation of TF programs.

diff --git a/src/main/java/org/distorted/library/main/DistortedLibrary.java b/src/main/java/org/distorted/library/main/DistortedLibrary.java
index 2290916..371f691 100644
--- a/src/main/java/org/distorted/library/main/DistortedLibrary.java
+++ b/src/main/java/org/distorted/library/main/DistortedLibrary.java
@@ -123,6 +123,7 @@ public class DistortedLibrary
 
   private static boolean mBuggyUBOs;
   private static String mVendor, mVersion, mRenderer;
+  private static boolean mFastCompilationTF;
 
   //////////////////////////////////////////////////////////////////////////////////////////////
   /// MAIN PROGRAM ///
@@ -880,6 +881,26 @@ public class DistortedLibrary
     return mFBOQueueSize;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private static int parseQualcommDriverVersion(String version)
+    {
+    int at = version.indexOf('@');
+
+    if( at>=0 )
+      {
+      int dot = version.indexOf('.',at);
+
+      if( dot>at+1 )
+        {
+        String ver = version.substring(at+1,dot);
+        return Integer.parseInt(ver);
+        }
+      }
+
+    return 0;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // ARM Mali driver r12 has problems when we keep swapping many FBOs (fixed in r22)
 // PowerVR GE8100 / GE8300 compiler fails to compile OIT programs.
@@ -891,6 +912,7 @@ public class DistortedLibrary
     mRenderer= GLES30.glGetString(GLES30.GL_RENDERER);
 
     mFBOQueueSize = 1;
+    mFastCompilationTF = true;
 
     if( mVendor.contains("ARM") )
       {
@@ -933,11 +955,18 @@ public class DistortedLibrary
       }
     else if( mVendor.contains("Qualcomm"))
       {
-      if( mRenderer.contains("308") && (mVersion.contains("V@331.0") || mVersion.contains("V@415.0") ) )
+      int driverVersion = parseQualcommDriverVersion(mVersion);
+
+      if( mRenderer.contains("308") && (driverVersion==331 || driverVersion==415) )
         {
         Log.e("DISTORTED", "You are running this on an Adreno 308 driver 331 or 415.\nStrange shit might happen.");
         mBuggyUBOs = true;
         }
+      if( mGLSL<=300 && driverVersion<415 ) // This is only on old enough drivers, 84,95,100,104,140 and known bad, 415 is known good.
+        {
+        Log.e("DISTORTED", "Slow compilation of Transform Feedback programs!");
+        mFastCompilationTF = false;
+        }
       }
     }
 
@@ -1186,6 +1215,17 @@ public class DistortedLibrary
       }
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Some devices - Qualcomm's Adreno 3xx with drivers v. 84,95,100,104,140, and possibly more -
+ * suffer from a very slow compilation of GLSL program if said program includes Transform Feedback.
+ * Return true if the platform we are running on does not suffer from this problem.
+ */
+  public static boolean fastCompilationTF()
+    {
+    return mFastCompilationTF;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Return the maximum size of the texture supported by the driver.
