1 // Copyright 2014 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 GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_CLEAR_FRAMEBUFFER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_CLEAR_FRAMEBUFFER_H_
7 
8 #include "base/macros.h"
9 #include "gpu/command_buffer/service/gl_utils.h"
10 #include "gpu/gpu_gles2_export.h"
11 
12 namespace gfx {
13 class Size;
14 }
15 
16 namespace gpu {
17 namespace gles2 {
18 class GLES2Decoder;
19 
20 class GPU_GLES2_EXPORT ClearFramebufferResourceManager {
21  public:
22   ClearFramebufferResourceManager(const gles2::GLES2Decoder* decoder);
23   ~ClearFramebufferResourceManager();
24 
25   void Destroy();
26   void ClearFramebuffer(const gles2::GLES2Decoder* decoder,
27                         const gfx::Size& max_viewport_size,
28                         GLbitfield mask,
29                         GLfloat clear_color_red,
30                         GLfloat clear_color_green,
31                         GLfloat clear_color_blue,
32                         GLfloat clear_color_alpha,
33                         GLfloat clear_depth_value,
34                         GLint clear_stencil_value);
35 
36  private:
37   void Initialize(const gles2::GLES2Decoder* decoder);
38 
39   // The attributes used during invocation of the extension.
40   static const GLuint kVertexPositionAttrib = 0;
41 
42   bool initialized_;
43   GLuint program_;
44   GLuint depth_handle_;
45   GLuint color_handle_;
46   GLuint buffer_id_;
47 
48   DISALLOW_COPY_AND_ASSIGN(ClearFramebufferResourceManager);
49 };
50 
51 }  // namespace gles2
52 }  // namespace gpu
53 
54 #endif  // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_CLEAR_FRAMEBUFFER_H_
55