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 CopyTextureMethod { | 21 enum CopyTextureMethod { |
22 // Use CopyTex{Sub}Image2D to copy from the source to the destination. | 22 // Use CopyTex{Sub}Image2D to copy from the source to the destination. |
23 DIRECT_COPY, | 23 DIRECT_COPY, |
24 // Draw from the source to the destination texture. | 24 // Draw from the source to the destination texture. |
25 DIRECT_DRAW, | 25 DIRECT_DRAW, |
26 // Draw to an intermediate texture, and then copy to the destination texture. | 26 // Draw to an intermediate texture, and then copy to the destination texture. |
27 DRAW_AND_COPY, | 27 DRAW_AND_COPY, |
| 28 // Draw to an intermediate texture in RGBA format, read back pixels in the |
| 29 // intermediate texture from GPU to CPU, and then upload to the destination |
| 30 // texture. |
| 31 DRAW_AND_READBACK, |
28 // CopyTexture isn't available. | 32 // CopyTexture isn't available. |
29 NOT_COPYABLE | 33 NOT_COPYABLE |
30 }; | 34 }; |
31 | 35 |
32 // TODOs(qiankun.miao@intel.com): | 36 // TODOs(qiankun.miao@intel.com): |
33 // 1. Add readback path for RGB9_E5 and float formats (if extension isn't | 37 // 1. Add readback path for RGB9_E5 and float formats (if extension isn't |
34 // available and they are not color-renderable). | 38 // available and they are not color-renderable). |
35 // 2. Support faces of cube map texture as valid dest target. The cube map | 39 // 2. Support GL_TEXTURE_3D as valid dest_target. |
36 // texture may be incomplete currently. | 40 // 3. Support ALPHA, LUMINANCE and LUMINANCE_ALPHA formats on core profile. |
37 // 3. Add support for levels other than 0. | |
38 // 4. Support ALPHA, LUMINANCE and LUMINANCE_ALPHA formats on core profile. | |
39 // 5. Update the extension doc after the whole work is done | |
40 // in gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt. We probably | |
41 // will need a ES2 version and a ES3 version. | |
42 | 41 |
43 // This class encapsulates the resources required to implement the | 42 // This class encapsulates the resources required to implement the |
44 // GL_CHROMIUM_copy_texture extension. The copy operation is performed | 43 // GL_CHROMIUM_copy_texture extension. The copy operation is performed |
45 // via glCopyTexImage2D() or a blit to a framebuffer object. | 44 // via glCopyTexImage2D() or a blit to a framebuffer object. |
46 // The target of |dest_id| texture must be GL_TEXTURE_2D. | 45 // The target of |dest_id| texture must be GL_TEXTURE_2D. |
47 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { | 46 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { |
48 public: | 47 public: |
49 CopyTextureCHROMIUMResourceManager(); | 48 CopyTextureCHROMIUMResourceManager(); |
50 ~CopyTextureCHROMIUMResourceManager(); | 49 ~CopyTextureCHROMIUMResourceManager(); |
51 | 50 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 GLuint buffer_id_; | 202 GLuint buffer_id_; |
204 GLuint framebuffer_; | 203 GLuint framebuffer_; |
205 | 204 |
206 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); | 205 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); |
207 }; | 206 }; |
208 | 207 |
209 } // namespace gles2 | 208 } // namespace gles2 |
210 } // namespace gpu | 209 } // namespace gpu |
211 | 210 |
212 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 211 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
OLD | NEW |