Revision d2dc25ad
Added by Leszek Koltunski over 3 years ago
| src/main/java/org/distorted/library/main/DistortedLibrary.java | ||
|---|---|---|
| 123 | 123 | 
     | 
| 124 | 124 | 
    private static boolean mBuggyUBOs;  | 
| 125 | 125 | 
    private static String mVendor, mVersion, mRenderer;  | 
| 126 | 
    private static boolean mFastCompilationTF;  | 
|
| 126 | 127 | 
     | 
| 127 | 128 | 
    //////////////////////////////////////////////////////////////////////////////////////////////  | 
| 128 | 129 | 
    /// MAIN PROGRAM ///  | 
| ... | ... | |
| 880 | 881 | 
    return mFBOQueueSize;  | 
| 881 | 882 | 
    }  | 
| 882 | 883 | 
     | 
| 884 | 
    ///////////////////////////////////////////////////////////////////////////////////////////////////  | 
|
| 885 | 
     | 
|
| 886 | 
    private static int parseQualcommDriverVersion(String version)  | 
|
| 887 | 
        {
   | 
|
| 888 | 
        int at = version.indexOf('@');
   | 
|
| 889 | 
     | 
|
| 890 | 
    if( at>=0 )  | 
|
| 891 | 
          {
   | 
|
| 892 | 
          int dot = version.indexOf('.',at);
   | 
|
| 893 | 
     | 
|
| 894 | 
    if( dot>at+1 )  | 
|
| 895 | 
            {
   | 
|
| 896 | 
    String ver = version.substring(at+1,dot);  | 
|
| 897 | 
    return Integer.parseInt(ver);  | 
|
| 898 | 
    }  | 
|
| 899 | 
    }  | 
|
| 900 | 
     | 
|
| 901 | 
    return 0;  | 
|
| 902 | 
    }  | 
|
| 903 | 
     | 
|
| 883 | 904 | 
    ///////////////////////////////////////////////////////////////////////////////////////////////////  | 
| 884 | 905 | 
    // ARM Mali driver r12 has problems when we keep swapping many FBOs (fixed in r22)  | 
| 885 | 906 | 
    // PowerVR GE8100 / GE8300 compiler fails to compile OIT programs.  | 
| ... | ... | |
| 891 | 912 | 
    mRenderer= GLES30.glGetString(GLES30.GL_RENDERER);  | 
| 892 | 913 | 
     | 
| 893 | 914 | 
    mFBOQueueSize = 1;  | 
| 915 | 
    mFastCompilationTF = true;  | 
|
| 894 | 916 | 
     | 
| 895 | 917 | 
        if( mVendor.contains("ARM") )
   | 
| 896 | 918 | 
          {
   | 
| ... | ... | |
| 933 | 955 | 
    }  | 
| 934 | 956 | 
        else if( mVendor.contains("Qualcomm"))
   | 
| 935 | 957 | 
          {
   | 
| 936 | 
          if( mRenderer.contains("308") && (mVersion.contains("V@331.0") || mVersion.contains("V@415.0") ) )
   | 
|
| 958 | 
    int driverVersion = parseQualcommDriverVersion(mVersion);  | 
|
| 959 | 
     | 
|
| 960 | 
          if( mRenderer.contains("308") && (driverVersion==331 || driverVersion==415) )
   | 
|
| 937 | 961 | 
            {
   | 
| 938 | 962 | 
            Log.e("DISTORTED", "You are running this on an Adreno 308 driver 331 or 415.\nStrange shit might happen.");
   | 
| 939 | 963 | 
    mBuggyUBOs = true;  | 
| 940 | 964 | 
    }  | 
| 965 | 
    if( mGLSL<=300 && driverVersion<415 ) // This is only on old enough drivers, 84,95,100,104,140 and known bad, 415 is known good.  | 
|
| 966 | 
            {
   | 
|
| 967 | 
            Log.e("DISTORTED", "Slow compilation of Transform Feedback programs!");
   | 
|
| 968 | 
    mFastCompilationTF = false;  | 
|
| 969 | 
    }  | 
|
| 941 | 970 | 
    }  | 
| 942 | 971 | 
    }  | 
| 943 | 972 | 
     | 
| ... | ... | |
| 1186 | 1215 | 
    }  | 
| 1187 | 1216 | 
    }  | 
| 1188 | 1217 | 
     | 
| 1218 | 
    ///////////////////////////////////////////////////////////////////////////////////////////////////  | 
|
| 1219 | 
    /**  | 
|
| 1220 | 
    * Some devices - Qualcomm's Adreno 3xx with drivers v. 84,95,100,104,140, and possibly more -  | 
|
| 1221 | 
    * suffer from a very slow compilation of GLSL program if said program includes Transform Feedback.  | 
|
| 1222 | 
    * Return true if the platform we are running on does not suffer from this problem.  | 
|
| 1223 | 
    */  | 
|
| 1224 | 
    public static boolean fastCompilationTF()  | 
|
| 1225 | 
        {
   | 
|
| 1226 | 
    return mFastCompilationTF;  | 
|
| 1227 | 
    }  | 
|
| 1228 | 
     | 
|
| 1189 | 1229 | 
    ///////////////////////////////////////////////////////////////////////////////////////////////////  | 
| 1190 | 1230 | 
    /**  | 
| 1191 | 1231 | 
    * Return the maximum size of the texture supported by the driver.  | 
Also available in: Unified diff
Properly detect which drivers are slow with compilation of TF programs.