Project

General

Profile

« Previous | Next » 

Revision 27cd6b98

Added by Leszek Koltunski over 6 years ago

SSBO: more and more works...

View differences:

src/main/java/org/distorted/library/main/DistortedEffects.java
274 274
    {
275 275
    float halfZ = halfW*mesh.zFactor;
276 276

  
277
    android.util.Log.d("surface", "SurfaceID "+ surface.getID()+" transparent fragments: "+ surface.returnOldCounter() );
278

  
277 279
    mM.compute(currTime);
278 280
    mV.compute(currTime,halfW,halfH,halfZ);
279 281
    mF.compute(currTime,halfW,halfH);
......
285 287
    GLES31.glUniform1i(mMainTextureH, 0);
286 288
    GLES31.glUniform1i(mCountIndexH, surface.resetNewCounter() );
287 289

  
288
    android.util.Log.d("surface", "SurfaceID "+ surface.getID()+" transparent fragments: "+ surface.returnCounter() );
289

  
290 290
    if( Distorted.GLSL >= 300 )
291 291
      {
292 292
      GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, mesh.mAttVBO[0]);
src/main/java/org/distorted/library/main/DistortedObjectCounter.java
71 71
    mUsed.add(1);
72 72
    mFirstUnused++;
73 73

  
74
    return size+1;
74
    return size;
75 75
    }
76 76

  
77 77
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/main/DistortedOutputSurface.java
207 207
    recreateSurface();
208 208
    }
209 209

  
210
///////////////////////////////////////////////////////////////////////////////////////////////////
211

  
212
  void debugSSBO()
213
    {
214
    android.util.Log.d("SSBO", mIntBuffer.get(0)+" "+mIntBuffer.get(1)+" "
215
        +mIntBuffer.get(2)+" "+mIntBuffer.get(3) );
216
    }
217

  
210 218
///////////////////////////////////////////////////////////////////////////////////////////////////
211 219

  
212 220
  int resetNewCounter()
213 221
    {
214
    //mIntBuffer.put(BUFFERING*mSurfaceID+mLastIndex,0);
222
    mIntBuffer.put(BUFFERING*mSurfaceID+mLastIndex,0);
215 223
    return BUFFERING*mSurfaceID + mLastIndex;
216 224
    }
217 225

  
......
227 235
    return ret;
228 236
    }
229 237

  
230
///////////////////////////////////////////////////////////////////////////////////////////////////
231

  
232
  int returnCounter()
233
    {
234
    return mIntBuffer.get(0);
235
    }
236

  
237 238
///////////////////////////////////////////////////////////////////////////////////////////////////
238 239

  
239 240
  private void createProjection()
src/main/res/raw/main_fragment_shader.glsl
43 43
                                        // next describes the Region, i.e. area over which the effect is active.
44 44
#endif    // NUM_FRAGMENT>0
45 45

  
46
layout (std140,binding=0) buffer SSBO   // PER-SURFACE count of transparent fragments.
46
layout (std430,binding=0) buffer SSBO   // PER-SURFACE count of transparent fragments.
47 47
  {                                     // Can be buffered, i.e. if we are for example
48 48
  int ssbocount[];                      // triple-buffered, then surfaceID=N uses 3
49 49
  };                                    // consecutive counts (N,N+1,N+2) during 3
......
73 73
    }
74 74
#endif
75 75

  
76
  ssbocount[0]=17;
76
  ssbocount[u_currentIndex]= 27 + u_currentIndex;
77 77

  
78 78
  FRAG_COLOR = vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a);
79 79
  }

Also available in: Unified diff