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

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

Issue 1974163003: Expose GpuMemoryBufferId through glGetImageivCHROMIUM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 7 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/in_process_command_buffer.h ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/in_process_command_buffer.cc
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 5184f76df5d56c65378a45282046d3633527aee5..ad390a937986099b237619505d8246ef7c6c4769 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -682,6 +682,9 @@ int32_t InProcessCommandBuffer::CreateImage(ClientBuffer buffer,
DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
internalformat, gpu_memory_buffer->GetFormat()));
+ DCHECK(image_gmb_ids_map_.find(new_id) == image_gmb_ids_map_.end());
+ image_gmb_ids_map_[new_id] = gpu_memory_buffer->GetId().id;
+
// This handle is owned by the GPU thread and must be passed to it or it
// will leak. In otherwords, do not early out on error between here and the
// queuing of the CreateImage task below.
@@ -786,6 +789,10 @@ void InProcessCommandBuffer::CreateImageOnGpuThread(
void InProcessCommandBuffer::DestroyImage(int32_t id) {
CheckSequencedThread();
+ auto it = image_gmb_ids_map_.find(id);
+ if (it != image_gmb_ids_map_.end())
+ image_gmb_ids_map_.erase(it);
+
QueueTask(base::Bind(&InProcessCommandBuffer::DestroyImageOnGpuThread,
base::Unretained(this),
id));
@@ -824,6 +831,14 @@ int32_t InProcessCommandBuffer::CreateGpuMemoryBufferImage(
return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
}
+int32_t InProcessCommandBuffer::GetImageGpuMemoryBufferId(unsigned image_id) {
+ CheckSequencedThread();
+ auto it = image_gmb_ids_map_.find(image_id);
+ if (it != image_gmb_ids_map_.end())
+ return it->second;
+ return -1;
+}
+
void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) {
DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release));
gles2::MailboxManager* mailbox_manager =
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698