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