Fix build break
[chromium-blink-merge.git] / cc / output / texture_copier.h
blob9b958bce9b9036833660d414c1ee38d07c00e9e3
1 // Copyright 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 CC_OUTPUT_TEXTURE_COPIER_H_
6 #define CC_OUTPUT_TEXTURE_COPIER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/output/program_binding.h"
12 #include "cc/output/shader.h"
13 #include "third_party/khronos/GLES2/gl2.h"
14 #include "ui/gfx/size.h"
16 namespace WebKit { class WebGraphicsContext3D; }
18 namespace cc {
20 class CC_EXPORT TextureCopier {
21 public:
22 struct Parameters {
23 unsigned source_texture;
24 unsigned dest_texture;
25 gfx::Size size;
27 // Copy the base level contents of |source_texture| to |dest_texture|. Both
28 // texture objects must be complete and have a base level of |size|
29 // dimensions. The color formats do not need to match, but |dest_texture| must
30 // have a renderable format.
31 virtual void CopyTexture(Parameters parameters) = 0;
32 virtual void Flush() = 0;
34 virtual ~TextureCopier() {}
37 class CC_EXPORT AcceleratedTextureCopier : public TextureCopier {
38 public:
39 static scoped_ptr<AcceleratedTextureCopier> Create(
40 WebKit::WebGraphicsContext3D* context,
41 bool using_bind_uniforms,
42 int highp_threshold_min) {
43 return make_scoped_ptr(
44 new AcceleratedTextureCopier(
45 context, using_bind_uniforms, highp_threshold_min));
47 virtual ~AcceleratedTextureCopier();
49 virtual void CopyTexture(Parameters parameters) OVERRIDE;
50 virtual void Flush() OVERRIDE;
52 protected:
53 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D* context,
54 bool using_bind_uniforms,
55 int highp_threshold_min);
57 private:
58 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex>
59 BlitProgram;
61 WebKit::WebGraphicsContext3D* context_;
62 GLuint fbo_;
63 GLuint position_buffer_;
64 scoped_ptr<BlitProgram> blit_program_;
65 scoped_ptr<BlitProgram> blit_program_highp_;
66 bool using_bind_uniforms_;
67 int highp_threshold_min_;
69 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier);
72 } // namespace cc
74 #endif // CC_OUTPUT_TEXTURE_COPIER_H_