Closed tgfrerer closed 9 years ago
Awesome work!
is ofxMSAPingPong not needed for the buffers and images though?
Tested the image example on OS X, and it works. I added an option to interactively reload the kernels from source upon SPACEBAR, which comes with my under-the-hood shared_ptr and memory management additions.
The image example, doesn't depend on ofxMSAPingPong currently.
hello world example now works on windows. (Dependency for NVIDIA cards: CUDA SDK 6.5)
Windows opengl / opencl interop finally appears to be working. Also, since camera grabber appears to be broken in current master, i added a public domain image for testing purposes.
There is still a kink in how nvidia's driver handles opencl code that's not 100% up to it's taste: the driver will just quit - i'm looking into what causes this currently.
all good. this is ready for review.
fixed a bug in openCL / openGL interop that affected the new managed openCL buffers. tested with particlesExample (windows).
Hey thanks for this, just going through and trying it out on mac (for now). The Hello World and Particles examples work fine, but image doesn't, I just get only one image showing (on the left), and the 2nd affected image which is supposed to be on the right just isn't showing up.
none of it worked! I haven't had much time to debug further as I need to rush out, but do you have any idea what it might be?
hi memo, just tested on my mac again, same machine as yours, albeit running Yosemite, and it runs. i've added a public domain image of a kitten with the right dimensions. Had to disable the video capture since video capture seems currently broken on windows.
Maybe do another pull from this PR, just to be sure to have the latest version.
ok weird, I had downloaded the latest version from your repo as a zip just before trying it, and it hadn't worked. I now deleted that and tried adding your repo as a remote to mine and merging into a new branch, and now the image example works. So that must have been a file corruption / messup error, all good there.
however FYI there was another minor issue :) None of my other opencl apps worked because of the API change, and I'm not keen on breaking backwards compatibility, especially when we don't really have to. Mainly removing
template<class T> bool setArg(int argNumber, T &arg)
and replacing it with
template<typename T> bool setArg(int argNumber, OpenCLBufferManagedT<T> &buf)
means that my app code breaks everytime I've sent a small struct (e.g. vec2, vec3 etc). It is nice to have a generic pointer setArg bool setArg(int argNumber, void* argp_, sizet size);
but I don't want to change all of my existing code to do that. So i've re-added my template function and made some minor mods to your stuff, so now both APIs work. i.e. you can send a struct, or a pointer, or a cl_mem, or a buffer, or a managed buffer.
you can see these changes in this commit if you are curious and can see anything potentially dangerous https://github.com/memo/ofxMSAOpenCL/commit/c61244b6e61d565721a36ccb50aa3ed0d82541e1
I'm now switching to windows to try there. over and out :)
i get the api consistency issue - and sending small structs up directly is definitely nice!
if i remember correctly, i had to (reluctantly) introduce this because the preprocessor was running into weird issues on vs2012 with the template being apparently too broad - maybe that's fixed now. let me know how it goes on windows.
ah man just wasted 5 hours (judging by the last comment on github) trying to get this to work, but to no avail :( I was going crazy.
It was compiling fine on windows and running, but when running just giving an "unspecified error" with a value of -1000! which isn't even documented anywhere! After hours of going crazy trying it figure out why I'm getting -1000 I found a few posts, including your post just above in the comments! I realized that the buffer was not going to your function but instead the templated function and therefore skipping your block checks.
I hacked some stuff to fix that (by renaming the function for the buffer, i.e. setArgBuffer), but then it started giving other errors. In short I don't think it's going to work on windows unless we rename it completely. So I have up on it and commented it out. instead created setArg overrides for vec2, vec3 and vec4. Isn't ideal but will work for now. If you have any ideas let me know.
my latest is now at https://github.com/memo/ofxMSAOpenCL/tree/dev (minor changes to yours)
Yes, that's pretty much what i ran into initially, (and the time it cost me to figure it out, too =) ).
It's weird to see how these subtle compiler toolchain differences can trip up templates. But it also shows the danger of open templates, if only for the headache they can introduce in debugging.
C++11 should give us some finer control over the preprocessor. There, I believe you can limit templates to classes of types - but how well different compiler toolchains implement/support this is another story.
An explanation for the difference between OS X and Windows could be that even on OS X, the original (open templated) implementation didn't feed into the buffer checks. Because Apple's OpenCL / OpenGL interop implementation seems a bit more lax about the standard and about having to lock interop objects, these missed buffer checks (at least on OS X) wouldn't immediately lead to OpenCL errors.
yup, you're probably right about the templated stuff.
I've now tested this on most of my apps on both windows and mac and all works fine, merged into master. thanks man.
sweet! shall we tweet about it to let the world know =) ?
haha yea, already did it :)
someone's tweeting faster than their shadow =) cheers!
This PR is ready to merge.