Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 10573004: Set default GL state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert revert Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index b40198e87554e5fe84c5fc5c63779d68818cc142..1322fcfe0868d509eb91e5553933c1534627f27b 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2265,6 +2265,45 @@ bool GLES2DecoderImpl::Initialize(
viewport_max_width_ = viewport_params[0];
viewport_max_height_ = viewport_params[1];
+ // Set all the default state because some GL drivers get it wrong.
+ glActiveTexture(GL_TEXTURE0 + active_texture_unit_);
+ glLineWidth(1.0);
+ EnableDisable(GL_BLEND, enable_blend_);
+ glBlendColor(0.0f, 0.0, 0.0f, 0.0f);
+ glBlendFunc(GL_ONE, GL_ZERO);
+ glBlendEquation(GL_FUNC_ADD);
+ glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO);
+ glClearColor(clear_red_, clear_green_, clear_blue_, clear_alpha_);
+ glColorMask(mask_red_, mask_green_, mask_blue_, mask_alpha_);
+ EnableDisable(GL_CULL_FACE, enable_cull_face_);
+ glCullFace(GL_BACK);
+ glClearDepth(clear_depth_);
+ glDepthFunc(GL_LESS);
+ glDepthRange(0.0f, 1.0f);
+ EnableDisable(GL_DEPTH_TEST, enable_depth_test_);
+ glEnable(GL_DITHER);
+ glFrontFace(GL_CCW);
+ glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
+ glLineWidth(1.0f);
+ glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment_);
+ glPolygonOffset(0.0f, 0.0f);
+ glDisable(GL_POLYGON_OFFSET_FILL);
+ glSampleCoverage(1.0, false);
+ glScissor(viewport_x_, viewport_y_, viewport_width_, viewport_height_);
+ EnableDisable(GL_SCISSOR_TEST, enable_scissor_test_);
+ EnableDisable(GL_STENCIL_TEST, enable_stencil_test_);
+ glClearStencil(clear_stencil_);
+ glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFFU);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ glStencilMaskSeparate(GL_FRONT, mask_stencil_front_);
+ glStencilMaskSeparate(GL_BACK, mask_stencil_back_);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment_);
+
+ DoBindBuffer(GL_ARRAY_BUFFER, 0);
+ DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ DoBindFramebuffer(GL_FRAMEBUFFER, 0);
+ DoBindRenderbuffer(GL_RENDERBUFFER, 0);
+
return true;
}
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698