You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I work on an application which uses both OpenGL and OpenCL, and relies a bit on interop between them.
The worst part of it is: when application starts, it checks for GL/CL extension and runs a simple diagnostic to verify that it indeed works properly. Right now this totally breaks replaying for me, even though I'm not interested in debugging any parts which actually use OpenCL.
It is clear that apitrace does not create OpenCL context and ignores all OpenCL calls, so any data getting from CL into GL is wrong. But the problem is that one interop function is in OpenGL: it is glCreateSyncFromCLeventARB from extension GL_ARB_cl_event. Apitrace honestly records this call to the trace, but fully skips it during replay. As the result, replay lacks a sync object which is used in subsequent GL calls that apitrace does replay... and crashes.
I know this is not something supported by apitrace, but maybe it's possible to avoid this crash with a simple fix?
Some ideas:
Replay glCreateSyncFromCLeventARB, but call glFenceSync instead of original function. That would create a sync object which can be waited for and deleted. I think it should be fine in any GL calls that application can use with it. I have a working prototype of this.
In all calls accepting sync object, skip the call if sync object does not exist. It's a matter of checking the result of std::map access. But I'm afraid the number of such calls can be pretty large.
Blacklist GL_ARB_cl_event during recording. If an application checks for availability of this extension, then it will skip the code path which uses it. If it does not... that's its own problem then.
The text was updated successfully, but these errors were encountered:
Ideas 1 and 3 sound good to me. Idea 1 has the advantage of not interfering with recording. Feel free to polish it up and post a PR.
BTW, what about other kinds of objects shared between OpenCL and OpenGL APIs, like buffers/textures? I'd expect any application which uses these two APIs to share some objects like this.
For the record, Direct3D APIs has similar issues, not with OpenCL but with interprocess communication, and we generally try to compensate like in your idea 1. One thing d3dretrace does, for example, is to replace a shared resource with a checker board texture. Obviously it won't give the same output, but at least the output is recognizable, and above all, it's not undefined (ie, unitialized data.)
As far as I understand, sharing buffers and images is done from OpenCL side.
Using cl_khr_gl_sharing, you can "import" GL resources into CL, and then use CL to fill them with your data.
Since these are CL calls, apitrace does not record them, and thus cannot replay.
During replay, I suppose the objects won't get filled with real data and will be left with black/garbage contents instead.
To me, it looks like the best / close-to-best outcome.
Replacing with checkerboard would be nice, but I'm afraid without a GL call in recorded trace it can't be done.
For some reason, GL_ARB_cl_event is the only interop extension that is on GL side.
I work on an application which uses both OpenGL and OpenCL, and relies a bit on interop between them.
The worst part of it is: when application starts, it checks for GL/CL extension and runs a simple diagnostic to verify that it indeed works properly. Right now this totally breaks replaying for me, even though I'm not interested in debugging any parts which actually use OpenCL.
It is clear that apitrace does not create OpenCL context and ignores all OpenCL calls, so any data getting from CL into GL is wrong. But the problem is that one interop function is in OpenGL: it is
glCreateSyncFromCLeventARB
from extensionGL_ARB_cl_event
. Apitrace honestly records this call to the trace, but fully skips it during replay. As the result, replay lacks a sync object which is used in subsequent GL calls that apitrace does replay... and crashes.I know this is not something supported by apitrace, but maybe it's possible to avoid this crash with a simple fix?
Some ideas:
The text was updated successfully, but these errors were encountered: