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

Unified Diff: cc/resources/resource_provider.cc

Issue 1157943004: cc: [WIP] Use worker context and OrderingBarrierCHROMIUM for one-copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle sync while copying texture. 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: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 449e04be23750e28d015ef04a50014eee0977f00..bed47f4ac69607672d8082b602e5e91cea528dbf 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -207,48 +207,30 @@ class BufferIdAllocator : public IdAllocator {
DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator);
};
-// Query object based fence implementation used to detect completion of copy
-// texture operations. Fence has passed when query result is available.
-class CopyTextureFence : public ResourceProvider::Fence {
- public:
- CopyTextureFence(gpu::gles2::GLES2Interface* gl, unsigned query_id)
- : gl_(gl), query_id_(query_id) {}
-
- // Overridden from ResourceProvider::Fence:
- void Set() override {}
- bool HasPassed() override {
- unsigned available = 1;
- gl_->GetQueryObjectuivEXT(
- query_id_, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
- if (!available)
- return false;
+} // namespace
- ProcessResult();
- return true;
+bool ResourceProvider::CopyTextureFence::HasPassed() {
+ unsigned available = 1;
+ gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_AVAILABLE_EXT,
+ &available);
+ if (!available)
+ return false;
+
+ ProcessResult();
+ return true;
}
- void Wait() override {
+ void ResourceProvider::CopyTextureFence::Wait() {
// ProcessResult() will wait for result to become available.
ProcessResult();
}
- private:
- ~CopyTextureFence() override {}
-
- void ProcessResult() {
+ void ResourceProvider::CopyTextureFence::ProcessResult() {
unsigned time_elapsed_us = 0;
gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &time_elapsed_us);
UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.CopyTextureLatency", time_elapsed_us,
0, 256000, 50);
}
- gpu::gles2::GLES2Interface* gl_;
- unsigned query_id_;
-
- DISALLOW_COPY_AND_ASSIGN(CopyTextureFence);
-};
-
-} // namespace
-
ResourceProvider::Resource::~Resource() {}
ResourceProvider::Resource::Resource(GLuint texture_id,

Powered by Google App Engine
This is Rietveld 408576698