Using #include to load OpenCL code

后端 未结 2 1358
刺人心
刺人心 2021-01-03 00:43

I\'ve seen this done long ago with hlsl/glsl shader code -- using an #include on the source code file that pastes the code into a char* so that no

相关标签:
2条回答
  • 2021-01-03 01:17

    See the bullet physics engines use of OpenCL for how to do this to a kernel.

    In C++ / C source

    #define MSTRINGIFY(A) #A
    char* stringifiedSourceCL = 
    #include "VectorAddKernels.cl"
    

    In the OpenCL source

    MSTRINGIFY(
       __kernel void VectorAdd(__global float8* c)
       {
        // snipped out OpenCL code...
        return;
       }
    );
    
    0 讨论(0)
  • 2021-01-03 01:17

    According to this, it's not possible, but you can use xxd -i to archieve the same effect.

    0 讨论(0)
提交回复
热议问题