Project

General

Profile

« Previous | Next » 

Revision eff6e3d3

Added by Leszek Koltunski about 3 years ago

Properly solve the issue with Qualcomm driver V@331 having buggy UBO size.

View differences:

src/main/java/org/distorted/library/main/DistortedLibrary.java
116 116
  private static int mGLSL;
117 117
  private static String mGLSL_VERSION;
118 118
  private static boolean mOITCompilationAttempted, mNeedsTransformFeedback;
119
  private static boolean mBuggyUBOs;
119 120

  
120 121
  private static int mMaxTextureSize         = Integer.MAX_VALUE;
121 122
  private static int mMaxNumberOfVerUniforms = Integer.MAX_VALUE;
......
248 249

  
249 250
    mainVertHeader += "#define MAX_COMPON " + MeshBase.getMaxEffComponents() + "\n";
250 251
    if( MeshBase.getUseCenters() ) mainVertHeader += "#define COMP_CENTERS\n";
252
    if( mBuggyUBOs )               mainVertHeader += "#define BUGGY_UBOS\n";
251 253

  
252 254
    String enabledEffectV= VertexEffect.getGLSL();
253 255
    String enabledEffectF= FragmentEffect.getGLSL();
......
347 349

  
348 350
    fullVertHeader += "#define MAX_COMPON " + MeshBase.getMaxEffComponents() + "\n";
349 351
    if( MeshBase.getUseCenters() ) fullVertHeader += "#define COMP_CENTERS\n";
352
    if( mBuggyUBOs )               fullVertHeader += "#define BUGGY_UBOS\n";
350 353

  
351 354
    String enabledEffectV= VertexEffect.getAllGLSL();
352 355
    String enabledEffectF= "{}";
......
387 390

  
388 391
    mainVertHeader += "#define MAX_COMPON " + MeshBase.getMaxEffComponents() + "\n";
389 392
    if( MeshBase.getUseCenters() ) mainVertHeader += "#define COMP_CENTERS\n";
393
    if( mBuggyUBOs )               mainVertHeader += "#define BUGGY_UBOS\n";
390 394

  
391 395
    String enabledEffectV= VertexEffect.getGLSL();
392 396
    String enabledEffectF= FragmentEffect.getGLSL();
......
935 939
      if( version.contains("V@331.0") )
936 940
        {
937 941
        Log.e("DISTORTED", "You are running this on an Adreno 3xx driver version 331.\nStrange shit might happen.");
942
        mBuggyUBOs = true;
938 943
        }
939 944
      }
940 945
    }
src/main/res/raw/main_vertex_shader.glsl
65 65
                                      // second vec4: first float - cache, next 3: Center, the third -  the Region.
66 66
  };
67 67

  
68
#ifdef BUGGY_UBOS
69
layout (packed) uniform componentAssociation
70
  {
71
  ivec2 vComAssoc[MAX_COMPON];        // component 'AND' and 'EQU' Associations
72
  };
73
#else
68 74
layout (std140) uniform componentAssociation
69 75
  {
70 76
  ivec4 vComAssoc[MAX_COMPON];        // component 'AND' and 'EQU' Associations
71 77
  };
78
#endif
72 79

  
73 80
//////////////////////////////////////////////////////////////////////////////////////////////
74 81
// HELPER FUNCTIONS

Also available in: Unified diff