mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Backed out 7 changesets (bug 1390386) for Android crashes in testSettingsPages
Backed out changeset 22b11f9aedd3 (bug 1390386) Backed out changeset caffdbefd427 (bug 1390386) Backed out changeset 3364e6589731 (bug 1390386) Backed out changeset ed6857bdc17b (bug 1390386) Backed out changeset 1314405cf812 (bug 1390386) Backed out changeset 9d16670edeb5 (bug 1390386) Backed out changeset d1286d0d2c79 (bug 1390386) MozReview-Commit-ID: 3V3ZFwrNaGE
This commit is contained in:
parent
5241bea863
commit
525ef4d843
@ -1085,7 +1085,7 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
|
||||
//////
|
||||
// Initial setup.
|
||||
|
||||
gl->mImplicitMakeCurrent = true;
|
||||
MakeContextCurrent();
|
||||
|
||||
gl->fViewport(0, 0, mWidth, mHeight);
|
||||
mViewportX = mViewportY = 0;
|
||||
@ -1931,6 +1931,12 @@ WebGLContext::ForceRestoreContext()
|
||||
EnqueueUpdateContextLossStatus();
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::MakeContextCurrent() const
|
||||
{
|
||||
gl->MakeCurrent();
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::gfx::SourceSurface>
|
||||
WebGLContext::GetSurfaceSnapshot(gfxAlphaType* const out_alphaType)
|
||||
{
|
||||
|
@ -1715,7 +1715,7 @@ protected:
|
||||
void Invalidate();
|
||||
void DestroyResourcesAndContext();
|
||||
|
||||
void MakeContextCurrent() const { } // MakeCurrent is implicit now.
|
||||
void MakeContextCurrent() const;
|
||||
|
||||
// helpers
|
||||
|
||||
|
@ -60,7 +60,11 @@ namespace gl {
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
MOZ_THREAD_LOCAL(const GLContext*) GLContext::sCurrentContext;
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
unsigned GLContext::sCurrentGLContextTLS = -1;
|
||||
#endif
|
||||
|
||||
MOZ_THREAD_LOCAL(GLContext*) GLContext::sCurrentContext;
|
||||
|
||||
// If adding defines, don't forget to undefine symbols. See #undef block below.
|
||||
#define CORE_SYMBOL(x) { (PRFuncPtr*) &mSymbols.f##x, { #x, nullptr } }
|
||||
@ -263,8 +267,7 @@ ChooseDebugFlags(CreateContextFlags createFlags)
|
||||
|
||||
GLContext::GLContext(CreateContextFlags flags, const SurfaceCaps& caps,
|
||||
GLContext* sharedContext, bool isOffscreen, bool useTLSIsCurrent)
|
||||
: mImplicitMakeCurrent(false),
|
||||
mIsOffscreen(isOffscreen),
|
||||
: mIsOffscreen(isOffscreen),
|
||||
mContextLost(false),
|
||||
mUseTLSIsCurrent(ShouldUseTLSIsCurrent(useTLSIsCurrent)),
|
||||
mVersion(0),
|
||||
@ -3026,31 +3029,37 @@ GetBytesPerTexel(GLenum format, GLenum type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
GLContext::MakeCurrent(bool aForce) const
|
||||
bool GLContext::MakeCurrent(bool aForce)
|
||||
{
|
||||
if (MOZ_UNLIKELY( IsDestroyed() ))
|
||||
if (IsDestroyed())
|
||||
return false;
|
||||
|
||||
if (MOZ_LIKELY( !aForce )) {
|
||||
bool isCurrent;
|
||||
if (mUseTLSIsCurrent) {
|
||||
isCurrent = (sCurrentContext.get() == this);
|
||||
} else {
|
||||
isCurrent = IsCurrentImpl();
|
||||
}
|
||||
if (MOZ_LIKELY( isCurrent )) {
|
||||
MOZ_ASSERT(IsCurrentImpl());
|
||||
return true;
|
||||
}
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
PR_SetThreadPrivate(sCurrentGLContextTLS, this);
|
||||
|
||||
// XXX this assertion is disabled because it's triggering on Mac;
|
||||
// we need to figure out why and reenable it.
|
||||
#if 0
|
||||
// IsOwningThreadCurrent is a bit of a misnomer;
|
||||
// the "owning thread" is the creation thread,
|
||||
// and the only thread that can own this. We don't
|
||||
// support contexts used on multiple threads.
|
||||
NS_ASSERTION(IsOwningThreadCurrent(),
|
||||
"MakeCurrent() called on different thread than this context was created on!");
|
||||
#endif
|
||||
#endif
|
||||
if (mUseTLSIsCurrent && !aForce && sCurrentContext.get() == this) {
|
||||
MOZ_ASSERT(IsCurrent());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!MakeCurrentImpl())
|
||||
if (!MakeCurrentImpl(aForce))
|
||||
return false;
|
||||
|
||||
if (mUseTLSIsCurrent) {
|
||||
sCurrentContext.set(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3065,56 +3074,5 @@ GLContext::ResetSyncCallCount(const char* resetReason) const
|
||||
mSyncGLCallCount = 0;
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
void
|
||||
GLContext::BeforeGLCall_Debug(const char* const funcName) const
|
||||
{
|
||||
MOZ_ASSERT(mDebugFlags);
|
||||
|
||||
FlushErrors();
|
||||
|
||||
if (mDebugFlags & DebugFlagTrace) {
|
||||
printf_stderr("[gl:%p] > %s\n", this, funcName);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GLContext::AfterGLCall_Debug(const char* const funcName) const
|
||||
{
|
||||
MOZ_ASSERT(mDebugFlags);
|
||||
|
||||
// calling fFinish() immediately after every GL call makes sure that if this GL command crashes,
|
||||
// the stack trace will actually point to it. Otherwise, OpenGL being an asynchronous API, stack traces
|
||||
// tend to be meaningless
|
||||
mSymbols.fFinish();
|
||||
GLenum err = FlushErrors();
|
||||
|
||||
if (mDebugFlags & DebugFlagTrace) {
|
||||
printf_stderr("[gl:%p] < %s [%s (0x%04x)]\n", this, funcName,
|
||||
GLErrorToString(err), err);
|
||||
}
|
||||
|
||||
if (err != LOCAL_GL_NO_ERROR &&
|
||||
!mLocalErrorScopeStack.size())
|
||||
{
|
||||
printf_stderr("[gl:%p] %s: Generated unexpected %s error."
|
||||
" (0x%04x)\n", this, funcName,
|
||||
GLErrorToString(err), err);
|
||||
|
||||
if (mDebugFlags & DebugFlagAbortOnError) {
|
||||
MOZ_CRASH("Unexpected error with MOZ_GL_DEBUG_ABORT_ON_ERROR. (Run"
|
||||
" with MOZ_GL_DEBUG_ABORT_ON_ERROR=0 to disable)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
GLContext::OnImplicitMakeCurrentFailure(const char* const funcName)
|
||||
{
|
||||
gfxCriticalError() << "Ignoring call to " << funcName << " with failed"
|
||||
<< " mImplicitMakeCurrent.";
|
||||
}
|
||||
|
||||
} /* namespace gl */
|
||||
} /* namespace mozilla */
|
||||
|
@ -197,9 +197,7 @@ class GLContext
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(GLContext)
|
||||
static MOZ_THREAD_LOCAL(const GLContext*) sCurrentContext;
|
||||
|
||||
bool mImplicitMakeCurrent;
|
||||
static MOZ_THREAD_LOCAL(GLContext*) sCurrentContext;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// basic getters
|
||||
@ -299,17 +297,7 @@ public:
|
||||
|
||||
virtual GLContextType GetContextType() const = 0;
|
||||
|
||||
virtual bool IsCurrentImpl() const = 0;
|
||||
virtual bool MakeCurrentImpl() const = 0;
|
||||
|
||||
bool IsCurrent() const {
|
||||
if (mImplicitMakeCurrent)
|
||||
return MakeCurrent();
|
||||
|
||||
return IsCurrentImpl();
|
||||
}
|
||||
|
||||
bool MakeCurrent(bool aForce = false) const;
|
||||
virtual bool IsCurrent() = 0;
|
||||
|
||||
/**
|
||||
* Get the default framebuffer for this context.
|
||||
@ -320,7 +308,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool mIsOffscreen;
|
||||
mutable bool mContextLost;
|
||||
bool mContextLost;
|
||||
const bool mUseTLSIsCurrent;
|
||||
|
||||
/**
|
||||
@ -553,13 +541,13 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
mutable GLenum mTopError;
|
||||
GLenum mTopError;
|
||||
|
||||
GLenum RawGetError() const {
|
||||
GLenum RawGetError() {
|
||||
return mSymbols.fGetError();
|
||||
}
|
||||
|
||||
GLenum RawGetErrorAndClear() const {
|
||||
GLenum RawGetErrorAndClear() {
|
||||
GLenum err = RawGetError();
|
||||
|
||||
if (err)
|
||||
@ -568,17 +556,26 @@ private:
|
||||
return err;
|
||||
}
|
||||
|
||||
GLenum FlushErrors() const {
|
||||
public:
|
||||
GLenum FlushErrors() {
|
||||
GLenum err = RawGetErrorAndClear();
|
||||
if (!mTopError)
|
||||
mTopError = err;
|
||||
return err;
|
||||
}
|
||||
|
||||
// We smash all errors together, so you never have to loop on this. We
|
||||
// guarantee that immediately after this call, there are no errors left.
|
||||
GLenum fGetError() {
|
||||
FlushErrors();
|
||||
|
||||
GLenum err = mTopError;
|
||||
mTopError = LOCAL_GL_NO_ERROR;
|
||||
return err;
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Use this safer option.
|
||||
|
||||
public:
|
||||
class LocalErrorScope;
|
||||
|
||||
private:
|
||||
@ -656,6 +653,11 @@ private:
|
||||
// MOZ_GL_DEBUG implementation
|
||||
private:
|
||||
|
||||
#undef BEFORE_GL_CALL
|
||||
#undef AFTER_GL_CALL
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
|
||||
#ifndef MOZ_FUNCTION_NAME
|
||||
# ifdef __GNUC__
|
||||
# define MOZ_FUNCTION_NAME __PRETTY_FUNCTION__
|
||||
@ -666,45 +668,51 @@ private:
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Record the name of the GL call for better hang stacks on Android.
|
||||
#define ANDROID_ONLY_PROFILER_LABEL AUTO_PROFILER_LABEL(__func__, GRAPHICS);
|
||||
#else
|
||||
#define ANDROID_ONLY_PROFILER_LABEL
|
||||
#endif
|
||||
void BeforeGLCall(const char* funcName) {
|
||||
MOZ_ASSERT(IsCurrent());
|
||||
|
||||
#define BEFORE_GL_CALL \
|
||||
ANDROID_ONLY_PROFILER_LABEL \
|
||||
if (MOZ_LIKELY( BeforeGLCall(MOZ_FUNCTION_NAME) )) { \
|
||||
do { } while (0)
|
||||
if (mDebugFlags) {
|
||||
FlushErrors();
|
||||
|
||||
#define AFTER_GL_CALL \
|
||||
AfterGLCall(MOZ_FUNCTION_NAME); \
|
||||
} \
|
||||
do { } while (0)
|
||||
if (mDebugFlags & DebugFlagTrace) {
|
||||
printf_stderr("[gl:%p] > %s\n", this, funcName);
|
||||
}
|
||||
|
||||
void BeforeGLCall_Debug(const char* funcName) const;
|
||||
void AfterGLCall_Debug(const char* funcName) const;
|
||||
static void OnImplicitMakeCurrentFailure(const char* funcName);
|
||||
|
||||
bool BeforeGLCall(const char* const funcName) const {
|
||||
if (mImplicitMakeCurrent) {
|
||||
if (MOZ_UNLIKELY( !MakeCurrent() )) {
|
||||
OnImplicitMakeCurrentFailure(funcName);
|
||||
return false;
|
||||
GLContext* tlsContext = (GLContext*)PR_GetThreadPrivate(sCurrentGLContextTLS);
|
||||
if (this != tlsContext) {
|
||||
printf_stderr("Fatal: %s called on non-current context %p. The"
|
||||
" current context for this thread is %p.\n",
|
||||
funcName, this, tlsContext);
|
||||
MOZ_CRASH("GFX: GLContext is not current.");
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(IsCurrentImpl());
|
||||
|
||||
if (mDebugFlags) {
|
||||
BeforeGLCall_Debug(funcName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AfterGLCall(const char* const funcName) const {
|
||||
void AfterGLCall(const char* funcName) {
|
||||
if (mDebugFlags) {
|
||||
AfterGLCall_Debug(funcName);
|
||||
// calling fFinish() immediately after every GL call makes sure that if this GL command crashes,
|
||||
// the stack trace will actually point to it. Otherwise, OpenGL being an asynchronous API, stack traces
|
||||
// tend to be meaningless
|
||||
mSymbols.fFinish();
|
||||
GLenum err = FlushErrors();
|
||||
|
||||
if (mDebugFlags & DebugFlagTrace) {
|
||||
printf_stderr("[gl:%p] < %s [%s (0x%04x)]\n", this, funcName,
|
||||
GLErrorToString(err), err);
|
||||
}
|
||||
|
||||
if (err != LOCAL_GL_NO_ERROR &&
|
||||
!mLocalErrorScopeStack.size())
|
||||
{
|
||||
printf_stderr("[gl:%p] %s: Generated unexpected %s error."
|
||||
" (0x%04x)\n", this, funcName,
|
||||
GLErrorToString(err), err);
|
||||
|
||||
if (mDebugFlags & DebugFlagAbortOnError) {
|
||||
MOZ_CRASH("Unexpected error with MOZ_GL_DEBUG_ABORT_ON_ERROR. (Run"
|
||||
" with MOZ_GL_DEBUG_ABORT_ON_ERROR=0 to disable)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,7 +726,22 @@ private:
|
||||
|
||||
static void AssertNotPassingStackBufferToTheGL(const void* ptr);
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Record the name of the GL call for better hang stacks on Android.
|
||||
#define BEFORE_GL_CALL \
|
||||
AUTO_PROFILER_LABEL(__func__, GRAPHICS);\
|
||||
BeforeGLCall(MOZ_FUNCTION_NAME)
|
||||
#else
|
||||
#define BEFORE_GL_CALL \
|
||||
do { \
|
||||
BeforeGLCall(MOZ_FUNCTION_NAME); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define AFTER_GL_CALL \
|
||||
do { \
|
||||
AfterGLCall(MOZ_FUNCTION_NAME); \
|
||||
} while (0)
|
||||
|
||||
#define TRACKING_CONTEXT(a) \
|
||||
do { \
|
||||
@ -727,6 +750,20 @@ private:
|
||||
|
||||
#define ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL(ptr) AssertNotPassingStackBufferToTheGL(ptr)
|
||||
|
||||
#else // ifdef MOZ_GL_DEBUG
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Record the name of the GL call for better hang stacks on Android.
|
||||
#define BEFORE_GL_CALL AUTO_PROFILER_LABEL(__func__, GRAPHICS)
|
||||
#else
|
||||
#define BEFORE_GL_CALL do { } while (0)
|
||||
#endif
|
||||
#define AFTER_GL_CALL do { } while (0)
|
||||
#define TRACKING_CONTEXT(a) do {} while (0)
|
||||
#define ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL(ptr) do {} while (0)
|
||||
|
||||
#endif // ifdef MOZ_GL_DEBUG
|
||||
|
||||
#define ASSERT_SYMBOL_PRESENT(func) \
|
||||
do {\
|
||||
MOZ_ASSERT(strstr(MOZ_FUNCTION_NAME, #func) != nullptr, "Mismatched symbol check.");\
|
||||
@ -736,15 +773,6 @@ private:
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
#else // ifdef MOZ_GL_DEBUG
|
||||
|
||||
#define TRACKING_CONTEXT(a) do {} while (0)
|
||||
#define ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL(ptr) do {} while (0)
|
||||
#define ASSERT_SYMBOL_PRESENT(func) do {} while (0)
|
||||
|
||||
#endif // ifdef MOZ_GL_DEBUG
|
||||
|
||||
|
||||
// Do whatever setup is necessary to draw to our offscreen FBO, if it's
|
||||
// bound.
|
||||
void BeforeGLDrawCall() { }
|
||||
@ -775,19 +803,6 @@ public:
|
||||
// -----------------------------------------------------------------------------
|
||||
// GL official entry points
|
||||
public:
|
||||
// We smash all errors together, so you never have to loop on this. We
|
||||
// guarantee that immediately after this call, there are no errors left.
|
||||
GLenum fGetError() {
|
||||
GLenum err = LOCAL_GL_CONTEXT_LOST;
|
||||
BEFORE_GL_CALL;
|
||||
|
||||
FlushErrors();
|
||||
err = mTopError;
|
||||
mTopError = LOCAL_GL_NO_ERROR;
|
||||
|
||||
AFTER_GL_CALL;
|
||||
return err;
|
||||
}
|
||||
|
||||
void fActiveTexture(GLenum texture) {
|
||||
BEFORE_GL_CALL;
|
||||
@ -1168,9 +1183,8 @@ public:
|
||||
}
|
||||
|
||||
GLint fGetAttribLocation(GLuint program, const GLchar* name) {
|
||||
GLint retval = 0;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fGetAttribLocation(program, name);
|
||||
GLint retval = mSymbols.fGetAttribLocation(program, name);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
@ -1222,10 +1236,9 @@ public:
|
||||
}
|
||||
|
||||
GLuint fGetDebugMessageLog(GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog) {
|
||||
GLuint ret = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fGetDebugMessageLog);
|
||||
ret = mSymbols.fGetDebugMessageLog(count, bufsize, sources, types, ids, severities, lengths, messageLog);
|
||||
GLuint ret = mSymbols.fGetDebugMessageLog(count, bufsize, sources, types, ids, severities, lengths, messageLog);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -1294,9 +1307,8 @@ public:
|
||||
}
|
||||
|
||||
const GLubyte* fGetString(GLenum name) {
|
||||
const GLubyte* result = nullptr;
|
||||
BEFORE_GL_CALL;
|
||||
result = mSymbols.fGetString(name);
|
||||
const GLubyte* result = mSymbols.fGetString(name);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return result;
|
||||
@ -1356,9 +1368,8 @@ public:
|
||||
}
|
||||
|
||||
GLint fGetUniformLocation (GLint programObj, const GLchar* name) {
|
||||
GLint retval = 0;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fGetUniformLocation(programObj, name);
|
||||
GLint retval = mSymbols.fGetUniformLocation(programObj, name);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
@ -1392,42 +1403,37 @@ public:
|
||||
}
|
||||
|
||||
realGLboolean fIsBuffer(GLuint buffer) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsBuffer(buffer);
|
||||
realGLboolean retval = mSymbols.fIsBuffer(buffer);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
}
|
||||
|
||||
realGLboolean fIsEnabled(GLenum capability) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsEnabled(capability);
|
||||
realGLboolean retval = mSymbols.fIsEnabled(capability);
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
}
|
||||
|
||||
realGLboolean fIsProgram(GLuint program) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsProgram(program);
|
||||
realGLboolean retval = mSymbols.fIsProgram(program);
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
}
|
||||
|
||||
realGLboolean fIsShader(GLuint shader) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsShader(shader);
|
||||
realGLboolean retval = mSymbols.fIsShader(shader);
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
}
|
||||
|
||||
realGLboolean fIsTexture(GLuint texture) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsTexture(texture);
|
||||
realGLboolean retval = mSymbols.fIsTexture(texture);
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
}
|
||||
@ -1867,23 +1873,6 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||
if (mViewportRect[0] == x &&
|
||||
mViewportRect[1] == y &&
|
||||
mViewportRect[2] == width &&
|
||||
mViewportRect[3] == height)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mViewportRect[0] = x;
|
||||
mViewportRect[1] = y;
|
||||
mViewportRect[2] = width;
|
||||
mViewportRect[3] = height;
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fViewport(x, y, width, height);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fCompileShader(GLuint shader) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fCompileShader(shader);
|
||||
@ -1974,9 +1963,8 @@ public:
|
||||
}
|
||||
|
||||
GLenum fCheckFramebufferStatus(GLenum target) {
|
||||
GLenum retval = 0;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fCheckFramebufferStatus(target);
|
||||
GLenum retval = mSymbols.fCheckFramebufferStatus(target);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
@ -2019,9 +2007,8 @@ public:
|
||||
}
|
||||
|
||||
realGLboolean fIsFramebuffer (GLuint framebuffer) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsFramebuffer(framebuffer);
|
||||
realGLboolean retval = mSymbols.fIsFramebuffer(framebuffer);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
@ -2029,9 +2016,8 @@ public:
|
||||
|
||||
public:
|
||||
realGLboolean fIsRenderbuffer (GLuint renderbuffer) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
retval = mSymbols.fIsRenderbuffer(renderbuffer);
|
||||
realGLboolean retval = mSymbols.fIsRenderbuffer(renderbuffer);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
@ -2098,20 +2084,18 @@ public:
|
||||
}
|
||||
|
||||
void* fMapBuffer(GLenum target, GLenum access) {
|
||||
void* ret = nullptr;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fMapBuffer);
|
||||
ret = mSymbols.fMapBuffer(target, access);
|
||||
void* ret = mSymbols.fMapBuffer(target, access);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
realGLboolean fUnmapBuffer(GLenum target) {
|
||||
realGLboolean ret = false;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fUnmapBuffer);
|
||||
ret = mSymbols.fUnmapBuffer(target);
|
||||
realGLboolean ret = mSymbols.fUnmapBuffer(target);
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
}
|
||||
@ -2119,17 +2103,15 @@ public:
|
||||
|
||||
private:
|
||||
GLuint raw_fCreateProgram() {
|
||||
GLuint ret = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ret = mSymbols.fCreateProgram();
|
||||
GLuint ret = mSymbols.fCreateProgram();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
GLuint raw_fCreateShader(GLenum t) {
|
||||
GLuint ret = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ret = mSymbols.fCreateShader(t);
|
||||
GLuint ret = mSymbols.fCreateShader(t);
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
}
|
||||
@ -2262,10 +2244,9 @@ public:
|
||||
}
|
||||
|
||||
GLenum fGetGraphicsResetStatus() {
|
||||
GLenum ret = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fGetGraphicsResetStatus);
|
||||
ret = mSymbols.fGetGraphicsResetStatus();
|
||||
GLenum ret = mSymbols.fGetGraphicsResetStatus();
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -2276,20 +2257,18 @@ public:
|
||||
// Extension ARB_sync (GL)
|
||||
public:
|
||||
GLsync fFenceSync(GLenum condition, GLbitfield flags) {
|
||||
GLsync ret = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fFenceSync);
|
||||
ret = mSymbols.fFenceSync(condition, flags);
|
||||
GLsync ret = mSymbols.fFenceSync(condition, flags);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
realGLboolean fIsSync(GLsync sync) {
|
||||
realGLboolean ret = false;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fIsSync);
|
||||
ret = mSymbols.fIsSync(sync);
|
||||
realGLboolean ret = mSymbols.fIsSync(sync);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -2303,10 +2282,9 @@ public:
|
||||
}
|
||||
|
||||
GLenum fClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
|
||||
GLenum ret = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fClientWaitSync);
|
||||
ret = mSymbols.fClientWaitSync(sync, flags, timeout);
|
||||
GLenum ret = mSymbols.fClientWaitSync(sync, flags, timeout);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -2584,10 +2562,9 @@ public:
|
||||
|
||||
GLint fGetFragDataLocation(GLuint program, const GLchar* name)
|
||||
{
|
||||
GLint result = 0;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fGetFragDataLocation);
|
||||
result = mSymbols.fGetFragDataLocation(program, name);
|
||||
GLint result = mSymbols.fGetFragDataLocation(program, name);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return result;
|
||||
@ -2682,10 +2659,9 @@ public:
|
||||
}
|
||||
|
||||
realGLboolean fIsQuery(GLuint query) {
|
||||
realGLboolean retval = false;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fIsQuery);
|
||||
retval = mSymbols.fIsQuery(query);
|
||||
realGLboolean retval = mSymbols.fIsQuery(query);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return retval;
|
||||
@ -2775,10 +2751,9 @@ public:
|
||||
|
||||
realGLboolean fIsTransformFeedback(GLuint id)
|
||||
{
|
||||
realGLboolean result = false;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fIsTransformFeedback);
|
||||
result = mSymbols.fIsTransformFeedback(id);
|
||||
realGLboolean result = mSymbols.fIsTransformFeedback(id);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return result;
|
||||
@ -2887,10 +2862,9 @@ public:
|
||||
|
||||
realGLboolean fIsVertexArray(GLuint array)
|
||||
{
|
||||
realGLboolean ret = false;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fIsVertexArray);
|
||||
ret = mSymbols.fIsVertexArray(array);
|
||||
realGLboolean ret = mSymbols.fIsVertexArray(array);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -2925,10 +2899,9 @@ public:
|
||||
|
||||
realGLboolean fTestFence(GLuint fence)
|
||||
{
|
||||
realGLboolean ret = false;
|
||||
ASSERT_SYMBOL_PRESENT(fTestFence);
|
||||
BEFORE_GL_CALL;
|
||||
ret = mSymbols.fTestFence(fence);
|
||||
realGLboolean ret = mSymbols.fTestFence(fence);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -2945,10 +2918,9 @@ public:
|
||||
|
||||
realGLboolean fIsFence(GLuint fence)
|
||||
{
|
||||
realGLboolean ret = false;
|
||||
ASSERT_SYMBOL_PRESENT(fIsFence);
|
||||
BEFORE_GL_CALL;
|
||||
ret = mSymbols.fIsFence(fence);
|
||||
realGLboolean ret = mSymbols.fIsFence(fence);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -2993,10 +2965,9 @@ public:
|
||||
void* fMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
|
||||
GLbitfield access)
|
||||
{
|
||||
void* data = nullptr;
|
||||
ASSERT_SYMBOL_PRESENT(fMapBufferRange);
|
||||
BEFORE_GL_CALL;
|
||||
data = mSymbols.fMapBufferRange(target, offset, length, access);
|
||||
void* data = mSymbols.fMapBufferRange(target, offset, length, access);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return data;
|
||||
@ -3031,10 +3002,9 @@ public:
|
||||
|
||||
realGLboolean fIsSampler(GLuint sampler)
|
||||
{
|
||||
realGLboolean result = false;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fIsSampler);
|
||||
result = mSymbols.fIsSampler(sampler);
|
||||
realGLboolean result = mSymbols.fIsSampler(sampler);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return result;
|
||||
@ -3121,10 +3091,9 @@ public:
|
||||
}
|
||||
|
||||
GLuint fGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) {
|
||||
GLuint result = 0;
|
||||
ASSERT_SYMBOL_PRESENT(fGetUniformBlockIndex);
|
||||
BEFORE_GL_CALL;
|
||||
result = mSymbols.fGetUniformBlockIndex(program, uniformBlockName);
|
||||
GLuint result = mSymbols.fGetUniformBlockIndex(program, uniformBlockName);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return result;
|
||||
@ -3251,10 +3220,9 @@ public:
|
||||
// GL3+, ES3+
|
||||
|
||||
const GLubyte* fGetStringi(GLenum name, GLuint index) {
|
||||
const GLubyte* ret = nullptr;
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fGetStringi);
|
||||
ret = mSymbols.fGetStringi(name, index);
|
||||
const GLubyte* ret = mSymbols.fGetStringi(name, index);
|
||||
OnSyncCall();
|
||||
AFTER_GL_CALL;
|
||||
return ret;
|
||||
@ -3280,12 +3248,6 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
#undef BEFORE_GL_CALL
|
||||
#undef AFTER_GL_CALL
|
||||
#undef ASSERT_SYMBOL_PRESENT
|
||||
// #undef TRACKING_CONTEXT // Needed in GLContext.cpp
|
||||
#undef ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constructor
|
||||
protected:
|
||||
@ -3308,14 +3270,24 @@ public:
|
||||
protected:
|
||||
typedef gfx::SurfaceFormat SurfaceFormat;
|
||||
|
||||
virtual bool MakeCurrentImpl(bool aForce) = 0;
|
||||
|
||||
public:
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
static void StaticInit() {
|
||||
PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool MakeCurrent(bool aForce = false);
|
||||
|
||||
virtual bool Init() = 0;
|
||||
|
||||
virtual bool SetupLookupFunction() = 0;
|
||||
|
||||
virtual void ReleaseSurface() {}
|
||||
|
||||
bool IsDestroyed() const {
|
||||
bool IsDestroyed() {
|
||||
// MarkDestroyed will mark all these as null.
|
||||
return mSymbols.fUseProgram == nullptr;
|
||||
}
|
||||
@ -3450,6 +3422,15 @@ protected:
|
||||
|
||||
GLContextSymbols mSymbols;
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
// Non-zero debug flags will check that we don't send call
|
||||
// to a GLContext that isn't current on the current
|
||||
// thread.
|
||||
// Store the current context when binding to thread local
|
||||
// storage to support debug flags on an arbitrary thread.
|
||||
static unsigned sCurrentGLContextTLS;
|
||||
#endif
|
||||
|
||||
UniquePtr<GLBlitHelper> mBlitHelper;
|
||||
UniquePtr<GLReadTexImageHelper> mReadTexImageHelper;
|
||||
|
||||
@ -3612,6 +3593,25 @@ public:
|
||||
return mMaxSamples;
|
||||
}
|
||||
|
||||
void fViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||
if (mViewportRect[0] == x &&
|
||||
mViewportRect[1] == y &&
|
||||
mViewportRect[2] == width &&
|
||||
mViewportRect[3] == height)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mViewportRect[0] = x;
|
||||
mViewportRect[1] = y;
|
||||
mViewportRect[2] = width;
|
||||
mViewportRect[3] = height;
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fViewport(x, y, width, height);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
#undef ASSERT_SYMBOL_PRESENT
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
void CreatedProgram(GLContext* aOrigin, GLuint aName);
|
||||
void CreatedShader(GLContext* aOrigin, GLuint aName);
|
||||
|
@ -45,9 +45,9 @@ public:
|
||||
NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
|
||||
CGLContextObj GetCGLContext() const;
|
||||
|
||||
virtual bool MakeCurrentImpl() const override;
|
||||
virtual bool MakeCurrentImpl(bool aForce) override;
|
||||
|
||||
virtual bool IsCurrentImpl() const override;
|
||||
virtual bool IsCurrent() override;
|
||||
|
||||
virtual GLenum GetPreferredARGB32Format() const override;
|
||||
|
||||
|
@ -43,9 +43,9 @@ public:
|
||||
|
||||
EAGLContext* GetEAGLContext() const { return mContext; }
|
||||
|
||||
virtual bool MakeCurrentImpl() const override;
|
||||
virtual bool MakeCurrentImpl(bool aForce) override;
|
||||
|
||||
virtual bool IsCurrentImpl() const override;
|
||||
virtual bool IsCurrent() override;
|
||||
|
||||
virtual bool SetupLookupFunction() override;
|
||||
|
||||
|
@ -73,9 +73,9 @@ public:
|
||||
return mSurfaceOverride;
|
||||
}
|
||||
|
||||
virtual bool MakeCurrentImpl() const override;
|
||||
virtual bool MakeCurrentImpl(bool aForce) override;
|
||||
|
||||
virtual bool IsCurrentImpl() const override;
|
||||
virtual bool IsCurrent() override;
|
||||
|
||||
virtual bool RenewSurface(widget::CompositorWidget* aWidget) override;
|
||||
|
||||
|
@ -46,9 +46,9 @@ public:
|
||||
|
||||
bool Init() override;
|
||||
|
||||
virtual bool MakeCurrentImpl() const override;
|
||||
virtual bool MakeCurrentImpl(bool aForce) override;
|
||||
|
||||
virtual bool IsCurrentImpl() const override;
|
||||
virtual bool IsCurrent() override;
|
||||
|
||||
virtual bool SetupLookupFunction() override;
|
||||
|
||||
|
@ -110,11 +110,15 @@ GLContextCGL::GetCGLContext() const
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextCGL::MakeCurrentImpl() const
|
||||
GLContextCGL::MakeCurrentImpl(bool aForce)
|
||||
{
|
||||
if (!aForce && [NSOpenGLContext currentContext] == mContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mContext) {
|
||||
[mContext makeCurrentContext];
|
||||
MOZ_ASSERT(IsCurrentImpl());
|
||||
MOZ_ASSERT(IsCurrent());
|
||||
// Use non-blocking swap in "ASAP mode".
|
||||
// ASAP mode means that rendering is iterated as fast as possible.
|
||||
// ASAP mode is entered when layout.frame_rate=0 (requires restart).
|
||||
@ -128,8 +132,7 @@ GLContextCGL::MakeCurrentImpl() const
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextCGL::IsCurrentImpl() const
|
||||
{
|
||||
GLContextCGL::IsCurrent() {
|
||||
return [NSOpenGLContext currentContext] == mContext;
|
||||
}
|
||||
|
||||
|
@ -113,8 +113,12 @@ GLContextEAGL::RecreateRB()
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextEAGL::MakeCurrentImpl() const
|
||||
GLContextEAGL::MakeCurrentImpl(bool aForce)
|
||||
{
|
||||
if (!aForce && [EAGLContext currentContext] == mContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mContext) {
|
||||
if(![EAGLContext setCurrentContext:mContext]) {
|
||||
return false;
|
||||
@ -124,8 +128,7 @@ GLContextEAGL::MakeCurrentImpl() const
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextEAGL::IsCurrentImpl() const
|
||||
{
|
||||
GLContextEAGL::IsCurrent() {
|
||||
return [EAGLContext currentContext] == mContext;
|
||||
}
|
||||
|
||||
|
@ -339,27 +339,34 @@ GLContextEGL::SetEGLSurfaceOverride(EGLSurface surf) {
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextEGL::MakeCurrentImpl() const
|
||||
{
|
||||
const EGLSurface surface = (mSurfaceOverride != EGL_NO_SURFACE) ? mSurfaceOverride
|
||||
: mSurface;
|
||||
if (surface == EGL_NO_SURFACE) {
|
||||
MOZ_CRASH("EGL_NO_SURFACE");
|
||||
return false;
|
||||
}
|
||||
GLContextEGL::MakeCurrentImpl(bool aForce) {
|
||||
bool succeeded = true;
|
||||
|
||||
const bool succeeded = sEGLLibrary.fMakeCurrent(EGL_DISPLAY(), surface, surface,
|
||||
mContext);
|
||||
if (!succeeded) {
|
||||
const auto eglError = sEGLLibrary.fGetError();
|
||||
if (eglError == LOCAL_EGL_CONTEXT_LOST) {
|
||||
mContextLost = true;
|
||||
NS_WARNING("EGL context has been lost.");
|
||||
} else {
|
||||
NS_WARNING("Failed to make GL context current!");
|
||||
// Assume that EGL has the same problem as WGL does,
|
||||
// where MakeCurrent with an already-current context is
|
||||
// still expensive.
|
||||
bool needsMakeCurrent = (aForce || sEGLLibrary.fGetCurrentContext() != mContext);
|
||||
if (needsMakeCurrent) {
|
||||
EGLSurface surface = mSurfaceOverride != EGL_NO_SURFACE
|
||||
? mSurfaceOverride
|
||||
: mSurface;
|
||||
if (surface == EGL_NO_SURFACE) {
|
||||
return false;
|
||||
}
|
||||
succeeded = sEGLLibrary.fMakeCurrent(EGL_DISPLAY(),
|
||||
surface, surface,
|
||||
mContext);
|
||||
if (!succeeded) {
|
||||
int eglError = sEGLLibrary.fGetError();
|
||||
if (eglError == LOCAL_EGL_CONTEXT_LOST) {
|
||||
mContextLost = true;
|
||||
NS_WARNING("EGL context has been lost.");
|
||||
} else {
|
||||
NS_WARNING("Failed to make GL context current!");
|
||||
#ifdef DEBUG
|
||||
printf_stderr("EGL Error: 0x%04x\n", eglError);
|
||||
printf_stderr("EGL Error: 0x%04x\n", eglError);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,8 +374,7 @@ GLContextEGL::MakeCurrentImpl() const
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextEGL::IsCurrentImpl() const
|
||||
{
|
||||
GLContextEGL::IsCurrent() {
|
||||
return sEGLLibrary.fGetCurrentContext() == mContext;
|
||||
}
|
||||
|
||||
|
@ -606,30 +606,40 @@ GLContextGLX::Init()
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextGLX::MakeCurrentImpl() const
|
||||
GLContextGLX::MakeCurrentImpl(bool aForce)
|
||||
{
|
||||
if (mGLX->IsMesa()) {
|
||||
// Read into the event queue to ensure that Mesa receives a
|
||||
// DRI2InvalidateBuffers event before drawing. See bug 1280653.
|
||||
Unused << XPending(mDisplay);
|
||||
bool succeeded = true;
|
||||
|
||||
// With the ATI FGLRX driver, glxMakeCurrent is very slow even when the context doesn't change.
|
||||
// (This is not the case with other drivers such as NVIDIA).
|
||||
// So avoid calling it more than necessary. Since GLX documentation says that:
|
||||
// "glXGetCurrentContext returns client-side information.
|
||||
// It does not make a round trip to the server."
|
||||
// I assume that it's not worth using our own TLS slot here.
|
||||
if (aForce || mGLX->fGetCurrentContext() != mContext) {
|
||||
if (mGLX->IsMesa()) {
|
||||
// Read into the event queue to ensure that Mesa receives a
|
||||
// DRI2InvalidateBuffers event before drawing. See bug 1280653.
|
||||
Unused << XPending(mDisplay);
|
||||
}
|
||||
|
||||
succeeded = mGLX->fMakeCurrent(mDisplay, mDrawable, mContext);
|
||||
NS_ASSERTION(succeeded, "Failed to make GL context current!");
|
||||
|
||||
if (!IsOffscreen() && mGLX->SupportsSwapControl()) {
|
||||
// Many GLX implementations default to blocking until the next
|
||||
// VBlank when calling glXSwapBuffers. We want to run unthrottled
|
||||
// in ASAP mode. See bug 1280744.
|
||||
const bool isASAP = (gfxPrefs::LayoutFrameRate() == 0);
|
||||
mGLX->fSwapInterval(mDisplay, mDrawable, isASAP ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
const bool succeeded = mGLX->fMakeCurrent(mDisplay, mDrawable, mContext);
|
||||
NS_ASSERTION(succeeded, "Failed to make GL context current!");
|
||||
|
||||
if (!IsOffscreen() && mGLX->SupportsSwapControl()) {
|
||||
// Many GLX implementations default to blocking until the next
|
||||
// VBlank when calling glXSwapBuffers. We want to run unthrottled
|
||||
// in ASAP mode. See bug 1280744.
|
||||
const bool isASAP = (gfxPrefs::LayoutFrameRate() == 0);
|
||||
mGLX->fSwapInterval(mDisplay, mDrawable, isASAP ? 0 : 1);
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextGLX::IsCurrentImpl() const
|
||||
{
|
||||
GLContextGLX::IsCurrent() {
|
||||
return mGLX->fGetCurrentContext() == mContext;
|
||||
}
|
||||
|
||||
|
@ -323,15 +323,24 @@ GLContextWGL::Init()
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextWGL::MakeCurrentImpl() const
|
||||
GLContextWGL::MakeCurrentImpl(bool aForce)
|
||||
{
|
||||
const bool succeeded = sWGLLib.mSymbols.fMakeCurrent(mDC, mContext);
|
||||
NS_ASSERTION(succeeded, "Failed to make GL context current!");
|
||||
BOOL succeeded = true;
|
||||
|
||||
// wglGetCurrentContext seems to just pull the HGLRC out
|
||||
// of its TLS slot, so no need to do our own tls slot.
|
||||
// You would think that wglMakeCurrent would avoid doing
|
||||
// work if mContext was already current, but not so much..
|
||||
if (aForce || sWGLLib.mSymbols.fGetCurrentContext() != mContext) {
|
||||
succeeded = sWGLLib.mSymbols.fMakeCurrent(mDC, mContext);
|
||||
NS_ASSERTION(succeeded, "Failed to make GL context current!");
|
||||
}
|
||||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextWGL::IsCurrentImpl() const
|
||||
GLContextWGL::IsCurrent()
|
||||
{
|
||||
return sWGLLib.mSymbols.fGetCurrentContext() == mContext;
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ public:
|
||||
|
||||
bool Init() override;
|
||||
|
||||
virtual bool MakeCurrentImpl() const override;
|
||||
virtual bool MakeCurrentImpl(bool aForce) override;
|
||||
|
||||
virtual bool IsCurrentImpl() const override;
|
||||
virtual bool IsCurrent() override;
|
||||
|
||||
void SetIsDoubleBuffered(bool aIsDB);
|
||||
|
||||
|
@ -748,6 +748,10 @@ gfxPlatform::Init()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
GLContext::StaticInit();
|
||||
#endif
|
||||
|
||||
InitLayersIPC();
|
||||
|
||||
gPlatform->PopulateScreenInfo();
|
||||
|
@ -156,8 +156,9 @@ ThreadLocal<T>::get() const
|
||||
return mValue;
|
||||
#else
|
||||
MOZ_ASSERT(initialized());
|
||||
void* h = pthread_getspecific(mKey);
|
||||
return static_cast<T>((typename Helper<T>::Type)h);
|
||||
void* h;
|
||||
h = pthread_getspecific(mKey);
|
||||
return static_cast<T>(reinterpret_cast<typename Helper<T>::Type>(h));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -169,9 +170,9 @@ ThreadLocal<T>::set(const T aValue)
|
||||
mValue = aValue;
|
||||
#else
|
||||
MOZ_ASSERT(initialized());
|
||||
void* h = (void*)(static_cast<typename Helper<T>::Type>(aValue));
|
||||
void* h = reinterpret_cast<void*>(static_cast<typename Helper<T>::Type>(aValue));
|
||||
bool succeeded = !pthread_setspecific(mKey, h);
|
||||
if (MOZ_UNLIKELY( !succeeded )) {
|
||||
if (!succeeded) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user