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

Unified Diff: gpu/command_buffer/tests/gl_manager.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/tests/gl_manager.h ('k') | gpu/gles2_conform_support/egl/context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_manager.cc
diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc
index bd86e5e8c5f2bfe9f4b9caa418d97f21bbf3eb1b..cf07ea04123d7a67aa173ce663965fb7910705c9 100644
--- a/gpu/command_buffer/tests/gl_manager.cc
+++ b/gpu/command_buffer/tests/gl_manager.cc
@@ -147,7 +147,6 @@ class IOSurfaceGpuMemoryBuffer : public gfx::GpuMemoryBuffer {
return IOSurfaceGetWidthOfPlane(iosurface_, plane);
}
gfx::GpuMemoryBufferId GetId() const override {
- NOTREACHED();
return gfx::GpuMemoryBufferId(0);
}
gfx::GpuMemoryBufferHandle GetHandle() const override {
@@ -516,6 +515,7 @@ int32_t GLManager::CreateImage(ClientBuffer buffer,
gfx::Size size(width, height);
scoped_refptr<gl::GLImage> gl_image;
+ int gmb_id = -1;
#if defined(OS_MACOSX)
if (use_iosurface_memory_buffers_) {
IOSurfaceGpuMemoryBuffer* gpu_memory_buffer =
@@ -528,6 +528,7 @@ int32_t GLManager::CreateImage(ClientBuffer buffer,
return -1;
}
gl_image = image;
+ gmb_id = gpu_memory_buffer->GetId().id;
}
#endif // defined(OS_MACOSX)
if (!gl_image) {
@@ -548,6 +549,12 @@ int32_t GLManager::CreateImage(ClientBuffer buffer,
gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
DCHECK(image_manager);
image_manager->AddImage(gl_image.get(), new_id);
+
+ if (gmb_id != -1) {
+ DCHECK(image_gmb_ids_map_.find(new_id) == image_gmb_ids_map_.end());
+ image_gmb_ids_map_[new_id] = gmb_id;
+ }
+
return new_id;
}
@@ -561,7 +568,18 @@ int32_t GLManager::CreateGpuMemoryBufferImage(size_t width,
return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
}
+int32_t GLManager::GetImageGpuMemoryBufferId(unsigned image_id) {
+ auto it = image_gmb_ids_map_.find(image_id);
+ if (it != image_gmb_ids_map_.end())
+ return it->second;
+ return -1;
+}
+
void GLManager::DestroyImage(int32_t id) {
+ auto it = image_gmb_ids_map_.find(id);
+ if (it != image_gmb_ids_map_.end())
+ image_gmb_ids_map_.erase(it);
+
gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
DCHECK(image_manager);
image_manager->RemoveImage(id);
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/gles2_conform_support/egl/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698