Project

General

Profile

« Previous | Next » 

Revision 2dbed690

Added by Leszek Koltunski almost 6 years ago

In an attempt to contain the flashes on Mali GPU, re-structure the post-processing FBOs from 1 FBO with 2 color attachments + combined depth-stencil to 2 separate FBOs sharing a depth-stencil texture.

Result: this appears to make the flashes slightly worse.

View differences:

src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
144 144
 *
145 145
 * @y.exclude
146 146
 */
147
  public int apply(float[] uniforms, int index, DistortedOutputSurface[] buffers)
147
  public int apply(float[] uniforms, int index, DistortedOutputSurface[][] buffers)
148 148
    {
149 149
    if( mProgram1 ==null)
150 150
      {
......
161 161

  
162 162
    DistortedRenderState.useStencilMark();
163 163

  
164
    DistortedFramebuffer  inBuffer = (DistortedFramebuffer)buffers[0];
165
    DistortedFramebuffer outBuffer = (DistortedFramebuffer)buffers[mQualityLevel];
164
    DistortedFramebuffer  inBuffer  = (DistortedFramebuffer)buffers[0][0];
165
    DistortedFramebuffer outBuffer0 = (DistortedFramebuffer)buffers[mQualityLevel][0];
166
    DistortedFramebuffer outBuffer1 = (DistortedFramebuffer)buffers[mQualityLevel][1];
166 167

  
167
    float w= outBuffer.getWidth();
168
    float h= outBuffer.getHeight();
169
    float n= 1.0f - outBuffer.getNear();
168
    float w= outBuffer0.getWidth();
169
    float h= outBuffer0.getHeight();
170
    float n= 1.0f - outBuffer0.getNear();
170 171

  
171 172
    float corrW = inBuffer.getWidthCorrection();
172 173
    float corrH = inBuffer.getHeightCorrection();
......
180 181
    int offset = radius + radius*radius/4;
181 182
    radius = (radius+1)/2;
182 183

  
183
    outBuffer.setAsOutput();
184 184
    GLES31.glViewport(0, 0, (int)w, (int)h);
185 185

  
186 186
    // horizontal glow
187 187
    for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrW;
188 188

  
189 189
    mProgram1.useProgram();
190
    outBuffer.bindForOutput(1);
191
    inBuffer.setAsInput(0);
190
    outBuffer1.setAsOutput();
191
    inBuffer.setAsInput();
192 192

  
193 193
    GLES31.glColorMask(true,true,true,true);
194 194
    GLES31.glClearColor(1.0f,1.0f,1.0f,0.0f);
......
209 209
    for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrH;
210 210

  
211 211
    mProgram2.useProgram();
212
    outBuffer.bindForOutput(0);
213
    outBuffer.setAsInput(1);
212
    outBuffer0.setAsOutput();
213
    outBuffer1.setAsInput();
214 214

  
215 215
    GLES31.glUniform1f ( mProgram2.mUniform[0] , n );
216 216
    GLES31.glUniform2f ( mProgram2.mUniform[1] , corrW, corrH );
......
229 229
    if( mQualityLevel>0 )
230 230
      {
231 231
      inBuffer.setAsOutput();
232
      outBuffer.setAsInput(0);
232
      outBuffer0.setAsInput();
233 233
      GLES31.glEnable(GLES31.GL_BLEND);
234 234
      DistortedEffects.blitPriv(inBuffer);
235 235
      GLES31.glDisable(GLES31.GL_BLEND);

Also available in: Unified diff