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

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

Issue 16831004: Perform glReadPixels with PBOs in the gpu, if PBOs are available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix cc_unittests Created 7 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: 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 e66478ae3c06b480dcc6203797ab54e27c2b3a85..6d2f84a68e26fa5642dbf8ab24f6552088532895 100644
--- a/gpu/command_buffer/service/query_manager.cc
+++ b/gpu/command_buffer/service/query_manager.cc
@@ -223,9 +223,8 @@ bool AsyncPixelTransfersCompletedQuery::End(uint32 submit_count) {
// on the current thread.
manager()->decoder()->GetAsyncPixelTransferManager()->AsyncNotifyCompletion(
mem_params,
- base::Bind(AsyncPixelTransfersCompletedQuery::MarkAsCompletedThreadSafe,
+ base::Bind(&AsyncPixelTransfersCompletedQuery::MarkAsCompletedThreadSafe,
submit_count));
-
return AddToPendingTransferQueue(submit_count);
}
@@ -254,6 +253,58 @@ void AsyncPixelTransfersCompletedQuery::Destroy(bool /* have_context */) {
AsyncPixelTransfersCompletedQuery::~AsyncPixelTransfersCompletedQuery() {
}
+class AsyncReadPixelsCompletedQuery
+ : public QueryManager::Query,
+ public base::SupportsWeakPtr<AsyncReadPixelsCompletedQuery> {
+ public:
+ AsyncReadPixelsCompletedQuery(
+ QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset);
+
+ virtual bool Begin() OVERRIDE;
+ virtual bool End(uint32 submit_count) OVERRIDE;
+ virtual bool Process() OVERRIDE;
+ virtual void Destroy(bool have_context) OVERRIDE;
+
+ protected:
+ void Complete();
+ virtual ~AsyncReadPixelsCompletedQuery();
+};
+
+AsyncReadPixelsCompletedQuery::AsyncReadPixelsCompletedQuery(
+ QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset)
+ : Query(manager, target, shm_id, shm_offset) {
+}
+
+bool AsyncReadPixelsCompletedQuery::Begin() {
+ return true;
+}
+
+bool AsyncReadPixelsCompletedQuery::End(uint32 submit_count) {
+ manager()->decoder()->WaitForReadPixels(
+ base::Bind(&AsyncReadPixelsCompletedQuery::Complete,
+ AsWeakPtr()));
+
+ return AddToPendingTransferQueue(submit_count);
+}
+
+void AsyncReadPixelsCompletedQuery::Complete() {
+ MarkAsCompleted(1);
+}
+
+bool AsyncReadPixelsCompletedQuery::Process() {
+ return !pending();
+}
+
+void AsyncReadPixelsCompletedQuery::Destroy(bool /* have_context */) {
+ if (!IsDeleted()) {
+ MarkAsDeleted();
+ }
+}
+
+AsyncReadPixelsCompletedQuery::~AsyncReadPixelsCompletedQuery() {
+}
+
+
class GetErrorQuery : public QueryManager::Query {
public:
GetErrorQuery(
@@ -345,6 +396,10 @@ QueryManager::Query* QueryManager::CreateQuery(
query = new AsyncPixelTransfersCompletedQuery(
this, target, shm_id, shm_offset);
break;
+ case GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM:
+ query = new AsyncReadPixelsCompletedQuery(
+ this, target, shm_id, shm_offset);
+ break;
case GL_GET_ERROR_QUERY_CHROMIUM:
query = new GetErrorQuery(this, target, shm_id, shm_offset);
break;
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698