Add support for in-memory half float data. Fixes issue #10
This commit is contained in:
21
tests/half-1.ispc
Normal file
21
tests/half-1.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_v(uniform float RET[]) {
|
||||
float sum = 0;
|
||||
int errors = 0;
|
||||
for (uniform int i = 0; i <= 0xffff; ++i) {
|
||||
uniform unsigned int16 h = i;
|
||||
uniform float f = half_to_float(i);
|
||||
h = float_to_half(f);
|
||||
|
||||
// may return a different value back for NaNs..
|
||||
if (f == f && i != h)
|
||||
++errors;
|
||||
}
|
||||
RET[programIndex] = errors;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
21
tests/half.ispc
Normal file
21
tests/half.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_v(uniform float RET[]) {
|
||||
float sum = 0;
|
||||
int errors = 0;
|
||||
for (uniform int i = 0; i <= 0xffff; ++i) {
|
||||
unsigned int16 h = i;
|
||||
float f = half_to_float(i);
|
||||
h = float_to_half(f);
|
||||
|
||||
// may return a different value back for NaNs..
|
||||
if (f == f && i != h)
|
||||
++errors;
|
||||
}
|
||||
RET[programIndex] = errors;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user