Moves applyShaders to Renderer

TRAC #22154 Signed-off-by: Geoff Lang Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1482 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent b6b27bc4
...@@ -1873,15 +1873,10 @@ void Context::applyShaders() ...@@ -1873,15 +1873,10 @@ void Context::applyShaders()
if (programBinary->getSerial() != mAppliedProgramBinarySerial) if (programBinary->getSerial() != mAppliedProgramBinarySerial)
{ {
IDirect3DVertexShader9 *vertexShader = programBinary->getVertexShader(); mRenderer->applyShaders(programBinary);
IDirect3DPixelShader9 *pixelShader = programBinary->getPixelShader();
mDevice->SetPixelShader(pixelShader);
mDevice->SetVertexShader(vertexShader);
programBinary->dirtyAllUniforms();
mAppliedProgramBinarySerial = programBinary->getSerial(); mAppliedProgramBinarySerial = programBinary->getSerial();
} }
programBinary->applyUniforms(); programBinary->applyUniforms();
} }
......
...@@ -92,6 +92,7 @@ class Renderer ...@@ -92,6 +92,7 @@ class Renderer
gl::ProgramBinary *currentProgram, bool forceSetUniforms) = 0; gl::ProgramBinary *currentProgram, bool forceSetUniforms) = 0;
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0; virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0;
virtual void applyShaders(gl::ProgramBinary *programBinary) = 0;
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw) = 0; virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw) = 0;
......
...@@ -405,6 +405,12 @@ GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Verte ...@@ -405,6 +405,12 @@ GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Verte
return GL_OUT_OF_MEMORY; return GL_OUT_OF_MEMORY;
} }
void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
{
// TODO
UNIMPLEMENTED();
}
void Renderer11::clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, void Renderer11::clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear,
gl::Framebuffer *frameBuffer) gl::Framebuffer *frameBuffer)
{ {
......
...@@ -64,6 +64,7 @@ class Renderer11 : public Renderer ...@@ -64,6 +64,7 @@ class Renderer11 : public Renderer
gl::ProgramBinary *currentProgram, bool forceSetUniforms); gl::ProgramBinary *currentProgram, bool forceSetUniforms);
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer); virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw); virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw);
......
...@@ -1109,6 +1109,16 @@ GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Vertex ...@@ -1109,6 +1109,16 @@ GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Vertex
return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, programBinary, instances, repeatDraw); return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, programBinary, instances, repeatDraw);
} }
void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
{
IDirect3DVertexShader9 *vertexShader = programBinary->getVertexShader();
IDirect3DPixelShader9 *pixelShader = programBinary->getPixelShader();
mDevice->SetPixelShader(pixelShader);
mDevice->SetVertexShader(vertexShader);
programBinary->dirtyAllUniforms();
}
void Renderer9::clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, void Renderer9::clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear,
gl::Framebuffer *frameBuffer) gl::Framebuffer *frameBuffer)
{ {
......
...@@ -127,6 +127,7 @@ class Renderer9 : public Renderer ...@@ -127,6 +127,7 @@ class Renderer9 : public Renderer
gl::ProgramBinary *currentProgram, bool forceSetUniforms); gl::ProgramBinary *currentProgram, bool forceSetUniforms);
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer); virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw); virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw);
......
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