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<VertexAttribManager> 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(
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"
// Class that manages vertex attribs.
scoped_refptr<VertexAttribManager> vertex_attrib_manager;
+ scoped_refptr<VertexAttribManager> default_vertex_attrib_manager;
// The program in use by glUseProgram
scoped_refptr<Program> current_program;
QueryMap current_queries;
bool pack_reverse_row_order;
+ bool ignore_cached_state;
mutable bool fbo_binding_for_scissor_workaround_dirty_;
FeatureInfo* feature_info_;