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

Unified Diff: gpu/command_buffer/service/context_state_impl_autogen.h

Issue 11363191: Cache more GL state both service and client side. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/context_state_impl_autogen.h
diff --git a/gpu/command_buffer/service/context_state_impl_autogen.h b/gpu/command_buffer/service/context_state_impl_autogen.h
index c33cb7fb11379d564e8979422df0dd38e2c728b2..5342435814172ff79bdff9f5a1137e243fb986cc 100644
--- a/gpu/command_buffer/service/context_state_impl_autogen.h
+++ b/gpu/command_buffer/service/context_state_impl_autogen.h
@@ -126,5 +126,631 @@ void ContextState::InitState() const {
stencil_back_z_pass_op);
glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
}
+bool ContextState::GetEnabled(GLenum cap) const {
+ switch (cap) {
+ case GL_BLEND:
+ return enable_flags.blend;
+ case GL_CULL_FACE:
+ return enable_flags.cull_face;
+ case GL_DEPTH_TEST:
+ return enable_flags.depth_test;
+ case GL_DITHER:
+ return enable_flags.dither;
+ case GL_POLYGON_OFFSET_FILL:
+ return enable_flags.polygon_offset_fill;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ return enable_flags.sample_alpha_to_coverage;
+ case GL_SAMPLE_COVERAGE:
+ return enable_flags.sample_coverage;
+ case GL_SCISSOR_TEST:
+ return enable_flags.scissor_test;
+ case GL_STENCIL_TEST:
+ return enable_flags.stencil_test;
+ default:
+ GPU_NOTREACHED();
+ return false;
+ }
+}
+
+bool ContextState::GetStateAsGLint(
+ GLenum pname, GLint* params, GLsizei* num_written) const {
+ switch (pname) {
+ case GL_VIEWPORT:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(viewport_x);
+ params[1] = static_cast<GLint>(viewport_y);
+ params[2] = static_cast<GLint>(viewport_width);
+ params[3] = static_cast<GLint>(viewport_height);
+ }
+ return true;
+ case GL_BLEND_SRC_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_source_rgb);
+ }
+ return true;
+ case GL_BLEND_DST_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_dest_rgb);
+ }
+ return true;
+ case GL_BLEND_SRC_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_source_alpha);
+ }
+ return true;
+ case GL_BLEND_DST_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_dest_alpha);
+ }
+ return true;
+ case GL_LINE_WIDTH:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(line_width);
+ }
+ return true;
+ case GL_BLEND_COLOR:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_color_red);
+ params[1] = static_cast<GLint>(blend_color_green);
+ params[2] = static_cast<GLint>(blend_color_blue);
+ params[3] = static_cast<GLint>(blend_color_alpha);
+ }
+ return true;
+ case GL_STENCIL_CLEAR_VALUE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_clear);
+ }
+ return true;
+ case GL_COLOR_WRITEMASK:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(color_mask_red);
+ params[1] = static_cast<GLint>(color_mask_green);
+ params[2] = static_cast<GLint>(color_mask_blue);
+ params[3] = static_cast<GLint>(color_mask_alpha);
+ }
+ return true;
+ case GL_COLOR_CLEAR_VALUE:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(color_clear_red);
+ params[1] = static_cast<GLint>(color_clear_green);
+ params[2] = static_cast<GLint>(color_clear_blue);
+ params[3] = static_cast<GLint>(color_clear_alpha);
+ }
+ return true;
+ case GL_DEPTH_RANGE:
+ *num_written = 2;
+ if (params) {
+ params[0] = static_cast<GLint>(z_near);
+ params[1] = static_cast<GLint>(z_far);
+ }
+ return true;
+ case GL_DEPTH_CLEAR_VALUE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(depth_clear);
+ }
+ return true;
+ case GL_STENCIL_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_fail_op);
+ }
+ return true;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_z_fail_op);
+ }
+ return true;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_z_pass_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_z_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_z_pass_op);
+ }
+ return true;
+ case GL_SCISSOR_BOX:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(scissor_x);
+ params[1] = static_cast<GLint>(scissor_y);
+ params[2] = static_cast<GLint>(scissor_width);
+ params[3] = static_cast<GLint>(scissor_height);
+ }
+ return true;
+ case GL_FRONT_FACE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(front_face);
+ }
+ return true;
+ case GL_SAMPLE_COVERAGE_VALUE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(sample_coverage_value);
+ }
+ return true;
+ case GL_SAMPLE_COVERAGE_INVERT:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(sample_coverage_invert);
+ }
+ return true;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(polygon_offset_factor);
+ }
+ return true;
+ case GL_POLYGON_OFFSET_UNITS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(polygon_offset_units);
+ }
+ return true;
+ case GL_CULL_FACE_MODE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(cull_mode);
+ }
+ return true;
+ case GL_DEPTH_FUNC:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(depth_func);
+ }
+ return true;
+ case GL_STENCIL_FUNC:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_func);
+ }
+ return true;
+ case GL_STENCIL_REF:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_ref);
+ }
+ return true;
+ case GL_STENCIL_VALUE_MASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_mask);
+ }
+ return true;
+ case GL_STENCIL_BACK_FUNC:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_func);
+ }
+ return true;
+ case GL_STENCIL_BACK_REF:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_ref);
+ }
+ return true;
+ case GL_STENCIL_BACK_VALUE_MASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_mask);
+ }
+ return true;
+ case GL_DEPTH_WRITEMASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(depth_mask);
+ }
+ return true;
+ case GL_BLEND_EQUATION_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_equation_rgb);
+ }
+ return true;
+ case GL_BLEND_EQUATION_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_equation_alpha);
+ }
+ return true;
+ case GL_STENCIL_WRITEMASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_front_writemask);
+ }
+ return true;
+ case GL_STENCIL_BACK_WRITEMASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_writemask);
+ }
+ return true;
+ case GL_BLEND:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.blend);
+ }
+ return true;
+ case GL_CULL_FACE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.cull_face);
+ }
+ return true;
+ case GL_DEPTH_TEST:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.depth_test);
+ }
+ return true;
+ case GL_DITHER:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.dither);
+ }
+ return true;
+ case GL_POLYGON_OFFSET_FILL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.polygon_offset_fill);
+ }
+ return true;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.sample_alpha_to_coverage);
+ }
+ return true;
+ case GL_SAMPLE_COVERAGE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.sample_coverage);
+ }
+ return true;
+ case GL_SCISSOR_TEST:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.scissor_test);
+ }
+ return true;
+ case GL_STENCIL_TEST:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(enable_flags.stencil_test);
+ }
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ContextState::GetStateAsGLfloat(
+ GLenum pname, GLfloat* params, GLsizei* num_written) const {
+ switch (pname) {
+ case GL_VIEWPORT:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(viewport_x);
+ params[1] = static_cast<GLfloat>(viewport_y);
+ params[2] = static_cast<GLfloat>(viewport_width);
+ params[3] = static_cast<GLfloat>(viewport_height);
+ }
+ return true;
+ case GL_BLEND_SRC_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_source_rgb);
+ }
+ return true;
+ case GL_BLEND_DST_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_dest_rgb);
+ }
+ return true;
+ case GL_BLEND_SRC_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_source_alpha);
+ }
+ return true;
+ case GL_BLEND_DST_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_dest_alpha);
+ }
+ return true;
+ case GL_LINE_WIDTH:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(line_width);
+ }
+ return true;
+ case GL_BLEND_COLOR:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_color_red);
+ params[1] = static_cast<GLfloat>(blend_color_green);
+ params[2] = static_cast<GLfloat>(blend_color_blue);
+ params[3] = static_cast<GLfloat>(blend_color_alpha);
+ }
+ return true;
+ case GL_STENCIL_CLEAR_VALUE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_clear);
+ }
+ return true;
+ case GL_COLOR_WRITEMASK:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(color_mask_red);
+ params[1] = static_cast<GLfloat>(color_mask_green);
+ params[2] = static_cast<GLfloat>(color_mask_blue);
+ params[3] = static_cast<GLfloat>(color_mask_alpha);
+ }
+ return true;
+ case GL_COLOR_CLEAR_VALUE:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(color_clear_red);
+ params[1] = static_cast<GLfloat>(color_clear_green);
+ params[2] = static_cast<GLfloat>(color_clear_blue);
+ params[3] = static_cast<GLfloat>(color_clear_alpha);
+ }
+ return true;
+ case GL_DEPTH_RANGE:
+ *num_written = 2;
+ if (params) {
+ params[0] = static_cast<GLfloat>(z_near);
+ params[1] = static_cast<GLfloat>(z_far);
+ }
+ return true;
+ case GL_DEPTH_CLEAR_VALUE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(depth_clear);
+ }
+ return true;
+ case GL_STENCIL_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_fail_op);
+ }
+ return true;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_z_fail_op);
+ }
+ return true;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_z_pass_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_z_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_z_pass_op);
+ }
+ return true;
+ case GL_SCISSOR_BOX:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(scissor_x);
+ params[1] = static_cast<GLfloat>(scissor_y);
+ params[2] = static_cast<GLfloat>(scissor_width);
+ params[3] = static_cast<GLfloat>(scissor_height);
+ }
+ return true;
+ case GL_FRONT_FACE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(front_face);
+ }
+ return true;
+ case GL_SAMPLE_COVERAGE_VALUE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(sample_coverage_value);
+ }
+ return true;
+ case GL_SAMPLE_COVERAGE_INVERT:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(sample_coverage_invert);
+ }
+ return true;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(polygon_offset_factor);
+ }
+ return true;
+ case GL_POLYGON_OFFSET_UNITS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(polygon_offset_units);
+ }
+ return true;
+ case GL_CULL_FACE_MODE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(cull_mode);
+ }
+ return true;
+ case GL_DEPTH_FUNC:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(depth_func);
+ }
+ return true;
+ case GL_STENCIL_FUNC:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_func);
+ }
+ return true;
+ case GL_STENCIL_REF:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_ref);
+ }
+ return true;
+ case GL_STENCIL_VALUE_MASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_mask);
+ }
+ return true;
+ case GL_STENCIL_BACK_FUNC:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_func);
+ }
+ return true;
+ case GL_STENCIL_BACK_REF:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_ref);
+ }
+ return true;
+ case GL_STENCIL_BACK_VALUE_MASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_mask);
+ }
+ return true;
+ case GL_DEPTH_WRITEMASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(depth_mask);
+ }
+ return true;
+ case GL_BLEND_EQUATION_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_equation_rgb);
+ }
+ return true;
+ case GL_BLEND_EQUATION_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_equation_alpha);
+ }
+ return true;
+ case GL_STENCIL_WRITEMASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_front_writemask);
+ }
+ return true;
+ case GL_STENCIL_BACK_WRITEMASK:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_writemask);
+ }
+ return true;
+ case GL_BLEND:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.blend);
+ }
+ return true;
+ case GL_CULL_FACE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.cull_face);
+ }
+ return true;
+ case GL_DEPTH_TEST:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.depth_test);
+ }
+ return true;
+ case GL_DITHER:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.dither);
+ }
+ return true;
+ case GL_POLYGON_OFFSET_FILL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.polygon_offset_fill);
+ }
+ return true;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ *num_written = 1;
+ if (params) {
+ params[0] =
+ static_cast<GLfloat>(enable_flags.sample_alpha_to_coverage);
+ }
+ return true;
+ case GL_SAMPLE_COVERAGE:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.sample_coverage);
+ }
+ return true;
+ case GL_SCISSOR_TEST:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.scissor_test);
+ }
+ return true;
+ case GL_STENCIL_TEST:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(enable_flags.stencil_test);
+ }
+ return true;
+ default:
+ return false;
+ }
+}
#endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698