Index regs can only be used with uniform regs (discovered by @Tilka)
This commit is contained in:
parent
d19c7b7cd0
commit
9aac60a683
@ -51,7 +51,7 @@ Registers may also be assigned additional names in order to make the code more l
|
||||
|
||||
For convenience, registers may be addressed using an offset from a known register. This is called indexing. For example, `c8[4]` is equivalent to `c12`; and `r4[-2]` is equivalent to `r2`. Indexing is useful for addressing arrays of registers (such as matrices).
|
||||
|
||||
Some source operands of instructions (called SRC1) support relative addressing. This means that it is possible to use one of the three built-in indexing registers (`a0`, `a1` and `a2` aka `lcnt`) to address a register, e.g. `someArray[lcnt]`. Adding an offset is also supported, e.g. `someArray[lcnt+2]`. This is useful in FOR loops.
|
||||
Some source operands of instructions (called SRC1) support relative addressing. This means that it is possible to use one of the three built-in indexing registers (`a0`, `a1` and `a2` aka `lcnt`) to address a register, e.g. `someArray[lcnt]`. Adding an offset is also supported, e.g. `someArray[lcnt+2]`. This is useful in FOR loops. Index registers can only be used with floating-point vector uniform registers, though.
|
||||
|
||||
Normal floating-point vector registers may also be negated by prepending a minus sign before it, e.g. `-r2` or `-someArray[lcnt+2]`.
|
||||
|
||||
|
@ -786,6 +786,8 @@ static int parseReg(char* pos, int& outReg, int& outSw, int* idxType = NULL)
|
||||
return throwError("invalid boolean uniform register: %s\n", pos);
|
||||
break;
|
||||
}
|
||||
if (idxType && *idxType && outReg < 0x20 || outReg >= 0x80)
|
||||
return throwError("index register not allowed with this kind of register\n");
|
||||
outReg += regOffset;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user