Move program binary serial caching to renderer

Trac #22249 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1576 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 9a067375
...@@ -317,8 +317,6 @@ void Context::markAllStateDirty() ...@@ -317,8 +317,6 @@ void Context::markAllStateDirty()
mAppliedTextureSerialVS[t] = 0; mAppliedTextureSerialVS[t] = 0;
} }
mAppliedProgramBinarySerial = 0;
mDxUniformsDirty = true; mDxUniformsDirty = true;
} }
...@@ -1784,11 +1782,7 @@ void Context::applyShaders() ...@@ -1784,11 +1782,7 @@ void Context::applyShaders()
{ {
ProgramBinary *programBinary = getCurrentProgramBinary(); ProgramBinary *programBinary = getCurrentProgramBinary();
if (programBinary->getSerial() != mAppliedProgramBinarySerial)
{
mRenderer->applyShaders(programBinary); mRenderer->applyShaders(programBinary);
mAppliedProgramBinarySerial = programBinary->getSerial();
}
programBinary->applyUniforms(); programBinary->applyUniforms();
} }
......
...@@ -490,7 +490,6 @@ class Context ...@@ -490,7 +490,6 @@ class Context
unsigned int mAppliedTextureSerialPS[MAX_TEXTURE_IMAGE_UNITS]; unsigned int mAppliedTextureSerialPS[MAX_TEXTURE_IMAGE_UNITS];
unsigned int mAppliedTextureSerialVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF]; unsigned int mAppliedTextureSerialVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF];
unsigned int mAppliedProgramBinarySerial;
bool mDxUniformsDirty; bool mDxUniformsDirty;
BindingPointer<ProgramBinary> mCurrentProgramBinary; BindingPointer<ProgramBinary> mCurrentProgramBinary;
Framebuffer *mBoundDrawFramebuffer; Framebuffer *mBoundDrawFramebuffer;
......
...@@ -696,6 +696,9 @@ void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLv ...@@ -696,6 +696,9 @@ void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLv
void Renderer11::applyShaders(gl::ProgramBinary *programBinary) void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
{ {
unsigned int programBinarySerial = programBinary->getSerial();
if (programBinarySerial != mAppliedProgramBinarySerial)
{
ShaderExecutable *vertexExe = programBinary->getVertexExecutable(); ShaderExecutable *vertexExe = programBinary->getVertexExecutable();
ShaderExecutable *pixelExe = programBinary->getPixelExecutable(); ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
...@@ -708,6 +711,9 @@ void Renderer11::applyShaders(gl::ProgramBinary *programBinary) ...@@ -708,6 +711,9 @@ void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
mDeviceContext->PSSetShader(pixelShader, NULL, 0); mDeviceContext->PSSetShader(pixelShader, NULL, 0);
mDeviceContext->VSSetShader(vertexShader, NULL, 0); mDeviceContext->VSSetShader(vertexShader, NULL, 0);
programBinary->dirtyAllUniforms(); programBinary->dirtyAllUniforms();
mAppliedProgramBinarySerial = programBinarySerial;
}
} }
void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
...@@ -839,6 +845,8 @@ void Renderer11::markAllStateDirty() ...@@ -839,6 +845,8 @@ void Renderer11::markAllStateDirty()
mForceSetDepthStencilState = true; mForceSetDepthStencilState = true;
mForceSetScissor = true; mForceSetScissor = true;
mForceSetViewport = true; mForceSetViewport = true;
mAppliedProgramBinarySerial = 0;
} }
void Renderer11::releaseDeviceResources() void Renderer11::releaseDeviceResources()
......
...@@ -192,6 +192,8 @@ class Renderer11 : public Renderer ...@@ -192,6 +192,8 @@ class Renderer11 : public Renderer
float mCurNear; float mCurNear;
float mCurFar; float mCurFar;
unsigned int mAppliedProgramBinarySerial;
ID3D11Device *mDevice; ID3D11Device *mDevice;
D3D_FEATURE_LEVEL mFeatureLevel; D3D_FEATURE_LEVEL mFeatureLevel;
ID3D11DeviceContext *mDeviceContext; ID3D11DeviceContext *mDeviceContext;
......
...@@ -1412,6 +1412,9 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, ...@@ -1412,6 +1412,9 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
void Renderer9::applyShaders(gl::ProgramBinary *programBinary) void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
{ {
unsigned int programBinarySerial = programBinary->getSerial();
if (programBinarySerial != mAppliedProgramBinarySerial)
{
ShaderExecutable *vertexExe = programBinary->getVertexExecutable(); ShaderExecutable *vertexExe = programBinary->getVertexExecutable();
ShaderExecutable *pixelExe = programBinary->getPixelExecutable(); ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
...@@ -1424,6 +1427,9 @@ void Renderer9::applyShaders(gl::ProgramBinary *programBinary) ...@@ -1424,6 +1427,9 @@ void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
mDevice->SetPixelShader(pixelShader); mDevice->SetPixelShader(pixelShader);
mDevice->SetVertexShader(vertexShader); mDevice->SetVertexShader(vertexShader);
programBinary->dirtyAllUniforms(); programBinary->dirtyAllUniforms();
mAppliedProgramBinarySerial = programBinarySerial;
}
} }
void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
...@@ -1625,6 +1631,7 @@ void Renderer9::markAllStateDirty() ...@@ -1625,6 +1631,7 @@ void Renderer9::markAllStateDirty()
mForceSetBlendState = true; mForceSetBlendState = true;
mAppliedIBSerial = 0; mAppliedIBSerial = 0;
mAppliedProgramBinarySerial = 0;
mVertexDeclarationCache.markStateDirty(); mVertexDeclarationCache.markStateDirty();
} }
......
...@@ -259,6 +259,7 @@ class Renderer9 : public Renderer ...@@ -259,6 +259,7 @@ class Renderer9 : public Renderer
GLuint mCurSampleMask; GLuint mCurSampleMask;
unsigned int mAppliedIBSerial; unsigned int mAppliedIBSerial;
unsigned int mAppliedProgramBinarySerial;
// A pool of event queries that are currently unused. // A pool of event queries that are currently unused.
std::vector<IDirect3DQuery9*> mEventQueryPool; std::vector<IDirect3DQuery9*> mEventQueryPool;
......
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