|
7 | 7 | static const char* curFile = NULL; |
8 | 8 | static int curLine = -1; |
9 | 9 |
|
| 10 | +bool g_isGeoShader = false; |
10 | 11 | std::vector<u32> g_outputBuf; |
11 | 12 |
|
12 | 13 | StackEntry g_stack[MAX_STACK]; |
@@ -561,9 +562,12 @@ static int parseReg(char* pos, int& outReg, int& outSw, int* idxType = NULL) |
561 | 562 | switch (*pos) |
562 | 563 | { |
563 | 564 | case 'o': // Output registers |
564 | | - case 'v': // Input attributes |
565 | 565 | if (outReg < 0x00 || outReg >= 0x08) |
566 | | - return throwError("invalid input/output register: %s(%d)\n", pos); |
| 566 | + return throwError("invalid output register: %s(%d)\n", pos); |
| 567 | + break; |
| 568 | + case 'v': // Input attributes |
| 569 | + if (outReg < 0x00 || outReg >= 0x0F) |
| 570 | + return throwError("invalid input register: %s(%d)\n", pos); |
567 | 571 | break; |
568 | 572 | case 'r': // Temporary registers |
569 | 573 | outReg += 0x10; |
@@ -805,6 +809,46 @@ DEF_COMMAND(formatmova) |
805 | 809 | return 0; |
806 | 810 | } |
807 | 811 |
|
| 812 | +static inline int parseSetEmitFlags(char* flags, bool& isPrim, bool& isInv) |
| 813 | +{ |
| 814 | + isPrim = false; |
| 815 | + isInv = false; |
| 816 | + if (!flags) |
| 817 | + return 0; |
| 818 | + |
| 819 | + mystrtok_pos = flags; |
| 820 | + while (char* flag = mystrtok_spc(NULL)) |
| 821 | + { |
| 822 | + if (stricmp(flag, "prim")==0 || stricmp(flag, "primitive")==0) |
| 823 | + isPrim = true; |
| 824 | + else if (stricmp(flag, "inv")==0 || stricmp(flag, "invert")==0) |
| 825 | + isInv = true; |
| 826 | + else |
| 827 | + throwError("unknown setemit flag: %s\n", flag); |
| 828 | + |
| 829 | + } |
| 830 | + return 0; |
| 831 | +} |
| 832 | + |
| 833 | +DEF_COMMAND(formatsetemit) |
| 834 | +{ |
| 835 | + NEXT_ARG(vtxIdStr); |
| 836 | + NEXT_ARG_OPT(flagStr, NULL); |
| 837 | + ENSURE_NO_MORE_ARGS(); |
| 838 | + |
| 839 | + ARG_TO_INT(vtxId, vtxIdStr, 0, 3); |
| 840 | + bool isPrim, isInv; |
| 841 | + safe_call(parseSetEmitFlags(flagStr, isPrim, isInv)); |
| 842 | + |
| 843 | +#ifdef DEBUG |
| 844 | + printf("%s:%02X vtx%d, %s, %s\n", cmdName, opcode, vtxId, isPrim?"true":"false", isInv=?"true":"false"); |
| 845 | +#endif |
| 846 | + BUF.push_back(FMT_OPCODE(opcode) | ((u32)isInv<<22) | ((u32)isPrim<<23) | (vtxId<<24)); |
| 847 | + g_isGeoShader = true; |
| 848 | + |
| 849 | + return 0; |
| 850 | +} |
| 851 | + |
808 | 852 | DEF_COMMAND(formatcall) |
809 | 853 | { |
810 | 854 | NEXT_ARG(procName); |
@@ -967,6 +1011,7 @@ static const cmdTableType cmdTable[] = |
967 | 1011 | { |
968 | 1012 | DEC_COMMAND(NOP, format0), |
969 | 1013 | DEC_COMMAND(END, format0), |
| 1014 | + DEC_COMMAND(EMIT, format0), |
970 | 1015 |
|
971 | 1016 | DEC_COMMAND(ADD, format1), |
972 | 1017 | DEC_COMMAND(DP3, format1), |
@@ -1009,6 +1054,8 @@ static const cmdTableType cmdTable[] = |
1009 | 1054 | DEC_COMMAND(MADI, format5i), |
1010 | 1055 | DEC_COMMAND(MAD, format5), |
1011 | 1056 |
|
| 1057 | + DEC_COMMAND(SETEMIT, formatsetemit), |
| 1058 | + |
1012 | 1059 | { NULL, NULL }, |
1013 | 1060 | }; |
1014 | 1061 |
|
|
0 commit comments