OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "gpu/command_buffer/service/feature_info.h" | 12 #include "gpu/command_buffer/service/feature_info.h" |
13 #include "gpu/command_buffer/service/gl_utils.h" | 13 #include "gpu/command_buffer/service/gl_utils.h" |
14 #include "gpu/gpu_export.h" | 14 #include "gpu/gpu_export.h" |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 namespace gles2 { | 17 namespace gles2 { |
18 | 18 |
19 class GLES2Decoder; | 19 class GLES2Decoder; |
20 | 20 |
21 enum SupportedCopyMethodByFormat { | |
Ken Russell (switch to Gerrit)
2016/12/07 06:38:01
Could we choose another name for this enum? Perhap
qiankun
2016/12/10 00:12:40
Done.
| |
22 DIRECT_COPY, | |
Ken Russell (switch to Gerrit)
2016/12/07 06:38:02
Could you please add a one-line comment documentin
qiankun
2016/12/10 00:12:40
Done.
| |
23 DIRECT_DRAW, | |
Ken Russell (switch to Gerrit)
2016/12/07 06:38:02
Could you mention that this draws from the source
qiankun
2016/12/10 00:12:40
Done.
| |
24 DRAW_AND_COPY, | |
Ken Russell (switch to Gerrit)
2016/12/07 06:38:01
Could you mention that this draws to an intermedia
qiankun
2016/12/10 00:12:40
Done.
| |
25 NONE_COPY | |
Ken Russell (switch to Gerrit)
2016/12/07 06:38:02
Perhaps NOT_COPYABLE?
qiankun
2016/12/10 00:12:40
Done.
| |
26 }; | |
27 | |
21 // This class encapsulates the resources required to implement the | 28 // This class encapsulates the resources required to implement the |
22 // GL_CHROMIUM_copy_texture extension. The copy operation is performed | 29 // GL_CHROMIUM_copy_texture extension. The copy operation is performed |
23 // via glCopyTexImage2D() or a blit to a framebuffer object. | 30 // via glCopyTexImage2D() or a blit to a framebuffer object. |
24 // The target of |dest_id| texture must be GL_TEXTURE_2D. | 31 // The target of |dest_id| texture must be GL_TEXTURE_2D. |
25 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { | 32 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { |
26 public: | 33 public: |
27 CopyTextureCHROMIUMResourceManager(); | 34 CopyTextureCHROMIUMResourceManager(); |
28 ~CopyTextureCHROMIUMResourceManager(); | 35 ~CopyTextureCHROMIUMResourceManager(); |
29 | 36 |
30 void Initialize(const gles2::GLES2Decoder* decoder, | 37 void Initialize(const gles2::GLES2Decoder* decoder, |
31 const gles2::FeatureInfo::FeatureFlags& feature_flags); | 38 const gles2::FeatureInfo::FeatureFlags& feature_flags); |
32 void Destroy(); | 39 void Destroy(); |
33 | 40 |
34 void DoCopyTexture(const gles2::GLES2Decoder* decoder, | 41 void DoCopyTexture(const gles2::GLES2Decoder* decoder, |
35 GLenum source_target, | 42 GLenum source_target, |
36 GLuint source_id, | 43 GLuint source_id, |
37 GLenum source_internal_format, | 44 GLenum source_internal_format, |
38 GLenum dest_target, | 45 GLenum dest_target, |
39 GLuint dest_id, | 46 GLuint dest_id, |
40 GLenum dest_internal_format, | 47 GLenum dest_internal_format, |
41 GLsizei width, | 48 GLsizei width, |
42 GLsizei height, | 49 GLsizei height, |
43 bool flip_y, | 50 bool flip_y, |
44 bool premultiply_alpha, | 51 bool premultiply_alpha, |
45 bool unpremultiply_alpha); | 52 bool unpremultiply_alpha, |
53 SupportedCopyMethodByFormat method); | |
46 | 54 |
47 void DoCopySubTexture(const gles2::GLES2Decoder* decoder, | 55 void DoCopySubTexture(const gles2::GLES2Decoder* decoder, |
48 GLenum source_target, | 56 GLenum source_target, |
49 GLuint source_id, | 57 GLuint source_id, |
50 GLenum source_internal_format, | 58 GLenum source_internal_format, |
51 GLenum dest_target, | 59 GLenum dest_target, |
52 GLuint dest_id, | 60 GLuint dest_id, |
53 GLenum dest_internal_format, | 61 GLenum dest_internal_format, |
54 GLint xoffset, | 62 GLint xoffset, |
55 GLint yoffset, | 63 GLint yoffset, |
56 GLint x, | 64 GLint x, |
57 GLint y, | 65 GLint y, |
58 GLsizei width, | 66 GLsizei width, |
59 GLsizei height, | 67 GLsizei height, |
60 GLsizei dest_width, | 68 GLsizei dest_width, |
61 GLsizei dest_height, | 69 GLsizei dest_height, |
62 GLsizei source_width, | 70 GLsizei source_width, |
63 GLsizei source_height, | 71 GLsizei source_height, |
64 bool flip_y, | 72 bool flip_y, |
65 bool premultiply_alpha, | 73 bool premultiply_alpha, |
66 bool unpremultiply_alpha); | 74 bool unpremultiply_alpha, |
75 SupportedCopyMethodByFormat method); | |
67 | 76 |
68 void DoCopySubTextureWithTransform(const gles2::GLES2Decoder* decoder, | 77 void DoCopySubTextureWithTransform(const gles2::GLES2Decoder* decoder, |
69 GLenum source_target, | 78 GLenum source_target, |
70 GLuint source_id, | 79 GLuint source_id, |
71 GLenum source_internal_format, | 80 GLenum source_internal_format, |
72 GLenum dest_target, | 81 GLenum dest_target, |
73 GLuint dest_id, | 82 GLuint dest_id, |
74 GLenum dest_internal_format, | 83 GLenum dest_internal_format, |
75 GLint xoffset, | 84 GLint xoffset, |
76 GLint yoffset, | 85 GLint yoffset, |
(...skipping 10 matching lines...) Expand all Loading... | |
87 bool unpremultiply_alpha, | 96 bool unpremultiply_alpha, |
88 const GLfloat transform_matrix[16]); | 97 const GLfloat transform_matrix[16]); |
89 | 98 |
90 // This will apply a transform on the texture coordinates before sampling | 99 // This will apply a transform on the texture coordinates before sampling |
91 // the source texture and copying to the destination texture. The transform | 100 // the source texture and copying to the destination texture. The transform |
92 // matrix should be given in column-major form, so it can be passed | 101 // matrix should be given in column-major form, so it can be passed |
93 // directly to GL. | 102 // directly to GL. |
94 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, | 103 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, |
95 GLenum source_target, | 104 GLenum source_target, |
96 GLuint source_id, | 105 GLuint source_id, |
106 GLenum source_format, | |
97 GLenum dest_target, | 107 GLenum dest_target, |
98 GLuint dest_id, | 108 GLuint dest_id, |
109 GLenum dest_format, | |
99 GLsizei width, | 110 GLsizei width, |
100 GLsizei height, | 111 GLsizei height, |
101 bool flip_y, | 112 bool flip_y, |
102 bool premultiply_alpha, | 113 bool premultiply_alpha, |
103 bool unpremultiply_alpha, | 114 bool unpremultiply_alpha, |
104 const GLfloat transform_matrix[16]); | 115 const GLfloat transform_matrix[16]); |
105 | 116 |
106 // The attributes used during invocation of the extension. | 117 // The attributes used during invocation of the extension. |
107 static const GLuint kVertexPositionAttrib = 0; | 118 static const GLuint kVertexPositionAttrib = 0; |
108 | 119 |
(...skipping 20 matching lines...) Expand all Loading... | |
129 GLuint vertex_source_mult_handle; | 140 GLuint vertex_source_mult_handle; |
130 GLuint vertex_source_add_handle; | 141 GLuint vertex_source_add_handle; |
131 | 142 |
132 GLuint tex_coord_transform_handle; | 143 GLuint tex_coord_transform_handle; |
133 GLuint sampler_handle; | 144 GLuint sampler_handle; |
134 }; | 145 }; |
135 | 146 |
136 void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder, | 147 void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder, |
137 GLenum source_target, | 148 GLenum source_target, |
138 GLuint source_id, | 149 GLuint source_id, |
150 GLenum source_format, | |
139 GLenum dest_target, | 151 GLenum dest_target, |
140 GLuint dest_id, | 152 GLuint dest_id, |
153 GLenum dest_format, | |
141 GLint xoffset, | 154 GLint xoffset, |
142 GLint yoffset, | 155 GLint yoffset, |
143 GLint x, | 156 GLint x, |
144 GLint y, | 157 GLint y, |
145 GLsizei width, | 158 GLsizei width, |
146 GLsizei height, | 159 GLsizei height, |
147 GLsizei dest_width, | 160 GLsizei dest_width, |
148 GLsizei dest_height, | 161 GLsizei dest_height, |
149 GLsizei source_width, | 162 GLsizei source_width, |
150 GLsizei source_height, | 163 GLsizei source_height, |
(...skipping 14 matching lines...) Expand all Loading... | |
165 GLuint buffer_id_; | 178 GLuint buffer_id_; |
166 GLuint framebuffer_; | 179 GLuint framebuffer_; |
167 | 180 |
168 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); | 181 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); |
169 }; | 182 }; |
170 | 183 |
171 } // namespace gles2 | 184 } // namespace gles2 |
172 } // namespace gpu | 185 } // namespace gpu |
173 | 186 |
174 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 187 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
OLD | NEW |