1 // Copyright 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.
7 #include "base/basictypes.h"
8 #include "ui/gl/gl_bindings.h"
14 namespace android_webview
{
16 // This class is not thread safe and should only be used on the UI thread.
17 class ScopedAppGLStateRestore
{
21 MODE_RESOURCE_MANAGEMENT
,
24 ScopedAppGLStateRestore(CallMode mode
);
25 ~ScopedAppGLStateRestore();
27 bool stencil_enabled() const { return stencil_test_
; }
28 GLint
framebuffer_binding_ext() const { return framebuffer_binding_ext_
; }
33 GLint pack_alignment_
;
34 GLint unpack_alignment_
;
43 GLint vertex_attrib_array_buffer_binding
;
44 GLfloat current_vertex_attrib
[4];
47 GLint vertex_array_buffer_binding_
;
48 GLint index_array_buffer_binding_
;
50 GLboolean depth_test_
;
52 GLint cull_face_mode_
;
53 GLboolean color_mask_
[4];
54 GLfloat color_clear_
[4];
56 GLint current_program_
;
58 GLboolean depth_mask_
;
59 GLfloat depth_rage_
[2];
61 GLint hint_generate_mipmap_
;
63 GLfloat polygon_offset_factor_
;
64 GLfloat polygon_offset_units_
;
65 GLfloat sample_coverage_value_
;
66 GLboolean sample_coverage_invert_
;
68 GLboolean enable_dither_
;
69 GLboolean enable_polygon_offset_fill_
;
70 GLboolean enable_sample_alpha_to_coverage_
;
71 GLboolean enable_sample_coverage_
;
73 // Not saved/restored in MODE_DRAW.
74 GLboolean blend_enabled_
;
76 GLint blend_src_alpha_
;
77 GLint blend_dest_rgb_
;
78 GLint blend_dest_alpha_
;
79 GLint active_texture_
;
81 GLboolean scissor_test_
;
82 GLint scissor_box_
[4];
84 GLboolean stencil_test_
;
89 GLint framebuffer_binding_ext_
;
91 struct TextureBindings
{
93 GLint texture_cube_map
;
94 GLint texture_external_oes
;
95 // TODO(boliu): TEXTURE_RECTANGLE_ARB
98 std::vector
<TextureBindings
> texture_bindings_
;
100 GLint vertex_array_bindings_oes_
;
102 DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestore
);
105 } // namespace android_webview