mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784925 - Add MakeCurrent for OGL Layers Readback path - r=bjacob
This commit is contained in:
parent
c1be063403
commit
ea5436543d
@ -1054,6 +1054,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void fGetIntegerv(GLenum pname, GLint *params) {
|
||||
switch (pname)
|
||||
{
|
||||
// LOCAL_GL_FRAMEBUFFER_BINDING is equal to
|
||||
// LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT, so we don't need two
|
||||
// cases.
|
||||
case LOCAL_GL_FRAMEBUFFER_BINDING:
|
||||
*params = GetUserBoundDrawFBO();
|
||||
break;
|
||||
|
||||
case LOCAL_GL_READ_FRAMEBUFFER_BINDING_EXT:
|
||||
*params = GetUserBoundReadFBO();
|
||||
break;
|
||||
|
||||
default:
|
||||
raw_fGetIntegerv(pname, params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// See comment near BindInternalDrawFBO()
|
||||
bool mInInternalBindingMode_DrawFBO;
|
||||
@ -1062,6 +1082,8 @@ public:
|
||||
|
||||
GLuint GetUserBoundDrawFBO() {
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(IsCurrent());
|
||||
|
||||
GLint ret = 0;
|
||||
// Don't need a branch here, because:
|
||||
// LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT == LOCAL_GL_FRAMEBUFFER_BINDING == 0x8CA6
|
||||
@ -1093,6 +1115,8 @@ public:
|
||||
|
||||
GLuint GetUserBoundReadFBO() {
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(IsCurrent());
|
||||
|
||||
GLint ret = 0;
|
||||
// We use raw_ here because this is debug code and we need to see what
|
||||
// the driver thinks.
|
||||
@ -2399,26 +2423,6 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
void fGetIntegerv(GLenum pname, GLint *params) {
|
||||
switch (pname)
|
||||
{
|
||||
// LOCAL_GL_FRAMEBUFFER_BINDING is equal to
|
||||
// LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT, so we don't need two
|
||||
// cases.
|
||||
case LOCAL_GL_FRAMEBUFFER_BINDING:
|
||||
*params = GetUserBoundDrawFBO();
|
||||
break;
|
||||
|
||||
case LOCAL_GL_READ_FRAMEBUFFER_BINDING_EXT:
|
||||
*params = GetUserBoundReadFBO();
|
||||
break;
|
||||
|
||||
default:
|
||||
raw_fGetIntegerv(pname, params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GetUIntegerv(GLenum pname, GLuint *params) {
|
||||
fGetIntegerv(pname, reinterpret_cast<GLint*>(params));
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ CanvasLayerOGL::UpdateSurface()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mCanvasGLContext) {
|
||||
mCanvasGLContext->MakeCurrent();
|
||||
}
|
||||
|
||||
if (mCanvasGLContext &&
|
||||
!mForceReadback &&
|
||||
mCanvasGLContext->GetContextType() == gl()->GetContextType())
|
||||
@ -193,7 +197,6 @@ CanvasLayerOGL::UpdateSurface()
|
||||
DiscardTempSurface();
|
||||
|
||||
// Can texture share, just make sure it's resolved first
|
||||
mCanvasGLContext->MakeCurrent();
|
||||
mCanvasGLContext->GuaranteeResolve();
|
||||
|
||||
if (gl()->BindOffscreenNeedsTexture(mCanvasGLContext) &&
|
||||
@ -202,30 +205,33 @@ CanvasLayerOGL::UpdateSurface()
|
||||
mOGLManager->MakeCurrent();
|
||||
MakeTextureIfNeeded(gl(), mTexture);
|
||||
}
|
||||
} else {
|
||||
nsRefPtr<gfxASurface> updatedAreaSurface;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCanvasSurface) {
|
||||
updatedAreaSurface = mCanvasSurface;
|
||||
} else if (mCanvasGLContext) {
|
||||
gfxIntSize size(mBounds.width, mBounds.height);
|
||||
nsRefPtr<gfxImageSurface> updatedAreaImageSurface =
|
||||
nsRefPtr<gfxASurface> updatedAreaSurface;
|
||||
if (mCanvasGLContext) {
|
||||
gfxIntSize size(mBounds.width, mBounds.height);
|
||||
nsRefPtr<gfxImageSurface> updatedAreaImageSurface =
|
||||
GetTempSurface(size, gfxASurface::ImageFormatARGB32);
|
||||
|
||||
updatedAreaImageSurface->Flush();
|
||||
mCanvasGLContext->ReadScreenIntoImageSurface(updatedAreaImageSurface);
|
||||
updatedAreaImageSurface->MarkDirty();
|
||||
updatedAreaImageSurface->Flush();
|
||||
mCanvasGLContext->ReadScreenIntoImageSurface(updatedAreaImageSurface);
|
||||
updatedAreaImageSurface->MarkDirty();
|
||||
|
||||
updatedAreaSurface = updatedAreaImageSurface;
|
||||
}
|
||||
|
||||
mOGLManager->MakeCurrent();
|
||||
mLayerProgram = gl()->UploadSurfaceToTexture(updatedAreaSurface,
|
||||
mBounds,
|
||||
mTexture,
|
||||
false,
|
||||
nsIntPoint(0, 0));
|
||||
updatedAreaSurface = updatedAreaImageSurface;
|
||||
} else if (mCanvasSurface) {
|
||||
updatedAreaSurface = mCanvasSurface;
|
||||
} else {
|
||||
MOZ_NOT_REACHED("Unhandled canvas layer type.");
|
||||
return;
|
||||
}
|
||||
|
||||
mOGLManager->MakeCurrent();
|
||||
mLayerProgram = gl()->UploadSurfaceToTexture(updatedAreaSurface,
|
||||
mBounds,
|
||||
mTexture,
|
||||
false,
|
||||
nsIntPoint(0, 0));
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user