| OLD | NEW |
| 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/context_state.h" | 5 #include "gpu/command_buffer/service/context_state.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 8 |
| 7 namespace gpu { | 9 namespace gpu { |
| 8 namespace gles2 { | 10 namespace gles2 { |
| 9 | 11 |
| 12 namespace { |
| 13 |
| 14 void EnableDisable(GLenum pname, bool enable) { |
| 15 if (enable) { |
| 16 glEnable(pname); |
| 17 } else { |
| 18 glDisable(pname); |
| 19 } |
| 20 } |
| 21 |
| 22 } // anonymous namespace. |
| 23 |
| 10 TextureUnit::TextureUnit() | 24 TextureUnit::TextureUnit() |
| 11 : bind_target(GL_TEXTURE_2D) { | 25 : bind_target(GL_TEXTURE_2D) { |
| 12 } | 26 } |
| 13 | 27 |
| 14 TextureUnit::~TextureUnit() { | 28 TextureUnit::~TextureUnit() { |
| 15 } | 29 } |
| 16 | 30 |
| 17 ContextState::ContextState() | 31 ContextState::ContextState() |
| 18 : pack_alignment(4), | 32 : pack_alignment(4), |
| 19 unpack_alignment(4), | 33 unpack_alignment(4), |
| 20 active_texture_unit(0), | 34 active_texture_unit(0), |
| 21 color_clear_red(0), | |
| 22 color_clear_green(0), | |
| 23 color_clear_blue(0), | |
| 24 color_clear_alpha(0), | |
| 25 color_mask_red(true), | |
| 26 color_mask_green(true), | |
| 27 color_mask_blue(true), | |
| 28 color_mask_alpha(true), | |
| 29 depth_clear(1.0f), | |
| 30 depth_mask(true), | |
| 31 depth_func(GL_LESS), | |
| 32 z_near(0.0f), | |
| 33 z_far(1.0f), | |
| 34 enable_blend(false), | |
| 35 enable_cull_face(false), | |
| 36 enable_scissor_test(false), | |
| 37 enable_depth_test(false), | |
| 38 enable_stencil_test(false), | |
| 39 enable_polygon_offset_fill(false), | |
| 40 enable_dither(true), | |
| 41 enable_sample_alpha_to_coverage(false), | |
| 42 enable_sample_coverage(false), | |
| 43 viewport_x(0), | |
| 44 viewport_y(0), | |
| 45 viewport_width(0), | |
| 46 viewport_height(0), | |
| 47 viewport_max_width(0), | 35 viewport_max_width(0), |
| 48 viewport_max_height(0), | 36 viewport_max_height(0), |
| 49 scissor_x(0), | |
| 50 scissor_y(0), | |
| 51 scissor_width(0), | |
| 52 scissor_height(0), | |
| 53 cull_mode(GL_BACK), | |
| 54 front_face(GL_CCW), | |
| 55 blend_source_rgb(GL_ONE), | |
| 56 blend_dest_rgb(GL_ZERO), | |
| 57 blend_source_alpha(GL_ONE), | |
| 58 blend_dest_alpha(GL_ZERO), | |
| 59 blend_equation_rgb(GL_FUNC_ADD), | |
| 60 blend_equation_alpha(GL_FUNC_ADD), | |
| 61 blend_color_red(0), | |
| 62 blend_color_green(0), | |
| 63 blend_color_blue(0), | |
| 64 blend_color_alpha(0), | |
| 65 stencil_clear(0), | |
| 66 stencil_front_writemask(0xFFFFFFFFU), | |
| 67 stencil_front_func(GL_ALWAYS), | |
| 68 stencil_front_ref(0), | |
| 69 stencil_front_mask(0xFFFFFFFFU), | |
| 70 stencil_front_fail_op(GL_KEEP), | |
| 71 stencil_front_z_fail_op(GL_KEEP), | |
| 72 stencil_front_z_pass_op(GL_KEEP), | |
| 73 stencil_back_writemask(0xFFFFFFFFU), | |
| 74 stencil_back_func(GL_ALWAYS), | |
| 75 stencil_back_ref(0), | |
| 76 stencil_back_mask(0xFFFFFFFFU), | |
| 77 stencil_back_fail_op(GL_KEEP), | |
| 78 stencil_back_z_fail_op(GL_KEEP), | |
| 79 stencil_back_z_pass_op(GL_KEEP), | |
| 80 polygon_offset_factor(0.0f), | |
| 81 polygon_offset_units(0.0f), | |
| 82 sample_coverage_value(1.0f), | |
| 83 sample_coverage_invert(false), | |
| 84 line_width(1.0), | |
| 85 hint_generate_mipmap(GL_DONT_CARE), | 37 hint_generate_mipmap(GL_DONT_CARE), |
| 86 hint_fragment_shader_derivative(GL_DONT_CARE), | 38 hint_fragment_shader_derivative(GL_DONT_CARE), |
| 87 pack_reverse_row_order(false) { | 39 pack_reverse_row_order(false) { |
| 40 Initialize(); |
| 88 } | 41 } |
| 89 | 42 |
| 90 ContextState::~ContextState() { | 43 ContextState::~ContextState() { |
| 91 } | 44 } |
| 92 | 45 |
| 46 // Include the auto-generated part of this file. We split this because it means |
| 47 // we can easily edit the non-auto generated parts right here in this file |
| 48 // instead of having to edit some template or the code generator. |
| 49 #include "gpu/command_buffer/service/context_state_impl_autogen.h" |
| 50 |
| 93 } // namespace gles2 | 51 } // namespace gles2 |
| 94 } // namespace gpu | 52 } // namespace gpu |
| 95 | 53 |
| 96 | 54 |
| OLD | NEW |