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

Side by Side Diff: gpu/command_buffer/service/image_factory.h

Issue 962723002: Change CHROMIUM_image declarations to support multi planar input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Trybot issues fixed. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 struct Capabilities; 18 struct Capabilities;
19 19
20 class GPU_EXPORT ImageFactory { 20 class GPU_EXPORT ImageFactory {
21 public: 21 public:
22 ImageFactory(); 22 ImageFactory();
23 23
24 // Returns a valid GpuMemoryBuffer format given a valid internalformat as 24 // Returns the number of GpuMemoryBuffers used when given a valid
25 // defined by CHROMIUM_gpu_memory_buffer_image. 25 // |internalformat| as defined by CHROMIUM_gpu_memory_buffer_image.
26 static int GpuMemoryBufferCountForImageFormat(unsigned internalformat);
reveman 2015/03/12 19:37:23 size_t as return type? And how about renaming this
emircan 2015/03/12 22:34:26 Done.
27
28 // Returns a valid GpuMemoryBuffer format given a valid |internalformat| as
29 // defined by CHROMIUM_gpu_memory_buffer_image, and |buffer_index|
30 // representing the zero-based index of the buffer in a multiple planar
31 // format.
26 static gfx::GpuMemoryBuffer::Format ImageFormatToGpuMemoryBufferFormat( 32 static gfx::GpuMemoryBuffer::Format ImageFormatToGpuMemoryBufferFormat(
27 unsigned internalformat); 33 unsigned internalformat,
34 int buffer_index);
reveman 2015/03/12 19:37:23 "size_t plane"?
emircan 2015/03/12 22:34:26 Done.
28 35
29 // Returns a valid GpuMemoryBuffer usage given a valid usage as defined by 36 // Returns a valid GpuMemoryBuffer usage given a valid usage as defined by
30 // CHROMIUM_gpu_memory_buffer_image. 37 // CHROMIUM_gpu_memory_buffer_image.
31 static gfx::GpuMemoryBuffer::Usage ImageUsageToGpuMemoryBufferUsage( 38 static gfx::GpuMemoryBuffer::Usage ImageUsageToGpuMemoryBufferUsage(
32 unsigned usage); 39 unsigned usage);
33 40
34 // Returns true if |internalformat| is compatible with |format|. 41 // Returns true if |internalformat| is compatible with |format|.
35 static bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( 42 static bool IsImageFormatCompatibleWithGpuMemoryBufferFormat(
36 unsigned internalformat, 43 unsigned internalformat,
44 int buffer_index,
reveman 2015/03/12 19:37:23 size_t plane
emircan 2015/03/12 22:34:26 Done.
37 gfx::GpuMemoryBuffer::Format format); 45 gfx::GpuMemoryBuffer::Format format);
38 46
39 // Returns true if |format| is supported by |capabilities|. 47 // Returns true if |format| is supported by |capabilities|.
40 static bool IsGpuMemoryBufferFormatSupported( 48 static bool IsGpuMemoryBufferFormatSupported(
41 gfx::GpuMemoryBuffer::Format format, 49 gfx::GpuMemoryBuffer::Format format,
42 const Capabilities& capabilities); 50 const Capabilities& capabilities);
43 51
44 // Returns true if |size| is valid for |format|. 52 // Returns true if |size| is valid for |format|.
45 static bool IsImageSizeValidForGpuMemoryBufferFormat( 53 static bool IsImageSizeValidForGpuMemoryBufferFormat(
46 const gfx::Size& size, 54 const gfx::Size& size,
47 gfx::GpuMemoryBuffer::Format format); 55 gfx::GpuMemoryBuffer::Format format);
48 56
49 // Creates a GLImage instance for GPU memory buffer identified by |handle|. 57 // Creates a GLImage instance for GPU memory buffer identified by |handle|.
50 // |client_id| should be set to the client requesting the creation of instance 58 // |client_id| should be set to the client requesting the creation of instance
51 // and can be used by factory implementation to verify access rights. 59 // and can be used by factory implementation to verify access rights.
52 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( 60 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffers(
53 const gfx::GpuMemoryBufferHandle& handle, 61 const std::vector<gfx::GpuMemoryBufferHandle>& handles,
54 const gfx::Size& size, 62 const gfx::Size& size,
55 gfx::GpuMemoryBuffer::Format format, 63 const std::vector<gfx::GpuMemoryBuffer::Format>& formats,
56 unsigned internalformat, 64 unsigned internalformat,
57 int client_id) = 0; 65 int client_id) = 0;
58 66
59 protected: 67 protected:
60 virtual ~ImageFactory(); 68 virtual ~ImageFactory();
61 }; 69 };
62 70
63 } // namespace gpu 71 } // namespace gpu
64 72
65 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ 73 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698