зеркало из https://github.com/mozilla/gecko-dev.git
b=576529; Last GL_SAME_METHOD validation fix, and pass WebGL types; r=vladimir
This commit is contained in:
Родитель
e6358a2cb1
Коммит
c84a062c1e
|
@ -277,7 +277,7 @@ WebGLContext::BindTexture(WebGLenum target, nsIWebGLTexture *tobj)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
GL_SAME_METHOD_4(BlendColor, BlendColor, float, float, float, float)
|
||||
GL_SAME_METHOD_4(BlendColor, BlendColor, WebGLfloat, WebGLfloat, WebGLfloat, WebGLfloat)
|
||||
|
||||
NS_IMETHODIMP WebGLContext::BlendEquation(WebGLenum mode)
|
||||
{
|
||||
|
@ -503,15 +503,15 @@ WebGLContext::Clear(PRUint32 mask)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
GL_SAME_METHOD_4(ClearColor, ClearColor, float, float, float, float)
|
||||
GL_SAME_METHOD_4(ClearColor, ClearColor, WebGLfloat, WebGLfloat, WebGLfloat, WebGLfloat)
|
||||
|
||||
#ifdef USE_GLES2
|
||||
GL_SAME_METHOD_1(ClearDepthf, ClearDepth, float)
|
||||
GL_SAME_METHOD_1(ClearDepthf, ClearDepth, WebGLfloat)
|
||||
#else
|
||||
GL_SAME_METHOD_1(ClearDepth, ClearDepth, float)
|
||||
GL_SAME_METHOD_1(ClearDepth, ClearDepth, WebGLfloat)
|
||||
#endif
|
||||
|
||||
GL_SAME_METHOD_1(ClearStencil, ClearStencil, PRInt32)
|
||||
GL_SAME_METHOD_1(ClearStencil, ClearStencil, WebGLint)
|
||||
|
||||
GL_SAME_METHOD_4(ColorMask, ColorMask, WebGLboolean, WebGLboolean, WebGLboolean, WebGLboolean)
|
||||
|
||||
|
@ -631,7 +631,16 @@ WebGLContext::CreateShader(WebGLenum type, nsIWebGLShader **retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
GL_SAME_METHOD_1(CullFace, CullFace, WebGLenum)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::CullFace(WebGLenum face)
|
||||
{
|
||||
if (!ValidateFaceEnum(face, "cullFace"))
|
||||
return NS_OK;
|
||||
|
||||
MakeContextCurrent();
|
||||
gl->fCullFace(face);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::DeleteBuffer(nsIWebGLBuffer *bobj)
|
||||
|
@ -807,9 +816,9 @@ WebGLContext::DepthFunc(WebGLenum func)
|
|||
GL_SAME_METHOD_1(DepthMask, DepthMask, WebGLboolean)
|
||||
|
||||
#ifdef USE_GLES2
|
||||
GL_SAME_METHOD_2(DepthRangef, DepthRange, float, float)
|
||||
GL_SAME_METHOD_2(DepthRangef, DepthRange, WebGLfloat, WebGLfloat)
|
||||
#else
|
||||
GL_SAME_METHOD_2(DepthRange, DepthRange, float, float)
|
||||
GL_SAME_METHOD_2(DepthRange, DepthRange, WebGLfloat, WebGLfloat)
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2111,7 +2120,7 @@ WebGLContext::IsEnabled(WebGLenum cap, WebGLboolean *retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
GL_SAME_METHOD_1(LineWidth, LineWidth, float)
|
||||
GL_SAME_METHOD_1(LineWidth, LineWidth, WebGLfloat)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::LinkProgram(nsIWebGLProgram *pobj)
|
||||
|
@ -2173,7 +2182,7 @@ WebGLContext::PixelStorei(WebGLenum pname, WebGLint param)
|
|||
}
|
||||
|
||||
|
||||
GL_SAME_METHOD_2(PolygonOffset, PolygonOffset, float, float)
|
||||
GL_SAME_METHOD_2(PolygonOffset, PolygonOffset, WebGLfloat, WebGLfloat)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::ReadPixels(PRInt32 dummy)
|
||||
|
@ -2406,7 +2415,7 @@ WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, We
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
GL_SAME_METHOD_2(SampleCoverage, SampleCoverage, float, WebGLboolean)
|
||||
GL_SAME_METHOD_2(SampleCoverage, SampleCoverage, WebGLfloat, WebGLboolean)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::Scissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
|
||||
|
|
|
@ -87,6 +87,8 @@ CHECKEDINT_REGISTER_SUPPORTED_TYPE(PRUint64, unsupported_type)
|
|||
*** is supported, what that twice bigger type is, and some stuff as found
|
||||
*** in std::numeric_limits (which we don't use because PRInt.. types may
|
||||
*** not support it, if they are defined directly from compiler built-in types).
|
||||
*** We use function names min_value() and max_value() instead of min() and max()
|
||||
*** because of stupid min/max macros in Windows headers.
|
||||
***/
|
||||
|
||||
template<typename T> struct is_unsupported_type { enum { answer = 0 }; };
|
||||
|
@ -107,15 +109,15 @@ template<typename T> struct integer_traits
|
|||
is_signed = (T(-1) > T(0)) ? 0 : 1
|
||||
};
|
||||
|
||||
static T min()
|
||||
static T min_value()
|
||||
{
|
||||
// bitwise ops may return a larger type, that's why we cast explicitly to T
|
||||
return is_signed ? T(T(1) << position_of_sign_bit) : T(0);
|
||||
}
|
||||
|
||||
static T max()
|
||||
static T max_value()
|
||||
{
|
||||
return ~min();
|
||||
return ~min_value();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -145,8 +147,8 @@ struct is_in_range_impl<T, U, true, true>
|
|||
{
|
||||
static T run(U x)
|
||||
{
|
||||
return (x <= integer_traits<T>::max()) &
|
||||
(x >= integer_traits<T>::min());
|
||||
return (x <= integer_traits<T>::max_value()) &
|
||||
(x >= integer_traits<T>::min_value());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -155,7 +157,7 @@ struct is_in_range_impl<T, U, false, false>
|
|||
{
|
||||
static T run(U x)
|
||||
{
|
||||
return x <= integer_traits<T>::max();
|
||||
return x <= integer_traits<T>::max_value();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -167,7 +169,7 @@ struct is_in_range_impl<T, U, true, false>
|
|||
if (sizeof(T) > sizeof(U))
|
||||
return 1;
|
||||
else
|
||||
return x <= U(integer_traits<T>::max());
|
||||
return x <= U(integer_traits<T>::max_value());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -179,7 +181,7 @@ struct is_in_range_impl<T, U, false, true>
|
|||
if (sizeof(T) >= sizeof(U))
|
||||
return x >= 0;
|
||||
else
|
||||
return x >= 0 && x <= U(integer_traits<T>::max());
|
||||
return x >= 0 && x <= U(integer_traits<T>::max_value());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -240,8 +242,8 @@ struct is_mul_valid_impl<T, true, false>
|
|||
{
|
||||
static T run(T x, T y)
|
||||
{
|
||||
const T max_value = integer_traits<T>::max();
|
||||
const T min_value = integer_traits<T>::min();
|
||||
const T max_value = integer_traits<T>::max_value();
|
||||
const T min_value = integer_traits<T>::min_value();
|
||||
|
||||
if (x == 0 || y == 0) return true;
|
||||
|
||||
|
@ -264,7 +266,7 @@ struct is_mul_valid_impl<T, false, false>
|
|||
{
|
||||
static T run(T x, T y)
|
||||
{
|
||||
const T max_value = integer_traits<T>::max();
|
||||
const T max_value = integer_traits<T>::max_value();
|
||||
if (x == 0 || y == 0) return true;
|
||||
return x <= max_value / y;
|
||||
}
|
||||
|
@ -279,7 +281,7 @@ template<typename T> inline T is_div_valid(T x, T y)
|
|||
{
|
||||
return integer_traits<T>::is_signed ?
|
||||
// keep in mind that min/-1 is invalid because abs(min)>max
|
||||
y != 0 && (x != integer_traits<T>::min() || y != T(-1))
|
||||
y != 0 && (x != integer_traits<T>::min_value() || y != T(-1))
|
||||
:
|
||||
y != 0;
|
||||
}
|
||||
|
|
|
@ -117,10 +117,10 @@ void test()
|
|||
|
||||
test_twice_bigger_type<T>::run();
|
||||
|
||||
CheckedInt<T> max_value(integer_traits<T>::max());
|
||||
CheckedInt<T> min_value(integer_traits<T>::min());
|
||||
CheckedInt<T> max_value(integer_traits<T>::max_value());
|
||||
CheckedInt<T> min_value(integer_traits<T>::min_value());
|
||||
|
||||
// check min() and max(), since they are custom implementations and a mistake there
|
||||
// check min_value() and max_value(), since they are custom implementations and a mistake there
|
||||
// could potentially NOT be caught by any other tests... while making everything wrong!
|
||||
|
||||
T bit = 1;
|
||||
|
@ -415,10 +415,10 @@ void test()
|
|||
if (is_U_signed) \
|
||||
VERIFY_IS_VALID_IF(CheckedInt<T>(U(-1)), is_signed); \
|
||||
if (sizeof(U) > sizeof(T)) \
|
||||
VERIFY_IS_INVALID(CheckedInt<T>(U(integer_traits<T>::max())+1)); \
|
||||
VERIFY_IS_VALID_IF(CheckedInt<T>(integer_traits<U>::max()), \
|
||||
VERIFY_IS_INVALID(CheckedInt<T>(U(integer_traits<T>::max_value())+1)); \
|
||||
VERIFY_IS_VALID_IF(CheckedInt<T>(integer_traits<U>::max_value()), \
|
||||
(sizeof(T) > sizeof(U) || ((sizeof(T) == sizeof(U)) && (is_U_signed || !is_signed)))); \
|
||||
VERIFY_IS_VALID_IF(CheckedInt<T>(integer_traits<U>::min()), \
|
||||
VERIFY_IS_VALID_IF(CheckedInt<T>(integer_traits<U>::min_value()), \
|
||||
is_U_signed == false ? 1 : \
|
||||
bool(is_signed) == false ? 0 : \
|
||||
sizeof(T) >= sizeof(U)); \
|
||||
|
|
Загрузка…
Ссылка в новой задаче