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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // via a blit to a framebuffer object. | 23 // via a blit to a framebuffer object. |
24 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { | 24 class GPU_EXPORT CopyTextureCHROMIUMResourceManager { |
25 public: | 25 public: |
26 CopyTextureCHROMIUMResourceManager(); | 26 CopyTextureCHROMIUMResourceManager(); |
27 ~CopyTextureCHROMIUMResourceManager(); | 27 ~CopyTextureCHROMIUMResourceManager(); |
28 | 28 |
29 void Initialize(const gles2::GLES2Decoder* decoder); | 29 void Initialize(const gles2::GLES2Decoder* decoder); |
30 void Destroy(); | 30 void Destroy(); |
31 | 31 |
32 void DoCopyTexture(const gles2::GLES2Decoder* decoder, GLenum source_target, | 32 void DoCopyTexture(const gles2::GLES2Decoder* decoder, GLenum source_target, |
33 GLenum dest_target, GLuint source_id, GLuint dest_id, | 33 GLuint source_id, GLuint dest_id, GLint level, |
34 GLint level, GLsizei width, GLsizei height, | 34 GLenum internal_format, GLsizei width, GLsizei height, |
35 bool flip_y, bool premultiply_alpha, | 35 bool flip_y, bool premultiply_alpha, |
36 bool unpremultiply_alpha); | 36 bool unpremultiply_alpha); |
37 | 37 |
38 // This will apply a transform on the source texture before copying to | 38 // This will apply a transform on the source texture before copying to |
39 // destination texture. | 39 // destination texture. |
40 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, | 40 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, |
41 GLenum source_target, GLenum dest_target, | 41 GLenum source_target, GLuint source_id, |
42 GLuint source_id, GLuint dest_id, GLint level, | 42 GLuint dest_id, GLint level, |
| 43 GLenum internal_format, |
43 GLsizei width, GLsizei height, bool flip_y, | 44 GLsizei width, GLsizei height, bool flip_y, |
44 bool premultiply_alpha, | 45 bool premultiply_alpha, |
45 bool unpremultiply_alpha, | 46 bool unpremultiply_alpha, |
46 const GLfloat transform_matrix[16]); | 47 const GLfloat transform_matrix[16]); |
47 | 48 |
48 // The attributes used during invocation of the extension. | 49 // The attributes used during invocation of the extension. |
49 static const GLuint kVertexPositionAttrib = 0; | 50 static const GLuint kVertexPositionAttrib = 0; |
50 | 51 |
51 private: | 52 private: |
| 53 void DoFastCopyTexture(const gles2::GLES2Decoder* decoder, |
| 54 GLuint source_id, |
| 55 GLuint dest_id, |
| 56 GLint level, |
| 57 GLenum internal_format, |
| 58 GLsizei width, |
| 59 GLsizei height); |
| 60 bool BindFramebufferTexture2D(GLuint texture_id, GLint level); |
| 61 |
52 struct ProgramInfo { | 62 struct ProgramInfo { |
53 ProgramInfo() | 63 ProgramInfo() |
54 : program(0u), | 64 : program(0u), |
55 matrix_handle(0u), | 65 matrix_handle(0u), |
56 half_size_handle(0u), | 66 half_size_handle(0u), |
57 sampler_handle(0u) {} | 67 sampler_handle(0u) {} |
58 | 68 |
59 GLuint program; | 69 GLuint program; |
60 GLuint matrix_handle; | 70 GLuint matrix_handle; |
61 GLuint half_size_handle; | 71 GLuint half_size_handle; |
62 GLuint sampler_handle; | 72 GLuint sampler_handle; |
63 }; | 73 }; |
64 | 74 |
65 bool initialized_; | 75 bool initialized_; |
66 typedef std::vector<GLuint> ShaderVector; | 76 typedef std::vector<GLuint> ShaderVector; |
67 ShaderVector vertex_shaders_; | 77 ShaderVector vertex_shaders_; |
68 ShaderVector fragment_shaders_; | 78 ShaderVector fragment_shaders_; |
69 typedef std::pair<int, int> ProgramMapKey; | 79 typedef std::pair<int, int> ProgramMapKey; |
70 typedef base::hash_map<ProgramMapKey, ProgramInfo> ProgramMap; | 80 typedef base::hash_map<ProgramMapKey, ProgramInfo> ProgramMap; |
71 ProgramMap programs_; | 81 ProgramMap programs_; |
72 GLuint buffer_id_; | 82 GLuint buffer_id_; |
73 GLuint framebuffer_; | 83 GLuint framebuffer_; |
74 | 84 |
75 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); | 85 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); |
76 }; | 86 }; |
77 | 87 |
78 } // namespace gpu. | 88 } // namespace gpu. |
79 | 89 |
80 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 90 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
OLD | NEW |