| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. |
| 407 uint32_t vertex_input_type_mask() const { |
| 408 return vertex_input_type_mask_; |
| 409 } |
| 410 uint32_t vertex_input_written_mask() const { |
| 411 return vertex_input_written_mask_; |
| 412 } |
| 413 |
| 406 // Update uniform block binding after a successful glUniformBlockBinding(). | 414 // Update uniform block binding after a successful glUniformBlockBinding(). |
| 407 void SetUniformBlockBinding(GLuint index, GLuint binding); | 415 void SetUniformBlockBinding(GLuint index, GLuint binding); |
| 408 | 416 |
| 409 const std::vector<UniformBlockSizeInfo>& uniform_block_size_info() const { | 417 const std::vector<UniformBlockSizeInfo>& uniform_block_size_info() const { |
| 410 return uniform_block_size_info_; | 418 return uniform_block_size_info_; |
| 411 } | 419 } |
| 412 | 420 |
| 413 private: | 421 private: |
| 414 friend class base::RefCounted<Program>; | 422 friend class base::RefCounted<Program>; |
| 415 friend class ProgramManager; | 423 friend class ProgramManager; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 440 | 448 |
| 441 // Resets the program. | 449 // Resets the program. |
| 442 void Reset(); | 450 void Reset(); |
| 443 | 451 |
| 444 // Updates the program info after a successful link. | 452 // Updates the program info after a successful link. |
| 445 void Update(); | 453 void Update(); |
| 446 void UpdateUniforms(); | 454 void UpdateUniforms(); |
| 447 void UpdateFragmentInputs(); | 455 void UpdateFragmentInputs(); |
| 448 void UpdateProgramOutputs(); | 456 void UpdateProgramOutputs(); |
| 449 void UpdateFragmentOutputBaseTypes(); | 457 void UpdateFragmentOutputBaseTypes(); |
| 458 void UpdateVertexInputBaseTypes(); |
| 450 void UpdateUniformBlockSizeInfo(); | 459 void UpdateUniformBlockSizeInfo(); |
| 451 | 460 |
| 452 // Process the program log, replacing the hashed names with original names. | 461 // Process the program log, replacing the hashed names with original names. |
| 453 std::string ProcessLogInfo(const std::string& log); | 462 std::string ProcessLogInfo(const std::string& log); |
| 454 | 463 |
| 455 // Updates the program log info from GL | 464 // Updates the program log info from GL |
| 456 void UpdateLogInfo(); | 465 void UpdateLogInfo(); |
| 457 | 466 |
| 458 // Clears all the uniforms. | 467 // Clears all the uniforms. |
| 459 void ClearUniforms(std::vector<uint8_t>* zero_buffer); | 468 void ClearUniforms(std::vector<uint8_t>* zero_buffer); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 // entry is the info about UniformBlock with index 0, etc. | 567 // entry is the info about UniformBlock with index 0, etc. |
| 559 std::vector<UniformBlockSizeInfo> uniform_block_size_info_; | 568 std::vector<UniformBlockSizeInfo> uniform_block_size_info_; |
| 560 | 569 |
| 561 // Fragment output variable base types: FLOAT, INT, or UINT. | 570 // Fragment output variable base types: FLOAT, INT, or UINT. |
| 562 // We have up to 16 outputs, each is encoded into 2 bits, total 32 bits: | 571 // We have up to 16 outputs, each is encoded into 2 bits, total 32 bits: |
| 563 // the lowest 2 bits for location 0, the highest 2 bits for location 15. | 572 // the lowest 2 bits for location 0, the highest 2 bits for location 15. |
| 564 uint32_t fragment_output_type_mask_; | 573 uint32_t fragment_output_type_mask_; |
| 565 // Same layout as above, 2 bits per location, 0x03 if a location is occupied | 574 // Same layout as above, 2 bits per location, 0x03 if a location is occupied |
| 566 // by an output variable, 0x00 if not. | 575 // by an output variable, 0x00 if not. |
| 567 uint32_t fragment_output_written_mask_; | 576 uint32_t fragment_output_written_mask_; |
| 577 |
| 578 // Vertex input variable base types: FLOAT, INT, or UINT. |
| 579 // We have up to 16 inputs, each is encoded into 2 bits, total 32 bits |
| 580 uint32_t vertex_input_type_mask_; |
| 581 // Same layout as above, 2 bits per location, 0x03 if a location is occupied |
| 582 // by an input variable, 0x00 if not. |
| 583 uint32_t vertex_input_written_mask_; |
| 568 }; | 584 }; |
| 569 | 585 |
| 570 // Tracks the Programs. | 586 // Tracks the Programs. |
| 571 // | 587 // |
| 572 // NOTE: To support shared resources an instance of this class will | 588 // NOTE: To support shared resources an instance of this class will |
| 573 // need to be shared by multiple GLES2Decoders. | 589 // need to be shared by multiple GLES2Decoders. |
| 574 class GPU_EXPORT ProgramManager { | 590 class GPU_EXPORT ProgramManager { |
| 575 public: | 591 public: |
| 576 ProgramManager(ProgramCache* program_cache, | 592 ProgramManager(ProgramCache* program_cache, |
| 577 uint32_t max_varying_vectors, | 593 uint32_t max_varying_vectors, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 }; | 677 }; |
| 662 | 678 |
| 663 inline const FeatureInfo& Program::feature_info() const { | 679 inline const FeatureInfo& Program::feature_info() const { |
| 664 return *manager_->feature_info_.get(); | 680 return *manager_->feature_info_.get(); |
| 665 } | 681 } |
| 666 | 682 |
| 667 } // namespace gles2 | 683 } // namespace gles2 |
| 668 } // namespace gpu | 684 } // namespace gpu |
| 669 | 685 |
| 670 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 686 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
| OLD | NEW |