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

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

Issue 11301006: automate more GL state handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/context_state_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/context_state.cc
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc
index 866abf44f241b447c83a5dbf05532b6373e0194f..f0524abb5722ebb6a8e5771b07ede0c5450edce4 100644
--- a/gpu/command_buffer/service/context_state.cc
+++ b/gpu/command_buffer/service/context_state.cc
@@ -4,9 +4,23 @@
#include "gpu/command_buffer/service/context_state.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
+
namespace gpu {
namespace gles2 {
+namespace {
+
+void EnableDisable(GLenum pname, bool enable) {
+ if (enable) {
+ glEnable(pname);
+ } else {
+ glDisable(pname);
+ }
+}
+
+} // anonymous namespace.
+
TextureUnit::TextureUnit()
: bind_target(GL_TEXTURE_2D) {
}
@@ -18,78 +32,22 @@ ContextState::ContextState()
: pack_alignment(4),
unpack_alignment(4),
active_texture_unit(0),
- color_clear_red(0),
- color_clear_green(0),
- color_clear_blue(0),
- color_clear_alpha(0),
- color_mask_red(true),
- color_mask_green(true),
- color_mask_blue(true),
- color_mask_alpha(true),
- depth_clear(1.0f),
- depth_mask(true),
- depth_func(GL_LESS),
- z_near(0.0f),
- z_far(1.0f),
- enable_blend(false),
- enable_cull_face(false),
- enable_scissor_test(false),
- enable_depth_test(false),
- enable_stencil_test(false),
- enable_polygon_offset_fill(false),
- enable_dither(true),
- enable_sample_alpha_to_coverage(false),
- enable_sample_coverage(false),
- viewport_x(0),
- viewport_y(0),
- viewport_width(0),
- viewport_height(0),
viewport_max_width(0),
viewport_max_height(0),
- scissor_x(0),
- scissor_y(0),
- scissor_width(0),
- scissor_height(0),
- cull_mode(GL_BACK),
- front_face(GL_CCW),
- blend_source_rgb(GL_ONE),
- blend_dest_rgb(GL_ZERO),
- blend_source_alpha(GL_ONE),
- blend_dest_alpha(GL_ZERO),
- blend_equation_rgb(GL_FUNC_ADD),
- blend_equation_alpha(GL_FUNC_ADD),
- blend_color_red(0),
- blend_color_green(0),
- blend_color_blue(0),
- blend_color_alpha(0),
- stencil_clear(0),
- stencil_front_writemask(0xFFFFFFFFU),
- stencil_front_func(GL_ALWAYS),
- stencil_front_ref(0),
- stencil_front_mask(0xFFFFFFFFU),
- stencil_front_fail_op(GL_KEEP),
- stencil_front_z_fail_op(GL_KEEP),
- stencil_front_z_pass_op(GL_KEEP),
- stencil_back_writemask(0xFFFFFFFFU),
- stencil_back_func(GL_ALWAYS),
- stencil_back_ref(0),
- stencil_back_mask(0xFFFFFFFFU),
- stencil_back_fail_op(GL_KEEP),
- stencil_back_z_fail_op(GL_KEEP),
- stencil_back_z_pass_op(GL_KEEP),
- polygon_offset_factor(0.0f),
- polygon_offset_units(0.0f),
- sample_coverage_value(1.0f),
- sample_coverage_invert(false),
- line_width(1.0),
hint_generate_mipmap(GL_DONT_CARE),
hint_fragment_shader_derivative(GL_DONT_CARE),
pack_reverse_row_order(false) {
+ Initialize();
}
ContextState::~ContextState() {
}
+// Include the auto-generated part of this file. We split this because it means
+// we can easily edit the non-auto generated parts right here in this file
+// instead of having to edit some template or the code generator.
+#include "gpu/command_buffer/service/context_state_impl_autogen.h"
+
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/context_state_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698