| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_win.h" |
| 6 |
| 7 #include "ui/gl/gl_image_dxgi.h" |
| 8 |
| 9 namespace gpu { |
| 10 |
| 11 GpuMemoryBufferFactoryWin::GpuMemoryBufferFactoryWin() {} |
| 12 |
| 13 GpuMemoryBufferFactoryWin::~GpuMemoryBufferFactoryWin() {} |
| 14 |
| 15 gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryWin::CreateGpuMemoryBuffer( |
| 16 gfx::GpuMemoryBufferId id, |
| 17 const gfx::Size& size, |
| 18 gfx::BufferFormat format, |
| 19 gfx::BufferUsage usage, |
| 20 int client_id, |
| 21 SurfaceHandle surface_handle) { |
| 22 NOTIMPLEMENTED(); |
| 23 return gfx::GpuMemoryBufferHandle(); |
| 24 } |
| 25 |
| 26 void GpuMemoryBufferFactoryWin::DestroyGpuMemoryBuffer( |
| 27 gfx::GpuMemoryBufferId id, |
| 28 int client_id) { |
| 29 // The buffer is deleted when all references to the handle are destroyed. |
| 30 } |
| 31 |
| 32 ImageFactory* GpuMemoryBufferFactoryWin::AsImageFactory() { |
| 33 return this; |
| 34 } |
| 35 |
| 36 // Overridden from ImageFactory: |
| 37 scoped_refptr<gl::GLImage> |
| 38 GpuMemoryBufferFactoryWin::CreateImageForGpuMemoryBuffer( |
| 39 const gfx::GpuMemoryBufferHandle& handle, |
| 40 const gfx::Size& size, |
| 41 gfx::BufferFormat format, |
| 42 unsigned internalformat, |
| 43 int client_id, |
| 44 SurfaceHandle surface_handle) { |
| 45 if (handle.type != gfx::DXGI_HANDLE) |
| 46 return nullptr; |
| 47 base::win::ScopedHandle raw_handle(handle.handle.GetHandle()); |
| 48 scoped_refptr<gl::GLImageDXGIHandle> image(new gl::GLImageDXGIHandle( |
| 49 size, std::move(raw_handle), handle.array_level)); |
| 50 if (!image->Initialize()) |
| 51 return nullptr; |
| 52 return image; |
| 53 } |
| 54 |
| 55 scoped_refptr<gl::GLImage> GpuMemoryBufferFactoryWin::CreateAnonymousImage( |
| 56 const gfx::Size& size, |
| 57 gfx::BufferFormat format, |
| 58 unsigned internalformat) { |
| 59 NOTIMPLEMENTED(); |
| 60 return nullptr; |
| 61 } |
| 62 |
| 63 unsigned GpuMemoryBufferFactoryWin::RequiredTextureType() { |
| 64 return 0; |
| 65 } |
| 66 |
| 67 bool GpuMemoryBufferFactoryWin::SupportsFormatRGB() { |
| 68 return false; |
| 69 } |
| 70 |
| 71 } // namespace gpu |
| OLD | NEW |