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

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

Issue 1408803003: Enforce queries' new availability semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLQuery.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index 16afe7a743a285a1a381e4a5cf5cec8c29545f76..33c94ce4305b2b71abc3ffa947e9bfeff9a3c3aa 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -1491,6 +1491,7 @@ void WebGL2RenderingContextBase::endQuery(GLenum target)
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
{
if (m_currentBooleanOcclusionQuery && m_currentBooleanOcclusionQuery->getTarget() == target) {
+ m_currentBooleanOcclusionQuery->resetCachedResult();
m_currentBooleanOcclusionQuery = nullptr;
} else {
synthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active");
@@ -1501,6 +1502,7 @@ void WebGL2RenderingContextBase::endQuery(GLenum target)
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
{
if (m_currentTransformFeedbackPrimitivesWrittenQuery) {
+ m_currentTransformFeedbackPrimitivesWrittenQuery->resetCachedResult();
m_currentTransformFeedbackPrimitivesWrittenQuery = nullptr;
} else {
synthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active");
@@ -1546,18 +1548,22 @@ ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
if (isContextLost() || !validateWebGLObject("getQueryParameter", query))
return ScriptValue::createNull(scriptState);
+ // Query is non-null at this point.
+ if (query == m_currentBooleanOcclusionQuery || query == m_currentTransformFeedbackPrimitivesWrittenQuery) {
+ synthesizeGLError(GL_INVALID_OPERATION, "getQueryParameter", "query is currently active");
+ return ScriptValue::createNull(scriptState);
+ }
+
switch (pname) {
case GL_QUERY_RESULT:
{
- GLuint value;
- webContext()->getQueryObjectuivEXT(objectOrZero(query), pname, &value);
- return WebGLAny(scriptState, value);
+ query->updateCachedResult(webContext());
+ return WebGLAny(scriptState, query->getQueryResult());
}
case GL_QUERY_RESULT_AVAILABLE:
{
- GLuint value;
- webContext()->getQueryObjectuivEXT(objectOrZero(query), pname, &value);
- return WebGLAny(scriptState, value == GL_TRUE);
+ query->updateCachedResult(webContext());
+ return WebGLAny(scriptState, query->isQueryResultAvailable());
}
default:
synthesizeGLError(GL_INVALID_ENUM, "getQueryParameter", "invalid parameter name");
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLQuery.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698