b=1009960, teach ScopedBindFramebuffer about spilt read/draw framebuffers; r=bjacob

This commit is contained in:
Vladimir Vukicevic 2014-05-13 17:14:53 -07:00
Родитель 1148a891c7
Коммит 7b45e7e0d5
2 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -52,7 +52,12 @@ ScopedGLState::UnwrapImpl()
void
ScopedBindFramebuffer::Init()
{
mOldFB = mGL->GetFB();
if (mGL->IsSupported(GLFeature::framebuffer_blit)) {
mOldReadFB = mGL->GetReadFB();
mOldDrawFB = mGL->GetDrawFB();
} else {
mOldReadFB = mOldDrawFB = mGL->GetFB();
}
}
ScopedBindFramebuffer::ScopedBindFramebuffer(GLContext* aGL)
@ -74,7 +79,12 @@ ScopedBindFramebuffer::UnwrapImpl()
// Check that we're not falling out of scope after the current context changed.
MOZ_ASSERT(mGL->IsCurrent());
mGL->BindFB(mOldFB);
if (mOldReadFB == mOldDrawFB) {
mGL->BindFB(mOldDrawFB);
} else {
mGL->BindDrawFB(mOldDrawFB);
mGL->BindReadFB(mOldReadFB);
}
}

Просмотреть файл

@ -74,7 +74,8 @@ struct ScopedBindFramebuffer
friend struct ScopedGLWrapper<ScopedBindFramebuffer>;
protected:
GLuint mOldFB;
GLuint mOldReadFB;
GLuint mOldDrawFB;
private:
void Init();