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/PostprocessEffectBlur.java
140 140
 *
141 141
 * @y.exclude
142 142
 */
143
  public int apply(float[] uniforms, int index, DistortedOutputSurface[] buffers)
143
  public int apply(float[] uniforms, int index, DistortedOutputSurface[][] buffers)
144 144
    {
145 145
    if( mProgram1 ==null)
146 146
      {
......
157 157

  
158 158
    DistortedRenderState.useStencilMark();
159 159

  
160
    DistortedFramebuffer buffer = (DistortedFramebuffer)buffers[mQualityLevel];
160
    DistortedFramebuffer buffer0 = (DistortedFramebuffer)buffers[mQualityLevel][0];
161
    DistortedFramebuffer buffer1 = (DistortedFramebuffer)buffers[mQualityLevel][1];
161 162

  
162
    buffer.setAsOutput();
163
    float w= buffer0.getWidth();
164
    float h= buffer0.getHeight();
165
    float n= 1.0f - buffer0.getNear();
163 166

  
164
    float w= buffer.getWidth();
165
    float h= buffer.getHeight();
166
    float n= 1.0f - buffer.getNear();
167

  
168
    float corrW = buffer.getWidthCorrection();
169
    float corrH = buffer.getHeightCorrection();
167
    float corrW = buffer0.getWidthCorrection();
168
    float corrH = buffer0.getHeightCorrection();
170 169
    float offsetCorrW = corrW/w;
171 170
    float offsetCorrH = corrH/h;
172 171

  
......
182 181
    for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrW;
183 182

  
184 183
    mProgram1.useProgram();
185
    buffer.bindForOutput(1);
186
    buffer.setAsInput(0);
184
    buffer1.setAsOutput();
185
    buffer0.setAsInput();
187 186

  
188 187
    GLES31.glColorMask(true,true,true,true);
189 188
    GLES31.glClearColor(1.0f,1.0f,1.0f,0.0f);
......
203 202
    for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrH;
204 203

  
205 204
    mProgram2.useProgram();
206
    buffer.bindForOutput(0);
207
    buffer.setAsInput(1);
205
    buffer0.setAsOutput();
206
    buffer1.setAsInput();
208 207

  
209 208
    GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
210 209

  

Also available in: Unified diff