Also you can query PROGRAM_ERROR_POSITION_ARB and PROGRAM_ERROR_STRING_ARB to get a hint of what’s wrong…doesn’t work all the time though, because sometimes you get very cryptic error messages…but then again, that might evolve in future driver releases.
Actually, the biggest problem is that ‘result’ is a keyword, so you’ll need another name for your TEMP register. I think this example was added to the ARB_vertex_program issues list before ‘result’ was made a keyword and the example wasn’t ever updated.
The last MUL is fine, since both operands are TEMP registers.
[edit - spelling]
[This message has been edited by secnuop (edited 09-24-2002).]
The last MUL is fine, since both operands are TEMP registers.
True, my mistake. Didn’t see he was declaring it with a TEMP statement before and I didn’t even notice that he didn’t write to result.position or something…ah well, guess I should drink a cup of coffee to wake up before posting
[This message has been edited by Asgard (edited 09-24-2002).]
The problem with this code is that “result” is not a valid variable name. “result” is also used for program result bindings (i.e., “result.position” holds the transformed vertex position, “result.color” the final color, and so on). We reserved it to simplify parsing.
As Asgard points out earlier, query VERTEX_PROGRAM_ERROR_POSITION_ARB and VERTEX_PROGRAM_ERROR_STRING_ARB.
The cryptic error string on the NVIDIA implementation should say “reserved keyword”, and the error position should point to the beginning of “result”.
My little programs usually do something like:
query errorPos;
if (errorPos != -1) {
int i;
query errorString;
printf(“Error: %s
“, errorString);
for (i = 0; i < errorPos; i++) {
putch(string[i]);
}
printf(”***”);
for (; i < stringLen; i++) {
putch(string[i]);
}
printf("
");
}
Pat (ARB_vertex_program spec editor)
[This message has been edited by pbrown (edited 09-24-2002).]
Originally posted by NitroGL: Now weather or not there are preformance issues with doing that, I don’t know.
There are no performance issues, except that maybe the parsing of the string will take a couple of microseconds longer
The OUTPUT statement simply aliases user-defined names with result registers and has no impact on the program execution on the GPU.
Also your program won’t compile as it has to be result.position.x (or some other result register) and not just result.x.
[edit - typos]
[This message has been edited by Asgard (edited 09-25-2002).]