Support (dummy) o7-o15 output registers in vertex shaders

This commit is contained in:
fincs 2017-03-18 00:46:37 +01:00
parent 4c7129925d
commit 0d03822d0a
2 changed files with 11 additions and 3 deletions

View File

@ -229,12 +229,17 @@ struct DVLEData
bool usesGshSpace() { return isGeoShader && !isCompatGeoShader; } bool usesGshSpace() { return isGeoShader && !isCompatGeoShader; }
int findFreeOutput() int findFreeOutput()
{ {
for (int i = 0; i < 7; i ++) for (int i = 0; i < maxOutputReg(); i ++)
if (!(outputMask & BIT(i))) if (!(outputMask & BIT(i)))
return i; return i;
return -1; return -1;
} }
int maxOutputReg() const
{
return isGeoShader ? 0x07 : 0x10;
}
DVLEData(const char* filename) : DVLEData(const char* filename) :
filename(filename), entrypoint("main"), filename(filename), entrypoint("main"),
nodvle(false), isGeoShader(false), isCompatGeoShader(false), isMerge(false), nodvle(false), isGeoShader(false), isCompatGeoShader(false), isMerge(false),

View File

@ -737,7 +737,7 @@ static int parseReg(char* pos, int& outReg, int& outSw, int* idxType = NULL)
switch (*pos) switch (*pos)
{ {
case 'o': // Output registers case 'o': // Output registers
if (outReg < 0x00 || outReg >= 0x07) if (outReg < 0x00 || outReg >= GetDvleData()->maxOutputReg())
return throwError("invalid output register: %s\n", pos); return throwError("invalid output register: %s\n", pos);
break; break;
case 'v': // Input attributes case 'v': // Input attributes
@ -1797,7 +1797,7 @@ DEF_DIRECTIVE(out)
if (outDestRegName) if (outDestRegName)
{ {
ARG_TO_REG(outDestReg, outDestRegName); ARG_TO_REG(outDestReg, outDestRegName);
if (outDestReg < 0x00 || outDestReg >= 0x07) if (outDestReg < 0x00 || outDestReg >= dvle->maxOutputReg())
return throwError("invalid output register: %s\n", outDestRegName); return throwError("invalid output register: %s\n", outDestRegName);
oid = outDestReg; oid = outDestReg;
sw = outDestRegSw; sw = outDestRegSw;
@ -1831,6 +1831,9 @@ DEF_DIRECTIVE(out)
if (outName && g_aliases.find(outName) != g_aliases.end()) if (outName && g_aliases.find(outName) != g_aliases.end())
return duplicateIdentifier(outName); return duplicateIdentifier(outName);
if (oid >= 7 && type != OUTTYPE_DUMMY)
return throwError("this register (o%d) can only be a dummy output\n", oid);
#ifdef DEBUG #ifdef DEBUG
printf("output %s <- o%d (%d:%X)\n", outName, oid, type, mask); printf("output %s <- o%d (%d:%X)\n", outName, oid, type, mask);
#endif #endif