Chromium Code Reviews| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 return; | 236 return; |
| 237 } | 237 } |
| 238 glStencilMaskSeparate(op, mask); | 238 glStencilMaskSeparate(op, mask); |
| 239 } | 239 } |
| 240 | 240 |
| 241 ErrorState* GetErrorState(); | 241 ErrorState* GetErrorState(); |
| 242 | 242 |
| 243 void SetBoundBuffer(GLenum target, Buffer* buffer); | 243 void SetBoundBuffer(GLenum target, Buffer* buffer); |
| 244 void RemoveBoundBuffer(Buffer* buffer); | 244 void RemoveBoundBuffer(Buffer* buffer); |
| 245 | 245 |
| 246 void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) { | |
| 247 DCHECK(index >=0 && index < 16); | |
| 248 int shift_bits = index * 2; | |
| 249 generic_attrib_type_written_mask_ |= ~(0x3 << shift_bits); | |
| 250 generic_attrib_base_type_ &= ~(0x3 << shift_bits); | |
| 251 generic_attrib_base_type_ |= base_type << shift_bits; | |
| 252 } | |
| 253 | |
| 254 uint32_t GetGenericVertexAttribBaseType() { | |
| 255 return generic_attrib_base_type_; | |
| 256 } | |
| 257 | |
| 258 uint32_t GetGenericVertexAttribTypeMask() { | |
| 259 return generic_attrib_type_written_mask_; | |
| 260 } | |
| 261 | |
| 246 void UnbindTexture(TextureRef* texture); | 262 void UnbindTexture(TextureRef* texture); |
| 247 void UnbindSampler(Sampler* sampler); | 263 void UnbindSampler(Sampler* sampler); |
| 248 | 264 |
| 249 PixelStoreParams GetPackParams(); | 265 PixelStoreParams GetPackParams(); |
| 250 PixelStoreParams GetUnpackParams(Dimension dimension); | 266 PixelStoreParams GetUnpackParams(Dimension dimension); |
| 251 | 267 |
| 252 void EnableDisableFramebufferSRGB(bool enable); | 268 void EnableDisableFramebufferSRGB(bool enable); |
| 253 | 269 |
| 254 #include "gpu/command_buffer/service/context_state_autogen.h" | 270 #include "gpu/command_buffer/service/context_state_autogen.h" |
| 255 | 271 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 // user values; otherwise, set them to 0. | 329 // user values; otherwise, set them to 0. |
| 314 void UpdatePackParameters() const; | 330 void UpdatePackParameters() const; |
| 315 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack | 331 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack |
| 316 // parameters user values; otherwise, set them to 0. | 332 // parameters user values; otherwise, set them to 0. |
| 317 void UpdateUnpackParameters() const; | 333 void UpdateUnpackParameters() const; |
| 318 | 334 |
| 319 void InitStateManual(const ContextState* prev_state) const; | 335 void InitStateManual(const ContextState* prev_state) const; |
| 320 | 336 |
| 321 bool framebuffer_srgb_; | 337 bool framebuffer_srgb_; |
| 322 | 338 |
| 339 // Generic vertex attrib base types: FLOAT, INT, or UINT. | |
| 340 // We have up to 16 attribs, each is encoded into 2 bits, total 32 bits | |
| 341 // the lowest 2 bits for location 0, the highest 2 bits for location 15. | |
| 342 uint32_t generic_attrib_base_type_; | |
|
Zhenyao Mo
2016/07/21 13:10:46
You didn't address the issue of attribs to be more
yunchao
2016/07/22 13:43:54
Done.
| |
| 343 // Same layout as above, 2 bits per location, 0x03 if a location is set | |
| 344 // by vertexAttrib API, 0x00 if not. | |
| 345 uint32_t generic_attrib_type_written_mask_; | |
| 346 | |
| 323 FeatureInfo* feature_info_; | 347 FeatureInfo* feature_info_; |
| 324 std::unique_ptr<ErrorState> error_state_; | 348 std::unique_ptr<ErrorState> error_state_; |
| 325 }; | 349 }; |
| 326 | 350 |
| 327 } // namespace gles2 | 351 } // namespace gles2 |
| 328 } // namespace gpu | 352 } // namespace gpu |
| 329 | 353 |
| 330 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 354 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 331 | 355 |
| OLD | NEW |