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 "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
11 namespace gles2 { | 11 namespace gles2 { |
12 | 12 |
13 class GLES2Decoder; | 13 class GLES2Decoder; |
14 | 14 |
15 } // namespace gles2. | 15 } // namespace gles2. |
16 | 16 |
17 // This class encapsulates the resources required to implement the | 17 // This class encapsulates the resources required to implement the |
18 // GL_CHROMIUM_copy_texture extension. The copy operation is performed | 18 // GL_CHROMIUM_copy_texture extension. The copy operation is performed |
19 // via a blit to a framebuffer object. | 19 // via a blit to a framebuffer object. |
20 class CopyTextureCHROMIUMResourceManager { | 20 class CopyTextureCHROMIUMResourceManager { |
21 public: | 21 public: |
22 CopyTextureCHROMIUMResourceManager() : initialized_(false) {} | 22 CopyTextureCHROMIUMResourceManager() : initialized_(false) {} |
23 | 23 |
24 void Initialize(const gles2::GLES2Decoder* decoder); | 24 void Initialize(const gles2::GLES2Decoder* decoder); |
25 void Destroy(); | 25 void Destroy(); |
26 | 26 |
27 void DoCopyTexture(const gles2::GLES2Decoder* decoder, | 27 void DoCopyTexture(const gles2::GLES2Decoder* decoder, GLenum source_target, |
28 GLenum target, GLuint source_id, GLuint dest_id, | 28 GLenum dest_target, GLuint source_id, GLuint dest_id, |
29 GLint level, GLsizei width, GLsizei height, | 29 GLint level, GLsizei width, GLsizei height, |
30 bool flip_y, bool premultiply_alpha, | 30 bool flip_y, bool premultiply_alpha, |
31 bool unpremultiply_alpha); | 31 bool unpremultiply_alpha); |
32 | 32 |
33 // The attributes used during invocation of the extension. | 33 // The attributes used during invocation of the extension. |
34 static const GLuint kVertexPositionAttrib = 0; | 34 static const GLuint kVertexPositionAttrib = 0; |
35 static const GLuint kVertexTextureAttrib = 1; | 35 static const GLuint kVertexTextureAttrib = 1; |
36 | 36 |
37 private: | 37 private: |
38 bool initialized_; | 38 bool initialized_; |
39 | 39 |
40 static const int kNumPrograms = 6; | 40 static const int kNumPrograms = 12; |
41 GLuint programs_[kNumPrograms]; | 41 GLuint programs_[kNumPrograms]; |
42 GLuint buffer_ids_[2]; | 42 GLuint buffer_ids_[2]; |
43 GLuint framebuffer_; | 43 GLuint framebuffer_; |
44 GLuint sampler_locations_[kNumPrograms]; | 44 GLuint sampler_locations_[kNumPrograms]; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); | 46 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace gpu. | 49 } // namespace gpu. |
50 | 50 |
51 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 51 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
52 | 52 |
53 | 53 |
OLD | NEW |