| 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 <vector> | 10 #include <vector> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 GLboolean blue, | 202 GLboolean blue, |
| 203 GLboolean alpha) { | 203 GLboolean alpha) { |
| 204 if (cached_color_mask_red == red && cached_color_mask_green == green && | 204 if (cached_color_mask_red == red && cached_color_mask_green == green && |
| 205 cached_color_mask_blue == blue && cached_color_mask_alpha == alpha && | 205 cached_color_mask_blue == blue && cached_color_mask_alpha == alpha && |
| 206 !ignore_cached_state) | 206 !ignore_cached_state) |
| 207 return; | 207 return; |
| 208 cached_color_mask_red = red; | 208 cached_color_mask_red = red; |
| 209 cached_color_mask_green = green; | 209 cached_color_mask_green = green; |
| 210 cached_color_mask_blue = blue; | 210 cached_color_mask_blue = blue; |
| 211 cached_color_mask_alpha = alpha; | 211 cached_color_mask_alpha = alpha; |
| 212 glColorMask(red, green, blue, alpha); | 212 glColorMask(red, green, blue, emulating_rgb_with_rgba ? false : alpha); |
| 213 } | 213 } |
| 214 | 214 |
| 215 inline void SetDeviceDepthMask(GLboolean mask) { | 215 inline void SetDeviceDepthMask(GLboolean mask) { |
| 216 if (cached_depth_mask == mask && !ignore_cached_state) | 216 if (cached_depth_mask == mask && !ignore_cached_state) |
| 217 return; | 217 return; |
| 218 cached_depth_mask = mask; | 218 cached_depth_mask = mask; |
| 219 glDepthMask(mask); | 219 glDepthMask(mask); |
| 220 } | 220 } |
| 221 | 221 |
| 222 inline void SetDeviceStencilMaskSeparate(GLenum op, GLuint mask) { | 222 inline void SetDeviceStencilMaskSeparate(GLenum op, GLuint mask) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 bool bound_renderbuffer_valid; | 287 bool bound_renderbuffer_valid; |
| 288 | 288 |
| 289 // The currently bound valuebuffer | 289 // The currently bound valuebuffer |
| 290 scoped_refptr<Valuebuffer> bound_valuebuffer; | 290 scoped_refptr<Valuebuffer> bound_valuebuffer; |
| 291 | 291 |
| 292 bool pack_reverse_row_order; | 292 bool pack_reverse_row_order; |
| 293 bool ignore_cached_state; | 293 bool ignore_cached_state; |
| 294 | 294 |
| 295 mutable bool fbo_binding_for_scissor_workaround_dirty; | 295 mutable bool fbo_binding_for_scissor_workaround_dirty; |
| 296 | 296 |
| 297 bool emulating_rgb_with_rgba; |
| 298 |
| 297 private: | 299 private: |
| 298 void EnableDisable(GLenum pname, bool enable) const; | 300 void EnableDisable(GLenum pname, bool enable) const; |
| 299 | 301 |
| 300 // If a buffer object is bound to PIXEL_PACK_BUFFER, set all pack parameters | 302 // If a buffer object is bound to PIXEL_PACK_BUFFER, set all pack parameters |
| 301 // user values; otherwise, set them to 0. | 303 // user values; otherwise, set them to 0. |
| 302 void UpdatePackParameters() const; | 304 void UpdatePackParameters() const; |
| 303 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack | 305 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack |
| 304 // parameters user values; otherwise, set them to 0. | 306 // parameters user values; otherwise, set them to 0. |
| 305 void UpdateUnpackParameters() const; | 307 void UpdateUnpackParameters() const; |
| 306 | 308 |
| 307 void InitStateManual(const ContextState* prev_state) const; | 309 void InitStateManual(const ContextState* prev_state) const; |
| 308 | 310 |
| 309 FeatureInfo* feature_info_; | 311 FeatureInfo* feature_info_; |
| 310 scoped_ptr<ErrorState> error_state_; | 312 scoped_ptr<ErrorState> error_state_; |
| 311 }; | 313 }; |
| 312 | 314 |
| 313 } // namespace gles2 | 315 } // namespace gles2 |
| 314 } // namespace gpu | 316 } // namespace gpu |
| 315 | 317 |
| 316 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 318 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 317 | |
| OLD | NEW |