Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp

Issue 2437233002: Implement EXT_disjoint_timer_query_webgl2 (Closed)
Patch Set: fix logic again Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp b/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
index 647d359d89f3d2d8b0852997ecf40a3996433f1c..1c3b496a4d1395b8fa227e401e8e1ed29a5daaa7 100644
--- a/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
+++ b/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
@@ -82,7 +82,7 @@ void EXTDisjointTimerQuery::beginQueryEXT(GLenum target,
if (m_currentElapsedQuery) {
scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "beginQueryEXT",
- "no current query");
+ "a query is already active for target");
return;
}
@@ -156,24 +156,28 @@ ScriptValue EXTDisjointTimerQuery::getQueryEXT(ScriptState* scriptState,
if (scoped.isLost())
return ScriptValue::createNull(scriptState);
- if (target == GL_TIMESTAMP_EXT || target == GL_TIME_ELAPSED_EXT) {
- switch (pname) {
- case GL_CURRENT_QUERY_EXT:
- if (GL_TIME_ELAPSED_EXT == target && m_currentElapsedQuery.get())
- return WebGLAny(scriptState, m_currentElapsedQuery.get());
- return ScriptValue::createNull(scriptState);
- case GL_QUERY_COUNTER_BITS_EXT: {
- GLint value = 0;
- scoped.context()->contextGL()->GetQueryivEXT(target, pname, &value);
- return WebGLAny(scriptState, value);
- }
- default:
- break;
+ if (pname == GL_QUERY_COUNTER_BITS_EXT) {
+ if (target == GL_TIMESTAMP_EXT || target == GL_TIME_ELAPSED_EXT) {
+ GLint value = 0;
+ scoped.context()->contextGL()->GetQueryivEXT(target, pname, &value);
+ return WebGLAny(scriptState, value);
}
+ scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "getQuery",
+ "invalid target/pname combination");
+ return ScriptValue::createNull(scriptState);
+ }
+
+ if (target == GL_TIME_ELAPSED_EXT && pname == GL_CURRENT_QUERY) {
+ return m_currentElapsedQuery ? WebGLAny(scriptState, m_currentElapsedQuery)
+ : ScriptValue::createNull(scriptState);
+ }
+
+ if (target == GL_TIMESTAMP_EXT && pname == GL_CURRENT_QUERY) {
+ return ScriptValue::createNull(scriptState);
}
- scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "getQueryEXT",
- "invalid target or pname");
+ scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "getQuery",
+ "invalid target/pname combination");
return ScriptValue::createNull(scriptState);
}

Powered by Google App Engine
This is Rietveld 408576698