Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_copy_texture_chromium.h
blob8cba517052abd4749c1198fc7545bab66fd1b942
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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_
8 #include <vector>
10 #include "base/containers/hash_tables.h"
11 #include "gpu/command_buffer/service/gl_utils.h"
12 #include "gpu/gpu_export.h"
14 namespace gpu {
15 namespace gles2 {
17 class GLES2Decoder;
19 } // namespace gles2.
21 // This class encapsulates the resources required to implement the
22 // GL_CHROMIUM_copy_texture extension. The copy operation is performed
23 // via glCopyTexImage2D() or a blit to a framebuffer object.
24 // The target of |dest_id| texture must be GL_TEXTURE_2D.
25 class GPU_EXPORT CopyTextureCHROMIUMResourceManager {
26 public:
27 CopyTextureCHROMIUMResourceManager();
28 ~CopyTextureCHROMIUMResourceManager();
30 void Initialize(const gles2::GLES2Decoder* decoder);
31 void Destroy();
33 void DoCopyTexture(const gles2::GLES2Decoder* decoder,
34 GLenum source_target,
35 GLuint source_id,
36 GLenum source_internal_format,
37 GLuint dest_id,
38 GLenum dest_internal_format,
39 GLsizei width,
40 GLsizei height,
41 bool flip_y,
42 bool premultiply_alpha,
43 bool unpremultiply_alpha);
45 void DoCopySubTexture(const gles2::GLES2Decoder* decoder,
46 GLenum source_target,
47 GLuint source_id,
48 GLenum source_internal_format,
49 GLuint dest_id,
50 GLenum dest_internal_format,
51 GLint xoffset,
52 GLint yoffset,
53 GLint x,
54 GLint y,
55 GLsizei width,
56 GLsizei height,
57 GLsizei dest_width,
58 GLsizei dest_height,
59 GLsizei source_width,
60 GLsizei source_height,
61 bool flip_y,
62 bool premultiply_alpha,
63 bool unpremultiply_alpha);
65 // This will apply a transform on the source texture before copying to
66 // destination texture.
67 void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder,
68 GLenum source_target,
69 GLuint source_id,
70 GLuint dest_id,
71 GLsizei width,
72 GLsizei height,
73 bool flip_y,
74 bool premultiply_alpha,
75 bool unpremultiply_alpha,
76 const GLfloat transform_matrix[16]);
78 // The attributes used during invocation of the extension.
79 static const GLuint kVertexPositionAttrib = 0;
81 private:
82 struct ProgramInfo {
83 ProgramInfo()
84 : program(0u),
85 matrix_handle(0u),
86 half_size_handle(0u),
87 sampler_handle(0u) {}
89 GLuint program;
90 GLuint matrix_handle;
91 GLuint half_size_handle;
92 GLuint sampler_handle;
95 void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder,
96 GLenum source_target,
97 GLuint source_id,
98 GLuint dest_id,
99 GLint xoffset,
100 GLint yoffset,
101 GLsizei dest_width,
102 GLsizei dest_height,
103 GLsizei source_width,
104 GLsizei source_height,
105 bool flip_y,
106 bool premultiply_alpha,
107 bool unpremultiply_alpha,
108 const GLfloat transform_matrix[16],
109 GLint scissor_x,
110 GLint scissor_y,
111 GLsizei scissor_width,
112 GLsizei scissor_height);
114 bool initialized_;
115 typedef std::vector<GLuint> ShaderVector;
116 ShaderVector vertex_shaders_;
117 ShaderVector fragment_shaders_;
118 typedef std::pair<int, int> ProgramMapKey;
119 typedef base::hash_map<ProgramMapKey, ProgramInfo> ProgramMap;
120 ProgramMap programs_;
121 GLuint buffer_id_;
122 GLuint framebuffer_;
124 DISALLOW_COPY_AND_ASSIGN(CopyTextureCHROMIUMResourceManager);
127 } // namespace gpu.
129 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_COPY_TEXTURE_CHROMIUM_H_