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

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: revert gl_in_process_context.cc, deal with out-of-order callbacks in gl_helper.cc 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..e6468d5ba9aa576f52277f44edfec8b76f4e8979 100644
--- a/gpu/command_buffer/service/query_manager.cc
+++ b/gpu/command_buffer/service/query_manager.cc
@@ -179,9 +179,6 @@ class AsyncPixelTransfersCompletedQuery
virtual bool Process() OVERRIDE;
virtual void Destroy(bool have_context) OVERRIDE;
- protected:
- virtual ~AsyncPixelTransfersCompletedQuery();
-
static void MarkAsCompletedThreadSafe(
uint32 submit_count, const AsyncMemoryParams& mem_params) {
DCHECK(mem_params.shared_memory);
@@ -195,6 +192,10 @@ class AsyncPixelTransfersCompletedQuery
base::subtle::MemoryBarrier();
sync->process_count = submit_count;
}
+
+ protected:
+ virtual ~AsyncPixelTransfersCompletedQuery();
piman 2013/07/01 22:24:08 nit: it looks like you didn't end up needing chang
hubbe 2013/07/01 22:34:41 Done.
+
};
AsyncPixelTransfersCompletedQuery::AsyncPixelTransfersCompletedQuery(
@@ -223,9 +224,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 +254,59 @@ void AsyncPixelTransfersCompletedQuery::Destroy(bool /* have_context */) {
AsyncPixelTransfersCompletedQuery::~AsyncPixelTransfersCompletedQuery() {
}
+///////////////////
+class AsyncReadPixelsCompletedQuery
+ : public QueryManager::Query
+ , public base::SupportsWeakPtr<AsyncReadPixelsCompletedQuery> {
piman 2013/07/01 22:24:08 nit: , on previous line.
hubbe 2013/07/01 22:34:41 Done.
+ 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 +398,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;

Powered by Google App Engine
This is Rietveld 408576698