简体   繁体   中英

how to block the command "clEnqueueFillImage",which don't have the blocking argument?

In the source code of funciton "clEnqueueFillImage",it want to blocking the command but I don't figure out how to blocking it without the blocking argument?

{
     iResult = OCL_Flush(psCommandQueue);
     if (iResult != CL_SUCCESS)
     {
          PVR_DPF((PVR_DBG_ERROR, "Failed implicit flush before blocking write."));
          goto exit;
    }
}```

clEnqueueFillImage , like many other functions in OpenCL, has and event out parameter. From the documentation:

Returns an event object that identifies this particular write command and can be used to query or queue a wait for this particular command to complete. event can be NULL in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete.

So you could simply use the returned event:

cl_event sync_event{};
CL_CHECK_ERROR(clEnqueueFillImage(... , &sync_event);
CL_CHECK_ERROR(clWaitForEvents(1, &sync_event));

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