Use type conversion machinery when processing expr lists for initializers.
Once we're down to something that's not another nested expr list, use TypeConvertExpr() to convert the expression to the type we need. This should allow simplifying a number of the GetConstant() implementations, to remove partial reimplementation of type conversion there. For now, this change finishes off issue #220.
This commit is contained in:
28
tests/func-ptr-initializer.ispc
Normal file
28
tests/func-ptr-initializer.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
typedef float (*func)();
|
||||
|
||||
float foo();
|
||||
float bar();
|
||||
|
||||
struct X { func f, g; };
|
||||
|
||||
static uniform X x = { foo, &bar };
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
RET[programIndex] = x.f() + x.g();
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = programIndex;
|
||||
}
|
||||
|
||||
float foo() {
|
||||
return 2 * programIndex;
|
||||
}
|
||||
|
||||
float bar() {
|
||||
return -programIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user