Commit 60e20280 by Alexis Hetu Committed by Alexis Hétu

convert_float_int fix

The convert_float_int was not scaling the [0,1] value to the full 1.31 fixed-point range before clamping the value. Fixes all failures in: dEQP-GLES3.functional.state_query.floats* Change-Id: Ic558eb45f1f351d3c30a0a5047a1b252edb56bd0 Reviewed-on: https://swiftshader-review.googlesource.com/14968Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 1ab837c5
......@@ -3103,7 +3103,7 @@ void GetIntegerv(GLenum pname, GLint* params)
{
if(pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
{
params[i] = convert_float_int(floatParams[i]);
params[i] = convert_float_fixed(floatParams[i]);
}
else
{
......
......@@ -1898,7 +1898,7 @@ GL_APICALL void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint *
{
if(target == GL_DEPTH_RANGE || target == GL_COLOR_CLEAR_VALUE || target == GL_DEPTH_CLEAR_VALUE || target == GL_BLEND_COLOR)
{
data[i] = convert_float_int(floatParams[i]);
data[i] = convert_float_fixed(floatParams[i]);
}
else
{
......@@ -3243,7 +3243,7 @@ GL_APICALL void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64 *data)
{
if(pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
{
data[i] = (GLint64)(convert_float_int(floatParams[i]));
data[i] = (GLint64)(convert_float_fixed(floatParams[i]));
}
else
{
......@@ -3326,7 +3326,7 @@ GL_APICALL void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint
{
if(target == GL_DEPTH_RANGE || target == GL_COLOR_CLEAR_VALUE || target == GL_DEPTH_CLEAR_VALUE || target == GL_BLEND_COLOR)
{
data[i] = (GLint64)(convert_float_int(floatParams[i]));
data[i] = (GLint64)(convert_float_fixed(floatParams[i]));
}
else
{
......
......@@ -90,6 +90,11 @@ inline int convert_float_int(float x)
return static_cast<int>(roundf(x));
}
inline int convert_float_fixed(float x)
{
return convert_float_int(static_cast<float>(0x7FFFFFFF) * x);
}
}
#endif // LIBGLESV2_MATHUTIL_H_
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