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 "gpu/command_buffer/service/gl_utils.h" | 11 #include "gpu/command_buffer/service/gl_utils.h" |
12 #include "gpu/gpu_export.h" | 12 #include "gpu/gpu_export.h" |
13 | 13 |
14 namespace gpu { | 14 namespace gpu { |
15 namespace gles2 { | 15 namespace gles2 { |
16 | 16 |
17 class GLES2Decoder; | 17 class GLES2Decoder; |
18 | 18 |
19 } // namespace gles2. | 19 } // namespace gles2. |
20 | 20 |
21 // This class encapsulates the resources required to implement the | 21 // This class encapsulates the resources required to implement the |
22 // GL_CHROMIUM_copy_texture extension. The copy operation is performed | 22 // GL_CHROMIUM_copy_texture extension. The copy operation is performed |
23 // via a blit to a framebuffer object. | 23 // via glCopyTexImage2D() or a blit to a framebuffer object. |
| 24 // The target of |dest_id| texture must be GL_TEXTURE_2D. |
24 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { | 25 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { |
25 public: | 26 public: |
26 CopyTextureCHROMIUMResourceManager(); | 27 CopyTextureCHROMIUMResourceManager(); |
27 ~CopyTextureCHROMIUMResourceManager(); | 28 ~CopyTextureCHROMIUMResourceManager(); |
28 | 29 |
29 void Initialize(const gles2::GLES2Decoder* decoder); | 30 void Initialize(const gles2::GLES2Decoder* decoder); |
30 void Destroy(); | 31 void Destroy(); |
31 | 32 |
32 void DoCopyTexture(const gles2::GLES2Decoder* decoder, GLenum source_target, | 33 void DoCopyTexture(const gles2::GLES2Decoder* decoder, |
33 GLenum dest_target, GLuint source_id, GLuint dest_id, | 34 GLenum source_target, |
34 GLint level, GLsizei width, GLsizei height, | 35 GLuint source_id, |
35 bool flip_y, bool premultiply_alpha, | 36 GLenum source_internal_format, |
| 37 GLuint dest_id, |
| 38 GLint dest_level, |
| 39 GLenum dest_internal_format, |
| 40 GLsizei width, |
| 41 GLsizei height, |
| 42 bool flip_y, |
| 43 bool premultiply_alpha, |
36 bool unpremultiply_alpha); | 44 bool unpremultiply_alpha); |
37 | 45 |
38 // This will apply a transform on the source texture before copying to | 46 // This will apply a transform on the source texture before copying to |
39 // destination texture. | 47 // destination texture. |
40 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, | 48 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, |
41 GLenum source_target, GLenum dest_target, | 49 GLenum source_target, |
42 GLuint source_id, GLuint dest_id, GLint level, | 50 GLuint source_id, |
43 GLsizei width, GLsizei height, bool flip_y, | 51 GLuint dest_id, |
| 52 GLint dest_level, |
| 53 GLsizei width, |
| 54 GLsizei height, |
| 55 bool flip_y, |
44 bool premultiply_alpha, | 56 bool premultiply_alpha, |
45 bool unpremultiply_alpha, | 57 bool unpremultiply_alpha, |
46 const GLfloat transform_matrix[16]); | 58 const GLfloat transform_matrix[16]); |
47 | 59 |
48 // The attributes used during invocation of the extension. | 60 // The attributes used during invocation of the extension. |
49 static const GLuint kVertexPositionAttrib = 0; | 61 static const GLuint kVertexPositionAttrib = 0; |
50 | 62 |
51 private: | 63 private: |
52 struct ProgramInfo { | 64 struct ProgramInfo { |
53 ProgramInfo() | 65 ProgramInfo() |
(...skipping 17 matching lines...) Expand all Loading... |
71 ProgramMap programs_; | 83 ProgramMap programs_; |
72 GLuint buffer_id_; | 84 GLuint buffer_id_; |
73 GLuint framebuffer_; | 85 GLuint framebuffer_; |
74 | 86 |
75 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); | 87 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); |
76 }; | 88 }; |
77 | 89 |
78 } // namespace gpu. | 90 } // namespace gpu. |
79 | 91 |
80 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 92 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
OLD | NEW |