Commit d0310437 by Geoff Lang

Fixed a bug where the frontFace shader constant would not be updated if the…

Fixed a bug where the frontFace shader constant would not be updated if the drawMode or frontFace changed but not the viewport. TRAC #23719 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent 7ecdd3d8
......@@ -1076,8 +1076,10 @@ bool Renderer9::setViewport(const gl::Rectangle &viewport, float zNear, float zF
return false; // Nothing to render
}
float depthFront = !gl::IsTriangleMode(drawMode) ? 0.0f : (frontFace == GL_CCW ? 1.0f : -1.0f);
bool viewportChanged = mForceSetViewport || memcmp(&actualViewport, &mCurViewport, sizeof(gl::Rectangle)) != 0 ||
actualZNear != mCurNear || actualZFar != mCurFar;
actualZNear != mCurNear || actualZFar != mCurFar || mCurDepthFront != depthFront;
if (viewportChanged)
{
mDevice->SetViewport(&dxViewport);
......@@ -1085,6 +1087,7 @@ bool Renderer9::setViewport(const gl::Rectangle &viewport, float zNear, float zF
mCurViewport = actualViewport;
mCurNear = actualZNear;
mCurFar = actualZFar;
mCurDepthFront = depthFront;
dx_VertexConstants vc = {0};
dx_PixelConstants pc = {0};
......@@ -1101,7 +1104,7 @@ bool Renderer9::setViewport(const gl::Rectangle &viewport, float zNear, float zF
pc.depthFront[0] = (actualZFar - actualZNear) * 0.5f;
pc.depthFront[1] = (actualZNear + actualZFar) * 0.5f;
pc.depthFront[2] = !gl::IsTriangleMode(drawMode) ? 0.0f : (frontFace == GL_CCW ? 1.0f : -1.0f);;
pc.depthFront[2] = depthFront;
vc.depthRange[0] = actualZNear;
vc.depthRange[1] = actualZFar;
......
......@@ -298,6 +298,7 @@ class Renderer9 : public Renderer
gl::Rectangle mCurViewport;
float mCurNear;
float mCurFar;
float mCurDepthFront;
bool mForceSetBlendState;
gl::BlendState mCurBlendState;
......
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