summaryrefslogtreecommitdiff
path: root/libs/hwui/Query.h
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2015-02-05 10:12:38 -0800
committer Chris Craik <ccraik@google.com> 2015-02-06 13:42:25 -0800
commit117bdbcfa3e8306dad21e7e01fa71b00cdfa7265 (patch)
treeaa54e4a5538818cd946bbd6e7eb771b83d0cfebd /libs/hwui/Query.h
parent34725687748cc2b4ace2bdb49becfdcd569e9a5d (diff)
Glop ColorFilter & VertexBuffer support, initial enable
Enables Glop rendering for supported Rects and VertexBuffers Also removes unused Query object Change-Id: Ibe227bc362685a153159f75077664f0947764e06
Diffstat (limited to 'libs/hwui/Query.h')
-rw-r--r--libs/hwui/Query.h152
1 files changed, 0 insertions, 152 deletions
diff --git a/libs/hwui/Query.h b/libs/hwui/Query.h
deleted file mode 100644
index e25b16b9206a..000000000000
--- a/libs/hwui/Query.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HWUI_QUERY_H
-#define ANDROID_HWUI_QUERY_H
-
-#include <GLES3/gl3.h>
-
-#include "Extensions.h"
-
-namespace android {
-namespace uirenderer {
-
-/**
- * A Query instance can be used to perform occlusion queries. If the device
- * does not support occlusion queries, the result of a query will always be
- * 0 and the result will always be marked available.
- *
- * To run an occlusion query successfully, you must start end end the query:
- *
- * Query query;
- * query.begin();
- * // execute OpenGL calls
- * query.end();
- * GLuint result = query.getResult();
- */
-class Query {
-public:
- /**
- * Possible query targets.
- */
- enum Target {
- /**
- * Indicates if any sample passed the depth & stencil tests.
- */
- kTargetSamples = GL_ANY_SAMPLES_PASSED,
- /**
- * Indicates if any sample passed the depth & stencil tests.
- * The implementation may choose to use a less precise version
- * of the test, potentially resulting in false positives.
- */
- kTargetConservativeSamples = GL_ANY_SAMPLES_PASSED_CONSERVATIVE,
- };
-
- /**
- * Creates a new query with the specified target. The default
- * target is kTargetSamples (of GL_ANY_SAMPLES_PASSED in OpenGL.)
- */
- Query(Target target = kTargetSamples): mActive(false), mTarget(target),
- mCanQuery(Extensions::getInstance().hasOcclusionQueries()),
- mQuery(0) {
- }
-
- ~Query() {
- if (mQuery) {
- glDeleteQueries(1, &mQuery);
- }
- }
-
- /**
- * Begins the query. If the query has already begun or if the device
- * does not support occlusion queries, calling this method as no effect.
- * After calling this method successfully, the query is marked active.
- */
- void begin() {
- if (!mActive && mCanQuery) {
- if (!mQuery) {
- glGenQueries(1, &mQuery);
- }
-
- glBeginQuery(mTarget, mQuery);
- mActive = true;
- }
- }
-
- /**
- * Ends the query. If the query has already begun or if the device
- * does not support occlusion queries, calling this method as no effect.
- * After calling this method successfully, the query is marked inactive.
- */
- void end() {
- if (mQuery && mActive) {
- glEndQuery(mTarget);
- mActive = false;
- }
- }
-
- /**
- * Returns true if the query is active, false otherwise.
- */
- bool isActive() {
- return mActive;
- }
-
- /**
- * Returns true if the result of the query is available,
- * false otherwise. Calling getResult() before the result
- * is available may result in the calling thread being blocked.
- * If the device does not support queries, this method always
- * returns true.
- */
- bool isResultAvailable() {
- if (!mQuery) return true;
-
- GLuint result;
- glGetQueryObjectuiv(mQuery, GL_QUERY_RESULT_AVAILABLE, &result);
- return result == GL_TRUE;
- }
-
- /**
- * Returns the result of the query. If the device does not
- * support queries this method will return 0.
- *
- * Calling this method implicitely calls end() if the query
- * is currently active.
- */
- GLuint getResult() {
- if (!mQuery) return 0;
-
- end();
-
- GLuint result;
- glGetQueryObjectuiv(mQuery, GL_QUERY_RESULT, &result);
- return result;
- }
-
-
-private:
- bool mActive;
- GLenum mTarget;
- bool mCanQuery;
- GLuint mQuery;
-
-}; // class Query
-
-}; // namespace uirenderer
-}; // namespace android
-
-#endif // ANDROID_HWUI_QUERY_H