Bug 942507 - GLContext doesn't need to have userdata. r=bjacob

This commit is contained in:
Dan Glastonbury 2013-12-06 10:23:16 -05:00
Родитель 53fedfbd2c
Коммит 1a74976806
4 изменённых файлов: 6 добавлений и 24 удалений

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

@ -2415,16 +2415,6 @@ public:
virtual void ReleaseSurface() {} virtual void ReleaseSurface() {}
void *GetUserData(void *aKey) {
void *result = nullptr;
mUserData.Get(aKey, &result);
return result;
}
void SetUserData(void *aKey, void *aValue) {
mUserData.Put(aKey, aValue);
}
// Mark this context as destroyed. This will nullptr out all // Mark this context as destroyed. This will nullptr out all
// the GL function pointers! // the GL function pointers!
void MarkDestroyed(); void MarkDestroyed();
@ -2910,8 +2900,6 @@ public:
bool IsOffscreenSizeAllowed(const gfxIntSize& aSize) const; bool IsOffscreenSizeAllowed(const gfxIntSize& aSize) const;
protected: protected:
nsDataHashtable<nsPtrHashKey<void>, void*> mUserData;
GLuint mReadTextureImagePrograms[4]; GLuint mReadTextureImagePrograms[4];
bool InitWithPrefix(const char *prefix, bool trygl); bool InitWithPrefix(const char *prefix, bool trygl);

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

@ -233,10 +233,6 @@ FPSState::DrawFPS(TimeStamp aNow,
DrawQuads(aContext, mVBOs, aProgram, rects); DrawQuads(aContext, mVBOs, aProgram, rects);
} }
#ifdef CHECK_CURRENT_PROGRAM
int ShaderProgramOGL::sCurrentProgramKey = 0;
#endif
CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth, CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth,
int aSurfaceHeight, bool aUseExternalSurfaceSize) int aSurfaceHeight, bool aUseExternalSurfaceSize)
: mWidget(aWidget) : mWidget(aWidget)

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

@ -449,9 +449,7 @@ ShaderProgramOGL::Activate()
} }
NS_ASSERTION(HasInitialized(), "Attempting to activate a program that's not in use!"); NS_ASSERTION(HasInitialized(), "Attempting to activate a program that's not in use!");
mGL->fUseProgram(mProgram); mGL->fUseProgram(mProgram);
#if CHECK_CURRENT_PROGRAM
mGL->SetUserData(&sCurrentProgramKey, this);
#endif
// check and set the projection matrix // check and set the projection matrix
if (mIsProjectionMatrixStale) { if (mIsProjectionMatrixStale) {
SetProjectionMatrix(mProjectionMatrix); SetProjectionMatrix(mProjectionMatrix);

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

@ -199,11 +199,14 @@ private:
#define CHECK_CURRENT_PROGRAM 1 #define CHECK_CURRENT_PROGRAM 1
#define ASSERT_THIS_PROGRAM \ #define ASSERT_THIS_PROGRAM \
do { \ do { \
NS_ASSERTION(mGL->GetUserData(&sCurrentProgramKey) == this, \ GLuint currentProgram; \
mGL->GetUIntegerv(LOCAL_GL_CURRENT_PROGRAM, &currentProgram); \
NS_ASSERTION(currentProgram == mProgram, \
"SetUniform with wrong program active!"); \ "SetUniform with wrong program active!"); \
} while (0) } while (0)
#else #else
#define ASSERT_THIS_PROGRAM #define ASSERT_THIS_PROGRAM \
do { } while (0)
#endif #endif
/** /**
@ -385,9 +388,6 @@ protected:
} mProgramState; } mProgramState;
GLint mTexCoordMultiplierUniformLocation; GLint mTexCoordMultiplierUniformLocation;
#ifdef CHECK_CURRENT_PROGRAM
static int sCurrentProgramKey;
#endif
void SetUniform(GLint aLocation, float aFloatValue); void SetUniform(GLint aLocation, float aFloatValue);
void SetUniform(GLint aLocation, const gfxRGBA& aColor); void SetUniform(GLint aLocation, const gfxRGBA& aColor);