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

Unified Diff: gpu/ipc/service/gpu_memory_buffer_factory_win.cc

Issue 2970353002: Add GpuMemoryBuffer support for DXGI handles.
Patch Set: update build config Created 3 years, 4 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/ipc/service/gpu_memory_buffer_factory_win.h ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_memory_buffer_factory_win.cc
diff --git a/gpu/ipc/service/gpu_memory_buffer_factory_win.cc b/gpu/ipc/service/gpu_memory_buffer_factory_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..706fd83ee483d311b4ba7f062821e446e09a6a4d
--- /dev/null
+++ b/gpu/ipc/service/gpu_memory_buffer_factory_win.cc
@@ -0,0 +1,71 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/ipc/service/gpu_memory_buffer_factory_win.h"
+
+#include "ui/gl/gl_image_dxgi.h"
+
+namespace gpu {
+
+GpuMemoryBufferFactoryWin::GpuMemoryBufferFactoryWin() {}
+
+GpuMemoryBufferFactoryWin::~GpuMemoryBufferFactoryWin() {}
+
+gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryWin::CreateGpuMemoryBuffer(
+ gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ gfx::BufferUsage usage,
+ int client_id,
+ SurfaceHandle surface_handle) {
+ NOTIMPLEMENTED();
+ return gfx::GpuMemoryBufferHandle();
+}
+
+void GpuMemoryBufferFactoryWin::DestroyGpuMemoryBuffer(
+ gfx::GpuMemoryBufferId id,
+ int client_id) {
+ // The buffer is deleted when all references to the handle are destroyed.
+}
+
+ImageFactory* GpuMemoryBufferFactoryWin::AsImageFactory() {
+ return this;
+}
+
+// Overridden from ImageFactory:
+scoped_refptr<gl::GLImage>
+GpuMemoryBufferFactoryWin::CreateImageForGpuMemoryBuffer(
+ const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ unsigned internalformat,
+ int client_id,
+ SurfaceHandle surface_handle) {
+ if (handle.type != gfx::DXGI_HANDLE)
+ return nullptr;
+ base::win::ScopedHandle raw_handle(handle.handle.GetHandle());
+ scoped_refptr<gl::GLImageDXGIHandle> image(new gl::GLImageDXGIHandle(
+ size, std::move(raw_handle), handle.array_level));
+ if (!image->Initialize())
+ return nullptr;
+ return image;
+}
+
+scoped_refptr<gl::GLImage> GpuMemoryBufferFactoryWin::CreateAnonymousImage(
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ unsigned internalformat) {
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+unsigned GpuMemoryBufferFactoryWin::RequiredTextureType() {
+ return 0;
+}
+
+bool GpuMemoryBufferFactoryWin::SupportsFormatRGB() {
+ return false;
+}
+
+} // namespace gpu
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory_win.h ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698