Hello,
I have no idea how I can do as follows opencl.cl [code]struct Sphere { int infoCode; double radius; double3 position, emission, color; ReflectionType refl; } __attribute__ ((packed)); enum ReflectionType { Diffuse = 0, Specular = 1, Refr = 2 } __attribute__ ((aligned (1))); __kernel void compute(__global struct Sphere *sp, ...) { // ... }[/code] Ok. I have found the julia3d demo and creates the class files for the struct. But - How I handle a enum? - Does jogamp support the vector types? e.g. float3 Thanks, Thomas |
Hi,
gluegen does not yet support non standard C types. But you could use the struct accessors of the julia3d example as template and implement it yourself. If you use the right offset and just create your own setters it should work just fine. StructAccessors are just a direct ByteBuffer with a few getters and setters. please file a bugreport or RFE if you have time. hope that helps, regards, michael On 08/01/2010 08:18 PM, Siassei [via jogamp] wrote: Hello, |
Thanks for your answer.
About gluegen. 1) It's generate files for 32 and 64. It's a little problem with OpenCL. OpenCL has fixed definied type size. For example, a integer is 32bit large. 2) Does gluegen support the __attributes__? About StructAccessor. Does it support the endian order? e.g host "little" and device "big" > gluegen does not yet support non standard C types Shit. The order of the components (xyzw) is depend on the endian of the device. See, Apendix B of OpenCL Spec 1.1 |
On 08/02/2010 06:32 PM, Siassei [via jogamp] wrote:
> Thanks for your answer. > > About gluegen. > 1) It's generate files for 32 and 64. It's a little problem with > OpenCL. OpenCL has fixed definied type size. For example, a integer is > 32bit large. int should be always 32bits wide. But all CPU dependent types like pointers use this feature. > 2) Does gluegen support the __attributes__? no. > > About StructAccessor. > Does it support the endian order? > e.g host "little" and device "big" this would require to bind the StructAccessor to a specific device. Otherwise jocl impl would have to change the endianess at runtime which could be inefficient. Answer is: not yet but is probably not that hard to generate another factory method. workaround: RenderingConfig config = RenderingConfig.create() if(device.isLittleEndian()) { config.getBuffer().order(ByteOrder.LITTLE_ENDIAN); }else{ config.getBuffer().order(ByteOrder.BIG_ENDIAN); } ... todo, something like: RenderingConfig config = RenderingConfig.createFor(device) > > > gluegen does not yet support non standard C types > Shit. The order of the components (xyzw) is depend on the endian of > the device. See, Apendix B of OpenCL Spec 1.1 gluegen does by default not know what a vector type like float3 is. Would be interesting to include cl_platform.h and see how the generated getter/setters look like (it will probably generate array accessors). thanks for your feedback, regards, michael |
Free forum by Nabble | Edit this page |