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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 2258
2259 viewport_width_ = size.width(); 2259 viewport_width_ = size.width();
2260 viewport_height_ = size.height(); 2260 viewport_height_ = size.height();
2261 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_); 2261 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_);
2262 2262
2263 GLint viewport_params[4] = { 0 }; 2263 GLint viewport_params[4] = { 0 };
2264 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewport_params); 2264 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewport_params);
2265 viewport_max_width_ = viewport_params[0]; 2265 viewport_max_width_ = viewport_params[0];
2266 viewport_max_height_ = viewport_params[1]; 2266 viewport_max_height_ = viewport_params[1];
2267 2267
2268 // Set all the default state because some GL drivers get it wrong.
2269 glActiveTexture(GL_TEXTURE0 + active_texture_unit_);
2270 glLineWidth(1.0);
2271 EnableDisable(GL_BLEND, enable_blend_);
2272 glBlendColor(0.0f, 0.0, 0.0f, 0.0f);
2273 glBlendFunc(GL_ONE, GL_ZERO);
2274 glBlendEquation(GL_FUNC_ADD);
2275 glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO);
2276 glClearColor(clear_red_, clear_green_, clear_blue_, clear_alpha_);
2277 glColorMask(mask_red_, mask_green_, mask_blue_, mask_alpha_);
2278 EnableDisable(GL_CULL_FACE, enable_cull_face_);
2279 glCullFace(GL_BACK);
2280 glClearDepth(clear_depth_);
2281 glDepthFunc(GL_LESS);
2282 glDepthRange(0.0f, 1.0f);
2283 EnableDisable(GL_DEPTH_TEST, enable_depth_test_);
2284 glEnable(GL_DITHER);
2285 glFrontFace(GL_CCW);
2286 glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
2287 glLineWidth(1.0f);
2288 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment_);
2289 glPolygonOffset(0.0f, 0.0f);
2290 glDisable(GL_POLYGON_OFFSET_FILL);
2291 glSampleCoverage(1.0, false);
2292 glScissor(viewport_x_, viewport_y_, viewport_width_, viewport_height_);
2293 EnableDisable(GL_SCISSOR_TEST, enable_scissor_test_);
2294 EnableDisable(GL_STENCIL_TEST, enable_stencil_test_);
2295 glClearStencil(clear_stencil_);
2296 glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFFU);
2297 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
2298 glStencilMaskSeparate(GL_FRONT, mask_stencil_front_);
2299 glStencilMaskSeparate(GL_BACK, mask_stencil_back_);
2300 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment_);
2301
2302 DoBindBuffer(GL_ARRAY_BUFFER, 0);
2303 DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
2304 DoBindFramebuffer(GL_FRAMEBUFFER, 0);
2305 DoBindRenderbuffer(GL_RENDERBUFFER, 0);
2306
2268 return true; 2307 return true;
2269 } 2308 }
2270 2309
2271 void GLES2DecoderImpl::UpdateCapabilities() { 2310 void GLES2DecoderImpl::UpdateCapabilities() {
2272 util_.set_num_compressed_texture_formats( 2311 util_.set_num_compressed_texture_formats(
2273 validators_->compressed_texture_format.GetValues().size()); 2312 validators_->compressed_texture_format.GetValues().size());
2274 util_.set_num_shader_binary_formats( 2313 util_.set_num_shader_binary_formats(
2275 validators_->shader_binary_format.GetValues().size()); 2314 validators_->shader_binary_format.GetValues().size());
2276 } 2315 }
2277 2316
(...skipping 6758 matching lines...) Expand 10 before | Expand all | Expand 10 after
9036 BindAndApplyTextureParameters(info); 9075 BindAndApplyTextureParameters(info);
9037 } 9076 }
9038 9077
9039 // Include the auto-generated part of this file. We split this because it means 9078 // Include the auto-generated part of this file. We split this because it means
9040 // we can easily edit the non-auto generated parts right here in this file 9079 // we can easily edit the non-auto generated parts right here in this file
9041 // instead of having to edit some template or the code generator. 9080 // instead of having to edit some template or the code generator.
9042 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 9081 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
9043 9082
9044 } // namespace gles2 9083 } // namespace gles2
9045 } // namespace gpu 9084 } // namespace gpu
OLDNEW
« 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