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

Unified Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 1168853002: Use mapped memory for uploading large textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Same fix for TexImage3D, also share uploading code. 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: gpu/command_buffer/client/mapped_memory.cc
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index 6d57af4ed57204e62156f215d3af59143b658da7..4332d89f5fdb9b2c554e5cf52d1d0635968d9261 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -140,4 +140,26 @@ void MappedMemoryManager::FreeUnused() {
}
}
+void ScopedMappedMemoryPtr::Release() {
+ if (buffer_) {
+ mapped_memory_manager_->FreePendingToken(buffer_, helper_->InsertToken());
+ buffer_ = nullptr;
+ size_ = 0;
+ shm_id_ = 0;
+ shm_offset_ = 0;
+
+ if (flush_after_release_)
+ helper_->CommandBufferHelper::Flush();
+ }
+}
+
+void ScopedMappedMemoryPtr::Reset(unsigned int new_size) {
+ Release();
+
+ if (new_size) {
+ buffer_ = mapped_memory_manager_->Alloc(size_, &shm_id_, &shm_offset_);
+ size_ = buffer_ ? new_size : 0;
+ }
+}
+
} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698