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

Unified Diff: Source/core/html/canvas/WebGLQuery.cpp

Issue 1210673002: Improving support for WebGL2 Query objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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: Source/core/html/canvas/WebGLQuery.cpp
diff --git a/Source/core/html/canvas/WebGLQuery.cpp b/Source/core/html/canvas/WebGLQuery.cpp
index 58c5f0c83fbf8072f77d1213f0a87b200988ad29..2c1ff460aae9734c5778e0bdf5a0fa12ed1903dd 100644
--- a/Source/core/html/canvas/WebGLQuery.cpp
+++ b/Source/core/html/canvas/WebGLQuery.cpp
@@ -29,10 +29,35 @@ WebGLQuery::~WebGLQuery()
WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx)
: WebGLSharedPlatform3DObject(ctx)
+ , m_target(0)
{
setObject(ctx->webContext()->createQueryEXT());
}
+void WebGLQuery::setTarget(GLenum target)
+{
+ if (!object() || !compatibleTarget(target))
+ return;
Ken Russell (switch to Gerrit) 2015/06/24 21:07:22 These checks are supposed to be validated by the c
+
+ m_target = target;
+}
+
+bool WebGLQuery::compatibleTarget(GLenum target)
+{
+ if (!m_target)
+ return true;
+
+ switch (target) {
+ // The SAMPLES_PASSED targets are interchangable.
+ case GL_ANY_SAMPLES_PASSED:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+ return m_target == GL_ANY_SAMPLES_PASSED || m_target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE;
+ // Otherwise target is finalized the first time beginQuery() is called.
+ default:
+ return m_target == target;
+ }
+}
+
void WebGLQuery::deleteObjectImpl(WebGraphicsContext3D* context3d)
{
context3d->deleteQueryEXT(m_object);
« Source/core/html/canvas/WebGLQuery.h ('K') | « Source/core/html/canvas/WebGLQuery.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698