Project

General

Profile

« Previous | Next » 

Revision 0f011027

Added by Leszek Koltunski almost 7 years ago

Major speedup, BLUR fully optimized now.

Multiblur app, worst case (all 8 cubes blurred with max radius, HIGHEST quality: Nexus5X: 46.7 FPS, Nexus 4: 29.7 FPS.

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
64 64

  
65 65
  private ArrayList<Job> mJobs = new ArrayList<>();
66 66

  
67
  DistortedFramebuffer[] mBuffer1, mBuffer2;
67
  DistortedFramebuffer[] mBuffer;
68 68

  
69 69
  private long mTime;
70 70
  private float mFOV;
......
110 110
    mClearStencil = 0;
111 111
    mClear = GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT;
112 112

  
113
    mBuffer1 = new DistortedFramebuffer[EffectQuality.LENGTH];
114
    mBuffer2 = new DistortedFramebuffer[EffectQuality.LENGTH];
113
    mBuffer = new DistortedFramebuffer[EffectQuality.LENGTH];
115 114

  
116 115
    mMipmap = 1.0f;
117 116

  
......
164 163

  
165 164
    for(int j=0; j<EffectQuality.LENGTH; j++)
166 165
      {
167
      mBuffer1[j] = new DistortedFramebuffer(1,BOTH_DEPTH_STENCIL,TYPE_SYST, (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
168
      mBuffer2[j] = new DistortedFramebuffer(1,BOTH_DEPTH_STENCIL,TYPE_SYST, (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
169
      mBuffer1[j].mMipmap = mipmap;
170
      mBuffer2[j].mMipmap = mipmap;
166
      mBuffer[j] = new DistortedFramebuffer(2,BOTH_DEPTH_STENCIL,TYPE_SYST, (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
167
      mBuffer[j].mMipmap = mipmap;
171 168
      mipmap *= EffectQuality.MULTIPLIER;
172 169
      }
173 170

  
......
182 179

  
183 180
    for(int j=0; j<EffectQuality.LENGTH; j++)
184 181
      {
185
      mBuffer1[j].setAsOutput();
186
      GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT|GLES30.GL_DEPTH_BUFFER_BIT|GLES30.GL_STENCIL_BUFFER_BIT);
187
      mBuffer2[j].setAsOutput();
182
      mBuffer[j].setAsOutput();
183
      GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_COLOR_ATTACHMENT0, GLES30.GL_TEXTURE_2D, mBuffer[j].mColorH[1], 0);
188 184
      GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT|GLES30.GL_DEPTH_BUFFER_BIT|GLES30.GL_STENCIL_BUFFER_BIT);
185
      GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_COLOR_ATTACHMENT0, GLES30.GL_TEXTURE_2D, mBuffer[j].mColorH[0], 0);
186
      GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT);
189 187
      }
190 188
    }
191 189

  
......
212 210
      if( currB==0 ) numRenders += child.draw(time,this);
213 211
      else
214 212
        {
215
        if( mBuffer1[0]==null ) createBuffers();
213
        if( mBuffer[0]==null ) createBuffers();
216 214
        numRenders += child.markStencilAndDraw(time,this,currP);
217 215
        if( i==num-1 ) numRenders += currP.postprocess(time,this);
218 216
        }

Also available in: Unified diff