Project

General

Profile

« Previous | Next » 

Revision 2301cb2f

Added by Leszek Koltunski almost 6 years ago

I am pretty sure this time the flashing issues on Mali T880 r12 driver are finally fixed.

The fix: a queue of FBOs render to, just like before, but this time in DistortedScreen we blit not the current FBO, but the one computed several frames ago.

This of course introduces a delay and uses more memory, but it appears to work and does not seem to have any effects on speed.

View differences:

src/main/java/org/distorted/library/main/DistortedScreen.java
55 55
  private static MatrixEffectMove mMoveEffect = new MatrixEffectMove( new Static3D(5,5,0) );
56 56
  ///// END DEBUGGING //////////////////////////
57 57

  
58
  private int mCurrFBO;
58
  private int mCurrFBO, mLastFBO;
59 59

  
60 60
///////////////////////////////////////////////////////////////////////////////////////////////////
61 61
// PUBLIC API
......
70 70
    super(Distorted.FBO_QUEUE_SIZE,1,BOTH_DEPTH_STENCIL, TYPE_SYST, 1,1);
71 71
    mShowFPS = false;
72 72
    mCurrFBO = 0;
73
    mLastFBO = 1;
73 74
    }
74 75

  
75 76
///////////////////////////////////////////////////////////////////////////////////////////////////
......
83 84
 */
84 85
  public int render(long time)
85 86
    {
87
    if( ++mCurrFBO>=Distorted.FBO_QUEUE_SIZE ) mCurrFBO=0;
88
    if( ++mLastFBO>=Distorted.FBO_QUEUE_SIZE ) mLastFBO=0;
89

  
86 90
    if( mShowFPS )
87 91
      {
88 92
      if( lastTime==0 ) lastTime = time;
......
106 110
    int numrender = super.render(time,mCurrFBO);
107 111

  
108 112
    GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, 0);
109
    setAsInput(mCurrFBO,0);
113

  
114
    // workaround for the Mali issues: blit the framebuffer we have computed Distorted.FBO_QUEUE_SIZE
115
    // frames ago. Looks like FBO_QUEUE_SIZE=2 solves the issue already but I decided to play it safe and
116
    // make it equal to 3.
117
    // This of course introduces a delay and uses more memory, but it does not appear to have any effect
118
    // on speed. Maybe a slight positive effect if any!
119
    setAsInput(mLastFBO,0);
120

  
110 121
    GLES31.glColorMask(true,true,true,true);
111 122
    GLES31.glDepthMask(false);
112 123
    GLES31.glDisable(GLES31.GL_STENCIL_TEST);
......
120 131
      fpsEffects.drawPriv(fpsW / 2.0f, fpsH / 2.0f, fpsMesh, this, time, 0);
121 132
      }
122 133

  
123
    mCurrFBO++;
124
    if( mCurrFBO>=Distorted.FBO_QUEUE_SIZE ) mCurrFBO=0;
125

  
126 134
    return numrender+1;
127 135
    }
128 136

  

Also available in: Unified diff