cogciprocate / ocl

OpenCL for Rust
Other
721 stars 75 forks source link

improvement for subbuffer #204

Open aleksander-mendoza opened 3 years ago

aleksander-mendoza commented 3 years ago

Hey, I think you might like this improvement. At least I'd really love this being added, because without it the API is not safe and can crash when someone attempts to build sub-buffer of sub-buffer

c0gent commented 1 year ago

Apologies for not responding to this sooner.

It's been a while since I've looked at this code. Any chance you could explain your changes?

After this much time you've probably forgotten too. Either way no worries and thanks anyway :)

aleksander-mendoza commented 1 year ago

This code caused crashes. It's been long time and I don't have the code that could reproduce this anymore but essentially if you try to make subbuffer of a subbuffer then core::create_sub_buffer calls some illegal operation and crashes (tried on OS X). My fix checks for this scenario and runs the correct sequence of functions. Instead of making subbuffer of subbuffer it creates a subbufer of the parent buffer with the appropriate offset being sum of parent offset and new subbufer offset.

c0gent commented 1 year ago

Ok thanks much.