Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In addition to the answer by ggrussel I have made the following steps that give me an acceptable syntax highlighting while avoiding other problems with eclipse (tested for Kepler).</p> <ol> <li><p>Create a header file that is included in all CL files. The header file should have guarded defines for keywords and fake structures for built-in datatypes. </p> <pre><code>#ifndef __OPENCL_VERSION__ #define kernel #define global #define constant #define local typedef struct float2 { float x, y; } float2; typedef struct float3 { float x, y, z; float2 xy, xz, yx, yz, zx, zy; } float3; typedef struct float4 { float x, y, z, w; float2 xy, yx; float3 xyz, xzy, yxz, yzx, zxy, zyx; } float4; ... etc #endif </code></pre> <p>Note that you need to define every possible combination of accesses to the primitive datatypes as if they where their own fields. Since this may become quite lengthy for the larger primites such as vec8, you may want to automatically pre-generate these fields with some script if you use such primitives. </p></li> <li><p>In workspace settings (Window>Preferences) add a new filetype under C/C++ > File Types. Use *.cl as the pattern and C++ <strong>Source</strong> File as type. </p></li> <li>Exclude all *.cl files from the actual build, right clicking on the file > properties > C/C++ Build > Settings > Exclude from build. </li> </ol> <p>Note that after doing these changes you may need to close and re-open the CL files before the editor highlights them correctly. </p> <p>An example of a CL file that compiles under OpenCL and that is correctly highlighted and shows swizzling:</p> <pre><code>#include "eclipseFakeOpenCL.h" kernel void nextIntersect() { float4 a,b; a.xzy = (float3)(1.0, 1.0, 0.0); b.xy = a.yx; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload