Files
ispc/tests/avg-down-uint8.ispc
Matt Pharr 5b20b06bd9 Add avg_{up,down}_int{8,16} routines to stdlib
These compute the average of two given values, rounding up and down,
respectively, if the result isn't exact.  When possible, these are
mapped to target-specific intrinsics (PADD[BW] on IA and VH[R]ADD[US]
on NEON.)

A subsequent commit will add pattern-matching to generate calls to
these intrinsincs when the corresponding patterns are detected in the
IR.)
2013-08-06 08:41:12 -07:00

14 lines
347 B
Plaintext

export uniform int width() { return programCount; }
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float bf) {
unsigned int8 a = aFOO[programIndex];
unsigned int8 b = bf;
RET[programIndex] = avg_down(a, b);
}
export void result(uniform float RET[]) {
RET[programIndex] = ((int)programIndex + 1 + 5) / 2;
}