We now follow C's approach of evaluating these: we don't evaluate the second expression in the operator if the value of the first one determines the overall result. Thus, these can now be used idiomatically like (index < limit && array[index] > 0) and such. For varying expressions, the mask is set appropriately when evaluating the second expression. (For expressions that can be determined to be both simple and safe to evaluate with the mask all off, we still evaluate both sides and compute the logical op result directly, which saves a number of branches and tests. However, the effect of this should never be visible to the programmer.) Issue #4.
22 lines
454 B
Plaintext
22 lines
454 B
Plaintext
|
|
export uniform int width() { return programCount; }
|
|
|
|
uniform int * uniform ptr;
|
|
|
|
uniform bool crash() {
|
|
return *ptr > 0;
|
|
}
|
|
|
|
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
|
float a = aFOO[programIndex];
|
|
float a0 = aFOO[0], a1 = aFOO[1];
|
|
if (a0 < a1 || crash())
|
|
RET[programIndex] = 1;
|
|
else
|
|
RET[programIndex] = 0;
|
|
}
|
|
|
|
export void result(uniform float RET[]) {
|
|
RET[programIndex] = 1;
|
|
}
|