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

--HG--
extra : rebase_source : cd31f7ff2daa4fec743726fd2e1a04ca83820b5b
This commit is contained in:
Ethan Lin 2016-07-17 19:37:00 +02:00
Родитель a5af07b18b
Коммит d775ae4e6e
4 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -1630,6 +1630,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)
{

Просмотреть файл

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

Просмотреть файл

@ -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));

Просмотреть файл

@ -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