Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "gpu/gpu_export.h" | 9 #include "gpu/gpu_export.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/gfx/gpu_memory_buffer.h" | 11 #include "ui/gfx/gpu_memory_buffer.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class GLImage; | 14 class GLImage; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace gpu { | 17 namespace gpu { |
| 18 | 18 |
| 19 class GPU_EXPORT ImageFactory { | 19 class GPU_EXPORT ImageFactory { |
| 20 public: | 20 public: |
| 21 ImageFactory(); | 21 ImageFactory(); |
| 22 | 22 |
| 23 // Returns a valid GpuMemoryBuffer format given a valid internalformat as | 23 // Returns the number of GpuMemoryBuffers used when given a valid |
| 24 // defined by CHROMIUM_gpu_memory_buffer_image. | 24 // |internalformat| as defined by CHROMIUM_gpu_memory_buffer_image. |
| 25 static gfx::GpuMemoryBuffer::Format ImageFormatToGpuMemoryBufferFormat( | 25 static int GpuMemoryBufferCountForImageFormat(unsigned internalformat); |
| 26 unsigned internalformat); | 26 |
| 27 // Fills a vector of valid GpuMemoryBuffer formats in |formats| when given a | |
| 28 // valid |internalformat| as defined by CHROMIUM_gpu_memory_buffer_image. | |
| 29 static void ImageFormatToGpuMemoryBufferFormats( | |
| 30 unsigned internalformat, | |
| 31 std::vector<gfx::GpuMemoryBuffer::Format>* formats); | |
| 27 | 32 |
| 28 // Returns a valid GpuMemoryBuffer usage given a valid usage as defined by | 33 // Returns a valid GpuMemoryBuffer usage given a valid usage as defined by |
| 29 // CHROMIUM_gpu_memory_buffer_image. | 34 // CHROMIUM_gpu_memory_buffer_image. |
| 30 static gfx::GpuMemoryBuffer::Usage ImageUsageToGpuMemoryBufferUsage( | 35 static gfx::GpuMemoryBuffer::Usage ImageUsageToGpuMemoryBufferUsage( |
| 31 unsigned usage); | 36 unsigned usage); |
| 32 | 37 |
| 33 // Returns true if |internalformat| is compatible with |format|. | 38 // Returns true if |internalformat| is compatible with |format|. |
| 34 static bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 39 static bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
|
reveman
2015/03/05 19:35:32
Doesn't this need a buffer index or something? How
emircan
2015/03/09 21:07:22
I was initially thinking the ordering of the buffe
| |
| 35 unsigned internalformat, | 40 unsigned internalformat, |
| 36 gfx::GpuMemoryBuffer::Format format); | 41 gfx::GpuMemoryBuffer::Format format); |
| 37 | 42 |
| 38 // Creates a GLImage instance for GPU memory buffer identified by |handle|. | 43 // Creates a GLImage instance for GPU memory buffer identified by |handle|. |
| 39 // |client_id| should be set to the client requesting the creation of instance | 44 // |client_id| should be set to the client requesting the creation of instance |
| 40 // and can be used by factory implementation to verify access rights. | 45 // and can be used by factory implementation to verify access rights. |
| 41 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 46 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
|
reveman
2015/03/05 19:35:32
CreateImageForGpuMemoryBuffers
emircan
2015/03/09 21:07:23
Done. Sorry for missing that.
| |
| 42 const gfx::GpuMemoryBufferHandle& handle, | 47 const std::vector<gfx::GpuMemoryBufferHandle>& handles, |
| 43 const gfx::Size& size, | 48 const gfx::Size& size, |
| 44 gfx::GpuMemoryBuffer::Format format, | 49 const std::vector<gfx::GpuMemoryBuffer::Format>& formats, |
| 45 unsigned internalformat, | 50 unsigned internalformat, |
| 46 int client_id) = 0; | 51 int client_id) = 0; |
| 47 | 52 |
| 48 protected: | 53 protected: |
| 49 virtual ~ImageFactory(); | 54 virtual ~ImageFactory(); |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 } // namespace gpu | 57 } // namespace gpu |
| 53 | 58 |
| 54 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ | 59 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ |
| OLD | NEW |