OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkSLSPIRVCodeGenerator.h" | 8 #include "SkSLSPIRVCodeGenerator.h" |
9 | 9 |
10 #include "string.h" | 10 #include "string.h" |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 ABORT("unsupported SPIR-V op"); | 768 ABORT("unsupported SPIR-V op"); |
769 } | 769 } |
770 } | 770 } |
771 #endif | 771 #endif |
772 | 772 |
773 void SPIRVCodeGenerator::writeOpCode(SpvOp_ opCode, int length, std::ostream& ou
t) { | 773 void SPIRVCodeGenerator::writeOpCode(SpvOp_ opCode, int length, std::ostream& ou
t) { |
774 ASSERT(opCode != SpvOpUndef); | 774 ASSERT(opCode != SpvOpUndef); |
775 switch (opCode) { | 775 switch (opCode) { |
776 case SpvOpReturn: // fall through | 776 case SpvOpReturn: // fall through |
777 case SpvOpReturnValue: // fall through | 777 case SpvOpReturnValue: // fall through |
| 778 case SpvOpKill: // fall through |
778 case SpvOpBranch: // fall through | 779 case SpvOpBranch: // fall through |
779 case SpvOpBranchConditional: | 780 case SpvOpBranchConditional: |
780 ASSERT(fCurrentBlock); | 781 ASSERT(fCurrentBlock); |
781 fCurrentBlock = 0; | 782 fCurrentBlock = 0; |
782 break; | 783 break; |
783 case SpvOpConstant: // fall through | 784 case SpvOpConstant: // fall through |
784 case SpvOpConstantTrue: // fall through | 785 case SpvOpConstantTrue: // fall through |
785 case SpvOpConstantFalse: // fall through | 786 case SpvOpConstantFalse: // fall through |
786 case SpvOpConstantComposite: // fall through | 787 case SpvOpConstantComposite: // fall through |
787 case SpvOpTypeVoid: // fall through | 788 case SpvOpTypeVoid: // fall through |
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 this->writeWord(SpvVersion, out); | 2620 this->writeWord(SpvVersion, out); |
2620 this->writeWord(SKSL_MAGIC, out); | 2621 this->writeWord(SKSL_MAGIC, out); |
2621 std::stringstream buffer; | 2622 std::stringstream buffer; |
2622 this->writeInstructions(program, buffer); | 2623 this->writeInstructions(program, buffer); |
2623 this->writeWord(fIdCount, out); | 2624 this->writeWord(fIdCount, out); |
2624 this->writeWord(0, out); // reserved, always zero | 2625 this->writeWord(0, out); // reserved, always zero |
2625 out << buffer.str(); | 2626 out << buffer.str(); |
2626 } | 2627 } |
2627 | 2628 |
2628 } | 2629 } |
OLD | NEW |