Project

General

Profile

« Previous | Next » 

Revision c14e495b

Added by Leszek Koltunski over 6 years ago

SSBO: zero out the per-surface transparent fragment counter only when setting the surface as output for the first time in the frame.

View differences:

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

  
219 219
  void recreate()
220 220
    {
221
    mSSBO[0] = -1;
221
    mSSBO[0]   = -1;
222
    mLastValue = -1;
222 223
    mSurfaceCounter.releaseAll();
223 224
    recreateSurface();
224 225
    }
......
227 228

  
228 229
  int getNewCounter()
229 230
    {
230
    int value = mIntBuffer.get(BUFFERING*mSurfaceID+mLastIndex);
231
    int value = mIntBuffer.get(BUFFERING*mSurfaceID+(mLastIndex==0 ? BUFFERING-1:mLastIndex-1));
231 232

  
232 233
    if( value!=mLastValue )
233 234
      {
......
235 236
      android.util.Log.d("surface", "surface id: "+mSurfaceID+" value now: "+mLastValue);
236 237
      }
237 238

  
238
    mLastIndex++;
239
    if( mLastIndex>=BUFFERING ) mLastIndex-=BUFFERING;
240

  
241
    mIntBuffer.put(BUFFERING*mSurfaceID+mLastIndex,0);
242 239
    return BUFFERING*mSurfaceID + mLastIndex;
243 240
    }
244 241

  
......
526 523
      GLES31.glClearStencil(mClearStencil);
527 524
      GLES31.glClear(mClear);
528 525
      DistortedRenderState.colorDepthStencilRestore();
526

  
527
      mLastIndex++;
528
      if( mLastIndex>=BUFFERING ) mLastIndex=0;
529
      mIntBuffer.put(BUFFERING*mSurfaceID+mLastIndex,0);
529 530
      }
530 531
    }
531 532

  

Also available in: Unified diff