Index: android_webview/browser/scoped_app_gl_state_restore.cc |
diff --git a/android_webview/browser/scoped_app_gl_state_restore.cc b/android_webview/browser/scoped_app_gl_state_restore.cc |
index 70e5075c1b637c4b5545a3ee8d0aaec5919ad2d2..a025d465d0720cab0f5941ad7ce3239e85b4c952 100644 |
--- a/android_webview/browser/scoped_app_gl_state_restore.cc |
+++ b/android_webview/browser/scoped_app_gl_state_restore.cc |
@@ -89,17 +89,43 @@ ScopedAppGLStateRestore::ScopedAppGLStateRestore(CallMode mode) { |
glGetBooleanv(GL_DEPTH_TEST, &depth_test_); |
glGetBooleanv(GL_CULL_FACE, &cull_face_); |
+ glGetIntegerv(GL_CULL_FACE_MODE, &cull_face_mode_); |
glGetBooleanv(GL_COLOR_WRITEMASK, color_mask_); |
- glGetBooleanv(GL_BLEND, &blend_enabled_); |
- glGetIntegerv(GL_BLEND_SRC_RGB, &blend_src_rgb_); |
- glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_alpha_); |
- glGetIntegerv(GL_BLEND_DST_RGB, &blend_dest_rgb_); |
- glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dest_alpha_); |
- glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture_); |
- glGetIntegerv(GL_VIEWPORT, viewport_); |
- glGetBooleanv(GL_SCISSOR_TEST, &scissor_test_); |
- glGetIntegerv(GL_SCISSOR_BOX, scissor_box_); |
glGetIntegerv(GL_CURRENT_PROGRAM, ¤t_program_); |
+ glGetFloatv(GL_COLOR_CLEAR_VALUE, color_clear_); |
+ glGetFloatv(GL_DEPTH_CLEAR_VALUE, &depth_clear_); |
+ glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &stencil_clear_value_); |
+ glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &stencil_clear_value_); |
joth
2013/07/23 05:52:57
you got this one twice.
boliu
2013/07/23 20:41:24
Done.
|
+ glGetIntegerv(GL_DEPTH_FUNC, &depth_func_); |
+ glGetBooleanv(GL_DEPTH_WRITEMASK, &depth_mask_); |
+ glGetFloatv(GL_DEPTH_RANGE, depth_rage_); |
+ glGetIntegerv(GL_FRONT_FACE, &front_face_); |
+ glGetIntegerv(GL_GENERATE_MIPMAP_HINT, &hint_generate_mipmap_); |
+ glGetFloatv(GL_LINE_WIDTH, &line_width_); |
+ glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &polygon_offset_factor_); |
+ glGetFloatv(GL_POLYGON_OFFSET_UNITS, &polygon_offset_units_); |
+ glGetFloatv(GL_SAMPLE_COVERAGE_VALUE, &sample_coverage_value_); |
+ glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT, &sample_coverage_invert_); |
+ glGetIntegerv(GL_STENCIL_FUNC, &stencil_front_func_); |
+ glGetIntegerv(GL_STENCIL_REF, &stencil_front_ref_); |
+ glGetIntegerv(GL_STENCIL_VALUE_MASK, &stencil_front_mask_); |
+ glGetIntegerv(GL_STENCIL_BACK_FUNC, &stencil_back_func_); |
+ glGetIntegerv(GL_STENCIL_BACK_REF, &stencil_back_ref_); |
+ glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, &stencil_back_mask_); |
+ glGetIntegerv(GL_STENCIL_WRITEMASK, &stencil_front_writemask_); |
+ glGetIntegerv(GL_STENCIL_BACK_WRITEMASK, &stencil_back_writemask_); |
+ glGetIntegerv(GL_STENCIL_FAIL, &stencil_front_fail_op_); |
+ glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &stencil_front_z_fail_op_); |
+ glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &stencil_front_z_pass_op_); |
+ glGetIntegerv(GL_STENCIL_BACK_FAIL, &stencil_back_fail_op_); |
+ glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_FAIL, &stencil_back_z_fail_op_); |
+ glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_PASS, &stencil_back_z_pass_op_); |
joth
2013/07/23 05:52:57
Lets chat this through with aelias. Stencil should
boliu
2013/07/23 20:41:24
Let's just not restore stencil here for now then.
|
+ |
+ glGetBooleanv(GL_DITHER, &enable_dither_); |
+ glGetBooleanv(GL_POLYGON_OFFSET_FILL, &enable_polygon_offset_fill_); |
+ glGetBooleanv(GL_SAMPLE_ALPHA_TO_COVERAGE, &enable_sample_alpha_to_coverage_); |
+ glGetBooleanv(GL_SAMPLE_COVERAGE, &enable_sample_coverage_); |
+ glGetBooleanv(GL_STENCIL_TEST, &enable_stencil_test_); |
} |
ScopedAppGLStateRestore::~ScopedAppGLStateRestore() { |
@@ -138,31 +164,64 @@ ScopedAppGLStateRestore::~ScopedAppGLStateRestore() { |
} else { |
glDisable(GL_CULL_FACE); |
} |
+ glCullFace(cull_face_mode_); |
glColorMask(color_mask_[0], color_mask_[1], color_mask_[2], color_mask_[3]); |
- if (blend_enabled_) { |
- glEnable(GL_BLEND); |
- } else { |
- glDisable(GL_BLEND); |
- } |
- |
- glBlendFuncSeparate( |
- blend_src_rgb_, blend_dest_rgb_, blend_src_alpha_, blend_dest_alpha_); |
- glActiveTexture(active_texture_); |
- |
- glViewport(viewport_[0], viewport_[1], viewport_[2], viewport_[3]); |
- |
- if (scissor_test_) { |
- glEnable(GL_SCISSOR_TEST); |
- } else { |
- glDisable(GL_SCISSOR_TEST); |
- } |
- |
- glScissor( |
- scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]); |
- |
glUseProgram(current_program_); |
+ |
+ glClearColor( |
+ color_clear_[0], color_clear_[1], color_clear_[2], color_clear_[3]); |
+ glClearDepth(depth_clear_); |
+ glClearStencil(stencil_clear_value_); |
+ glDepthFunc(depth_func_); |
+ glDepthMask(depth_mask_); |
+ glDepthRange(depth_rage_[0], depth_rage_[1]); |
+ glFrontFace(front_face_); |
+ glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap_); |
+ // TODO(boliu): GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES ?? |
+ glLineWidth(line_width_); |
+ glPolygonOffset(polygon_offset_factor_, polygon_offset_units_); |
+ glSampleCoverage(sample_coverage_value_, sample_coverage_invert_); |
+ glStencilFuncSeparate( |
+ GL_FRONT, stencil_front_func_, stencil_front_ref_, stencil_front_mask_); |
+ glStencilFuncSeparate( |
+ GL_BACK, stencil_back_func_, stencil_back_ref_, stencil_back_mask_); |
+ glStencilMaskSeparate(GL_FRONT, stencil_front_writemask_); |
+ glStencilMaskSeparate(GL_BACK, stencil_back_writemask_); |
+ glStencilOpSeparate(GL_FRONT, |
+ stencil_front_fail_op_, |
+ stencil_front_z_fail_op_, |
+ stencil_front_z_pass_op_); |
+ glStencilOpSeparate(GL_BACK, |
+ stencil_back_fail_op_, |
+ stencil_back_z_fail_op_, |
+ stencil_back_z_pass_op_); |
+ |
+ if (enable_dither_) |
+ glEnable(GL_DITHER); |
+ else |
+ glDisable(GL_DITHER); |
+ |
+ if (enable_polygon_offset_fill_) |
+ glEnable(GL_POLYGON_OFFSET_FILL); |
+ else |
+ glDisable(GL_POLYGON_OFFSET_FILL); |
+ |
+ if (enable_sample_alpha_to_coverage_) |
+ glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); |
+ else |
+ glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); |
+ |
+ if (enable_sample_coverage_) |
+ glEnable(GL_SAMPLE_COVERAGE); |
+ else |
+ glDisable(GL_SAMPLE_COVERAGE); |
+ |
+ if (enable_stencil_test_) |
+ glEnable(GL_STENCIL_TEST); |
+ else |
+ glDisable(GL_STENCIL_TEST); |
} |
} // namespace android_webview |