Project

General

Profile

« Previous | Next » 

Revision 2dbed690

Added by Leszek Koltunski almost 6 years ago

In an attempt to contain the flashes on Mali GPU, re-structure the post-processing FBOs from 1 FBO with 2 color attachments + combined depth-stencil to 2 separate FBOs sharing a depth-stencil texture.

Result: this appears to make the flashes slightly worse.

View differences:

src/main/java/org/distorted/library/main/DistortedFramebuffer.java
39 39
    if( mColorCreated==NOT_CREATED_YET )
40 40
      {
41 41
      GLES31.glGenTextures( mNumColors, mColorH, 0);
42
      GLES31.glGenFramebuffers(1, mFBOH, 0);
43
      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
44 42

  
45 43
      for(int i=0; i<mNumColors; i++)
46 44
        {
......
51 49
        GLES31.glTexParameterf(GLES31.GL_TEXTURE_2D, GLES31.GL_TEXTURE_MAG_FILTER, GLES31.GL_LINEAR);
52 50
        GLES31.glTexImage2D(GLES31.GL_TEXTURE_2D, 0, GLES31.GL_RGBA, mRealWidth, mRealHeight, 0, GLES31.GL_RGBA, GLES31.GL_UNSIGNED_BYTE, null);
53 51
        }
54
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[0], 0);
55 52
      GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
53

  
54
      GLES31.glGenFramebuffers(1, mFBOH, 0);
55
      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
56
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[0], 0);
56 57
      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, 0);
57 58

  
58 59
      mColorCreated = checkStatus("color");
......
77 78
        }
78 79

  
79 80
      GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
81

  
80 82
      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
81 83

  
82 84
      if( mDepthStencil==DEPTH_NO_STENCIL )
......
105 107
      GLES31.glDeleteTextures(1, mDepthStencilH, 0);
106 108
      mDepthStencilH[0]=0;
107 109
      }
110
    if( mDepthStencilCreated==COPIED && mDepthStencilH[0]>0 )
111
      {
112
      mDepthStencilCreated = DONT_CREATE;
113
      mDepthStencilH[0]=0;
114
      }
108 115
    }
109 116

  
110 117
///////////////////////////////////////////////////////////////////////////////////////////////////
......
128 135
    return CREATED;
129 136
    }
130 137

  
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139
// the Framebuffer was created without DEPTH or STENCIL but now we want to copy it from some other.
140
// Framebuffer 'from' MUST be already created!!
141
// Must be called from a thread holding OpenGL Context
142
//
143
// 'Private' , library-only function used only for the postprocessing buffers!
144

  
145
  void copyDepthAndStencil(DistortedFramebuffer from)
146
    {
147
    mDepthStencilCreated = COPIED;
148
    mDepthStencilH[0] = from.mDepthStencilH[0];
149
    }
150

  
131 151
///////////////////////////////////////////////////////////////////////////////////////////////////
132 152
// Must be called from a thread holding OpenGL Context
133 153

  

Also available in: Unified diff