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 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return transform_feedback_varyings_; | 390 return transform_feedback_varyings_; |
391 } | 391 } |
392 | 392 |
393 GLenum transform_feedback_buffer_mode() const { | 393 GLenum transform_feedback_buffer_mode() const { |
394 return transform_feedback_buffer_mode_; | 394 return transform_feedback_buffer_mode_; |
395 } | 395 } |
396 | 396 |
397 // See member declaration for details. | 397 // See member declaration for details. |
398 // The data are only valid after a successful link. | 398 // The data are only valid after a successful link. |
399 uint32_t fragment_output_type_mask() const { | 399 uint32_t fragment_output_type_mask() const { |
400 return fragment_output_type_mask_; | 400 return fragment_output_type_mask_; |
401 } | 401 } |
402 uint32_t fragment_output_written_mask() const { | 402 uint32_t fragment_output_written_mask() const { |
403 return fragment_output_written_mask_; | 403 return fragment_output_written_mask_; |
404 } | 404 } |
405 | 405 |
406 // The data are only valid after a successful link. | 406 // The data are only valid after a successful link. |
407 // Return 16 attributes' base types, in which the attribute | 407 const std::vector<uint32_t>& vertex_input_base_type_mask() const { |
408 // specified by argument 'loc' located. | 408 return vertex_input_base_type_mask_; |
409 uint32_t vertex_input_base_type_mask(GLuint loc) const { | |
410 DCHECK(loc < max_vertex_attribs_); | |
411 return vertex_input_base_type_mask_[loc / 16]; | |
412 } | 409 } |
413 // Return 16 attributes' type written masks, in which the | 410 const std::vector<uint32_t>& vertex_input_active_mask() const { |
414 // attribute specified by argument 'loc' located. | 411 return vertex_input_active_mask_; |
415 uint32_t vertex_input_type_written_mask(GLuint loc) const { | |
416 DCHECK(loc < max_vertex_attribs_); | |
417 return vertex_input_type_written_mask_[loc / 16]; | |
418 } | 412 } |
419 | 413 |
420 // Update uniform block binding after a successful glUniformBlockBinding(). | 414 // Update uniform block binding after a successful glUniformBlockBinding(). |
421 void SetUniformBlockBinding(GLuint index, GLuint binding); | 415 void SetUniformBlockBinding(GLuint index, GLuint binding); |
422 | 416 |
423 const std::vector<UniformBlockSizeInfo>& uniform_block_size_info() const { | 417 const std::vector<UniformBlockSizeInfo>& uniform_block_size_info() const { |
424 return uniform_block_size_info_; | 418 return uniform_block_size_info_; |
425 } | 419 } |
426 | 420 |
427 private: | 421 private: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return static_cast<size_t>(fake_location & 0xFFFF); | 491 return static_cast<size_t>(fake_location & 0xFFFF); |
498 } | 492 } |
499 | 493 |
500 static inline size_t GetArrayElementIndexFromFakeLocation( | 494 static inline size_t GetArrayElementIndexFromFakeLocation( |
501 GLint fake_location) { | 495 GLint fake_location) { |
502 return static_cast<size_t>((fake_location >> 16) & 0xFFFF); | 496 return static_cast<size_t>((fake_location >> 16) & 0xFFFF); |
503 } | 497 } |
504 | 498 |
505 const FeatureInfo& feature_info() const; | 499 const FeatureInfo& feature_info() const; |
506 | 500 |
| 501 void ClearVertexInputMasks(); |
| 502 |
507 ProgramManager* manager_; | 503 ProgramManager* manager_; |
508 | 504 |
509 int use_count_; | 505 int use_count_; |
510 | 506 |
511 GLsizei max_attrib_name_length_; | 507 GLsizei max_attrib_name_length_; |
512 | 508 |
513 // Attrib by index. | 509 // Attrib by index. |
514 AttribInfoVector attrib_infos_; | 510 AttribInfoVector attrib_infos_; |
515 | 511 |
516 // Attrib by location to index. | 512 // Attrib by location to index. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 std::vector<UniformBlockSizeInfo> uniform_block_size_info_; | 570 std::vector<UniformBlockSizeInfo> uniform_block_size_info_; |
575 | 571 |
576 // Fragment output variable base types: FLOAT, INT, or UINT. | 572 // Fragment output variable base types: FLOAT, INT, or UINT. |
577 // We have up to 16 outputs, each is encoded into 2 bits, total 32 bits: | 573 // We have up to 16 outputs, each is encoded into 2 bits, total 32 bits: |
578 // the lowest 2 bits for location 0, the highest 2 bits for location 15. | 574 // the lowest 2 bits for location 0, the highest 2 bits for location 15. |
579 uint32_t fragment_output_type_mask_; | 575 uint32_t fragment_output_type_mask_; |
580 // Same layout as above, 2 bits per location, 0x03 if a location is occupied | 576 // Same layout as above, 2 bits per location, 0x03 if a location is occupied |
581 // by an output variable, 0x00 if not. | 577 // by an output variable, 0x00 if not. |
582 uint32_t fragment_output_written_mask_; | 578 uint32_t fragment_output_written_mask_; |
583 | 579 |
584 uint32_t max_vertex_attribs_; | |
585 // Vertex input attrib base types: FLOAT, INT, or UINT. | 580 // Vertex input attrib base types: FLOAT, INT, or UINT. |
586 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, | 581 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, |
587 // the highest 2 bits for location (max_vertex_attribs_ - 1). | 582 // the highest 2 bits for location (max_vertex_attribs - 1). |
588 std::vector<uint32_t> vertex_input_base_type_mask_; | 583 std::vector<uint32_t> vertex_input_base_type_mask_; |
589 // Same layout as above, 2 bits per location, 0x03 if a location is set | 584 // Same layout as above, 2 bits per location, 0x03 if a location is set |
590 // by vertexAttrib API, 0x00 if not. | 585 // by vertexAttrib API, 0x00 if not. |
591 std::vector<uint32_t> vertex_input_type_written_mask_; | 586 std::vector<uint32_t> vertex_input_active_mask_; |
592 }; | 587 }; |
593 | 588 |
594 // Tracks the Programs. | 589 // Tracks the Programs. |
595 // | 590 // |
596 // NOTE: To support shared resources an instance of this class will | 591 // NOTE: To support shared resources an instance of this class will |
597 // need to be shared by multiple GLES2Decoders. | 592 // need to be shared by multiple GLES2Decoders. |
598 class GPU_EXPORT ProgramManager { | 593 class GPU_EXPORT ProgramManager { |
599 public: | 594 public: |
600 ProgramManager(ProgramCache* program_cache, | 595 ProgramManager(ProgramCache* program_cache, |
601 uint32_t max_varying_vectors, | 596 uint32_t max_varying_vectors, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 }; | 684 }; |
690 | 685 |
691 inline const FeatureInfo& Program::feature_info() const { | 686 inline const FeatureInfo& Program::feature_info() const { |
692 return *manager_->feature_info_.get(); | 687 return *manager_->feature_info_.get(); |
693 } | 688 } |
694 | 689 |
695 } // namespace gles2 | 690 } // namespace gles2 |
696 } // namespace gpu | 691 } // namespace gpu |
697 | 692 |
698 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 693 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
OLD | NEW |