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

Unified Diff: gpu/command_buffer/service/query_manager.cc

Issue 238933003: Re-land: gpu: Add CHROMIUM_sync_query extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove SyncQueryBasic test as no guarantee this extension is available Created 6 years, 8 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 | « gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h ('k') | ui/gl/gl_bindings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/query_manager.cc
diff --git a/gpu/command_buffer/service/query_manager.cc b/gpu/command_buffer/service/query_manager.cc
index 9f1d3a7169c31b5c1ee640b07f6c08a71623b18b..30c036ed98d02dc0b211b5b999b7611bfd2b2a9b 100644
--- a/gpu/command_buffer/service/query_manager.cc
+++ b/gpu/command_buffer/service/query_manager.cc
@@ -16,6 +16,7 @@
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
+#include "ui/gl/gl_fence.h"
namespace gpu {
namespace gles2 {
@@ -389,6 +390,55 @@ void GetErrorQuery::Destroy(bool /* have_context */) {
GetErrorQuery::~GetErrorQuery() {
}
+class CommandsCompletedQuery : public QueryManager::Query {
+ public:
+ CommandsCompletedQuery(QueryManager* manager,
+ GLenum target,
+ int32 shm_id,
+ uint32 shm_offset);
+
+ // Overridden from QueryManager::Query:
+ virtual bool Begin() OVERRIDE;
+ virtual bool End(base::subtle::Atomic32 submit_count) OVERRIDE;
+ virtual bool Process() OVERRIDE;
+ virtual void Destroy(bool have_context) OVERRIDE;
+
+ protected:
+ virtual ~CommandsCompletedQuery();
+
+ private:
+ scoped_ptr<gfx::GLFence> fence_;
+};
+
+CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager,
+ GLenum target,
+ int32 shm_id,
+ uint32 shm_offset)
+ : Query(manager, target, shm_id, shm_offset) {}
+
+bool CommandsCompletedQuery::Begin() { return true; }
+
+bool CommandsCompletedQuery::End(base::subtle::Atomic32 submit_count) {
+ fence_.reset(gfx::GLFence::Create());
+ DCHECK(fence_);
+ return AddToPendingQueue(submit_count);
+}
+
+bool CommandsCompletedQuery::Process() {
+ if (fence_ && !fence_->HasCompleted())
+ return true;
+ return MarkAsCompleted(0);
+}
+
+void CommandsCompletedQuery::Destroy(bool have_context) {
+ if (have_context && !IsDeleted()) {
+ fence_.reset();
+ MarkAsDeleted();
+ }
+}
+
+CommandsCompletedQuery::~CommandsCompletedQuery() {}
+
QueryManager::QueryManager(
GLES2Decoder* decoder,
FeatureInfo* feature_info)
@@ -444,6 +494,9 @@ QueryManager::Query* QueryManager::CreateQuery(
case GL_GET_ERROR_QUERY_CHROMIUM:
query = new GetErrorQuery(this, target, shm_id, shm_offset);
break;
+ case GL_COMMANDS_COMPLETED_CHROMIUM:
+ query = new CommandsCompletedQuery(this, target, shm_id, shm_offset);
+ break;
default: {
GLuint service_id = 0;
glGenQueriesARB(1, &service_id);
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h ('k') | ui/gl/gl_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698