Revision 8ebbc730
Added by Leszek Koltunski almost 6 years ago
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; |
|
59 |
private static final int NUM_FBO = 3; |
|
60 |
|
|
58 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 62 |
// PUBLIC API |
60 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
65 | 68 |
*/ |
66 | 69 |
public DistortedScreen() |
67 | 70 |
{ |
68 |
super(1,1,1,BOTH_DEPTH_STENCIL);
|
|
71 |
super(NUM_FBO,1,BOTH_DEPTH_STENCIL, TYPE_SYST, 1,1);
|
|
69 | 72 |
mShowFPS = false; |
73 |
mCurrFBO = 0; |
|
70 | 74 |
} |
71 | 75 |
|
72 | 76 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
100 | 104 |
lastTime = time; |
101 | 105 |
} |
102 | 106 |
|
103 |
int numrender = super.render(time); |
|
107 |
int numrender = super.render(time,mCurrFBO);
|
|
104 | 108 |
|
105 | 109 |
GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, 0); |
106 |
clear(); |
|
107 |
setAsInput(); |
|
110 |
setAsInput(mCurrFBO,0); |
|
108 | 111 |
GLES31.glColorMask(true,true,true,true); |
109 | 112 |
GLES31.glDepthMask(false); |
110 | 113 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST); |
... | ... | |
118 | 121 |
fpsEffects.drawPriv(fpsW / 2.0f, fpsH / 2.0f, fpsMesh, this, time, 0); |
119 | 122 |
} |
120 | 123 |
|
124 |
mCurrFBO++; |
|
125 |
if( mCurrFBO>=NUM_FBO ) mCurrFBO=0; |
|
126 |
|
|
121 | 127 |
return numrender+1; |
122 | 128 |
} |
123 | 129 |
|
Also available in: Unified diff
Port a commit from the master branch.
Finally properly fix the flashing on ARM Mali T880 GPU.
The flashing is caused by a 'full pipeline flush' (see DarkPhoton, https://www.opengl.org/discussion_boards/showthread.php/200754-Flashes-on-ARM-Mali?p=1291679&viewfull=1#post1291679 ). In order to combat it, first introduce the possibility that a single DistortedOutputSurface is backed up by more than one FBO. Then make DistortedScreen be derived from DistortedFramebuffer (which itself is derived from DistortedOutputSurface) and make it contain 3 FBOs, render to them in a circular queue fashion, and blit from a given FBO to the system FBO. The 'more than 1 intermediate FBO' queue prevents the pipeline flush.
Still some TODOs in DistortedFramebuffer remain (properly check for Framebuffer completness!)