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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 | 392 |
393 // See member declaration for details. | 393 // See member declaration for details. |
394 // The data are only valid after a successful link. | 394 // The data are only valid after a successful link. |
395 uint32_t fragment_output_type_mask() const { | 395 uint32_t fragment_output_type_mask() const { |
396 return fragment_output_type_mask_; | 396 return fragment_output_type_mask_; |
397 } | 397 } |
398 uint32_t fragment_output_written_mask() const { | 398 uint32_t fragment_output_written_mask() const { |
399 return fragment_output_written_mask_; | 399 return fragment_output_written_mask_; |
400 } | 400 } |
401 | 401 |
402 // The data are only valid after a successful link. | |
403 uint32_t vertex_input_type_mask() const { | |
404 return vertex_input_type_mask_; | |
405 } | |
406 uint32_t vertex_input_written_mask() const { | |
407 return vertex_input_written_mask_; | |
408 } | |
409 | |
402 private: | 410 private: |
403 friend class base::RefCounted<Program>; | 411 friend class base::RefCounted<Program>; |
404 friend class ProgramManager; | 412 friend class ProgramManager; |
405 | 413 |
406 ~Program(); | 414 ~Program(); |
407 | 415 |
408 void set_log_info(const char* str) { | 416 void set_log_info(const char* str) { |
409 log_info_.reset(str ? new std::string(str) : NULL); | 417 log_info_.reset(str ? new std::string(str) : NULL); |
410 } | 418 } |
411 | 419 |
(...skipping 17 matching lines...) Expand all Loading... | |
429 | 437 |
430 // Resets the program. | 438 // Resets the program. |
431 void Reset(); | 439 void Reset(); |
432 | 440 |
433 // Updates the program info after a successful link. | 441 // Updates the program info after a successful link. |
434 void Update(); | 442 void Update(); |
435 void UpdateUniforms(); | 443 void UpdateUniforms(); |
436 void UpdateFragmentInputs(); | 444 void UpdateFragmentInputs(); |
437 void UpdateProgramOutputs(); | 445 void UpdateProgramOutputs(); |
438 void UpdateFragmentOutputBaseTypes(); | 446 void UpdateFragmentOutputBaseTypes(); |
447 void UpdateVertexInputBaseTypes(); | |
439 | 448 |
440 // Process the program log, replacing the hashed names with original names. | 449 // Process the program log, replacing the hashed names with original names. |
441 std::string ProcessLogInfo(const std::string& log); | 450 std::string ProcessLogInfo(const std::string& log); |
442 | 451 |
443 // Updates the program log info from GL | 452 // Updates the program log info from GL |
444 void UpdateLogInfo(); | 453 void UpdateLogInfo(); |
445 | 454 |
446 // Clears all the uniforms. | 455 // Clears all the uniforms. |
447 void ClearUniforms(std::vector<uint8_t>* zero_buffer); | 456 void ClearUniforms(std::vector<uint8_t>* zero_buffer); |
448 | 457 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 // glBindFragDataLocation() and ..IndexedEXT() calls. | 551 // glBindFragDataLocation() and ..IndexedEXT() calls. |
543 LocationIndexMap bind_program_output_location_index_map_; | 552 LocationIndexMap bind_program_output_location_index_map_; |
544 | 553 |
545 // Fragment output variable base types: FLOAT, INT, or UINT. | 554 // Fragment output variable base types: FLOAT, INT, or UINT. |
546 // We have up to 16 outputs, each is encoded into 2 bits, total 32 bits: | 555 // We have up to 16 outputs, each is encoded into 2 bits, total 32 bits: |
547 // the lowest 2 bits for location 0, the highest 2 bits for location 15. | 556 // the lowest 2 bits for location 0, the highest 2 bits for location 15. |
548 uint32_t fragment_output_type_mask_; | 557 uint32_t fragment_output_type_mask_; |
549 // Same layout as above, 2 bits per location, 0x03 if a location is occupied | 558 // Same layout as above, 2 bits per location, 0x03 if a location is occupied |
550 // by an output variable, 0x00 if not. | 559 // by an output variable, 0x00 if not. |
551 uint32_t fragment_output_written_mask_; | 560 uint32_t fragment_output_written_mask_; |
561 | |
562 // Vertex input variable base types: FLOAT, INT, or UINT. | |
563 // We have up to 16 inputs, each is encoded into 2 bits, total 32 bits | |
564 uint32_t vertex_input_type_mask_; | |
Zhenyao Mo
2016/07/20 17:54:56
Again, you will need to have arrays here. It can b
yunchao
2016/07/22 13:43:53
Done.
| |
565 // Same layout as above, 2 bits per location, 0x03 if a location is occupied | |
566 // by an input variable, 0x00 if not. | |
567 uint32_t vertex_input_written_mask_; | |
552 }; | 568 }; |
553 | 569 |
554 // Tracks the Programs. | 570 // Tracks the Programs. |
555 // | 571 // |
556 // NOTE: To support shared resources an instance of this class will | 572 // NOTE: To support shared resources an instance of this class will |
557 // need to be shared by multiple GLES2Decoders. | 573 // need to be shared by multiple GLES2Decoders. |
558 class GPU_EXPORT ProgramManager { | 574 class GPU_EXPORT ProgramManager { |
559 public: | 575 public: |
560 ProgramManager(ProgramCache* program_cache, | 576 ProgramManager(ProgramCache* program_cache, |
561 uint32_t max_varying_vectors, | 577 uint32_t max_varying_vectors, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 }; | 661 }; |
646 | 662 |
647 inline const FeatureInfo& Program::feature_info() const { | 663 inline const FeatureInfo& Program::feature_info() const { |
648 return *manager_->feature_info_.get(); | 664 return *manager_->feature_info_.get(); |
649 } | 665 } |
650 | 666 |
651 } // namespace gles2 | 667 } // namespace gles2 |
652 } // namespace gpu | 668 } // namespace gpu |
653 | 669 |
654 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 670 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
OLD | NEW |