| 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 17 matching lines...) Expand all Loading... |
| 28 CopyTextureCHROMIUMResourceManager(); | 28 CopyTextureCHROMIUMResourceManager(); |
| 29 ~CopyTextureCHROMIUMResourceManager(); | 29 ~CopyTextureCHROMIUMResourceManager(); |
| 30 | 30 |
| 31 void Initialize(const gles2::GLES2Decoder* decoder); | 31 void Initialize(const gles2::GLES2Decoder* decoder); |
| 32 void Destroy(); | 32 void Destroy(); |
| 33 | 33 |
| 34 void DoCopyTexture(const gles2::GLES2Decoder* decoder, | 34 void DoCopyTexture(const gles2::GLES2Decoder* decoder, |
| 35 GLenum source_target, | 35 GLenum source_target, |
| 36 GLuint source_id, | 36 GLuint source_id, |
| 37 GLenum source_internal_format, | 37 GLenum source_internal_format, |
| 38 GLenum dest_target, |
| 38 GLuint dest_id, | 39 GLuint dest_id, |
| 39 GLenum dest_internal_format, | 40 GLenum dest_internal_format, |
| 40 GLsizei width, | 41 GLsizei width, |
| 41 GLsizei height, | 42 GLsizei height, |
| 42 bool flip_y, | 43 bool flip_y, |
| 43 bool premultiply_alpha, | 44 bool premultiply_alpha, |
| 44 bool unpremultiply_alpha); | 45 bool unpremultiply_alpha); |
| 45 | 46 |
| 46 void DoCopySubTexture(const gles2::GLES2Decoder* decoder, | 47 void DoCopySubTexture(const gles2::GLES2Decoder* decoder, |
| 47 GLenum source_target, | 48 GLenum source_target, |
| 48 GLuint source_id, | 49 GLuint source_id, |
| 49 GLenum source_internal_format, | 50 GLenum source_internal_format, |
| 51 GLenum dest_target, |
| 50 GLuint dest_id, | 52 GLuint dest_id, |
| 51 GLenum dest_internal_format, | 53 GLenum dest_internal_format, |
| 52 GLint xoffset, | 54 GLint xoffset, |
| 53 GLint yoffset, | 55 GLint yoffset, |
| 54 GLint x, | 56 GLint x, |
| 55 GLint y, | 57 GLint y, |
| 56 GLsizei width, | 58 GLsizei width, |
| 57 GLsizei height, | 59 GLsizei height, |
| 58 GLsizei dest_width, | 60 GLsizei dest_width, |
| 59 GLsizei dest_height, | 61 GLsizei dest_height, |
| 60 GLsizei source_width, | 62 GLsizei source_width, |
| 61 GLsizei source_height, | 63 GLsizei source_height, |
| 62 bool flip_y, | 64 bool flip_y, |
| 63 bool premultiply_alpha, | 65 bool premultiply_alpha, |
| 64 bool unpremultiply_alpha); | 66 bool unpremultiply_alpha); |
| 65 | 67 |
| 66 // This will apply a transform on the texture coordinates before sampling | 68 // This will apply a transform on the texture coordinates before sampling |
| 67 // the source texture and copying to the destination texture. The transform | 69 // the source texture and copying to the destination texture. The transform |
| 68 // matrix should be given in column-major form, so it can be passed | 70 // matrix should be given in column-major form, so it can be passed |
| 69 // directly to GL. | 71 // directly to GL. |
| 70 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, | 72 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, |
| 71 GLenum source_target, | 73 GLenum source_target, |
| 72 GLuint source_id, | 74 GLuint source_id, |
| 75 GLenum dest_target, |
| 73 GLuint dest_id, | 76 GLuint dest_id, |
| 74 GLsizei width, | 77 GLsizei width, |
| 75 GLsizei height, | 78 GLsizei height, |
| 76 bool flip_y, | 79 bool flip_y, |
| 77 bool premultiply_alpha, | 80 bool premultiply_alpha, |
| 78 bool unpremultiply_alpha, | 81 bool unpremultiply_alpha, |
| 79 const GLfloat transform_matrix[16]); | 82 const GLfloat transform_matrix[16]); |
| 80 | 83 |
| 81 // The attributes used during invocation of the extension. | 84 // The attributes used during invocation of the extension. |
| 82 static const GLuint kVertexPositionAttrib = 0; | 85 static const GLuint kVertexPositionAttrib = 0; |
| 83 | 86 |
| 84 private: | 87 private: |
| 85 struct ProgramInfo { | 88 struct ProgramInfo { |
| 86 ProgramInfo() | 89 ProgramInfo() |
| 87 : program(0u), | 90 : program(0u), |
| 88 vertex_translate_handle(0u), | 91 vertex_dest_mult_handle(0u), |
| 92 vertex_dest_add_handle(0u), |
| 93 vertex_source_mult_handle(0u), |
| 94 vertex_source_add_handle(0u), |
| 89 tex_coord_transform_handle(0u), | 95 tex_coord_transform_handle(0u), |
| 90 half_size_handle(0u), | |
| 91 sampler_handle(0u) {} | 96 sampler_handle(0u) {} |
| 92 | 97 |
| 93 GLuint program; | 98 GLuint program; |
| 94 GLuint vertex_translate_handle; | 99 |
| 100 // Transformations that map from the original quad coordinates [-1, 1] into |
| 101 // the destination texture's quad coordinates. |
| 102 GLuint vertex_dest_mult_handle; |
| 103 GLuint vertex_dest_add_handle; |
| 104 |
| 105 // Transformations that map from the original quad coordinates [-1, 1] into |
| 106 // the source texture's texture coordinates. |
| 107 GLuint vertex_source_mult_handle; |
| 108 GLuint vertex_source_add_handle; |
| 109 |
| 95 GLuint tex_coord_transform_handle; | 110 GLuint tex_coord_transform_handle; |
| 96 GLuint half_size_handle; | |
| 97 GLuint sampler_handle; | 111 GLuint sampler_handle; |
| 98 }; | 112 }; |
| 99 | 113 |
| 100 void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder, | 114 void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder, |
| 101 GLenum source_target, | 115 GLenum source_target, |
| 102 GLuint source_id, | 116 GLuint source_id, |
| 117 GLenum dest_target, |
| 103 GLuint dest_id, | 118 GLuint dest_id, |
| 104 GLint xoffset, | 119 GLint xoffset, |
| 105 GLint yoffset, | 120 GLint yoffset, |
| 106 GLint x, | 121 GLint x, |
| 107 GLint y, | 122 GLint y, |
| 108 GLsizei width, | 123 GLsizei width, |
| 109 GLsizei height, | 124 GLsizei height, |
| 110 GLsizei dest_width, | 125 GLsizei dest_width, |
| 111 GLsizei dest_height, | 126 GLsizei dest_height, |
| 112 GLsizei source_width, | 127 GLsizei source_width, |
| 113 GLsizei source_height, | 128 GLsizei source_height, |
| 114 bool flip_y, | 129 bool flip_y, |
| 115 bool premultiply_alpha, | 130 bool premultiply_alpha, |
| 116 bool unpremultiply_alpha, | 131 bool unpremultiply_alpha, |
| 117 const GLfloat transform_matrix[16]); | 132 const GLfloat transform_matrix[16]); |
| 118 | 133 |
| 119 bool initialized_; | 134 bool initialized_; |
| 120 typedef std::vector<GLuint> ShaderVector; | 135 typedef std::vector<GLuint> ShaderVector; |
| 121 ShaderVector vertex_shaders_; | 136 GLuint vertex_shader_; |
| 122 ShaderVector fragment_shaders_; | 137 ShaderVector fragment_shaders_; |
| 123 typedef std::pair<int, int> ProgramMapKey; | 138 typedef int ProgramMapKey; |
| 124 typedef base::hash_map<ProgramMapKey, ProgramInfo> ProgramMap; | 139 typedef base::hash_map<ProgramMapKey, ProgramInfo> ProgramMap; |
| 125 ProgramMap programs_; | 140 ProgramMap programs_; |
| 126 GLuint buffer_id_; | 141 GLuint buffer_id_; |
| 127 GLuint framebuffer_; | 142 GLuint framebuffer_; |
| 128 | 143 |
| 129 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); | 144 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); |
| 130 }; | 145 }; |
| 131 | 146 |
| 132 } // namespace gpu. | 147 } // namespace gpu. |
| 133 | 148 |
| 134 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ | 149 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ |
| OLD | NEW |