зеркало из https://github.com/mozilla/gecko-dev.git
Bug 733562 - Offscreen FBO must not be created for Global Shared context. r=bjacob
This commit is contained in:
Родитель
69fc2ae50b
Коммит
ed773f9c8b
|
@ -571,6 +571,11 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
enum ContextFlags {
|
||||
ContextFlagsNone = 0x0,
|
||||
ContextFlagsGlobal = 0x1
|
||||
};
|
||||
|
||||
enum GLContextType {
|
||||
ContextTypeUnknown,
|
||||
ContextTypeWGL,
|
||||
|
|
|
@ -590,7 +590,8 @@ CreateOffscreenFBOContext(const ContextFormat& aFormat,
|
|||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderCGL::CreateOffscreen(const gfxIntSize& aSize,
|
||||
const ContextFormat& aFormat)
|
||||
const ContextFormat& aFormat,
|
||||
const ContextFlags flags)
|
||||
{
|
||||
ContextFormat actualFormat(aFormat);
|
||||
|
||||
|
|
|
@ -1897,7 +1897,8 @@ GLContextEGL::CreateEGLPixmapOffscreenContext(const gfxIntSize& aSize,
|
|||
// often without the ability to texture from them directly.
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderEGL::CreateOffscreen(const gfxIntSize& aSize,
|
||||
const ContextFormat& aFormat)
|
||||
const ContextFormat& aFormat,
|
||||
const ContextFlags aFlags)
|
||||
{
|
||||
if (!sEGLLibrary.EnsureInitialized()) {
|
||||
return nsnull;
|
||||
|
@ -1917,7 +1918,7 @@ GLContextProviderEGL::CreateOffscreen(const gfxIntSize& aSize,
|
|||
return nsnull;
|
||||
|
||||
gfxIntSize fboSize = usePBuffers ? glContext->OffscreenActualSize() : aSize;
|
||||
if (!glContext->ResizeOffscreenFBO(fboSize, !usePBuffers))
|
||||
if (!(aFlags & GLContext::ContextFlagsGlobal) && !glContext->ResizeOffscreenFBO(fboSize, !usePBuffers))
|
||||
return nsnull;
|
||||
|
||||
return glContext.forget();
|
||||
|
@ -1928,7 +1929,7 @@ GLContextProviderEGL::CreateOffscreen(const gfxIntSize& aSize,
|
|||
if (!glContext)
|
||||
return nsnull;
|
||||
|
||||
if (!glContext->ResizeOffscreenFBO(glContext->OffscreenActualSize(), true))
|
||||
if (!(aFlags & GLContext::ContextFlagsGlobal) && !glContext->ResizeOffscreenFBO(glContext->OffscreenActualSize(), true))
|
||||
return nsnull;
|
||||
|
||||
return glContext.forget();
|
||||
|
@ -1940,7 +1941,7 @@ GLContextProviderEGL::CreateOffscreen(const gfxIntSize& aSize,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
if (!gUseBackingSurface && !glContext->ResizeOffscreenFBO(glContext->OffscreenActualSize(), true)) {
|
||||
if (!(aFlags & GLContext::ContextFlagsGlobal) && !gUseBackingSurface && !glContext->ResizeOffscreenFBO(glContext->OffscreenActualSize(), true)) {
|
||||
// we weren't able to create the initial
|
||||
// offscreen FBO, so this is dead
|
||||
return nsnull;
|
||||
|
@ -1999,7 +2000,8 @@ GLContextProviderEGL::GetGlobalContext()
|
|||
// CreateOffscreen can call us re-entrantly.
|
||||
nsRefPtr<GLContext> ctx =
|
||||
GLContextProviderEGL::CreateOffscreen(gfxIntSize(16, 16),
|
||||
ContextFormat(ContextFormat::BasicRGB24));
|
||||
ContextFormat(ContextFormat::BasicRGB24),
|
||||
GLContext::ContextFlagsGlobal);
|
||||
gGlobalContext = ctx;
|
||||
if (gGlobalContext)
|
||||
gGlobalContext->SetIsGlobalSharedContext(true);
|
||||
|
|
|
@ -1292,7 +1292,8 @@ DONE_CREATING_PIXMAP:
|
|||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderGLX::CreateOffscreen(const gfxIntSize& aSize,
|
||||
const ContextFormat& aFormat)
|
||||
const ContextFormat& aFormat,
|
||||
const ContextFlags)
|
||||
{
|
||||
nsRefPtr<GLContextGLX> glContext =
|
||||
CreateOffscreenPixmapContext(aSize, aFormat, true);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
class THEBES_API GL_CONTEXT_PROVIDER_NAME
|
||||
{
|
||||
public:
|
||||
typedef GLContext::ContextFlags ContextFlags;
|
||||
/**
|
||||
* Create a context that renders to the surface of the widget that is
|
||||
* passed in. The context is always created with an RGB pixel format,
|
||||
|
@ -90,7 +91,8 @@ public:
|
|||
*/
|
||||
static already_AddRefed<GLContext>
|
||||
CreateOffscreen(const gfxIntSize& aSize,
|
||||
const ContextFormat& aFormat = ContextFormat::BasicRGBA32Format);
|
||||
const ContextFormat& aFormat = ContextFormat::BasicRGBA32Format,
|
||||
const ContextFlags aFlags = GLContext::ContextFlagsNone);
|
||||
|
||||
/**
|
||||
* Try to create a GL context from native surface for arbitrary gfxASurface
|
||||
|
|
|
@ -46,7 +46,8 @@ GLContextProviderNull::CreateForWindow(nsIWidget*)
|
|||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderNull::CreateOffscreen(const gfxIntSize&,
|
||||
const ContextFormat&)
|
||||
const ContextFormat&,
|
||||
const ContextFlags)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -259,7 +259,8 @@ GLContextProviderOSMesa::CreateForWindow(nsIWidget *aWidget)
|
|||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderOSMesa::CreateOffscreen(const gfxIntSize& aSize,
|
||||
const ContextFormat& aFormat)
|
||||
const ContextFormat& aFormat,
|
||||
const ContextFlags)
|
||||
{
|
||||
if (!sOSMesaLibrary.EnsureInitialized()) {
|
||||
return nsnull;
|
||||
|
|
|
@ -751,7 +751,8 @@ CreateWindowOffscreenContext(const ContextFormat& aFormat)
|
|||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateOffscreen(const gfxIntSize& aSize,
|
||||
const ContextFormat& aFormat)
|
||||
const ContextFormat& aFormat,
|
||||
const ContextFlags)
|
||||
{
|
||||
if (!sWGLLibrary.EnsureInitialized()) {
|
||||
return nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче