| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains the ContextState class. | 5 // This file contains the ContextState class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 GLboolean alpha) { | 219 GLboolean alpha) { |
| 220 if (cached_color_mask_red == red && cached_color_mask_green == green && | 220 if (cached_color_mask_red == red && cached_color_mask_green == green && |
| 221 cached_color_mask_blue == blue && cached_color_mask_alpha == alpha && | 221 cached_color_mask_blue == blue && cached_color_mask_alpha == alpha && |
| 222 !ignore_cached_state) | 222 !ignore_cached_state) |
| 223 return; | 223 return; |
| 224 cached_color_mask_red = red; | 224 cached_color_mask_red = red; |
| 225 cached_color_mask_green = green; | 225 cached_color_mask_green = green; |
| 226 cached_color_mask_blue = blue; | 226 cached_color_mask_blue = blue; |
| 227 cached_color_mask_alpha = alpha; | 227 cached_color_mask_alpha = alpha; |
| 228 glColorMask(red, green, blue, alpha); | 228 glColorMask(red, green, blue, alpha); |
| 229 // print(" ****** set color mask **** \n"); |
| 229 } | 230 } |
| 230 | 231 |
| 231 inline void SetDeviceDepthMask(GLboolean mask) { | 232 inline void SetDeviceDepthMask(GLboolean mask) { |
| 232 if (cached_depth_mask == mask && !ignore_cached_state) | 233 if (cached_depth_mask == mask && !ignore_cached_state) |
| 233 return; | 234 return; |
| 234 cached_depth_mask = mask; | 235 cached_depth_mask = mask; |
| 235 glDepthMask(mask); | 236 glDepthMask(mask); |
| 237 // print(" @@@@@@ set depth mask **** \n"); |
| 236 } | 238 } |
| 237 | 239 |
| 238 inline void SetDeviceStencilMaskSeparate(GLenum op, GLuint mask) { | 240 inline void SetDeviceStencilMaskSeparate(GLenum op, GLuint mask) { |
| 239 if (op == GL_FRONT) { | 241 if (op == GL_FRONT) { |
| 240 if (cached_stencil_front_writemask == mask && !ignore_cached_state) | 242 if (cached_stencil_front_writemask == mask && !ignore_cached_state) |
| 241 return; | 243 return; |
| 242 cached_stencil_front_writemask = mask; | 244 cached_stencil_front_writemask = mask; |
| 243 } else if (op == GL_BACK) { | 245 } else if (op == GL_BACK) { |
| 244 if (cached_stencil_back_writemask == mask && !ignore_cached_state) | 246 if (cached_stencil_back_writemask == mask && !ignore_cached_state) |
| 245 return; | 247 return; |
| 246 cached_stencil_back_writemask = mask; | 248 cached_stencil_back_writemask = mask; |
| 247 } else { | 249 } else { |
| 248 NOTREACHED(); | 250 NOTREACHED(); |
| 249 return; | 251 return; |
| 250 } | 252 } |
| 251 glStencilMaskSeparate(op, mask); | 253 glStencilMaskSeparate(op, mask); |
| 254 // print(" ##### set stencil mask **** \n"); |
| 252 } | 255 } |
| 253 | 256 |
| 254 ErrorState* GetErrorState(); | 257 ErrorState* GetErrorState(); |
| 255 | 258 |
| 256 void SetBoundBuffer(GLenum target, Buffer* buffer); | 259 void SetBoundBuffer(GLenum target, Buffer* buffer); |
| 257 void RemoveBoundBuffer(Buffer* buffer); | 260 void RemoveBoundBuffer(Buffer* buffer); |
| 258 | 261 |
| 259 void InitGenericAttribs(GLuint max_vertex_attribs) { | 262 void InitGenericAttribs(GLuint max_vertex_attribs) { |
| 260 attrib_values.resize(max_vertex_attribs); | 263 attrib_values.resize(max_vertex_attribs); |
| 261 | 264 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 GLfloat line_width_max_ = 1.0f; | 372 GLfloat line_width_max_ = 1.0f; |
| 370 | 373 |
| 371 FeatureInfo* feature_info_; | 374 FeatureInfo* feature_info_; |
| 372 std::unique_ptr<ErrorState> error_state_; | 375 std::unique_ptr<ErrorState> error_state_; |
| 373 }; | 376 }; |
| 374 | 377 |
| 375 } // namespace gles2 | 378 } // namespace gles2 |
| 376 } // namespace gpu | 379 } // namespace gpu |
| 377 | 380 |
| 378 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 381 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| OLD | NEW |