Bug 1260599 - Enable EXT_disjoint_timer_query extension on ANGLE. r=jgilbert

--HG--
extra : rebase_source : debccc5664b65f568f3cb82f6434108bb9092045
This commit is contained in:
Ethan Lin 2016-07-26 12:51:32 +08:00
parent b1a08048c4
commit 29ace485e1
4 changed files with 18 additions and 7 deletions

View File

@ -1626,6 +1626,13 @@ WebGLContext::DummyReadFramebufferOperation(const char* funcName)
}
}
bool
WebGLContext::HasTimestampBits() const
{
// 'sync' provides glGetInteger64v either by supporting ARB_sync, GL3+, or GLES3+.
return gl->IsSupported(GLFeature::sync);
}
static bool
CheckContextLost(GLContext* gl, bool* const out_isGuilty)
{

View File

@ -1473,6 +1473,8 @@ protected:
bool mNeedsFakeNoStencil;
bool mNeedsEmulatedLoneDepthStencil;
bool HasTimestampBits() const;
struct ScopedMaskWorkaround {
WebGLContext& mWebGL;
const bool mFakeNoAlpha;

View File

@ -267,7 +267,11 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::EXT_disjoint_timer_query)) {
if (pname == LOCAL_GL_TIMESTAMP_EXT) {
GLuint64 iv = 0;
gl->fGetInteger64v(pname, (GLint64*) &iv);
if (HasTimestampBits()) {
gl->fGetInteger64v(pname, (GLint64*)&iv);
} else {
GenerateWarning("QUERY_COUNTER_BITS_EXT for TIMESTAMP_EXT is 0.");
}
// TODO: JS doesn't support 64-bit integers. Be lossy and
// cast to double (53 bits)
return JS::NumberValue(static_cast<double>(iv));

View File

@ -177,7 +177,9 @@ WebGLExtensionDisjointTimerQuery::GetQueryEXT(JSContext* cx, GLenum target,
return;
}
GLint bits = 0;
mContext->GL()->fGetQueryiv(target, pname, &bits);
if (mContext->HasTimestampBits()) {
mContext->GL()->fGetQueryiv(target, pname, &bits);
}
retval.set(JS::Int32Value(int32_t(bits)));
break;
}
@ -242,11 +244,7 @@ WebGLExtensionDisjointTimerQuery::IsSupported(const WebGLContext* webgl)
gl::GLContext* gl = webgl->GL();
return gl->IsSupported(gl::GLFeature::query_objects) &&
gl->IsSupported(gl::GLFeature::get_query_object_i64v) &&
gl->IsSupported(gl::GLFeature::query_counter) && // provides GL_TIMESTAMP
gl->IsSupported(gl::GLFeature::sync); // provides glGetInteger64v
// 'sync' provides glGetInteger64v either by supporting ARB_sync, GL3+, or GLES3+.
// Since there are no differences between support for glGetInteger64v and support for
// 'sync', we just piggy-back off of 'sync'.
gl->IsSupported(gl::GLFeature::query_counter); // provides GL_TIMESTAMP
}
void