简体   繁体   中英

clSetKernelArg throwing EXC_BAD_ACCESS

I'm working through the HelloWorld example in the OpenCl Programming Guide and I keep getting an EXC_BAD_ACCESS when I try to run this function (clSetKernelArg). The look of my function is basically...

clSetKernelArg(mKernel, 0, sizeof(cl_mem), mMemObject[0]);

In the debugger everything looks to be instantiated. There's nothing null inside of the parenthesis and I'm all out of ideas. Any help would be greatly appreciated.

If you are going trough an OpenCL Hello World example I am almost certain that you do not have

cl_mem * mMemObject[foo]

That would be the only thing that would make the mMemObject[0] declaration legal. EXC_BAD_ACCESS implies that you are dereferencing an invalid pointer, and this implies that your mMemObject is just cl_mem.

This works if you have declared mMemObject simply with cl_mem mMemObject:

clSetKernelArg(mKernel, 0, sizeof(cl_mem), &mMemObject);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM