Explicitly track the current program binary instead of just caching it.

Trac #21270 Bug=351 Signed-off-by: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@1237 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 7f3bfe13
...@@ -141,6 +141,7 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo ...@@ -141,6 +141,7 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo
bindRenderbuffer(0); bindRenderbuffer(0);
mState.currentProgram = 0; mState.currentProgram = 0;
mCurrentProgramBinary = NULL;
mState.packAlignment = 4; mState.packAlignment = 4;
mState.unpackAlignment = 4; mState.unpackAlignment = 4;
...@@ -185,6 +186,7 @@ Context::~Context() ...@@ -185,6 +186,7 @@ Context::~Context()
} }
mState.currentProgram = 0; mState.currentProgram = 0;
} }
mCurrentProgramBinary = NULL;
while (!mFramebufferMap.empty()) while (!mFramebufferMap.empty())
{ {
...@@ -407,7 +409,6 @@ void Context::markAllStateDirty() ...@@ -407,7 +409,6 @@ void Context::markAllStateDirty()
mDitherStateDirty = true; mDitherStateDirty = true;
mFrontFaceDirty = true; mFrontFaceDirty = true;
mDxUniformsDirty = true; mDxUniformsDirty = true;
mCachedCurrentProgramBinary = NULL;
} }
void Context::markDxUniformsDirty() void Context::markDxUniformsDirty()
...@@ -1146,12 +1147,13 @@ void Context::useProgram(GLuint program) ...@@ -1146,12 +1147,13 @@ void Context::useProgram(GLuint program)
{ {
Program *newProgram = mResourceManager->getProgram(program); Program *newProgram = mResourceManager->getProgram(program);
Program *oldProgram = mResourceManager->getProgram(priorProgram); Program *oldProgram = mResourceManager->getProgram(priorProgram);
mCachedCurrentProgramBinary = NULL; mCurrentProgramBinary = NULL;
mDxUniformsDirty = true; mDxUniformsDirty = true;
if (newProgram) if (newProgram)
{ {
newProgram->addRef(); newProgram->addRef();
mCurrentProgramBinary = newProgram->getProgramBinary();
} }
if (oldProgram) if (oldProgram)
...@@ -1325,12 +1327,7 @@ Buffer *Context::getElementArrayBuffer() ...@@ -1325,12 +1327,7 @@ Buffer *Context::getElementArrayBuffer()
ProgramBinary *Context::getCurrentProgramBinary() ProgramBinary *Context::getCurrentProgramBinary()
{ {
if (!mCachedCurrentProgramBinary) return mCurrentProgramBinary;
{
Program *program = mResourceManager->getProgram(mState.currentProgram);
mCachedCurrentProgramBinary = program->getProgramBinary();
}
return mCachedCurrentProgramBinary;
} }
Texture2D *Context::getTexture2D() Texture2D *Context::getTexture2D()
......
...@@ -597,7 +597,7 @@ class Context ...@@ -597,7 +597,7 @@ class Context
bool mRenderTargetDescInitialized; bool mRenderTargetDescInitialized;
D3DSURFACE_DESC mRenderTargetDesc; D3DSURFACE_DESC mRenderTargetDesc;
bool mDxUniformsDirty; bool mDxUniformsDirty;
ProgramBinary *mCachedCurrentProgramBinary; ProgramBinary *mCurrentProgramBinary;
Framebuffer *mBoundDrawFramebuffer; Framebuffer *mBoundDrawFramebuffer;
bool mSupportsShaderModel3; bool mSupportsShaderModel3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment