Changed the Renderer::clear method parameters to use the new ClearParameters structure.

TRAC #22125 Signed-off-by: Shannon Woods Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1485 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 7436971e
...@@ -1998,6 +1998,7 @@ void Context::clear(GLbitfield mask) ...@@ -1998,6 +1998,7 @@ void Context::clear(GLbitfield mask)
} }
DWORD flags = 0; DWORD flags = 0;
GLbitfield finalMask = 0;
if (mask & GL_COLOR_BUFFER_BIT) if (mask & GL_COLOR_BUFFER_BIT)
{ {
...@@ -2006,6 +2007,7 @@ void Context::clear(GLbitfield mask) ...@@ -2006,6 +2007,7 @@ void Context::clear(GLbitfield mask)
if (framebufferObject->getColorbufferType() != GL_NONE) if (framebufferObject->getColorbufferType() != GL_NONE)
{ {
flags |= D3DCLEAR_TARGET; flags |= D3DCLEAR_TARGET;
finalMask |= GL_COLOR_BUFFER_BIT;
} }
} }
...@@ -2015,6 +2017,7 @@ void Context::clear(GLbitfield mask) ...@@ -2015,6 +2017,7 @@ void Context::clear(GLbitfield mask)
if (mState.depthStencil.depthMask && framebufferObject->getDepthbufferType() != GL_NONE) if (mState.depthStencil.depthMask && framebufferObject->getDepthbufferType() != GL_NONE)
{ {
flags |= D3DCLEAR_ZBUFFER; flags |= D3DCLEAR_ZBUFFER;
finalMask |= GL_DEPTH_BUFFER_BIT;
} }
} }
...@@ -2038,6 +2041,7 @@ void Context::clear(GLbitfield mask) ...@@ -2038,6 +2041,7 @@ void Context::clear(GLbitfield mask)
if (stencilUnmasked != 0x0) if (stencilUnmasked != 0x0)
{ {
flags |= D3DCLEAR_STENCIL; flags |= D3DCLEAR_STENCIL;
finalMask |= GL_STENCIL_BUFFER_BIT;
} }
} }
} }
...@@ -2212,9 +2216,18 @@ void Context::clear(GLbitfield mask) ...@@ -2212,9 +2216,18 @@ void Context::clear(GLbitfield mask)
{ {
mDevice->Clear(0, NULL, flags, color, depth, stencil); mDevice->Clear(0, NULL, flags, color, depth, stencil);
} }
ClearParameters clearParams;
mRenderer->clear(mask, mState.colorClearValue, mState.depthClearValue, mState.stencilClearValue, clearParams.mask = finalMask;
framebufferObject); clearParams.colorClearValue = mState.colorClearValue;
clearParams.colorMaskRed = mState.blend.colorMaskRed;
clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
clearParams.depthClearValue = mState.depthClearValue;
clearParams.stencilClearValue = mState.stencilClearValue;
clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
mRenderer->clear(clearParams, framebufferObject);
} }
void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances) void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
......
...@@ -96,8 +96,7 @@ class Renderer ...@@ -96,8 +96,7 @@ class Renderer
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;
virtual void clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) = 0;
gl::Framebuffer *frameBuffer) = 0;
virtual void markAllStateDirty() = 0; virtual void markAllStateDirty() = 0;
......
...@@ -411,8 +411,7 @@ void Renderer11::applyShaders(gl::ProgramBinary *programBinary) ...@@ -411,8 +411,7 @@ void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
void Renderer11::clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
gl::Framebuffer *frameBuffer)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -68,8 +68,7 @@ class Renderer11 : public Renderer ...@@ -68,8 +68,7 @@ class Renderer11 : public Renderer
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);
virtual void clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
gl::Framebuffer *frameBuffer);
virtual void markAllStateDirty(); virtual void markAllStateDirty();
......
...@@ -1119,8 +1119,7 @@ void Renderer9::applyShaders(gl::ProgramBinary *programBinary) ...@@ -1119,8 +1119,7 @@ void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
programBinary->dirtyAllUniforms(); programBinary->dirtyAllUniforms();
} }
void Renderer9::clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
gl::Framebuffer *frameBuffer)
{ {
mForceSetDepthStencilState = true; mForceSetDepthStencilState = true;
......
...@@ -131,8 +131,7 @@ class Renderer9 : public Renderer ...@@ -131,8 +131,7 @@ class Renderer9 : public Renderer
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);
virtual void clear(GLbitfield mask, const gl::Color &colorClear, float depthClear, int stencilClear, virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
gl::Framebuffer *frameBuffer);
virtual void markAllStateDirty(); virtual void markAllStateDirty();
......
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