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 MAJOR_VERSION 0
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 792 #define BUILD_REVISION 793
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -381,6 +381,7 @@ void Context::markAllStateDirty() ...@@ -381,6 +381,7 @@ void Context::markAllStateDirty()
mSampleStateDirty = true; mSampleStateDirty = true;
mDitherStateDirty = true; mDitherStateDirty = true;
mFrontFaceDirty = true; mFrontFaceDirty = true;
mDxUniformsDirty = true;
mCachedCurrentProgram = NULL; mCachedCurrentProgram = NULL;
} }
...@@ -1043,6 +1044,7 @@ void Context::useProgram(GLuint program) ...@@ -1043,6 +1044,7 @@ 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);
mCachedCurrentProgram = NULL; mCachedCurrentProgram = NULL;
mDxUniformsDirty = true;
if (newProgram) if (newProgram)
{ {
...@@ -1725,6 +1727,7 @@ bool Context::applyRenderTarget(bool ignoreViewport) ...@@ -1725,6 +1727,7 @@ bool Context::applyRenderTarget(bool ignoreViewport)
device->SetViewport(&viewport); device->SetViewport(&viewport);
mSetViewport = viewport; mSetViewport = viewport;
mViewportInitialized = true; mViewportInitialized = true;
mDxUniformsDirty = true;
} }
if (mScissorStateDirty) if (mScissorStateDirty)
...@@ -1747,7 +1750,7 @@ bool Context::applyRenderTarget(bool ignoreViewport) ...@@ -1747,7 +1750,7 @@ bool Context::applyRenderTarget(bool ignoreViewport)
mScissorStateDirty = false; mScissorStateDirty = false;
} }
if (mState.currentProgram) if (mState.currentProgram && mDxUniformsDirty)
{ {
Program *programObject = getCurrentProgram(); Program *programObject = getCurrentProgram();
...@@ -1768,6 +1771,7 @@ bool Context::applyRenderTarget(bool ignoreViewport) ...@@ -1768,6 +1771,7 @@ bool Context::applyRenderTarget(bool ignoreViewport)
GLint depthRange = programObject->getDxDepthRangeLocation(); GLint depthRange = programObject->getDxDepthRangeLocation();
GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear}; GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear};
programObject->setUniform3fv(depthRange, 1, nearFarDiff); programObject->setUniform3fv(depthRange, 1, nearFarDiff);
mDxUniformsDirty = false;
} }
return true; return true;
......
...@@ -544,6 +544,7 @@ class Context ...@@ -544,6 +544,7 @@ class Context
D3DVIEWPORT9 mSetViewport; D3DVIEWPORT9 mSetViewport;
bool mRenderTargetDescInitialized; bool mRenderTargetDescInitialized;
D3DSURFACE_DESC mRenderTargetDesc; D3DSURFACE_DESC mRenderTargetDesc;
bool mDxUniformsDirty;
Program *mCachedCurrentProgram; Program *mCachedCurrentProgram;
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