Program: 52759
Project: 52759
Buggy source:
@Override public void onDrawFrame(GL10 gl){
  if (surfaceProgram == 0 || program == 0) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    return;
  }
  final long now=System.nanoTime();
  GLES20.glUseProgram(program);
  GLES20.glVertexAttribPointer(positionLoc,2,GLES20.GL_BYTE,false,0,vertexBuffer);
  if (timeLoc > -1)   GLES20.glUniform1f(timeLoc,(now - startTime) / NS_PER_SECOND);
  if (resolutionLoc > -1)   GLES20.glUniform2fv(resolutionLoc,1,resolution,0);
  if (touchLoc > -1)   GLES20.glUniform2fv(touchLoc,1,touch,0);
  if (mouseLoc > -1)   GLES20.glUniform2fv(mouseLoc,1,mouse,0);
  if (pointerCountLoc > -1)   GLES20.glUniform1i(pointerCountLoc,pointerCount);
  if (pointersLoc > -1)   GLES20.glUniform3fv(pointersLoc,pointerCount,pointers,0);
  if (gravityLoc > -1 && accelerometerListener != null)   GLES20.glUniform3fv(gravityLoc,1,accelerometerListener.gravity,0);
  if (linearLoc > -1 && accelerometerListener != null)   GLES20.glUniform3fv(linearLoc,1,accelerometerListener.linear,0);
  if (rotationLoc > -1 && gyroscopeListener != null)   GLES20.glUniform3fv(rotationLoc,1,gyroscopeListener.rotation,0);
  if (magneticLoc > -1 && magneticFieldListener != null)   GLES20.glUniform3fv(magneticLoc,1,magneticFieldListener.values,0);
  if (lightLoc > -1 && lightListener != null)   GLES20.glUniform1f(lightLoc,lightListener.ambient);
  if (pressureLoc > -1 && pressureListener != null)   GLES20.glUniform1f(pressureLoc,pressureListener.pressure);
  if (proximityLoc > -1 && proximityListener != null)   GLES20.glUniform1f(proximityLoc,proximityListener.centimeters);
  if (offsetLoc > -1)   GLES20.glUniform2fv(offsetLoc,1,offset,0);
  if (batteryLoc > -1) {
    if (now - lastBatteryUpdate > BATTERY_UPDATE_INTERVAL) {
      batteryLevel=getBatteryLevel();
      lastBatteryUpdate=now;
    }
    GLES20.glUniform1f(batteryLoc,batteryLevel);
  }
  if (dateTimeLoc > -1) {
    if (now - lastDateUpdate > DATE_UPDATE_INTERVAL) {
      calendar=Calendar.getInstance();
      dateTime[0]=calendar.get(Calendar.YEAR);
      dateTime[1]=calendar.get(Calendar.MONTH);
      dateTime[2]=calendar.get(Calendar.DAY_OF_MONTH);
      dateTime[3]=calendar.get(Calendar.HOUR_OF_DAY) * 3600f + calendar.get(Calendar.MINUTE) * 60f + calendar.get(Calendar.SECOND);
      lastDateUpdate=now;
    }
    GLES20.glUniform4fv(dateTimeLoc,1,dateTime,0);
  }
  if (startRandomLoc > -1)   GLES20.glUniform1f(startRandomLoc,startRandom);
  if (fb[0] == 0)   createTargets((int)resolution[0],(int)resolution[1]);
  GLES20.glViewport(0,0,(int)resolution[0],(int)resolution[1]);
  textureBinder.reset();
  if (backBufferLoc > -1)   textureBinder.bind(backBufferLoc,GLES20.GL_TEXTURE_2D,tx[backTarget]);
  for (int n=0; n < numberOfTextures; ++n)   textureBinder.bind(textureLocs[n],textureTargets[n],textureIds[n]);
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,fb[frontTarget]);
  GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP,0,4);
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,0);
  GLES20.glViewport(0,0,(int)surfaceResolution[0],(int)surfaceResolution[1]);
  GLES20.glUseProgram(surfaceProgram);
  GLES20.glVertexAttribPointer(surfacePositionLoc,2,GLES20.GL_BYTE,false,0,vertexBuffer);
  GLES20.glUniform2fv(surfaceResolutionLoc,1,surfaceResolution,0);
  GLES20.glUniform1i(surfaceFrameLoc,0);
  GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,tx[frontTarget]);
  GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
  GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP,0,4);
  int t=frontTarget;
  frontTarget=backTarget;
  backTarget=t;
  if (thumbnail == null)   thumbnail=saveThumbnail();
  if (onRendererListener != null)   updateFps(now);
}

Fixed version (ground truth):
@Override public void onDrawFrame(GL10 gl){
  if (surfaceProgram == 0 || program == 0) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    return;
  }
  final long now=System.nanoTime();
  GLES20.glUseProgram(program);
  GLES20.glVertexAttribPointer(positionLoc,2,GLES20.GL_BYTE,false,0,vertexBuffer);
  if (timeLoc > -1)   GLES20.glUniform1f(timeLoc,(now - startTime) / NS_PER_SECOND);
  if (resolutionLoc > -1)   GLES20.glUniform2fv(resolutionLoc,1,resolution,0);
  if (touchLoc > -1)   GLES20.glUniform2fv(touchLoc,1,touch,0);
  if (mouseLoc > -1)   GLES20.glUniform2fv(mouseLoc,1,mouse,0);
  if (pointerCountLoc > -1)   GLES20.glUniform1i(pointerCountLoc,pointerCount);
  if (pointersLoc > -1)   GLES20.glUniform3fv(pointersLoc,pointerCount,pointers,0);
  if (gravityLoc > -1 && accelerometerListener != null)   GLES20.glUniform3fv(gravityLoc,1,accelerometerListener.gravity,0);
  if (linearLoc > -1 && accelerometerListener != null)   GLES20.glUniform3fv(linearLoc,1,accelerometerListener.linear,0);
  if (rotationLoc > -1 && gyroscopeListener != null)   GLES20.glUniform3fv(rotationLoc,1,gyroscopeListener.rotation,0);
  if (magneticLoc > -1 && magneticFieldListener != null)   GLES20.glUniform3fv(magneticLoc,1,magneticFieldListener.values,0);
  if (lightLoc > -1 && lightListener != null)   GLES20.glUniform1f(lightLoc,lightListener.ambient);
  if (pressureLoc > -1 && pressureListener != null)   GLES20.glUniform1f(pressureLoc,pressureListener.pressure);
  if (proximityLoc > -1 && proximityListener != null)   GLES20.glUniform1f(proximityLoc,proximityListener.centimeters);
  if (offsetLoc > -1)   GLES20.glUniform2fv(offsetLoc,1,offset,0);
  if (batteryLoc > -1) {
    if (now - lastBatteryUpdate > BATTERY_UPDATE_INTERVAL) {
      batteryLevel=getBatteryLevel();
      lastBatteryUpdate=now;
    }
    GLES20.glUniform1f(batteryLoc,batteryLevel);
  }
  if (dateTimeLoc > -1) {
    if (now - lastDateUpdate > DATE_UPDATE_INTERVAL) {
      Calendar calendar=Calendar.getInstance();
      dateTime[0]=calendar.get(Calendar.YEAR);
      dateTime[1]=calendar.get(Calendar.MONTH);
      dateTime[2]=calendar.get(Calendar.DAY_OF_MONTH);
      dateTime[3]=calendar.get(Calendar.HOUR_OF_DAY) * 3600f + calendar.get(Calendar.MINUTE) * 60f + calendar.get(Calendar.SECOND);
      lastDateUpdate=now;
    }
    GLES20.glUniform4fv(dateTimeLoc,1,dateTime,0);
  }
  if (startRandomLoc > -1)   GLES20.glUniform1f(startRandomLoc,startRandom);
  if (fb[0] == 0)   createTargets((int)resolution[0],(int)resolution[1]);
  GLES20.glViewport(0,0,(int)resolution[0],(int)resolution[1]);
  textureBinder.reset();
  if (backBufferLoc > -1)   textureBinder.bind(backBufferLoc,GLES20.GL_TEXTURE_2D,tx[backTarget]);
  for (int n=0; n < numberOfTextures; ++n)   textureBinder.bind(textureLocs[n],textureTargets[n],textureIds[n]);
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,fb[frontTarget]);
  GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP,0,4);
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,0);
  GLES20.glViewport(0,0,(int)surfaceResolution[0],(int)surfaceResolution[1]);
  GLES20.glUseProgram(surfaceProgram);
  GLES20.glVertexAttribPointer(surfacePositionLoc,2,GLES20.GL_BYTE,false,0,vertexBuffer);
  GLES20.glUniform2fv(surfaceResolutionLoc,1,surfaceResolution,0);
  GLES20.glUniform1i(surfaceFrameLoc,0);
  GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,tx[frontTarget]);
  GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
  GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP,0,4);
  int t=frontTarget;
  frontTarget=backTarget;
  backTarget=t;
  if (thumbnail == null)   thumbnail=saveThumbnail();
  if (onRendererListener != null)   updateFps(now);
}