| 200 | |
| 201 | |
| 202 | void FakePbuffer::swap(void) |
| 203 | { |
| 204 | bool changed = false; |
| 205 | |
| 206 | if(_eglGetCurrentContext()) _glFlush(); |
| 207 | |
| 208 | CriticalSection::SafeLock l(RBOCONTEXT.getMutex()); |
| 209 | |
| 210 | // 0 = front left, 1 = back left, 2 = front right, 3 = back right |
| 211 | if(rboc[0] && rboc[1]) |
| 212 | { |
| 213 | GLuint tmp = rboc[0]; |
| 214 | rboc[0] = rboc[1]; |
| 215 | rboc[1] = tmp; |
| 216 | changed = true; |
| 217 | } |
| 218 | if(rboc[2] && rboc[3]) |
| 219 | { |
| 220 | GLuint tmp = rboc[2]; |
| 221 | rboc[2] = rboc[3]; |
| 222 | rboc[3] = tmp; |
| 223 | changed = true; |
| 224 | } |
| 225 | if(changed && _eglGetCurrentContext()) |
| 226 | { |
| 227 | GLint drawFBO = -1, readFBO = -1; |
| 228 | _glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFBO); |
| 229 | _glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFBO); |
| 230 | GLuint oldFBO = fbo; |
| 231 | |
| 232 | if(getCurrentDrawable() == id || getCurrentReadDrawable() == id) |
| 233 | createBuffer(false, false, drawFBO == (GLint)oldFBO, |
| 234 | readFBO == (GLint)oldFBO); |
| 235 | |
| 236 | if(getCurrentDrawable() == id && drawFBO == (GLint)oldFBO) |
| 237 | { |
| 238 | BufferState bs(BS_DRAWBUFS); |
| 239 | _glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); |
| 240 | } |
| 241 | if(getCurrentReadDrawable() == id && readFBO == (GLint)oldFBO) |
| 242 | { |
| 243 | BufferState bs(BS_READBUF); |
| 244 | _glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo); |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | |
| 250 | void FakePbuffer::setDrawBuffer(GLenum drawBuf, bool deferred) |
no test coverage detected