commit baa3989b28ba5b95e5ead92b273e351b6b42bc83
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Jun 24 01:07:07 2018 +0100

    Revert last changes to the postprocessing FBO.
    
    This reverts commit 2dbed690bdbee80d9bfb22c800073855eb5d0946.

diff --git a/src/main/java/org/distorted/library/effect/PostprocessEffect.java b/src/main/java/org/distorted/library/effect/PostprocessEffect.java
index 4695e0a..28ebd7c 100644
--- a/src/main/java/org/distorted/library/effect/PostprocessEffect.java
+++ b/src/main/java/org/distorted/library/effect/PostprocessEffect.java
@@ -139,7 +139,7 @@ public abstract class PostprocessEffect extends Effect implements DistortedMaste
  *
  * @y.exclude
  */
-  public abstract int apply(float[] uniforms, int index, DistortedOutputSurface[][] buffers);
+  public abstract int apply(float[] uniforms, int index, DistortedOutputSurface[] buffers);
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
diff --git a/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java b/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
index d8d25c7..08cec17 100644
--- a/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
+++ b/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
@@ -140,7 +140,7 @@ public class PostprocessEffectBlur extends PostprocessEffect
  *
  * @y.exclude
  */
-  public int apply(float[] uniforms, int index, DistortedOutputSurface[][] buffers)
+  public int apply(float[] uniforms, int index, DistortedOutputSurface[] buffers)
     {
     if( mProgram1 ==null)
       {
@@ -157,15 +157,16 @@ public class PostprocessEffectBlur extends PostprocessEffect
 
     DistortedRenderState.useStencilMark();
 
-    DistortedFramebuffer buffer0 = (DistortedFramebuffer)buffers[mQualityLevel][0];
-    DistortedFramebuffer buffer1 = (DistortedFramebuffer)buffers[mQualityLevel][1];
+    DistortedFramebuffer buffer = (DistortedFramebuffer)buffers[mQualityLevel];
 
-    float w= buffer0.getWidth();
-    float h= buffer0.getHeight();
-    float n= 1.0f - buffer0.getNear();
+    buffer.setAsOutput();
 
-    float corrW = buffer0.getWidthCorrection();
-    float corrH = buffer0.getHeightCorrection();
+    float w= buffer.getWidth();
+    float h= buffer.getHeight();
+    float n= 1.0f - buffer.getNear();
+
+    float corrW = buffer.getWidthCorrection();
+    float corrH = buffer.getHeightCorrection();
     float offsetCorrW = corrW/w;
     float offsetCorrH = corrH/h;
 
@@ -181,8 +182,8 @@ public class PostprocessEffectBlur extends PostprocessEffect
     for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrW;
 
     mProgram1.useProgram();
-    buffer1.setAsOutput();
-    buffer0.setAsInput();
+    buffer.bindForOutput(1);
+    buffer.setAsInput(0);
 
     GLES31.glColorMask(true,true,true,true);
     GLES31.glClearColor(1.0f,1.0f,1.0f,0.0f);
@@ -202,8 +203,8 @@ public class PostprocessEffectBlur extends PostprocessEffect
     for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrH;
 
     mProgram2.useProgram();
-    buffer0.setAsOutput();
-    buffer1.setAsInput();
+    buffer.bindForOutput(0);
+    buffer.setAsInput(1);
 
     GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
 
diff --git a/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java b/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
index bc16afb..e0cd858 100644
--- a/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
+++ b/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
@@ -144,7 +144,7 @@ public class PostprocessEffectGlow extends PostprocessEffect
  *
  * @y.exclude
  */
-  public int apply(float[] uniforms, int index, DistortedOutputSurface[][] buffers)
+  public int apply(float[] uniforms, int index, DistortedOutputSurface[] buffers)
     {
     if( mProgram1 ==null)
       {
@@ -161,13 +161,12 @@ public class PostprocessEffectGlow extends PostprocessEffect
 
     DistortedRenderState.useStencilMark();
 
-    DistortedFramebuffer  inBuffer  = (DistortedFramebuffer)buffers[0][0];
-    DistortedFramebuffer outBuffer0 = (DistortedFramebuffer)buffers[mQualityLevel][0];
-    DistortedFramebuffer outBuffer1 = (DistortedFramebuffer)buffers[mQualityLevel][1];
+    DistortedFramebuffer  inBuffer = (DistortedFramebuffer)buffers[0];
+    DistortedFramebuffer outBuffer = (DistortedFramebuffer)buffers[mQualityLevel];
 
-    float w= outBuffer0.getWidth();
-    float h= outBuffer0.getHeight();
-    float n= 1.0f - outBuffer0.getNear();
+    float w= outBuffer.getWidth();
+    float h= outBuffer.getHeight();
+    float n= 1.0f - outBuffer.getNear();
 
     float corrW = inBuffer.getWidthCorrection();
     float corrH = inBuffer.getHeightCorrection();
@@ -181,14 +180,15 @@ public class PostprocessEffectGlow extends PostprocessEffect
     int offset = radius + radius*radius/4;
     radius = (radius+1)/2;
 
+    outBuffer.setAsOutput();
     GLES31.glViewport(0, 0, (int)w, (int)h);
 
     // horizontal glow
     for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrW;
 
     mProgram1.useProgram();
-    outBuffer1.setAsOutput();
-    inBuffer.setAsInput();
+    outBuffer.bindForOutput(1);
+    inBuffer.setAsInput(0);
 
     GLES31.glColorMask(true,true,true,true);
     GLES31.glClearColor(1.0f,1.0f,1.0f,0.0f);
@@ -209,8 +209,8 @@ public class PostprocessEffectGlow extends PostprocessEffect
     for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]*offsetCorrH;
 
     mProgram2.useProgram();
-    outBuffer0.setAsOutput();
-    outBuffer1.setAsInput();
+    outBuffer.bindForOutput(0);
+    outBuffer.setAsInput(1);
 
     GLES31.glUniform1f ( mProgram2.mUniform[0] , n );
     GLES31.glUniform2f ( mProgram2.mUniform[1] , corrW, corrH );
@@ -229,7 +229,7 @@ public class PostprocessEffectGlow extends PostprocessEffect
     if( mQualityLevel>0 )
       {
       inBuffer.setAsOutput();
-      outBuffer0.setAsInput();
+      outBuffer.setAsInput(0);
       GLES31.glEnable(GLES31.GL_BLEND);
       DistortedEffects.blitPriv(inBuffer);
       GLES31.glDisable(GLES31.GL_BLEND);
diff --git a/src/main/java/org/distorted/library/main/DistortedFramebuffer.java b/src/main/java/org/distorted/library/main/DistortedFramebuffer.java
index ccea145..c7614f1 100644
--- a/src/main/java/org/distorted/library/main/DistortedFramebuffer.java
+++ b/src/main/java/org/distorted/library/main/DistortedFramebuffer.java
@@ -39,6 +39,8 @@ public class DistortedFramebuffer extends DistortedOutputSurface implements Dist
     if( mColorCreated==NOT_CREATED_YET )
       {
       GLES31.glGenTextures( mNumColors, mColorH, 0);
+      GLES31.glGenFramebuffers(1, mFBOH, 0);
+      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
 
       for(int i=0; i<mNumColors; i++)
         {
@@ -49,11 +51,8 @@ public class DistortedFramebuffer extends DistortedOutputSurface implements Dist
         GLES31.glTexParameterf(GLES31.GL_TEXTURE_2D, GLES31.GL_TEXTURE_MAG_FILTER, GLES31.GL_LINEAR);
         GLES31.glTexImage2D(GLES31.GL_TEXTURE_2D, 0, GLES31.GL_RGBA, mRealWidth, mRealHeight, 0, GLES31.GL_RGBA, GLES31.GL_UNSIGNED_BYTE, null);
         }
-      GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
-
-      GLES31.glGenFramebuffers(1, mFBOH, 0);
-      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
       GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[0], 0);
+      GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
       GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, 0);
 
       mColorCreated = checkStatus("color");
@@ -78,7 +77,6 @@ public class DistortedFramebuffer extends DistortedOutputSurface implements Dist
         }
 
       GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
-
       GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
 
       if( mDepthStencil==DEPTH_NO_STENCIL )
@@ -107,11 +105,6 @@ public class DistortedFramebuffer extends DistortedOutputSurface implements Dist
       GLES31.glDeleteTextures(1, mDepthStencilH, 0);
       mDepthStencilH[0]=0;
       }
-    if( mDepthStencilCreated==COPIED && mDepthStencilH[0]>0 )
-      {
-      mDepthStencilCreated = DONT_CREATE;
-      mDepthStencilH[0]=0;
-      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -135,19 +128,6 @@ public class DistortedFramebuffer extends DistortedOutputSurface implements Dist
     return CREATED;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// the Framebuffer was created without DEPTH or STENCIL but now we want to copy it from some other.
-// Framebuffer 'from' MUST be already created!!
-// Must be called from a thread holding OpenGL Context
-//
-// 'Private' , library-only function used only for the postprocessing buffers!
-
-  void copyDepthAndStencil(DistortedFramebuffer from)
-    {
-    mDepthStencilCreated = COPIED;
-    mDepthStencilH[0] = from.mDepthStencilH[0];
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // Must be called from a thread holding OpenGL Context
 
diff --git a/src/main/java/org/distorted/library/main/DistortedObject.java b/src/main/java/org/distorted/library/main/DistortedObject.java
index b569d4e..e147544 100644
--- a/src/main/java/org/distorted/library/main/DistortedObject.java
+++ b/src/main/java/org/distorted/library/main/DistortedObject.java
@@ -39,7 +39,6 @@ abstract class DistortedObject
   static final int NOT_CREATED_YET  = 2;
   static final int DONT_CREATE      = 3;
   static final int CREATED          = 4;
-  static final int COPIED           = 5;
 
   static final int TYPE_USER = 0;
   static final int TYPE_TREE = 1;
diff --git a/src/main/java/org/distorted/library/main/DistortedOutputSurface.java b/src/main/java/org/distorted/library/main/DistortedOutputSurface.java
index 4331071..7d451b6 100644
--- a/src/main/java/org/distorted/library/main/DistortedOutputSurface.java
+++ b/src/main/java/org/distorted/library/main/DistortedOutputSurface.java
@@ -69,9 +69,8 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
 
   private ArrayList<Job> mJobs = new ArrayList<>();
 
-  // Global buffers used for postprocessing. MipmapLevels x PING_PONG of each for postprocessing ping-pong.
-  private static final int PING_PONG = 2;
-  private static DistortedOutputSurface[][] mBuffer = null;
+  // Global buffers used for postprocessing.
+  private static DistortedOutputSurface[] mBuffer = new DistortedOutputSurface[EffectQuality.LENGTH];
 
   private long mTime;
   private float mFOV;
@@ -172,37 +171,20 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
 
   private static void createPostprocessingBuffers(int width, int height, float near)
     {
-    mBuffer = new DistortedOutputSurface[EffectQuality.LENGTH][PING_PONG];
     float mipmap=1.0f;
 
-    for (int i=0; i<EffectQuality.LENGTH; i++)
+    for (int j=0; j<EffectQuality.LENGTH; j++)
       {
-      mBuffer[i][0] = new DistortedFramebuffer(1, BOTH_DEPTH_STENCIL, TYPE_SYST, (int) (width * mipmap), (int) (height * mipmap));
-      mBuffer[i][0].mMipmap = mipmap;
-      mBuffer[i][0].mNear = near;  // copy mNear as well (for blitting- see PostprocessEffect.apply() )
-      mBuffer[i][0].glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
-
-      for(int j=1; j<PING_PONG; j++)
-        {
-        mBuffer[i][j] = new DistortedFramebuffer(1, NO_DEPTH_NO_STENCIL, TYPE_SYST, (int) (width * mipmap), (int) (height * mipmap));
-        mBuffer[i][j].mMipmap = mipmap;
-        mBuffer[i][j].mNear = near;
-        mBuffer[i][j].glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
-        }
+      mBuffer[j] = new DistortedFramebuffer(2, BOTH_DEPTH_STENCIL, TYPE_SYST, (int) (width * mipmap), (int) (height * mipmap));
+      mBuffer[j].mMipmap = mipmap;
+      mBuffer[j].mNear = near;  // copy mNear as well (for blitting- see PostprocessEffect.apply() )
+      mBuffer[j].glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
 
       mipmap *= EffectQuality.MULTIPLIER;
       }
 
     DistortedObject.toDo(); // create the FBOs immediately. This is safe as we must be holding the OpenGL context now.
 
-    for (int i=0; i<EffectQuality.LENGTH; i++)
-      {
-      for(int j=1; j<PING_PONG; j++)
-        {
-        ( (DistortedFramebuffer)mBuffer[i][j]).copyDepthAndStencil( (DistortedFramebuffer)mBuffer[i][0] );
-        }
-      }
-
     GLES31.glStencilMask(0xff);
     GLES31.glDepthMask(true);
     GLES31.glColorMask(true, true, true, true);
@@ -210,16 +192,13 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
     GLES31.glClearDepthf(1.0f);
     GLES31.glClearStencil(0);
 
-    for (int i=0; i<EffectQuality.LENGTH; i++)
+    for (int j=0; j<EffectQuality.LENGTH; j++)
       {
-      mBuffer[i][0].setAsOutput();
+      mBuffer[j].setAsOutput();
+      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mBuffer[j].mColorH[1], 0);
       GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT | GLES31.GL_DEPTH_BUFFER_BIT | GLES31.GL_STENCIL_BUFFER_BIT);
-
-      for(int j=1; j<PING_PONG; j++)
-        {
-        mBuffer[i][j].setAsOutput();
-        GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
-        }
+      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mBuffer[j].mColorH[0], 0);
+      GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
       }
     }
 
@@ -227,17 +206,9 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
 
   static synchronized void onDestroy()
     {
-    if( mBuffer!=null )
+    for(int j=0; j<EffectQuality.LENGTH; j++)
       {
-      for (int i=0; i<EffectQuality.LENGTH; i++)
-        {
-        for (int j=1; j<PING_PONG; j++)
-          {
-          mBuffer[i][j] = null;
-          }
-        }
-
-      mBuffer = null;
+      mBuffer[j] = null;
       }
     }
 
@@ -249,36 +220,33 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
 
   private static void clonePostprocessingViewport(DistortedOutputSurface from)
     {
-    if( mBuffer[0][0].mWidth != from.mWidth || mBuffer[0][0].mHeight != from.mHeight )
+    if( mBuffer[0].mWidth != from.mWidth || mBuffer[0].mHeight != from.mHeight )
       {
       DistortedOutputSurface surface;
 
       for(int i=0; i<EffectQuality.LENGTH; i++)
         {
-        for(int j=0; j<PING_PONG; j++)
-          {
-          surface = mBuffer[i][j];
+        surface = mBuffer[i];
 
-          surface.mWidth  = (int) (from.mWidth  * surface.mMipmap);
-          surface.mHeight = (int) (from.mHeight * surface.mMipmap);
+        surface.mWidth  = (int)(from.mWidth *surface.mMipmap);
+        surface.mHeight = (int)(from.mHeight*surface.mMipmap);
 
-          surface.mNear = from.mNear;  // Near plane is independent of the mipmap level
+        surface.mNear   = from.mNear;  // Near plane is independent of the mipmap level
 
-          //android.util.Log.e("surface", "viewport "+i+" to ("+from.mWidth+"x"+from.mHeight+")");
+        //android.util.Log.e("surface", "viewport "+i+" to ("+from.mWidth+"x"+from.mHeight+")");
 
-          surface.createProjection();
+        surface.createProjection();
 
-          int maxw = surface.mWidth  > surface.mRealWidth  ? surface.mWidth  : surface.mRealWidth;
-          int maxh = surface.mHeight > surface.mRealHeight ? surface.mHeight : surface.mRealHeight;
+        int maxw = surface.mWidth  > surface.mRealWidth  ? surface.mWidth  : surface.mRealWidth;
+        int maxh = surface.mHeight > surface.mRealHeight ? surface.mHeight : surface.mRealHeight;
 
-          if (maxw > surface.mRealWidth || maxh > surface.mRealHeight)
-            {
-            surface.mRealWidth = maxw;
-            surface.mRealHeight = maxh;
+        if (maxw > surface.mRealWidth || maxh > surface.mRealHeight)
+          {
+          surface.mRealWidth = maxw;
+          surface.mRealHeight = maxh;
 
-            surface.recreate();
-            surface.create();
-            }
+          surface.recreate();
+          surface.create();
           }
         }
       }
@@ -320,7 +288,7 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// two phases: 1. collapse the SSBO 2. blend the SSBO's color
+// two phases: 1. collapse the SSBO 2. blend the ssbo's color
 
   private int oitRender(long currTime)
     {
@@ -350,7 +318,7 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private static void clearPostprocessingBuffer(int quality)
+  private static void clearBuffer(DistortedOutputSurface buffer)
     {
     GLES31.glStencilMask(0xff);
     GLES31.glDepthMask(true);
@@ -359,12 +327,13 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
     GLES31.glClearDepthf(1.0f);
     GLES31.glClearStencil(0);
 
-    mBuffer[quality][0].setAsOutput();
+    buffer.setAsOutput();
+    GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, buffer.mColorH[buffer.mNumColors-1], 0);
     GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT|GLES31.GL_DEPTH_BUFFER_BIT|GLES31.GL_STENCIL_BUFFER_BIT);
 
-    for(int j=1; j<PING_PONG; j++)
+    for(int i=buffer.mNumColors-2; i>=0; i--)
       {
-      mBuffer[quality][j].setAsOutput();
+      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, buffer.mColorH[i], 0);
       GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
       }
     }
@@ -406,7 +375,7 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
         }
       else
         {
-        if( mBuffer==null ) createPostprocessingBuffers(mWidth,mHeight,mNear);
+        if( mBuffer[0]==null ) createPostprocessingBuffers(mWidth,mHeight,mNear);
 
         if( lastBucket!=currBucket )
           {
@@ -420,13 +389,13 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
             for(int j=bucketChange; j<i; j++)
               {
               child2 = children.get(j);
-              numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality][0],lastQueue);
+              numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],lastQueue);
               }
 
             numRenders += lastQueue.postprocess(mBuffer);
-            numRenders += oitBuild(mBuffer[quality][0]);
+            numRenders += oitBuild(mBuffer[quality]);
             GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT|GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT);
-            clearPostprocessingBuffer(quality);
+            clearBuffer(mBuffer[quality]);
             }
 
           internalQuality = currQueue.getInternalQuality();
@@ -434,22 +403,22 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
           bucketChange    = i;
           }
 
-        mBuffer[quality][0].setAsOutput(time);
-        child1.drawNoBlend(time,mBuffer[quality][0]);
+        mBuffer[quality].setAsOutput(time);
+        child1.drawNoBlend(time,mBuffer[quality]);
 
         if( i==numChildren-1 )
           {
           for(int j=bucketChange; j<numChildren; j++)
             {
             child2 = children.get(j);
-            numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality][0],currQueue);
+            numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],currQueue);
             }
 
           numRenders += currQueue.postprocess(mBuffer);
-          numRenders += oitBuild(mBuffer[quality][0]);
+          numRenders += oitBuild(mBuffer[quality]);
           GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT|GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT);
           numRenders += oitRender(time);  // merge the OIT linked list
-          clearPostprocessingBuffer(quality);
+          clearBuffer(mBuffer[quality]);
           }
         } // end else (postprocessed child)
 
diff --git a/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java b/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
index 0dfb1a8..d3bb295 100644
--- a/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
+++ b/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
@@ -100,7 +100,7 @@ class EffectQueuePostprocess extends EffectQueue
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int postprocess(DistortedOutputSurface[][] buffers)
+  int postprocess(DistortedOutputSurface[] buffers)
     {
     int numRenders = 0;
 
