Commit 12d59314 by Geoff Lang

Prefer glDepthRangef and glClearDepthf to the double version.

ES only has the float versions. BUG=angleproject:1145 Change-Id: I6c96b553d20e8aa160f68fe1b3fa0200d64108a3 Reviewed-on: https://chromium-review.googlesource.com/296361Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent f2ee0752
...@@ -571,7 +571,18 @@ void StateManagerGL::setDepthRange(float near, float far) ...@@ -571,7 +571,18 @@ void StateManagerGL::setDepthRange(float near, float far)
{ {
mNear = near; mNear = near;
mFar = far; mFar = far;
mFunctions->depthRange(mNear, mFar);
// The glDepthRangef function isn't available until OpenGL 4.1. Prefer it when it is
// available because OpenGL ES only works in floats.
if (mFunctions->depthRangef)
{
mFunctions->depthRangef(mNear, mFar);
}
else
{
ASSERT(mFunctions->depthRange);
mFunctions->depthRange(mNear, mFar);
}
mLocalDirtyBits.set(gl::State::DIRTY_BIT_DEPTH_RANGE); mLocalDirtyBits.set(gl::State::DIRTY_BIT_DEPTH_RANGE);
} }
...@@ -973,7 +984,18 @@ void StateManagerGL::setClearDepth(float clearDepth) ...@@ -973,7 +984,18 @@ void StateManagerGL::setClearDepth(float clearDepth)
if (mClearDepth != clearDepth) if (mClearDepth != clearDepth)
{ {
mClearDepth = clearDepth; mClearDepth = clearDepth;
mFunctions->clearDepth(mClearDepth);
// The glClearDepthf function isn't available until OpenGL 4.1. Prefer it when it is
// available because OpenGL ES only works in floats.
if (mFunctions->clearDepthf)
{
mFunctions->clearDepthf(mClearDepth);
}
else
{
ASSERT(mFunctions->clearDepth);
mFunctions->clearDepth(mClearDepth);
}
mLocalDirtyBits.set(gl::State::DIRTY_BIT_CLEAR_DEPTH); mLocalDirtyBits.set(gl::State::DIRTY_BIT_CLEAR_DEPTH);
} }
......
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