Refactored Renderer::setRasterizerState to no longer need a depthSize parameter.
TRAC #22145
Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1516 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index d8995d5..a834a4d 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -660,10 +660,9 @@
mDevice->SetTexture(d3dSampler, d3dTexture);
}
-void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState, unsigned int depthSize)
+void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
{
bool rasterStateChanged = mForceSetRasterState || memcmp(&rasterState, &mCurRasterState, sizeof(gl::RasterizerState)) != 0;
- bool depthSizeChanged = mForceSetRasterState || depthSize != mCurDepthSize;
if (rasterStateChanged)
{
@@ -679,18 +678,13 @@
mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, rasterState.scissorTest ? TRUE : FALSE);
- mCurRasterState = rasterState;
- }
-
- if (rasterStateChanged || depthSizeChanged)
- {
if (rasterState.polygonOffsetFill)
{
- if (depthSize > 0)
+ if (mCurDepthSize > 0)
{
mDevice->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&rasterState.polygonOffsetFactor);
- float depthBias = ldexp(rasterState.polygonOffsetUnits, -static_cast<int>(depthSize));
+ float depthBias = ldexp(rasterState.polygonOffsetUnits, -static_cast<int>(mCurDepthSize));
mDevice->SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&depthBias);
}
}
@@ -700,7 +694,7 @@
mDevice->SetRenderState(D3DRS_DEPTHBIAS, 0);
}
- mCurDepthSize = depthSize;
+ mCurRasterState = rasterState;
}
mForceSetRasterState = false;
@@ -1088,6 +1082,8 @@
stencilbufferSerial != mAppliedStencilbufferSerial ||
!mDepthStencilInitialized)
{
+ unsigned int depthSize = 0;
+
// Apply the depth stencil on the device
if (depthStencil)
{
@@ -1107,12 +1103,20 @@
mDevice->SetDepthStencilSurface(depthStencilSurface);
depthStencilSurface->Release();
+
+ depthSize = depthStencil->getDepthSize();
}
else
{
mDevice->SetDepthStencilSurface(NULL);
}
+ if (!mDepthStencilInitialized || depthSize != mCurDepthSize)
+ {
+ mCurDepthSize = depthSize;
+ mForceSetRasterState = true;
+ }
+
mAppliedDepthbufferSerial = depthbufferSerial;
mAppliedStencilbufferSerial = stencilbufferSerial;
mDepthStencilInitialized = true;