Commit 54f59ef8 by jbauman@chromium.org

Don't reupload DX uniforms unless necessary

Makes Donuts NaCl test go from 14->16 fps. BUG= TEST=webgl conformance tests Review URL: http://codereview.appspot.com/5233056 git-svn-id: https://angleproject.googlecode.com/svn/trunk@793 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a28233e5
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 792
#define BUILD_REVISION 793
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -381,6 +381,7 @@ void Context::markAllStateDirty()
mSampleStateDirty = true;
mDitherStateDirty = true;
mFrontFaceDirty = true;
mDxUniformsDirty = true;
mCachedCurrentProgram = NULL;
}
......@@ -1043,6 +1044,7 @@ void Context::useProgram(GLuint program)
Program *newProgram = mResourceManager->getProgram(program);
Program *oldProgram = mResourceManager->getProgram(priorProgram);
mCachedCurrentProgram = NULL;
mDxUniformsDirty = true;
if (newProgram)
{
......@@ -1725,6 +1727,7 @@ bool Context::applyRenderTarget(bool ignoreViewport)
device->SetViewport(&viewport);
mSetViewport = viewport;
mViewportInitialized = true;
mDxUniformsDirty = true;
}
if (mScissorStateDirty)
......@@ -1747,7 +1750,7 @@ bool Context::applyRenderTarget(bool ignoreViewport)
mScissorStateDirty = false;
}
if (mState.currentProgram)
if (mState.currentProgram && mDxUniformsDirty)
{
Program *programObject = getCurrentProgram();
......@@ -1768,6 +1771,7 @@ bool Context::applyRenderTarget(bool ignoreViewport)
GLint depthRange = programObject->getDxDepthRangeLocation();
GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear};
programObject->setUniform3fv(depthRange, 1, nearFarDiff);
mDxUniformsDirty = false;
}
return true;
......
......@@ -544,6 +544,7 @@ class Context
D3DVIEWPORT9 mSetViewport;
bool mRenderTargetDescInitialized;
D3DSURFACE_DESC mRenderTargetDesc;
bool mDxUniformsDirty;
Program *mCachedCurrentProgram;
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