Project

General

Profile

« Previous | Next » 

Revision 2b7d2abb

Added by Leszek Koltunski over 3 years ago

Remove UBO from the fragment shader and come back to the default of only 5 concurrent fragment effects. All because UBOs in fragment shader crash on Adreno 510 and Adreno 506.

View differences:

src/main/java/org/distorted/library/uniformblock/UniformBlockFloatUniforms.java
32 32
 */
33 33
public class UniformBlockFloatUniforms
34 34
  {
35
  private final InternalBuffer mUBO;
35
  private InternalBuffer mUBO;
36 36
  private final float[] mArray;
37 37
  private final int mNumUniforms, mSize;
38
  private final boolean mReallyUseUBO;
38 39

  
39 40
///////////////////////////////////////////////////////////////////////////////////////////////////
40 41

  
41
  public UniformBlockFloatUniforms(int numUniforms, int size)
42
  public UniformBlockFloatUniforms(int numUniforms, int size, boolean reallyUse)
42 43
    {
43 44
    mNumUniforms = numUniforms;
44 45
    mSize        = size;
45 46
    mArray= new float[mNumUniforms*mSize];
46
    mUBO = new InternalBuffer(GLES30.GL_UNIFORM_BUFFER, GLES30.GL_STATIC_READ);
47
    mReallyUseUBO= reallyUse;
48

  
49
    if( mReallyUseUBO )
50
      {
51
      mUBO = new InternalBuffer(GLES30.GL_UNIFORM_BUFFER, GLES30.GL_STATIC_READ);
52
      }
47 53
    }
48 54

  
49 55
///////////////////////////////////////////////////////////////////////////////////////////////////
......
53 59
    mNumUniforms = original.mNumUniforms;
54 60
    mSize        = original.mSize;
55 61
    mArray= new float[mNumUniforms*mSize];
62
    mReallyUseUBO= original.mReallyUseUBO;
63

  
56 64
    System.arraycopy(original.mArray, 0, mArray, 0, 3*mSize);
57
    mUBO = new InternalBuffer(GLES30.GL_UNIFORM_BUFFER, GLES30.GL_STATIC_READ);
65

  
66
    if( mReallyUseUBO )
67
      {
68
      mUBO = new InternalBuffer(GLES30.GL_UNIFORM_BUFFER, GLES30.GL_STATIC_READ);
69
      }
58 70
    }
59 71

  
60 72
///////////////////////////////////////////////////////////////////////////////////////////////////
......
69 81
  public void remove(int pos, int numEffects)
70 82
    {
71 83
    System.arraycopy(mArray, mNumUniforms*(pos+1), mArray, mNumUniforms*pos, mNumUniforms*(numEffects-pos) );
72
    mUBO.invalidate();
84

  
85
    if( mReallyUseUBO )
86
      {
87
      mUBO.invalidate();
88
      }
73 89
    }
74 90

  
75 91
///////////////////////////////////////////////////////////////////////////////////////////////////
76 92

  
77 93
  public void markForDeletion()
78 94
    {
79
    mUBO.markForDeletion();
95
    if( mReallyUseUBO )
96
      {
97
      mUBO.markForDeletion();
98
      }
80 99
    }
81 100

  
82 101
///////////////////////////////////////////////////////////////////////////////////////////////////
83 102

  
84 103
  public void invalidate()
85 104
    {
86
    mUBO.invalidate();
105
    if( mReallyUseUBO )
106
      {
107
      mUBO.invalidate();
108
      }
87 109
    }
88 110

  
89 111
///////////////////////////////////////////////////////////////////////////////////////////////////
......
99 121
    {
100 122
    StringBuilder builder = new StringBuilder();
101 123

  
102
    builder.append(mUBO.getID());
124
    builder.append( mReallyUseUBO ? mUBO.getID() : "NOT USED");
103 125
    builder.append(':');
104 126

  
105 127
    for(int i=0; i<6; i++)

Also available in: Unified diff