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

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

Issue 245923008: Optimize GLES2DecoderImpl::ApplyDirtyState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on refactored gles2_cmd_decoder_unittest.cc Created 6 years, 8 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
Index: gpu/command_buffer/service/context_state_autogen.h
diff --git a/gpu/command_buffer/service/context_state_autogen.h b/gpu/command_buffer/service/context_state_autogen.h
index 6e408a34476362c4b069d4114f30c8f7cf43db4d..309301f1b2810cfc73b1d55cb1fa6d0ffdca5cca 100644
--- a/gpu/command_buffer/service/context_state_autogen.h
+++ b/gpu/command_buffer/service/context_state_autogen.h
@@ -15,14 +15,23 @@
struct EnableFlags {
EnableFlags();
bool blend;
+ bool cached_blend;
bool cull_face;
+ bool cached_cull_face;
bool depth_test;
+ bool cached_depth_test;
bool dither;
+ bool cached_dither;
bool polygon_offset_fill;
+ bool cached_polygon_offset_fill;
bool sample_alpha_to_coverage;
+ bool cached_sample_alpha_to_coverage;
bool sample_coverage;
+ bool cached_sample_coverage;
bool scissor_test;
+ bool cached_scissor_test;
bool stencil_test;
+ bool cached_stencil_test;
};
GLfloat blend_color_red;
@@ -42,12 +51,17 @@ GLfloat color_clear_alpha;
GLclampf depth_clear;
GLint stencil_clear;
GLboolean color_mask_red;
+GLboolean cached_color_mask_red;
GLboolean color_mask_green;
+GLboolean cached_color_mask_green;
GLboolean color_mask_blue;
+GLboolean cached_color_mask_blue;
GLboolean color_mask_alpha;
+GLboolean cached_color_mask_alpha;
GLenum cull_mode;
GLenum depth_func;
GLboolean depth_mask;
+GLboolean cached_depth_mask;
GLclampf z_near;
GLclampf z_far;
GLenum front_face;
@@ -71,7 +85,9 @@ GLenum stencil_back_func;
GLint stencil_back_ref;
GLuint stencil_back_mask;
GLuint stencil_front_writemask;
+GLuint cached_stencil_front_writemask;
GLuint stencil_back_writemask;
+GLuint cached_stencil_back_writemask;
GLenum stencil_front_fail_op;
GLenum stencil_front_z_fail_op;
GLenum stencil_front_z_pass_op;
@@ -83,4 +99,62 @@ GLint viewport_y;
GLsizei viewport_width;
GLsizei viewport_height;
+inline void SetDeviceCapabilityState(GLenum cap, bool enable) {
+ switch (cap) {
+ case GL_BLEND:
+ if (enable_flags.cached_blend == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_blend = enable;
+ break;
+ case GL_CULL_FACE:
+ if (enable_flags.cached_cull_face == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_cull_face = enable;
+ break;
+ case GL_DEPTH_TEST:
+ if (enable_flags.cached_depth_test == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_depth_test = enable;
+ break;
+ case GL_DITHER:
+ if (enable_flags.cached_dither == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_dither = enable;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ if (enable_flags.cached_polygon_offset_fill == enable &&
+ !ignore_cached_state)
+ return;
+ enable_flags.cached_polygon_offset_fill = enable;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ if (enable_flags.cached_sample_alpha_to_coverage == enable &&
+ !ignore_cached_state)
+ return;
+ enable_flags.cached_sample_alpha_to_coverage = enable;
+ break;
+ case GL_SAMPLE_COVERAGE:
+ if (enable_flags.cached_sample_coverage == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_sample_coverage = enable;
+ break;
+ case GL_SCISSOR_TEST:
+ if (enable_flags.cached_scissor_test == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_scissor_test = enable;
+ break;
+ case GL_STENCIL_TEST:
+ if (enable_flags.cached_stencil_test == enable && !ignore_cached_state)
+ return;
+ enable_flags.cached_stencil_test = enable;
+ break;
+ default:
+ NOTREACHED();
+ return;
+ }
+ if (enable)
+ glEnable(cap);
+ else
+ glDisable(cap);
+}
#endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_AUTOGEN_H_
« no previous file with comments | « gpu/command_buffer/service/context_state.cc ('k') | gpu/command_buffer/service/context_state_impl_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698