OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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. |
| 4 |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 10 #include "ui/gl/gl_bindings.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // A utility class which copies the given external texture |
| 15 // (GL_TEXTURE_EXTERNAL_OES) to the target texture (GL_TEXTURE_2D). |
| 16 class Gles2ExternalTextureCopier { |
| 17 public: |
| 18 Gles2ExternalTextureCopier(int32 width, int32 height); |
| 19 virtual ~Gles2ExternalTextureCopier(); |
| 20 |
| 21 bool Copy(GLuint source_texture_id, GLuint destination_texture_id_); |
| 22 |
| 23 private: |
| 24 void SaveState(); |
| 25 void RestoreState(); |
| 26 void SaveStateForAttrib(GLuint attrib, int index); |
| 27 void RestoreStateForAttrib(GLuint attrib, int index); |
| 28 |
| 29 int32 width_; |
| 30 int32 height_; |
| 31 |
| 32 GLint previous_framebuffer_id_; |
| 33 GLint previous_renderbuffer_id_; |
| 34 GLint previous_texture_2d_id_; |
| 35 GLint previous_program_; |
| 36 GLint previous_viewport_[4]; |
| 37 GLint vertex_array_buffer_binding_; |
| 38 GLint index_array_buffer_binding_; |
| 39 |
| 40 struct { |
| 41 GLint enabled; |
| 42 GLint size; |
| 43 GLint type; |
| 44 GLint normalized; |
| 45 GLint stride; |
| 46 GLvoid* pointer; |
| 47 } previous_vertex_attrib_[2]; |
| 48 |
| 49 CopyTextureCHROMIUMResourceManager copier_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(Gles2ExternalTextureCopier); |
| 52 }; |
| 53 |
| 54 } // namespace content |
| 55 |
| 56 #endif // CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
OLD | NEW |