spectral

Mimics "va_list" in OpenCL

Discussion created by spectral on Mar 18, 2011
Latest reply on Mar 23, 2011 by rick.weber

Hi,

I would like to be able to write some methods like this. I need a way to manage "dynamic parameters" like we do with va_list ...

I know that internally you do this (with printf) but can we use this feature in OpenCL kernels ?

 

Thanks

 

Shading() { floaf f = Integrate(scene, 0, Kd); } float4 Integrate(Scene* scene, int type, ...) { float4 f; switch(type) { case 0: f = closure_diffuse(scene, ...); break; case 1: f = closure_refraction(scene, ...); break; case 2: f = closure_reflection(scene, ...); break; } return f; } closure_diffuse(scene, float4 Kd) { } closure_refraction(scene, float eta) { } closure_reflection(scene, float etai, float etao) { }

Outcomes