Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h

Issue 374193002: gpu: Optimize and cleanup code used for CHROMIUM_copy_texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comments and DCHECK Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 GLuint dest_id,
37 GLint level,
38 GLenum internal_format,
39 GLsizei width,
40 GLsizei height,
41 bool flip_y,
42 bool premultiply_alpha,
36 bool unpremultiply_alpha); 43 bool unpremultiply_alpha);
37 44
38 // This will apply a transform on the source texture before copying to 45 // This will apply a transform on the source texture before copying to
39 // destination texture. 46 // destination texture. |level| and |internal_format| are of |dest_id|
47 // texture. |internal_format| specifies the internal format of the texture.
48 // e.g. GL_RGBA, GL_RGB
reveman 2014/07/10 20:20:49 nit: this applies to DoCopyTexture as well. maybe
dshwang 2014/07/10 22:08:22 Thank you for detail suggestions. I chose the seco
40 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, 49 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder,
41 GLenum source_target, GLenum dest_target, 50 GLenum source_target,
42 GLuint source_id, GLuint dest_id, GLint level, 51 GLuint source_id,
43 GLsizei width, GLsizei height, bool flip_y, 52 GLuint dest_id,
53 GLint level,
54 GLenum internal_format,
55 GLsizei width,
56 GLsizei height,
57 bool flip_y,
44 bool premultiply_alpha, 58 bool premultiply_alpha,
45 bool unpremultiply_alpha, 59 bool unpremultiply_alpha,
46 const GLfloat transform_matrix[16]); 60 const GLfloat transform_matrix[16]);
47 61
48 // The attributes used during invocation of the extension. 62 // The attributes used during invocation of the extension.
49 static const GLuint kVertexPositionAttrib = 0; 63 static const GLuint kVertexPositionAttrib = 0;
50 64
51 private: 65 private:
52 struct ProgramInfo { 66 struct ProgramInfo {
53 ProgramInfo() 67 ProgramInfo()
(...skipping 17 matching lines...) Expand all
71 ProgramMap programs_; 85 ProgramMap programs_;
72 GLuint buffer_id_; 86 GLuint buffer_id_;
73 GLuint framebuffer_; 87 GLuint framebuffer_;
74 88
75 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager); 89 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager);
76 }; 90 };
77 91
78 } // namespace gpu. 92 } // namespace gpu.
79 93
80 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_ 94 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698