X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fgpu%2Fcommand_buffer%2Fservice%2Fcontext_state.h;h=e436e74e280a4a65636beefc1989feadc4d67ee4;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=2c1f0e172c0549803a143816423c7a759914d519;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/gpu/command_buffer/service/context_state.h b/src/gpu/command_buffer/service/context_state.h index 2c1f0e1..e436e74 100644 --- a/src/gpu/command_buffer/service/context_state.h +++ b/src/gpu/command_buffer/service/context_state.h @@ -101,16 +101,23 @@ struct GPU_EXPORT ContextState { void Initialize(); + void SetIgnoreCachedStateForTest(bool ignore) { + ignore_cached_state = ignore; + } + void RestoreState(const ContextState* prev_state) const; - void InitCapabilities() const; - void InitState() const; + void InitCapabilities(const ContextState* prev_state) const; + void InitState(const ContextState* prev_state) const; void RestoreActiveTexture() const; void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; void RestoreActiveTextureUnitBinding(unsigned int target) const; - void RestoreAttribute(GLuint index) const; + void RestoreVertexAttribValues() const; + void RestoreVertexAttribArrays( + const scoped_refptr attrib_manager) const; + void RestoreVertexAttribs() const; void RestoreBufferBindings() const; - void RestoreGlobalState() const; + void RestoreGlobalState(const ContextState* prev_state) const; void RestoreProgramBindings() const; void RestoreRenderbufferBindings() const; void RestoreTextureUnitBindings( @@ -123,6 +130,44 @@ struct GPU_EXPORT ContextState { GLenum pname, GLfloat* params, GLsizei* num_written) const; bool GetEnabled(GLenum cap) const; + inline void SetDeviceColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) { + if (cached_color_mask_red == red && cached_color_mask_green == green && + cached_color_mask_blue == blue && cached_color_mask_alpha == alpha && + !ignore_cached_state) + return; + cached_color_mask_red = red; + cached_color_mask_green = green; + cached_color_mask_blue = blue; + cached_color_mask_alpha = alpha; + glColorMask(red, green, blue, alpha); + } + + inline void SetDeviceDepthMask(GLboolean mask) { + if (cached_depth_mask == mask && !ignore_cached_state) + return; + cached_depth_mask = mask; + glDepthMask(mask); + } + + inline void SetDeviceStencilMaskSeparate(GLenum op, GLuint mask) { + if (op == GL_FRONT) { + if (cached_stencil_front_writemask == mask && !ignore_cached_state) + return; + cached_stencil_front_writemask = mask; + } else if (op == GL_BACK) { + if (cached_stencil_back_writemask == mask && !ignore_cached_state) + return; + cached_stencil_back_writemask = mask; + } else { + NOTREACHED(); + return; + } + glStencilMaskSeparate(op, mask); + } + ErrorState* GetErrorState(); #include "gpu/command_buffer/service/context_state_autogen.h" @@ -146,6 +191,7 @@ struct GPU_EXPORT ContextState { // Class that manages vertex attribs. scoped_refptr vertex_attrib_manager; + scoped_refptr default_vertex_attrib_manager; // The program in use by glUseProgram scoped_refptr current_program; @@ -158,6 +204,7 @@ struct GPU_EXPORT ContextState { QueryMap current_queries; bool pack_reverse_row_order; + bool ignore_cached_state; mutable bool fbo_binding_for_scissor_workaround_dirty_; FeatureInfo* feature_info_;